Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_Source

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/simple_html/sections/html_source.rb

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Html_Source

Returns a new instance of Html_Source.



25
26
27
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_source.rb', line 25

def initialize(html)
   @html = html
end

Instance Method Details

#writeHtml(hSource) ⇒ Object



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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_source.rb', line 29

def writeHtml(hSource)

   # classes used
   citationClass = Html_Citation.new(@html)
   resolutionClass = Html_SpatialResolution.new(@html)
   referenceClass = Html_SpatialReference.new(@html)
   stepClass = Html_ProcessStep.new(@html)
   scopeClass = Html_Scope.new(@html)
   identifierClass = Html_Identifier.new(@html)
   nominalClass = Html_NominalResolution.new(@html)

   # source - source ID
   unless hSource[:sourceId].nil?
      @html.em('Source ID: ')
      @html.text!(hSource[:sourceId])
      @html.br
   end

   # source - description
   unless hSource[:description].nil?
      @html.em('Description: ')
      @html.div(:class => 'block') do
         @html.text!(hSource[:description])
      end
   end

   # source - citation {citation}
   unless hSource[:sourceCitation].empty?
      @html.div do
         @html.div('Source Citation', {'class' => 'h5'})
         @html.div(:class => 'block') do
            citationClass.writeHtml(hSource[:sourceCitation])
         end
      end
   end

   # source - metadata citation [] {citation}
   unless hSource[:metadataCitations].empty?
      @html.div do
         @html.div('Metadata Citations', {'class' => 'h5'})
         @html.div(:class => 'block') do
            hSource[:metadataCitations].each do |hCitation|
               @html.div do
                  @html.div(hCitation[:title], {'class' => 'h5'})
                  @html.div(:class => 'block') do
                     citationClass.writeHtml(hCitation)
                  end
               end
            end
         end
      end
   end

   # source - spatial resolution {resolution}
   unless hSource[:spatialResolution].empty?
      @html.div do
         @html.div('Resolution', {'class' => 'h5'})
         @html.div(:class => 'block') do
            resolutionClass.writeHtml(hSource[:spatialResolution])
         end
      end
   end

   # source - reference system {spatialReference}
   unless hSource[:referenceSystem].empty?
      @html.div do
         @html.div('Spatial Reference System', {'class' => 'h5'})
         @html.div(:class => 'block') do
            referenceClass.writeHtml(hSource[:referenceSystem])
         end
      end
   end

   # source - process steps [] {processStep}
   unless hSource[:sourceSteps].empty?
      @html.div do
         @html.div('Source Processing Steps', {'class' => 'h5'})
         @html.div(:class => 'block') do
            hSource[:sourceSteps].each do |hStep|
               @html.div do
                  @html.div('Process Step', {'class' => 'h5'})
                  @html.div(:class => 'block') do
                     stepClass.writeHtml(hStep)
                  end
               end
            end
         end
      end
   end

   # source - scope {scope}
   unless hSource[:scope].empty?
      @html.div do
         @html.div('Scope', {'class' => 'h5'})
         @html.div(:class => 'block') do
            scopeClass.writeHtml(hSource[:scope])
         end
      end
   end

   # source - processed level {identifier}
   unless hSource[:processedLevel].empty?
      @html.div do
         @html.div('Processed Level', {'class' => 'h5'})
         @html.div(:class => 'block') do
            identifierClass.writeHtml(hSource[:processedLevel])
         end
      end
   end

   # source - resolution {nominal resolution}
   unless hSource[:resolution].empty?
      @html.div do
         @html.div('Nominal Resolution', {'class' => 'h5'})
         @html.div(:class => 'block') do
            nominalClass.writeHtml(hSource[:resolution])
         end
      end
   end

end