Class: MapnikLegendary::Feature
- Inherits:
-
Object
- Object
- MapnikLegendary::Feature
- Defined in:
- lib/mapnik_legendary/feature.rb
Overview
A feature has a name, description, and one or more parts holding geometries, tags and layers
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parts ⇒ Object
readonly
Returns the value of attribute parts.
Instance Method Summary collapse
- #envelope ⇒ Object
-
#initialize(feature, zoom, map, extra_tags) ⇒ Feature
constructor
A new instance of Feature.
Constructor Details
#initialize(feature, zoom, map, extra_tags) ⇒ Feature
Returns a new instance of Feature.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/mapnik_legendary/feature.rb', line 10 def initialize(feature, zoom, map, ) @name = feature['name'] @description = feature.key?('description') ? feature['description'] : @name.capitalize @parts = [] if feature.key? 'parts' feature['parts'].each do |part| @parts << Part.new(part, zoom, map, ) end else @parts << Part.new(feature, zoom, map, ) end end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/mapnik_legendary/feature.rb', line 8 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/mapnik_legendary/feature.rb', line 8 def name @name end |
#parts ⇒ Object (readonly)
Returns the value of attribute parts.
8 9 10 |
# File 'lib/mapnik_legendary/feature.rb', line 8 def parts @parts end |
Instance Method Details
#envelope ⇒ Object
23 24 25 |
# File 'lib/mapnik_legendary/feature.rb', line 23 def envelope @parts.first.geom.envelope end |