日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ArcGIS Server for Silverlight 之集群(Simple Clusterer)

發(fā)布時間:2025/5/22 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ArcGIS Server for Silverlight 之集群(Simple Clusterer) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
前臺代碼:
Code
<UserControl?x:Class="SimpleClusterer.MainPage"
????xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"?
????xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml"
????xmlns:d
="http://schemas.microsoft.com/expression/blend/2008"?xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"?
????xmlns:esri
="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"
?????????????xmlns:esriSymbols
="clr-namespace:ESRI.ArcGIS.Client.Symbols;assembly=ESRI.ArcGIS.Client"
?????????????xmlns:esriGeometry?
="clr-namespace:ESRI.ArcGIS.Client.Geometry;assembly=ESRI.ArcGIS.Client"
?????????????mc:Ignorable
="d"?d:DesignWidth="640"?d:DesignHeight="480">
??
<Grid?x:Name="LayoutRoot">
????????????
<esri:Map?x:Name="myMap"?ExtentChanged="myMap_ExtentChanged">
????????????
<esri:ArcGISTiledMapServiceLayer?x:Name="myTiledMapServiceLayer"
?????????????????????????????????????????????Url
="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
????????????
<esri:GraphicsLayer??ID="mygraphicslayer">
????????????
</esri:GraphicsLayer>
????????
</esri:Map>
????
</Grid>
</UserControl>

Code Behind C#
Code
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Net;
using?System.Windows;
using?System.Windows.Media;
using?System.Windows.Controls;
using?System.Windows.Documents;
using?System.Windows.Input;
using?System.Windows.Media.Animation;
using?System.Windows.Shapes;
using?ESRI.ArcGIS.Client;
using?ESRI.ArcGIS.Client.Symbols;
using?ESRI.ArcGIS.Client.Tasks;

namespace?SimpleClusterer
{
????
public?partial?class?MainPage?:?UserControl
????{
????????GraphicsLayer?graphicslayer?
=?null;
????????SimpleMarkerSymbol?simpleMarkerSymbol;
????????
public?MainPage()
????????{
????????????InitializeComponent();
????????????Init();
????????}
????????
void?Init()
????????{
???????????
????????????
//獲取Graphicslayer
????????????graphicslayer?=?myMap.Layers["mygraphicslayer"]?as?GraphicsLayer;

????????????GradientStopCollection?gradientStopColl?
=?new?GradientStopCollection();
????????????GradientStop?gstop1?
=?new?GradientStop();
????????????gstop1.Color?
=?Colors.Red;
????????????gstop1.Offset?
=?0;
????????????GradientStop?gstop2?
=?new?GradientStop();
????????????gstop2.Color?
=?Colors.Gray;
????????????gstop2.Offset?
=?0.25;
????????????GradientStop?gstop3?
=?new?GradientStop();
????????????gstop3.Color?
=?Colors.Black;
????????????gstop3.Offset?
=?0.5;
????????????GradientStop?gstop4?
=?new?GradientStop();
????????????gstop4.Color?
=?Colors.Blue;
????????????gstop4.Offset?
=?0.75;
????????????GradientStop?gstop5?
=?new?GradientStop();
????????????gstop5.Color?
=?Colors.Green;
????????????gstop5.Offset?
=?1;

????????????gradientStopColl.Add(gstop1);
????????????gradientStopColl.Add(gstop2);
????????????gradientStopColl.Add(gstop3);
????????????gradientStopColl.Add(gstop4);
????????????gradientStopColl.Add(gstop5);

????????????LinearGradientBrush?mylinearGradientBrush?
=?new?LinearGradientBrush(gradientStopColl,0);
????????????mylinearGradientBrush.MappingMode?
=?BrushMappingMode.RelativeToBoundingBox;

????????????
//初始化simpleMarkerSymbol
????????????SolidColorBrush?symbolBrush?=?new?SolidColorBrush(Colors.Purple);
????????????simpleMarkerSymbol?
=?new?SimpleMarkerSymbol();
????????????simpleMarkerSymbol.Size?
=?12;
????????????simpleMarkerSymbol.Style?
=?SimpleMarkerSymbol.SimpleMarkerStyle.Circle;
????????????simpleMarkerSymbol.Color?
=?symbolBrush;

????????????
//設(shè)置背景色
????????????SolidColorBrush?backbrush?=?new?SolidColorBrush(Colors.Yellow);
????????????
//設(shè)置前景色
????????????SolidColorBrush?forebrush?=?new?SolidColorBrush();
????????????forebrush.Color?
=?Color.FromArgb(99,?0,?0,?0);
????????????
//設(shè)置集群
????????????FlareClusterer?myflareClusterer?=?new?FlareClusterer();
????????????myflareClusterer.FlareBackground?
=?backbrush;
????????????myflareClusterer.FlareForeground?
=?forebrush;

????????????myflareClusterer.Radius?
=?10;
????????????myflareClusterer.MaximumFlareCount?
=?20;?//最大個數(shù)
????????????myflareClusterer.Gradient?=?mylinearGradientBrush;

????????????graphicslayer.Clusterer?
=?myflareClusterer;?
????????}

????????
void?LoadGraphic()
????????{
????????????QueryTask?querytask?
=?new?QueryTask();
????????????querytask.Url?
=?"http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0";
????????????querytask.ExecuteCompleted?
+=?new?EventHandler<QueryEventArgs>(querytask_ExecuteCompleted);

????????????Query?query?
=?new?Query();
????????????query.OutSpatialReferenceWKID?
=?myMap.SpatialReference.WKID;
????????????query.ReturnGeometry?
=?true;
????????????query.Where?
=?"1=1";

????????????querytask.ExecuteAsync(query);
????????}

????????
void?querytask_ExecuteCompleted(object?sender,?QueryEventArgs?e)
????????{
????????????FeatureSet?featureset?
=?e.FeatureSet;
????????????
if?(featureset?==?null?||?featureset.Features.Count?<?1)
????????????{
????????????????MessageBox.Show(
"No?features?retured?from?query");
????????????????
return;
????????????}
????????????
foreach?(Graphic?g?in?featureset.Features)
????????????{
????????????????g.Symbol?
=?simpleMarkerSymbol;
????????????????graphicslayer.Graphics.Add(g);
????????????}
????????}

????????
private?void?myMap_ExtentChanged(object?sender,?ExtentEventArgs?e)
????????{
????????????
if?(e.OldExtent?==?null)
????????????????LoadGraphic();
????????}

????}
}

效果圖:

轉(zhuǎn)載于:https://www.cnblogs.com/JinDin/archive/2009/09/29/1576556.html

《新程序員》:云原生和全面數(shù)字化實踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀

總結(jié)

以上是生活随笔為你收集整理的ArcGIS Server for Silverlight 之集群(Simple Clusterer)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。