InspectorForm user control

Land Desktop Map 3D Samples

 
InspectorForm user control
 
 
 

The following are the actions taken by the InspectorForm user control in response to user input:

  • layerComboBox - SelectionChanged event

    This event is in response to the user selecting a layer from the layerComboBox control. It will set the internal variables so that the rest of the code only accesses those features in the layer specified. The list of all selected features are stored in the _featureItems array. Each layer’s features are contiguous within the array.

    1. If the user selected the “* All *” item, then the indexes are set so that all selected features can be accessed.
    2. Otherwise, it loops through _featureItems (the list of all selected features) until the first feature of the layer specified is found. The index for this first feature is set.
    3. It then loops through the remaining selected features until the last feature in the specified layer is found. The index for the last item is set.
    4. Calls the UpdateAttributeFields function. This function recreates the list of properties for the selected feature because different features have different numbers and kinds of properties. This function first gets the layer of the displayed feature, and then calls the GetLayerDefinition function to get the layer definition and the GetFeatureSource function to get the layer feature source id. It then loops though all properties of the displayed feature and calls AddAttributeField for each property.
    5. UpdateAttributeFields calls the AddAttributeField function. AddAttributeField adds a new row to the detailsGrid grid control and then places a label and (depending on the type of the feature property) a text box or combo box within the row.
    6. After the loop, UpdateAttributeFields calls the ResetButtonStatus function. ResetButtonsStatus modifies the enabled status of each of the navigation buttons in the InspectorForm control. It makes sure the user does not select the previous or next feature buttons if there are no previous or next features. It also disables the update and delete buttons if no features are selected.
  • deleteButton - Click event
    1. Gets the layer (as a MgLayerBase object) that the currently displayed feature belongs to.
    2. Creates a MgFeatureCommandCollection object and adds a delete command to the collection.
    3. Passes the command collection to the layer’s UpdateFeatures method.
    4. Deletes the feature from the _featureItems list of all selected features.
    5. Calls UpdateAttributeFields to correctly display the next selected feature, if one exists.
  • updateButton - Click event
    1. Create a MgPropertyCollection object to hold the properties that the user has modified.
    2. Obtains the PropertyList of the displayed property.
    3. Loops through all the properties displayed in the grid control. The property value shown in the grid row is compared to the previous property value. If it is different, the property value and type are stored in the MgPropertyCollection collection.
    4. Gets the layer (as a MgLayerBase object) that the currently displayed feature belongs to.
    5. Creates a MgFeatureCommandCollection object and adds a update command to the collection. The update command includes the MgPropertyCollection list of all changed properties.
    6. Passes the command collection to the layer’s UpdateFeatures method.
    7. Calls UpdateCacheValues with the MgPropertyCollection object as a parameter. UpdateCacheValues loops through all the modified properties held in the MgPropertyCollection object and sets the corisponding properties in the displayed feature to the new values.
  • previousButton, nextButton, firstButton, lastButton - Click events

    Sets the index to change which of the selected features is displayed. Calls the UpdateAttributeFields function to show the properties of the currently displayed feature.