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
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'support/integration_help'
|
3
3
|
require 'ffi-gdal'
|
4
|
-
|
4
|
+
require 'gdal/dataset'
|
5
5
|
|
6
6
|
TIF_FILES.each do |file|
|
7
7
|
dataset = GDAL::Dataset.open(file, 'r')
|
8
8
|
|
9
|
-
describe 'Color Table Info' do
|
9
|
+
RSpec.describe 'Color Table Info' do
|
10
10
|
after :all do
|
11
11
|
dataset.close
|
12
12
|
end
|
@@ -34,26 +34,26 @@ TIF_FILES.each do |file|
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe '#color_entry' do
|
37
|
-
it 'returns a
|
37
|
+
it 'returns a GDAL::ColorEntry' do
|
38
38
|
next if subject.nil?
|
39
39
|
|
40
|
-
expect(subject.color_entry(0)).to be_a
|
40
|
+
expect(subject.color_entry(0)).to be_a GDAL::ColorEntry
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'has 4 Fixnum values, >= 0' do
|
44
44
|
next if subject.nil?
|
45
45
|
|
46
|
-
expect(subject.color_entry(0)
|
47
|
-
expect(subject.color_entry(0)
|
46
|
+
expect(subject.color_entry(0).color1).to be_a Fixnum
|
47
|
+
expect(subject.color_entry(0).color1).to be >= 0
|
48
48
|
|
49
|
-
expect(subject.color_entry(0)
|
50
|
-
expect(subject.color_entry(0)
|
49
|
+
expect(subject.color_entry(0).color2).to be_a Fixnum
|
50
|
+
expect(subject.color_entry(0).color2).to be >= 0
|
51
51
|
|
52
|
-
expect(subject.color_entry(0)
|
53
|
-
expect(subject.color_entry(0)
|
52
|
+
expect(subject.color_entry(0).color3).to be_a Fixnum
|
53
|
+
expect(subject.color_entry(0).color3).to be >= 0
|
54
54
|
|
55
|
-
expect(subject.color_entry(0)
|
56
|
-
expect(subject.color_entry(0)
|
55
|
+
expect(subject.color_entry(0).color4).to be_a Fixnum
|
56
|
+
expect(subject.color_entry(0).color4).to be >= 0
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -3,17 +3,13 @@ require 'support/integration_help'
|
|
3
3
|
require 'ffi-gdal'
|
4
4
|
|
5
5
|
TIF_FILES.each do |file|
|
6
|
-
describe 'Dataset Info' do
|
6
|
+
RSpec.describe 'Dataset Info' do
|
7
7
|
subject do
|
8
8
|
GDAL::Dataset.open(file, 'r')
|
9
9
|
end
|
10
10
|
|
11
11
|
it_behaves_like 'a major object'
|
12
12
|
|
13
|
-
describe '#open?' do
|
14
|
-
it { is_expected.to be_open }
|
15
|
-
end
|
16
|
-
|
17
13
|
describe '#driver' do
|
18
14
|
it 'is a GDAL::Driver' do
|
19
15
|
expect(subject.driver).to be_a GDAL::Driver
|
@@ -88,7 +84,7 @@ TIF_FILES.each do |file|
|
|
88
84
|
|
89
85
|
describe '#gcps' do
|
90
86
|
it 'is a GDALGCP' do
|
91
|
-
expect(subject.gcps).to be_a FFI::GDAL::
|
87
|
+
expect(subject.gcps).to be_a FFI::GDAL::GCP
|
92
88
|
end
|
93
89
|
end
|
94
90
|
end
|
@@ -3,17 +3,17 @@ require 'support/integration_help'
|
|
3
3
|
require 'ffi-gdal'
|
4
4
|
|
5
5
|
TIF_FILES.each do |file|
|
6
|
-
describe 'Driver Info' do
|
6
|
+
RSpec.describe 'Driver Info' do
|
7
7
|
subject do
|
8
|
-
GDAL::
|
8
|
+
GDAL::Dataset.open(file, 'r').driver
|
9
9
|
end
|
10
10
|
|
11
11
|
it_behaves_like 'a major object'
|
12
12
|
|
13
|
-
describe '.
|
13
|
+
describe '.count' do
|
14
14
|
it 'is a non-zero Integer' do
|
15
|
-
expect(GDAL::Driver.
|
16
|
-
expect(GDAL::Driver.
|
15
|
+
expect(GDAL::Driver.count).to be_a Fixnum
|
16
|
+
expect(GDAL::Driver.count).to be > 0
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -2,11 +2,10 @@ require 'spec_helper'
|
|
2
2
|
require 'support/integration_help'
|
3
3
|
require 'ffi-gdal'
|
4
4
|
|
5
|
-
|
6
5
|
TIF_FILES.each do |file|
|
7
6
|
dataset = GDAL::Dataset.open(file, 'r')
|
8
7
|
|
9
|
-
describe 'GeoTransform Info' do
|
8
|
+
RSpec.describe 'GeoTransform Info' do
|
10
9
|
after :all do
|
11
10
|
dataset.close
|
12
11
|
end
|
@@ -50,17 +49,5 @@ TIF_FILES.each do |file|
|
|
50
49
|
expect(subject.pixel_height).to be_a Float
|
51
50
|
end
|
52
51
|
end
|
53
|
-
|
54
|
-
describe '#x_projection' do
|
55
|
-
it 'is a Float' do
|
56
|
-
expect(subject.x_projection(0, 0)).to be_a Float
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe '#y_projection' do
|
61
|
-
it 'is a Float' do
|
62
|
-
expect(subject.y_projection(0, 0)).to be_a Float
|
63
|
-
end
|
64
|
-
end
|
65
52
|
end
|
66
53
|
end
|
@@ -2,11 +2,10 @@ require 'spec_helper'
|
|
2
2
|
require 'support/integration_help'
|
3
3
|
require 'ffi-gdal'
|
4
4
|
|
5
|
-
|
6
5
|
TIF_FILES.each do |file|
|
7
6
|
dataset = GDAL::Dataset.open(file, 'r')
|
8
7
|
|
9
|
-
describe 'Raster Band Info' do
|
8
|
+
RSpec.describe 'Raster Band Info' do
|
10
9
|
after :all do
|
11
10
|
dataset.close
|
12
11
|
end
|
@@ -2,12 +2,11 @@ require 'spec_helper'
|
|
2
2
|
require 'support/integration_help'
|
3
3
|
require 'ffi-gdal'
|
4
4
|
|
5
|
-
|
6
5
|
TIF_FILES.each do |file|
|
7
6
|
dataset = GDAL::Dataset.open(file, 'r')
|
8
7
|
|
9
8
|
dataset.each_band do |band_under_test|
|
10
|
-
describe
|
9
|
+
RSpec.describe 'Raster Band Info' do
|
11
10
|
after :suite do
|
12
11
|
dataset.close
|
13
12
|
end
|
@@ -45,9 +44,9 @@ TIF_FILES.each do |file|
|
|
45
44
|
end
|
46
45
|
|
47
46
|
describe '#color_interpretation' do
|
48
|
-
it 'is a Symbol; one of FFI::GDAL::
|
47
|
+
it 'is a Symbol; one of FFI::GDAL::ColorInterp' do
|
49
48
|
expect(subject.color_interpretation).to be_a Symbol
|
50
|
-
expect(FFI::GDAL::
|
49
|
+
expect(FFI::GDAL::ColorInterp.symbols).to include subject.color_interpretation
|
51
50
|
end
|
52
51
|
end
|
53
52
|
|
@@ -60,9 +59,9 @@ TIF_FILES.each do |file|
|
|
60
59
|
end
|
61
60
|
|
62
61
|
describe '#data_type' do
|
63
|
-
it 'is a Symbol; one of FFI::GDAL::
|
62
|
+
it 'is a Symbol; one of FFI::GDAL::DataType' do
|
64
63
|
expect(subject.data_type).to be_a Symbol
|
65
|
-
expect(FFI::GDAL::
|
64
|
+
expect(FFI::GDAL::DataType.symbols).to include subject.data_type
|
66
65
|
end
|
67
66
|
end
|
68
67
|
|
@@ -145,7 +144,7 @@ TIF_FILES.each do |file|
|
|
145
144
|
|
146
145
|
describe '#mask_flags' do
|
147
146
|
it 'returns an Array of Symbols' do
|
148
|
-
expect(subject.mask_flags).to eq
|
147
|
+
expect(subject.mask_flags).to eq([:GMF_ALL_VALID]).or eq([:GMF_PER_DATASET])
|
149
148
|
end
|
150
149
|
end
|
151
150
|
|
@@ -158,8 +157,8 @@ TIF_FILES.each do |file|
|
|
158
157
|
|
159
158
|
it 'has a :minimum that ranges between 0.0/-32768.0 and 255.0' do
|
160
159
|
min = subject.statistics[:minimum]
|
161
|
-
unless min == -
|
162
|
-
expect(subject.statistics[:minimum]).to(
|
160
|
+
unless min == -32_768.0
|
161
|
+
expect(subject.statistics[:minimum]).to (be >= 0.0).or eq(-32_768.0)
|
163
162
|
expect(subject.statistics[:minimum]).to be <= 255.0
|
164
163
|
end
|
165
164
|
end
|
@@ -167,7 +166,7 @@ TIF_FILES.each do |file|
|
|
167
166
|
|
168
167
|
describe '#scale' do
|
169
168
|
it 'returns a Hash with populated values' do
|
170
|
-
expect(subject.
|
169
|
+
expect(subject.scale).to be_a Hash
|
171
170
|
expect(%i[value is_meaningful]).to eq subject.scale.keys
|
172
171
|
end
|
173
172
|
|
@@ -235,24 +234,26 @@ TIF_FILES.each do |file|
|
|
235
234
|
end
|
236
235
|
|
237
236
|
it 'does nothing (because the file formats dont support it)' do
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
237
|
+
if defined? FFI::GDAL::GDALSetRasterUnitType
|
238
|
+
subject.unit_type = 'ft'
|
239
|
+
expect(subject.unit_type).to eq 'ft'
|
240
|
+
else
|
241
|
+
skip 'GDALSetRasterUnitType not supported'
|
242
|
+
end
|
242
243
|
end
|
243
244
|
end
|
244
245
|
|
245
246
|
describe '#default_histogram' do
|
246
247
|
let!(:histogram) { subject.default_histogram }
|
247
248
|
|
248
|
-
it 'returns a Hash with :
|
249
|
+
it 'returns a Hash with :minimum, :maximum, :buckets, and :totals' do
|
249
250
|
if histogram
|
250
251
|
expect(histogram).to be_a Hash
|
251
252
|
expect(histogram.keys).to eq %i[minimum maximum buckets totals]
|
252
253
|
end
|
253
254
|
end
|
254
255
|
|
255
|
-
it 'has :
|
256
|
+
it 'has :minimum as a Float' do
|
256
257
|
expect(histogram[:minimum]).to be_a Float if histogram
|
257
258
|
end
|
258
259
|
|
@@ -264,11 +265,11 @@ TIF_FILES.each do |file|
|
|
264
265
|
expect(histogram[:buckets]).to be_a Fixnum if histogram
|
265
266
|
end
|
266
267
|
|
267
|
-
it 'has :totals as an Array of 256 Fixnums' do
|
268
|
+
it 'has :totals as an Array of 0 or 256 Fixnums' do
|
268
269
|
if histogram
|
269
270
|
expect(histogram[:totals]).to be_an Array
|
270
|
-
expect(histogram[:totals].size).to eq
|
271
|
-
expect(histogram[:totals].all? { |t| t.class == Fixnum}).to eq true
|
271
|
+
expect(histogram[:totals].size).to eq(256).or eq(0)
|
272
|
+
expect(histogram[:totals].all? { |t| t.class == Fixnum }).to eq true
|
272
273
|
end
|
273
274
|
end
|
274
275
|
end
|
@@ -277,33 +278,20 @@ TIF_FILES.each do |file|
|
|
277
278
|
it 'returns a GDAL::RasterAttributeTable' do
|
278
279
|
rat = subject.default_raster_attribute_table
|
279
280
|
|
280
|
-
if rat
|
281
|
-
expect(rat).to be_a GDAL::RasterAttributeTable
|
282
|
-
end
|
281
|
+
expect(rat).to be_a GDAL::RasterAttributeTable if rat
|
283
282
|
end
|
284
283
|
end
|
285
284
|
|
286
|
-
describe '#
|
287
|
-
it 'returns a
|
288
|
-
expect(subject.
|
289
|
-
expect(subject.
|
290
|
-
expect(subject.
|
291
|
-
expect(subject.
|
285
|
+
describe '#min_max' do
|
286
|
+
it 'returns a Hash with :min and :max keys' do
|
287
|
+
expect(subject.min_max).to be_a Hash
|
288
|
+
expect(subject.min_max.size).to eq 2
|
289
|
+
expect(subject.min_max[:min]).to be_a Float
|
290
|
+
expect(subject.min_max[:max]).to be_a Float
|
292
291
|
end
|
293
292
|
|
294
293
|
it 'has a min that is < its max' do
|
295
|
-
min
|
296
|
-
expect(min).to be < max
|
297
|
-
end
|
298
|
-
|
299
|
-
it 'has a min that == statistics[:minimum]' do
|
300
|
-
min, _ = subject.compute_min_max
|
301
|
-
expect(min).to eq subject.statistics[:minimum]
|
302
|
-
end
|
303
|
-
|
304
|
-
it 'has a min that == minimum_value[:value]' do
|
305
|
-
min, _ = subject.compute_min_max
|
306
|
-
expect(min).to eq subject.minimum_value[:value]
|
294
|
+
expect(subject.min_max[:min]).to be < subject.min_max[:max]
|
307
295
|
end
|
308
296
|
end
|
309
297
|
|
@@ -318,7 +306,7 @@ TIF_FILES.each do |file|
|
|
318
306
|
end
|
319
307
|
|
320
308
|
it 'has a :is_tight that is nil (since the examples are geotiffs)' do
|
321
|
-
#expect(subject.minimum_value[:is_tight]).to eq nil
|
309
|
+
# expect(subject.minimum_value[:is_tight]).to eq nil
|
322
310
|
end
|
323
311
|
end
|
324
312
|
|
@@ -333,7 +321,7 @@ TIF_FILES.each do |file|
|
|
333
321
|
end
|
334
322
|
|
335
323
|
it 'has a :is_tight that is nil (since the examples are geotiffs)' do
|
336
|
-
#expect(subject.maximum_value[:is_tight]).to eq nil
|
324
|
+
# expect(subject.maximum_value[:is_tight]).to eq nil
|
337
325
|
end
|
338
326
|
end
|
339
327
|
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe OGR::Layer do
|
4
|
+
let(:data_source) do
|
5
|
+
OGR::DataSource.open('spec/support/shapefiles/states_21basic/states.shp', 'r')
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:layer0) do
|
9
|
+
data_source.layer(0)
|
10
|
+
end
|
11
|
+
|
12
|
+
subject do
|
13
|
+
layer0
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#name' do
|
17
|
+
subject { layer0.name }
|
18
|
+
it { is_expected.to eq 'states' }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#geometry_type' do
|
22
|
+
subject { layer0.geometry_type }
|
23
|
+
it { is_expected.to eq :wkbPolygon }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#feature_count' do
|
27
|
+
subject { layer0.feature_count }
|
28
|
+
it { is_expected.to eq 51 }
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#feature' do
|
32
|
+
subject { layer0.feature(0) }
|
33
|
+
it { is_expected.to be_a OGR::Feature }
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#next_feature' do
|
37
|
+
subject { layer0.next_feature }
|
38
|
+
it { is_expected.to be_a OGR::Feature }
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#features_read' do
|
42
|
+
subject { layer0.features_read }
|
43
|
+
it { is_expected.to be >= 0 }
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#features' do
|
47
|
+
subject { layer0.features }
|
48
|
+
it { is_expected.to be_an Array }
|
49
|
+
specify { expect(subject.first).to be_a OGR::Feature }
|
50
|
+
specify { expect(subject.size).to eq layer0.feature_count }
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#feature_definition' do
|
54
|
+
subject { layer0.feature_definition }
|
55
|
+
it { is_expected.to be_a OGR::FeatureDefinition }
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#spatial_reference' do
|
59
|
+
subject { layer0.spatial_reference }
|
60
|
+
it { is_expected.to be_a OGR::SpatialReference }
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#extent' do
|
64
|
+
subject { layer0.extent }
|
65
|
+
it { is_expected.to be_a OGR::Envelope }
|
66
|
+
end
|
67
|
+
|
68
|
+
describe '#fid_column' do
|
69
|
+
subject { layer0.fid_column }
|
70
|
+
it { is_expected.to be_a String }
|
71
|
+
it { is_expected.to be_empty }
|
72
|
+
end
|
73
|
+
|
74
|
+
describe '#geometry_column' do
|
75
|
+
subject { layer0.geometry_column }
|
76
|
+
it { is_expected.to be_a String }
|
77
|
+
it { is_expected.to be_empty }
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '#style_table' do
|
81
|
+
subject { layer0.style_table }
|
82
|
+
it { is_expected.to be_nil }
|
83
|
+
end
|
84
|
+
|
85
|
+
describe '#geometry_from_extent' do
|
86
|
+
it 'is a Polygon' do
|
87
|
+
geometry = subject.geometry_from_extent
|
88
|
+
expect(geometry).to be_a OGR::Polygon
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe '#as_json' do
|
93
|
+
specify do
|
94
|
+
expect { subject.as_json }.to_not raise_exception
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,16 +1,105 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
add_filter '/spec/'
|
4
|
+
add_group 'GDAL', 'lib/gdal'
|
5
|
+
add_group 'OGR', 'lib/ogr'
|
6
|
+
add_group 'FFI', 'lib/ffi'
|
7
|
+
add_group 'ext', 'lib/ext'
|
8
|
+
end
|
9
|
+
|
10
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
3
11
|
require 'ffi-gdal'
|
4
12
|
|
5
|
-
|
13
|
+
require './spec/support/shared_contexts'
|
14
|
+
Dir['./spec/support/shared_examples/**/*.rb'].sort.each { |f| require f }
|
6
15
|
|
16
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
17
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
18
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
19
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
20
|
+
#
|
21
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
22
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
23
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
24
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
25
|
+
# a separate helper file that requires the additional dependencies and performs
|
26
|
+
# the additional setup, and require it from the spec files that actually need it.
|
27
|
+
#
|
28
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
29
|
+
# users commonly want.
|
30
|
+
#
|
31
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
32
|
RSpec.configure do |config|
|
33
|
+
# rspec-expectations config goes here. You can use an alternate
|
34
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
35
|
+
# assertions if you prefer.
|
36
|
+
config.expect_with :rspec do |expectations|
|
37
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
38
|
+
# and `failure_message` of custom matchers include text for helper methods
|
39
|
+
# defined using `chain`, e.g.:
|
40
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
41
|
+
# # => "be bigger than 2 and smaller than 4"
|
42
|
+
# ...rather than:
|
43
|
+
# # => "be bigger than 2"
|
44
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
45
|
+
end
|
46
|
+
|
47
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
48
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
49
|
+
config.mock_with :rspec do |mocks|
|
50
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
51
|
+
# a real object. This is generally recommended, and will default to
|
52
|
+
# `true` in RSpec 4.
|
53
|
+
mocks.verify_partial_doubles = true
|
54
|
+
end
|
55
|
+
|
56
|
+
# The settings below are suggested to provide a good initial experience
|
57
|
+
# with RSpec, but feel free to customize to your heart's content.
|
58
|
+
|
59
|
+
# These two settings work together to allow you to limit a spec run
|
60
|
+
# to individual examples or groups you care about by tagging them with
|
61
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
62
|
+
# get run.
|
63
|
+
config.filter_run :focus
|
64
|
+
config.run_all_when_everything_filtered = true
|
65
|
+
|
66
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
67
|
+
# For more details, see:
|
68
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
69
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
70
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
71
|
+
config.disable_monkey_patching!
|
72
|
+
|
73
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
74
|
+
# be too noisy due to issues in dependencies.
|
75
|
+
config.warnings = true
|
76
|
+
|
77
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
78
|
+
# file, and it's useful to allow more verbose output when running an
|
79
|
+
# individual spec file.
|
80
|
+
if config.files_to_run.one?
|
81
|
+
# Use the documentation formatter for detailed output,
|
82
|
+
# unless a formatter has already been configured
|
83
|
+
# (e.g. via a command-line flag).
|
84
|
+
# config.default_formatter = 'doc'
|
85
|
+
end
|
86
|
+
|
87
|
+
# Print the 10 slowest examples and example groups at the
|
88
|
+
# end of the spec run, to help surface which specs are running
|
89
|
+
# particularly slow.
|
90
|
+
config.profile_examples = 3
|
8
91
|
|
9
92
|
# Run specs in random order to surface order dependencies. If you find an
|
10
93
|
# order dependency and want to debug it, you can fix the order by providing
|
11
94
|
# the seed, which is printed after each run.
|
12
95
|
# --seed 1234
|
13
|
-
config.order =
|
96
|
+
config.order = :random
|
97
|
+
|
98
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
99
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
100
|
+
# test failures related to randomization by passing the same `--seed` value
|
101
|
+
# as the one that triggered the failure.
|
102
|
+
Kernel.srand config.seed
|
14
103
|
end
|
15
104
|
|
16
|
-
|
105
|
+
GDAL::Logger.logging_enabled = true
|
@@ -0,0 +1,26 @@
|
|
1
|
+
RSpec.shared_context 'OGR::Layer, spatial_reference' do
|
2
|
+
require 'ogr/driver'
|
3
|
+
require 'ogr/spatial_reference'
|
4
|
+
|
5
|
+
let(:driver) { OGR::Driver.by_name 'Memory' }
|
6
|
+
let(:data_source) { driver.create_data_source 'spec data source' }
|
7
|
+
|
8
|
+
subject(:layer) do
|
9
|
+
data_source.create_layer 'spec layer',
|
10
|
+
geometry_type: :wkbMultiPoint,
|
11
|
+
spatial_reference: OGR::SpatialReference.new_from_epsg(4326)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
RSpec.shared_context 'OGR::Layer, no spatial_reference' do
|
16
|
+
require 'ogr/driver'
|
17
|
+
require 'ogr/spatial_reference'
|
18
|
+
|
19
|
+
let(:driver) { OGR::Driver.by_name 'Memory' }
|
20
|
+
let(:data_source) { driver.create_data_source 'spec data source' }
|
21
|
+
|
22
|
+
subject(:layer) do
|
23
|
+
data_source.create_layer 'spec layer',
|
24
|
+
geometry_type: :wkbMultiPoint
|
25
|
+
end
|
26
|
+
end
|
data/spec/support/shared_examples/{major_object_examples.rb → gdal/major_object_examples.rb}
RENAMED
@@ -9,10 +9,10 @@ RSpec.shared_examples 'a major object' do
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe '#
|
12
|
+
describe '#metadata' do
|
13
13
|
context 'default domain' do
|
14
14
|
it 'is a Hash' do
|
15
|
-
expect(subject.
|
15
|
+
expect(subject.metadata).to be_a Hash
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -21,8 +21,8 @@ RSpec.shared_examples 'a major object' do
|
|
21
21
|
context 'default domain' do
|
22
22
|
context 'first item in metadata list' do
|
23
23
|
it 'is a String' do
|
24
|
-
unless subject.
|
25
|
-
key = subject.
|
24
|
+
unless subject.metadata.empty?
|
25
|
+
key = subject.metadata.keys.first
|
26
26
|
|
27
27
|
expect(subject.metadata_item(key)).to be_a String
|
28
28
|
end
|
@@ -37,7 +37,7 @@ RSpec.shared_examples 'a major object' do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'has a DEFAULT key' do
|
40
|
-
expect(subject.all_metadata[:DEFAULT]).to eq subject.
|
40
|
+
expect(subject.all_metadata[:DEFAULT]).to eq subject.metadata
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Requirements:
|
2
|
+
# * :child_geometry - one that the described class can
|
3
|
+
RSpec.shared_examples 'a container geometry' do
|
4
|
+
describe '#collection?' do
|
5
|
+
it 'returns true' do
|
6
|
+
expect(subject.collection?).to eq true
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#add_geometry' do
|
11
|
+
it 'adds the geometry to the container' do
|
12
|
+
skip
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#add_directly' do
|
17
|
+
it 'adds the geometry to the container' do
|
18
|
+
skip
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#remove_geometry' do
|
23
|
+
it 'removes the geometry to the container' do
|
24
|
+
skip
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#geometry_at' do
|
29
|
+
context 'geometry exists at the index' do
|
30
|
+
subject do
|
31
|
+
gc = described_class.new
|
32
|
+
gc.add_geometry(child_geometry)
|
33
|
+
gc
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'returns the geometry' do
|
37
|
+
expect(subject.geometry_at(0)).to be_a(child_geometry.class)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'no geometries' do
|
42
|
+
it 'returns nil' do
|
43
|
+
expect(subject.geometry_at(0)).to be_nil
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|