Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_FeatureCollection
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Simple_html::Html_FeatureCollection
- Defined in:
- lib/adiwg/mdtranslator/writers/simple_html/sections/html_featureCollection.rb
Instance Method Summary collapse
-
#initialize(html) ⇒ Html_FeatureCollection
constructor
A new instance of Html_FeatureCollection.
- #writeHtml(hCollection) ⇒ Object
Constructor Details
#initialize(html) ⇒ Html_FeatureCollection
Returns a new instance of Html_FeatureCollection.
17 18 19 |
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_featureCollection.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 73 74 75 76 |
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_featureCollection.rb', line 21 def writeHtml(hCollection) # classes used featureClass = Html_Feature.new(@html) boxClass = Html_BoundingBox.new(@html) # feature collection - feature [] {feature} hCollection[:features].each do |feature| @html.div do title = 'Feature' unless feature[:id].nil? title += ': '+feature[:id].to_s end @html.div(title, 'class' => 'h5') @html.div(:class => 'block') do featureClass.writeHtml(feature) end end end # feature 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 # feature 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 # feature collection - 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 |