Class: ROGC::Formats::WMSCapabilities::V1_1

Inherits:
V1 show all
Defined in:
lib/rogc/formats/wms_capabilities/v1_1.rb

Direct Known Subclasses

V1_1_1, V1_3

Instance Attribute Summary

Attributes inherited from XML::Base

#xml_readers

Instance Method Summary collapse

Methods inherited from V1

#get_bounding_box, #get_srs

Methods inherited from XML::VersionedOGC

#get_parser, #get_version, #read

Methods inherited from XML::Base

#child_value, #read_child_nodes, #read_node

Constructor Details

#initializeV1_1

Returns a new instance of V1_1.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
# File 'lib/rogc/formats/wms_capabilities/v1_1.rb', line 5

def initialize
  super
  @xml_readers = xml_readers.merge({ 'wms' =>  xml_readers['wms'].merge({
  'WMT_MS_Capabilities' => lambda { |node, obj|
    read_child_nodes(node, obj)
  },
  'Keyword' => lambda { |node, obj|
    obj.keywords ||= Array.new
    obj.keywords << child_value(node)
  },
  'DescribeLayer' => lambda { |node, obj|
    obj.describelayer = OpenStruct.new({ formats: Array.new })
    read_child_nodes(node, obj.describelayer)
  },
  'GetLegendGraphic' => lambda { |node, obj|
    obj.getlegendgraphic = OpenStruct.new({ formats: Array.new })
    read_child_nodes(node, obj.getlegendgraphic)
  },
  'GetStyles' => lambda { |node, obj|
    obj.getstyles = OpenStruct.new({ formats: Array.new })
    read_child_nodes(node, obj.getstyles)
  },
  'PutStyles' => lambda { |node, obj|
    obj.putstyles = OpenStruct.new({ formats: Array.new })
    read_child_nodes(node, obj.putstyles)
  },
  'UserDefinedSymbolization' => lambda { |node, obj|
    obj.user_symbols = OpenStruct.new({
      supports_SLD: node['SupportSLD'].to_i == 1,
      user_layer: node['UserLayer'].to_i == 1,
      user_style: node['UserStyle'].to_i == 1,
      remote_WFS: node['RemoteWFS'].to_i == 1
    })
  },
  'LatLonBoundingBox' => lambda { |node, obj|
    obj.llbox = [
      node['minx'].to_f,
      node['miny'].to_f,
      node['maxx'].to_f,
      node['maxy'].to_f
    ]
  },
  'BoundingBox' => lambda { |node, obj|
      # raise super['wms']['BOundingBox'].inspect
      bbox = get_bounding_box(node, obj)
      # bbox = obj.bbox
      bbox.srs = node['SRS']
      obj.bbox ||= {}
      obj.bbox[bbox.srs] = bbox 

      obj.bbox
  }
    
}) })
end