Class: VORuby::STC::V1_30::PolygonType
- Inherits:
-
ShapeType
- Object
- STCBaseType
- CoordIntervalType
- SpatialIntervalType
- RegionType
- ShapeType
- VORuby::STC::V1_30::PolygonType
- Defined in:
- lib/voruby/stc/1.30/stc.rb
Overview
Polygon: one or more vertices; counter-clockwise (as seen from “inside” or from “top”) encircled area is enclosed; sides should span less than 180 deg in each coordinate if spherical; a polygon may not intersect itself.
Instance Attribute Summary collapse
-
#vertices ⇒ Object
Returns the value of attribute vertices.
Attributes inherited from RegionType
#area, #coord_system_id, #note
Attributes inherited from SpatialIntervalType
Attributes inherited from CoordIntervalType
#fill_factor, #frame_id, #hi_include, #lo_include
Attributes included from STCReference
#id, #idref, #ucd, #xlink_href, #xlink_type
Class Method Summary collapse
Instance Method Summary collapse
- #==(p) ⇒ Object
-
#initialize(vertices, area = nil, lo_include = true, hi_include = true, options = {}) ⇒ PolygonType
constructor
A new instance of PolygonType.
- #to_s ⇒ Object
- #to_xml(name = nil) ⇒ Object
Methods inherited from ShapeType
Methods inherited from RegionType
Methods inherited from SpatialIntervalType
Methods inherited from CoordIntervalType
coord_interval_from_xml, #hi_include?, #lo_include?
Methods inherited from STCBaseType
Methods included from STCReference
#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml
Methods included from SerializableToXml
Constructor Details
#initialize(vertices, area = nil, lo_include = true, hi_include = true, options = {}) ⇒ PolygonType
Returns a new instance of PolygonType.
5537 5538 5539 5540 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5537 def initialize(vertices, area=nil, lo_include=true, hi_include=true, ={}) super(area, lo_include, hi_include, ) self.vertices = vertices end |
Instance Attribute Details
#vertices ⇒ Object
Returns the value of attribute vertices.
5535 5536 5537 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5535 def vertices @vertices end |
Class Method Details
.from_xml(xml) ⇒ Object
5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5574 def self.from_xml(xml) root = element_from(xml) self.new( VertexList.new( REXML::XPath.match(root, 'x:Vertex', {'x' => obj_ns.uri}).collect{ |v| VertexType.from_xml(v) } ), *ShapeType.shape_from_xml(root) ) end |
Instance Method Details
#==(p) ⇒ Object
5556 5557 5558 5559 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5556 def ==(p) super(p) and self.vertices == p.vertices end |
#to_s ⇒ Object
5570 5571 5572 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5570 def to_s "POLYGON #{self.coord_system_id || IdRef.new('J2000')} #{self.vertices.collect{ |v| v.to_s }.join(' ')}" end |
#to_xml(name = nil) ⇒ Object
5561 5562 5563 5564 5565 5566 5567 5568 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5561 def to_xml(name=nil) el = super(name) self.vertices.each{ |v| el.add_element(v.to_xml('Vertex')) } collapse_namespaces(el) el end |