ffi-gdal 1.0.0.beta3 → 1.0.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +62 -0
- data/Gemfile +1 -1
- data/History.md +53 -28
- data/README.md +6 -0
- data/Rakefile +23 -1
- data/examples/extract_and_colorize.rb +21 -22
- data/examples/geometries.rb +2 -2
- data/examples/gridding.rb +106 -0
- data/examples/ogr_layer_to_layer.rb +1 -1
- data/examples/points.txt +127 -0
- data/examples/testing_gdal.rb +3 -4
- data/ffi-gdal.gemspec +3 -2
- data/lib/ext/error_symbols.rb +2 -57
- data/lib/ext/ffi_library_function_checks.rb +26 -0
- data/lib/ext/float_ext.rb +2 -2
- data/lib/ext/narray_ext.rb +2 -0
- data/lib/ext/numeric_as_data_type.rb +19 -0
- data/lib/ext/to_bool.rb +4 -4
- data/lib/ffi/cpl/conv.rb +132 -0
- data/lib/ffi/cpl/error.rb +67 -0
- data/lib/ffi/cpl/hash_set.rb +39 -0
- data/lib/ffi/cpl/http.rb +25 -0
- data/lib/ffi/cpl/http_result.rb +18 -0
- data/lib/ffi/cpl/list.rb +38 -0
- data/lib/ffi/cpl/mime_part.rb +11 -0
- data/lib/ffi/cpl/minixml.rb +47 -0
- data/lib/ffi/cpl/port.rb +23 -0
- data/lib/ffi/cpl/quad_tree.rb +51 -0
- data/lib/ffi/{ogr/ogr_envelope.rb → cpl/rect_obj.rb} +3 -3
- data/lib/ffi/cpl/string.rb +95 -0
- data/lib/ffi/cpl/vsi.rb +115 -0
- data/lib/ffi/cpl/xml_node.rb +6 -6
- data/lib/ffi/gdal/alg.rb +385 -0
- data/lib/ffi/gdal/{gdal_color_entry.rb → color_entry.rb} +1 -2
- data/lib/ffi/gdal/exceptions.rb +6 -0
- data/lib/ffi/gdal/{gdal_gcp.rb → gcp.rb} +1 -3
- data/lib/ffi/gdal/{gdal_h.rb → gdal.rb} +253 -252
- data/lib/ffi/gdal/grid.rb +58 -0
- data/lib/ffi/gdal/{gdal_grid_data_metrics_options.rb → grid_data_metrics_options.rb} +1 -2
- data/lib/ffi/gdal/{gdal_grid_inverse_distance_to_a_power_options.rb → grid_inverse_distance_to_a_power_options.rb} +1 -2
- data/lib/ffi/gdal/{gdal_grid_moving_average_options.rb → grid_moving_average_options.rb} +1 -2
- data/lib/ffi/gdal/{gdal_grid_nearest_neighbor_options.rb → grid_nearest_neighbor_options.rb} +1 -2
- data/lib/ffi/gdal/matching.rb +20 -0
- data/lib/ffi/gdal/{gdal_rpc_info.rb → rpc_info.rb} +1 -2
- data/lib/ffi/gdal/{gdal_transformer_info.rb → transformer_info.rb} +1 -2
- data/lib/ffi/gdal/version.rb +1 -1
- data/lib/ffi/gdal/vrt.rb +92 -0
- data/lib/ffi/gdal/{gdal_warp_options.rb → warp_options.rb} +8 -4
- data/lib/ffi/gdal/warper.rb +70 -0
- data/lib/ffi/gdal.rb +56 -69
- data/lib/ffi/ogr/api.rb +567 -0
- data/lib/ffi/ogr/{ogr_contour_writer_info.rb → contour_writer_info.rb} +2 -3
- data/lib/ffi/ogr/core.rb +181 -0
- data/lib/ffi/ogr/envelope.rb +12 -0
- data/lib/ffi/ogr/{ogr_envelope_3d.rb → envelope_3d.rb} +2 -2
- data/lib/ffi/ogr/featurestyle.rb +29 -0
- data/lib/ffi/ogr/field.rb +63 -0
- data/lib/ffi/ogr/geocoding.rb +30 -0
- data/lib/ffi/ogr/srs_api.rb +407 -0
- data/lib/ffi/ogr/style_param.rb +13 -0
- data/lib/ffi/ogr/{ogr_style_value.rb → style_value.rb} +4 -3
- data/lib/ffi/ogr.rb +7 -7
- data/lib/ffi-gdal.rb +7 -145
- data/lib/gdal/color_entry.rb +18 -14
- data/lib/gdal/color_entry_mixins/extensions.rb +32 -0
- data/lib/gdal/color_interpretation.rb +2 -2
- data/lib/gdal/color_table.rb +37 -32
- data/lib/gdal/color_table_mixins/extensions.rb +48 -0
- data/lib/gdal/cpl_error_handler.rb +119 -0
- data/lib/gdal/data_type.rb +7 -7
- data/lib/gdal/dataset.rb +131 -238
- data/lib/gdal/dataset_mixins/algorithm_methods.rb +182 -0
- data/lib/gdal/dataset_mixins/extensions.rb +542 -0
- data/lib/gdal/dataset_mixins/matching.rb +26 -0
- data/lib/gdal/driver.rb +68 -92
- data/lib/gdal/driver_mixins/extensions.rb +93 -0
- data/lib/gdal/exceptions.rb +32 -4
- data/lib/gdal/geo_transform.rb +63 -43
- data/lib/gdal/geo_transform_mixins/extensions.rb +57 -0
- data/lib/gdal/grid.rb +144 -0
- data/lib/gdal/grid_types/data_metrics_base.rb +14 -0
- data/lib/gdal/grid_types/inverse_distance_to_a_power.rb +19 -0
- data/lib/gdal/grid_types/metric_average_distance.rb +12 -0
- data/lib/gdal/grid_types/metric_average_distance_pts.rb +12 -0
- data/lib/gdal/grid_types/metric_count.rb +12 -0
- data/lib/gdal/grid_types/metric_maximum.rb +12 -0
- data/lib/gdal/grid_types/metric_minimum.rb +12 -0
- data/lib/gdal/grid_types/metric_range.rb +12 -0
- data/lib/gdal/grid_types/moving_average.rb +19 -0
- data/lib/gdal/grid_types/nearest_neighbor.rb +19 -0
- data/lib/gdal/grid_types.rb +22 -0
- data/lib/gdal/internal_helpers.rb +94 -0
- data/lib/gdal/major_object.rb +4 -7
- data/lib/gdal/options.rb +14 -7
- data/lib/gdal/raster_attribute_table.rb +38 -47
- data/lib/gdal/raster_attribute_table_mixins/extensions.rb +41 -0
- data/lib/gdal/raster_band.rb +193 -227
- data/lib/gdal/raster_band_classifier.rb +107 -0
- data/lib/gdal/raster_band_mixins/algorithm_methods.rb +292 -0
- data/lib/gdal/raster_band_mixins/extensions.rb +238 -0
- data/lib/gdal/rpc_info.rb +35 -0
- data/lib/gdal/transformer.rb +15 -0
- data/lib/gdal/transformers/approximate_transformer.rb +48 -0
- data/lib/gdal/transformers/base_general_image_projection_transformer.rb +45 -0
- data/lib/gdal/transformers/gcp_transformer.rb +55 -0
- data/lib/gdal/transformers/general_image_projection_transformer.rb +31 -0
- data/lib/gdal/transformers/general_image_projection_transformer2.rb +52 -0
- data/lib/gdal/transformers/general_image_projection_transformer3.rb +25 -0
- data/lib/gdal/transformers/geolocation_transformer.rb +42 -0
- data/lib/gdal/transformers/reprojection_transformer.rb +39 -0
- data/lib/gdal/transformers/rpc_transformer.rb +56 -0
- data/lib/gdal/transformers/tps_transformer.rb +40 -0
- data/lib/gdal/virtual_dataset.rb +96 -0
- data/lib/gdal/warp_operation.rb +20 -23
- data/lib/gdal.rb +17 -0
- data/lib/ogr/coordinate_transformation.rb +16 -41
- data/lib/ogr/data_source.rb +103 -58
- data/lib/ogr/data_source_extensions.rb +5 -6
- data/lib/ogr/data_source_mixins/capability_methods.rb +27 -0
- data/lib/ogr/driver.rb +61 -33
- data/lib/ogr/driver_mixins/capability_methods.rb +16 -0
- data/lib/ogr/envelope.rb +29 -18
- data/lib/ogr/envelope_extensions.rb +70 -49
- data/lib/ogr/error_handling.rb +46 -0
- data/lib/ogr/exceptions.rb +58 -12
- data/lib/ogr/feature.rb +334 -86
- data/lib/ogr/feature_definition.rb +94 -51
- data/lib/ogr/feature_definition_extensions.rb +36 -13
- data/lib/ogr/feature_extensions.rb +62 -11
- data/lib/ogr/field.rb +175 -54
- data/lib/ogr/field_definition.rb +110 -0
- data/lib/ogr/{field_extensions.rb → field_definition_extensions.rb} +4 -5
- data/lib/ogr/{geocoding_session.rb → geocoder.rb} +14 -13
- data/lib/ogr/geometries/geometry_collection.rb +13 -0
- data/lib/ogr/geometries/line_string.rb +35 -0
- data/lib/ogr/geometries/linear_ring.rb +11 -0
- data/lib/ogr/geometries/multi_line_string.rb +16 -0
- data/lib/ogr/geometries/multi_point.rb +14 -0
- data/lib/ogr/geometries/multi_polygon.rb +21 -0
- data/lib/ogr/geometries/none_geometry.rb +13 -0
- data/lib/ogr/geometries/point.rb +65 -0
- data/lib/ogr/geometries/point_extensions.rb +32 -0
- data/lib/ogr/geometries/polygon.rb +14 -0
- data/lib/ogr/geometries/unknown_geometry.rb +10 -0
- data/lib/ogr/geometry.rb +270 -242
- data/lib/ogr/geometry_extensions.rb +8 -9
- data/lib/ogr/geometry_field_definition.rb +99 -0
- data/lib/ogr/geometry_field_definition_extensions.rb +19 -0
- data/lib/ogr/geometry_types/container.rb +75 -0
- data/lib/ogr/geometry_types/curve.rb +25 -28
- data/lib/ogr/geometry_types/surface.rb +13 -4
- data/lib/ogr/internal_helpers.rb +57 -0
- data/lib/ogr/layer.rb +60 -181
- data/lib/ogr/layer_mixins/capability_methods.rb +102 -0
- data/lib/ogr/layer_mixins/extensions.rb +59 -0
- data/lib/ogr/layer_mixins/ogr_feature_methods.rb +127 -0
- data/lib/ogr/layer_mixins/ogr_field_methods.rb +143 -0
- data/lib/ogr/layer_mixins/ogr_layer_method_methods.rb +163 -0
- data/lib/ogr/layer_mixins/ogr_query_filter_methods.rb +89 -0
- data/lib/ogr/layer_mixins/ogr_sql_methods.rb +48 -0
- data/lib/ogr/spatial_reference.rb +108 -589
- data/lib/ogr/spatial_reference_extensions.rb +29 -3
- data/lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb +494 -0
- data/lib/ogr/spatial_reference_mixins/exporters.rb +134 -0
- data/lib/ogr/spatial_reference_mixins/importers.rb +243 -0
- data/lib/ogr/spatial_reference_mixins/morphers.rb +25 -0
- data/lib/ogr/spatial_reference_mixins/parameter_getter_setters.rb +122 -0
- data/lib/ogr/spatial_reference_mixins/type_checks.rb +62 -0
- data/lib/ogr/style_table.rb +53 -5
- data/lib/ogr/style_table_extensions.rb +21 -5
- data/lib/ogr/style_tool.rb +118 -0
- data/lib/ogr.rb +8 -0
- data/spec/ffi-gdal_spec.rb +1 -2
- data/spec/integration/{color_table_info_spec.rb → gdal/color_table_info_spec.rb} +12 -12
- data/spec/integration/{dataset_info_spec.rb → gdal/dataset_info_spec.rb} +2 -6
- data/spec/integration/{driver_info_spec.rb → gdal/driver_info_spec.rb} +5 -5
- data/spec/integration/{geo_transform_info_spec.rb → gdal/geo_transform_info_spec.rb} +1 -14
- data/spec/integration/{raster_attribute_table_info_spec.rb → gdal/raster_attribute_table_info_spec.rb} +1 -2
- data/spec/integration/{raster_band_info_spec.rb → gdal/raster_band_info_spec.rb} +30 -42
- data/spec/integration/ogr/layer_spec.rb +97 -0
- data/spec/spec_helper.rb +94 -5
- data/spec/support/integration_help.rb +1 -0
- data/spec/support/shared_contexts.rb +26 -0
- data/spec/support/shared_examples/{major_object_examples.rb → gdal/major_object_examples.rb} +5 -5
- data/spec/support/shared_examples/ogr/a_25D_geometry.rb +7 -0
- data/spec/support/shared_examples/ogr/a_container_geometry.rb +47 -0
- data/spec/support/shared_examples/ogr/a_geometry.rb +404 -0
- data/spec/support/shared_examples/ogr/a_line_string.rb +16 -0
- data/spec/support/test_style_table.txt +3 -0
- data/spec/unit/ext/error_symbols_spec.rb +41 -53
- data/spec/unit/ext/numeric_as_data_type_spec.rb +113 -0
- data/spec/unit/ffi/gdal_spec.rb +70 -0
- data/spec/unit/gdal/color_entry_spec.rb +5 -0
- data/spec/unit/gdal/color_interpretation_spec.rb +5 -0
- data/spec/unit/gdal/{color_table_extensions_spec.rb → color_table_mixins/extensions_spec.rb} +3 -3
- data/spec/unit/gdal/color_table_spec.rb +14 -16
- data/spec/unit/gdal/data_type_spec.rb +10 -17
- data/spec/unit/gdal/dataset_spec.rb +4 -7
- data/spec/unit/gdal/driver_mixins/extensions_spec.rb +22 -0
- data/spec/unit/gdal/driver_spec.rb +49 -0
- data/spec/unit/gdal/environment_methods_spec.rb +6 -0
- data/spec/unit/gdal/geo_transform_spec.rb +276 -0
- data/spec/unit/gdal/grid_spec.rb +5 -0
- data/spec/unit/gdal/internal_helpers_spec.rb +112 -0
- data/spec/unit/gdal/major_object_spec.rb +6 -0
- data/spec/unit/gdal/options_spec.rb +5 -0
- data/spec/unit/gdal/raster_attribute_table_spec.rb +5 -0
- data/spec/unit/gdal/raster_band_classifier_spec.rb +134 -0
- data/spec/unit/gdal/raster_band_spec.rb +5 -0
- data/spec/unit/gdal/rpc_info_spec.rb +5 -0
- data/spec/unit/gdal/version_info_spec.rb +6 -0
- data/spec/unit/gdal/virtual_dataset_spec.rb +32 -0
- data/spec/unit/gdal/warp_operation_spec.rb +5 -0
- data/spec/unit/ogr/data_source_mixins/capability_methods_spec.rb +30 -0
- data/spec/unit/ogr/data_source_spec.rb +209 -0
- data/spec/unit/ogr/driver_mixins/capability_methods_spec.rb +18 -0
- data/spec/unit/ogr/driver_spec.rb +150 -0
- data/spec/unit/ogr/envelope_spec.rb +322 -0
- data/spec/unit/ogr/feature_definition_spec.rb +313 -0
- data/spec/unit/ogr/feature_spec.rb +379 -0
- data/spec/unit/ogr/field_definition_spec.rb +135 -0
- data/spec/unit/ogr/field_spec.rb +193 -0
- data/spec/unit/ogr/geometries/geometry_collection_spec.rb +186 -0
- data/spec/unit/ogr/geometries/line_string_spec.rb +105 -0
- data/spec/unit/ogr/{linear_ring_spec.rb → geometries/linear_ring_spec.rb} +10 -31
- data/spec/unit/ogr/geometries/multi_line_string_spec.rb +14 -0
- data/spec/unit/ogr/geometries/multi_point_spec.rb +14 -0
- data/spec/unit/ogr/geometries/multi_polygon_spec.rb +41 -0
- data/spec/unit/ogr/geometries/none_geometry_spec.rb +12 -0
- data/spec/unit/ogr/{point_spec.rb → geometries/point_spec.rb} +19 -25
- data/spec/unit/ogr/geometries/polygon_spec.rb +17 -0
- data/spec/unit/ogr/geometries/unknown_geometry_spec.rb +10 -0
- data/spec/unit/ogr/geometry_field_definition_spec.rb +87 -0
- data/spec/unit/ogr/geometry_spec.rb +542 -0
- data/spec/unit/ogr/internal_helpers_spec.rb +57 -0
- data/spec/unit/ogr/layer_mixins/capability_methods_spec.rb +88 -0
- data/spec/unit/ogr/layer_mixins/ogr_feature_methods_spec.rb +145 -0
- data/spec/unit/ogr/layer_mixins/ogr_field_methods_spec.rb +432 -0
- data/spec/unit/ogr/layer_mixins/ogr_layer_method_methods_spec.rb +20 -0
- data/spec/unit/ogr/layer_mixins/ogr_query_filter_methods_spec.rb +42 -0
- data/spec/unit/ogr/layer_mixins/ogr_sql_methods_spec.rb +12 -0
- data/spec/unit/ogr/layer_spec.rb +66 -67
- data/spec/unit/ogr/spatial_reference_mixins/coordinate_system_getter_setters_spec.rb +46 -0
- data/spec/unit/ogr/spatial_reference_mixins/exporters_spec.rb +139 -0
- data/spec/unit/ogr/spatial_reference_mixins/importers_spec.rb +38 -0
- data/spec/unit/ogr/spatial_reference_mixins/morphers_spec.rb +36 -0
- data/spec/unit/ogr/spatial_reference_mixins/parameter_getter_setters_spec.rb +102 -0
- data/spec/unit/ogr/spatial_reference_mixins/type_checks_spec.rb +157 -0
- data/spec/unit/ogr/spatial_reference_spec.rb +42 -0
- data/spec/unit/ogr/style_table_spec.rb +132 -0
- data/spec/unit/ogr/style_tool_spec.rb +157 -0
- data/spec/unit/version_info_spec.rb +1 -1
- metadata +285 -75
- data/lib/ffi/cpl/conv_h.rb +0 -143
- data/lib/ffi/cpl/error_h.rb +0 -63
- data/lib/ffi/cpl/minixml_h.rb +0 -14
- data/lib/ffi/cpl/string_h.rb +0 -81
- data/lib/ffi/cpl/vsi_h.rb +0 -112
- data/lib/ffi/gdal/alg_h.rb +0 -127
- data/lib/ffi/gdal/grid_h.rb +0 -51
- data/lib/ffi/gdal/warper_h.rb +0 -48
- data/lib/ffi/ogr/api_h.rb +0 -553
- data/lib/ffi/ogr/core_h.rb +0 -148
- data/lib/ffi/ogr/featurestyle_h.rb +0 -22
- data/lib/ffi/ogr/geocoding_h.rb +0 -21
- data/lib/ffi/ogr/ogr_field.rb +0 -50
- data/lib/ffi/ogr/ogr_style_param.rb +0 -12
- data/lib/ffi/ogr/srs_api_h.rb +0 -325
- data/lib/gdal/color_entry_extensions.rb +0 -30
- data/lib/gdal/color_table_extensions.rb +0 -47
- data/lib/gdal/dataset_extensions.rb +0 -496
- data/lib/gdal/driver_extensions.rb +0 -56
- data/lib/gdal/geo_transform_extensions.rb +0 -90
- data/lib/gdal/raster_attribute_table_extensions.rb +0 -40
- data/lib/gdal/raster_band_extensions.rb +0 -198
- data/lib/ogr/geometry_types/collection.rb +0 -45
- data/lib/ogr/layer_extensions.rb +0 -55
- data/lib/ogr/line_string.rb +0 -7
- data/lib/ogr/linear_ring.rb +0 -6
- data/lib/ogr/multi_line_string.rb +0 -9
- data/lib/ogr/multi_point.rb +0 -7
- data/lib/ogr/multi_polygon.rb +0 -14
- data/lib/ogr/point.rb +0 -89
- data/lib/ogr/polygon.rb +0 -9
@@ -0,0 +1,404 @@
|
|
1
|
+
RSpec.shared_examples 'a geometry' do
|
2
|
+
require 'ogr/spatial_reference'
|
3
|
+
|
4
|
+
describe '#coordinate_dimension' do
|
5
|
+
subject { geometry.coordinate_dimension }
|
6
|
+
it { is_expected.to eq 2 }
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#coordinate_dimension=' do
|
10
|
+
context 'valid value' do
|
11
|
+
it 'changes the dimension to the new value' do
|
12
|
+
skip
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'invalid value' do
|
17
|
+
it '???' do
|
18
|
+
skip
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#empty!' do
|
24
|
+
it 'removes all points/geometries from the geometry' do
|
25
|
+
skip
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#empty?' do
|
30
|
+
context 'when empty' do
|
31
|
+
subject { described_class.new }
|
32
|
+
it { is_expected.to be_empty }
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when with points' do
|
36
|
+
it 'is not empty' do
|
37
|
+
skip 'Writing the test'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#envelope' do
|
43
|
+
subject { geometry.envelope }
|
44
|
+
it { is_expected.to be_a OGR::Envelope }
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#dump_readable' do
|
48
|
+
context 'with prefix' do
|
49
|
+
it 'writes out to a file' do
|
50
|
+
skip
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'without prefix' do
|
55
|
+
it 'writes out to a file' do
|
56
|
+
skip
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#intersects?' do
|
62
|
+
context 'self intersects other geometry' do
|
63
|
+
it 'returns true' do
|
64
|
+
skip
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'self does not intersect other geometry' do
|
69
|
+
it 'returns false' do
|
70
|
+
skip
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#equals?' do
|
76
|
+
context 'self equals other geometry' do
|
77
|
+
it 'returns true' do
|
78
|
+
skip
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'self does not equals other geometry' do
|
83
|
+
it 'returns false' do
|
84
|
+
skip
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe '#disjoint?' do
|
90
|
+
context 'self disjoints other geometry' do
|
91
|
+
it 'returns true' do
|
92
|
+
skip
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context 'self does not disjoint other geometry' do
|
97
|
+
it 'returns false' do
|
98
|
+
skip
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe '#touches?' do
|
104
|
+
context 'self touches other geometry' do
|
105
|
+
it 'returns true' do
|
106
|
+
skip
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
context 'self does not touch other geometry' do
|
111
|
+
it 'returns false' do
|
112
|
+
skip
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe '#crosses?' do
|
118
|
+
context 'self touches other geometry' do
|
119
|
+
it 'returns true' do
|
120
|
+
skip
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
context 'self does not touch other geometry' do
|
125
|
+
it 'returns false' do
|
126
|
+
skip
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
describe '#within?' do
|
132
|
+
context 'self is within other geometry' do
|
133
|
+
it 'returns true' do
|
134
|
+
skip
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
context 'self is not within other geometry' do
|
139
|
+
it 'returns false' do
|
140
|
+
skip
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe '#contains?' do
|
146
|
+
context 'self contains other geometry' do
|
147
|
+
it 'returns true' do
|
148
|
+
skip
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
context 'self does not contain other geometry' do
|
153
|
+
it 'returns false' do
|
154
|
+
skip
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe '#overlaps?' do
|
160
|
+
context 'self overlaps other geometry' do
|
161
|
+
it 'returns true' do
|
162
|
+
skip
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
context 'self does not overlap other geometry' do
|
167
|
+
it 'returns false' do
|
168
|
+
skip
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
describe '#valid?' do
|
174
|
+
context 'self is valid' do
|
175
|
+
it 'returns true' do
|
176
|
+
skip
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
context 'self is not valid' do
|
181
|
+
it 'returns false' do
|
182
|
+
skip
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
describe '#simple?' do
|
188
|
+
context 'self is simple' do
|
189
|
+
it 'returns true' do
|
190
|
+
skip
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
context 'self is not simple' do
|
195
|
+
it 'returns false' do
|
196
|
+
skip
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
describe '#ring?' do
|
202
|
+
context 'self is a ring' do
|
203
|
+
it 'returns true' do
|
204
|
+
skip
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
context 'self is not a ring' do
|
209
|
+
it 'returns false' do
|
210
|
+
skip
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
describe '#intersection' do
|
216
|
+
specify { skip 'Implementation' }
|
217
|
+
end
|
218
|
+
|
219
|
+
describe '#union' do
|
220
|
+
context 'where there is no union' do
|
221
|
+
specify { skip }
|
222
|
+
end
|
223
|
+
|
224
|
+
context 'where there is union' do
|
225
|
+
specify { skip }
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
describe '#close_rings!' do
|
230
|
+
it 'adds points to close any potential rings' do
|
231
|
+
skip
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
describe '#polygonize' do
|
236
|
+
it 'adds points to close any potential rings' do
|
237
|
+
skip
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
describe '#difference' do
|
242
|
+
it 'creates a new geometry that represents the difference' do
|
243
|
+
skip
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
describe '#symmetric_difference' do
|
248
|
+
it 'creates a new geometry that represents the difference' do
|
249
|
+
skip
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
describe '#distance_to' do
|
254
|
+
context 'other geometry is nil' do
|
255
|
+
it '???' do
|
256
|
+
skip
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
context 'other geometry is valid' do
|
261
|
+
it 'creates a new geometry that represents the difference' do
|
262
|
+
skip
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
describe '#spatial_reference' do
|
268
|
+
context 'none assigned' do
|
269
|
+
it 'returns nil' do
|
270
|
+
expect(geometry.spatial_reference).to be_nil
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
context 'has one assigned' do
|
275
|
+
it 'returns a spatial reference' do
|
276
|
+
geometry.spatial_reference = OGR::SpatialReference.new_from_epsg 4326
|
277
|
+
expect(geometry.spatial_reference).to be_a OGR::SpatialReference
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
describe '#spatial_reference=' do
|
283
|
+
it 'assigns the new spatial reference' do
|
284
|
+
skip
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
describe '#transform!' do
|
289
|
+
it 'assigns the new spatial reference' do
|
290
|
+
skip
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
describe '#transform_to!' do
|
295
|
+
it 'transforms the points into the new spatial reference' do
|
296
|
+
skip
|
297
|
+
end
|
298
|
+
|
299
|
+
it 'sets the new spatial reference' do
|
300
|
+
skip
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
describe '#simplify' do
|
305
|
+
context 'preserve_topology is true' do
|
306
|
+
it 'returns a new geometry' do
|
307
|
+
skip
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
context 'preserve_topology is false' do
|
312
|
+
it 'returns a new geometry' do
|
313
|
+
skip
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
describe '#segmentize!' do
|
319
|
+
it 'updates the geometry' do
|
320
|
+
skip
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
describe '#boundary' do
|
325
|
+
it 'returns a geometry that represents the boundary of self' do
|
326
|
+
skip
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
describe '#buffer' do
|
331
|
+
it 'returns a new geometry that adds a boundary around self' do
|
332
|
+
skip
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
describe '#convex_hull' do
|
337
|
+
it 'returns a new geometry that is the convex hull of self' do
|
338
|
+
skip
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
describe '#import_from_wkb' do
|
343
|
+
it 'updates self with the new geometry info' do
|
344
|
+
skip
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
describe '#import_from_wkt' do
|
349
|
+
it 'updates self with the new geometry info' do
|
350
|
+
skip
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
describe '#wkb_size' do
|
355
|
+
it 'returns a non-zero integer' do
|
356
|
+
expect(geometry.wkb_size).to be_a Fixnum
|
357
|
+
|
358
|
+
if geometry.name == 'LINEARRING'
|
359
|
+
expect(geometry.wkb_size).to be_zero
|
360
|
+
else
|
361
|
+
expect(geometry.wkb_size).to be > 0
|
362
|
+
end
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
describe '#to_wkb' do
|
367
|
+
it 'returns some binary String data' do
|
368
|
+
if geometry.name == 'LINEARRING'
|
369
|
+
expect { geometry.to_wkb }.to raise_exception OGR::UnsupportedOperation
|
370
|
+
else
|
371
|
+
expect(geometry.to_wkb).to be_a String
|
372
|
+
expect(geometry.to_wkb).to_not be_empty
|
373
|
+
end
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
describe '#to_wkt' do
|
378
|
+
it 'returns some String data' do
|
379
|
+
expect(geometry.to_wkt).to be_a String
|
380
|
+
expect(geometry.to_wkt).to_not be_empty
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
describe '#to_gml' do
|
385
|
+
it 'returns some String data' do
|
386
|
+
expect(geometry.to_gml).to be_a String
|
387
|
+
expect(geometry.to_gml).to_not be_empty
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
describe '#to_kml' do
|
392
|
+
it 'returns some String data' do
|
393
|
+
expect(geometry.to_kml).to be_a String
|
394
|
+
expect(geometry.to_kml).to_not be_empty
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
describe '#to_geo_json' do
|
399
|
+
it 'returns some String data' do
|
400
|
+
expect(geometry.to_geo_json).to be_a String
|
401
|
+
expect(geometry.to_geo_json).to_not be_empty
|
402
|
+
end
|
403
|
+
end
|
404
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
RSpec.shared_examples 'a line string' do
|
2
|
+
describe '#dimension' do
|
3
|
+
subject { geometry.dimension }
|
4
|
+
it { is_expected.to eq 1 }
|
5
|
+
end
|
6
|
+
|
7
|
+
describe '#type' do
|
8
|
+
subject { geometry.type }
|
9
|
+
it { is_expected.to eq :wkbLineString }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#type_to_name' do
|
13
|
+
subject { geometry.type }
|
14
|
+
it { is_expected.to eq :wkbLineString }
|
15
|
+
end
|
16
|
+
end
|
@@ -1,78 +1,66 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'ext/error_symbols'
|
3
3
|
|
4
|
-
describe Symbol do
|
5
|
-
describe '#
|
6
|
-
context ':
|
7
|
-
subject { :
|
8
|
-
|
9
|
-
it 'returns :none' do
|
10
|
-
expect(subject.to_ruby).to eq :none
|
11
|
-
end
|
12
|
-
|
13
|
-
context 'with an explicit value' do
|
14
|
-
it 'returns what the given param is' do
|
15
|
-
expect(subject.to_ruby(none: :pants)).to eq :pants
|
16
|
-
end
|
17
|
-
end
|
4
|
+
RSpec.describe Symbol do
|
5
|
+
describe '#handle_result' do
|
6
|
+
context ':OGRERR_NONE' do
|
7
|
+
subject { :OGRERR_NONE.handle_result }
|
8
|
+
it { is_expected.to eq true }
|
18
9
|
end
|
19
10
|
|
20
|
-
context ':
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
expect(subject.to_ruby).to eq :debug
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'with an explicit value' do
|
28
|
-
it 'returns what the given param is' do
|
29
|
-
expect(subject.to_ruby(debug: :pants)).to eq :pants
|
30
|
-
end
|
11
|
+
context ':OGRERR_NOT_ENOUGH_DATA' do
|
12
|
+
it 'raises an OGR::NotEnoughData exception' do
|
13
|
+
expect { :OGRERR_NOT_ENOUGH_DATA.handle_result }.
|
14
|
+
to raise_exception OGR::NotEnoughData
|
31
15
|
end
|
32
16
|
end
|
33
17
|
|
34
|
-
context ':
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
expect(subject.to_ruby).to eq :warning
|
18
|
+
context ':OGRERR_NOT_ENOUGH_MEMORY' do
|
19
|
+
it 'raises an NoMemoryError exception' do
|
20
|
+
expect { :OGRERR_NOT_ENOUGH_MEMORY.handle_result }.
|
21
|
+
to raise_exception NoMemoryError
|
39
22
|
end
|
23
|
+
end
|
40
24
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
25
|
+
context ':OGRERR_UNSUPPORTED_GEOMETRY_TYPE' do
|
26
|
+
it 'raises an OGR::UnsupportedGeometryType exception' do
|
27
|
+
expect { :OGRERR_UNSUPPORTED_GEOMETRY_TYPE.handle_result }.
|
28
|
+
to raise_exception OGR::UnsupportedGeometryType
|
45
29
|
end
|
46
30
|
end
|
47
|
-
end
|
48
31
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
32
|
+
context ':OGRERR_UNSUPPORTED_OPERATION' do
|
33
|
+
it 'raises an OGR::UnsupportedOperation exception' do
|
34
|
+
expect { :OGRERR_UNSUPPORTED_OPERATION.handle_result }.
|
35
|
+
to raise_exception OGR::UnsupportedOperation
|
36
|
+
end
|
53
37
|
end
|
54
38
|
|
55
|
-
context ':
|
56
|
-
|
57
|
-
|
39
|
+
context ':OGRERR_CORRUPT_DATA' do
|
40
|
+
it 'raises an OGR::CorruptData exception' do
|
41
|
+
expect { :OGRERR_CORRUPT_DATA.handle_result }.
|
42
|
+
to raise_exception OGR::CorruptData
|
43
|
+
end
|
58
44
|
end
|
59
45
|
|
60
|
-
context ':
|
61
|
-
|
62
|
-
|
46
|
+
context ':OGRERR_FAILURE' do
|
47
|
+
it 'raises an OGR::Failure exception' do
|
48
|
+
expect { :OGRERR_FAILURE.handle_result }.
|
49
|
+
to raise_exception OGR::Failure
|
50
|
+
end
|
63
51
|
end
|
64
52
|
|
65
|
-
context ':
|
66
|
-
|
67
|
-
|
68
|
-
|
53
|
+
context ':OGRERR_UNSUPPORTED_SRS' do
|
54
|
+
it 'raises an OGR::UnsupportedSRS exception' do
|
55
|
+
expect { :OGRERR_UNSUPPORTED_SRS.handle_result }.
|
56
|
+
to raise_exception OGR::UnsupportedSRS
|
69
57
|
end
|
70
58
|
end
|
71
59
|
|
72
|
-
context ':
|
73
|
-
|
74
|
-
|
75
|
-
|
60
|
+
context ':OGRERR_INVALID_HANDLE' do
|
61
|
+
it 'raises an OGR::InvalidHandle exception' do
|
62
|
+
expect { :OGRERR_INVALID_HANDLE.handle_result }.
|
63
|
+
to raise_exception OGR::InvalidHandle
|
76
64
|
end
|
77
65
|
end
|
78
66
|
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Numeric do
|
4
|
+
let(:integer_data_types) do
|
5
|
+
%i[GDT_Byte GDT_UInt16 GDT_Int16 GDT_UInt32 GDT_Int32]
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:float_data_types) do
|
9
|
+
%i[GDT_Float32 GDT_Float64]
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:complex_data_types) do
|
13
|
+
%i[GDT_CInt16 GDT_CInt32 GDT_CFloat32 GDT_CFloat64]
|
14
|
+
end
|
15
|
+
|
16
|
+
shared_examples_for 'a numeric converted to GDAL' do
|
17
|
+
context 'integer data types' do
|
18
|
+
it 'returns an Integer' do
|
19
|
+
integer_data_types.each do |data_type|
|
20
|
+
expect(subject.to_data_type(data_type)).to eql 1
|
21
|
+
expect(subject.to_data_type(data_type)).to be_an Integer
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'float data types' do
|
27
|
+
it 'returns a Float' do
|
28
|
+
float_data_types.each do |data_type|
|
29
|
+
expect(subject.to_data_type(data_type)).to eql 1.0
|
30
|
+
expect(subject.to_data_type(data_type)).to be_a Float
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'complex data types' do
|
36
|
+
it 'returns a Complex' do
|
37
|
+
complex_data_types.each do |data_type|
|
38
|
+
expect(subject.to_data_type(data_type)).to eql(1 + 0i).or eql(1.0 + 0i)
|
39
|
+
expect(subject.to_data_type(data_type)).to be_a Complex
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'Integers' do
|
46
|
+
subject { 1 }
|
47
|
+
|
48
|
+
it_behaves_like 'a numeric converted to GDAL'
|
49
|
+
|
50
|
+
context 'unknown data type' do
|
51
|
+
it 'returns self' do
|
52
|
+
expect(subject.to_data_type('meow')).to eql 1
|
53
|
+
expect(subject.to_data_type('meow')).to be_a Integer
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'Floats' do
|
59
|
+
context 'subject round down to 1' do
|
60
|
+
subject { 1.0 }
|
61
|
+
|
62
|
+
it_behaves_like 'a numeric converted to GDAL'
|
63
|
+
|
64
|
+
context 'unknown data type' do
|
65
|
+
it 'returns self' do
|
66
|
+
expect(subject.to_data_type('meow')).to eql subject
|
67
|
+
expect(subject.to_data_type('meow')).to be_a Float
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'subject rounds up to 2' do
|
73
|
+
subject { 1.8 }
|
74
|
+
|
75
|
+
context 'integer data types' do
|
76
|
+
it 'returns an Integer' do
|
77
|
+
integer_data_types.each do |data_type|
|
78
|
+
expect(subject.to_data_type(data_type)).to eql 1
|
79
|
+
expect(subject.to_data_type(data_type)).to be_an Integer
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'Complexes' do
|
87
|
+
context 'subject round down to 1' do
|
88
|
+
subject { 1 + 0i }
|
89
|
+
|
90
|
+
it_behaves_like 'a numeric converted to GDAL'
|
91
|
+
|
92
|
+
context 'unknown data type' do
|
93
|
+
it 'returns self' do
|
94
|
+
expect(subject.to_data_type('meow')).to eql subject
|
95
|
+
expect(subject.to_data_type('meow')).to be_a Complex
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
context 'subject rounds up to 2' do
|
101
|
+
subject { 1.8 + 0i }
|
102
|
+
|
103
|
+
context 'integer data types' do
|
104
|
+
it 'returns an Integer' do
|
105
|
+
integer_data_types.each do |data_type|
|
106
|
+
expect(subject.to_data_type(data_type)).to eql 1
|
107
|
+
expect(subject.to_data_type(data_type)).to be_an Integer
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|