lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb in adiwg-mdtranslator-2.9.2 vs lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb in adiwg-mdtranslator-2.10.0
- old
+ new
@@ -1,9 +1,10 @@
# unpack bounding box
# Reader - ADIwg JSON to internal data structure
# History:
+# Stan Smith 2018-02-18 refactored error and warning messaging
# Stan Smith 2017-09-28 add altitude to support fgdc
# Stan Smith 2016-12-01 original script
module ADIWG
module Mdtranslator
@@ -14,12 +15,11 @@
def self.unpack(hBBox, responseObj)
# return nil object if input is empty
if hBBox.empty?
- responseObj[:readerExecutionMessages] << 'boundingBox object is empty'
- responseObj[:readerExecutionPass] = false
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: bounding box object is empty'
return nil
end
# instance classes needed in script
intMetadataClass = InternalMetadata.new
@@ -28,61 +28,61 @@
# bounding box - west longitude (required)
if hBBox.has_key?('westLongitude')
intBBox[:westLongitude] = hBBox['westLongitude']
end
if intBBox[:westLongitude].nil? || intBBox[:westLongitude] == ''
- responseObj[:readerExecutionMessages] << 'boundingBox west boundary is missing'
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box west boundary is missing'
responseObj[:readerExecutionPass] = false
return nil
end
if intBBox[:westLongitude].abs > 180
- responseObj[:readerExecutionMessages] << 'boundingBox longitude must be between -180 and +180'
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box longitude must be between -180 and +180'
responseObj[:readerExecutionPass] = false
return nil
end
# bounding box - east longitude (required)
if hBBox.has_key?('eastLongitude')
intBBox[:eastLongitude] = hBBox['eastLongitude']
end
if intBBox[:eastLongitude].nil? || intBBox[:eastLongitude] == ''
- responseObj[:readerExecutionMessages] << 'boundingBox east boundary is missing'
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box east boundary is missing'
responseObj[:readerExecutionPass] = false
return nil
end
if intBBox[:eastLongitude].abs > 180
- responseObj[:readerExecutionMessages] << 'boundingBox longitude must be between -180 and +180'
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box longitude must be between -180 and +180'
responseObj[:readerExecutionPass] = false
return nil
end
# bounding box - south latitude (required)
if hBBox.has_key?('southLatitude')
intBBox[:southLatitude] = hBBox['southLatitude']
end
if intBBox[:southLatitude].nil? || intBBox[:southLatitude] == ''
- responseObj[:readerExecutionMessages] << 'boundingBox south boundary is missing'
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box south boundary is missing'
responseObj[:readerExecutionPass] = false
return nil
end
if intBBox[:southLatitude].abs > 90
- responseObj[:readerExecutionMessages] << 'boundingBox latitude must be between -90 and +90'
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box latitude must be between -90 and +90'
responseObj[:readerExecutionPass] = false
return nil
end
# bounding box - north latitude (required)
if hBBox.has_key?('northLatitude')
intBBox[:northLatitude] = hBBox['northLatitude']
end
if intBBox[:northLatitude].nil? || intBBox[:northLatitude] == ''
- responseObj[:readerExecutionMessages] << 'boundingBox north boundary is missing'
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box north boundary is missing'
responseObj[:readerExecutionPass] = false
return nil
end
if intBBox[:northLatitude].abs > 90
- responseObj[:readerExecutionMessages] << 'boundingBox latitude must be between -90 and +90'
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box latitude must be between -90 and +90'
responseObj[:readerExecutionPass] = false
return nil
end
# bounding box - minimum altitude
@@ -105,10 +105,10 @@
intBBox[:unitsOfAltitude] = hBBox['unitsOfAltitude']
end
end
unless intBBox[:minimumAltitude].nil? && intBBox[:maximumAltitude].nil?
if intBBox[:unitsOfAltitude].nil? || intBBox[:unitsOfAltitude] == ''
- responseObj[:readerExecutionMessages] << 'boundingBox altitude unit of measure is missing'
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box altitude units of measure are missing'
responseObj[:readerExecutionPass] = false
return nil
end
end