Class: VORuby::STC::V1_30::ConvexType
- Inherits:
-
ShapeType
- Object
- STCBaseType
- CoordIntervalType
- SpatialIntervalType
- RegionType
- ShapeType
- VORuby::STC::V1_30::ConvexType
- Defined in:
- lib/voruby/stc/1.30/stc.rb
Overview
A convex polygon defined by one or more halfspaces.
Instance Attribute Summary collapse
-
#halfspaces ⇒ Object
Returns the value of attribute halfspaces.
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
- #==(c) ⇒ Object
-
#initialize(halfspaces, area = nil, lo_include = true, hi_include = true, options = {}) ⇒ ConvexType
constructor
A new instance of ConvexType.
- #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(halfspaces, area = nil, lo_include = true, hi_include = true, options = {}) ⇒ ConvexType
Returns a new instance of ConvexType.
5815 5816 5817 5818 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5815 def initialize(halfspaces, area=nil, lo_include=true, hi_include=true, ={}) super(area, lo_include, hi_include, ) self.halfspaces = halfspaces end |
Instance Attribute Details
#halfspaces ⇒ Object
Returns the value of attribute halfspaces.
5813 5814 5815 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5813 def halfspaces @halfspaces end |
Class Method Details
.from_xml(xml) ⇒ Object
5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5847 def self.from_xml(xml) root = element_from(xml) self.new( HalfspaceList.new( REXML::XPath.match(root, 'x:Halfspace', {'x' => obj_ns.uri}).collect{ |h| HalfspaceType.from_xml(h) } ), *ShapeType.shape_from_xml(root) ) end |
Instance Method Details
#==(c) ⇒ Object
5829 5830 5831 5832 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5829 def ==(c) super(c) and self.halfspaces == c.halfspaces end |
#to_s ⇒ Object
5843 5844 5845 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5843 def to_s "CONVEX #{self.coord_system_id || IdRef.new('J2000')} #{self.halfspaces}" end |
#to_xml(name = nil) ⇒ Object
5834 5835 5836 5837 5838 5839 5840 5841 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5834 def to_xml(name=nil) el = super(name) self.halfspaces.each{ |h| el.add_element(h.to_xml('Halfspace')) } collapse_namespaces(el) el end |