public void Set(CoordinateOrder co, float _e1, float _e2, float _e3, float _ni) { m_c[0] = _e1; m_c[1] = _e2; m_c[2] = _e3; m_c[3] = _ni; }
public void Set(CoordinateOrder co, float[] A) { m_c[0] = A[0]; m_c[1] = A[1]; m_c[2] = A[2]; m_c[3] = A[3]; }
public void Set(CoordinateOrder co, float _e1_ni, float _e2_ni, float _e3_ni, float _no_ni) { m_c[0] = _e1_ni; m_c[1] = _e2_ni; m_c[2] = _e3_ni; m_c[3] = _no_ni; }
/// <summary> /// Writes a <see cref="ShapeData"/> instance as Well-Known Text according to the OGC Simple Features Specification 1.2.0. /// </summary> /// <param name="g">Geometry</param> /// <param name="includeZ">Include Z values</param> /// <param name="includeM">Include M values</param> /// <param name="order"></param> /// <returns>Well-Known Text</returns> public static string Write(ShapeData g, bool includeZ, bool includeM, CoordinateOrder order) { StringBuilder sb = new StringBuilder(); WriteGeometry(g, sb, includeZ, includeM, order); return(sb.ToString()); }
/// <summary> /// Writes a <see cref="ShapeData"/> instance as Well-Known Text according to the OGC Simple Features Specification 1.2.0. /// </summary> /// <param name="g">Geometry</param> /// <param name="order"></param> /// <returns>Well-Known Text</returns> public static string Write(ShapeData g, CoordinateOrder order) { if (g.IsNull) { return("Null"); } return(Write(g, g.HasZ, g.HasM, order)); }
public void Set(CoordinateOrder co, float _e1_e2, float _e1_e3, float _e2_e3, float _e1_ni, float _e2_ni, float _e3_ni) { m_c[0] = _e1_e2; m_c[1] = _e1_e3; m_c[2] = _e2_e3; m_c[3] = _e1_ni; m_c[4] = _e2_ni; m_c[5] = _e3_ni; }
public static ShapeData Parse(ReadOnlySpan <byte> str, CoordinateOrder order) { if (str.Length == 0) { throw new FormatException("24112: The well-known text (WKT) input is empty. To input an empty instance, specify an empty instance of one of the following types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, CircularString, CompoundCurve, CurvePolygon or GeometryCollection."); } var reader = new WktReader(str, order); return(reader.ReadShape()); }
public void Set(CoordinateOrder co, float[] A) { m_c[0] = A[0]; m_c[1] = A[1]; m_c[2] = A[2]; m_c[3] = A[3]; m_c[4] = A[4]; m_c[5] = A[5]; m_c[6] = A[6]; m_c[7] = A[7]; m_c[8] = A[8]; m_c[9] = A[9]; }
private WktReader(ReadOnlySpan <byte> str, CoordinateOrder order) { hasZ = false; hasM = false; _vertices = new List <Point>(); _z = new List <double>(); _m = new List <double>(); _figures = new List <Figure>(); _segments = new List <Segment>(); _shapes = new List <Shape>(); _index = 0; length = str.Length; _order = order; wkt = str; }
/// <summary> /// Constructs a new plane with each coordinate specified. /// </summary> public plane(CoordinateOrder co, float e1_e2_e3_ni, float no_e2_e3_ni, float no_e1_e3_ni, float no_e1_e2_ni) { Set(co, e1_e2_e3_ni, no_e2_e3_ni, no_e1_e3_ni, no_e1_e2_ni); }
/// <summary>Returns array of coordinates. /// </summary> /// <param name="coordOrder">pass the value 'flatPoint.coord_e1ni_e2ni_e3ni_noni' /// </param> public float[] c(CoordinateOrder coordOrder) { return(m_c); }
/// <summary> /// Constructs a new vectorE3GA with each coordinate specified. /// </summary> public vectorE3GA(CoordinateOrder co, float e1, float e2, float e3) { Set(co, e1, e2, e3); }
/// <summary> /// Constructs a new flatPoint. Coordinate values come from 'A'. /// </summary> public flatPoint(CoordinateOrder co, float[] A) { Set(co, A); }
private static void WriteCoordinateCollection(IEnumerable <PointZM> coords, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order) { bool firstItem = true; foreach (var c in coords) { if (firstItem) { firstItem = false; } else { sb.Append(", "); } WriteCoordinate(c, sb, includeZ, includeM, order); } }
private static void WriteCoordinate(PointZM coord, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order) { if (order == CoordinateOrder.XY) { sb.AppendFormat(CultureInfo.InvariantCulture, "{0} {1}", coord.X, coord.Y); } else { sb.AppendFormat(CultureInfo.InvariantCulture, "{0} {1}", coord.Y, coord.X); } if (includeZ) { if (!double.IsNaN(coord.Z)) { sb.AppendFormat(CultureInfo.InvariantCulture, " {0}", coord.Z); } } if (includeM) { if (!double.IsNaN(coord.M)) { sb.AppendFormat(CultureInfo.InvariantCulture, " {0}", coord.M); } } }
public void Set(CoordinateOrder co) { }
/// <summary> /// Constructs a new normalizedPoint. Coordinate values come from 'A'. /// </summary> public normalizedPoint(CoordinateOrder co, float[] A) { Set(co, A); }
/// <summary> /// Constructs a new line with each coordinate specified. /// </summary> public line(CoordinateOrder co, float e1_e2_ni, float e1_e3_ni, float e2_e3_ni, float e1_no_ni, float e2_no_ni, float e3_no_ni) { Set(co, e1_e2_ni, e1_e3_ni, e2_e3_ni, e1_no_ni, e2_no_ni, e3_no_ni); }
/// <summary> /// Constructs a new line. Coordinate values come from 'A'. /// </summary> public line(CoordinateOrder co, float[] A) { Set(co, A); }
/// <summary> /// Constructs a new vectorE3GA. Coordinate values come from 'A'. /// </summary> public vectorE3GA(CoordinateOrder co, float[] A) { Set(co, A); }
public void Set(CoordinateOrder co, float[] A) { m_c[0] = A[0]; m_c[1] = A[1]; m_c[2] = A[2]; }
public void Set(CoordinateOrder co, float _e1, float _e2, float _e3) { m_c[0] = _e1; m_c[1] = _e2; m_c[2] = _e3; }
/// <summary> /// Constructs a new circle with each coordinate specified. /// </summary> public circle(CoordinateOrder co, float no_e1_e2, float no_e1_e3, float no_e2_e3, float e1_e2_e3, float no_e1_ni, float no_e2_ni, float e1_e2_ni, float no_e3_ni, float e1_e3_ni, float e2_e3_ni) { Set(co, no_e1_e2, no_e1_e3, no_e2_e3, e1_e2_e3, no_e1_ni, no_e2_ni, e1_e2_ni, no_e3_ni, e1_e3_ni, e2_e3_ni); }
private static void WriteGeometry(ShapeData geometry, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order) { var type = geometry.Type; // Special handling for FULLGLOBE if (type == OGCGeometryType.FullGlobe) { sb.Append("FULLGLOBE"); return; } sb.Append(type.ToString().ToUpperInvariant()); if (geometry.IsEmpty) { sb.Append(" EMPTY"); return; } else { sb.Append(" ("); } if (type == OGCGeometryType.Point) { WritePoint(geometry, sb, includeZ, includeM, order); } else if (type == OGCGeometryType.LineString) { WriteLineString(geometry, sb, includeZ, includeM, order); } else if (type == OGCGeometryType.Polygon) { WritePolygon(geometry, sb, includeZ, includeM, order); } else if (type == OGCGeometryType.MultiPoint) { WriteMultiPoint(geometry, sb, includeZ, includeM, order); } else if (type == OGCGeometryType.MultiLineString) { WriteMultiLineString(geometry, sb, includeZ, includeM, order); } else if (type == OGCGeometryType.MultiPolygon) { WriteMultiPolygon(geometry, sb, includeZ, includeM, order); } else if (type == OGCGeometryType.GeometryCollection) { WriteGeometryCollection(geometry, sb, includeZ, includeM, order); } else { throw new ArgumentException("Invalid Geometry Type"); } sb.Append(")"); }
public void Set(CoordinateOrder co, float _no_e1_e2, float _no_e1_e3, float _no_e2_e3, float _e1_e2_e3, float _no_e1_ni, float _no_e2_ni, float _e1_e2_ni, float _no_e3_ni, float _e1_e3_ni, float _e2_e3_ni) { m_c[0] = _no_e1_e2; m_c[1] = _no_e1_e3; m_c[2] = _no_e2_e3; m_c[3] = _e1_e2_e3; m_c[4] = _no_e1_ni; m_c[5] = _no_e2_ni; m_c[6] = _e1_e2_ni; m_c[7] = _no_e3_ni; m_c[8] = _e1_e3_ni; m_c[9] = _e2_e3_ni; }
private static void WriteGeometryCollection(ShapeData geoms, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order) { for (int i = 0; i < geoms.NumGeometries; i++) { if (i > 0) { sb.Append(","); } WriteGeometry(geoms.GetGeometryN(i + 1), sb, includeZ, includeM, order); } }
/// <summary> /// Constructs a new normalizedPoint with each coordinate specified. /// </summary> public normalizedPoint(CoordinateOrder co, float e1, float e2, float e3, float ni) { Set(co, e1, e2, e3, ni); }
/// <summary> /// Constructs a new flatPoint with each coordinate specified. /// </summary> public flatPoint(CoordinateOrder co, float e1_ni, float e2_ni, float e3_ni, float no_ni) { Set(co, e1_ni, e2_ni, e3_ni, no_ni); }
public void Set(CoordinateOrder co, float[] A) { }
public void Set(CoordinateOrder co, float _e1_e2_ni, float _e1_e3_ni, float _e2_e3_ni, float _e1_no_ni, float _e2_no_ni, float _e3_no_ni) { m_c[0] = _e1_e2_ni; m_c[1] = _e1_e3_ni; m_c[2] = _e2_e3_ni; m_c[3] = _e1_no_ni; m_c[4] = _e2_no_ni; m_c[5] = _e3_no_ni; }
/// <summary> /// Constructs a new pointPair. Coordinate values come from 'A'. /// </summary> public pointPair(CoordinateOrder co, float[] A) { Set(co, A); }
/// <summary> /// Constructs a new pointPair with each coordinate specified. /// </summary> public pointPair(CoordinateOrder co, float no_e1, float no_e2, float e1_e2, float no_e3, float e1_e3, float e2_e3, float no_ni, float e1_ni, float e2_ni, float e3_ni) { Set(co, no_e1, no_e2, e1_e2, no_e3, e1_e3, e2_e3, no_ni, e1_ni, e2_ni, e3_ni); }
private static void WritePoint(ShapeData point, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order) { WriteCoordinate(point.GetPointN(1), sb, includeZ, includeM, order); }
public static ShapeData Parse(ReadOnlySpan <byte> str, CoordinateOrder order) { var reader = new WktReader(str, order); return(reader.ReadShape()); }
private static void WriteMultiPoint(ShapeData points, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order) { for (int i = 0; i < points.NumPoints; i++) { if (i > 0) { sb.Append(","); } WriteCoordinate(points.GetPointN(i + 1), sb, includeZ, includeM, order); } }
private static void WriteLineString(ShapeData line, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order) { WriteCoordinateCollection(GetVertices(line), sb, includeZ, includeM, order); }
private static void WriteMultiLineString(ShapeData lines, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order) { sb.Append('('); for (int i = 0; i < lines.NumGeometries; i++) { if (i > 0) { sb.Append("),("); } WriteCoordinateCollection(GetVertices(lines.GetRing(i)), sb, includeZ, includeM, order); } sb.Append(")"); }
private static void WritePolygon(ShapeData polygon, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order) { WritePolygonContents(polygon, sb, includeZ, includeM, order); }
/// <summary> /// Constructs a new circle. Coordinate values come from 'A'. /// </summary> public circle(CoordinateOrder co, float[] A) { Set(co, A); }
private static void WritePolygonContents(ShapeData polygon, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order) { sb.Append('('); WriteCoordinateCollection(GetVertices(polygon.GetRing(0)), sb, includeZ, includeM, order); for (int i = 0; i < polygon.NumInteriorRing; i++) { sb.Append("),("); WriteCoordinateCollection(GetVertices(polygon.GetRing(i + 1)), sb, includeZ, includeM, order); } sb.Append(')'); }
/// <summary>Returns array of coordinates. /// </summary> /// <param name="coordOrder">pass the value 'circle.coord_noe1e2_noe1e3_noe2e3_e1e2e3_noe1ni_noe2ni_e1e2ni_noe3ni_e1e3ni_e2e3ni' /// </param> public float[] c(CoordinateOrder coordOrder) { return m_c; }
private static void WriteMultiPolygon(ShapeData polys, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order) { sb.Append('('); for (int i = 0; i < polys.NumGeometries; i++) { if (i > 0) { sb.Append("),("); } WritePolygonContents(polys.GetGeometryN(i + 1), sb, includeZ, includeM, order); } sb.Append(')'); }
/// <summary> /// Constructs a new dualLine with each coordinate specified. /// </summary> public dualLine(CoordinateOrder co, float e1_e2, float e1_e3, float e2_e3, float e1_ni, float e2_ni, float e3_ni) { Set(co, e1_e2, e1_e3, e2_e3, e1_ni, e2_ni, e3_ni); }