ChangeSurfaceLayerStyle

Land Desktop Map 3D Samples

 
ChangeSurfaceLayerStyle
 
 
 

This method takes one argument, an MgLayerBase object. It assumes that the features in the layer are surfaces. It changes the color of the features. In particular, it does the following:

  1. Gets the schema and class names from the MgLayerBase object.
  2. Uses the MgLayerBase object to create an MgResourceIdentifier object for the feature source used to create the MgLayerBase object.
  3. Uses an MgFeatureService object, the MgResourceIdentifier object, and the schema and class names to get the MgClassDefinition object for the features in the MgLayerBase object.
  4. Gets the default geometry property name from the MgClassDefinition object.
  5. Gets an MgPropertyDefinitionCollection object from the MgClassDefinition object.
  6. Uses the default geometry property name to get the MgGeometricPropertyDefinition object from the MgPropertyDefinitionCollection object.
  7. Creates a serialized OSGeo.MapGuide.Schema.LayerDefinition.LayerDefinition object from the MgLayerBase object. This is described in topic CreateLayerDefinitionObject.
  8. Deserializes the string object returned in the previous step to create an actualLayerDefinition object.
  9. Extracts an OSGeo.MapGuide.Schema.LayerDefinition.VectorLayerDefinitionType object from the LayerDefinition object.
  10. Extracts an OSGeo.MapGuide.Schema.LayerDefinition.VectorScaleRange object from the VectorLayerDefinitionType object.
  11. Extracts an OSGeo.MapGuide.Schema.LayerDefinition.AreaRule object from the VectorScaleRange object.
  12. Extracts an OSGeo.MapGuide.Schema.LayerDefinition.Fill object from the AreaRule object.
  13. Changes the value of the foreground color attribute of the Fill object.
  14. Reserializes the LayerDefinition object as a string.
  15. Converts the string to an array of bytes.
  16. Converts the array of bytes to an MgByteSource object.
  17. Uses an MgResourceService object to updates the value of the modified MgLayerBase object in the Resource Service repository.
  18. Refreshes the current map with the newly changed MgLayerBase object.