Class: WmsGetcapabilities::Layer

Inherits:
Object
  • Object
show all
Defined in:
lib/wms_getcapabilities/layer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, title, crs, bbox, description, dimension_type, dimension_values) ⇒ Layer

Returns a new instance of Layer.



5
6
7
8
9
10
11
12
13
# File 'lib/wms_getcapabilities/layer.rb', line 5

def initialize(name, title, crs, bbox, description, dimension_type, dimension_values)
  @name             = name
  @title            = title
  @crs              = crs
  @bbox             = bbox
  @description      = description
  @dimension_type   = dimension_type
  @dimension_values = dimension_values
end

Instance Attribute Details

#bboxObject

Returns the value of attribute bbox.



3
4
5
# File 'lib/wms_getcapabilities/layer.rb', line 3

def bbox
  @bbox
end

#crsObject

Returns the value of attribute crs.



3
4
5
# File 'lib/wms_getcapabilities/layer.rb', line 3

def crs
  @crs
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/wms_getcapabilities/layer.rb', line 3

def description
  @description
end

#dimension_typeObject

Returns the value of attribute dimension_type.



3
4
5
# File 'lib/wms_getcapabilities/layer.rb', line 3

def dimension_type
  @dimension_type
end

#dimension_valuesObject

Returns the value of attribute dimension_values.



3
4
5
# File 'lib/wms_getcapabilities/layer.rb', line 3

def dimension_values
  @dimension_values
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/wms_getcapabilities/layer.rb', line 3

def name
  @name
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/wms_getcapabilities/layer.rb', line 3

def title
  @title
end

Class Method Details

.from_xml(node) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/wms_getcapabilities/layer.rb', line 15

def self.from_xml(node)
  children = node.children

  name             = children.at("Name").text
  title            = children.at("Title").text
  crs              = children.at("CRS").text
  description      = children.at("Abstract").text
  dimension        = children.at("Dimension")
  box              = children.search("BoundingBox").last
  bbox             = {minx: box.attr("minx"), miny: box.attr("miny"), maxx: box.attr("maxx"), maxy: box.attr("maxy")}
  dimension_type   = dimension ? dimension.attr("name") : nil
  dimension_values = dimension ? dimension.text : nil

  l = Layer.new(name, title, crs, bbox, description, dimension_type, dimension_values)
end