Dim gpsNMEASentences As String = "$GPGGA, 92204.9, " & e.Result(recordcount).ELat & ", N," & e.Result(recordcount).ELon & ", W, 1, 04, 2.4, 25.7, M,,,,*75" Dim gpsNMEASentenceArray() As String = gpsNMEASentences.Split(ControlChars.Lf) Dim graphicsLayer As GraphicsLayer = TryCast(MyMap.Layers("MyGraphicsLayer"), GraphicsLayer) Dim gpsNMEASentence() As String = gpsNMEASentenceArray(0).Split(","c) '.Geometry = mercator.FromGeographic(New MapPoint(Convert.ToDouble(gpsNMEASentence(4)), Convert.ToDouble(gpsNMEASentence(2)))), Dim graphic As New Graphic() With { .Geometry = mercator.FromGeographic(New MapPoint(Convert.ToDouble(gpsNMEASentence(4)), Convert.ToDouble(gpsNMEASentence(2)))), .Symbol = TryCast(LayoutRoot.Resources(colourstyle), Symbol) } graphicsLayer.Graphics.Add(graphic) Dim textSymbol As New TextSymbol() With { .FontFamily = New System.Windows.Media.FontFamily("Arial"), .Foreground = New System.Windows.Media.SolidColorBrush(Colors.Black), .FontSize = 25, .Text = gpsNMEASentence(9) } Dim graphicText As New Graphic() With { .Geometry = mercator.FromGeographic(New MapPoint(Convert.ToDouble(gpsNMEASentence(4)), Convert.ToDouble(gpsNMEASentence(2)))), .Symbol = textSymbol } graphicsLayer.Graphics.Add(graphicText)
Solved! Go to Solution.
1.I am adding lot of picturemarker features on map in button clik based on some condition.Now i can see some of the features after dragging the map only.How can i see all feature collection without dragging?
MyMap.ZoomTo(graphicsLayer.FullExtent)
2.How can i clear all the existing features(picturemarker) in button click?
graphicsLayer.ClearGraphics() //or //graphicsLayer.Graphics.Clear()
lineGraphicsLayer.Renderer = New SimpleRenderer() With { _ Key .Symbol = New SimpleLineSymbol() With { _ Key .Color = New System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red), _ Key .Width = 3, _ Key .Style = SimpleLineSymbol.LineStyle.Solid _ } _ } Dim polyline = New Polyline() Dim pc = New PointCollection() For Each g As var In pointGraphicsLayer.Graphics Dim mp = TryCast(Geometry.Clone(TryCast(g.Geometry, MapPoint)), MapPoint) pc.Add(mp) Next polyline.Paths.Add(pc) lineGraphicsLayer.Graphics.Add(New Graphic() With { _ Key .Geometry = polyline _ })
<DataTemplate x:Key="MyFeatureLayerInfoWindowTemplate"> <TextBoxText="{Binding [STATE_NAME]}" Foreground="Black" FontSize="12" /> </DataTemplate>
<esri:Map MouseClick="MyMap_MouseClick" Extent="-120, 20, -100, 40" Grid.Row="3" Name="MyMap" Visibility="Visible" Background="Transparent" Margin="2,0" BorderThickness="1" BorderBrush="{StaticResource TitleBarGradient}"> <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" /> <esri:GraphicsLayer ID="MyGraphicsLayer" /> </esri:Map> <esri:InfoWindow x:Name="MyInfoWindow" Padding="2" CornerRadius="10" Map="{Binding ElementName=MyMap}" > <esri:InfoWindow.Background> <LinearGradientBrush EndPoint="1.038,1.136" StartPoint="0.015,0.188"> <GradientStop Color="#FFD1DFF2"/> <GradientStop Color="#FF092959" Offset="0.946"/> </LinearGradientBrush> </esri:InfoWindow.Background> </esri:InfoWindow>
1.I am adding lot of picturemarker features on map in button clik based on some condition.Now i can see some of the features after dragging the map only.How can i see all feature collection without dragging?
MyMap.ZoomTo(graphicsLayer.FullExtent)
2.How can i clear all the existing features(picturemarker) in button click?
graphicsLayer.ClearGraphics() //or //graphicsLayer.Graphics.Clear()
lineGraphicsLayer.Renderer = New SimpleRenderer() With { _ Key .Symbol = New SimpleLineSymbol() With { _ Key .Color = New System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red), _ Key .Width = 3, _ Key .Style = SimpleLineSymbol.LineStyle.Solid _ } _ } Dim polyline = New Polyline() Dim pc = New PointCollection() For Each g As var In pointGraphicsLayer.Graphics Dim mp = TryCast(Geometry.Clone(TryCast(g.Geometry, MapPoint)), MapPoint) pc.Add(mp) Next polyline.Paths.Add(pc) lineGraphicsLayer.Graphics.Add(New Graphic() With { _ Key .Geometry = polyline _ })
<DataTemplate x:Key="MyFeatureLayerInfoWindowTemplate"> <TextBoxText="{Binding [STATE_NAME]}" Foreground="Black" FontSize="12" /> </DataTemplate>
4.How can i set a maptip on eachpicture marker in buttonclick event? Like infowindow showing in featureservice popup sample.All sample mapti...
Status = e.Result(recordcount).EEventNameas information
Private Sub LastPositionFinalRunning(ByVal sender As Object, ByVal e As SelectLastPositionCompletedEventArgs) For recordcount = 0 To e.Result.Count - 1 'Dim geometry1 As New Point(csys, rsOman("lon"), rsOman("lat")) Dim Status As String = "" Dim EventId As Integer Dim colourstyle As String EventId = e.Result(recordcount).EEventID If EventId = 253 Then colourstyle = "GlobePictureSymbol_Blue" ElseIf EventId = 110 Then colourstyle = "GlobePictureSymbol_Green" ElseIf EventId = 108 Then colourstyle = "GlobePictureSymbol_Green" ElseIf EventId = 101 Then colourstyle = "GlobePictureSymbol_Red" ElseIf EventId = 142 Then colourstyle = "GlobePictureSymbol_Black" ElseIf EventId = 254 Then colourstyle = "GlobePictureSymbol_Gray" Else colourstyle = "GlobePictureSymbol_Black" End If Status = e.Result(recordcount).EEventName '************************* ''''''''''LOCATION FROM POI and Roaddata same connection not possible bfre close Dim procname As String = "" Dim location As String location = "" If e.Result(recordcount).EStreetAddress <> "NULL" And e.Result(recordcount).EStreetAddress <> "" Then location = e.Result(recordcount).ELocationName & ", STREET: " & e.Result(recordcount).EStreetAddress Else location = e.Result(recordcount).ELocationName & "" End If '''''''''''''''''''''''''' TxtLastUpd.Text = e.Result(recordcount).Edatedisplay Dim gpsNMEASentences As String = "$GPGGA, 92204.9, " & e.Result(recordcount).ELat & ", N," & e.Result(recordcount).ELon & ", W, 1, 04, 2.4, 25.7, M,,,,*75" Dim gpsNMEASentenceArray() As String = gpsNMEASentences.Split(ControlChars.Lf) Dim gpsNMEASentence() As String = gpsNMEASentenceArray(0).Split(","c) Dim graphic As New Graphic() With { .Geometry = mercator.FromGeographic(New MapPoint(Convert.ToDouble(gpsNMEASentence(4)), Convert.ToDouble(gpsNMEASentence(2)))), .Symbol = TryCast(LayoutRoot.Resources(colourstyle), Symbol) } Dim graphicsLayer As GraphicsLayer = TryCast(MyMap.Layers("MyGraphicsLayer"), GraphicsLayer) graphicsLayer.ClearGraphics() graphicsLayer.Graphics.Add(graphic) esriLogoImage.Visibility = Windows.Visibility.Collapsed MyMap.Visibility = Windows.Visibility.Visible MyMap.ZoomTo(graphicsLayer.FullExtent) 'map1.Center = New DPoint(rsOman("lon"), rsOman("lat")) 'Dim distance2 As MapInfo.Geometry.Distance = New MapInfo.Geometry.Distance(3, map1.Zoom.Unit) 'map1.Zoom = distance2 Next End Sub
graphic.MapTip = new MapTip();
<StackPanel Orientation="Vertical" Margin="10,10,10,10"> <TextBlock Text="{Binding [Name]}" Width="120" Height="20" TextAlignment="Center" FontWeight="SemiBold"/> <StackPanel Orientation="Horizontal" Margin="0,5,0,0"> <Controls:Label Content="Lattitude:" Margin="0,0,8,0"/> <TextBlock Text="{Binding [Lat]}" Width="60"/> </StackPanel> <StackPanel Orientation="Horizontal" Margin="0,5,0,0"> <Controls:Label Content="Longitude:" Margin="0,0,3,0"/> <TextBlock Text="{Binding [Lon]}" Width="60"/> </StackPanel> </StackPanel>