lib/adiwg/mdtranslator/writers/iso/classes/class_lineString.rb in adiwg-mdtranslator-0.10.2 vs lib/adiwg/mdtranslator/writers/iso/classes/class_lineString.rb in adiwg-mdtranslator-0.12.0

- old
+ new

@@ -3,72 +3,83 @@ # History: # Stan Smith 2013-11-13 original script # Stan Smith 2014-05-30 modified for version 0.5.0 # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure +# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers -require ADIWG::Mdtranslator.reader_module('module_coordinates', $response[:readerVersionUsed]) +require $ReaderNS.readerModule('module_coordinates') -class LineString +module ADIWG + module Mdtranslator + module Writers + module Iso - def initialize(xml) - @xml = xml - end + class LineString - def writeXML(hGeoElement) + def initialize(xml) + @xml = xml + end - # gml:LineString attributes - attributes = {} + def writeXML(hGeoElement) - # gml:LineString attributes - gml:id - required - lineID = hGeoElement[:elementId] - if lineID.nil? - $idCount = $idCount.succ - lineID = 'line' + $idCount - end - attributes['gml:id'] = lineID + # gml:LineString attributes + attributes = {} - # gml:LineString attributes - srsDimension - s = hGeoElement[:elementGeometry][:dimension] - if !s.nil? - attributes[:srsDimension] = s - end + # gml:LineString attributes - gml:id - required + lineID = hGeoElement[:elementId] + if lineID.nil? + $idCount = $idCount.succ + lineID = 'line' + $idCount + end + attributes['gml:id'] = lineID - # gml:LineString attributes - srsName - s = hGeoElement[:elementSrs][:srsName] - if !s.nil? - attributes[:srsName] = s - end + # gml:LineString attributes - srsDimension + s = hGeoElement[:elementGeometry][:dimension] + if !s.nil? + attributes[:srsDimension] = s + end - @xml.tag!('gml:LineString',attributes) do + # gml:LineString attributes - srsName + s = hGeoElement[:elementSrs][:srsName] + if !s.nil? + attributes[:srsName] = s + end - # lineString - description - s = hGeoElement[:elementDescription] - if !s.nil? - @xml.tag!('gml:description',s) - elsif $showAllTags - @xml.tag!('gml:description') - end + @xml.tag!('gml:LineString', attributes) do - # lineString - name - s = hGeoElement[:elementName] - if !s.nil? - @xml.tag!('gml:name',s) - elsif $showAllTags - @xml.tag!('gml:name') - end + # lineString - description + s = hGeoElement[:elementDescription] + if !s.nil? + @xml.tag!('gml:description', s) + elsif $showAllTags + @xml.tag!('gml:description') + end - # lineString - coordinates - required - # gml does not support nilReason for coordinates - # convert coordinate string from geoJSON to gml - s = hGeoElement[:elementGeometry][:geometry] - if !s.nil? - s = Md_Coordinates.unpack(s) - @xml.tag!('gml:coordinates',s) - else - @xml.tag!('gml:coordinates') - end - end + # lineString - name + s = hGeoElement[:elementName] + if !s.nil? + @xml.tag!('gml:name', s) + elsif $showAllTags + @xml.tag!('gml:name') + end - end + # lineString - coordinates - required + # gml does not support nilReason for coordinates + # convert coordinate string from geoJSON to gml + s = hGeoElement[:elementGeometry][:geometry] + if !s.nil? + s = $ReaderNS::Coordinates.unpack(s) + @xml.tag!('gml:coordinates', s) + else + @xml.tag!('gml:coordinates') + end + end -end \ No newline at end of file + end + + end + + end + end + end +end