SpiderNetwork
When you enter the SpiderNetwork command on the Map command-line, you cause an instance of the SpiderNetwork class to be created and its RunSpiderNetwork method to be executed.
The RunSpiderNetwork method does the following:
- Prints SpiderNetwork... to the command-line.
- Connects to the SpiderNetwork\Data\crime.sdf file. This data store contains a set of points which represent the location of crimes. Each feature contains an integer field containing the feature id of a police station. This is described in the topic ConnectToSdfFile.
- Connects to the SpiderNetwork\Data\policestation.sdf file. This data store contains a set of points which represent the location of police station. This is described in the topic ConnectToSdfFile.
- Creates an sdf file in the local filesystem to hold the results and uses the Resource Service to give it an MgResourceIdentifier. This is described in the topic CreateSdfFile.
- Gets all of the features in the policestation.sdf and loops over them.
- Extracts the point geometry and feature id from the policestation feature.
- Gets all of the features in the crime.sdf data store whose PoliceStationResponded property value is equal to the policestation feature id, which is currently being read and loops over them.
- Extracts the point geometry from the crime feature currently being read and creates a LineString geometry whose start point is the police station point geometry and whose end point is the crime location point geometry.
- Uses the LineString geometry to create a geometry property and adds it to a property collection.
- Uses the police station feature id to create an integer property and adds it to the same property collection.
- Creates an MgInsertFeatures command for the feature in the property collection and adds the command to a feature command collection.
- Uses an MgFeatureService object to execute the command in the feature command collection to insert the feature into the results sdf file.
- Creates a layer for the police station features and adds this layer to the current map.
- Creates a layer for the crime location features and adds this layer to the current map.
- Creates a layer for the results features and adds this layer to the current map.