filegdb 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/.travis.yml +4 -0
- data/Gemfile +3 -0
- data/LICENSE +28 -0
- data/Makefile +12 -0
- data/README.md +27 -0
- data/Rakefile +24 -0
- data/ext/filegdb/base.hpp +126 -0
- data/ext/filegdb/extconf.rb +13 -0
- data/ext/filegdb/filegdb.cpp +27 -0
- data/ext/filegdb/filegdb.hpp +44 -0
- data/ext/filegdb/filegdb/include/FileGDBAPI.h +30 -0
- data/ext/filegdb/filegdb/include/FileGDBCore.h +226 -0
- data/ext/filegdb/filegdb/include/Geodatabase.h +291 -0
- data/ext/filegdb/filegdb/include/GeodatabaseManagement.h +79 -0
- data/ext/filegdb/filegdb/include/Raster.h +101 -0
- data/ext/filegdb/filegdb/include/Row.h +336 -0
- data/ext/filegdb/filegdb/include/Table.h +296 -0
- data/ext/filegdb/filegdb/include/Util.h +936 -0
- data/ext/filegdb/filegdb/include/make.include +98 -0
- data/ext/filegdb/filegdb/lib/libFileGDBAPI.dylib +0 -0
- data/ext/filegdb/filegdb/lib/libFileGDBAPI.so +0 -0
- data/ext/filegdb/filegdb/lib/libfgdbunixrtl.dylib +0 -0
- data/ext/filegdb/filegdb/lib/libfgdbunixrtl.so +0 -0
- data/ext/filegdb/geodatabase.cpp +529 -0
- data/ext/filegdb/geodatabase.hpp +53 -0
- data/ext/filegdb/multi_point_shape_buffer.cpp +254 -0
- data/ext/filegdb/multi_point_shape_buffer.hpp +35 -0
- data/ext/filegdb/point.cpp +44 -0
- data/ext/filegdb/point.hpp +31 -0
- data/ext/filegdb/point_shape_buffer.cpp +162 -0
- data/ext/filegdb/point_shape_buffer.hpp +32 -0
- data/ext/filegdb/row.cpp +222 -0
- data/ext/filegdb/row.hpp +37 -0
- data/ext/filegdb/shape_buffer.cpp +19 -0
- data/ext/filegdb/shape_buffer.hpp +20 -0
- data/ext/filegdb/shape_buffer_base.hpp +33 -0
- data/ext/filegdb/table.cpp +65 -0
- data/ext/filegdb/table.hpp +29 -0
- data/ext/filegdb/util.cpp +16 -0
- data/filegdb.gemspec +23 -0
- data/lib/filegdb.rb +2 -0
- data/lib/filegdb/version.rb +3 -0
- data/spec/data/domain_definition.xml +22 -0
- data/spec/data/domain_definition_altered.xml +26 -0
- data/spec/data/feature_dataset_definition.xml +25 -0
- data/spec/data/table_definition.xml +177 -0
- data/spec/filegdb_spec.rb +36 -0
- data/spec/geodatabase_spec.rb +107 -0
- data/spec/multi_point_shape_buffer_spec.rb +58 -0
- data/spec/point_shape_buffer_spec.rb +39 -0
- data/spec/row_spec.rb +76 -0
- data/spec/spec_helper.rb +41 -0
- metadata +153 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
#ifndef __FGDB_GEODATABASE_HPP__
|
2
|
+
#define __FGDB_GEODATABASE_HPP__
|
3
|
+
|
4
|
+
#include "filegdb.hpp"
|
5
|
+
#include "base.hpp"
|
6
|
+
|
7
|
+
namespace filegdb {
|
8
|
+
class table;
|
9
|
+
|
10
|
+
class geodatabase : public base<geodatabase> {
|
11
|
+
public:
|
12
|
+
geodatabase();
|
13
|
+
static VALUE create(VALUE klass, VALUE filename);
|
14
|
+
static VALUE open(VALUE klass, VALUE filename);
|
15
|
+
static VALUE delete_database(VALUE klass, VALUE filename);
|
16
|
+
static VALUE close(VALUE self);
|
17
|
+
static VALUE create_table(VALUE self, VALUE tableName, VALUE tableDefinition);
|
18
|
+
static VALUE create_feature_dataset(VALUE self, VALUE featureSetDefinition);
|
19
|
+
static VALUE open_table(VALUE self, VALUE tableName);
|
20
|
+
static VALUE close_table(VALUE self, VALUE table);
|
21
|
+
static VALUE delete_dataset(VALUE self, VALUE path, VALUE datasetType);
|
22
|
+
static VALUE rename(VALUE self, VALUE path, VALUE datasetType, VALUE newName);
|
23
|
+
static VALUE move(VALUE self, VALUE path, VALUE newParentPath);
|
24
|
+
static VALUE get_child_datasets(VALUE self, VALUE parentPath, VALUE datasetType);
|
25
|
+
static VALUE get_dataset_definition(VALUE self, VALUE path, VALUE datasetType);
|
26
|
+
static VALUE get_dataset_documentation(VALUE self, VALUE path, VALUE datasetType);
|
27
|
+
static VALUE get_child_dataset_definitions(VALUE self, VALUE parentPath, VALUE datasetType);
|
28
|
+
static VALUE get_related_dataset_definitions(VALUE self, VALUE path, VALUE relType, VALUE datasetType);
|
29
|
+
static VALUE get_dataset_types(VALUE self);
|
30
|
+
static VALUE get_dataset_relationship_types(VALUE self);
|
31
|
+
static VALUE get_related_datasets(VALUE self, VALUE path, VALUE relType, VALUE datasetType);
|
32
|
+
static VALUE create_domain(VALUE self, VALUE domainDefinition);
|
33
|
+
static VALUE alter_domain(VALUE self, VALUE domainDefinition);
|
34
|
+
static VALUE delete_domain(VALUE self, VALUE domainName);
|
35
|
+
static VALUE get_domain_definition(VALUE self, VALUE domainName);
|
36
|
+
static VALUE get_query_name(VALUE self, VALUE path);
|
37
|
+
|
38
|
+
static void define(VALUE module);
|
39
|
+
|
40
|
+
virtual ~geodatabase();
|
41
|
+
|
42
|
+
virtual void mark();
|
43
|
+
virtual VALUE klass();
|
44
|
+
|
45
|
+
static VALUE _klass;
|
46
|
+
|
47
|
+
private:
|
48
|
+
Geodatabase *_gdb;
|
49
|
+
std::vector<table *> _tables;
|
50
|
+
};
|
51
|
+
}
|
52
|
+
|
53
|
+
#endif
|
@@ -0,0 +1,254 @@
|
|
1
|
+
|
2
|
+
#include "point.hpp"
|
3
|
+
#include "shape_buffer.hpp"
|
4
|
+
#include "multi_point_shape_buffer.hpp"
|
5
|
+
|
6
|
+
namespace filegdb {
|
7
|
+
|
8
|
+
VALUE multi_point_shape_buffer::_klass = Qnil;
|
9
|
+
|
10
|
+
VALUE multi_point_shape_buffer::klass() {
|
11
|
+
return multi_point_shape_buffer::_klass;
|
12
|
+
}
|
13
|
+
|
14
|
+
VALUE multi_point_shape_buffer::setup(VALUE self, VALUE shapeType, VALUE numberOfPoints) {
|
15
|
+
CHECK_ARGUMENT_FIXNUM(shapeType);
|
16
|
+
CHECK_ARGUMENT_FIXNUM(numberOfPoints);
|
17
|
+
|
18
|
+
multi_point_shape_buffer *shape = unwrap(self);
|
19
|
+
|
20
|
+
ShapeType nshape_type = (ShapeType)FIX2INT(shapeType);
|
21
|
+
|
22
|
+
fgdbError hr = shape->value().Setup(nshape_type, FIX2INT(numberOfPoints));
|
23
|
+
|
24
|
+
if (FGDB_IS_FAILURE(hr)) {
|
25
|
+
FGDB_RAISE_ERROR(hr);
|
26
|
+
}
|
27
|
+
|
28
|
+
return shape->wrapped();
|
29
|
+
}
|
30
|
+
|
31
|
+
VALUE multi_point_shape_buffer::get_points(VALUE self) {
|
32
|
+
multi_point_shape_buffer *shape = unwrap(self);
|
33
|
+
|
34
|
+
Point *points = NULL;
|
35
|
+
|
36
|
+
fgdbError hr = shape->value().GetPoints(points);
|
37
|
+
|
38
|
+
if (FGDB_IS_FAILURE(hr)) {
|
39
|
+
FGDB_RAISE_ERROR(hr);
|
40
|
+
}
|
41
|
+
|
42
|
+
int numPoints = 0;
|
43
|
+
|
44
|
+
hr = shape->value().GetNumPoints(numPoints);
|
45
|
+
|
46
|
+
if (FGDB_IS_FAILURE(hr)) {
|
47
|
+
FGDB_RAISE_ERROR(hr);
|
48
|
+
}
|
49
|
+
|
50
|
+
VALUE arrayOfPoints = rb_ary_new();
|
51
|
+
|
52
|
+
for (int i = 0; i < numPoints; ++i) {
|
53
|
+
point *p = new point(&points[i]);
|
54
|
+
rb_ary_push(arrayOfPoints, p->wrapped());
|
55
|
+
}
|
56
|
+
|
57
|
+
return arrayOfPoints;
|
58
|
+
}
|
59
|
+
|
60
|
+
VALUE multi_point_shape_buffer::get_num_points(VALUE self) {
|
61
|
+
multi_point_shape_buffer *shape = unwrap(self);
|
62
|
+
|
63
|
+
int numPoints = 0;
|
64
|
+
|
65
|
+
fgdbError hr = shape->value().GetNumPoints(numPoints);
|
66
|
+
|
67
|
+
if (FGDB_IS_FAILURE(hr)) {
|
68
|
+
FGDB_RAISE_ERROR(hr);
|
69
|
+
}
|
70
|
+
|
71
|
+
return INT2FIX(numPoints);
|
72
|
+
}
|
73
|
+
|
74
|
+
VALUE multi_point_shape_buffer::get_zs(VALUE self)
|
75
|
+
{
|
76
|
+
multi_point_shape_buffer *shape = unwrap(self);
|
77
|
+
|
78
|
+
double *zValues;
|
79
|
+
|
80
|
+
fgdbError hr = shape->value().GetZs(zValues);
|
81
|
+
|
82
|
+
if (FGDB_IS_FAILURE(hr)) {
|
83
|
+
FGDB_RAISE_ERROR(hr);
|
84
|
+
}
|
85
|
+
|
86
|
+
int numPoints = 0;
|
87
|
+
|
88
|
+
hr = shape->value().GetNumPoints(numPoints);
|
89
|
+
|
90
|
+
if (FGDB_IS_FAILURE(hr)) {
|
91
|
+
FGDB_RAISE_ERROR(hr);
|
92
|
+
}
|
93
|
+
|
94
|
+
VALUE result = rb_ary_new();
|
95
|
+
|
96
|
+
for (int i = 0; i < numPoints; ++i) {
|
97
|
+
rb_ary_push(result, rb_float_new(zValues[i]));
|
98
|
+
}
|
99
|
+
|
100
|
+
return result;
|
101
|
+
}
|
102
|
+
|
103
|
+
VALUE multi_point_shape_buffer::get_ms(VALUE self)
|
104
|
+
{
|
105
|
+
multi_point_shape_buffer *shape = unwrap(self);
|
106
|
+
|
107
|
+
double *mValues;
|
108
|
+
|
109
|
+
fgdbError hr = shape->value().GetMs(mValues);
|
110
|
+
|
111
|
+
if (FGDB_IS_FAILURE(hr)) {
|
112
|
+
FGDB_RAISE_ERROR(hr);
|
113
|
+
}
|
114
|
+
|
115
|
+
int numPoints = 0;
|
116
|
+
|
117
|
+
hr = shape->value().GetNumPoints(numPoints);
|
118
|
+
|
119
|
+
if (FGDB_IS_FAILURE(hr)) {
|
120
|
+
FGDB_RAISE_ERROR(hr);
|
121
|
+
}
|
122
|
+
|
123
|
+
VALUE result = rb_ary_new();
|
124
|
+
|
125
|
+
for (int i = 0; i < numPoints; ++i) {
|
126
|
+
rb_ary_push(result, rb_float_new(mValues[i]));
|
127
|
+
}
|
128
|
+
|
129
|
+
return result;
|
130
|
+
}
|
131
|
+
|
132
|
+
VALUE multi_point_shape_buffer::get_ids(VALUE self)
|
133
|
+
{
|
134
|
+
multi_point_shape_buffer *shape = unwrap(self);
|
135
|
+
|
136
|
+
int *idValues;
|
137
|
+
|
138
|
+
fgdbError hr = shape->value().GetIDs(idValues);
|
139
|
+
|
140
|
+
if (FGDB_IS_FAILURE(hr)) {
|
141
|
+
FGDB_RAISE_ERROR(hr);
|
142
|
+
}
|
143
|
+
|
144
|
+
int numPoints = 0;
|
145
|
+
|
146
|
+
hr = shape->value().GetNumPoints(numPoints);
|
147
|
+
|
148
|
+
if (FGDB_IS_FAILURE(hr)) {
|
149
|
+
FGDB_RAISE_ERROR(hr);
|
150
|
+
}
|
151
|
+
|
152
|
+
VALUE result = rb_ary_new();
|
153
|
+
|
154
|
+
for (int i = 0; i < numPoints; ++i) {
|
155
|
+
rb_ary_push(result, INT2FIX(idValues[i]));
|
156
|
+
}
|
157
|
+
|
158
|
+
return result;
|
159
|
+
}
|
160
|
+
|
161
|
+
VALUE multi_point_shape_buffer::get_extent(VALUE self)
|
162
|
+
{
|
163
|
+
multi_point_shape_buffer *shape = unwrap(self);
|
164
|
+
|
165
|
+
double *extents = NULL;
|
166
|
+
|
167
|
+
fgdbError hr = shape->value().GetExtent(extents);
|
168
|
+
|
169
|
+
if (FGDB_IS_FAILURE(hr)) {
|
170
|
+
FGDB_RAISE_ERROR(hr);
|
171
|
+
}
|
172
|
+
|
173
|
+
VALUE result = rb_ary_new();
|
174
|
+
|
175
|
+
rb_ary_push(result, DBL2NUM(extents[0]));
|
176
|
+
rb_ary_push(result, DBL2NUM(extents[1]));
|
177
|
+
rb_ary_push(result, DBL2NUM(extents[2]));
|
178
|
+
rb_ary_push(result, DBL2NUM(extents[3]));
|
179
|
+
|
180
|
+
return result;
|
181
|
+
}
|
182
|
+
|
183
|
+
VALUE multi_point_shape_buffer::get_z_extent(VALUE self)
|
184
|
+
{
|
185
|
+
multi_point_shape_buffer *shape = unwrap(self);
|
186
|
+
|
187
|
+
double *extents = NULL;
|
188
|
+
|
189
|
+
fgdbError hr = shape->value().GetZExtent(extents);
|
190
|
+
|
191
|
+
if (FGDB_IS_FAILURE(hr)) {
|
192
|
+
FGDB_RAISE_ERROR(hr);
|
193
|
+
}
|
194
|
+
|
195
|
+
VALUE result = rb_ary_new();
|
196
|
+
|
197
|
+
rb_ary_push(result, DBL2NUM(extents[0]));
|
198
|
+
rb_ary_push(result, DBL2NUM(extents[1]));
|
199
|
+
|
200
|
+
return result;
|
201
|
+
}
|
202
|
+
|
203
|
+
VALUE multi_point_shape_buffer::get_m_extent(VALUE self)
|
204
|
+
{
|
205
|
+
multi_point_shape_buffer *shape = unwrap(self);
|
206
|
+
|
207
|
+
double *extents = NULL;
|
208
|
+
|
209
|
+
fgdbError hr = shape->value().GetMExtent(extents);
|
210
|
+
|
211
|
+
if (FGDB_IS_FAILURE(hr)) {
|
212
|
+
FGDB_RAISE_ERROR(hr);
|
213
|
+
}
|
214
|
+
|
215
|
+
VALUE result = rb_ary_new();
|
216
|
+
|
217
|
+
rb_ary_push(result, DBL2NUM(extents[0]));
|
218
|
+
rb_ary_push(result, DBL2NUM(extents[1]));
|
219
|
+
|
220
|
+
return result;
|
221
|
+
}
|
222
|
+
|
223
|
+
VALUE multi_point_shape_buffer::calculate_extent(VALUE self)
|
224
|
+
{
|
225
|
+
multi_point_shape_buffer *shape = unwrap(self);
|
226
|
+
|
227
|
+
fgdbError hr = shape->value().CalculateExtent();
|
228
|
+
|
229
|
+
if (FGDB_IS_FAILURE(hr)) {
|
230
|
+
FGDB_RAISE_ERROR(hr);
|
231
|
+
}
|
232
|
+
|
233
|
+
return Qnil;
|
234
|
+
}
|
235
|
+
|
236
|
+
void multi_point_shape_buffer::define(VALUE module)
|
237
|
+
{
|
238
|
+
multi_point_shape_buffer::_klass = rb_define_class_under(module, "MultiPointShapeBuffer", shape_buffer::_klass);
|
239
|
+
base::define(multi_point_shape_buffer::_klass, true);
|
240
|
+
rb_define_method(multi_point_shape_buffer::_klass, "setup", FGDB_METHOD(multi_point_shape_buffer::setup), 2);
|
241
|
+
rb_define_method(multi_point_shape_buffer::_klass, "get_points", FGDB_METHOD(multi_point_shape_buffer::get_points), 0);
|
242
|
+
rb_define_method(multi_point_shape_buffer::_klass, "get_num_points", FGDB_METHOD(multi_point_shape_buffer::get_num_points), 0);
|
243
|
+
rb_define_method(multi_point_shape_buffer::_klass, "z", FGDB_METHOD(multi_point_shape_buffer::get_zs), 0);
|
244
|
+
rb_define_method(multi_point_shape_buffer::_klass, "m", FGDB_METHOD(multi_point_shape_buffer::get_ms), 0);
|
245
|
+
rb_define_method(multi_point_shape_buffer::_klass, "id", FGDB_METHOD(multi_point_shape_buffer::get_ids), 0);
|
246
|
+
rb_define_method(multi_point_shape_buffer::_klass, "get_extent", FGDB_METHOD(multi_point_shape_buffer::get_extent), 0);
|
247
|
+
rb_define_method(multi_point_shape_buffer::_klass, "get_z_extent", FGDB_METHOD(multi_point_shape_buffer::get_z_extent), 0);
|
248
|
+
rb_define_method(multi_point_shape_buffer::_klass, "get_m_extent", FGDB_METHOD(multi_point_shape_buffer::get_m_extent), 0);
|
249
|
+
rb_define_method(multi_point_shape_buffer::_klass, "calculate_extent", FGDB_METHOD(multi_point_shape_buffer::calculate_extent), 0);
|
250
|
+
}
|
251
|
+
|
252
|
+
}
|
253
|
+
|
254
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#ifndef __FGDB_MULTI_POINT_SHAPE_BUFFER_HPP__
|
2
|
+
#define __FGDB_MULTI_POINT_SHAPE_BUFFER_HPP__
|
3
|
+
|
4
|
+
#include "filegdb.hpp"
|
5
|
+
#include "shape_buffer_base.hpp"
|
6
|
+
|
7
|
+
namespace filegdb {
|
8
|
+
class multi_point_shape_buffer : public shape_buffer_base<multi_point_shape_buffer, MultiPointShapeBuffer> {
|
9
|
+
public:
|
10
|
+
static void define(VALUE module);
|
11
|
+
|
12
|
+
static VALUE setup(VALUE self, VALUE shapeType, VALUE numberOfPoints);
|
13
|
+
static VALUE get_points(VALUE self);
|
14
|
+
static VALUE get_num_points(VALUE self);
|
15
|
+
static VALUE get_zs(VALUE self);
|
16
|
+
static VALUE get_ms(VALUE self);
|
17
|
+
static VALUE get_ids(VALUE self);
|
18
|
+
static VALUE get_extent(VALUE self);
|
19
|
+
static VALUE get_z_extent(VALUE self);
|
20
|
+
static VALUE get_m_extent(VALUE self);
|
21
|
+
static VALUE calculate_extent(VALUE self);
|
22
|
+
|
23
|
+
virtual VALUE klass();
|
24
|
+
|
25
|
+
static VALUE _klass;
|
26
|
+
|
27
|
+
virtual ~multi_point_shape_buffer() {};
|
28
|
+
};
|
29
|
+
}
|
30
|
+
|
31
|
+
#endif
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
#include "point.hpp"
|
3
|
+
|
4
|
+
namespace filegdb {
|
5
|
+
|
6
|
+
VALUE point::_klass = Qnil;
|
7
|
+
|
8
|
+
VALUE point::klass() {
|
9
|
+
return point::_klass;
|
10
|
+
}
|
11
|
+
|
12
|
+
VALUE point::set_x(VALUE self, VALUE x) {
|
13
|
+
unwrap(self)->value->x = NUM2DBL(x);
|
14
|
+
|
15
|
+
return x;
|
16
|
+
}
|
17
|
+
|
18
|
+
VALUE point::get_x(VALUE self) {
|
19
|
+
return rb_float_new(unwrap(self)->value->x);
|
20
|
+
}
|
21
|
+
|
22
|
+
VALUE point::set_y(VALUE self, VALUE y) {
|
23
|
+
unwrap(self)->value->y = NUM2DBL(y);
|
24
|
+
|
25
|
+
return y;
|
26
|
+
}
|
27
|
+
|
28
|
+
VALUE point::get_y(VALUE self) {
|
29
|
+
return rb_float_new(unwrap(self)->value->y);
|
30
|
+
}
|
31
|
+
|
32
|
+
void point::define(VALUE module)
|
33
|
+
{
|
34
|
+
point::_klass = rb_define_class_under(module, "Point", rb_cObject);
|
35
|
+
base::define(point::_klass, false);
|
36
|
+
rb_define_method(point::_klass, "x=", FGDB_METHOD(point::set_x), 1);
|
37
|
+
rb_define_method(point::_klass, "x", FGDB_METHOD(point::get_x), 0);
|
38
|
+
rb_define_method(point::_klass, "y=", FGDB_METHOD(point::set_y), 1);
|
39
|
+
rb_define_method(point::_klass, "y", FGDB_METHOD(point::get_y), 0);
|
40
|
+
}
|
41
|
+
|
42
|
+
}
|
43
|
+
|
44
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#ifndef __FGDB_POINT_HPP__
|
2
|
+
#define __FGDB_POINT_HPP__
|
3
|
+
|
4
|
+
#include "filegdb.hpp"
|
5
|
+
#include "base.hpp"
|
6
|
+
|
7
|
+
namespace filegdb {
|
8
|
+
class point : public base<point> {
|
9
|
+
public:
|
10
|
+
point() : value(0) {};
|
11
|
+
point(Point *p) : value(p) {};
|
12
|
+
static void define(VALUE module);
|
13
|
+
|
14
|
+
static VALUE set_x(VALUE self, VALUE x);
|
15
|
+
static VALUE get_x(VALUE self);
|
16
|
+
|
17
|
+
static VALUE set_y(VALUE self, VALUE y);
|
18
|
+
static VALUE get_y(VALUE self);
|
19
|
+
|
20
|
+
virtual VALUE klass();
|
21
|
+
|
22
|
+
static VALUE _klass;
|
23
|
+
|
24
|
+
virtual ~point() {};
|
25
|
+
|
26
|
+
Point *value;
|
27
|
+
};
|
28
|
+
}
|
29
|
+
|
30
|
+
#endif
|
31
|
+
|
@@ -0,0 +1,162 @@
|
|
1
|
+
|
2
|
+
#include "point.hpp"
|
3
|
+
#include "shape_buffer.hpp"
|
4
|
+
#include "point_shape_buffer.hpp"
|
5
|
+
|
6
|
+
namespace filegdb {
|
7
|
+
|
8
|
+
VALUE point_shape_buffer::_klass = Qnil;
|
9
|
+
|
10
|
+
VALUE point_shape_buffer::klass() {
|
11
|
+
return point_shape_buffer::_klass;
|
12
|
+
}
|
13
|
+
|
14
|
+
VALUE point_shape_buffer::setup(VALUE self, VALUE shapeType) {
|
15
|
+
point_shape_buffer *shape = unwrap(self);
|
16
|
+
|
17
|
+
ShapeType nshape_type = (ShapeType)FIX2INT(shapeType);
|
18
|
+
|
19
|
+
fgdbError hr = shape->value().Setup(nshape_type);
|
20
|
+
|
21
|
+
if (FGDB_IS_FAILURE(hr)) {
|
22
|
+
FGDB_RAISE_ERROR(hr);
|
23
|
+
}
|
24
|
+
|
25
|
+
return shape->wrapped();
|
26
|
+
}
|
27
|
+
|
28
|
+
VALUE point_shape_buffer::get_point(VALUE self) {
|
29
|
+
point_shape_buffer *shape = unwrap(self);
|
30
|
+
|
31
|
+
Point *out = NULL;
|
32
|
+
|
33
|
+
fgdbError hr = shape->value().GetPoint(out);
|
34
|
+
|
35
|
+
if (FGDB_IS_FAILURE(hr)) {
|
36
|
+
FGDB_RAISE_ERROR(hr);
|
37
|
+
return Qnil;
|
38
|
+
}
|
39
|
+
|
40
|
+
point *result = new point(out);
|
41
|
+
|
42
|
+
return result->wrapped();
|
43
|
+
}
|
44
|
+
|
45
|
+
VALUE point_shape_buffer::get_z(VALUE self) {
|
46
|
+
point_shape_buffer *shape = unwrap(self);
|
47
|
+
|
48
|
+
double *result = NULL;
|
49
|
+
|
50
|
+
fgdbError hr = shape->value().GetZ(result);
|
51
|
+
|
52
|
+
if (FGDB_IS_FAILURE(hr)) {
|
53
|
+
FGDB_RAISE_ERROR(hr);
|
54
|
+
return Qnil;
|
55
|
+
}
|
56
|
+
|
57
|
+
return rb_float_new(*result);
|
58
|
+
}
|
59
|
+
|
60
|
+
VALUE point_shape_buffer::get_m(VALUE self) {
|
61
|
+
point_shape_buffer *shape = unwrap(self);
|
62
|
+
|
63
|
+
double *result = NULL;
|
64
|
+
|
65
|
+
fgdbError hr = shape->value().GetM(result);
|
66
|
+
|
67
|
+
if (FGDB_IS_FAILURE(hr)) {
|
68
|
+
FGDB_RAISE_ERROR(hr);
|
69
|
+
return Qnil;
|
70
|
+
}
|
71
|
+
|
72
|
+
return rb_float_new(*result);
|
73
|
+
}
|
74
|
+
|
75
|
+
VALUE point_shape_buffer::get_id(VALUE self) {
|
76
|
+
point_shape_buffer *shape = unwrap(self);
|
77
|
+
|
78
|
+
int *result = NULL;
|
79
|
+
|
80
|
+
fgdbError hr = shape->value().GetID(result);
|
81
|
+
|
82
|
+
if (FGDB_IS_FAILURE(hr)) {
|
83
|
+
FGDB_RAISE_ERROR(hr);
|
84
|
+
return Qnil;
|
85
|
+
}
|
86
|
+
|
87
|
+
return INT2FIX(*result);
|
88
|
+
}
|
89
|
+
|
90
|
+
VALUE point_shape_buffer::set_z(VALUE self, VALUE zValue) {
|
91
|
+
CHECK_ARGUMENT_FLOAT(zValue);
|
92
|
+
|
93
|
+
point_shape_buffer *shape = unwrap(self);
|
94
|
+
|
95
|
+
double *result = NULL;
|
96
|
+
|
97
|
+
fgdbError hr = shape->value().GetZ(result);
|
98
|
+
|
99
|
+
if (FGDB_IS_FAILURE(hr)) {
|
100
|
+
FGDB_RAISE_ERROR(hr);
|
101
|
+
return Qnil;
|
102
|
+
}
|
103
|
+
|
104
|
+
*result = NUM2DBL(zValue);
|
105
|
+
|
106
|
+
return zValue;
|
107
|
+
}
|
108
|
+
|
109
|
+
VALUE point_shape_buffer::set_m(VALUE self, VALUE mValue) {
|
110
|
+
CHECK_ARGUMENT_FLOAT(mValue);
|
111
|
+
|
112
|
+
point_shape_buffer *shape = unwrap(self);
|
113
|
+
|
114
|
+
double *result = NULL;
|
115
|
+
|
116
|
+
fgdbError hr = shape->value().GetM(result);
|
117
|
+
|
118
|
+
if (FGDB_IS_FAILURE(hr)) {
|
119
|
+
FGDB_RAISE_ERROR(hr);
|
120
|
+
return Qnil;
|
121
|
+
}
|
122
|
+
|
123
|
+
*result = NUM2DBL(mValue);
|
124
|
+
|
125
|
+
return mValue;
|
126
|
+
}
|
127
|
+
|
128
|
+
VALUE point_shape_buffer::set_id(VALUE self, VALUE idValue) {
|
129
|
+
CHECK_ARGUMENT_FIXNUM(idValue);
|
130
|
+
|
131
|
+
point_shape_buffer *shape = unwrap(self);
|
132
|
+
|
133
|
+
int *result = NULL;
|
134
|
+
|
135
|
+
fgdbError hr = shape->value().GetID(result);
|
136
|
+
|
137
|
+
if (FGDB_IS_FAILURE(hr)) {
|
138
|
+
FGDB_RAISE_ERROR(hr);
|
139
|
+
return Qnil;
|
140
|
+
}
|
141
|
+
|
142
|
+
*result = FIX2INT(idValue);
|
143
|
+
|
144
|
+
return idValue;
|
145
|
+
}
|
146
|
+
|
147
|
+
void point_shape_buffer::define(VALUE module)
|
148
|
+
{
|
149
|
+
point_shape_buffer::_klass = rb_define_class_under(module, "PointShapeBuffer", shape_buffer::_klass);
|
150
|
+
base::define(point_shape_buffer::_klass, true);
|
151
|
+
rb_define_method(point_shape_buffer::_klass, "setup", FGDB_METHOD(point_shape_buffer::setup), 1);
|
152
|
+
rb_define_method(point_shape_buffer::_klass, "get_point", FGDB_METHOD(point_shape_buffer::get_point), 0);
|
153
|
+
rb_define_method(point_shape_buffer::_klass, "z", FGDB_METHOD(point_shape_buffer::get_z), 0);
|
154
|
+
rb_define_method(point_shape_buffer::_klass, "m", FGDB_METHOD(point_shape_buffer::get_m), 0);
|
155
|
+
rb_define_method(point_shape_buffer::_klass, "id", FGDB_METHOD(point_shape_buffer::get_id), 0);
|
156
|
+
rb_define_method(point_shape_buffer::_klass, "z=", FGDB_METHOD(point_shape_buffer::set_z), 1);
|
157
|
+
rb_define_method(point_shape_buffer::_klass, "m=", FGDB_METHOD(point_shape_buffer::set_m), 1);
|
158
|
+
rb_define_method(point_shape_buffer::_klass, "id=", FGDB_METHOD(point_shape_buffer::set_id), 1);
|
159
|
+
}
|
160
|
+
|
161
|
+
}
|
162
|
+
|