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.
- Uses an OSGeo.MapGuide.MgFeatureService object to get the name the schema in the feature source, identified by the MgResourceIdentifier object.
- Uses the MgFeatureService object to get the name of the class in the schema.
- Use the MgFeatureService object to get the OSGeo.MapGuide.MgClassDefinition object for the class.
- 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.
- Use the feature source name and the class name to create a unique name for the layer.
- Create an MgResourceIdentifier object with the unique layer name as the constructor’s argument.
- Convert the serialized xml-formatted layer definition into an array of bytes. This involves the use of MgByteSource and MgByteReader.
- 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.
- Create an OSGeo.MapGuide.MgLayerBase object with the layer definition MgResourceIdentifier object as one of the constructor’s arguments.
- 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.