Class: VORuby::STC::V1_30::EllipseType
- Inherits:
-
ShapeType
- Object
- STCBaseType
- CoordIntervalType
- SpatialIntervalType
- RegionType
- ShapeType
- VORuby::STC::V1_30::EllipseType
- Defined in:
- lib/voruby/stc/1.30/stc.rb
Overview
Ellipse shape: center, semi-major, semi-minor axis and position angle; in spherical coordinates defined as the shape cut out of the sphere by a cone with elliptical cross-section.
Instance Attribute Summary collapse
-
#center ⇒ Object
Returns the value of attribute center.
-
#pos_angle ⇒ Object
Returns the value of attribute pos_angle.
-
#semi_major_axis ⇒ Object
Returns the value of attribute semi_major_axis.
-
#semi_minor_axis ⇒ Object
Returns the value of attribute semi_minor_axis.
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
- #==(e) ⇒ Object
-
#initialize(center, semi_major_axis, semi_minor_axis, pos_angle, area = nil, lo_include = true, hi_include = true, options = {}) ⇒ EllipseType
constructor
A new instance of EllipseType.
- #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(center, semi_major_axis, semi_minor_axis, pos_angle, area = nil, lo_include = true, hi_include = true, options = {}) ⇒ EllipseType
Returns a new instance of EllipseType.
5356 5357 5358 5359 5360 5361 5362 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5356 def initialize(center, semi_major_axis, semi_minor_axis, pos_angle, area=nil, lo_include=true, hi_include=true, ={}) super(area, lo_include, hi_include, ) self.center = center self.semi_major_axis = semi_major_axis self.semi_minor_axis = semi_minor_axis self.pos_angle = pos_angle end |
Instance Attribute Details
#center ⇒ Object
Returns the value of attribute center.
5354 5355 5356 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5354 def center @center end |
#pos_angle ⇒ Object
Returns the value of attribute pos_angle.
5354 5355 5356 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5354 def pos_angle @pos_angle end |
#semi_major_axis ⇒ Object
Returns the value of attribute semi_major_axis.
5354 5355 5356 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5354 def semi_major_axis @semi_major_axis end |
#semi_minor_axis ⇒ Object
Returns the value of attribute semi_minor_axis.
5354 5355 5356 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5354 def semi_minor_axis @semi_minor_axis end |
Class Method Details
.from_xml(xml) ⇒ Object
5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5420 def self.from_xml(xml) root = element_from(xml) major_axis = REXML::XPath.first(root, 'x:SemiMajorAxis', {'x' => obj_ns.uri}) minor_axis = REXML::XPath.first(root, 'x:SemiMinorAxis', {'x' => obj_ns.uri}) self.new( Double2Type.from_xml(REXML::XPath.first(root, 'x:Center', {'x' => obj_ns.uri})), major_axis ? Double1Type.from_xml(major_axis) : nil, minor_axis ? Double1Type.from_xml(minor_axis) : nil, PosAngleType.from_xml(REXML::XPath.first(root, 'x:PosAngle', {'x' => obj_ns.uri})), *ShapeType.shape_from_xml(root) ) end |
Instance Method Details
#==(e) ⇒ Object
5396 5397 5398 5399 5400 5401 5402 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5396 def ==(e) super(e) and self.center == e.center and self.semi_major_axis == e.semi_major_axis and self.semi_minor_axis == e.semi_minor_axis and self.pos_angle == e.pos_angle end |
#to_s ⇒ Object
5416 5417 5418 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5416 def to_s "ELLIPSE #{self.coord_system_id || IdRef.new('J2000')} #{self.center} #{self.semi_major_axis} #{self.semi_minor_axis} #{self.pos_angle}" end |
#to_xml(name = nil) ⇒ Object
5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5404 def to_xml(name=nil) el = super(name) el.add_element(self.center.to_xml('Center')) el.add_element(self.semi_major_axis.to_xml('SemiMajorAxis')) if self.semi_major_axis el.add_element(self.semi_minor_axis.to_xml('SemiMinorAxis')) if self.semi_minor_axis el.add_element(self.pos_angle.to_xml('PosAngle')) collapse_namespaces(el) el end |