ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Core.Geometry Namespace / AttributeFlags Enumeration
Example Example

In This Topic
    AttributeFlags Enumeration
    In This Topic
    Flags used when creating a geometry in some GeometryBuilderEx methods specifying which attributes, Z, M, and ID, the newly created geometry should have. Use bitwise OR to specify more than one attribute. For example, to specify that the geometry should have Z and M-values, specify AttributeFlags.HasZ | AttributeFlags.HasM.
    Syntax
    Members
    MemberDescription
    AllAttributes Specifies that the geometry has Z, M and ID-values.
    HasID Specifies that the geometry has ID-values.
    HasM Specified that the geometry has M-values.
    HasZ Specifies that the geometry has Z-values.
    None Specifies that the geometry has no attributes. It does not have Z, M or ID-values.
    Example
    Builder Properties
    // list of points
    List<MapPoint> points = new List<MapPoint>
    {
      MapPointBuilderEx.CreateMapPoint(0, 0, 2, 3, 1),
      MapPointBuilderEx.CreateMapPoint(1, 1, 5, 6),
      MapPointBuilderEx.CreateMapPoint(2, 1, 6),
      MapPointBuilderEx.CreateMapPoint(0, 0)
    };
    
    // will have attributes because it is created with convenience method
    Polyline polylineWithAttrs = PolylineBuilderEx.CreatePolyline(points);
    bool hasZ = polylineWithAttrs.HasZ;          // hasZ = true
    bool hasM = polylineWithAttrs.HasM;          // hasM = true
    bool hasID = polylineWithAttrs.HasID;        // hasID = true
    
    // will not have attributes because it is specified as a parameter
    Polyline polylineWithoutAttrs = 
      PolylineBuilderEx.CreatePolyline(points, AttributeFlags.None);
    hasZ = polylineWithoutAttrs.HasZ;          // hasZ = false
    hasM = polylineWithoutAttrs.HasM;          // hasM = false
    hasID = polylineWithoutAttrs.HasID;        // hasID = false
    
    // will have attributes because it is created with convenience method
    Polygon polygonWithAttrs = PolygonBuilderEx.CreatePolygon(points);
    hasZ = polygonWithAttrs.HasZ;               // hasZ = true
    hasM = polygonWithAttrs.HasM;               // hasM = true
    hasID = polygonWithAttrs.HasID;             // hasID = true
    
    // will not have attributes because it is specified as a parameter
    Polygon polygonWithoutAttrs = 
          PolygonBuilderEx.CreatePolygon(points, AttributeFlags.None);
    hasZ = polygonWithoutAttrs.HasZ;               // hasZ = false
    hasM = polygonWithoutAttrs.HasM;               // hasM = false
    hasID = polygonWithoutAttrs.HasID;             // hasID = false
    
    // will not have attributes because it is specified as a parameter
    PolylineBuilderEx polylineB = 
               new PolylineBuilderEx(points, AttributeFlags.None);
    hasZ = polylineB.HasZ;                      // hasZ = false
    hasM = polylineB.HasM;                      // hasM = false
    hasID = polylineB.HasID;                    // hasID = false
    
    // will have attributes because it is passed an attributed polyline
    polylineB = new PolylineBuilderEx(polylineWithAttrs);
    hasZ = polylineB.HasZ;                      // hasZ = true
    hasM = polylineB.HasM;                      // hasM = true
    hasID = polylineB.HasID;                    // hasID = true
    
    // will not have attributes because it is passed a non-attributed polyline
    polylineB = new PolylineBuilderEx(polylineWithoutAttrs);
    hasZ = polylineB.HasZ;                      // hasZ = false
    hasM = polylineB.HasM;                      // hasM = false
    hasID = polylineB.HasID;                    // hasID = false
    
    // will not have attributes because it is specified as a parameter
    PolygonBuilderEx polygonB = new PolygonBuilderEx(points, AttributeFlags.None);
    hasZ = polygonB.HasZ;                       // hasZ = false
    hasM = polygonB.HasM;                       // hasM = false
    hasID = polygonB.HasID;                     // hasID = false
    
    // will have attributes because it is passed an attributed polygon
    polygonB = new PolygonBuilderEx(polygonWithAttrs);
    hasZ = polygonB.HasZ;                       // hasZ = true
    hasM = polygonB.HasM;                       // hasM = true
    hasID = polygonB.HasID;                     // hasID = true
    
    // will not have attributes because it is passed a non-attributed polygon
    polygonB = new PolygonBuilderEx(polygonWithoutAttrs);
    hasZ = polygonB.HasZ;                       // hasZ = true
    hasM = polygonB.HasM;                       // hasM = true
    hasID = polygonB.HasID;                     // hasID = true
    
    Construct a Polyline - from an enumeration of MapPoints
    // Use a builderEx convenience method or a builderEx constructor.
    // neither need to run on the MCT
    
    MapPoint startPt = MapPointBuilderEx.CreateMapPoint(1.0, 1.0);
    MapPoint endPt = MapPointBuilderEx.CreateMapPoint(2.0, 1.0);
    
    List<MapPoint> list = new List<MapPoint>() { startPt, endPt };
    
    Polyline polyline = PolylineBuilderEx.CreatePolyline(list, SpatialReferences.WGS84);
    
    // use AttributeFlags.None since we only have 2D points in the list
    PolylineBuilderEx pb = new PolylineBuilderEx(list, AttributeFlags.None);
    pb.SpatialReference = SpatialReferences.WGS84;
    Polyline polyline2 = pb.ToGeometry();
    
    // Use AttributeFlags.NoAttributes because we only have 2d points in the list
    Polyline polyline4 = PolylineBuilderEx.CreatePolyline(list, AttributeFlags.None);
    
    Build a multi-part Polyline
    List<MapPoint> firstPoints = new List<MapPoint>();
    firstPoints.Add(MapPointBuilderEx.CreateMapPoint(1.0, 1.0));
    firstPoints.Add(MapPointBuilderEx.CreateMapPoint(1.0, 2.0));
    firstPoints.Add(MapPointBuilderEx.CreateMapPoint(2.0, 2.0));
    firstPoints.Add(MapPointBuilderEx.CreateMapPoint(2.0, 1.0));
    
    List<MapPoint> nextPoints = new List<MapPoint>();
    nextPoints.Add(MapPointBuilderEx.CreateMapPoint(11.0, 1.0));
    nextPoints.Add(MapPointBuilderEx.CreateMapPoint(11.0, 2.0));
    nextPoints.Add(MapPointBuilderEx.CreateMapPoint(12.0, 2.0));
    nextPoints.Add(MapPointBuilderEx.CreateMapPoint(12.0, 1.0));
    
    // use AttributeFlags.None since we have 2D points in the list
    PolylineBuilderEx pBuilder = new PolylineBuilderEx(firstPoints, AttributeFlags.None);
    pBuilder.AddPart(nextPoints);
    
    Polyline polyline = pBuilder.ToGeometry();
    // polyline has 2 parts
    
    pBuilder.RemovePart(0);
    polyline = pBuilder.ToGeometry();
    // polyline has 1 part
    
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             ArcGIS.Core.Geometry.AttributeFlags

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also