|
POST
|
I'm diving head first into learning some Java using ArcObjects. We have a Flow trace tool using a geometric network that we have written in C# and it works perfectly on the desktop and on server. I have had some pretty good success in porting most of the code over to Java, but I have hit a snag in trying to cast a FeatureDataset to a NetworkCollection. This is the working portion in C#. // Obtain a reference to the geometric network in the feature workspace
IFeatureDataset featureDataset = featureWorkspace.OpenFeatureDataset("sde.Sewerage_Network_Classes");
INetworkCollection networkCollection = (INetworkCollection)featureDataset;
IGeometricNetwork geometricNetwork = networkCollection.get_GeometricNetworkByName("sde.Sewerage_Network_Classes_Net");
INetwork network = geometricNetwork.Network; Looks pretty much the exact same in Java // Obtain a reference to the geometric network in the feature workspace
INetwork network = null;
INetSolver netSolver = null;
IGeometricNetwork geometricNetwork = null;
INetworkCollection networkCollection = null;
try
{
IFeatureDataset featureDataset = featureWorkspace.openFeatureDataset("sde.Sewerage_Network_Classes");
networkCollection = (INetworkCollection) featureDataset; // <-- this is where the error happens
geometricNetwork = networkCollection.getGeometricNetworkByName("sde.Sewerage_Network_Classes_Net");
}
catch(Exception e)
{
System.out.println("This error sucks!");
System.out.println(e.getMessage());
} I'm running my jUnit tests and catching the following error at the line indicated above. com.esri.arcgis.geodatabase.IFeatureDatasetProxy cannot be cast to com.esri.arcgis.geodatabase.INetworkCollection I'm using the same connection properties to connect to the SDE, using the default instance. I'm pretty much stumped at this point. Is there a nuance that I might be missing? Thanks in advance.
... View more
02-10-2011
06:07 AM
|
0
|
2
|
1098
|
|
POST
|
yeah, you'll want to exclude your .* files and folders from the svn because they will usually be machine specific and path dependant. So they won't play well across multiple machines. I have never used the fb.exportReleaseBuild, but this is probably going to be a FlashBuilder dependant tool. I have not checked to see if it's in the SDK folder or the FlashBuilder App folder. I have been using your very scenario for a couple of years now, svn->automated build. To get started, I would recommend the following walkthroughs. http://www.unitedmindset.com/jonbcampos/2010/01/07/using-ant-to-build-an-application/ http://www.unitedmindset.com/jonbcampos/2010/01/14/building-a-library-with-ant/ http://www.unitedmindset.com/jonbcampos/2010/01/19/building-the-html-wrapper-with-ant/ http://www.unitedmindset.com/jonbcampos/2010/01/20/building-a-custom-html-wrapper-with-ant/ http://www.unitedmindset.com/jonbcampos/2010/01/21/including-assets-files-with-ant/ http://www.unitedmindset.com/jonbcampos/2010/01/26/building-a-library-and-application-with-ant/ http://www.unitedmindset.com/jonbcampos/2010/01/28/building-asdocs-with-ant/ http://www.unitedmindset.com/jonbcampos/2010/02/09/the-master-flex-ant-file/ There are a couple of others that have to do with building FlexUnit tests with ANT, but you could find them in there. Now, I have not tried creating build scripts for Flexviewer, but ideally, I would invest the time into creating a build script per widget. This way, a co-worker can work on a widget, I could work on a widget and we could both run our widget specific build scripts without having to rebuild the whole project. So in a per widget ANT build scenario in your svn, you could have a master ANT build that would run each individual build file, while at the same time it should allow you to build the widgets independantly. Here is a sample of using ANT to compile modules. http://jvalentino.blogspot.com/2010/03/flex-ant-build-optimized-modules_24.html http://modular.theflexsite.net/blog/ant/build.xml
... View more
02-10-2011
05:07 AM
|
0
|
0
|
637
|
|
POST
|
I know it still works with the current Flex API as myself and others still use it, but I don't save remotely, so I'm not sure if that might be the issue. I let users save locally, so mine just looks like this. var bytes:ByteArray = _pdf.save(Method.LOCAL); fileReference.save(bytes, "map.pdf");
... View more
02-04-2011
08:26 AM
|
0
|
0
|
1216
|
|
POST
|
I maintain a library using the ESRI Flex API and I know that error all too well. Granted, this error will ONLY occur in Flex/FlashBuilder, I can successfully link my library files in IntelliJ and FDT withouth issue. Go figure. Anyway, in the Properties for your main project, add your library file (Add Project), make sure Link Type is RSL (runtime shared library). FlashBuilder will compile and link to the library swf. Now, here is the kicker. If you make any changes to your library file at all that force it to rebuild, you will need to remove the library project from your Main project and re-add it following the steps above. You'll need to do this every single time you update your library project. It's a horrible workaround, but I do it on a daily basis. I am really not a fan of Flashbuilder at all.
... View more
02-03-2011
11:56 AM
|
0
|
0
|
516
|
|
POST
|
Not too long ago someone had inquired about a Real Estate widget using Zillow or some other service on this forum. So, I had been wanting to try out some new API's and built a Zillow Widget for Flexviewer 2.x. http://www.arcgis.com/home/item.html?id=43a861b27c3a4463b23493d042974138 You will need to get your own Zillow API key from Zillow, which you can do for free. http://www.zillow.com/howto/api/APIOverview.htm Their API calls are pretty well documented and it's basically a lot of XML parsing. This widget was also built using Robotlegs once I realized that it was really going to be a more invloved module than I initially anticipated. If you wish to compile from source, you will need the Robotlegs .swc file which you can get from the official site. http://www.robotlegs.org/ I have tested some more extensive API calls to Zillow and I am pleasantly surprised that their servies are quick. You are limited to 1000 API calls per day, so if my sample application breaks, that is probably why. The latest source can be found on github https://github.com/odoe/Zillow-Widget I will update the zip file on the Resource center when new functionalities are complete. The github repo will probably have some incomplete features as I commit often while working. Any feedback is welcome, thank you. Update: (02/03/2011) - added search options for Regional Postings to include Property Types and Rentals.
... View more
02-02-2011
01:12 PM
|
0
|
11
|
3013
|
|
POST
|
If it's just the one name you're worried about you could do this var qName:String = qTextFname.text.toLowerCase(); var len:int = qName.length; var ucase:String = qName.charAt(0).toUpperCase(); var temp:String = qName.substr(1, len); var newName:String = ucase + temp; AS3 doesn't have a simple capitalize function. OOh, found a regex method to do it for multiple words http://stackoverflow.com/questions/860394/flex-capitalize-words-in-string
... View more
01-27-2011
08:07 AM
|
0
|
0
|
461
|
|
POST
|
I don't even remember what was in the core swc, but technically you could load the swf standalone in your app, but not sure what kind of interaction you were hoping to get with it from the rest of your application. I think you'd just need to load viewer into it's own domain to avoid conflicts. Not an elegant solution, but something you could probably play with.
... View more
01-27-2011
07:39 AM
|
0
|
0
|
755
|
|
POST
|
Todd, I can't answer with certainty in trying to compile the Flex API apps with CS3, but don't think it would work, or at least not easily. FlashDevelop is a free Flash/Flex IDE I have heard lots of good things about. http://www.flashdevelop.org/wikidocs/index.php?title=Main_Page
... View more
01-20-2011
01:36 PM
|
0
|
0
|
701
|
|
POST
|
There's a zillow api where you can sign up for an id to make REST requests to various web services. The results include a Lat/Long, so you could display them with the Flex API. There's a limit of 1000 per day though, after that I think you have to pay to make more requests.
... View more
01-19-2011
11:54 AM
|
0
|
0
|
254
|
|
POST
|
It wasn't up this morning when Robert posted, but I just submitted my widgets and seems to work fine. Is there a page where we can see what we submitted? Or will it just warn us that the link was already submitted? I only ask, because I almost submitted a widget twice while I had a dozen browser tabs open. Thanks and this is kind of fun.
... View more
01-19-2011
09:16 AM
|
0
|
0
|
1168
|
|
POST
|
There was a case Dasa before the latest release fixed the clearing lod issue where I could have probably worked around it by overriding the map_extentChangeHandler() of Map to check the given extent before doing a super.map_extentChangeHandler(). As far as I can tell, it's a private function.
... View more
01-13-2011
07:29 AM
|
0
|
0
|
682
|
|
POST
|
You can do that because FeatureLayer is a subclass of GraphicsLayer http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/FeatureLayer.html It inherits all the methods/fields of a GraphicsLayer, but some such as clear have been overriden so they don't do anything.
... View more
01-12-2011
07:53 AM
|
0
|
0
|
354
|
|
POST
|
FlexViewer can't natively load shapefile data, but someone made a widget that might help. http://www.arcgis.com/home/item.html?id=bc6a88cf51364d9ea767347954363d7d
... View more
01-12-2011
06:18 AM
|
0
|
0
|
335
|
|
POST
|
If you set up your xml config file to let you know the Layer type, "dynamic", "tiled", etc, you can iterate through your list, create layers, then iterate through the layers to get the layerinfos.
... View more
01-12-2011
06:04 AM
|
0
|
0
|
1573
|
|
POST
|
I have a widget with some functionality that can load services via a config.xml that might help. http://www.arcgis.com/home/item.html?id=ca9e4de998714d07a6bdc59ededa0efc
/**
* Takes URL for a ArcGIS Server Rest directory and
* will attempt to extract the SiteMap.
* @param directory
*/
protected function loadServices(servername:String):void
{
var service:HTTPService = new HTTPService();
var sitemap:String = "/ArcGIS/rest/services/?f=sitemap";
var url:String = "http://" + servername + sitemap;
service.url = url;
service.resultFormat = "e4x";
var token:AsyncToken = service.send();
token.addResponder(new AsyncResponder(onServiceResults_handler, onFault_handler));
}
/**
* Handles the results of accessing the SiteMap.
* @param event
* @param token
*/
protected function onServiceResults_handler(event:ResultEvent, token:Object = null):void
{
var xml:XML = event.result as XML;
var xmlColl:XMLListCollection = new XMLListCollection(xml.children());
var list:Array = [];
var qn:QName = new QName(sitemapNS, "loc");
var sxml:XML;
for each (sxml in xmlColl)
{
var url:String = sxml[qn].text();
var tmp:Array = url.split("/");
var i:uint = tmp.length;
if (tmp[i-1] == "MapServer")
{
var item:ServiceItem = new ServiceItem();
item.serverType = tmp[i-1];
item.name = tmp[i-2];
item.url = url;
list.push(item);
findServiceDetails(item);
}
}
list.sortOn("name");
dataList = new ArrayList(list);
vUrls = new Vector.<String>(list.length);
servicesList.dataProvider = dataList;
}
/**
* Parses <code>ServiceItem</code> object url to find layer details
* in service REST.
* @param item
*/
protected function findServiceDetails(item:ServiceItem):void
{
var jsonurl:String = "?f=json&pretty=false";
var url:String = item.url + jsonurl;
var srv:HTTPService = new HTTPService();
srv.url = url;
srv.resultFormat = "text";
var token:AsyncToken = srv.send();
token.addResponder(new mx.rpc.Responder(onJSONResult_handler, onFault_handler));
function onJSONResult_handler(event:ResultEvent):void {
var data:String = event.result.toString();
// this regex replace can be used to make parsing the JSON faster.
// It removes spaces, but it will mess up service description.
//data = data.replace( /\s/g, '' );
var details:Object = JSON.decode(data);
item.description = details["serviceDescription"];
if (!details["singleFusedMapCache"])
item.type = DYNAMIC;
else
item.type = TILED;
}
}
This will get you as far as loading the individual URL's for each service in a server, like "sampleserver1.arcgisonline.com", then you can create a layers using the URL and pull out the Layer info via layerInfos. I have a function for another tool that does just that.
/**
* Will find all the items that make up a given map service layer.
* @param lyr
*/
protected function findLayerDetails(lyr:Layer):void
{
if (layers)
layers.removeAll();
layers = new ArrayList();
var layerInfos:Array;
layerIDSet = null;
layerIDSet = {};
if (lyr is ArcGISDynamicMapServiceLayer)
layerInfos = ArcGISDynamicMapServiceLayer(lyr).layerInfos;
else if (lyr is ArcGISTiledMapServiceLayer)
layerInfos = ArcGISTiledMapServiceLayer(lyr).layerInfos;
else if (lyr is FeatureLayer) {
var lyrId:int = FeatureLayer(lyr).layerDetails.id;
var lyrName:String = FeatureLayer(lyr).layerDetails.name;
layerIDSet[lyrName] = lyrId;
layers.addItem(lyrName);
}
if (layerInfos)
{
var info:LayerInfo;
for each (info in layerInfos)
{
layerIDSet[info.name] = info.id;
layers.addItem(info.name);
}
}
}
... View more
01-12-2011
05:54 AM
|
0
|
0
|
1573
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | Wednesday | |
| 1 | 3 weeks ago | |
| 1 | 11-13-2025 03:13 PM | |
| 2 | 11-06-2025 11:10 AM | |
| 3 | 11-05-2025 02:54 PM |
| Online Status |
Online
|
| Date Last Visited |
an hour ago
|