class ADIWG::Mdtranslator::Writers::Html::Html_GeographicElement

Public Class Methods

new(html) click to toggle source
# File lib/adiwg/mdtranslator/writers/html/sections/html_geographicElement.rb, line 19
def initialize(html)
   @html = html
end

Public Instance Methods

writeHtml(hElement) click to toggle source
# File lib/adiwg/mdtranslator/writers/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.details do
            @html.summary(hElement[:type], 'class' => 'h5')
            @html.section(:class => 'block') do
               geometryClass.writeHtml(hElement)
            end
         end

      when 'GeometryCollection'
         @html.details do
            @html.summary('Geometry Collection', 'class' => 'h5')
            @html.section(:class => 'block') do
               geoCollectionClass.writeHtml(hElement)
            end
         end

      when 'Feature'
         @html.details do
            title = 'Feature'
            unless hElement[:id].nil?
               title += ': '+hElement[:id].to_s
            end
            @html.summary(title, 'class' => 'h5')
            @html.section(:class => 'block') do
               featureClass.writeHtml(hElement)
            end
         end

      when 'FeatureCollection'
         @html.details do
            @html.summary(hElement[:type], 'class' => 'h5')
            @html.section(:class => 'block') do
               featCollectionClass.writeHtml(hElement)
            end
         end

      else
         @html.text!('Bad GeoJSON Type: '+hElement[:type])
   end

end