Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_GeographicElement
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Simple_html::Html_GeographicElement
- Defined in:
- lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicElement.rb
Instance Method Summary collapse
-
#initialize(html) ⇒ Html_GeographicElement
constructor
A new instance of Html_GeographicElement.
- #writeHtml(hElement) ⇒ Object
Constructor Details
#initialize(html) ⇒ Html_GeographicElement
Returns a new instance of Html_GeographicElement.
19 20 21 |
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicElement.rb', line 19 def initialize(html) @html = html end |
Instance Method Details
#writeHtml(hElement) ⇒ Object
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 |
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicElement.rb', line 23 def writeHtml(hElement) # classes used geometryClass = Html_GeometryObject.new(@html) geoCollectionClass =Html_GeometryCollection.new(@html) featureClass =Html_Feature.new(@html) featCollectionClass =Html_FeatureCollection.new(@html) # geographic element - geometry objects case hElement[:type] when 'Point', 'LineString', 'Polygon', 'MultiPoint', 'MultiLineString', 'MultiPolygon' @html.div do @html.div(hElement[:type], 'class' => 'h5') @html.div(:class => 'block') do geometryClass.writeHtml(hElement) end end when 'GeometryCollection' @html.div do @html.div('Geometry Collection', 'class' => 'h5') @html.div(:class => 'block') do geoCollectionClass.writeHtml(hElement) end end when 'Feature' @html.div do title = 'Feature' unless hElement[:id].nil? title += ': '+hElement[:id].to_s end @html.div(title, 'class' => 'h5') @html.div(:class => 'block') do featureClass.writeHtml(hElement) end end when 'FeatureCollection' @html.div do @html.div(hElement[:type], 'class' => 'h5') @html.div(:class => 'block') do featCollectionClass.writeHtml(hElement) end end else @html.text!('Bad GeoJSON Type: '+hElement[:type]) end end |