Inheritance: DependencyObject, INotifyPropertyChanged
        private async void ExecuteExtentService()
        {
            try
            {
                string url = "http://support.supermap.com.cn:8090/iserver/services/Temperature/rest/domainComponents/Temperature/getTemperatureResult";
                ExtendServerParameters param = new ExtendServerParameters() { Arg = "北京" };
                ExtendServerService service = new ExtendServerService(url);
                ExtendServerResult e = await service.ProcessAsync(param);

                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.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);
            }
            catch (Exception ex)
            {
                
            }
        }
        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))
            if (renderer != 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;
        }
 /// <summary>${mapping_UniqueRender_method_getStyle_D}</summary>
 /// <returns>${mapping_UniqueRender_method_getStyle_return}</returns>
 /// <param name="feature">${mapping_UniqueRender_method_getStyle_param_feature}</param>
 public SuperMap.WinRT.Core.Style GetStyle(Feature feature)
 {
     if (feature != null && !string.IsNullOrEmpty(this.Attribute) && feature.Attributes.ContainsKey(this.Attribute))
     {
         object obj = feature.Attributes[this.Attribute];
         foreach (UniqueItem item in this.Items)
         {
             if ((item.Value == obj) || (((obj != null) && (item.Value != null)) && (obj.GetHashCode() == item.Value.GetHashCode())))
             {
                 if (item.Style != null)
                 {
                     return item.Style;
                 }//设Value了但没有设置Style,返回default
                 else
                 {
                     return DefaultStyle;
                 }
             }
         }
         return DefaultStyle;
     }
     else
     {
         return null;//Attribute属性没有设置,或者设错了。
     }
 }
 /// <summary>${mapping_RangeRender_method_getStyle_D}</summary>
 /// <returns>${mapping_RangeRender_method_getStyle_return}</returns>
 /// <param name="feature">${mapping_RangeRender_method_getStyle_param_feature}</param>
 public SuperMap.WinRT.Core.Style GetStyle(Feature feature)
 {
     if (feature != null && !string.IsNullOrEmpty(this.Attribute) && feature.Attributes.ContainsKey(this.Attribute))
     {
         double num;
         object obj = feature.Attributes[this.Attribute];
         if (double.TryParse(string.Format(CultureInfo.InvariantCulture, "{0}", new object[] { obj }), NumberStyles.Any, CultureInfo.InvariantCulture, out num))
         {
             foreach (RangeItem item in this.Items)
             {
                 if ((num >= item.MinimumValue) && (num < item.MaximumValue))
                 {
                     if (item.Style != null)
                     {
                         return item.Style;
                     }
                     else
                     {
                         return DefaultStyle;
                     }
                 }
             }
             return DefaultStyle;
         }
         else
         {
             return null;
         }
     }
     else
     {
         return null;
     }
 }
        public CustomGeoCircle()
        {
            InitializeComponent();
            double[] resolutions = new double[14];
            double resolution = 0.28526148969889065;
            for (int i = 0; i < 14; i++)
            {
                resolutions[i] = resolution;
                resolution /= 2;
            }
            MyMap.Resolutions = resolutions;
            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);
            _layer = MyMap.Layers["tiledLayer"] as TiledDynamicRESTLayer;
            _layer.LocalStorage = new OfflineStorage("World");
            _layer.Failed += CustomGeoCircle_Failed;
            this.Unloaded += CustomGeoCircle_Unloaded;
        }
 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);
 }
        public RESTFindMTSPPath()
        {
            InitializeComponent();
            double[] resolutions = new double[14];
            double resolution = 9.9772839315388211;
            for (int i = 0; i < 14; i++)
            {
                resolutions[i] = resolution;
                resolution /= 2;
            }
            MyMap.Resolutions = resolutions;

            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);
            _layer = MyMap.Layers["tiledDynamicRESTLayer"] as TiledDynamicRESTLayer;
            _layer.LocalStorage = new OfflineStorage("长春市区图");
            _layer.Failed += RESTFindMTSPPath_Failed;
            this.Unloaded += RESTFindMTSPPath_Unloaded;
        }
 private void Line_DrawLineCompleted(object sender, DrawEventArgs e)
 {
    // _eLayer.AddChild(e.Element);
     Feature f = new Feature
     {
         Geometry = e.Geometry
     };
     _fLayer.AddFeature(f);
 }
        private void Point_DrawCompleted(object sender, DrawEventArgs e)
        {
            Feature feature = new Feature
            {
                Geometry = e.Geometry
            };


            _fLayer.AddFeature(feature);
            
            //_elayer .AddChild(e.Element);
        }
 /// <summary>${mapping_UniformRenderer_method_GetStyle_D}</summary>
 /// <returns>${mapping_UniformRenderer_method_GetStyle_return}</returns>
 /// <param name="feature">${mapping_UniformRenderer_method_GetStyle_param_feature}</param>
 public SuperMap.WinRT.Core.Style GetStyle(Feature feature)
 {
     if (feature == null)
     {
         return null;
     }
     if (feature.Geometry is GeoPoint)
     {
         return MarkerStyle;
     }
     else if (feature.Geometry is GeoLine)
     {
         return LineStyle;
     }
     return this.FillStyle;
 }
        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);
            }
        }
        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);
        }
        public CustomMarkerStyle()
        {
            InitializeComponent();
            double[] resolutions = new double[14];
            double resolution = 0.28526148969889065;
            for (int i = 0; i < 14; i++)
            {
                resolutions[i] = resolution;
                resolution /= 2;
            }
            MyMap.Resolutions = resolutions;

            _layer = MyMap.Layers["tiledLayer"] as TiledDynamicRESTLayer;
            _layer.LocalStorage = new OfflineStorage("World");
            _layer.Failed += CustomMarkerStyle_Failed;
            this.Unloaded += CustomMarkerStyle_Unloaded;
            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("MyMarkerStyle{0}", i)] as MarkerStyle;
                featureslayer.Features.Add(f);
            }
        }
        public InRegionCheck()
        {
            InitializeComponent();

            double[] resolutions = new double[14];
            double resolution = 0.28526148969889065;
            for (int i = 0; i < 14; i++)
            {
                resolutions[i] = resolution;
                resolution /= 2;
            }
            MyMap.Resolutions = resolutions;
            pointsLayer = this.MyMap.Layers["MyPointsLayer"] as FeaturesLayer;
            regionLayer = this.MyMap.Layers["MyRegionLayer"] as FeaturesLayer;
            _layer = MyMap.Layers["tiledLayer"] as TiledDynamicRESTLayer;
            _layer.LocalStorage = new OfflineStorage("World");
            _layer.Failed += InRegionCheck_Failed;
            this.Unloaded += InRegionCheck_Unloaded;
            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 static Style generateDefaultSyle(Feature f)
 {
     if (f.Geometry is GeoPoint)
     {
         Style pmstyle = null;
         if (f.Layer.Map.Theme == null)
         {
             pmstyle = new PredefinedMarkerStyle() { Color = new SolidColorBrush(Colors.Red), Size = 10 };
         }
         else
         {
             pmstyle = new PredefinedMarkerStyle() { Color = f.Layer.Map.Theme.Color, Size = f.Layer.Map.Theme.Size };
         }
         return pmstyle;
     }
     else if (f.Geometry is GeoLine)
     {
         Style plstyle = null;
         if (f.Layer.Map.Theme == null)
         {
             plstyle = new PredefinedLineStyle() { Stroke = new SolidColorBrush(Color.FromArgb(99, 255, 0, 0)), StrokeThickness = 2 };
         }
         else
         {
             plstyle = new PredefinedLineStyle() { Stroke = f.Layer.Map.Theme.Stroke, StrokeThickness = f.Layer.Map.Theme.StrokeThickness };
         }
         return plstyle;
     }
     else
     {
         Style pfstyle = null;
         if (f.Layer.Map.Theme == null)
         {
             pfstyle = new FillStyle() { Fill = new SolidColorBrush(Color.FromArgb(99, 255, 0, 0)) };
         }
         else
         {
             pfstyle = new FillStyle() { Fill = f.Layer.Map.Theme.Fill, Stroke = f.Layer.Map.Theme.Stroke };
         }
         return pfstyle;
     }
 }
        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();
        }
        public CustomGeoRectangle()
        {
            InitializeComponent();
            double[] resolutions = new double[14];
            double resolution = 0.28526148969889065;
            for (int i = 0; i < 14; i++)
            {
                resolutions[i] = resolution;
                resolution /= 2;
            }
            MyMap.Resolutions = resolutions;
            FeaturesLayer featuresLayer = MyMap.Layers["MyFeaturesLayer"] as FeaturesLayer;
            Feature feature = new Feature();

            feature.Geometry = new GeoRectangle(new Point2D(10, -10), new Point2D(30, 30));
            featuresLayer.Features.Add(feature);
            _layer = MyMap.Layers["tiledLayer"] as TiledDynamicRESTLayer;
            _layer.LocalStorage = new OfflineStorage("World");
            _layer.Failed += CustomGeoRectangle_Failed;
            this.Unloaded += CustomGeoRectangle_Unloaded;
        }
 public CustomLineStyle()
 {
     InitializeComponent();
     double[] resolutions = new double[14];
     double resolution = 0.28526148969889065;
     for (int i = 0; i < 14; i++)
     {
         resolutions[i] = resolution;
         resolution /= 2;
     }
     MyMap.Resolutions = resolutions;
     _layer = MyMap.Layers["tiledLayer"] as TiledDynamicRESTLayer;
     _layer.LocalStorage = new OfflineStorage("World");
     _layer.Failed += CustomLineStyle_Failed;
     this.Unloaded += CustomLineStyle_Unloaded;
     MyMap.ViewBounds = new Rectangle2D(75.0, 5.0, 138.0, 55.0);
     FeaturesLayer featureslayer = MyMap.Layers["MyFeaturesLayer"] as FeaturesLayer;
     for (int i = 1; i <= 10; i++)
     {
         int j = i * 7 + 70;
         Feature f = new Feature();
         f.Geometry =
             new GeoLine
             {
                 Parts = new System.Collections.ObjectModel.ObservableCollection<Point2DCollection>
                 {
                     new Point2DCollection
                     {
                         new Point2D(j,10),
                         new Point2D(j,50)
                     }
                 }
             };
         f.Style = LayoutRoot.Resources[string.Format("MyLineStyle{0}", i)] as LineStyle;
         featureslayer.Features.Add(f);
     }
 }
Exemple #19
0
        private void deleteOneVertex(Feature hoverVertex)
        {
            Feature parent = hoverVertex.Attributes["Feature"] as Feature;
            Point2DCollection points = hoverVertex.Attributes["Point2DCollection"] as Point2DCollection;
            int index = (int)hoverVertex.Attributes["Index"];
            if (parent.Geometry is GeoRegion && points.Count < 5)
            {
                return;
            }
            if (parent.Geometry is GeoLine && points.Count < 3)
            {
                return;
            }
            if (parent.Geometry is GeoRegion && index == 0)
            {
                points.RemoveAt(points.Count - 1);
                points.Add(points[1]);
            }//特殊处理下第1个/最后1个点删除
            points.RemoveAt(index);

            rebuildHoverLayer(parent);
            OnGeometryEdit(hoverVertex , GeometryEditAction.VertexRemoved);
        }
Exemple #20
0
        /// <summary>${core_Feature_method_Clone_D}</summary>
        public Feature Clone()
        {
            Feature fClone = new Feature();
            fClone.Geometry = this.Geometry.Clone();
            fClone.Style = this.Style;
            fClone.ToolTip = this.ToolTip;
            fClone.DisableToolTip = this.DisableToolTip;
            fClone.Attributes = this.Attributes;

            return fClone;
        }
        async private void PathAnalyst_Click(object sender, RoutedEventArgs e)
        {
            if (points.Count == 0)
            {
                await MessageBox.Show("请指定服务点");
                return;
            }

            if (string.IsNullOrEmpty(MyTextBox.Text))
            {
                await MessageBox.Show("请填写服务半径");
                return;
            }
            double radius;
            if (double.TryParse(MyTextBox.Text, out radius))
            {
                if (radius <= 0)
                {
                    await MessageBox.Show("服务半径必须大于0");
                    return;
                }
            }
            else
            {
                await MessageBox.Show("服务半径必须为数值");
                return;
            }
            //listweights用来添加服务半径,list记录点,点与半径一一对应
            //每次新添加的点用新添加的服务半径进行分析,以前的几个点的服务半径不变
            List<double> listweights = new List<double>();
            List<Point2D> list = new List<Point2D>();
            for(int count=i;count<points.Count;count++)
            {
                list.Add(points[count]);
                listweights.Add(radius);
            }
            //记录点的个数,下次分析从此点开始进行分析,之前的点仍用原服务半径
            i=points.Count;


            //定义 Point2D 类型的参数
            FindServiceAreasParameters<Point2D> paramPoint2D = new FindServiceAreasParameters<Point2D>
            {
                Centers = list,
                Weights = listweights,
                Parameter = new TransportationAnalystParameter
                {
                    ResultSetting = new TransportationAnalystResultSetting
                    {
                        ReturnEdgeFeatures = true,
                        ReturnEdgeGeometry = true,
                        ReturnEdgeIDs = true,
                        ReturnPathGuides = true,
                        ReturnRoutes = true,
                    },
                    WeightFieldName = "length",
                    TurnWeightField = "TurnCost",
                }
            };

            //与服务器交互
            try
            {
                FindServiceAreasService findServiceAreaService = new FindServiceAreasService("http://support.supermap.com.cn:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun");
                var result = await findServiceAreaService.ProcessAsync(paramPoint2D);
               
                foreach (SuperMap.WinRT.REST.NetworkAnalyst.ServiceArea p in 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);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        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.WinRT.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
        }
Exemple #23
0
        private void stopTracking( )
        {
            startGeoPoint = Point2D.Empty;
            startPoint = Point2D.Empty;
            lastPostion = Point2D.Empty;

            if (draggingVertex != null)
            {
                draggingVertex.UnSelect();
                draggingVertex = null;
                if (activeFeature != null && activeFeature.Geometry is GeoPoint)
                {
                    StopEdit();
                }
            }
        }
        //绘制线结束后将所绘制的线转化为线元素并加载到ElementsLayer中,在加载前先设置线元素样式
        private void line_DrawCompleted(object sender , DrawEventArgs e)
        {
            //设置线元素样式
            Feature feature = new Feature
            {
                Geometry = e.Geometry
            };

            this.featuresLayer.AddFeature(feature);
        }
Exemple #25
0
        //public static ServerStyle StyleToServerStyle(SuperMap.WinRT.Core.Style Style)
        //{
        //    return null;
        //}

        /// <summary>${REST_Bridge_method_ToFeature}</summary>
        /// <param name="feature">${REST_Bridge_method_ToFeature_param_feature}</param>
        /// <returns>${REST_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;
        }
        //绘制矩形结束后将所绘制的矩形转化为面元素并加载到ElementsLayer中,在加载前先设置该元素样式
        private void rectangle_DrawCompleted(object sender , DrawEventArgs e)
        {
            Feature feature = new Feature
            {
                Geometry = e.Geometry
            };

            this.featuresLayer.AddFeature(feature);
        }
Exemple #27
0
 private void OnGeometryEdit(Feature f , GeometryEditAction action)
 {
     if (GeometryEdit != null)
     {
         GeometryEdit(this , new GeometryEditEventArgs(f , action));
     }
 }
Exemple #28
0
 private void startEdit(Feature feature , bool suppressEvent , Point2D start)
 {
     if (activeFeature != feature)
     {
         StopEdit();
         activeFeature = feature;
         buildHoverLayer(activeFeature);
         if (!suppressEvent)
         {
             OnGeometryEdit(activeFeature , GeometryEditAction.EditStarted);
         }
     }
     else if (activeFeature.Geometry is GeoRegion && !start.IsEmpty)
     {
         prepareMoveLineOrRegionFeature(start);
     }//表明移动整个要素
 }
Exemple #29
0
 private void startEdit(Feature feature , bool suppressEvent)
 {
     startEdit(feature , suppressEvent , Point2D.Empty);
 }
Exemple #30
0
 internal GeometryEditEventArgs(Feature feature , GeometryEditAction action)
 {
     Feature = feature;
     Action = action;
 }