class RGeoServer::Style
A style describes how a resource (feature type or coverage) should be symbolized or rendered by a Web Map Service. In GeoServer styles are specified with SLD
Constants
- OBJ_ATTRIBUTES
- OBJ_DEFAULT_ATTRIBUTES
Public Class Methods
member_xpath()
click to toggle source
# File lib/rgeoserver/style.rb, line 24 def self.member_xpath "//#{resource_name}" end
new(catalog, options)
click to toggle source
@param [RGeoServer::Catalog] catalog @param [Hash] options
Calls superclass method
RGeoServer::ResourceInfo::new
# File lib/rgeoserver/style.rb, line 64 def initialize catalog, options super(catalog) _run_initialize_callbacks do @name = options[:name].strip end @route = route end
resource_name()
click to toggle source
# File lib/rgeoserver/style.rb, line 16 def self.resource_name @@resource_name end
root_xpath()
click to toggle source
# File lib/rgeoserver/style.rb, line 20 def self.root_xpath "//#{@@route}/#{@@resource_name}" end
Public Instance Methods
create_options()
click to toggle source
# File lib/rgeoserver/style.rb, line 37 def create_options { :headers => { :accept => :xml, :content_type=> "application/vnd.ogc.sld+xml" }, :format => :xml, :name => @name } end
layers() { |l| ... }
click to toggle source
Obtain all layers that use this style. WARNING: This will be slow and inneficient when the list of all layers is too long.
# File lib/rgeoserver/style.rb, line 74 def layers &block return to_enum(:layers).to_a unless block_given? @catalog.get_layers do |l| lyrs = [l.profile['default_style']]+l.profile['alternate_styles'] yield l if lyrs.include? @name end end
message()
click to toggle source
# File lib/rgeoserver/style.rb, line 58 def message @sld_doc end
profile_xml_to_hash(profile_xml)
click to toggle source
# File lib/rgeoserver/style.rb, line 82 def profile_xml_to_hash profile_xml doc = profile_xml_to_ng profile_xml h = { 'name' => doc.at_xpath('//name').text.strip, 'sld_version' => doc.at_xpath('//sldVersion/version/text()').to_s, 'filename' => doc.at_xpath('//filename/text()').to_s, 'sld_doc' => begin Nokogiri::XML(@catalog.search({:styles => @name}, options={:format => :sld})).to_xml rescue RestClient::ResourceNotFound nil end }.freeze h end
route()
click to toggle source
# File lib/rgeoserver/style.rb, line 28 def route @@route end
sld_namespace()
click to toggle source
# File lib/rgeoserver/style.rb, line 32 def sld_namespace @@sld_namespace end
update_options()
click to toggle source
# File lib/rgeoserver/style.rb, line 48 def update_options { :headers => { :accept => :xml, :content_type=> "application/vnd.ogc.sld+xml" }, :format => :sld } end