Sha256: 952186d2c19816280faaf70dfb271537252c8328dcb5af8bd349edd1c41d09a3
Contents?: true
Size: 1.99 KB
Versions: 7
Compression:
Stored size: 1.99 KB
Contents
# ISO <<Class>> EX_BoundingPolygon # writer output in XML # History: # Stan Smith 2013-11-01 original script # Stan Smith 2013-11-12 added multi geometry # Stan Smith 2013-11-13 added line string # Stan Smith 2013-11-18 added polygon # Stan Smith 2014-05-30 modified for version 0.5.0 # Stan Smith 2014-05-30 added multi-point, multi-linestring, multi-polygon support # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure require 'class_point' require 'class_lineString' require 'class_multiGeometry' require 'class_polygon' class EX_BoundingPolygon def initialize(xml) @xml = xml end def writeXML(hGeoElement) # classes used by MD_Metadata pointClass = Point.new(@xml) lineClass = LineString.new(@xml) multiGeoClass = MultiGeometry.new(@xml) polygonClass = Polygon.new(@xml) hGeometry = hGeoElement[:elementGeometry] polyType = hGeometry[:geoType] @xml.tag!('gmd:EX_BoundingPolygon') do # bounding polygon - extent type - required extentType = hGeoElement[:elementIncludeData] if extentType.nil? @xml.tag!('gmd:extentTypeCode',{'gco:nilReason'=>'missing'}) elsif extentType == true || extentType == false @xml.tag!('gmd:extentTypeCode') do @xml.tag!('gco:Boolean',extentType) end else @xml.tag!('gmd:extentTypeCode',{'gco:nilReason'=>extentType}) end # bounding polygon - polygon - required if hGeometry[:geometry].empty? @xml.tag!('gmd:polygon', {'gco:nilReason' => 'missing'}) else @xml.tag!('gmd:polygon') do case polyType when 'Point' pointClass.writeXML(hGeoElement) when 'LineString' lineClass.writeXML(hGeoElement) when 'Polygon' polygonClass.writeXML(hGeoElement) when 'MultiPoint', 'MultiLineString', 'MultiPolygon', 'MultiGeometry' multiGeoClass.writeXML(hGeoElement) when 'MultiGeometry' multiGeoClass.writeXML(hGeoElement) else # log - the bounding polygon type is not supported end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems