Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_GeometryCollection

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

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Html_GeometryCollection

Returns a new instance of Html_GeometryCollection.



17
18
19
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_geometryCollection.rb', line 17

def initialize(html)
   @html = html
end

Instance Method Details

#writeHtml(hCollection) ⇒ Object



21
22
23
24
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
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_geometryCollection.rb', line 21

def writeHtml(hCollection)

   # classes used
   geometryClass = Html_GeometryObject.new(@html)
   boxClass = Html_BoundingBox.new(@html)

   # geometry collection - objects
   hCollection[:geometryObjects].each do |hObject|
      @html.div do
         @html.div(hObject[:type], 'class' => 'h5')
         @html.div(:class => 'block') do
            geometryClass.writeHtml(hObject)
         end
      end
   end

   # geometry collection - user bounding box
   unless hCollection[:bbox].empty?
      @html.div do
         @html.div('User Provided Bounding Box', 'class' => 'h5')
         @html.div(:class => 'block') do
            bbox = {}
            bbox[:westLongitude] = hCollection[:bbox][0]
            bbox[:eastLongitude] = hCollection[:bbox][2]
            bbox[:southLatitude] = hCollection[:bbox][1]
            bbox[:northLatitude] = hCollection[:bbox][3]
            boxClass.writeHtml(bbox)
         end
      end
   end

   # geometry collection - computed bounding box
   unless hCollection[:computedBbox].empty?
      @html.div do
         @html.div('Computed Bounding Box', 'class' => 'h5')
         @html.div(:class => 'block') do
            boxClass.writeHtml(hCollection[:computedBbox])
         end
      end
   end

   # geographic element - native GeoJson
   unless hCollection[:nativeGeoJson].empty?
      @html.div do
         @html.div('GeoJson', 'class' => 'h5')
         @html.div(:class => 'block') do
            @html.text!(hCollection[:nativeGeoJson].to_json)
         end
      end
   end

end