root/lang/ruby/RubyESRIShape/Shape_int.h @ 2091

Revision 2079, 2.4 kB (checked in by gyuque, 7 years ago)

/lang/ruby/RubyESRIShape: supported point datas

Line 
1// types and functions for internal use
2#ifndef SHAPE_INT_H
3#define SHAPE_INT_H
4#include "ruby_min.h"
5
6#include <vector>
7
8typedef struct _ShpReadContext {
9        size_t readSize;
10        size_t readRecordContentSize;
11} ShpReadContext;
12
13/*interface*/
14class ShpRecordObject
15{
16public:
17        virtual ~ShpRecordObject(){};
18        virtual VALUE toRubyObject() = 0;
19        virtual ShpRecordObject* clone() = 0;
20        virtual es_error_t readFromMainFile(FILE* fp, ShpReadContext& rctx) = 0;
21
22int mDebugIndex;
23};
24
25typedef std::vector<ShpRecordObject*> RecordContentList;
26
27class IndexedPointList
28{
29public:
30        IndexedPointList();
31        virtual ~IndexedPointList();
32        void copyFrom(const IndexedPointList& aSrc);
33        VALUE getPartAsRubyObj(int index);
34
35        void allocBuffers();
36        void freeBuffers();
37
38        ESDouble mBounds[4];
39        ESInt32 mNParts;
40        ESInt32 mNPoints;
41
42        ESInt32* mPartIndexes;
43        ESPointEx* mPoints;
44
45        ESDouble mZRange[2];
46        ESDouble mMRange[2];
47
48        es_error_t readFromMainFile(FILE* fp, ShpReadContext& rctx, int option);
49};
50
51
52#define SHPRECORD_WITH_Z 0x1
53#define SHPRECORD_WITH_M 0x2
54
55class ShpPolygon : public ShpRecordObject
56{
57public:
58        ShpPolygon(int option);
59        virtual ~ShpPolygon();
60        virtual VALUE toRubyObject();
61        virtual ShpRecordObject* clone();
62
63        VALUE getPartAt(int index);
64        VALUE getBoundingBox();
65        int getPartsLength();
66
67        void markRubyGC();
68
69        es_error_t readFromMainFile(FILE* fp, ShpReadContext& rctx);
70private:
71        ESInt32 mType;
72        IndexedPointList mPList;
73        int mOption;
74};
75
76class ShpPolyline : public ShpRecordObject
77{
78public:
79        ShpPolyline(int option);
80        virtual ~ShpPolyline();
81        virtual VALUE toRubyObject();
82        virtual ShpRecordObject* clone();
83        VALUE getPartAt(int index);
84        int getPartsLength();
85
86        es_error_t readFromMainFile(FILE* fp, ShpReadContext& rctx);
87private:
88        ESInt32 mType;
89        IndexedPointList mPList;
90        int mOption;
91};
92
93class ShpPoint : public ShpRecordObject
94{
95public:
96        ShpPoint(int option);
97        ShpPoint(ESDouble x, ESDouble y, ESDouble z, ESDouble m);
98        virtual ~ShpPoint();
99        virtual VALUE toRubyObject();
100        virtual ShpRecordObject* clone();
101
102        ESDouble getX() const{ return mX; }
103        ESDouble getY() const{ return mY; }
104        ESDouble getZ() const{ return mZ; }
105        ESDouble getM() const{ return mM; }
106
107        es_error_t readFromMainFile(FILE* fp, ShpReadContext& rctx);
108private:
109        ESDouble mX;
110        ESDouble mY;
111        ESDouble mZ;
112        ESDouble mM;
113        ESInt32 mType;
114        int mOption;
115};
116
117#endif
Note: See TracBrowser for help on using the browser.