public StPoint(string wkt) { if (wkt.ToUpper().Contains("Z")) { HasZ = true; } if (wkt.ToUpper().Contains("M")) { HasM = true; } string coordsText = wkt.ToUpper().Replace("POINT", String.Empty).Replace("Z", String.Empty).Replace("M", String.Empty).Replace("(", String.Empty).Replace(")", String.Empty).Trim(); string[] coords = coordsText.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); decimal x = Convert.ToDecimal(coords[0], CultureInfo.InvariantCulture); decimal y = Convert.ToDecimal(coords[1], CultureInfo.InvariantCulture); decimal?z = null; decimal?m = null; if (HasZ && HasM) { z = Convert.ToDecimal(coords[2], CultureInfo.InvariantCulture); m = Convert.ToDecimal(coords[3], CultureInfo.InvariantCulture); } else if (HasZ) { z = Convert.ToDecimal(coords[2], CultureInfo.InvariantCulture); } else if (HasM) { m = Convert.ToDecimal(coords[2], CultureInfo.InvariantCulture); } X = new StCoordinate(x, StCoordType.X); Y = new StCoordinate(y, StCoordType.Y); if (HasZ) { if (!z.HasValue) { throw new ArgumentException(); } Z = new StCoordinate(z.Value, StCoordType.Z); } if (HasM) { if (!m.HasValue) { throw new ArgumentException(); } M = new StCoordinate(m.Value, StCoordType.M); } CalculateBytes(); }
public StPoint(decimal x, decimal y, decimal? z = null, decimal? m = null) { X = new StCoordinate(x, StCoordType.X); Y = new StCoordinate(y, StCoordType.Y); if (z.HasValue) { HasZ = true; Z = new StCoordinate(z.Value, StCoordType.Z); } if (m.HasValue) { HasM = true; M = new StCoordinate(m.Value, StCoordType.M); } // Set Bytes CalculateBytes(); }
public StPoint(byte[] x, byte[] y, byte[] z = null, byte[] m = null) { X = new StCoordinate(x, StCoordType.X); Y = new StCoordinate(y, StCoordType.Y); if (z != null) { HasZ = true; Z = new StCoordinate(z, StCoordType.Z); } if (m != null) { HasM = true; M = new StCoordinate(m, StCoordType.M); } // Set Bytes CalculateBytes(); }
public StPoint(decimal x, decimal y, decimal?z = null, decimal?m = null) { X = new StCoordinate(x, StCoordType.X); Y = new StCoordinate(y, StCoordType.Y); if (z.HasValue) { HasZ = true; Z = new StCoordinate(z.Value, StCoordType.Z); } if (m.HasValue) { HasM = true; M = new StCoordinate(m.Value, StCoordType.M); } // Set Bytes CalculateBytes(); }
private void SetGeometry(List <List <byte> > bytesList) { X = new StCoordinate(bytesList[0], StCoordType.X); Y = new StCoordinate(bytesList[1], StCoordType.Y); if (HasZ && HasM) { Z = new StCoordinate(bytesList[2], StCoordType.Z); M = new StCoordinate(bytesList[3], StCoordType.M); } else if (HasZ) { Z = new StCoordinate(bytesList[2], StCoordType.Z); } else if (HasM) { M = new StCoordinate(bytesList[2], StCoordType.M); } }
public StPoint(string wkt) { if (wkt.ToUpper().Contains("Z")) HasZ = true; if (wkt.ToUpper().Contains("M")) HasM = true; string coordsText = wkt.ToUpper().Replace("POINT", String.Empty).Replace("Z", String.Empty).Replace("M", String.Empty).Replace("(", String.Empty).Replace(")", String.Empty).Trim(); string[] coords = coordsText.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); decimal x = Convert.ToDecimal(coords[0], CultureInfo.InvariantCulture); decimal y = Convert.ToDecimal(coords[1], CultureInfo.InvariantCulture); decimal? z = null; decimal? m = null; if (HasZ && HasM) { z = Convert.ToDecimal(coords[2], CultureInfo.InvariantCulture); m = Convert.ToDecimal(coords[3], CultureInfo.InvariantCulture); } else if (HasZ) z = Convert.ToDecimal(coords[2], CultureInfo.InvariantCulture); else if (HasM) m = Convert.ToDecimal(coords[2], CultureInfo.InvariantCulture); X = new StCoordinate(x, StCoordType.X); Y = new StCoordinate(y, StCoordType.Y); if (HasZ) { if (!z.HasValue) throw new ArgumentException(); Z = new StCoordinate(z.Value, StCoordType.Z); } if (HasM) { if (!m.HasValue) throw new ArgumentException(); M = new StCoordinate(m.Value, StCoordType.M); } CalculateBytes(); }
private void SetGeometry(List<List<byte>> bytesList) { X = new StCoordinate(bytesList[0], StCoordType.X); Y = new StCoordinate(bytesList[1], StCoordType.Y); if (HasZ && HasM) { Z = new StCoordinate(bytesList[2], StCoordType.Z); M = new StCoordinate(bytesList[3], StCoordType.M); } else if (HasZ) Z = new StCoordinate(bytesList[2], StCoordType.Z); else if (HasM) M = new StCoordinate(bytesList[2], StCoordType.M); }