Class: Amanzi::SLD::Document
- Inherits:
-
XML::Document
- Object
- XML::Element
- XML::Document
- Amanzi::SLD::Document
- Includes:
- Logger
- Defined in:
- lib/amanzi/sld.rb
Instance Attribute Summary collapse
-
#geometry_property ⇒ Object
readonly
Returns the value of attribute geometry_property.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sld_name ⇒ Object
readonly
Returns the value of attribute sld_name.
-
#style_name ⇒ Object
readonly
Returns the value of attribute style_name.
Attributes inherited from XML::Element
#attributes, #children, #depth, #namespace
Instance Method Summary collapse
- #add_line_symbolizer(options = {}, *args, &block) ⇒ Object
- #add_polygon_symbolizer(options = {}, *args, &block) ⇒ Object
- #add_rule(options = {}) ⇒ Object
- #add_text_symbolizer(options = {}, *args, &block) ⇒ Object
-
#initialize(name, options = {}) ⇒ Document
constructor
A new instance of Document.
-
#method_missing(symbol, *args, &block) ⇒ Object
Pass any unknown methods down to user_style.
Methods included from Logger
Methods inherited from XML::Document
#add_singleton_elements, #comment, #singleton_elements, #singleton_method, #to_s, #to_xml
Methods inherited from XML::Element
#<<, #[]=, #add_child, #attribute_text, camelize, #comment, #contents, #indent, #insert, #insert_child, #make_child, #ns, #tag, #to_s, #to_xml
Constructor Details
#initialize(name, options = {}) ⇒ Document
Returns a new instance of Document.
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/amanzi/sld.rb', line 42 def initialize(name,={}) super 'StyledLayerDescriptor' self['version'] = '1.0.0' self['xmlns'] = "http://www.opengis.net/sld" self['xmlns:ogc'] ="http://www.opengis.net/ogc" self['xmlns:xlink'] = "http://www.w3.org/1999/xlink" self['xmlns:xsi'] = "http://www.w3.org/2001/XMLSchema-instance" self['xsi:schemaLocation'] = "http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" add_singleton_elements ['named_layer','user_style'] singleton_method(:named_layer).insert_child(0,'Name') << name singleton_method(:user_style).insert_child(0,'Name') << name end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args, &block) ⇒ Object
Pass any unknown methods down to user_style
55 56 57 58 59 |
# File 'lib/amanzi/sld.rb', line 55 def method_missing(symbol,*args,&block) puts "Looking for SLD document method: #{symbol}" singleton_method(symbol,*args,&block) || singleton_method(:user_style).send(symbol, *args, &block) end |
Instance Attribute Details
#geometry_property ⇒ Object (readonly)
Returns the value of attribute geometry_property.
41 42 43 |
# File 'lib/amanzi/sld.rb', line 41 def geometry_property @geometry_property end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
41 42 43 |
# File 'lib/amanzi/sld.rb', line 41 def name @name end |
#sld_name ⇒ Object (readonly)
Returns the value of attribute sld_name.
41 42 43 |
# File 'lib/amanzi/sld.rb', line 41 def sld_name @sld_name end |
#style_name ⇒ Object (readonly)
Returns the value of attribute style_name.
41 42 43 |
# File 'lib/amanzi/sld.rb', line 41 def style_name @style_name end |
Instance Method Details
#add_line_symbolizer(options = {}, *args, &block) ⇒ Object
60 61 62 |
# File 'lib/amanzi/sld.rb', line 60 def add_line_symbolizer(={},*args,&block) RuleBuilder.new(self.feature_type_style.rule).add_line_symbolizer(,*args,&block) end |
#add_polygon_symbolizer(options = {}, *args, &block) ⇒ Object
63 64 65 |
# File 'lib/amanzi/sld.rb', line 63 def add_polygon_symbolizer(={},*args,&block) RuleBuilder.new(self.feature_type_style.rule).add_polygon_symbolizer(,*args,&block) end |
#add_rule(options = {}) ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'lib/amanzi/sld.rb', line 69 def add_rule(={}) puts "Adding a generic rule: #{.inspect}" self.feature_type_style do |fs| rule_builder = RuleBuilder.new(rule) yield rule_builder if(block_given?) rule_builder end end |
#add_text_symbolizer(options = {}, *args, &block) ⇒ Object
66 67 68 |
# File 'lib/amanzi/sld.rb', line 66 def add_text_symbolizer(={},*args,&block) RuleBuilder.new(self.feature_type_style.rule).add_text_symbolizer(,*args,&block) end |