Click or drag to resize

PointCollection Class

Collection of MapPoint.
Inheritance Hierarchy
SystemObject
  Esri.ArcGISRuntime.GeometryPointCollection

Namespace:  Esri.ArcGISRuntime.Geometry
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.9.0
Syntax
public class PointCollection : IList<MapPoint>, 
	ICollection<MapPoint>, IEnumerable<MapPoint>, IEnumerable

The PointCollection type exposes the following members.

Constructors
  NameDescription
Public methodPointCollection
Initializes a new instance of the PointCollection class without a SpatialReference
Public methodPointCollection(IEnumerableMapPoint)
Initializes a new instance of the PointCollection class. Populates with the supplied points.
Public methodCode examplePointCollection(SpatialReference)
Initializes a new instance of the PointCollection class with a given SpatialReference
Public methodPointCollection(IEnumerableMapPoint, SpatialReference)
Initializes a new instance of the PointCollection class. The spatial reference is used if the input points don't have one.
Top
Properties
  NameDescription
Public propertyCapacity
Reserves space to hold a specified number of points. If the number of points are known in advance this provides a performance benefit as it avoid reallocations as the collection grows.
Public propertyCode exampleCount
Public propertyIsReadOnly
Public propertyItem
Gets or sets the element at the specified index.
Public propertySpatialReference
The spatial reference of this point collection.
Top
Methods
  NameDescription
Public methodCode exampleAdd(MapPoint)
Public methodCode exampleAdd(Double, Double)
Adds a new point with the specified x and y coordinate
Public methodAdd(Double, Double, Double)
Adds a new point with a specified x,y,z coordinate
Public methodCode exampleAddPoints
Adds a collection of points to the end of this point collection
Public methodCode exampleClear
Public methodClone
Creates a deep clone of the current PointCollection. All points are copied into the new instance.
Public methodContains
Public methodCopyTo
Copies a collection of coordinates to this instance.
Public methodCode exampleGetEnumerator
Returns an enumerator that iterates through the collection.
Public methodGetPoint(Int32, Double, Double)
Gets the coordinates of a specified point
Public methodGetPoint(Int32, Double, Double, Double)
Gets the coordinates of a specified 3D point
Public methodIndexOf
Public methodInsert
Public methodRemove
Public methodRemoveAt
Public methodSetPoint(Int32, Double, Double)
Sets the coordinates of a specified point
Public methodSetPoint(Int32, Double, Double, Double)
Sets the coordinates of a specified point
Top
Examples

WPF

Example Name: AddGraphicsRenderer

A renderer allows you to change the style of all graphics in a graphics overlay by referencing a single symbol style.

Code example screen shot.

C#
// Copyright 2019 Esri.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
// language governing permissions and limitations under the License.

using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI;
using System.Drawing;

namespace ArcGISRuntime.WPF.Samples.AddGraphicsRenderer
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        name: "Add graphics with renderer",
        category: "GraphicsOverlay",
        description: "A renderer allows you to change the style of all graphics in a graphics overlay by referencing a single symbol style.",
        instructions: "Run the sample and view graphics for points, lines, and polygons, which are stylized using renderers.",
        tags: new[] { "GraphicsOverlay", "SimpleMarkerSymbol", "SimpleRenderer" })]
    public partial class AddGraphicsRenderer
    {
        public AddGraphicsRenderer()
        {
            InitializeComponent();
            Initialize();
        }

        private void Initialize()
        {
            // Create a map with 'Imagery with Labels' basemap.
            Map myMap = new Map(Basemap.CreateImageryWithLabels());

            // Assign the map to the MapView.
            MyMapView.Map = myMap;

            // Create a center point for the graphics.
            MapPoint centerPoint = new MapPoint(-117.195800, 34.056295, SpatialReferences.Wgs84);

            // Create an envelope from that center point.
            Envelope pointExtent = new Envelope(centerPoint, .07, .035);

            // Create a collection of points on the corners of the envelope.
            PointCollection points = new PointCollection(SpatialReferences.Wgs84)
            {
                new MapPoint(pointExtent.XMax, pointExtent.YMax),
                new MapPoint(pointExtent.XMax, pointExtent.YMin),
                new MapPoint(pointExtent.XMin, pointExtent.YMax),
                new MapPoint(pointExtent.XMin, pointExtent.YMin),
            };

            // Create overlay to where graphics are shown.
            GraphicsOverlay overlay = new GraphicsOverlay();

            // Add points to the graphics overlay.
            foreach (MapPoint point in points)
            {
                // Create new graphic and add it to the overlay.
                overlay.Graphics.Add(new Graphic(point));
            }

            // Create symbol for points.
            SimpleMarkerSymbol pointSymbol = new SimpleMarkerSymbol()
            {
                Color = Color.Yellow,
                Size = 30,
                Style = SimpleMarkerSymbolStyle.Square
            };

            // Create simple renderer with symbol.
            SimpleRenderer renderer = new SimpleRenderer(pointSymbol);

            // Set renderer to graphics overlay.
            overlay.Renderer = renderer;

            // Add created overlay to the MapView.
            MyMapView.GraphicsOverlays.Add(overlay);

            // Center the MapView on the points.
            MyMapView.SetViewpointGeometryAsync(pointExtent, 50);
        }
    }
}
XAML
<UserControl x:Class="ArcGISRuntime.WPF.Samples.AddGraphicsRenderer.AddGraphicsRenderer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <esri:MapView x:Name="MyMapView"/>
    </Grid>
</UserControl>
See Also
Additional Examples
Hyperlink to ExampleDescription
AddGraphicsRendererA renderer allows you to change the style of all graphics in a graphics overlay by referencing a single symbol style.
AddGraphicsWithSymbolsUse a symbol style to display a graphic on a graphics overlay.
Animate3DGraphicAn `OrbitGeoElementCameraController` follows a graphic while the graphic's position and rotation are animated.
ConvexHullCreate a convex hull for a given set of points. The convex hull is a polygon with shortest perimeter that encloses a set of points. As a visual analogy, consider a set of points as nails in a board. The convex hull of the points would be like a rubber band stretched around the outermost nails.
ConvexHullListGenerate convex hull polygon(s) from multiple input geometries.
CreateGeometriesCreate simple geometry types.
CutGeometryCut a geometry along a polyline.
DensifyAndGeneralizeA multipart geometry can be densified by adding interpolated points at regular intervals. Generalizing multipart geometry simplifies it while preserving its general shape. Densifying a multipart geometry adds more vertices at regular intervals.
DictionaryRendererGraphicsOverlayThis sample demonstrates applying a dictionary renderer to graphics, in order to display military symbology without the need for a feature table.
GeodesicOperationsCalculate a geodesic path between two points and measure its distance.
NearestVertexFind the closest vertex and coordinate of a geometry to a point.
SpatialOperationsFind the union, intersection, or difference of two geometries.
SpatialRelationshipsDetermine spatial relationships between two geometries.