AddAllToMap

Land Desktop Map 3D Samples

 
AddAllToMap
 
 
 

This method adds all of the features in a feature source to a map in the Map 3D drawing pane. The argument is a OSGeo.MapGuide.MgResourceIdentifier object, which identifies the feature source in the repository.

This method can handle a feature source which has many schema with each schema having many classes. All of the current sample feature sources have only one schema with only one class.

It does the following:

  1. Uses an OSGeo.MapGuide.MgFeatureService object to get the name the schema in the feature source, identified by the MgResourceIdentifier object.
  2. Uses the MgFeatureService object to get the name of the class in the schema.
  3. Use the MgFeatureService object to get the OSGeo.MapGuide.MgClassDefinition object for the class.
  4. Use the MgClassDefinition object to the name of the geometry property. If there is no geometry property then the procedure for creating a serialized, xml-formatted layer definition from a raster feature source is followed. See the topic CreateRasterLayerDefinitionXml. Otherwise the procedure for creating a serialized, xml-formatted layer definition from an SDF file is followed. See the topic CreateLayerDefinitionObject.
  5. Use the feature source name and the class name to create a unique name for the layer.
  6. Create an MgResourceIdentifier object with the unique layer name as the constructor’s argument.
  7. Convert the serialized xml-formatted layer definition into an array of bytes. This involves the use of MgByteSource and MgByteReader.
  8. Use the MgResourceService object to store xml-formatted layer definition in byte array form in the repository identified by the MgResourceIdentifier object cretaed in step 6.
  9. Create an OSGeo.MapGuide.MgLayerBase object with the layer definition MgResourceIdentifier object as one of the constructor’s arguments.
  10. Use a static method of the OSGeo.MapGuide.AcMapMap class to create an object representing the current map and then use this object to add the MgLayerBase object to the current map.