module ADIWG::Mdtranslator::Readers::MdJson::SpatialRepresentation
Public Class Methods
unpack(hRepresent, responseObj, inContext = nil)
click to toggle source
# File lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialRepresentation.rb, line 20 def self.unpack(hRepresent, responseObj, inContext = nil) @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson # return nil object if input is empty if hRepresent.empty? @MessagePath.issueWarning(790, responseObj, inContext) return nil end # instance classes needed in script intMetadataClass = InternalMetadata.new intRepresent = intMetadataClass.newSpatialRepresentation outContext = 'spatial representation' outContext = inContext + ' > ' + outContext unless inContext.nil? haveOne = false # spatial representation - grid representation (required if not others) if hRepresent.has_key?('gridRepresentation') hRep = hRepresent['gridRepresentation'] unless hRep.empty? hObject = GridRepresentation.unpack(hRep, responseObj, outContext) unless hObject.nil? intRepresent[:gridRepresentation] = hObject haveOne = true end end end # spatial representation - vector representation (required if not others) if hRepresent.has_key?('vectorRepresentation') hRep = hRepresent['vectorRepresentation'] unless hRep.empty? hObject = VectorRepresentation.unpack(hRep, responseObj, outContext) unless hObject.nil? intRepresent[:vectorRepresentation] = hObject haveOne = true end end end # spatial representation - georectified representation (required if not others) if hRepresent.has_key?('georectifiedRepresentation') hRep = hRepresent['georectifiedRepresentation'] unless hRep.empty? hObject = GeorectifiedRepresentation.unpack(hRep, responseObj, outContext) unless hObject.nil? intRepresent[:georectifiedRepresentation] = hObject haveOne = true end end end # spatial representation - georeferenceable representation (required if not others) if hRepresent.has_key?('georeferenceableRepresentation') hRep = hRepresent['georeferenceableRepresentation'] unless hRep.empty? hObject = GeoreferenceableRepresentation.unpack(hRep, responseObj, outContext) unless hObject.nil? intRepresent[:georeferenceableRepresentation] = hObject haveOne = true end end end # error messages unless haveOne @MessagePath.issueError(791, responseObj, inContext) end return intRepresent end