-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRecordHeader.cs
More file actions
93 lines (70 loc) · 2.65 KB
/
RecordHeader.cs
File metadata and controls
93 lines (70 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using DbfDataReader;
namespace ShapeUtilities
{
public class RecordHeader
{
public int RecordNumber { get; set; }
public int ContentLength { get; set; }
public SHPHeader.eShapeType ShapeType { get; set; }
public RecordHeader(BinaryReader br)
{
RecordNumber = br.ReadBigEndianInt32();
ContentLength = br.ReadBigEndianInt32();
ShapeType = (SHPHeader.eShapeType)br.ReadInt32();
switch (ShapeType)
{
case SHPHeader.eShapeType.Point:
Record = new PointShape(br);
break;
case SHPHeader.eShapeType.PointM:
Record = new PointMShape(br);
break;
case SHPHeader.eShapeType.PointZ:
Record = new PointZShape(br);
break;
case SHPHeader.eShapeType.Polygon:
Record = new PolygonShape(br);
break;
case SHPHeader.eShapeType.PolygonM:
Record = new PolygonMShape(br);
break;
case SHPHeader.eShapeType.PolygonZ:
Record = new PolygonZShape(br);
break;
case SHPHeader.eShapeType.PolyLine:
Record = new PolyLineShape(br);
break;
case SHPHeader.eShapeType.PolyLineM:
Record = new PolyLineMShape(br);
break;
case SHPHeader.eShapeType.PolyLineZ:
Record = new PolyLineZShape(br);
break;
case SHPHeader.eShapeType.MultiPatch:
Record = new MultiPatchShape(br);
break;
case SHPHeader.eShapeType.MultiPoint:
Record = new MultiPointShape(br);
break;
case SHPHeader.eShapeType.MultiPointM:
Record = new MultiPointMShape(br);
break;
case SHPHeader.eShapeType.MultiPointZ:
Record = new MultiPointZShape(br);
break;
case SHPHeader.eShapeType.NullShape:
Record = new NullShape(br);
break;
default:
throw new Exception("None of the registered shape types matched header input !");
}
}
public BaseShapeRecord Record;
}
}