class ADIWG::Mdtranslator::Writers::Html::Html_Feature

Public Class Methods

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

Public Instance Methods

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

   # feature - user bounding box
   unless hFeature[:bbox].empty?
      @html.details do
         @html.summary('User Provided Bounding Box', 'class' => 'h5')
         @html.section(: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.details do
         @html.summary('Computed Bounding Box', 'class' => 'h5')
         @html.section(:class => 'block') do
            boxClass.writeHtml(hFeature[:computedBbox])
         end
      end
   end

   # feature - properties
   unless hFeature[:properties].empty?
      @html.details do
         @html.summary('Properties', 'class' => 'h5')
         @html.section(:class => 'block') do
            propertyClass.writeHtml(hFeature[:properties])
         end
      end
   end

   # feature - native GeoJson
   unless hFeature[:nativeGeoJson].empty?
      @html.details do
         @html.summary('GeoJson', 'class' => 'h5')
         @html.section(:class => 'block') do
            @html.text!(hFeature[:nativeGeoJson].to_json)
         end
      end
   end

end