FindIntersect

Land Desktop Map 3D Samples

 
FindIntersect
 
 
 

When you enter the FindIntersect command on the Map command-line, you cause the FindIntersectCommand method to be executed. This method collects two command-line arguments from the user: the tolerance and the maximum number of intersections to return. It uses objects from the Autodesk.AutoCAD.EditorInput namespace to do this, namely, PromptDoubleOptions, PromptDoubleResult, PromptIntegerOptions, PromptIntegerResult, and Editor. It then creates an Implements object and calls its FindIntersections method passing in the tolerance and maximum number of intersections arguments. The tolerance is used to decide whether two points are close enough to be considered as intersecting, and the maximum number of intersections is used to limit how many intersections are reported.

The FindIntersections method does the following:

  1. Creates an AcMapMap object that contains the current map.
  2. Gets the MgLayerCollection object from the AcMapMap object.
  3. Verifies that there is only one MgLayerBase object in the MgLayerCollection object.
  4. Uses the MgLayerBase object to create an MgResourceIdentifier object identifying the feature source for the layer, that is, the Roads.sdf file.
  5. Uses an MgFeatureService object and the MgResourceIdentifier object to get the schema names from the feature source.
  6. Verifies that there is only one schema name.
  7. Uses an MgFeatureService object, the MgResourceIdentifier object and the schema name to get the class names from the feature source.
  8. Verifies that there is only one class in the schema.
  9. Finds the set of points that represent intersections between the end point of a LineString geometry and other LineString geometries in the layer. This is described in the topic Find Intersections.
  10. Uses classes from the OSGeo.FDO.Schema namespace to create a feature schema for the results of the find intersections operation, namely, FeatureSchema, FeatureClass, DataType, DataPropertyDefinition, and GeometricPropertyDefinition. The GeometricPropertyDefintion object is for the point geometry that identifies the intersection. There are two DataPropertyDefinition objects. One is used as an identity property, and the other for the number of LineString endpoints represented by the intersection point.
  11. Creates the Result.sdf file to hold the results returned by the FindIntersections method. This file has the feature schema created in the previous step and the coordinate system of the AcMapMap object. This is described in the topic CreateSdfFile.
  12. Creates an MgResourceIdentifier object that identifies the Result.sdf file. This is described in the topic ConnectToSdfFile.
  13. Uses an MgFeatureService object, the MgResourceIdentifier object identifying Result.sdf, the MgBatchPropertyCollection object returned by FindIntersections operation, an MgFeatureCommandCollection object, and an MgInsertFeatures object to insert the intersection results into the Result.sdf file.
  14. Adds the results returned by the FindIntersections operation as a layer in the current map. This is described in topic AddAllToMap. The set of intersections appear as little squares laid over the original road map.