Hi,
I'm currently working on a solution where i provide the ability to open files from my map, i add icons to the map relating to the file that needs to be opened in the form of a pointstyle.
Each file has it's own layer with it's associated file icon applied.
I want to loop through each layer in the overlay and determine which icon was clicked on. I currently have the following code:
Dim overLay As LayerOverlay = Me.map1.Overlays(Overlays.DataFileOverLay)
For Each Layer As FeatureLayer In overLay.Layers
Dim clickedPointShape As PointShape = New PointShape(ClickedPosition.X, ClickedPosition.Y)
Dim selectedFeatures As System.Collections.ObjectModel.Collection(Of Feature) = Layer.QueryTools.GetFeaturesNearestTo(clickedPointShape, GeographyUnit.Meter, 1, ReturningColumnsType.AllColumns)
If selectedFeatures.Count > 0 Then
Dim dtscenafile As DTScenarioDataFile = selectedFeatures.Item(0).Tag
Dim rectang As RectangleShape = selectedFeatures.Item(0).GetBoundingBox
If rectang.Intersects(clickedPointShape) Then
'raiseevent
End If
End If
Next
The calling of GetFeaturesNearestTo in the code above always returns a file as each file has a layer of its own. To ensure that we a file that is in the position clicked i added a test for intersects but unless the user clicks on the exact point that the image was added then this always returns false.
How can i determine if the user has clicked on the point style on a layer if i have icons spread across many layers.
Thanks
Aaron