Sha256: f55b0fd54b122f3ea966bf89dd8d76f5875bbfeecbef4e7c4a6a4bc7fed094c2

Contents?: true

Size: 1.9 KB

Versions: 36

Compression:

Stored size: 1.9 KB

Contents

# ISO <<Class>> Measure
# 19115-2 writer output in XML

# History:
#  Stan Smith 2018-04-19 add error and warning messaging
#  Stan Smith 2016-11-22 original script.

require_relative '../iso19115_2_writer'

module ADIWG
   module Mdtranslator
      module Writers
         module Iso19115_2

            class Measure

               def initialize(xml, hResponseObj)
                  @xml = xml
                  @hResponseObj = hResponseObj
                  @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
               end

               def writeXML(hMeasure, inContext = nil)

                  # measure
                  type = hMeasure[:type]
                  value = hMeasure[:value]
                  uom = hMeasure[:unitOfMeasure]

                  # ISO 19115-2 will not accept spaces in uom
                  uom.gsub!(/\s+/, '')

                  haveType = false
                  if type == 'distance'
                     @xml.tag!('gco:Distance', {'uom' => uom}, value)
                     haveType = true
                  end
                  if type == 'length'
                     @xml.tag!('gco:Length', {'uom' => uom}, value)
                     haveType = true
                  end
                  if type == 'angle'
                     @xml.tag!('gco:Angle', {'uom' => uom}, value)
                     haveType = true
                  end
                  if type == 'measure'
                     @xml.tag!('gco:Measure', {'uom' => uom}, value)
                     haveType = true
                  end
                  if type == 'scale'
                     @xml.tag!('gco:Scale', {'uom' => uom}, value)
                     haveType = true
                  end

                  unless haveType
                     @NameSpace.issueWarning(360, nil, inContext)
                  end

               end # write XML
            end # CI_Telephone class

         end
      end
   end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.19.0.pre.beta.31 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.19.0.pre.beta.30 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.19.0.pre.beta.29 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.19.0.pre.beta.28 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.19.0.pre.beta.27 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.19.0.pre.beta.26 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.19.0.pre.beta.13 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.19.0.pre.beta.12 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.19.0.pre.beta.11 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.19.0.pre.beta.10 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.19.0.pre.beta.9 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.19.0.pre.beta.8 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.19.0.pre.beta.7 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.18.4 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.18.2 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.18.1 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.18.0 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.18.0rc9 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.18.0rc8 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb
adiwg-mdtranslator-2.18.0rc7 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb