Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_Feature
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Simple_html::Html_Feature
- Defined in:
- lib/adiwg/mdtranslator/writers/simple_html/sections/html_feature.rb
Instance Method Summary collapse
-
#initialize(html) ⇒ Html_Feature
constructor
A new instance of Html_Feature.
- #writeHtml(hFeature) ⇒ Object
Constructor Details
#initialize(html) ⇒ Html_Feature
Returns a new instance of Html_Feature.
18 19 20 |
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_feature.rb', line 18 def initialize(html) @html = html end |
Instance Method Details
#writeHtml(hFeature) ⇒ Object
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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_feature.rb', line 22 def writeHtml(hFeature) # classes used geometryClass = Html_GeometryObject.new(@html) boxClass = Html_BoundingBox.new(@html) propertyClass = Html_FeatureProperty.new(@html) # feature - id unless hFeature[:id].nil? @html.em('ID: ') @html.text!(hFeature[:id]) @html.br end # feature - geometry object unless hFeature[:geometryObject].empty? @html.div do @html.div(hFeature[:geometryObject][:type], 'class' => 'h5') @html.div(:class => 'block') do geometryClass.writeHtml(hFeature[:geometryObject]) end end end # feature - user bounding box unless hFeature[:bbox].empty? @html.div do @html.div('User Provided Bounding Box', 'class' => 'h5') @html.div(:class => 'block') do bbox = {} bbox[:westLongitude] = hFeature[:bbox][0] bbox[:eastLongitude] = hFeature[:bbox][2] bbox[:southLatitude] = hFeature[:bbox][1] bbox[:northLatitude] = hFeature[:bbox][3] boxClass.writeHtml(bbox) end end end # feature - computed bounding box unless hFeature[:computedBbox].empty? @html.div do @html.div('Computed Bounding Box', 'class' => 'h5') @html.div(:class => 'block') do boxClass.writeHtml(hFeature[:computedBbox]) end end end # feature - properties unless hFeature[:properties].empty? @html.div do @html.div('Properties', 'class' => 'h5') @html.div(:class => 'block') do propertyClass.writeHtml(hFeature[:properties]) end end end # feature - native GeoJson unless hFeature[:nativeGeoJson].empty? @html.div do @html.div('GeoJson', 'class' => 'h5') @html.div(:class => 'block') do @html.text!(hFeature[:nativeGeoJson].to_json) end end end end |