Sha256: 057db157f56274871746d76858f579c70e113b82bc9f0969a287cfa079eadafb

Contents?: true

Size: 1.59 KB

Versions: 6

Compression:

Stored size: 1.59 KB

Contents

# ISO <<Class>> Point
# writer output in XML

# History:
# 	Stan Smith 2013-11-01 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

require ADIWG::Mdtranslator.reader_module('module_coordinates', $response[:readerVersionUsed])

class Point

	def initialize(xml)
		@xml = xml
	end

	def writeXML(hGeoElement)

		# gml:Point attributes
		attributes = {}

		# gml:Point attributes - gml:id - required
		pointID = hGeoElement[:elementId]
		if pointID.nil?
			$idCount = $idCount.succ
			pointID = 'point' + $idCount
		end
		attributes['gml:id'] = pointID

		# gml:Point attributes - srsDimension
		s = hGeoElement[:elementGeometry][:dimension]
		if !s.nil?
			attributes[:srsDimension] = s
		end

		# gml:Point attributes - srsName
		s = hGeoElement[:elementSrs][:srsName]
		if !s.nil?
			attributes[:srsName] = s
		end

		@xml.tag!('gml:Point',attributes) do

			# point - description
			s = hGeoElement[:elementDescription]
			if !s.nil?
				@xml.tag!('gml:description',s)
			elsif $showAllTags
				@xml.tag!('gml:description')
			end

			# point - name
			s = hGeoElement[:elementName]
			if !s.nil?
				@xml.tag!('gml:name',s)
			elsif $showAllTags
				@xml.tag!('gml:name')
			end

			# point - coordinates - required
			# gml does not support nilReason for coordinates
			# convert coordinate string from geoJSON to gml
			s = hGeoElement[:elementGeometry][:geometry]
			if !s.nil?
				s = Adiwg_Coordinates.unpack(s)
				@xml.tag!('gml:coordinates',s)
			else
				@xml.tag!('gml:coordinates')
			end
		end

	end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adiwg-mdtranslator-0.9.0 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_point.rb
adiwg-mdtranslator-0.8.6 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_point.rb
adiwg-mdtranslator-0.8.5 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_point.rb
adiwg-mdtranslator-0.8.2 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_point.rb
adiwg-mdtranslator-0.8.1 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_point.rb
adiwg-mdtranslator-0.8.0 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_point.rb