/// <summary> /// Changed but not tested. 93.03.21 /// </summary> /// <returns></returns> public byte[] AsWkb() { List <byte> result = new List <byte>(); if (this.Parts.Count() == 1) { result.AddRange(OgcWkbMapFunctions.ToWkbLineStringZM( ShapeHelper.GetEsriPoints(this, 0), ShapeHelper.GetZValues(this, 0), ShapeHelper.GetMeasures(this, 0))); } else { result.Add((byte)IRI.Standards.OGC.SFA.WkbByteOrder.WkbNdr); result.AddRange(BitConverter.GetBytes((uint)IRI.Standards.OGC.SFA.WkbGeometryType.MultiLineStringZM)); result.AddRange(BitConverter.GetBytes((uint)this.parts.Length)); for (int i = 0; i < this.parts.Length; i++) { result.AddRange( OgcWkbMapFunctions.ToWkbLineStringZM( ShapeHelper.GetEsriPoints(this, this.Parts[i]), ShapeHelper.GetZValues(this, this.Parts[i]), ShapeHelper.GetMeasures(this, this.Parts[i]))); } } return(result.ToArray()); }
public string AsSqlServerWkt() { StringBuilder result = new StringBuilder("MULTILINESTRING("); for (int i = 0; i < NumberOfParts; i++) { result.Append( string.Format("{0},", SqlServerWktMapFunctions.PointZGroupElementToWkt( ShapeHelper.GetEsriPoints(this, i), ShapeHelper.GetZValues(this, i), ShapeHelper.GetMeasures(this, this.Parts[i])))); } return(result.Remove(result.Length - 1, 1).Append(")").ToString()); }
/// <summary> /// Returs Kml representation of the point. Note: Z,M values are igonred /// </summary> /// <returns></returns> static IRI.Ket.KmlFormat.Primitives.PlacemarkType AsPlacemark(EsriPolylineZ polyline, Func <IRI.Msh.Common.Primitives.Point, IRI.Msh.Common.Primitives.Point> projectToGeodeticFunc = null, byte[] color = null) { IRI.Ket.KmlFormat.Primitives.PlacemarkType placemark = new KmlFormat.Primitives.PlacemarkType(); List <IRI.Ket.KmlFormat.Primitives.LineStringType> linestrings = new List <KmlFormat.Primitives.LineStringType>(); IRI.Ket.KmlFormat.Primitives.MultiGeometryType multiGeometry = new KmlFormat.Primitives.MultiGeometryType(); IEnumerable <string> coordinates; if (projectToGeodeticFunc != null) { coordinates = polyline.parts .Select(i => string.Join(" ", ShapeHelper.GetEsriPoints(polyline, i) .Select(j => { var temp = projectToGeodeticFunc(new IRI.Msh.Common.Primitives.Point(j.X, j.Y)); return(string.Format("{0},{1}", temp.X, temp.Y)); }).ToArray())); } else { coordinates = polyline.Parts .Select(i => string.Join(" ", ShapeHelper.GetEsriPoints(polyline, i) .Select(j => string.Format("{0},{1}", j.X, j.Y)) .ToArray())); } foreach (string item in coordinates) { IRI.Ket.KmlFormat.Primitives.LineStringType linestring = new KmlFormat.Primitives.LineStringType(); linestring.coordinates = item; linestrings.Add(linestring); } multiGeometry.AbstractGeometryObjectExtensionGroup = linestrings.ToArray(); placemark.AbstractFeatureObjectExtensionGroup = new KmlFormat.Primitives.AbstractObjectType[] { multiGeometry }; return(placemark); }
//Error Prone: not checking for multipolygon cases public byte[] AsWkb() { List <byte> result = new List <byte>(); result.Add((byte)IRI.Standards.OGC.SFA.WkbByteOrder.WkbNdr); result.AddRange(BitConverter.GetBytes((uint)IRI.Standards.OGC.SFA.WkbGeometryType.Polygon)); result.AddRange(BitConverter.GetBytes((uint)this.parts.Length)); for (int i = 0; i < this.parts.Length; i++) { result.AddRange(OgcWkbMapFunctions.ToWkbLinearRing(ShapeHelper.GetEsriPoints(this, this.Parts[i]))); } return(result.ToArray()); }
public EsriPoint[] GetPart(int partNo) { return(ShapeHelper.GetEsriPoints(this, Parts[partNo])); }