1 #ifndef bwm_shape_file_h_
2 #define bwm_shape_file_h_
3 //:
4 // \file
5 #include <vector>
6 #include <iostream>
7 #include <string>
8 #ifdef _MSC_VER
9 #  include <vcl_msvc_warnings.h>
10 #endif
11 
12 #include <shapefil.h>
13 #include <vsol/vsol_point_3d_sptr.h>
14 #include <vsol/vsol_box_3d.h>
15 
16 #if 0 // commented out
17 typedef enum { NULL = 0, POINT = 1, ARC = 3, POLYGON = 5, MULTIPOINT = 8, POINT3D = 11, ARC3D = 13, POLYGON3D = 15, MULTIPOINT3D = 18, POINTM = 21, ARCM = 23, POLYGONM = 25, MULTIPOINTM = 28, MULTIPATCHM = 31} BWM_SHAPE_TYPE;
18 typedef enum { NULL, POINT, ARC=3, POLYGON, MULTIPOINT, POINT3D, ARC3D, POLYGON3D, MULTIPOINT3D, POINTM, ARCM, POLYGONM, MULTIPOINTM, MULTIPATCHM} BWM_SHAPE_TYPE;
19 #endif // 0
20 
21 class bwm_shape_file
22 {
23  public :
bwm_shape_file()24   bwm_shape_file(){}
~bwm_shape_file()25   ~bwm_shape_file(){}
26 
27   bool load(std::string filename);
28 
29   //: only one shape type is included, no MIX types
shape_type()30   int shape_type() const{ return nShapeType_; }
31 
32   //: number of entities in the file
num_items()33   int num_items() const { return nEntities_; }
34 
35   //: returns the bounding box of the items included in the shape file
bounding_box()36   vsol_box_3d bounding_box() const { return bb_; }
37 
vertices()38   std::vector<std::vector<vsol_point_3d_sptr> > vertices() {return vertices_; }
39 
40   void print();
41 
42  private:
43   SHPHandle handle_;
44   int nEntities_;
45   int nShapeType_;
46   double padfMinBound[4];
47   double padfMaxBound[4];
48   vsol_box_3d bb_;
49   std::vector<std::vector<vsol_point_3d_sptr> > vertices_;
50 };
51 
52 #endif
53