Class: ADIWG::Mdtranslator::Writers::Iso19115_3::MD_Georectified
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Iso19115_3::MD_Georectified
- Defined in:
- lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_georectified.rb
Instance Method Summary collapse
-
#initialize(xml, hResponseObj) ⇒ MD_Georectified
constructor
A new instance of MD_Georectified.
- #writeXML(hGeoRec, inContext = nil) ⇒ Object
Constructor Details
#initialize(xml, hResponseObj) ⇒ MD_Georectified
Returns a new instance of MD_Georectified.
19 20 21 22 23 |
# File 'lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_georectified.rb', line 19 def initialize(xml, hResponseObj) @xml = xml @hResponseObj = hResponseObj @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_3 end |
Instance Method Details
#writeXML(hGeoRec, inContext = nil) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_georectified.rb', line 25 def writeXML(hGeoRec, inContext = nil) # classes used gridClass = Grid.new(@xml, @hResponseObj) pointClass = Point.new(@xml, @hResponseObj) scopeClass = MD_Scope.new(@xml, @hResponseObj) outContext = 'georectified representation' outContext = inContext + ' georectified representation' unless inContext.nil? @xml.tag!('msr:MD_Georectified') do hGeoRec[:scope].each do |scope| @xml.tag!('msr:scope') do scopeClass.writeXML(scope, inContext) end end # georectified - add grid info hGrid = hGeoRec[:gridRepresentation] gridClass.writeXML(hGrid, outContext) # georectified - checkpoint availability @xml.tag!('msr:checkPointAvailability') do @xml.tag!('gco:Boolean', hGeoRec[:checkPointAvailable]) end # georectified - checkpoint description unless hGeoRec[:checkPointDescription].nil? @xml.tag!('msr:checkPointDescription') do @xml.tag!('gco:CharacterString', hGeoRec[:checkPointDescription]) end end if hGeoRec[:checkPointDescription].nil? && @hResponseObj[:writerShowTags] @xml.tag!('msr:checkPointDescription') end # georectified - corner points (2 or 4 required) aCoords = hGeoRec[:cornerPoints] aCoords.each do |aPoint| hPoint = {} hPoint[:type] = 'Point' hPoint[:coordinates] = aPoint @xml.tag!('msr:cornerPoints') do pointClass.writeXML(hPoint, {}, nil) end end if aCoords.empty? @NameSpace.issueWarning(170, 'msr:cornerPoints', 'spatial representation') end unless (aCoords.length == 2 || aCoords.length == 4) @NameSpace.issueWarning(172, 'msr:cornerPoints', 'spatial representation') end # georectified - center point aCoords = hGeoRec[:centerPoint] unless aCoords.empty? hPoint = {} hPoint[:type] = 'Point' hPoint[:coordinates] = aCoords @xml.tag!('msr:centrePoint') do pointClass.writeXML(hPoint, {}, nil) end end if aCoords.empty? && @hResponseObj[:writerShowTags] @xml.tag!('msr:centrePoint') end # georectified - point in pixel (required) if hGeoRec[:pointInPixel].nil? @NameSpace.issueWarning(171, 'msr:pointInPixel', 'spatial representation') else @xml.tag!('msr:pointInPixel') do @xml.tag!('msr:MD_PixelOrientationCode', hGeoRec[:pointInPixel]) end end # georectified - transformation dimension description unless hGeoRec[:transformationDimensionDescription].nil? @xml.tag!('msr:transformationDimensionDescription') do @xml.tag!('gco:CharacterString', hGeoRec[:transformationDimensionDescription]) end end if hGeoRec[:transformationDimensionDescription].nil? && @hResponseObj[:writerShowTags] @xml.tag!('msr:transformationDimensionDescription') end # georectified - transformation dimension mapping unless hGeoRec[:transformationDimensionMapping].nil? @xml.tag!('msr:transformationDimensionMapping') do @xml.tag!('gco:CharacterString', hGeoRec[:transformationDimensionMapping]) end end if hGeoRec[:transformationDimensionMapping].nil? && @hResponseObj[:writerShowTags] @xml.tag!('msr:transformationDimensionMapping') end end # msr:MD_Georectified tag end |