Наследование: System.Windows.DependencyObject, INotifyPropertyChanged
        internal static void DoFeatureRefresh(this DataGridRow row , Feature targetFeature , Type type)
        {
            object dataContext = row.DataContext;

            if (dataContext != null && type != null)
            {
                FieldInfo[] fldInfos = GetFldInfo(type);
                foreach (FieldInfo fldInfo in fldInfos)
                {
                    string key = fldInfo.Name.Substring(1);
                    try
                    {
                        targetFeature.Attributes[mappingfield.KV(key)] = dataContext.GetType().GetProperty(key).GetValue(dataContext , null);
                    }
                    catch (Exception ex)
                    {
                        throw new ArgumentException(TYPE_EXCEPTION_MSG_OBJECT + key , ex);
                    }
                }
            }
            else
            {
                throw new NullReferenceException(TYPE_EXCEPTION_MSG_OBJECT);
            }
        }
 public CustomFillStyle()
 {
     InitializeComponent();
     FeaturesLayer featureslayer = MyMap.Layers["MyFeaturesLayer"] as FeaturesLayer;
     for (int i = 1; i <= 10; i++)
     {
         int j = i * 8 + 60;
         Feature f = new Feature();
         f.Geometry =
             new GeoRegion
             {
                 Parts = new System.Collections.ObjectModel.ObservableCollection<Point2DCollection>
                 {
                     new Point2DCollection
                     {
                         new Point2D(j,20),
                         new Point2D(j,40),
                         new Point2D(j+5,40),
                         new Point2D(j+5,20),
                          new Point2D(j,20)
                     }
                 }
             };
         f.Style = LayoutRoot.Resources[string.Format(System.Globalization.CultureInfo.InvariantCulture, "MyFillStyle{0}", i)] as FillStyle;
         featureslayer.Features.Add(f);
     }
 }
        protected override Feature OnCreateFeature(FeatureCollection cluster, GeoPoint center, int maxClusterCount)
        {
            double sum = 0;
            Feature feature = null;
            foreach (Feature item in cluster)
            {
                if (item.Attributes.ContainsKey(AggregateColumn))
                {
                    sum += Convert.ToDouble(item.Attributes[AggregateColumn]);
                }
            }
            double size = (sum + 450) / 30;
            size = Math.Log(sum * StyleScale / 10) * 10 + 20;
            if (size < 12)
            {
                size = 12;
            }
            CustomClusterStyle s = new CustomClusterStyle();
            feature = new Feature() { Style = new CustomClusterStyle() { Size = size }, Geometry = center };
            feature.Attributes.Add("Color", InterPlateColor(size - 12, 100));
            feature.Attributes.Add("Size", size);
            feature.Attributes.Add("Count", cluster.Count);

            return feature;
        }
        public FeatureElement(Feature f, IRenderer renderer)
        {
            this.ClipBox = Rectangle2D.Empty;
            this.pathIsInvalid = true;
            if (f == null)
            {
                throw new ArgumentNullException("f");
            }
            this.feature = new WeakReference(f);

            if (renderer != null && (f.GetValue(Clusterer.ClusterProperty) == null))
            {
                this.GeoStyle = renderer.GetStyle(f) ?? generateDefaultSyle(f);
            }//renderer的优先级高于Feature自我的
            else
            {
                this.GeoStyle = f.Style ?? generateDefaultSyle(f);
            }
            f.SetBoundedStyle(this.GeoStyle);

            if (this.GeoStyle != null)
            {
                base.Template = this.GeoStyle.ControlTemplate;
            }

            this.Geometry = f.Geometry;
        }
        public CustomMarkerStyle()
        {
            InitializeComponent();
            FeaturesLayer featureslayer = MyMap.Layers["MyFeaturesLayer"] as FeaturesLayer;

            for (int i = 1; i <= 27; i++)
            {
                double x;
                double y;
                if (i <= 9)
                {
                    x = 80 + 5 * i;
                    y = 40;
                }
                else if (i > 9 && i <= 18)
                {
                    x = 80 + 5 * (i - 9);
                    y = 30;
                }
                else
                {
                    x = 80 + 5 * (i - 18);
                    y = 20;
                }

                Feature f = new Feature();
                f.Geometry = new GeoPoint(x, y);
                f.Style = LayoutRoot.Resources[string.Format(System.Globalization.CultureInfo.InvariantCulture, "MyMarkerStyle{0}", i)] as MarkerStyle;
                featureslayer.Features.Add(f);
            }
        }
 void region_DrawCompleted(object sender, DrawEventArgs e)
 {
     Feature feature = new Feature();
     feature.Geometry = e.Geometry;
     restLayer.ClipRegion = e.Geometry as GeoRegion;
     restLayer.Refresh();
     this.MyMap.Action = new Pan(this.MyMap);
 }
        private void MyBtn2_Click(object sender, RoutedEventArgs e)
        {
            Feature feature = new Feature();
            GeoRegion geoRegion = new GeoRegion();
            geoRegion.Parts.Add(new Point2DCollection() { new Point2D(50, 150), new Point2D(250, 250), new Point2D(400, 150), new Point2D(150, 150) });
            feature.Geometry = geoRegion;
            featureLayer.Features.Add(feature);

            mytb.Text = MyMap.Center.ToString();
        }
 private void MyBtn100_Click(object sender, RoutedEventArgs e)
 {
     for (int i = 0; i < 10; i++)
     {
         for (int j = 0; j < 10; j++)
         {
             Feature f = new Feature { Geometry = new GeoPoint(i, j) };
             featureLayer.Features.Add(f);
         }
     }
 }
        public StyleChange()
        {
            InitializeComponent();

            MyMap.Layers.Add(fLayer);

            fP = new Feature { Geometry = new GeoPoint(13000000, 6200000), Style = markerStyle };
            fL = new Feature { Style = lineStyle };
            fL.Geometry  = new GeoLine
            {
                Parts = new ObservableCollection<Point2DCollection>
                {
                    new Point2DCollection()
                        {
                            new Point2D(-5000000,5000000),
                            new Point2D(-10000000,10000000),

                        },
                    new Point2DCollection()
                        {
                            new Point2D(5000000,-5000000),
                            new Point2D(10000000,-10000000),
                        }
                }
            };

            fR = new Feature { Style = fillStyle};
            fR.Geometry = new GeoRegion
            {
                Parts = new ObservableCollection<Point2DCollection>
                {
                    new Point2DCollection()
                        {
                            new Point2D(0,0),
                            new Point2D(10000000,0),
                            new Point2D(10000000,10000000),
                            new Point2D(0,10000000),
                            new Point2D(0,0)
                        },
                    new Point2DCollection()
                        {
                            new Point2D(-10000000,0),
                            new Point2D(0,-10000000),
                            new Point2D(-10000000,-10000000),
                            new Point2D(-10000000,0)
                        }
                 }
            };

            fLayer.AddFeature(fP);
            fLayer.AddFeature(fL);
            fLayer.AddFeature(fR);
        }
 private void query_ProcessCompleted(object sender, QueryEventArgs e)
 {
     if (e.ResultSet == null)
     {
         MessageBox.Show("No Result!");
         return;
     }
     sgVegetable = e.ResultSet.RecordSets[0].Records[0].Shape;
     FeatureCollection fc = e.ResultSet.RecordSets[0].ToFeatureSet();
     Feature f = new Feature { Geometry = fc[0].Geometry, Style = this.GreenFillStyle };
     paramLayer.Features.Add(f);
 }
        public CustomGeoCircle()
        {
            InitializeComponent();
            FeaturesLayer featuresLayer = MyMap.Layers["MyFeaturesLayer"] as FeaturesLayer;
            Feature feature = new Feature();

            GeoCircle circle = new GeoCircle();
            circle.Center = new GeoPoint(0, 0);
            circle.Radius = 20;

            feature.Geometry = circle;
            featuresLayer.Features.Add(feature);
        }
        private void findServiceAreaService_ProcessCompleted(object sender, FindServiceAreasEventArgs e)
        {
            if (e.Result != null && e.Result.ServiceAreaList != null)
            {

                foreach (SuperMap.Web.iServerJava6R.NetworkAnalyst.ServiceArea p in e.Result.ServiceAreaList)
                {
                    //将要素添加到图层
                    PredefinedFillStyle style = new PredefinedFillStyle();
                    style.Fill = new SolidColorBrush(Color.FromArgb(120, 179, 235, 246));
                    Feature area = new Feature();
                    area.Geometry = p.ServiceRegion;
                    area.Style = style;
                    featuresLayer.AddFeature(area);
                }
            }
        }
        private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
        {
            FeaturesLayer featureslayer = this.MyMap.Layers["MyFeaturesLayer"] as FeaturesLayer;
            MarkerStyle style = this.LayoutRoot.Resources["customStyle"] as MarkerStyle;

            //将feature的ID、Fill和Size属性绑定到随机生成50个椭圆
            for (int i = 0; i < 50; i++)
            {
                double x = random.NextDouble() * (ChinaRight - ChinaLeft) + ChinaLeft;
                double y = random.NextDouble() * (ChinaTop - ChinaBottom) + ChinaBottom;
                Feature feature = new Feature() { Geometry = new GeoPoint(x, y), Style = style };
                feature.Attributes.Add("ID", i);
                feature.Attributes.Add("Size", random.NextDouble() * 20);
                feature.Attributes.Add("Fill", GetRandomColor());
                featureslayer.Features.Add(feature);
            }
        }
        public iServerJava6RFindMTSPPath()
        {
            InitializeComponent();

            elementsLayer = this.MyMap.Layers["MyElementsLayer"] as ElementsLayer;

            featuresLayer = this.MyMap.Layers["MyFeaturesLayer"] as FeaturesLayer;
            featuresLayerCenterPoints = this.MyMap.Layers["MyFeaturesLayer1"] as FeaturesLayer;

            Feature feature1 = new Feature
            {
                Geometry = new GeoPoint(4100, -4100),
                Style = new PredefinedMarkerStyle
                {
                    Color = new SolidColorBrush(Colors.Red),
                    Size = 20,
                    Symbol = PredefinedMarkerStyle.MarkerSymbol.Star
                }
            };

            featuresLayerCenterPoints.Features.Add(feature1);

            Feature feature2 = new Feature
            {
                Geometry = new GeoPoint(4500, -3000),
                Style = new PredefinedMarkerStyle
                {
                    Color = new SolidColorBrush(Colors.Red),
                    Size = 20,
                    Symbol = PredefinedMarkerStyle.MarkerSymbol.Star
                }
            };
            featuresLayerCenterPoints.AddFeature(feature2);

            Feature feature3 = new Feature
            {
                Geometry = new GeoPoint(5000, -3500),
                Style = new PredefinedMarkerStyle
                {
                    Color = new SolidColorBrush(Colors.Red),
                    Size = 20,
                    Symbol = PredefinedMarkerStyle.MarkerSymbol.Star
                }
            };
            featuresLayerCenterPoints.AddFeature(feature3);
        }
        private void line_DrawCompleted(object sender, DrawEventArgs e)
        {
            if (e.Geometry == null)
            {
                return;
            }

            //将线标绘在客户端要素图层
            PredefinedLineStyle lineStyle = new PredefinedLineStyle { Stroke = new SolidColorBrush(Colors.Red), StrokeThickness = 3 };
            Feature feature = new Feature
            {
                Geometry = e.Geometry,
                Style = lineStyle
            };
            featuresLayer.Features.Add(feature);

            Measure(e.Geometry);
        }
        private void service_ProcessCompleted(object sender, ExtendServerEventArgs e)
        {
            Feature feature = new Feature();
            feature.Geometry = new GeoPoint(116, 40);
            feature.Style = MyMarkerStyle;

            Grid grid = new Grid();
            grid.Background = new SolidColorBrush(Color.FromArgb(99, 00, 00, 00));
            StackPanel sp = new StackPanel();
            sp.Margin = new Thickness(5);
            sp.Children.Add(new TextBlock { Text = e.Result.Extendresult, Foreground = new SolidColorBrush(Colors.Red), FontSize = 20 });
            grid.Children.Add(sp);

            feature.ToolTip = grid;
            FeaturesLayer layer = new FeaturesLayer();
            layer.Features.Add(feature);
            MyMap.Layers.Add(layer);
        }
        private void MyMapControl_Loaded(object sender , RoutedEventArgs e)
        {
            for (int i = 0 ; i < 100 ; i++)
            {
                double x = this.random.Next(-180 , 0);
                double y = this.random.Next(-90 , 90);
                Feature feature2 = new Feature();
                feature2.Geometry = new GeoPoint(x , y);
                Feature feature = feature2;
                feature.Attributes.Add("Ranking" , this.random.NextDouble());
                TextBlock block = new TextBlock();
                block.Text = "Ranking:" + feature.Attributes["Ranking"].ToString();
                block.Foreground = new SolidColorBrush(Colors.Red);
                feature.ToolTip = block;
                rangeRendererLayer.Features.Add(feature);
            }

            DouUiqueRenderSearch();
            DoUniformRendererSearch();
        }
        //根据地图缩放,实现点的聚类功能
        private void Map_ViewBoundsChanged(object sender, SuperMap.Web.Mapping.ViewBoundsEventArgs e)
        {
            if (e.OldViewBounds.IsEmpty)
            {
                featuresLayer = this.MyMap.Layers["MyFeaturesLayer"] as FeaturesLayer;
                featuresLayer.Clusterer = myFlareClusterer;

                //随机生成点
                for (int i = 0; i < 500; i++)
                {
                    double x = random.NextDouble() * (ChinaRight - ChinaLeft) + ChinaLeft;
                    double y = random.NextDouble() * (ChinaTop - ChinaBottom) + ChinaBottom;
                    Feature feature = new Feature();
                    feature.Geometry = new GeoPoint(x, y);
                    feature.Style = MediumMarkerStyle;
                    feature.ToolTip = new TextBlock() { Text = i.ToString() };
                    featuresLayer.Features.Add(feature);
                }
            }
        }
Пример #19
0
        //public static ServerStyle StyleToServerStyle(SuperMap.Web.Core.Style Style)
        //{
        //    return null;
        //}
        /// <summary>${iServerJava6R_Bridge_method_ToFeature}</summary>
        /// <param name="feature">${iServerJava6R_Bridge_method_ToFeature_param_feature}</param>
        /// <returns>${iServerJava6R_Bridge_method_ToFeature_return}</returns>
        public static Feature ToFeature(this ServerFeature feature)
        {
            if (feature != null)
            {
                Feature f = new Feature();
                if (feature.Geometry != null)
                {
                    f.Geometry = feature.Geometry.ToGeometry();
                }
                if (feature.FieldNames != null && feature.FieldNames.Count > 0 && feature.FieldValues != null && feature.FieldValues.Count > 0)
                {

                    for (int i = 0; i < feature.FieldNames.Count; i++)
                    {
                        f.Attributes.Add(feature.FieldNames[i].ToString(), feature.FieldValues[i]);
                    }
                }
                return f;
            }
            return null;
        }
        //距离量算
        private void line_DrawCompleted(object sender, DrawEventArgs e)
        {
            //将线标绘在客户端要素图层
            PredefinedLineStyle lineStyle = new PredefinedLineStyle { Stroke = new SolidColorBrush(Colors.Red), StrokeThickness = 3 };
            Feature feature = new Feature
            {
                Geometry = e.Geometry,
                Style = lineStyle
            };
            featuresLayer.Features.Add(feature);

            MeasureParameters parameters = new MeasureParameters
            {
                Geometry = e.Geometry,
                MapName = "changchun"
            };
            MeasureService measureDistance = new MeasureService("http://localhost/IS/AjaxDemo");
            measureDistance.ProcessAsync(parameters);
            measureDistance.ProcessCompleted += new EventHandler<MeasureEventArgs>(measureDistance_ProcessCompleted);
            measureDistance.Failed += new EventHandler<ServiceFailedEventArgs>(measure_Failed);
        }
        internal static void AddToDataSource(this IEnumerable itemsSource , Feature feature , Type objectType)
        {
            Dictionary<string , object> dictionary = new Dictionary<string , object>();

            if (feature.Attributes.Count == 0)
            {
                if (objectType != null)
                {
                    FieldInfo[] fieldInfo = GetFldInfo(objectType);
                    foreach (FieldInfo fldInfo in fieldInfo)
                    {
                        Type fldType = fldInfo.FieldType;
                        string fldName = fldInfo.Name.Substring(1);

                        object defaultValue = fldType.IsValueType ? Activator.CreateInstance(fldType) : null;
                        dictionary.Add(fldName , defaultValue);

                        feature.Attributes.Add(mappingfield.KV(fldName) , defaultValue);
                    }
                }
            }
            else
            {
                foreach (KeyValuePair<string , object> keyVal in feature.Attributes)
                {
                    dictionary.Add(mappingfield[keyVal.Key] , keyVal.Value);
                }
            }

            if (dictionary.Keys.Count == 0)
            {
                throw new ArgumentException(NULL_EXCEPTION_MSG_IDICT);

            }

            if (objectType != null)
            {
                AddToEnum(objectType , dictionary , itemsSource);
            }
        }
        //根据地图缩放,实现点的聚类功能
        private void Map_ViewBoundsChanged(object sender, SuperMap.Web.Mapping.ViewBoundsEventArgs e)
        {
            if (e.OldViewBounds.IsEmpty)
            {
                featuresLayer = this.MyMap.Layers["MyFeaturesLayer"] as FeaturesLayer;
                featuresLayer1 = this.MyMap.Layers["MyFeaturesLayer1"] as FeaturesLayer;
                featuresLayer.Clusterer = myScatterClusterer;

                //随机生成点
                for (int i = 0; i < 500; i++)
                {
                    double x = random.NextDouble() * (ChinaRight - ChinaLeft) + ChinaLeft;
                    double y = random.NextDouble() * (ChinaTop - ChinaBottom) + ChinaBottom;
                    Feature feature = new Feature();
                    feature.Geometry = new GeoPoint(x, y);
                    feature.Style = MediumMarkerStyle;
                    feature.ToolTip = new TextBlock() { Text = i.ToString(System.Globalization.CultureInfo.InvariantCulture) };
                    featuresLayer.Features.Add(feature);
                }
                featuresLayer.Clusterer = myScatterClusterer;

                region = new Feature
                {
                    Geometry = new GeoRegion
                    {
                        Parts = new ObservableCollection<Point2DCollection>
                           {
                               new Point2DCollection
                               {
                                   new Point2D{ X=100,Y=20},
                                   new Point2D{ X=120,Y=20},
                                   new Point2D{ X=120,Y=30},
                                   new Point2D{ X=100,Y=30},
                                   new Point2D{ X=100,Y=20},
                               }
                           }
                    }
                };
            }
        }
        private void MyMapControl_Loaded(object sender, RoutedEventArgs e)
        {
            FeaturesLayer layer = MyMap.Layers["MyFeaturesLayer1"] as FeaturesLayer;
            for (int i = 0; i < 100; i++)
            {
                double x = random.Next(2000, 7600);
                double y = random.Next(-7600, -2000);

                Feature f = new Feature
                {
                    Geometry = new GeoPoint(x, y),
                };
                f.Attributes.Add("Ranking", random.NextDouble());
                f.ToolTip = new TextBlock
                {
                    Text = "Ranking:" + f.Attributes["Ranking"].ToString(),
                    Foreground = new SolidColorBrush(Colors.Red)
                };
                layer.Features.Add(f);
            }

            List<QueryLayerParam> queryLayerParams = new List<QueryLayerParam>()
            {
                new QueryLayerParam
                {
                    Name = "WaterPoly@changchun"
                }
            };

            QueryBySqlParameters parameters = new QueryBySqlParameters
            {
                MapName = "Changchun",
                QueryParam = new QueryParam { QueryLayerParams = queryLayerParams },
            };
            QueryBySqlService query = new QueryBySqlService("http://localhost:7080/demo/");
            query.ProcessAsync(parameters);
            query.Failed += (s, args) => { MessageBox.Show(args.Error.ToString()); };
            query.ProcessCompleted += new EventHandler<QueryEventArgs>(query_ProcessCompleted);
        }
        private void MyMap_Loaded(object sender, RoutedEventArgs e)
        {
            #region 使用预定义点符号
            Feature featurePoint = new Feature();
            GeoPoint point = new GeoPoint();
            point.X = 116.2;
            point.Y = 39.6;
            PredefinedMarkerStyle simpleMarkerStyle = new PredefinedMarkerStyle();
            simpleMarkerStyle.Color = new SolidColorBrush(Colors.Red);
            simpleMarkerStyle.Size = 20;
            simpleMarkerStyle.Symbol = SuperMap.Web.Core.PredefinedMarkerStyle.MarkerSymbol.Star;
            featurePoint.Style = simpleMarkerStyle;
            featurePoint.Geometry = point;
            featuresLayer.Features.Add(featurePoint);
            #endregion

            #region 使用预定义线符号
            Feature featureLine = new Feature();
            Point2DCollection points = new Point2DCollection();
            points.Add(new Point2D(116.2, 39.6));
            points.Add(new Point2D(90, 50));
            points.Add(new Point2D(50, 25));
            points.Add(new Point2D(-80, 45));
            points.Add(new Point2D(-100, 38));
            ObservableCollection<Point2DCollection> path = new ObservableCollection<Point2DCollection>();
            path.Add(points);
            GeoLine geoLine = new GeoLine();
            geoLine.Parts = path;

            PredefinedLineStyle simpleLineStyle = new PredefinedLineStyle();
            simpleLineStyle.Stroke = new SolidColorBrush(Colors.Black);
            simpleLineStyle.StrokeThickness = 1;
            simpleLineStyle.StrokeDashArray = new DoubleCollection { 3, 1 };

            featureLine.Geometry = geoLine;
            featureLine.Style = simpleLineStyle;
            featuresLayer.Features.Add(featureLine);
            #endregion

            #region 使用预定义面符号
            Feature featureRegion = new Feature();
            Point2DCollection pointsRegion = new Point2DCollection();
            pointsRegion.Add(new Point2D(-8, 61));
            pointsRegion.Add(new Point2D(-6, 55));
            pointsRegion.Add(new Point2D(-8, 50));
            pointsRegion.Add(new Point2D(2, 50));
            pointsRegion.Add(new Point2D(1, 61));
            pointsRegion.Add(new Point2D(-8, 61));
            ObservableCollection<Point2DCollection> pRegion = new ObservableCollection<Point2DCollection>();
            pRegion.Add(pointsRegion);
            GeoRegion geoRegion = new GeoRegion();
            geoRegion.Parts = pRegion;

            PredefinedFillStyle simpleFillStyle = new PredefinedFillStyle();
            simpleFillStyle.StrokeThickness = 1;
            simpleFillStyle.Stroke = new SolidColorBrush(Colors.Black);
            simpleFillStyle.Fill = new SolidColorBrush(Colors.Yellow);

            featureRegion.Geometry = geoRegion;
            featureRegion.Style = simpleFillStyle;
            featuresLayer.Features.Add(featureRegion);
            #endregion

            #region 添加文本
            Feature featureText = new Feature();
            GeoPoint text = new GeoPoint();
            text.X = 5;
            text.Y = 10;

            TextStyle textStyle = new TextStyle();
            textStyle.Text = "Africa";
            textStyle.FontSize = 40;
            textStyle.Foreground = new SolidColorBrush(Colors.Blue);

            featureText.Geometry = text;
            featureText.Style = textStyle;
            featuresLayer.Features.Add(featureText);
            #endregion
        }
        void CustomClustererTest_Loaded(object sender, RoutedEventArgs e)
        {
            FeaturesLayer featuresLayer = this.MyMap.Layers["MyFeaturesLayer"] as FeaturesLayer;
            featuresLayer.Clusterer = new CustomClusterer() { AggregateColumn = "id", StyleScale = 0.01 };

            for (int i = 0; i < 1000; i++)
            {
                Feature feature = new Feature();
                feature.Geometry = new GeoPoint(random.NextDouble() * (ChinaRight - ChinaLeft) + ChinaLeft, random.NextDouble() * (ChinaTop - ChinaBottom) + ChinaBottom);
                PredefinedMarkerStyle ps = new PredefinedMarkerStyle();
                ps.Color = new SolidColorBrush(Colors.Red);
                ps.Size = 10;
                feature.Style = ps;
                feature.ToolTip = new TextBlock() { Text = i.ToString(System.Globalization.CultureInfo.InvariantCulture) };
                feature.Attributes.Add("id", i);
                featuresLayer.Features.Add(feature);
            }
        }
 internal FeatureMouseButtonEventArgs(Feature f, MouseButtonEventArgs e)
     : base(f, e)
 {
     this.source = e;
 }
        private void LoadFeatures()
        {
            var  flareClusterer = new ScatterClusterer()
            {
                Background = new SolidColorBrush(Color.FromArgb(99, 00, 255, 00)),
                Foreground = new SolidColorBrush(Color.FromArgb(99, 00, 00, 00)),
                //MaximumCount = 10,
                Radius = 40,
                Gradient = RedGradient,
                //EnableRotation = true
            };
            featuresLayer.Clusterer = flareClusterer;

            for (int i = 0; i < 1000; i++)
            {
                double x = random.NextDouble() * (ChinaRight - ChinaLeft) + ChinaLeft;
                double y = random.NextDouble() * (ChinaTop - ChinaBottom) + ChinaBottom;

                Feature feature = new Feature();
                feature.Geometry = new GeoPoint(x, y);
                feature.Style = MediumMarkerStyle;
                feature.Attributes.Add("id", i);
                feature.ToolTip = new TextBlock { Text = i.ToString() };
                featuresLayer.Features.Add(feature);
            }
        }
        public InRegionCheck()
        {
            InitializeComponent();
            pointsLayer = this.MyMap.Layers["MyPointsLayer"] as FeaturesLayer;
            regionLayer = this.MyMap.Layers["MyRegionLayer"] as FeaturesLayer;

            random = new Random();
            for (int i = 0; i < 100; i++)
            {
                X = random.Next(-160, 160);
                Y = random.Next(-60, 60);

                Feature feature = new Feature
                {
                    Geometry = new GeoPoint
                    {
                        X = X,
                        Y = Y
                    },
                    Style = new PredefinedMarkerStyle
                    {
                        Color = new SolidColorBrush
                        {
                            Color = Colors.Red
                        }
                    }
                };

                pointsLayer.AddFeature(feature);
            }
        }
 private void service_ProcessCompleted(object sender, ServiceAreaEventArgs e)
 {
     foreach (ServerGeometry p in e.Result.AreaRegions)
     {
         //显示服务区域
         FillStyle fillStyle = new FillStyle();
         fillStyle.Fill = new SolidColorBrush(Color.FromArgb(120, 179, 235, 246));
         Feature area = new Feature();
         area.Geometry = p.ToGeometry();
         area.Style = fillStyle;
         featuresLayer.AddFeature(area);
     }
 }
        //绘制面结束后将所绘制的面转化为矢量要素并加载到矢量要素图层中
        private void polygon_DrawCompleted(object sender, DrawEventArgs e)
        {
            //将绘制面转化为面要素并加载到矢量要素图层中
            Feature feature = new Feature()
            {
                Geometry = e.Geometry as GeoRegion,
                Style = new PredefinedFillStyle
                {
                    Fill = regionColor1
                }
            };

            regionLayer.Features.Add(feature);
            region = e.Geometry as GeoRegion;

            Check();
        }