filegdb 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/ext/filegdb/double_primitive.cpp +35 -0
- data/ext/filegdb/double_primitive.hpp +29 -0
- data/ext/filegdb/filegdb.cpp +6 -0
- data/ext/filegdb/integer_primitive.cpp +36 -0
- data/ext/filegdb/integer_primitive.hpp +29 -0
- data/ext/filegdb/multi_part_shape_buffer.cpp +303 -0
- data/ext/filegdb/multi_part_shape_buffer.hpp +38 -0
- data/ext/filegdb/primitive.hpp +20 -0
- data/lib/filegdb/version.rb +1 -1
- data/spec/multi_part_shape_buffer_spec.rb +66 -0
- metadata +10 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzM1MjMzMTkwNDc3MjEyNzU1Y2U5ZmY2ODk0NGZhZTk4Y2VhY2E3NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzRmMDRjY2U3MzZlZTA5NDVmYzdiNjA4MTUyMDc5ZjViMGUyMWNkZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2UzOTVhMzMzZjllODJlZTE2YzA3M2JiZWEzYmM3MDQwMzg2ZGRjZDUxNTdh
|
10
|
+
YjZjOTRiZDA3OGEwODJiN2MzZDUxMzgyYTEzZGRhMDUxNDVlZTBmNDVhMWFh
|
11
|
+
ODk0OTEzYmI5MzdhMWQ0YzRhNzk3MmU3YmYzMjRiZTkzZjcyYzQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWZmNjNhNjE4N2ZhNmIwYTk2NDk5NWI4MGIwYjZlMGNjMzMxZDE0MGE5Mzgz
|
14
|
+
M2VlOWEyY2MxNDQ4ZDc3YTM3YmM0OTQ1OWExNzMxNWU5NGU5OWE2ZGVmMTc3
|
15
|
+
ZmUzM2QyNTFmNGFiZDg1NGExYWI5OWQ2ZDNjZTJkYjExNTM2YmY=
|
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
#include "double_primitive.hpp"
|
3
|
+
|
4
|
+
namespace filegdb {
|
5
|
+
|
6
|
+
VALUE double_primitive::_klass = Qnil;
|
7
|
+
|
8
|
+
VALUE double_primitive::klass() {
|
9
|
+
return double_primitive::_klass;
|
10
|
+
}
|
11
|
+
|
12
|
+
VALUE double_primitive::set_value(VALUE self, VALUE value) {
|
13
|
+
CHECK_ARGUMENT_FLOAT(value);
|
14
|
+
|
15
|
+
double_primitive *prim = unwrap(self);
|
16
|
+
|
17
|
+
*prim->_value = NUM2DBL(value);
|
18
|
+
|
19
|
+
return prim->wrapped();
|
20
|
+
}
|
21
|
+
|
22
|
+
VALUE double_primitive::get_value(VALUE self) {
|
23
|
+
double_primitive *prim = unwrap(self);
|
24
|
+
return rb_float_new(*prim->_value);
|
25
|
+
}
|
26
|
+
|
27
|
+
void double_primitive::define(VALUE module)
|
28
|
+
{
|
29
|
+
double_primitive::_klass = rb_define_class_under(module, "DoublePrimitive", rb_cObject);
|
30
|
+
base::define(double_primitive::_klass, true);
|
31
|
+
rb_define_method(double_primitive::_klass, "value", FGDB_METHOD(double_primitive::get_value), 0);
|
32
|
+
rb_define_method(double_primitive::_klass, "value=", FGDB_METHOD(double_primitive::set_value), 1);
|
33
|
+
}
|
34
|
+
|
35
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#ifndef __FGDB_DOUBLE_PRIMITIVE_HPP__
|
2
|
+
#define __FGDB_DOUBLE_PRIMITIVE_HPP__
|
3
|
+
|
4
|
+
#include "filegdb.hpp"
|
5
|
+
#include "base.hpp"
|
6
|
+
#include "primitive.hpp"
|
7
|
+
|
8
|
+
namespace filegdb {
|
9
|
+
|
10
|
+
class double_primitive : public primitive<double, double_primitive> {
|
11
|
+
public:
|
12
|
+
double_primitive() {}
|
13
|
+
|
14
|
+
double_primitive(double *value) : primitive(value) {}
|
15
|
+
|
16
|
+
virtual VALUE klass();
|
17
|
+
|
18
|
+
static VALUE _klass;
|
19
|
+
|
20
|
+
static void define(VALUE module);
|
21
|
+
|
22
|
+
static VALUE set_value(VALUE self, VALUE value);
|
23
|
+
|
24
|
+
static VALUE get_value(VALUE self);
|
25
|
+
};
|
26
|
+
|
27
|
+
}
|
28
|
+
|
29
|
+
#endif
|
data/ext/filegdb/filegdb.cpp
CHANGED
@@ -9,9 +9,12 @@
|
|
9
9
|
#include "shape_buffer.hpp"
|
10
10
|
#include "point_shape_buffer.hpp"
|
11
11
|
#include "multi_point_shape_buffer.hpp"
|
12
|
+
#include "multi_part_shape_buffer.hpp"
|
12
13
|
#include "point.hpp"
|
13
14
|
#include "field_info.hpp"
|
14
15
|
#include "spatial_reference.hpp"
|
16
|
+
#include "integer_primitive.hpp"
|
17
|
+
#include "double_primitive.hpp"
|
15
18
|
|
16
19
|
VALUE cFileGDB;
|
17
20
|
|
@@ -25,7 +28,10 @@ extern "C" {
|
|
25
28
|
filegdb::shape_buffer::define(cFileGDB);
|
26
29
|
filegdb::point_shape_buffer::define(cFileGDB);
|
27
30
|
filegdb::multi_point_shape_buffer::define(cFileGDB);
|
31
|
+
filegdb::multi_part_shape_buffer::define(cFileGDB);
|
28
32
|
filegdb::field_info::define(cFileGDB);
|
29
33
|
filegdb::spatial_reference::define(cFileGDB);
|
34
|
+
filegdb::integer_primitive::define(cFileGDB);
|
35
|
+
filegdb::double_primitive::define(cFileGDB);
|
30
36
|
}
|
31
37
|
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
#include "integer_primitive.hpp"
|
3
|
+
|
4
|
+
namespace filegdb {
|
5
|
+
|
6
|
+
VALUE integer_primitive::_klass = Qnil;
|
7
|
+
|
8
|
+
VALUE integer_primitive::klass() {
|
9
|
+
return integer_primitive::_klass;
|
10
|
+
}
|
11
|
+
|
12
|
+
|
13
|
+
VALUE integer_primitive::set_value(VALUE self, VALUE value) {
|
14
|
+
CHECK_ARGUMENT_FIXNUM(value);
|
15
|
+
|
16
|
+
integer_primitive *prim = unwrap(self);
|
17
|
+
|
18
|
+
*prim->_value = FIX2INT(value);
|
19
|
+
|
20
|
+
return prim->wrapped();
|
21
|
+
}
|
22
|
+
|
23
|
+
VALUE integer_primitive::get_value(VALUE self) {
|
24
|
+
integer_primitive *prim = unwrap(self);
|
25
|
+
return INT2FIX(*prim->_value);
|
26
|
+
}
|
27
|
+
|
28
|
+
void integer_primitive::define(VALUE module)
|
29
|
+
{
|
30
|
+
integer_primitive::_klass = rb_define_class_under(module, "IntegerPrimitive", rb_cObject);
|
31
|
+
base::define(integer_primitive::_klass, true);
|
32
|
+
rb_define_method(integer_primitive::_klass, "value", FGDB_METHOD(integer_primitive::get_value), 0);
|
33
|
+
rb_define_method(integer_primitive::_klass, "value=", FGDB_METHOD(integer_primitive::set_value), 1);
|
34
|
+
}
|
35
|
+
|
36
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#ifndef __FGDB_INTEGER_PRIMITIVE_HPP__
|
2
|
+
#define __FGDB_INTEGER_PRIMITIVE_HPP__
|
3
|
+
|
4
|
+
#include "filegdb.hpp"
|
5
|
+
#include "base.hpp"
|
6
|
+
#include "primitive.hpp"
|
7
|
+
|
8
|
+
namespace filegdb {
|
9
|
+
|
10
|
+
class integer_primitive : public primitive<int, integer_primitive> {
|
11
|
+
public:
|
12
|
+
integer_primitive() {}
|
13
|
+
|
14
|
+
integer_primitive(int *value) : primitive(value) {}
|
15
|
+
|
16
|
+
virtual VALUE klass();
|
17
|
+
|
18
|
+
static VALUE _klass;
|
19
|
+
|
20
|
+
static void define(VALUE module);
|
21
|
+
|
22
|
+
static VALUE set_value(VALUE self, VALUE value);
|
23
|
+
|
24
|
+
static VALUE get_value(VALUE self);
|
25
|
+
};
|
26
|
+
|
27
|
+
}
|
28
|
+
|
29
|
+
#endif
|
@@ -0,0 +1,303 @@
|
|
1
|
+
|
2
|
+
#include "point.hpp"
|
3
|
+
#include "shape_buffer.hpp"
|
4
|
+
#include "multi_part_shape_buffer.hpp"
|
5
|
+
#include "integer_primitive.hpp"
|
6
|
+
#include "double_primitive.hpp"
|
7
|
+
|
8
|
+
namespace filegdb {
|
9
|
+
|
10
|
+
VALUE multi_part_shape_buffer::_klass = Qnil;
|
11
|
+
|
12
|
+
VALUE multi_part_shape_buffer::klass() {
|
13
|
+
return multi_part_shape_buffer::_klass;
|
14
|
+
}
|
15
|
+
|
16
|
+
VALUE multi_part_shape_buffer::setup(VALUE self, VALUE shapeType, VALUE numberOfParts, VALUE numberOfPoints) {
|
17
|
+
CHECK_ARGUMENT_FIXNUM(shapeType);
|
18
|
+
CHECK_ARGUMENT_FIXNUM(numberOfParts);
|
19
|
+
CHECK_ARGUMENT_FIXNUM(numberOfPoints);
|
20
|
+
|
21
|
+
multi_part_shape_buffer *shape = unwrap(self);
|
22
|
+
|
23
|
+
ShapeType nshape_type = (ShapeType)FIX2INT(shapeType);
|
24
|
+
|
25
|
+
fgdbError hr = shape->value().Setup(nshape_type, FIX2INT(numberOfParts), FIX2INT(numberOfPoints));
|
26
|
+
|
27
|
+
if (FGDB_IS_FAILURE(hr)) {
|
28
|
+
FGDB_RAISE_ERROR(hr);
|
29
|
+
}
|
30
|
+
|
31
|
+
return shape->wrapped();
|
32
|
+
}
|
33
|
+
|
34
|
+
VALUE multi_part_shape_buffer::get_points(VALUE self) {
|
35
|
+
multi_part_shape_buffer *shape = unwrap(self);
|
36
|
+
|
37
|
+
Point *points = NULL;
|
38
|
+
|
39
|
+
fgdbError hr = shape->value().GetPoints(points);
|
40
|
+
|
41
|
+
if (FGDB_IS_FAILURE(hr)) {
|
42
|
+
FGDB_RAISE_ERROR(hr);
|
43
|
+
}
|
44
|
+
|
45
|
+
int numPoints = 0;
|
46
|
+
|
47
|
+
hr = shape->value().GetNumPoints(numPoints);
|
48
|
+
|
49
|
+
if (FGDB_IS_FAILURE(hr)) {
|
50
|
+
FGDB_RAISE_ERROR(hr);
|
51
|
+
}
|
52
|
+
|
53
|
+
VALUE arrayOfPoints = rb_ary_new();
|
54
|
+
|
55
|
+
for (int i = 0; i < numPoints; ++i) {
|
56
|
+
point *p = new point(&points[i]);
|
57
|
+
rb_ary_push(arrayOfPoints, p->wrapped());
|
58
|
+
}
|
59
|
+
|
60
|
+
return arrayOfPoints;
|
61
|
+
}
|
62
|
+
|
63
|
+
VALUE multi_part_shape_buffer::get_parts(VALUE self) {
|
64
|
+
multi_part_shape_buffer *shape = unwrap(self);
|
65
|
+
|
66
|
+
int *parts = NULL;
|
67
|
+
|
68
|
+
fgdbError hr = shape->value().GetParts(parts);
|
69
|
+
|
70
|
+
if (FGDB_IS_FAILURE(hr)) {
|
71
|
+
FGDB_RAISE_ERROR(hr);
|
72
|
+
}
|
73
|
+
|
74
|
+
int numParts = 0;
|
75
|
+
|
76
|
+
hr = shape->value().GetNumParts(numParts);
|
77
|
+
|
78
|
+
if (FGDB_IS_FAILURE(hr)) {
|
79
|
+
FGDB_RAISE_ERROR(hr);
|
80
|
+
}
|
81
|
+
|
82
|
+
VALUE arrayOfParts = rb_ary_new();
|
83
|
+
|
84
|
+
for (int i = 0; i < numParts; ++i) {
|
85
|
+
integer_primitive *value = new integer_primitive(&parts[i]);
|
86
|
+
rb_ary_push(arrayOfParts, value->wrapped());
|
87
|
+
}
|
88
|
+
|
89
|
+
return arrayOfParts;
|
90
|
+
}
|
91
|
+
|
92
|
+
VALUE multi_part_shape_buffer::get_num_points(VALUE self) {
|
93
|
+
multi_part_shape_buffer *shape = unwrap(self);
|
94
|
+
|
95
|
+
int numPoints = 0;
|
96
|
+
|
97
|
+
fgdbError hr = shape->value().GetNumPoints(numPoints);
|
98
|
+
|
99
|
+
if (FGDB_IS_FAILURE(hr)) {
|
100
|
+
FGDB_RAISE_ERROR(hr);
|
101
|
+
}
|
102
|
+
|
103
|
+
return INT2FIX(numPoints);
|
104
|
+
}
|
105
|
+
|
106
|
+
VALUE multi_part_shape_buffer::get_num_parts(VALUE self) {
|
107
|
+
multi_part_shape_buffer *shape = unwrap(self);
|
108
|
+
|
109
|
+
int numParts = 0;
|
110
|
+
|
111
|
+
fgdbError hr = shape->value().GetNumParts(numParts);
|
112
|
+
|
113
|
+
if (FGDB_IS_FAILURE(hr)) {
|
114
|
+
FGDB_RAISE_ERROR(hr);
|
115
|
+
}
|
116
|
+
|
117
|
+
return INT2FIX(numParts);
|
118
|
+
}
|
119
|
+
|
120
|
+
VALUE multi_part_shape_buffer::get_zs(VALUE self)
|
121
|
+
{
|
122
|
+
multi_part_shape_buffer *shape = unwrap(self);
|
123
|
+
|
124
|
+
double *zValues;
|
125
|
+
|
126
|
+
fgdbError hr = shape->value().GetZs(zValues);
|
127
|
+
|
128
|
+
if (FGDB_IS_FAILURE(hr)) {
|
129
|
+
FGDB_RAISE_ERROR(hr);
|
130
|
+
}
|
131
|
+
|
132
|
+
int numPoints = 0;
|
133
|
+
|
134
|
+
hr = shape->value().GetNumPoints(numPoints);
|
135
|
+
|
136
|
+
if (FGDB_IS_FAILURE(hr)) {
|
137
|
+
FGDB_RAISE_ERROR(hr);
|
138
|
+
}
|
139
|
+
|
140
|
+
VALUE result = rb_ary_new();
|
141
|
+
|
142
|
+
for (int i = 0; i < numPoints; ++i) {
|
143
|
+
rb_ary_push(result, rb_float_new(zValues[i]));
|
144
|
+
}
|
145
|
+
|
146
|
+
return result;
|
147
|
+
}
|
148
|
+
|
149
|
+
VALUE multi_part_shape_buffer::get_ms(VALUE self)
|
150
|
+
{
|
151
|
+
multi_part_shape_buffer *shape = unwrap(self);
|
152
|
+
|
153
|
+
double *mValues;
|
154
|
+
|
155
|
+
fgdbError hr = shape->value().GetMs(mValues);
|
156
|
+
|
157
|
+
if (FGDB_IS_FAILURE(hr)) {
|
158
|
+
FGDB_RAISE_ERROR(hr);
|
159
|
+
}
|
160
|
+
|
161
|
+
int numPoints = 0;
|
162
|
+
|
163
|
+
hr = shape->value().GetNumPoints(numPoints);
|
164
|
+
|
165
|
+
if (FGDB_IS_FAILURE(hr)) {
|
166
|
+
FGDB_RAISE_ERROR(hr);
|
167
|
+
}
|
168
|
+
|
169
|
+
VALUE result = rb_ary_new();
|
170
|
+
|
171
|
+
for (int i = 0; i < numPoints; ++i) {
|
172
|
+
rb_ary_push(result, rb_float_new(mValues[i]));
|
173
|
+
}
|
174
|
+
|
175
|
+
return result;
|
176
|
+
}
|
177
|
+
|
178
|
+
VALUE multi_part_shape_buffer::get_ids(VALUE self)
|
179
|
+
{
|
180
|
+
multi_part_shape_buffer *shape = unwrap(self);
|
181
|
+
|
182
|
+
int *idValues;
|
183
|
+
|
184
|
+
fgdbError hr = shape->value().GetIDs(idValues);
|
185
|
+
|
186
|
+
if (FGDB_IS_FAILURE(hr)) {
|
187
|
+
FGDB_RAISE_ERROR(hr);
|
188
|
+
}
|
189
|
+
|
190
|
+
int numPoints = 0;
|
191
|
+
|
192
|
+
hr = shape->value().GetNumPoints(numPoints);
|
193
|
+
|
194
|
+
if (FGDB_IS_FAILURE(hr)) {
|
195
|
+
FGDB_RAISE_ERROR(hr);
|
196
|
+
}
|
197
|
+
|
198
|
+
VALUE result = rb_ary_new();
|
199
|
+
|
200
|
+
for (int i = 0; i < numPoints; ++i) {
|
201
|
+
rb_ary_push(result, INT2FIX(idValues[i]));
|
202
|
+
}
|
203
|
+
|
204
|
+
return result;
|
205
|
+
}
|
206
|
+
|
207
|
+
VALUE multi_part_shape_buffer::get_extent(VALUE self)
|
208
|
+
{
|
209
|
+
multi_part_shape_buffer *shape = unwrap(self);
|
210
|
+
|
211
|
+
double *extents = NULL;
|
212
|
+
|
213
|
+
fgdbError hr = shape->value().GetExtent(extents);
|
214
|
+
|
215
|
+
if (FGDB_IS_FAILURE(hr)) {
|
216
|
+
FGDB_RAISE_ERROR(hr);
|
217
|
+
}
|
218
|
+
|
219
|
+
VALUE result = rb_ary_new();
|
220
|
+
|
221
|
+
rb_ary_push(result, DBL2NUM(extents[0]));
|
222
|
+
rb_ary_push(result, DBL2NUM(extents[1]));
|
223
|
+
rb_ary_push(result, DBL2NUM(extents[2]));
|
224
|
+
rb_ary_push(result, DBL2NUM(extents[3]));
|
225
|
+
|
226
|
+
return result;
|
227
|
+
}
|
228
|
+
|
229
|
+
VALUE multi_part_shape_buffer::get_z_extent(VALUE self)
|
230
|
+
{
|
231
|
+
multi_part_shape_buffer *shape = unwrap(self);
|
232
|
+
|
233
|
+
double *extents = NULL;
|
234
|
+
|
235
|
+
fgdbError hr = shape->value().GetZExtent(extents);
|
236
|
+
|
237
|
+
if (FGDB_IS_FAILURE(hr)) {
|
238
|
+
FGDB_RAISE_ERROR(hr);
|
239
|
+
}
|
240
|
+
|
241
|
+
VALUE result = rb_ary_new();
|
242
|
+
|
243
|
+
rb_ary_push(result, DBL2NUM(extents[0]));
|
244
|
+
rb_ary_push(result, DBL2NUM(extents[1]));
|
245
|
+
|
246
|
+
return result;
|
247
|
+
}
|
248
|
+
|
249
|
+
VALUE multi_part_shape_buffer::get_m_extent(VALUE self)
|
250
|
+
{
|
251
|
+
multi_part_shape_buffer *shape = unwrap(self);
|
252
|
+
|
253
|
+
double *extents = NULL;
|
254
|
+
|
255
|
+
fgdbError hr = shape->value().GetMExtent(extents);
|
256
|
+
|
257
|
+
if (FGDB_IS_FAILURE(hr)) {
|
258
|
+
FGDB_RAISE_ERROR(hr);
|
259
|
+
}
|
260
|
+
|
261
|
+
VALUE result = rb_ary_new();
|
262
|
+
|
263
|
+
rb_ary_push(result, DBL2NUM(extents[0]));
|
264
|
+
rb_ary_push(result, DBL2NUM(extents[1]));
|
265
|
+
|
266
|
+
return result;
|
267
|
+
}
|
268
|
+
|
269
|
+
VALUE multi_part_shape_buffer::calculate_extent(VALUE self)
|
270
|
+
{
|
271
|
+
multi_part_shape_buffer *shape = unwrap(self);
|
272
|
+
|
273
|
+
fgdbError hr = shape->value().CalculateExtent();
|
274
|
+
|
275
|
+
if (FGDB_IS_FAILURE(hr)) {
|
276
|
+
FGDB_RAISE_ERROR(hr);
|
277
|
+
}
|
278
|
+
|
279
|
+
return Qnil;
|
280
|
+
}
|
281
|
+
|
282
|
+
void multi_part_shape_buffer::define(VALUE module)
|
283
|
+
{
|
284
|
+
multi_part_shape_buffer::_klass = rb_define_class_under(module, "MultiPartShapeBuffer", shape_buffer::_klass);
|
285
|
+
base::define(multi_part_shape_buffer::_klass, true);
|
286
|
+
rb_define_method(multi_part_shape_buffer::_klass, "setup", FGDB_METHOD(multi_part_shape_buffer::setup), 3);
|
287
|
+
rb_define_method(multi_part_shape_buffer::_klass, "get_points", FGDB_METHOD(multi_part_shape_buffer::get_points), 0);
|
288
|
+
rb_define_method(multi_part_shape_buffer::_klass, "get_parts", FGDB_METHOD(multi_part_shape_buffer::get_parts), 0);
|
289
|
+
rb_define_method(multi_part_shape_buffer::_klass, "get_num_points", FGDB_METHOD(multi_part_shape_buffer::get_num_points), 0);
|
290
|
+
rb_define_method(multi_part_shape_buffer::_klass, "get_num_parts", FGDB_METHOD(multi_part_shape_buffer::get_num_parts), 0);
|
291
|
+
rb_define_method(multi_part_shape_buffer::_klass, "z", FGDB_METHOD(multi_part_shape_buffer::get_zs), 0);
|
292
|
+
rb_define_method(multi_part_shape_buffer::_klass, "m", FGDB_METHOD(multi_part_shape_buffer::get_ms), 0);
|
293
|
+
rb_define_method(multi_part_shape_buffer::_klass, "id", FGDB_METHOD(multi_part_shape_buffer::get_ids), 0);
|
294
|
+
rb_define_method(multi_part_shape_buffer::_klass, "get_extent", FGDB_METHOD(multi_part_shape_buffer::get_extent), 0);
|
295
|
+
rb_define_method(multi_part_shape_buffer::_klass, "get_z_extent", FGDB_METHOD(multi_part_shape_buffer::get_z_extent), 0);
|
296
|
+
rb_define_method(multi_part_shape_buffer::_klass, "get_m_extent", FGDB_METHOD(multi_part_shape_buffer::get_m_extent), 0);
|
297
|
+
rb_define_method(multi_part_shape_buffer::_klass, "calculate_extent", FGDB_METHOD(multi_part_shape_buffer::calculate_extent), 0);
|
298
|
+
}
|
299
|
+
|
300
|
+
}
|
301
|
+
|
302
|
+
|
303
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#ifndef __FGDB_MULTI_PART_SHAPE_BUFFER_HPP__
|
2
|
+
#define __FGDB_MULTI_PART_SHAPE_BUFFER_HPP__
|
3
|
+
|
4
|
+
#include "filegdb.hpp"
|
5
|
+
#include "shape_buffer_base.hpp"
|
6
|
+
|
7
|
+
namespace filegdb {
|
8
|
+
class multi_part_shape_buffer : public shape_buffer_base<multi_part_shape_buffer, MultiPartShapeBuffer> {
|
9
|
+
public:
|
10
|
+
static void define(VALUE module);
|
11
|
+
|
12
|
+
static VALUE setup(VALUE self, VALUE shapeType, VALUE numberOfParts, VALUE numberOfPoints);
|
13
|
+
static VALUE get_points(VALUE self);
|
14
|
+
static VALUE get_parts(VALUE self);
|
15
|
+
static VALUE get_num_points(VALUE self);
|
16
|
+
static VALUE get_num_parts(VALUE self);
|
17
|
+
static VALUE get_zs(VALUE self);
|
18
|
+
static VALUE get_ms(VALUE self);
|
19
|
+
static VALUE get_ids(VALUE self);
|
20
|
+
static VALUE get_extent(VALUE self);
|
21
|
+
static VALUE get_z_extent(VALUE self);
|
22
|
+
static VALUE get_m_extent(VALUE self);
|
23
|
+
static VALUE calculate_extent(VALUE self);
|
24
|
+
|
25
|
+
virtual VALUE klass();
|
26
|
+
|
27
|
+
static VALUE _klass;
|
28
|
+
|
29
|
+
virtual ~multi_part_shape_buffer() {};
|
30
|
+
};
|
31
|
+
}
|
32
|
+
|
33
|
+
#endif
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#ifndef __FGDB_PRIMITIVE_HPP__
|
2
|
+
#define __FGDB_PRIMITIVE_HPP__
|
3
|
+
|
4
|
+
#include "filegdb.hpp"
|
5
|
+
|
6
|
+
namespace filegdb {
|
7
|
+
template<typename T, typename K> class primitive : public base<K> {
|
8
|
+
public:
|
9
|
+
primitive(T *value) : _value(value) {}
|
10
|
+
|
11
|
+
virtual ~primitive() {}
|
12
|
+
|
13
|
+
protected:
|
14
|
+
primitive() {}
|
15
|
+
|
16
|
+
T *_value;
|
17
|
+
};
|
18
|
+
}
|
19
|
+
|
20
|
+
#endif
|
data/lib/filegdb/version.rb
CHANGED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
NUM_POINTS = 3
|
4
|
+
NUM_PARTS = 1
|
5
|
+
|
6
|
+
describe 'MultiPartShapeBuffer' do
|
7
|
+
before(:each) do
|
8
|
+
@shape = FileGDB::MultiPartShapeBuffer.new
|
9
|
+
@shape.setup(15, NUM_PARTS, NUM_POINTS)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'sets up the geometry' do
|
13
|
+
lambda { @shape.setup(5, NUM_POINTS, NUM_PARTS) }.should_not raise_error
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'gets the number of points' do
|
17
|
+
@shape.get_num_points.should eq(NUM_POINTS)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'gets the number of parts' do
|
21
|
+
@shape.get_num_parts.should eq(NUM_PARTS)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'gets the parts' do
|
25
|
+
@shape.get_parts.should have(1).item
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'sets the parts' do
|
29
|
+
parts = @shape.get_parts
|
30
|
+
parts[0].value = 10
|
31
|
+
@shape.get_parts[0].value.should eq(10)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'gets the points' do
|
35
|
+
@shape.get_points.should have(3).items
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'gets the z values' do
|
39
|
+
@shape.z.should have(3).items
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'gets the m values' do
|
43
|
+
@shape.m.should have(3).items
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'gets the id values' do
|
47
|
+
lambda { @shape.id }.should raise_error
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'gets the extent' do
|
51
|
+
@shape.get_extent.should eq([0, 0, 0, 0])
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'gets the z extent' do
|
55
|
+
@shape.get_z_extent.should eq([0, 0])
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'gets the m extent' do
|
59
|
+
@shape.get_m_extent.should eq([0, 0])
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'calculates the extent' do
|
63
|
+
lambda { @shape.calculate_extent }.should_not raise_error
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filegdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zac McCormick
|
@@ -68,6 +68,8 @@ files:
|
|
68
68
|
- README.md
|
69
69
|
- Rakefile
|
70
70
|
- ext/filegdb/base.hpp
|
71
|
+
- ext/filegdb/double_primitive.cpp
|
72
|
+
- ext/filegdb/double_primitive.hpp
|
71
73
|
- ext/filegdb/extconf.rb
|
72
74
|
- ext/filegdb/field_info.cpp
|
73
75
|
- ext/filegdb/field_info.hpp
|
@@ -88,12 +90,17 @@ files:
|
|
88
90
|
- ext/filegdb/filegdb/lib/libfgdbunixrtl.so
|
89
91
|
- ext/filegdb/geodatabase.cpp
|
90
92
|
- ext/filegdb/geodatabase.hpp
|
93
|
+
- ext/filegdb/integer_primitive.cpp
|
94
|
+
- ext/filegdb/integer_primitive.hpp
|
95
|
+
- ext/filegdb/multi_part_shape_buffer.cpp
|
96
|
+
- ext/filegdb/multi_part_shape_buffer.hpp
|
91
97
|
- ext/filegdb/multi_point_shape_buffer.cpp
|
92
98
|
- ext/filegdb/multi_point_shape_buffer.hpp
|
93
99
|
- ext/filegdb/point.cpp
|
94
100
|
- ext/filegdb/point.hpp
|
95
101
|
- ext/filegdb/point_shape_buffer.cpp
|
96
102
|
- ext/filegdb/point_shape_buffer.hpp
|
103
|
+
- ext/filegdb/primitive.hpp
|
97
104
|
- ext/filegdb/row.cpp
|
98
105
|
- ext/filegdb/row.hpp
|
99
106
|
- ext/filegdb/shape_buffer.cpp
|
@@ -114,6 +121,7 @@ files:
|
|
114
121
|
- spec/field_info_spec.rb
|
115
122
|
- spec/filegdb_spec.rb
|
116
123
|
- spec/geodatabase_spec.rb
|
124
|
+
- spec/multi_part_shape_buffer_spec.rb
|
117
125
|
- spec/multi_point_shape_buffer_spec.rb
|
118
126
|
- spec/point_shape_buffer_spec.rb
|
119
127
|
- spec/row_spec.rb
|
@@ -154,6 +162,7 @@ test_files:
|
|
154
162
|
- spec/field_info_spec.rb
|
155
163
|
- spec/filegdb_spec.rb
|
156
164
|
- spec/geodatabase_spec.rb
|
165
|
+
- spec/multi_part_shape_buffer_spec.rb
|
157
166
|
- spec/multi_point_shape_buffer_spec.rb
|
158
167
|
- spec/point_shape_buffer_spec.rb
|
159
168
|
- spec/row_spec.rb
|