This project is read-only.

ClearSelection and SpatialToolStrip Issues

Feb 1, 2011 at 10:08 PM

I am experiencing these issues.

Issue 1

When I add a project I have 2 layers. When I make a selection with the Map Layers item seleced, it grabs all the objects on all layers. The ClearSelection clears all the objects selected.

If a selection is made as described above and I now click on a layer in the legend, I make a selection. The previous selection (of all layers) has not been removed. The ClearSelection command will only clear the objects selected on the highlighted layer in the Legend. To clear all of the objects selected, I need to select the Map Layers in the legend and run the ClearSelection command again. Is this by design?

Issue 2

I have the SpatialToolStrip added and use the Zoom In function to zoom in to an area of the map. I now choose the Select function. Before I make a selection I switch the map function to Zoom In again, this time using a pull down I have created which changes the map mode to Zoom In. The Select icon in the SpatialToolStrip is still in the pressed mode because I used an alternative Zoom In method. I would like to go back to the Select mode by clicking on the Select icon in the SpatialToolStrip but because it is already in thet mode it will not switch to it.

Issue 3

I use the SpatialToolStrip to switch to the Measure Distance mode. I select some point on the screen and measuring begins. Now I click the X (close) on the Measure Distance form that popped up. The map mode is still in measure mode and the crosshairs still show. Clickin gon the screen now does nothing. The Measure Distance icon in the SpatialToolStrip is still selected. Clicking on it again does not change anything, the distance measure pop up does not appear even if I select more points on the screen. If I change the mode to Zoom In then select the Measure Distance again the measure distance dialog box is shown again as well as my previous points and lines from my last measurements.  Once again, if the Zoom In is selected from an alternate metho dother than the SpatialToolStrip, the Measure Distance Mode remains selected.

If the Measure Distance dialog box is closed using the X (close) in the top right, should the map measure mode not be ternminated? Also, if a the map mode function is changed other then by selecting the mode from the SpatialToolStrip, should the toolstrip not be updated as well, or at the minimum, have all the icons revery to unselected?

 

Feb 1, 2011 at 10:19 PM
Edited Feb 1, 2011 at 10:32 PM

To overcome Issue 2, I thought to clear all the selected items in the SpatialToolStrip prior to changing the map mode through a different method. The problem I face here is that both the Pressed and Selected methods are ReadOnly and cannot be done programetrically. Any ideas how to carry this out?

        Try

            Dim jk As Integer

            For jk = 0 To SpatialToolStrip1.Items.Count

                SpatialToolStrip1.Items(jk).Pressed = False

or

                SpatialToolStrip1.Items(jk).Selected = False

            Next

            Map1.ZoomToMaxExtent()

        Catch ex As Exception

        End Try

Feb 1, 2011 at 10:33 PM

To overcome Issue 1, I used the following to loop through the layers and clear them one by one. Is there a command to clear anything selected in the map, or is the solution below the way to do this?

Try

            For Each myLayer As IMapLayer In Map1.Layers

                Dim myFL As IFeatureLayer = TryCast(myLayer, IFeatureLayer)

                If myFL Is Nothing Then

                    Continue For

                End If

                myFL.Selection.Clear()

            Next

        Catch ex As Exception

        End Try