Apply A Buffer Operation To Features

Land Desktop Map 3D Samples

 
Apply A Buffer Operation To Features
 
 
 

This method takes four arguments: an MgResourceIdentifier object identifying the feature source, the name of a schema in the feature source, the name of a class in the schema, and an OSGeo.MapGuide.MgFeatureQueryOptions object. It returns an OSGeo.MapGuide.MgBatchPropertyCollection object. It does the following:

  1. Uses an MgFeatureService object and the four arguments to create an OSGeo.MapGuide.MgFeatureReader object containing the features specified by the MgFeatureQueryOptions object.
  2. Use the MgFeatureService object to create an OSGeo.MapGuide.MgClassDefinition object for the class identfied by the class name argument.
  3. Use the MgClassDefinition object to create an OSGeo.MapGuide.MgPropertyDefinitionCollection object containing all of the class’s property definitions.
  4. Get the property names from the OSGeo.MapGuide.MgPropertyDefinition objects in the MgPropertyDefinitionCollection object.
  5. Get the name of the default geometry property from the MgClassDefinition object and remove this name from the property names retrieved in the previous step.
  6. Create an MgBatchPropertyCollection object. This will hold the set of MgPropertyCollection objects, which are the result of applying the buffering operation to the geometries in the features in the MgFeatureReader object
  7. Loop through the MgFeatureReader object. For each feature do the following:
    • Create an MgPropertyCollection object containing all of the feature’s properties except the default geometry property.
    • Get the feature’s default geometry property and put it in an MgByteReader object.
    • Use an MgAgfReaderWriter object to convert the MgByteReader object to an MgGeometry object.
    • Apply a buffer operation to the MgGeometry object and store the results in a new MgGeometry object.
    • Use the MgAgfReaderWriter object to conver the new MgGeometry object to an MgByteReader object.
    • Use the MgByteReader object containing the buffered geometry to create an MgGeometryProperty object.
    • Add the MgGeometryProperty object to the MgPropertyCollection object extracted from the MgFeatureReader object.
    • Add the MgPropertyCollection object to the MgBatchPropertyCollection object.
  8. Return the MgBatchPropertyCollection object.