Hi,
I'm using RadMap to load a simple ESRI shapefile containing points (described by latitude/longitude in associated dbf file).
I want to change the defaut icon used to draw the point (which is looking like a google map pin) to a single blue circle with a radius of one ou two pixel.
I want to change the color of the circle on mouse click for select it.
I tried to use VisualizationLayer.ShapeFill but it doesn't work.
Here is my code :
<UserControl x:Class="Example" xmlns:local="clr-namespace:POCMap" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> <UserControl.Resources> </UserControl.Resources> <DockPanel> <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" HorizontalAlignment="Center"> <Button Click="France_OnClick">France</Button> <Button Click="Roumanie_OnClick">Roumanie</Button> <Button Click="Yenne_OnClick">Yenne</Button> </StackPanel> <Grid DockPanel.Dock="Bottom"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <TextBlock Grid.Row ="0" Grid.Column="0">Latitude (°N)</TextBlock> <TextBox Grid.Row ="0" Grid.Column="1" x:Name="txtLatitude" KeyDown="TxtLatitudeLongitude_OnKeyDown"></TextBox> <TextBlock Grid.Row ="1" Grid.Column="0">Longitude (°E)</TextBlock> <TextBox Grid.Row ="1" Grid.Column="1" x:Name="txtLongitude" LostFocus="TxtLatitudeLongitude_OnLostFocus" KeyDown="TxtLatitudeLongitude_OnKeyDown"></TextBox> </Grid> <telerik:RadBusyIndicator Name="busyIndicator"> <telerik:RadMap x:Name="radMap" Center="40,-100" ZoomLevel="8" > <telerik:RadMap.Provider> <telerik:ArcGisMapProvider x:Name="prov" Mode="Aerial" /> </telerik:RadMap.Provider> <!--<telerik:InformationLayer x:Name="informationLayer"/>--> <telerik:VisualizationLayer x:Name="visualizationLayer" UseBitmapCache="False"> <telerik:VisualizationLayer.ZoomLevelGridList> <telerik:ZoomLevelGrid MinZoom="0" /> <telerik:ZoomLevelGrid MinZoom="9" /> <telerik:ZoomLevelGrid MinZoom="8" /> </telerik:VisualizationLayer.ZoomLevelGridList> <telerik:VisualizationLayer.ShapeFill> <telerik:MapShapeFill Fill="#6FDFEFFF" Stroke="Blue" StrokeThickness="2" /> </telerik:VisualizationLayer.ShapeFill> <telerik:VisualizationLayer.VirtualizationSource> <telerik:MapShapeDataVirtualizationSource x:Name="mapShapeDataVirtualizationSource"> <telerik:MapShapeDataVirtualizationSource.Reader> <!--<telerik:AsyncShapeFileReader Source="/POCMap;component/Resources/Time_Zones.shp" ToolTipFormat="Time Zone : {ZONE_}" /> --> <telerik:AsyncShapeFileReader x:Name="mapShapeDataReader" ToolTipFormat="Latitude : {latitude} / Longitude : {longitude}" ProgressChanged="OnProgressChanged" ReadShapeDataCompleted="OnReadShapeDataCompleted"/> </telerik:MapShapeDataVirtualizationSource.Reader> </telerik:MapShapeDataVirtualizationSource> </telerik:VisualizationLayer.VirtualizationSource> </telerik:VisualizationLayer> </telerik:RadMap> </telerik:RadBusyIndicator> </DockPanel></UserControl>
Imports System.Windows.ResourcesImports Telerik.Windows.Controls.MapPublic Class Example Public Sub New() ' Cet appel est requis par le concepteur. InitializeComponent() AddHandler Me.Loaded, AddressOf Page_Loaded ' Ajoutez une initialisation quelconque après l'appel InitializeComponent(). prov.Mode = ArcGisMapMode.Topographic radMap.Center = New Location(45.7, 5.75) radMap.ZoomLevel = 8 radMap.MaxZoomLevel=8 txtLatitude.Text = 45.7 txtLongitude.Text = 5.75 AddHandler Me.Loaded, AddressOf Me.ExampleLoaded End Sub Private Sub Page_Loaded(sender As Object, e As RoutedEventArgs) Me.mapShapeDataVirtualizationSource.ReadAsync() End Sub Private Sub TxtLatitudeLongitude_OnLostFocus(sender As Object, e As RoutedEventArgs) SetLocation() End Sub Private Sub TxtLatitudeLongitude_OnKeyDown(sender As Object, e As KeyEventArgs) If e.Key = Key.Enter Then SetLocation() End If End Sub Private Sub SetLocation() If txtLatitude.Text AndAlso txtLongitude.Text Then Dim latitude = CDbl(txtLatitude.Text) Dim longitude = CDbl(txtLongitude.Text) radMap.Center = New Location(latitude, longitude) End If End Sub Private Sub France_OnClick(sender As Object, e As RoutedEventArgs) radMap.Center = New Location(47.08, 2.39) radMap.ZoomLevel = 6 End Sub Private Sub Roumanie_OnClick(sender As Object, e As RoutedEventArgs) radMap.Center = New Location(44.94, 26.96) radMap.ZoomLevel = 6 End Sub Private Sub Yenne_OnClick(sender As Object, e As RoutedEventArgs) radMap.Center = New Location(45.7, 5.75) radMap.ZoomLevel = 13 End Sub Private Sub ExampleLoaded(sender As Object, e As RoutedEventArgs) Me.busyIndicator.IsIndeterminate = False Me.busyIndicator.IsBusy = True Me.mapShapeDataReader.Source = New Uri("/POCMap;component/Resources/0.25deg_grille_EU.shp", UriKind.Relative) End Sub Private Sub OnProgressChanged(sender As Object, e As System.ComponentModel.ProgressChangedEventArgs) Me.busyIndicator.ProgressValue = e.ProgressPercentage If e.ProgressPercentage >= 100 Then Me.busyIndicator.IsIndeterminate = True Me.busyIndicator.BusyContent = "Refresh layer" End If End Sub Private Sub OnReadShapeDataCompleted(sender As Object, e As Telerik.Windows.Controls.Map.ReadShapeDataCompletedEventArgs) If Me.busyIndicator IsNot Nothing Then Me.busyIndicator.IsBusy = False End If End SubEnd Class
Thanks for your help
Yoan
