原文:
ArcGIS API for Silverlight 地图元素点闪烁,线流动显示的处理方式
<Grid x:Name="LayoutRoot" Background="White"> <!--地图资源样式模版--> <Grid.Resources> <!--预警闪烁标记符号--> <esri:MarkerSymbol x:Name="DefaultMarkerSymbol"> <esri:MarkerSymbol.ControlTemplate> <ControlTemplate> <Canvas> <vsm:VisualStateManager.VisualStateGroups> <vsm:VisualStateGroup x:Name="CommonStates"> <vsm:VisualState x:Name="Normal"> <Storyboard RepeatBehavior="Forever"> <DoubleAnimation BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" From="1" To="5" Duration="00:00:02" /> <DoubleAnimation BeginTime="0:0:0" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" From="1" To="5" Duration="00:00:02" /> <DoubleAnimation BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.Opacity)" From="1" To="0" Duration="00:00:02" /> </Storyboard> </vsm:VisualState> </vsm:VisualStateGroup> </vsm:VisualStateManager.VisualStateGroups> <Ellipse Height="25" Width="25" Canvas.Left="0" Canvas.Top="0" RenderTransformOrigin="0.5,0.5" x:Name="ellipse" IsHitTestVisible="False"> <Ellipse.RenderTransform> <ScaleTransform /> </Ellipse.RenderTransform> <Ellipse.Fill> <RadialGradientBrush> <GradientStop Color="#00FF0000" /> <GradientStop Color="#FFFF0000" Offset="0.25" /> <GradientStop Color="#00FF0000" Offset="0.5" /> <GradientStop Color="#FFFF0000" Offset="0.75" /> <GradientStop Color="#00FFFFFF" Offset="1" /> </RadialGradientBrush> </Ellipse.Fill> </Ellipse> <Ellipse Height="20" Width="20" Canvas.Left="0" Canvas.Top="0" Fill="#FFFFFFFF" x:Name="ellipse1" /> </Canvas> </ControlTemplate> </esri:MarkerSymbol.ControlTemplate> </esri:MarkerSymbol> <!--线层流动显示--> <esri:LineSymbol x:Key="CustomAnimatedRedLineSymbol"> <esri:LineSymbol.ControlTemplate> <ControlTemplate > <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"> <Storyboard RepeatBehavior="Forever"> <DoubleAnimation BeginTime="0:0:0" Storyboard.TargetName="Element" Storyboard.TargetProperty="StrokeDashOffset" To="1000" Duration="0:3:0" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Path x:Name="Element" StrokeDashArray="2,1" StrokeDashOffset="0" Stroke="Blue" StrokeThickness="2" /> </Grid> </ControlTemplate> </esri:LineSymbol.ControlTemplate> </esri:LineSymbol> </Grid.Resources> </Grid> //点闪烁 Graphic g = new Graphic() { Geometry = mercator.FromGeographic(new MapPoint(double.Parse(findResult.Latitute.ToString().Trim()), double.Parse(findResult.Longitute.ToString().Trim()))), Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as Symbol }; //线流动显示 Graphic g = new Graphic() { Geometry = mp, Symbol = LayoutRoot.Resources["RedMarkerSymbol"] as Symbol };