Skip to content

Commit e88fefd

Browse files
committed
enhance bounds
1 parent 8d682a2 commit e88fefd

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

lib/geoscript/geom/bounds.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,24 @@ def get_projection
6161
GeoScript::Projection.new crs if crs
6262
end
6363

64-
def self.scale(bounds, factor)
64+
def get_aspect
65+
self.width / self.height
66+
end
67+
68+
def scale(factor)
6569
width = self.width * (factor - 1) / 2
6670
height = self.height * (factor - 1) / 2
6771

6872
Bounds.new self.west - width, self.south - height, self.east + width, self.north + height
6973
end
7074

71-
def expand(other_bounds);end
75+
def expand(other)
76+
self.expand_to_include(other)
77+
end
7278

7379
def to_polygon;end
7480

7581
def tile(resolution);end
7682
end
7783
end
78-
end
84+
end

lib/geoscript/geom/polygon.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def initialize(*rings)
2525
linear_rings << LinearRing.new(*ring)
2626
end
2727
end
28-
28+
2929
shell = linear_rings.first
3030
holes = linear_rings[1..linear_rings.size].to_java(com.vividsolutions.jts.geom.LinearRing)
3131
end
@@ -47,6 +47,10 @@ def to_wkb
4747
def to_json
4848
GeoScript::IO::Geom.write_json self
4949
end
50+
51+
def bounds
52+
Bounds.new self.get_envelope_internal
53+
end
5054
end
5155
end
52-
end
56+
end

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<version>0.0.1-SNAPSHOT</version>
88

99
<properties>
10-
<gt.version>8.3</gt.version>
10+
<gt.version>8.6</gt.version>
1111
</properties>
1212

1313
<repositories>
@@ -100,4 +100,4 @@
100100
</plugins>
101101
</build>
102102

103-
</project>
103+
</project>

0 commit comments

Comments
 (0)