Sha256: 8654578f424716505d65b56b947efb537531e3b71ed66209ca681ad722323b31

Contents?: true

Size: 952 Bytes

Versions: 4

Compression:

Stored size: 952 Bytes

Contents

require 'spec_helper'
require 'ogr/geometry'

RSpec.describe OGR::MultiPolygon do
  it_behaves_like 'a geometry' do
    let(:geometry) { described_class.new }
  end

  it_behaves_like 'a container geometry' do
    let(:child_geometry) { OGR::Polygon.new }
  end

  describe '#to_polygon' do
    subject { OGR::Geometry.create_from_wkt(wkt) }

    let(:wkt) do
      'MULTIPOLYGON(((0 0,0 1,1 1,0 0)),((0 0,1 1,1 0,0 0)))'
    end

    it 'returns a Polygon' do
      expect(subject.to_polygon).to be_a OGR::Polygon
    end
  end

  describe '#union_cascaded' do
    subject { OGR::Geometry.create_from_wkt(wkt) }

    let(:wkt) do
      'MULTIPOLYGON(((0 0,0 1,1 1,0 0)),((0 0,1 1,1 0,0 0)))'
    end

    it 'returns a Geometry' do
      expect(subject.union_cascaded).to be_a OGR::Polygon
    end

    it 'does a union on the geometry' do
      expect(subject.union_cascaded.to_wkt).
        to eq 'POLYGON ((0 0,0 1,1 1,1 0,0 0))'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta7 spec/unit/ogr/geometries/multi_polygon_spec.rb
ffi-gdal-1.0.0.beta6 spec/unit/ogr/geometries/multi_polygon_spec.rb
ffi-gdal-1.0.0.beta5 spec/unit/ogr/geometries/multi_polygon_spec.rb
ffi-gdal-1.0.0.beta4 spec/unit/ogr/geometries/multi_polygon_spec.rb