filegdb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +18 -0
  3. data/.travis.yml +4 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE +28 -0
  6. data/Makefile +12 -0
  7. data/README.md +27 -0
  8. data/Rakefile +24 -0
  9. data/ext/filegdb/base.hpp +126 -0
  10. data/ext/filegdb/extconf.rb +13 -0
  11. data/ext/filegdb/filegdb.cpp +27 -0
  12. data/ext/filegdb/filegdb.hpp +44 -0
  13. data/ext/filegdb/filegdb/include/FileGDBAPI.h +30 -0
  14. data/ext/filegdb/filegdb/include/FileGDBCore.h +226 -0
  15. data/ext/filegdb/filegdb/include/Geodatabase.h +291 -0
  16. data/ext/filegdb/filegdb/include/GeodatabaseManagement.h +79 -0
  17. data/ext/filegdb/filegdb/include/Raster.h +101 -0
  18. data/ext/filegdb/filegdb/include/Row.h +336 -0
  19. data/ext/filegdb/filegdb/include/Table.h +296 -0
  20. data/ext/filegdb/filegdb/include/Util.h +936 -0
  21. data/ext/filegdb/filegdb/include/make.include +98 -0
  22. data/ext/filegdb/filegdb/lib/libFileGDBAPI.dylib +0 -0
  23. data/ext/filegdb/filegdb/lib/libFileGDBAPI.so +0 -0
  24. data/ext/filegdb/filegdb/lib/libfgdbunixrtl.dylib +0 -0
  25. data/ext/filegdb/filegdb/lib/libfgdbunixrtl.so +0 -0
  26. data/ext/filegdb/geodatabase.cpp +529 -0
  27. data/ext/filegdb/geodatabase.hpp +53 -0
  28. data/ext/filegdb/multi_point_shape_buffer.cpp +254 -0
  29. data/ext/filegdb/multi_point_shape_buffer.hpp +35 -0
  30. data/ext/filegdb/point.cpp +44 -0
  31. data/ext/filegdb/point.hpp +31 -0
  32. data/ext/filegdb/point_shape_buffer.cpp +162 -0
  33. data/ext/filegdb/point_shape_buffer.hpp +32 -0
  34. data/ext/filegdb/row.cpp +222 -0
  35. data/ext/filegdb/row.hpp +37 -0
  36. data/ext/filegdb/shape_buffer.cpp +19 -0
  37. data/ext/filegdb/shape_buffer.hpp +20 -0
  38. data/ext/filegdb/shape_buffer_base.hpp +33 -0
  39. data/ext/filegdb/table.cpp +65 -0
  40. data/ext/filegdb/table.hpp +29 -0
  41. data/ext/filegdb/util.cpp +16 -0
  42. data/filegdb.gemspec +23 -0
  43. data/lib/filegdb.rb +2 -0
  44. data/lib/filegdb/version.rb +3 -0
  45. data/spec/data/domain_definition.xml +22 -0
  46. data/spec/data/domain_definition_altered.xml +26 -0
  47. data/spec/data/feature_dataset_definition.xml +25 -0
  48. data/spec/data/table_definition.xml +177 -0
  49. data/spec/filegdb_spec.rb +36 -0
  50. data/spec/geodatabase_spec.rb +107 -0
  51. data/spec/multi_point_shape_buffer_spec.rb +58 -0
  52. data/spec/point_shape_buffer_spec.rb +39 -0
  53. data/spec/row_spec.rb +76 -0
  54. data/spec/spec_helper.rb +41 -0
  55. metadata +153 -0
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ NUM_POINTS = 3
4
+
5
+ describe 'MultiPointShapeBuffer' do
6
+ before(:each) do
7
+ @shape = FileGDB::MultiPointShapeBuffer.new
8
+ end
9
+
10
+ it 'sets up the geometry' do
11
+ lambda { @shape.setup(8, NUM_POINTS) }.should_not raise_error
12
+ end
13
+
14
+ it 'gets the number of points' do
15
+ @shape.setup(8, NUM_POINTS)
16
+ @shape.get_num_points.should eq(NUM_POINTS)
17
+ end
18
+
19
+ it 'gets the points' do
20
+ @shape.setup(8, NUM_POINTS)
21
+ @shape.get_points.should have(3).items
22
+ end
23
+
24
+ it 'gets the z values' do
25
+ @shape.setup(18, NUM_POINTS)
26
+ @shape.z.should have(3).items
27
+ end
28
+
29
+ it 'gets the m values' do
30
+ @shape.setup(18, NUM_POINTS)
31
+ @shape.m.should have(3).items
32
+ end
33
+
34
+ it 'gets the id values' do
35
+ @shape.setup(18, NUM_POINTS)
36
+ lambda { @shape.id }.should raise_error
37
+ end
38
+
39
+ it 'gets the extent' do
40
+ @shape.setup(18, NUM_POINTS)
41
+ @shape.get_extent.should eq([0, 0, 0, 0])
42
+ end
43
+
44
+ it 'gets the z extent' do
45
+ @shape.setup(18, NUM_POINTS)
46
+ @shape.get_z_extent.should eq([0, 0])
47
+ end
48
+
49
+ it 'gets the m extent' do
50
+ @shape.setup(18, NUM_POINTS)
51
+ @shape.get_m_extent.should eq([0, 0])
52
+ end
53
+
54
+ it 'calculates the extent' do
55
+ @shape.setup(18, NUM_POINTS)
56
+ lambda { @shape.calculate_extent }.should_not raise_error
57
+ end
58
+ end
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'PointShapeBuffer' do
4
+ before(:each) do
5
+ @shape = FileGDB::PointShapeBuffer.new
6
+ end
7
+
8
+ it 'gets the z value' do
9
+ @shape.setup(9)
10
+ @shape.z.should eq(0.0)
11
+ end
12
+
13
+ it 'sets the z value' do
14
+ @shape.setup(9)
15
+ @shape.z = 10.0
16
+ @shape.z.should eq(10.0)
17
+ end
18
+
19
+ it 'gets the m value' do
20
+ @shape.setup(11)
21
+ @shape.m.should eq(0.0)
22
+ end
23
+
24
+ it 'sets the m value' do
25
+ @shape.setup(11)
26
+ @shape.m = 10.0
27
+ @shape.m.should eq(10.0)
28
+ end
29
+
30
+ it 'gets the id value' do
31
+ @shape.setup(11)
32
+ lambda { @shape.id }.should raise_error
33
+ end
34
+
35
+ it 'sets the id value' do
36
+ @shape.setup(11)
37
+ lambda { @shape.id = 1 }.should raise_error
38
+ end
39
+ end
@@ -0,0 +1,76 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Row' do
4
+ before(:each) do
5
+ delete_database rescue nil
6
+ @db = create_database
7
+ @table = @db.create_table('', table_definition)
8
+ end
9
+
10
+ after(:each) do
11
+ @db.close if @db
12
+ delete_database
13
+ end
14
+
15
+ it 'creates a row object' do
16
+ row = @table.create_row_object
17
+ row.should_not be_nil
18
+ end
19
+
20
+ it 'sets a string attribute on a row' do
21
+ row = @table.create_row_object
22
+ lambda { row.set_string('string_field', 'a string value') }.should_not raise_error
23
+ end
24
+
25
+ it 'throws an error when setting a field that does not exist' do
26
+ row = @table.create_row_object
27
+ lambda { row.set_string('string_field_that_doesnt_exist', 'a string value') }.should raise_error
28
+ end
29
+
30
+ it 'retrieves a string field' do
31
+ row = @table.create_row_object
32
+ row.set_string('string_field', 'a string value')
33
+ row.get_string('string_field').should eq('a string value')
34
+ end
35
+
36
+ it 'throws an error when retrieving a string field that does not exist' do
37
+ row = @table.create_row_object
38
+ row.set_string('string_field', 'a string value')
39
+ lambda { row.get_string('string_field_that_doesnt_exist') }.should raise_error
40
+ end
41
+
42
+ it 'creates a point shape buffer using #new' do
43
+ FileGDB::PointShapeBuffer.new.should_not be_nil
44
+ end
45
+
46
+ it 'can setup a geometry' do
47
+ shape = FileGDB::PointShapeBuffer.new
48
+ lambda { shape.setup(1) }.should_not raise_error
49
+ end
50
+
51
+ it 'throws an exception when setting up a point shape incorrectly' do
52
+ shape = FileGDB::PointShapeBuffer.new
53
+ lambda { shape.setup(2) }.should raise_error
54
+ end
55
+
56
+ it 'fetches the point object after setting it up' do
57
+ shape = FileGDB::PointShapeBuffer.new
58
+ shape.setup(1)
59
+ shape.get_point.should be_instance_of(FileGDB::Point)
60
+ end
61
+
62
+ it 'sets the geometry of a point' do
63
+ row = @table.create_row_object
64
+ shape = FileGDB::PointShapeBuffer.new
65
+ shape.setup(1)
66
+ point = shape.get_point
67
+ point.x = -82.23233;
68
+ point.y = 27.457347347;
69
+ lambda { row.set_geometry(shape) }.should_not raise_error
70
+ end
71
+
72
+ it 'throws an exception when setting up the geometry incorrectly' do
73
+ row = @table.create_row_object
74
+ lambda { row.set_geometry(nil) }.should raise_error
75
+ end
76
+ end
@@ -0,0 +1,41 @@
1
+ require 'filegdb'
2
+
3
+ RSpec.configure do |config|
4
+ config.color_enabled = true
5
+ config.tty = true
6
+ config.formatter = :documentation
7
+ end
8
+
9
+ TEST_FILE_NAME = 'testfile.gdb'
10
+
11
+ def data_directory
12
+ File.join(File.dirname(__FILE__), 'data')
13
+ end
14
+
15
+ def table_definition
16
+ File.read(File.join(data_directory, 'table_definition.xml'))
17
+ end
18
+
19
+ def feature_dataset_definition
20
+ File.read(File.join(data_directory, 'feature_dataset_definition.xml'))
21
+ end
22
+
23
+ def domain_definition
24
+ File.read(File.join(data_directory, 'domain_definition.xml'))
25
+ end
26
+
27
+ def domain_definition_altered
28
+ File.read(File.join(data_directory, 'domain_definition_altered.xml'))
29
+ end
30
+
31
+ def create_database
32
+ FileGDB::Geodatabase.create(TEST_FILE_NAME)
33
+ end
34
+
35
+ def open_database
36
+ FileGDB::Geodatabase.open(TEST_FILE_NAME)
37
+ end
38
+
39
+ def delete_database
40
+ FileGDB::Geodatabase.delete(TEST_FILE_NAME)
41
+ end
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: filegdb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Zac McCormick
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake-compiler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: ESRI FileGDB bindings for ruby
56
+ email:
57
+ - zac.mccormick@gmail.com
58
+ executables: []
59
+ extensions:
60
+ - ext/filegdb/extconf.rb
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - .travis.yml
65
+ - Gemfile
66
+ - LICENSE
67
+ - Makefile
68
+ - README.md
69
+ - Rakefile
70
+ - ext/filegdb/base.hpp
71
+ - ext/filegdb/extconf.rb
72
+ - ext/filegdb/filegdb.cpp
73
+ - ext/filegdb/filegdb.hpp
74
+ - ext/filegdb/filegdb/include/FileGDBAPI.h
75
+ - ext/filegdb/filegdb/include/FileGDBCore.h
76
+ - ext/filegdb/filegdb/include/Geodatabase.h
77
+ - ext/filegdb/filegdb/include/GeodatabaseManagement.h
78
+ - ext/filegdb/filegdb/include/Raster.h
79
+ - ext/filegdb/filegdb/include/Row.h
80
+ - ext/filegdb/filegdb/include/Table.h
81
+ - ext/filegdb/filegdb/include/Util.h
82
+ - ext/filegdb/filegdb/include/make.include
83
+ - ext/filegdb/filegdb/lib/libFileGDBAPI.dylib
84
+ - ext/filegdb/filegdb/lib/libFileGDBAPI.so
85
+ - ext/filegdb/filegdb/lib/libfgdbunixrtl.dylib
86
+ - ext/filegdb/filegdb/lib/libfgdbunixrtl.so
87
+ - ext/filegdb/geodatabase.cpp
88
+ - ext/filegdb/geodatabase.hpp
89
+ - ext/filegdb/multi_point_shape_buffer.cpp
90
+ - ext/filegdb/multi_point_shape_buffer.hpp
91
+ - ext/filegdb/point.cpp
92
+ - ext/filegdb/point.hpp
93
+ - ext/filegdb/point_shape_buffer.cpp
94
+ - ext/filegdb/point_shape_buffer.hpp
95
+ - ext/filegdb/row.cpp
96
+ - ext/filegdb/row.hpp
97
+ - ext/filegdb/shape_buffer.cpp
98
+ - ext/filegdb/shape_buffer.hpp
99
+ - ext/filegdb/shape_buffer_base.hpp
100
+ - ext/filegdb/table.cpp
101
+ - ext/filegdb/table.hpp
102
+ - ext/filegdb/util.cpp
103
+ - filegdb.gemspec
104
+ - lib/filegdb.rb
105
+ - lib/filegdb/version.rb
106
+ - spec/data/domain_definition.xml
107
+ - spec/data/domain_definition_altered.xml
108
+ - spec/data/feature_dataset_definition.xml
109
+ - spec/data/table_definition.xml
110
+ - spec/filegdb_spec.rb
111
+ - spec/geodatabase_spec.rb
112
+ - spec/multi_point_shape_buffer_spec.rb
113
+ - spec/point_shape_buffer_spec.rb
114
+ - spec/row_spec.rb
115
+ - spec/spec_helper.rb
116
+ homepage: https://github.com/spatialnetworks/filegdb-ruby
117
+ licenses:
118
+ - BSD
119
+ metadata: {}
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ - ext
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 2.1.5
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: ESRI FileGDB bindings for ruby. Currently contains native extensions for
141
+ FileGDB API 1.3
142
+ test_files:
143
+ - spec/data/domain_definition.xml
144
+ - spec/data/domain_definition_altered.xml
145
+ - spec/data/feature_dataset_definition.xml
146
+ - spec/data/table_definition.xml
147
+ - spec/filegdb_spec.rb
148
+ - spec/geodatabase_spec.rb
149
+ - spec/multi_point_shape_buffer_spec.rb
150
+ - spec/point_shape_buffer_spec.rb
151
+ - spec/row_spec.rb
152
+ - spec/spec_helper.rb
153
+ has_rdoc: