class ADIWG::Mdtranslator::Writers::Iso19115_2::LineString
Public Class Methods
new(xml, hResponseObj)
click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineString.rb, line 25 def initialize(xml, hResponseObj) @xml = xml @hResponseObj = hResponseObj end
Public Instance Methods
writeXML(hGeoObject, hProperties, lineId)
click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineString.rb, line 30 def writeXML(hGeoObject, hProperties, lineId) # classes used geoPropClass = FeatureProperties.new(@xml, @hResponseObj) # LineString attributes attributes = {} # LineString attributes - gml:id (required) if lineId.nil? @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ lineId = 'line' + @hResponseObj[:writerMissingIdCount] else lineId.gsub!(/[^0-9a-zA-Z]/, '') end attributes['gml:id'] = lineId # LineString attributes - srsDimension s = AdiwgCoordinates.getDimension(hGeoObject[:coordinates]) if !s.nil? attributes[:srsDimension] = s end # LineString attributes - srsName (GeoJSON is WGS84) attributes[:srsName] = 'WGS84' @xml.tag!('gml:LineString', attributes) do # lineString - properties for Feature unless hProperties.empty? geoPropClass.writeXML(hProperties) end if hProperties.empty? && @hResponseObj[:writerShowTags] @xml.tag!('gml:description') @xml.tag!('gml:identifier', {'codeSpace' => ''}) @xml.tag!('gml:name') end # lineString - pos (required) unless hGeoObject[:coordinates].empty? aCoords = hGeoObject[:coordinates] aCoords.each do |aCoord| s = aCoord[0].to_s + ' ' + aCoord[1].to_s @xml.tag!('gml:pos', s) end end end # gml:LineString end