상속: Geometry
예제 #1
0
 /// <summary>${core_GeoLine_method_clone_D}</summary>
 public override Geometry Clone()
 {
     GeoLine line = new GeoLine();
     if (this.Parts != null)
     {
         foreach (Point2DCollection points in this.Parts)
         {
             if (points != null)
             {
                 Point2DCollection item = new Point2DCollection();
                 foreach (Point2D point in points)
                 {
                     if (point != null)
                     {
                         item.Add(point.Clone());
                     }
                 }
                 line.Parts.Add(item);
                 continue;
             }
             line.Parts.Add(null);
         }
     }
     return line;
 }
예제 #2
0
 /// <summary>${utility_Extensions_method_ToGeoLine_D}</summary>
 public static GeoLine ToGeoLine(this PolylineElement polylineElement)
 {
     if (polylineElement != null && polylineElement.Point2Ds != null && polylineElement.Point2Ds.Count > 0)
     {
         GeoLine line = new GeoLine();
         line.Parts.Add(polylineElement.Point2Ds.Clone());
         return line;
     }
     return null;
 }
예제 #3
0
 internal GeoLine Clip(GeoLine line)
 {
     GeoLine newLine = new GeoLine();
     foreach (Point2DCollection points in line.Parts)
     {
         IList<Point2DCollection> list = this.ClipPointCollection(points, this.boundary);
         if ((list != null) && (list.Count > 0))
         {
             foreach (Point2DCollection points2 in list)
             {
                 newLine.Parts.Add(points2);
             }
             continue;
         }
     }
     return newLine;
 }
        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
        }
예제 #5
0
        private void endDraw(bool isCancel = false)
        {
            if (points != null)
            {
                PolylineElement pLine = new PolylineElement()
                {
                    Point2Ds = points.Clone(),
                    #region 所有风格的控制
                    Stroke = this.Stroke,
                    StrokeThickness = this.StrokeThickness,
                    StrokeMiterLimit = this.StrokeMiterLimit,
                    StrokeDashOffset = this.StrokeDashOffset,
                    StrokeDashArray = this.StrokeDashArray,
                    StrokeDashCap = this.StrokeDashCap,
                    StrokeEndLineCap = this.StrokeEndLineCap,
                    StrokeLineJoin = this.StrokeLineJoin,
                    StrokeStartLineCap = this.StrokeStartLineCap,
                    Opacity = this.Opacity,
                    Fill = this.Fill,
                    FillRule = this.FillRule
                    #endregion
                };
                GeoLine geoLine = new GeoLine();//构造返回的Geometry
                geoLine.Parts.Add(points);
                DrawEventArgs args = new DrawEventArgs
                {
                    DrawName = Name,
                    Element = pLine,
                    Geometry = geoLine,
                    Canceled = isCancel
                };

                Deactivate();
                OnDrawCompleted(args);
            }
        }
예제 #6
0
        //添加虚拟线;
        private void addHoverLineSegment(Point2D p0 , Point2D p1 , int index0 , int index1 , Feature feature , Point2DCollection points , int partIndex)
        {
            GeoLine line = new GeoLine();
            line.Parts.Add(new Point2DCollection() { p0 , p1 });
            Feature segment = new Feature() { Geometry = line , Style = hoverLineStyle };
            segment.SetZIndex(1);

            segment.Attributes.Add("Point2DCollection" , points);
            segment.Attributes.Add("Feature" , feature);
            segment.Attributes.Add("Index0" , index0);
            segment.Attributes.Add("Index1" , index1);
            segment.Attributes.Add("PartIndex" , partIndex);

            hoverLayer.Features.Add(segment);
        }
예제 #7
0
 private GeoLine ParseMultiLineCoordinates(XElement eles)
 {
     GeoLine line = new GeoLine();
     if (eles != null)
     {
         if (!string.IsNullOrEmpty(eles.Value))
         {
             string[] values = eles.Value.Trim().Split(',', ' ');
             line.Parts.Add(this.GetPoint2Ds(values));
         }
     }
     return line;
 }
예제 #8
0
        internal GeoLine ToGeoLine()
        {
            if (this.Parts != null)
            {
                List<Point2DCollection> pss = new List<Point2DCollection>();
                Point2DCollection copy = new Point2DCollection();
                foreach (Point2D item in this.Points)
                {
                    copy.Add(item);
                }
                for (int i = 0; i < this.Parts.Count; i++)
                {
                    Point2DCollection temp = new Point2DCollection();
                    for (int j = 0; j < this.Parts[i]; j++)
                    {
                        temp.Add(copy[j]);
                    }
                    pss.Add(temp);

                    copy.RemoveRange(0, this.Parts[i]);
                }

                GeoLine line = new GeoLine();
                foreach (Point2DCollection item in pss)
                {
                    line.Parts.Add(item);
                }
                return line;
            }
            return null;
        }
예제 #9
0
 //预留接口
 private static GeoLine ToGeoLine(XElement xe)
 {
     GeoLine line = new GeoLine();
     return line;
 }