Class: VORuby::STC::V1_10::Region::ConvexHullType
- Inherits:
-
Shape
show all
- Defined in:
- lib/voruby/stc/1.10/region.rb
Overview
Instance Attribute Summary collapse
Attributes inherited from Shape
#coord_system_id, #unit
Attributes inherited from RegionType
#note
Class Method Summary
collapse
Instance Method Summary
collapse
#element
Methods inherited from RegionType
#fill_factor, #fill_factor=
Constructor Details
Returns a new instance of ConvexHullType.
693
694
695
696
|
# File 'lib/voruby/stc/1.10/region.rb', line 693
def initialize(options={})
raise_argument_required_error('list of points') if !options.has_key?(:points)
super(options)
end
|
Instance Attribute Details
#points ⇒ Object
Returns the value of attribute points.
689
690
691
|
# File 'lib/voruby/stc/1.10/region.rb', line 689
def points
@points
end
|
Class Method Details
.from_xml(xml) ⇒ Object
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
|
# File 'lib/voruby/stc/1.10/region.rb', line 723
def self.from_xml(xml)
root = element_from(xml)
fill_factor = root.attributes.get_attribute_ns(obj_ns.uri, 'fill_factor')
note = root.attributes.get_attribute_ns(obj_ns.uri, 'note')
options = {
:fill_factor => fill_factor ? Float(fill_factor.value) : nil,
:note => note ? note.value : nil,
:coord_system_id => IdRef.new(root.attributes.get_attribute_ns(obj_ns.uri, 'coord_system_id').value),
:points => PointList.new(
REXML::XPath.match(root, 'x:Point', {'x' => obj_ns.uri}).collect{ |p| Double3.from_xml(p) }
)
}
unit = root.attributes.get_attribute_ns(obj_ns.uri, 'unit')
options[:unit] = PosUnit.new(unit.value) if unit
self.new(options)
end
|
.xml_type ⇒ Object
691
|
# File 'lib/voruby/stc/1.10/region.rb', line 691
def self.xml_type; 'convexHullType' end
|
Instance Method Details
#==(c) ⇒ Object
707
708
709
710
|
# File 'lib/voruby/stc/1.10/region.rb', line 707
def ==(c)
super(c) and
self.points == c.points
end
|
#to_s ⇒ Object
719
720
721
|
# File 'lib/voruby/stc/1.10/region.rb', line 719
def to_s
"CHULL #{self.coord_system_id} #{self.points}"
end
|
#to_xml(name = nil) ⇒ Object
712
713
714
715
716
717
|
# File 'lib/voruby/stc/1.10/region.rb', line 712
def to_xml(name=nil)
el = super(name)
self.points.each { |p| el.add_element(p.to_xml('Point', obj_ns)) }
collapse_namespaces(el)
el
end
|