Example #1
0
 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();
         }
     }
 }
Example #2
0
        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();
            }
        }
Example #3
0
 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();
 }
Example #4
0
 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}");
     }
 }
Example #5
0
        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();
            }
        }
Example #6
0
        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));
                }
            }
        }
Example #7
0
 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));
     }
 }
Example #8
0
        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;
        }
Example #9
0
 public ComplexShape(ShapeFile shp, BinaryReader br, bool readHeader) : base(shp, br, readHeader)
 {
 }