Module: Adiwg_Polygon
- Defined in:
- lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_polygon.rb
Class Method Summary collapse
Class Method Details
.splitPolygons(aPolySet) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_polygon.rb', line 35 def self.splitPolygons(aPolySet) intMetadataClass = InternalMetadata.new intPolygonSet = intMetadataClass.newPolygonSet # first polygon in set is a bounding exterior ring # all subsequent polygons are exclusion rings i = 0 aPolySet.each do |aPolygon| i += 1 if i == 1 intPolygonSet[:exteriorRing] = aPolygon else intPolygonSet[:exclusionRings] << aPolygon end end return intPolygonSet end |
.unpack(aCoords, geoType) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_polygon.rb', line 15 def self.unpack(aCoords, geoType) intMetadataClass = InternalMetadata.new intGeometry = intMetadataClass.newGeometry intGeometry[:geoType] = geoType # polygon - coordinate(s) if geoType == 'Polygon' intGeometry[:geometry] = splitPolygons(aCoords) intGeometry[:dimension] = Adiwg_Coordinates.getDimension(intGeometry[:geometry][:exteriorRing]) elsif geoType == 'MultiPolygon' aPolySets = Array.new aCoords.each do |aPolygonSet| aPolySets << splitPolygons(aPolygonSet) end intGeometry[:geometry] = aPolySets end return intGeometry end |