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

Revision 2054, 2.0 kB (checked in by gyuque, 5 years ago)

lang/ruby/RubyESRIShape: extracted point-list implementation

RevLine 
[2000]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;
[2023]19        virtual ShpRecordObject* clone() = 0;
[2043]20
21int mDebugIndex;
[2000]22};
23
[2023]24typedef std::vector<ShpRecordObject*> RecordContentList;
25
[2054]26class IndexedPointList
27{
28public:
29        IndexedPointList();
30        virtual ~IndexedPointList();
31        void copyFrom(const IndexedPointList& aSrc);
[2000]32
[2054]33        void allocBuffers();
34        void freeBuffers();
35
36        ESDouble mBounds[4];
37        ESInt32 mNParts;
38        ESInt32 mNPoints;
39
40        ESInt32* mPartIndexes;
41        ESPointEx* mPoints;
42
43        ESDouble mZRange[2];
44        ESDouble mMRange[2];
45};
46
47
48#define SHPRECORD_WITH_Z 0x1
49#define SHPRECORD_WITH_M 0x2
50
[2000]51class ShpPolygon : public ShpRecordObject
52{
53public:
54        ShpPolygon(int option);
55        virtual ~ShpPolygon();
56        virtual VALUE toRubyObject();
[2023]57        virtual ShpRecordObject* clone();
58
[2015]59        VALUE getPartAt(int index);
[2043]60        VALUE getBoundingBox();
[2015]61        int getPartsLength();
[2000]62
[2015]63        void markRubyGC();
64
[2000]65        es_error_t readFromMainFile(FILE* fp, ShpReadContext& rctx);
66private:
[2054]67        ESInt32 mType;
68        IndexedPointList mPList;
69        int mOption;
70};
[2000]71
[2054]72class ShpPolyline : public ShpRecordObject
73{
74public:
75        ShpPolyline(int option);
76        virtual ~ShpPolyline();
77        virtual VALUE toRubyObject();
78        virtual ShpRecordObject* clone();
79private:
[2000]80        ESInt32 mType;
[2054]81        IndexedPointList mPList;
[2000]82        int mOption;
83};
84
[2015]85class ShpPoint : public ShpRecordObject
86{
87public:
[2023]88        ShpPoint(ESDouble x, ESDouble y, ESDouble z, ESDouble m);
[2015]89        virtual ~ShpPoint();
90        virtual VALUE toRubyObject();
[2023]91        virtual ShpRecordObject* clone();
92
93        ESDouble getX() const{ return mX; }
94        ESDouble getY() const{ return mY; }
95        ESDouble getZ() const{ return mZ; }
96        ESDouble getM() const{ return mM; }
97private:
98        ESDouble mX;
99        ESDouble mY;
100        ESDouble mZ;
101        ESDouble mM;
[2015]102};
103
[2000]104#endif
Note: See TracBrowser for help on using the browser.