[mapguide-users] Re: Mapguide JavaAjaxViewer Update Features Memory Leak?

ar_gaeta ar_gaeta at yahoo.it
Tue Dec 14 04:47:20 EST 2010


I don't know if this can help you, but I had a similar problem, trying to
select all features.
After open the map, you can rty:

map.Open(resourceSrvc, mapName);

//MY STRINGS:
MgFeatureQueryOptions queryOptions = new MgFeatureQueryOptions();
MgLayer layer = (MgLayer)map.GetLayers().GetItem(layername);
						
// Create a filter containing all the IDs of the features on this layer
String layerFeatureId = layer.GetFeatureSourceId();
String selectionString = "FeatId >= 0";			
			
MgResourceIdentifier layerFeatureResource = new
MgResourceIdentifier(layerFeatureId);
queryOptions.SetFilter(selectionString);
MgFeatureReader featureReader = layer.SelectFeatures(queryOptions);
MgPropertyCollection properties = new MgPropertyCollection();
properties.Add(new MgStringProperty("Name",name));
MgUpdateFeatures updateFeature1 = new MgUpdateFeatures(layername,
properties, selectionString);
MgFeatureCommandCollection commands = new MgFeatureCommandCollection();
commands.Add(updateFeature1);
			
featureService.UpdateFeatures(layerFeatureResource, commands, false);
//END


In this way you select all features based on the field "FeatID" (a Int32
that define univocally each element) and maybe the system take less time to
calculate, also because there is no WHILE cycle.
Try and let me know, maybe I've forgotten something...

Could I ask you 2 things?
1-why do you use "featureReader.GetPropertyCount()"? What it does? I need to
count all the objects in a layer: do you know maybe how to do?
2-you're working on SHP FDO Provider to update, I imagine, a shpfile. Do you
know how it's possible to "INSERT" a new object in a shpfile layer?

Thanks
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Mapguide-JavaAjaxViewer-Update-Features-Memory-Leak-tp5833542p5833954.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list