当前位置: 首页>>代码示例>>C#>>正文


C# PointCollection.Add方法代码示例

本文整理汇总了C#中PointCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# PointCollection.Add方法的具体用法?C# PointCollection.Add怎么用?C# PointCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PointCollection的用法示例。


在下文中一共展示了PointCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: envelopeToPolygon

 Polygon envelopeToPolygon(Envelope env)
 {
     PointCollection points = new PointCollection();
     points.Add(new MapPoint(env.XMin, env.YMin, env.SpatialReference));
     points.Add(new MapPoint(env.XMin, env.YMax, env.SpatialReference));
     points.Add(new MapPoint(env.XMax, env.YMax, env.SpatialReference));
     points.Add(new MapPoint(env.XMax, env.YMin, env.SpatialReference));
     points.Add(new MapPoint(env.XMin, env.YMin, env.SpatialReference));
     Polygon polygon = new Polygon();
     polygon.Rings.Add(points);
     return polygon;
 }
开发者ID:yulifengwx,项目名称:arcgis-viewer-silverlight,代码行数:12,代码来源:CurrentExtentLayerParameter.cs

示例2: CreatePolylineX

		// Creates a polyline with two paths in the shape of an 'X' centered at the given point
		private Polyline CreatePolylineX(MapPoint center, double length)
		{
			var halfLen = length / 2.0;

			PointCollection coords1 = new PointCollection();
			coords1.Add(new MapPoint(center.X - halfLen, center.Y + halfLen));
			coords1.Add(new MapPoint(center.X + halfLen, center.Y - halfLen));

			PointCollection coords2 = new PointCollection();
			coords2.Add(new MapPoint(center.X + halfLen, center.Y + halfLen));
			coords2.Add(new MapPoint(center.X - halfLen, center.Y - halfLen));

			return new Polyline(new List<PointCollection> { coords1, coords2 }, MyMapView.SpatialReference);
		}
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:15,代码来源:CreatePolylines.xaml.cs

示例3: OnPointerPressed

        public void OnPointerPressed(InqCanvas inqCanvas, PointerRoutedEventArgs e)
        {
            Debug.WriteLine(e.Pointer.PointerDeviceType);
            _currentStroke = new PointCollection();
            _polyline = new Polyline
            {
                Stroke = new SolidColorBrush(StrokeColor),
                StrokeThickness = 3,
                StrokeLineJoin = PenLineJoin.Round
            };
            inqCanvas.Children.Add(_polyline);

            _polyline.Points = _currentStroke;

            var point = e.GetCurrentPoint(inqCanvas);

            _strokeBuilder.BeginStroke(point);
            _currentStroke.Add(point.Position);

            //_inkManager.

            /*
            //TODO: add data binding for thickness and color
            _currentStroke.StrokeThickness = Math.Max(4.0 * e.GetCurrentPoint(inqCanvas).Properties.Pressure, 2);
            _currentInqLineView.StrokeThickness = _currentStroke.StrokeThickness;
            inqCanvas.Children.Add(_currentInqLineView);
            var currentPoint = e.GetCurrentPoint(inqCanvas);
            _currentStroke.AddPoint(new Point(currentPoint.Position.X, currentPoint.Position.Y));
            */
        }
开发者ID:philllies,项目名称:finalproject,代码行数:30,代码来源:DrawInqMode.cs

示例4: MultiPolygonWktToPolygon

        private static Polygon MultiPolygonWktToPolygon(string wkt)
        {
            var polygon = new Polygon();

            var pointCollection = new PointCollection();
            var removed = wkt.Replace("MULTIPOLYGON (", "");
            var preSplit = removed.Replace(")), ((", "|");
            var rings = preSplit.Split('|');

            foreach (var r in rings)
            {
                PointCollection pc = new PointCollection();

                var r1 = r.Replace("(", "");
                var r2 = r1.Replace(")", "");
                var r3 = r2.Trim();

                var coords = r3.Split(',');
                foreach(var coord in coords)
                {
                    coord.Trim();
                    var xy = coord.Trim().Split(' ');
                    if (xy.Length != 2)
                    continue;

                    pc.Add(new MapPoint(double.Parse(xy[0], CultureInfo.InvariantCulture), double.Parse(xy[1], CultureInfo.InvariantCulture)));
                }

                polygon.Rings.Add(pc);
            }

            return polygon;
        }
开发者ID:HackatonArGP,项目名称:Guardianes,代码行数:33,代码来源:WktConverter.cs

示例5: UpdateShape

 /// <summary>
 /// Updates the Shape for the series.
 /// </summary>
 /// <param name="definitionPoints">Locations of the points of each SeriesDefinition in the series.</param>
 protected override void UpdateShape(IList<IEnumerable<Point>> definitionPoints)
 {
     for (int i = SeriesDefinitions.Count - 1; 0 < i; i--)
     {
         PointCollection pointCollection = new PointCollection();
         IEnumerable<Point> topPoints = (ActualIndependentAxis is ICategoryAxis) ? definitionPoints[i].OrderBy(p => p.X) : definitionPoints[i];
         foreach (Point p in topPoints)
         {
             pointCollection.Add(p);
         }
         IEnumerable<Point> bottomPoints = (ActualIndependentAxis is ICategoryAxis) ? definitionPoints[i - 1].OrderByDescending(p => p.X) : definitionPoints[i - 1].Reverse();
         foreach (Point p in bottomPoints)
         {
             pointCollection.Add(p);
         }
         SetPolygonPointsProperty((Polygon)SeriesDefinitionShapes[SeriesDefinitions[i]], pointCollection);
     }
     if (1 <= SeriesDefinitions.Count)
     {
         double plotAreaMaximumDependentCoordinate = ActualDependentAxis.GetPlotAreaCoordinate(ActualDependentRangeAxis.Range.Maximum).Value;
         IComparable zeroValue = ActualDependentRangeAxis.Origin ?? 0.0;
         if (zeroValue.CompareTo(ActualDependentRangeAxis.Range.Minimum) < 0)
         {
             zeroValue = ActualDependentRangeAxis.Range.Minimum;
         }
         if (0 < zeroValue.CompareTo(ActualDependentRangeAxis.Range.Maximum))
         {
             zeroValue = ActualDependentRangeAxis.Range.Maximum;
         }
         double zeroCoordinate = ActualDependentAxis.GetPlotAreaCoordinate(zeroValue).Value;
         PointCollection pointCollection = new PointCollection();
         Point[] topPoints = ((ActualIndependentAxis is ICategoryAxis) ? definitionPoints[0].OrderBy(p => p.X) : definitionPoints[0]).ToArray();
         foreach (Point p in topPoints)
         {
             pointCollection.Add(p);
         }
         if (0 < topPoints.Length)
         {
             Point firstPoint = topPoints[0];
             Point lastPoint = topPoints[topPoints.Length - 1];
             pointCollection.Add(new Point(lastPoint.X, plotAreaMaximumDependentCoordinate - zeroCoordinate));
             pointCollection.Add(new Point(firstPoint.X, plotAreaMaximumDependentCoordinate - zeroCoordinate));
         }
         SetPolygonPointsProperty((Polygon)SeriesDefinitionShapes[SeriesDefinitions[0]], pointCollection);
     }
 }
开发者ID:siatwangmin,项目名称:WinRTXamlToolkit,代码行数:50,代码来源:StackedAreaSeries.cs

示例6: FromArray

		// Helper method
		private static PointCollection FromArray(params double[] parameters)
		{
			PointCollection coll = new PointCollection();
			for (int i = 0; i < parameters.Length - 1; i+=2)
			{
				coll.Add(new MapPoint(parameters[i], parameters[i + 1]));
			}
			return coll;
		}
开发者ID:jordanparfitt,项目名称:arcgis-runtime-samples-dotnet,代码行数:10,代码来源:SymbolsAndLabels.xaml.cs

示例7: ToPointCollectionList

 /// <summary>
 /// Convert a collection of points into a <see cref="PointCollectionList"/> that can be used as paths in <see cref="Polyline"/> types
 /// or rings in <see cref="Polygon"/> types
 /// </summary>
 /// <param name="points"></param>
 /// <returns></returns>
 public static PointCollectionList ToPointCollectionList(this IEnumerable<Point> points)
 {
     var result = new PointCollectionList();
     var pointCollection = new PointCollection();
     foreach (var point in points)
         pointCollection.Add(point.ToPointCollectionEntry());
     result.Add(pointCollection);
     return result;
 }
开发者ID:pheede,项目名称:ArcGIS.PCL,代码行数:15,代码来源:GeometryExtensions.cs

示例8: FromArray

		// Helper method
		private static PointCollection FromArray(params double[] parameters)
		{
			PointCollection coll = new PointCollection(SpatialReferences.Wgs84);
			var mapPointBuilder = new MapPointBuilder(SpatialReferences.Wgs84);
			for (int i = 0; i < parameters.Length - 1; i+=2)
			{
				mapPointBuilder.SetValues(parameters[i], parameters[i + 1]);
				coll.Add(mapPointBuilder.ToGeometry());
			}
			return coll;
		}
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:12,代码来源:SymbolsAndLabels.xaml.cs

示例9: UpdateShape

 /// <summary>
 /// Updates the shape for the series.
 /// </summary>
 /// <param name="definitionPoints">Locations of the points of each SeriesDefinition in the series.</param>
 protected override void UpdateShape(IList<IEnumerable<Point>> definitionPoints)
 {
     for (int i = 0; i < SeriesDefinitions.Count; i++)
     {
         PointCollection pointCollection = new PointCollection();
         foreach (Point p in ((ActualIndependentAxis is ICategoryAxis) ? definitionPoints[i].OrderBy(p => p.X) : definitionPoints[i]))
         {
             pointCollection.Add(p);
         }
         SetPolylinePointsProperty((Polyline)SeriesDefinitionShapes[SeriesDefinitions[i]], pointCollection);
     }
 }
开发者ID:siatwangmin,项目名称:WinRTXamlToolkit,代码行数:16,代码来源:StackedLineSeries.cs

示例10: Convert

        public object Convert(object value, Type targetType, object parameter, string language)
        {
            double valueAsDouble = DebugHelper.CastAndAssert<double>(value);

            double LeftBase = 20;

            double RightBase = 20;

            if (BaseShape == null)
            {
                BaseShape = new Polygon();

                BaseShape.Points.Add(new Point(-20,25));
                BaseShape.Points.Add(new Point(-20,20));
                BaseShape.Points.Add(new Point(0,0));
                BaseShape.Points.Add(new Point(20,20));
                BaseShape.Points.Add(new Point(20,25));
            }

            PointCollection newShape = new PointCollection();

            double maxValue = Windows.UI.Xaml.Window.Current.Bounds.Width;

            if (BaseShape != null)
            {
                foreach (Point j in BaseShape.Points)
                {
                    double shiftX = j.X;

                    if (valueAsDouble < LeftBase)
                    {
                        if (j.X < 0)
                        {
                            shiftX = j.X * valueAsDouble / LeftBase;
                        }
                    }
                    if ((maxValue - valueAsDouble) < RightBase)
                    {
                        if (j.X > 0)
                        {
                            shiftX = j.X * (maxValue - valueAsDouble) / RightBase;
                        }
                    }

                    newShape.Add(new Point(shiftX, j.Y));
                }
            }

            return newShape;
        }
开发者ID:jevonsflash,项目名称:ProjectMato,代码行数:50,代码来源:ProgressTriangleConverter.cs

示例11: CreatePolygonBox

        // Creates a square polygon with a hole centered at the given point
        private Polygon CreatePolygonBox(MapPoint center, double length)
        {
            var halfLen = length / 2.0;

            PointCollection coords = new PointCollection();
			coords.Add(new MapPoint(center.X - halfLen, center.Y + halfLen));
			coords.Add(new MapPoint(center.X + halfLen, center.Y + halfLen));
			coords.Add(new MapPoint(center.X + halfLen, center.Y - halfLen));
			coords.Add(new MapPoint(center.X - halfLen, center.Y - halfLen));
			coords.Add(new MapPoint(center.X - halfLen, center.Y + halfLen));

            halfLen /= 3;
            PointCollection coordsHole = new PointCollection();
			coordsHole.Add(new MapPoint(center.X - halfLen, center.Y + halfLen));
			coordsHole.Add(new MapPoint(center.X - halfLen, center.Y - halfLen));
			coordsHole.Add(new MapPoint(center.X + halfLen, center.Y - halfLen));
			coordsHole.Add(new MapPoint(center.X + halfLen, center.Y + halfLen));
			coordsHole.Add(new MapPoint(center.X - halfLen, center.Y + halfLen));

            return new Polygon(
				new List<PointCollection> { coords, coordsHole }, 
				MyMapView.SpatialReference);
        }
开发者ID:jordanparfitt,项目名称:arcgis-runtime-samples-dotnet,代码行数:24,代码来源:CreatePolygons.xaml.cs

示例12: EnvelopeToPolygon

        public static Geometry EnvelopeToPolygon(Geometry geometry)
        {
            if (!(geometry is Envelope))
            return null;

              Envelope envelope = geometry as Envelope;
              Polygon polygon = new Polygon();
              polygon.SpatialReference = envelope.SpatialReference;

              PointCollection pointCollection = new PointCollection();

              MapPoint topLeft = new MapPoint();
              topLeft.X = envelope.XMin;
              topLeft.Y = envelope.YMax;
              pointCollection.Add(topLeft);

              MapPoint topRight = new MapPoint();
              topRight.X = envelope.XMax;
              topRight.Y = envelope.YMax;
              pointCollection.Add(topRight);

              MapPoint bottomRight = new MapPoint();
              bottomRight.X = envelope.XMax;
              bottomRight.Y = envelope.YMin;
              pointCollection.Add(bottomRight);

              MapPoint bottomLeft = new MapPoint();
              bottomLeft.X = envelope.XMin;
              bottomLeft.Y = envelope.YMin;
              pointCollection.Add(bottomLeft);

              pointCollection.Add(topLeft);

              polygon.Rings.Add(pointCollection);

              return polygon as Geometry;
        }
开发者ID:RockDr,项目名称:route-monitor-for-geoevent,代码行数:37,代码来源:Helper.cs

示例13: GetRadiusAsPolygonGeodesic

        public static Polygon GetRadiusAsPolygonGeodesic(MapPoint center, double distance, int pointCount)
        {
            Polyline line = GetRadiusGeodesicAsPolyline(center, distance, pointCount);
            Polygon poly = new Polygon() { SpatialReference = new SpatialReference(4326) };

            if (line.Paths.Count > 1)
            {
                PointCollection ring = line.Paths[0];
                MapPoint last = ring[ring.Count - 1];
                for (int i = 1; i < line.Paths.Count; i++)
                {
                    PointCollection pnts = line.Paths[i];
                    ring.Add(new MapPoint(180 * Math.Sign(last.X), 90 * Math.Sign(center.Y)));
                    last = pnts[0];
                    ring.Add(new MapPoint(180 * Math.Sign(last.X), 90 * Math.Sign(center.Y)));
                    foreach (MapPoint p in pnts)
                        ring.Add(p);
                    last = pnts[pnts.Count - 1];
                }
                poly.Rings.Add(ring);
            }
            else
            {
                poly.Rings.Add(line.Paths[0]);
            }
            if (distance > _EARTHCIRCUMFERENCE_ * Math.PI / 2 && line.Paths.Count != 2)
            {
                PointCollection pnts = new PointCollection();
                pnts.Add(new MapPoint(-180, -90));
                pnts.Add(new MapPoint(180, -90));
                pnts.Add(new MapPoint(180, 90));
                pnts.Add(new MapPoint(-180, 90));
                pnts.Add(new MapPoint(-180, -90));
                poly.Rings.Add(pnts); //Exterior
            }
            return poly;
        }
开发者ID:Esri,项目名称:arcgis-toolkit-sl-wpf,代码行数:37,代码来源:GeoRssLoader.cs

示例14: Convert

        public object Convert(object value, Type targetType, object parameter, string language)
        {
            var sw = Window.Current.Bounds.Width;
            var sh = Window.Current.Bounds.Height;
            var input = (PointCollection) value;

            var pc = new PointCollection();
            foreach (var p in input)
            {
                pc.Add(new Point(p.X * sw * 0.08, p.Y * sh * 0.08));

            }

            return pc;
        }
开发者ID:philllies,项目名称:finalproject,代码行数:15,代码来源:PointConverter.cs

示例15: CalculateWheels

 private PointCollection CalculateWheels(WheelsData CurrentData, 
                                         double inc)
 {
     PointCollection pts = new PointCollection();
     var maxAngle = CurrentData.SuggestedMaxTurns * 2 * Math.PI; 
     for (double t = 0; t < maxAngle; t += inc)
     {
         Complex c = new Complex();
         foreach (WheelStageData sd in CurrentData.Stages)
         {
             c += sd.Amplitude * Complex.Exp(new Complex(0,sd.Frequency * t ));
         }
         pts.Add(new Point(c.Real, c.Imaginary));
     }
     return pts;
 }
开发者ID:dolkensp,项目名称:OTWB,代码行数:16,代码来源:WheelsEngine.cs


注:本文中的PointCollection.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。