Sha256: efd8e4870b604b1db88c2bcdcd5643a1fd7f5efed20ec2bcb8cde98f2b42af57

Contents?: true

Size: 1.32 KB

Versions: 9

Compression:

Stored size: 1.32 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Envelope do
  before(:each) do
    @env = Envelope.from_points([Point.from_x_y(10,20),Point.from_x_y(20,30)])
  end

  it "should initialize" do
    @env.should be_instance_of(Envelope)
  end

  it "converted tu" do
    linear_ring = LinearRing.from_coordinates([[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],256)
    polygon = Polygon.from_linear_rings([linear_ring],256)
    e = polygon.envelope

    e.lower_corner.class.should eql(Point)
    e.upper_corner.class.should eql(Point)

    e.lower_corner.x.should eql(4.456)
    e.lower_corner.y.should eql(-45.3)
    e.upper_corner.x.should eql(45.4)
    e.upper_corner.y.should eql(41.6)

    line_string = LineString.from_coordinates([[13.6,-49.3],[45.4,44.6],[14.2,1.09],[13.6,-49.3]],256)
    e2 = line_string.envelope

    e3 = e.extend(e2)

    e3.lower_corner.x.should eql(4.456)
    e3.lower_corner.y.should eql(-49.3)
    e3.upper_corner.x.should eql(45.4)
    e3.upper_corner.y.should eql(44.6)
  end

  it "should have a center" do
    @env.center.x.should eql(15)
    @env.center.y.should eql(25)
  end

  it "should print a kml_representation" do
    @env.as_kml.should eql("<LatLonAltBox>\n<north>30</north>\n<south>20</south>\n<east>20</east>\n<west>10</west>\n</LatLonAltBox>\n")
  end

end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
nofxx-georuby-1.3.7 spec/geo_ruby/base/envelope_spec.rb
nofxx-georuby-1.3.9 spec/geo_ruby/simple_features/envelope_spec.rb
nofxx-georuby-1.6.0 spec/geo_ruby/simple_features/envelope_spec.rb
nofxx-georuby-1.6.1 spec/geo_ruby/simple_features/envelope_spec.rb
nofxx-georuby-1.6.2 spec/geo_ruby/simple_features/envelope_spec.rb
nofxx-georuby-1.7.3 spec/geo_ruby/simple_features/envelope_spec.rb
georuby_remake-1.0.0 spec/geo_ruby/simple_features/envelope_spec.rb
ppe-georuby-1.7.2 spec/geo_ruby/simple_features/envelope_spec.rb
nofxx-georuby-1.7.1 spec/geo_ruby/simple_features/envelope_spec.rb