Class: VORuby::STC::V1_30::CircleType
- Inherits:
-
ShapeType
- Object
- STCBaseType
- CoordIntervalType
- SpatialIntervalType
- RegionType
- ShapeType
- VORuby::STC::V1_30::CircleType
- Defined in:
- lib/voruby/stc/1.30/stc.rb
Overview
Circle shape: center and radius.
Instance Attribute Summary collapse
-
#center ⇒ Object
Returns the value of attribute center.
-
#radius ⇒ Object
Returns the value of attribute radius.
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(center, radius, area = nil, lo_include = true, hi_include = true, options = {}) ⇒ CircleType
constructor
A new instance of CircleType.
- #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, radius, area = nil, lo_include = true, hi_include = true, options = {}) ⇒ CircleType
Returns a new instance of CircleType.
5298 5299 5300 5301 5302 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5298 def initialize(center, radius, area=nil, lo_include=true, hi_include=true, ={}) super(area, lo_include, hi_include, ) self.center = center self.radius = radius end |
Instance Attribute Details
#center ⇒ Object
Returns the value of attribute center.
5296 5297 5298 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5296 def center @center end |
#radius ⇒ Object
Returns the value of attribute radius.
5296 5297 5298 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5296 def radius @radius end |
Class Method Details
.from_xml(xml) ⇒ Object
5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5338 def self.from_xml(xml) root = element_from(xml) radius = REXML::XPath.first(root, 'x:Radius', {'x' => obj_ns.uri}) self.new( Double2Type.from_xml(REXML::XPath.first(root, 'x:Center', {'x' => obj_ns.uri})), radius ? Double1Type.from_xml(REXML::XPath.first(root, 'x:Radius', {'x' => obj_ns.uri})) : nil, *ShapeType.shape_from_xml(root) ) end |
Instance Method Details
#==(c) ⇒ Object
5318 5319 5320 5321 5322 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5318 def ==(c) super(c) and self.center == c.center and self.radius == c.radius end |
#to_s ⇒ Object
5334 5335 5336 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5334 def to_s "CIRCLE #{self.coord_system_id || IdRef.new('J2000')} #{self.center} #{self.radius}" end |
#to_xml(name = nil) ⇒ Object
5324 5325 5326 5327 5328 5329 5330 5331 5332 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5324 def to_xml(name=nil) el = super(name) el.add_element(self.center.to_xml('Center')) if self.center el.add_element(self.radius.to_xml('Radius')) if self.radius collapse_namespaces(el) el end |