File tree Expand file tree Collapse file tree 1 file changed +16
-14
lines changed
Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Original file line number Diff line number Diff line change 11module GeoScript
22 module Geom
33 JTSMultiPolygon = com . vividsolutions . jts . geom . MultiPolygon
4+ JTSPolygon = com . vividsolutions . jts . geom . Polygon unless defined? ( JTSPolygon )
45
56 class MultiPolygon < JTSMultiPolygon
67 include GeoScript ::Geom
78
89 attr_accessor :bounds
910
1011 def initialize ( *polygons )
11- polys = [ ]
12-
13- if polygons . first . kind_of? JTSMultiPolygon
14- multi_polygon = polygons . first
15- for i in range ( 0 ...multi_polygon . num_geometries )
16- polys << multi_polygon . get_geometry_n ( i )
17- end
18- else
19- polygons . each do |polygon |
20- if polygon . kind_of? Java ::ComVividsolutionsJtsGeom ::Polygon
21- polys << polygon
22- else
23- polys << Polygon . new ( *polygon )
12+ polys =
13+ if polygons . first . kind_of? JTSMultiPolygon
14+ mp = polygons . first
15+
16+ [ ] . tap do |p |
17+ for i in 0 ...mp . num_geometries
18+ p << mp . geometry_n ( i )
19+ end
20+ end
21+ else
22+ [ ] . tap do |p |
23+ polygons . each do |polygon |
24+ p << ( polygon . kind_of? ( JTSPolygon ) ? polygon : Polygon . new ( *polygon ) )
25+ end
2426 end
2527 end
26- end
28+
2729 super ( polys . to_java ( com . vividsolutions . jts . geom . Polygon ) , GEOM_FACTORY )
2830 end
2931
You can’t perform that action at this time.
0 commit comments