public PolygonZ(ShapeFile shp, BinaryReader br, bool readHeader = true) : base(shp, br, readHeader) { if (!readHeader) { ShapeType = ShapeTypeEnum.PolygonZ; } if (shp.ShapeType != ShapeType) { throw new Exception( $"Unable to process shape! Shape types do not match! (Shapefile: {shp.ShapeType} | Record: {ShapeType}"); } ZRange = new ZRange(br); //ZRangeId = ZRange.Id; for (var i = 0; i < NumberOfParts; i++) { for (var j = 0; j < ((List <Part>)Parts)[i].NumberOfPoints; j++) { ((List <Point>)((List <Part>)Parts)[i].Points)[j].ShapeType = ShapeTypeEnum.PointZ; ((List <Point>)((List <Part>)Parts)[i].Points)[j].Z = br.ReadDouble(); } } MeasurementRange = new MeasurementRange(br); //MeasurementRangeId = MeasurementRange.Id; for (var i = 0; i < NumberOfParts; i++) { for (var j = 0; j < ((List <Part>)Parts)[i].NumberOfPoints; j++) { ((List <Point>)((List <Part>)Parts)[i].Points)[j].M = br.ReadDouble(); } } }
public MultiPointZ(ShapeFile shp, BinaryReader br, bool readHeader = true) : base(shp, br, readHeader) { if (!readHeader) { ShapeType = ShapeTypeEnum.MultiPointZ; } if (shp.ShapeType != ShapeType) { throw new Exception( $"Unable to process shape! Shape types do not match! (Shapefile: {shp.ShapeType} | Record: {ShapeType}"); } ZRange = new ZRange(br); for (var i = 0; i < NumberOfPoints; i++) { ((List <Point>)Points)[i].Z = br.ReadDouble(); } MeasurementRange = new MeasurementRange(br); for (var i = 0; i < NumberOfPoints; i++) { ((List <Point>)Points)[i].M = br.ReadDouble(); } }
public PointM(ShapeFile shp, BinaryReader br, bool readHeader = true) : base(shp, br, readHeader) { if (!readHeader) { ShapeType = ShapeTypeEnum.PointM; } if (shp.ShapeType != ShapeType) { throw new Exception( $"Unable to process shape! Shape types do not match! (Shapefile: {shp.ShapeType} | Record: {ShapeType}"); } M = br.ReadDouble(); }
public Null(ShapeFile shp, BinaryReader br, bool readHeader = true) : base(shp, br, readHeader) { if (!readHeader) { ShapeType = ShapeTypeEnum.Null; } if (shp.ShapeType != ShapeType && ShapeType != ShapeTypeEnum.Null) { throw new Exception( $"Unable to process shape! Shape types do not match and isn't null! (Shapefile: {shp.ShapeType} | Record: {ShapeType}"); } }
public BaseShape(ShapeFile shp, BinaryReader br, bool readHeader = true) { ShapeFile = shp; //ShapeFileId = shp.Id; RecordHeader = readHeader ? new RecordHeader(br) : null; if (RecordHeader != null) { RecordHeaderId = RecordHeader.Id; ShapeType = (ShapeTypeEnum)br.ReadInt32(); } }
public Polyline(ShapeFile shp, BinaryReader br, bool readHeader = true) : base(shp, br, readHeader) { if (!readHeader) { ShapeType = ShapeTypeEnum.Polyline; } if (shp.ShapeType != ShapeType) { throw new Exception( $"Unable to process shape! Shape types do not match! (Shapefile: {shp.ShapeType} | Record: {ShapeType}"); } BoundingBox = new BoundingBox(br); //BoundingBoxId = BoundingBox.Id; NumberOfParts = br.ReadInt32(); NumberOfPoints = br.ReadInt32(); var parts = (List <Part>)Parts; for (var i = 0; i < NumberOfParts; i++) { ((List <Part>)Parts)[i] = new Part(br); if (i > 0) { parts[i - 1].EndIndex = ((List <Part>)Parts)[i].StartIndex - 1; } if (i + 1 == NumberOfParts) { ((List <Part>)Parts)[i].EndIndex = NumberOfPoints - 1; } } for (var i = 0; i < NumberOfParts; i++) { ((List <Part>)Parts)[i].NumberOfPoints = ((List <Part>)Parts)[i].EndIndex - ((List <Part>)Parts)[i].StartIndex + 1; ((List <Part>)Parts)[i].Points = new Point[((List <Part>)Parts)[i].NumberOfPoints]; } for (var i = 0; i < NumberOfParts; i++) { for (var j = 0; j < ((List <Part>)Parts)[i].NumberOfPoints; j++) { ((List <Part>)Parts)[i].Points.Add(new Point(shp, br, false)); } } }
public MultiPoint(ShapeFile shp, BinaryReader br, bool readHeader = true) : base(shp, br, readHeader) { if (!readHeader) { ShapeType = ShapeTypeEnum.MultiPoint; } if (shp.ShapeType != ShapeType) { throw new Exception( $"Unable to process shape! Shape types do not match! (Shapefile: {shp.ShapeType} | Record: {ShapeType}"); } BoundingBox = new BoundingBox(br); BoundingBoxId = BoundingBox.Id; NumberOfPoints = br.ReadInt32(); Points = new HashSet <Point>(); for (var i = 0; i < NumberOfPoints; i++) { Points.Add(new Point(shp, br, false)); } }
public MultiPatch(ShapeFile shp, BinaryReader br, bool readHeader = true) : base(shp, br, readHeader) { if (!readHeader) { ShapeType = ShapeTypeEnum.MultiPatch; } if (shp.ShapeType != ShapeType) { throw new Exception(string.Format( "Unable to process shape! Shape types do not match! (Shapefile: {0} | Record: {1}", shp.ShapeType, ShapeType)); } BoundingBox = new BoundingBox(br); BoundingBoxId = BoundingBox.Id; NumberOfParts = br.ReadInt32(); NumberOfPoints = br.ReadInt32(); var parts = new List <Part>(); for (var i = 0; i < NumberOfParts; i++) { parts.Add(new Part(br)); if (i > 0) { parts[i - 1].EndIndex = ((List <Part>)Parts)[i].StartIndex - 1; } if (i + 1 == NumberOfParts) { ((List <Part>)Parts)[i].EndIndex = NumberOfPoints - 1; } } for (var i = 0; i < NumberOfParts; i++) { ((List <Part>)Parts)[i].NumberOfPoints = ((List <Part>)Parts)[i].EndIndex - ((List <Part>)Parts)[i].StartIndex + 1; ((List <Part>)Parts)[i].Points = new List <Point>(((List <Part>)Parts)[i].NumberOfPoints); } for (var i = 0; i < NumberOfParts; i++) { for (var j = 0; j < ((List <Part>)Parts)[i].NumberOfPoints; j++) { ((List <Part>)Parts)[i].Points.Add(new Point(shp, br, false)); } } ZRange = new ZRange(br); ////ZRangeId = ZRange.Id; for (var i = 0; i < NumberOfParts; i++) { for (var j = 0; j < ((List <Part>)Parts)[i].NumberOfPoints; j++) { ((List <Point>)((List <Part>)Parts)[i].Points)[j].ShapeType = ShapeTypeEnum.PointZ; ((List <Point>)((List <Part>)Parts)[i].Points)[j].Z = br.ReadDouble(); } } MeasurementRange = new MeasurementRange(br); ////MeasurementRangeId = MeasurementRange.Id; for (var i = 0; i < NumberOfParts; i++) { for (var j = 0; j < ((List <Part>)Parts)[i].NumberOfPoints; j++) { ((List <Point>)((List <Part>)Parts)[i].Points)[j].M = br.ReadDouble(); } } Parts = parts; }
public ComplexShape(ShapeFile shp, BinaryReader br, bool readHeader) : base(shp, br, readHeader) { }