ArcGIS API for Silverlight 查询点闪烁显示

简介: 主要样式如下代码段内所示: .......xmlns:esri="http://schemas.

主要样式如下代码段内所示:
<esri:MarkerSymbol x:Name="DefaultMarkerSymbol">
 ....
</esri:MarkerSymbol>


...
xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
...

<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="10" Duration="00:00:01" />

                                            <DoubleAnimation BeginTime="0:0:0" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" From="1" To="10" Duration="00:00:01" />

                                            <DoubleAnimation BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.Opacity)" From="1" To="0" Duration="00:00:01" />
                                        </Storyboard>
                                    </vsm:VisualState>

                                </vsm:VisualStateGroup>
                            </vsm:VisualStateManager.VisualStateGroups>
                            <Ellipse Height="10" Width="10" Canvas.Left="-5" Canvas.Top="-5" 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="#00FF0000" Offset="1" />
                                    </RadialGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                            <Ellipse Height="10" Width="10" Canvas.Left="-5" Canvas.Top="-5" Fill="#FFFF0000" x:Name="ellipse1" />
                        </Canvas>
                    </ControlTemplate>
                </esri:MarkerSymbol.ControlTemplate>
            </esri:MarkerSymbol>
</Grid.Resources>


private void UserControl_Loaded(object sender, RoutedEventArgs e)
{

     QueryTask queryTask = new QueryTask("http://192.168.2.5/arcgis/rest/services/AnHuiDynamic/MapServer/0");
     queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
     queryTask.Failed += QueryTask_Failed;

     ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query();
     query.ReturnGeometry = true;
     query.Text = conditions;
     query.OutSpatialReference = myMap.SpatialReference;
     query.OutFields.Add("NAME");
     queryTask.ExecuteAsync(query);      

}

 private void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
{
     FeatureSet featureSet = args.FeatureSet;
       
    GraphicsLayer graphicsLayer = myMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
    graphicsLayer.ClearGraphics();

    if (featureSet != null && featureSet.Features.Count > 0)
    {
        Graphic selectedFeature = featureSet.Features[0];

       // Highlight selected feature
       selectedFeature.Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
       graphicsLayer.Graphics.Add(selectedFeature);

       // Zoom to selected feature (define expand percentage)
       ESRI.ArcGIS.Client.Geometry.Envelope selectedFeatureExtent = selectedFeature.Geometry.Extent;

       double expandPercentage = 30;

      double widthExpand = selectedFeatureExtent.Width * (expandPercentage / 100);
       double heightExpand = selectedFeatureExtent.Height * (expandPercentage / 100);

       ESRI.ArcGIS.Client.Geometry.Envelope displayExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(
       selectedFeatureExtent.XMin - (widthExpand / 2),
       selectedFeatureExtent.YMin - (heightExpand / 2),
       selectedFeatureExtent.XMax + (widthExpand / 2),
       selectedFeatureExtent.YMax + (heightExpand / 2));

       myMap.ZoomTo(displayExtent);
     }
}

private void QueryTask_Failed(object sender, TaskFailedEventArgs args)
{
    MessageBox.Show("Query failed: " + args.Error);
}


效果如下图:


相关文章
ArcGIS:如何对要素类进行查询要素属性、更改符号、标记?
ArcGIS:如何对要素类进行查询要素属性、更改符号、标记?
1069 1
|
人工智能 数据可视化 API
ArcGIS API for Python
ArcGIS API for Python
360 0
|
数据可视化 数据管理 API
​​​​​​​ARCGIS API for Python进行城市区域提取
​​​​​​​ARCGIS API for Python进行城市区域提取
​​​​​​​ARCGIS API for Python进行城市区域提取
arcgis api 3.X 修改自带弹窗样式 2022年6月12日
自带的弹窗介绍: arcgis api 3.X 修改自带弹窗样式插图 /*修改原有弹窗的css样式*/ /* 弹窗整体 */ .esriPopup { font-size: 16px; box-shadow: 10px 10px 5px #888888; } .esriPopup .sizer { position: relative; width: 400px; /* 弹窗宽度 */ z-index: 1; } /* 标题部分 */ .esriPopup .titlePane { background-color: rgba(7
|
数据可视化 定位技术
ArcGIS应用基础1 数据显示、查询及可视化
😃在本文中,你将学会ArcGIS中数据查看、信息检索、要素符号化及要素标注的基本流程。
851 0
|
定位技术 Windows
ArcGIS:按属性选择要素、按位置选择要素、空间和属性的组合查询;属性表中长度、面积等的量算
ArcGIS:按属性选择要素、按位置选择要素、空间和属性的组合查询;属性表中长度、面积等的量算
1334 0
|
JavaScript 前端开发 应用服务中间件
Arcgis api for javascript 详细部署
Arcgis api for javascript 详细部署
636 0
|
人工智能 数据可视化 数据管理
ArcGIS API for Python
ArcGIS API for Python
395 0
|
JavaScript 前端开发 定位技术
ArcGIS API For JavaScript官方文档(六)之设置范围
ArcGIS API For JavaScript官方文档(六)之设置范围
|
存储 JSON 前端开发
ArcGIS API For JavaScript官方文档(一)之默认API配置
ArcGIS API For JavaScript官方文档(一)之默认API配置

热门文章

最新文章