Class: VORuby::STC::V1_30::ConvexHullType

Inherits:
ShapeType show all
Defined in:
lib/voruby/stc/1.30/stc.rb

Overview

A convex hull: the smallest convex polygon that contains all its points; in spherical coordinates all points have to be contained within a hemisphere.

Direct Known Subclasses

ConvexHull, ConvexHull2

Instance Attribute Summary collapse

Attributes inherited from RegionType

#area, #coord_system_id, #note

Attributes inherited from SpatialIntervalType

#epoch, #unit

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

Methods inherited from ShapeType

shape_from_xml

Methods inherited from RegionType

region_from_xml

Methods inherited from SpatialIntervalType

spatial_interval_from_xml

Methods inherited from CoordIntervalType

coord_interval_from_xml, #hi_include?, #lo_include?

Methods inherited from STCBaseType

stc_base_from_xml

Methods included from STCReference

#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(points, area = nil, lo_include = true, hi_include = true, options = {}) ⇒ ConvexHullType

Returns a new instance of ConvexHullType.



5869
5870
5871
5872
# File 'lib/voruby/stc/1.30/stc.rb', line 5869

def initialize(points, area=nil, lo_include=true, hi_include=true, options={})
  super(area, lo_include, hi_include, options)
  self.points = points
end

Instance Attribute Details

#pointsObject

Returns the value of attribute points.



5867
5868
5869
# File 'lib/voruby/stc/1.30/stc.rb', line 5867

def points
  @points
end

Class Method Details

.from_xml(xml) ⇒ Object



5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
# File 'lib/voruby/stc/1.30/stc.rb', line 5901

def self.from_xml(xml)
  root = element_from(xml)
  
  self.new(
    PointList.new(
      REXML::XPath.match(root, 'x:Point', {'x' => obj_ns.uri}).collect{ |p| Double3Type.from_xml(p) }
    ),
    *ShapeType.shape_from_xml(root)
  )
end

Instance Method Details

#==(c) ⇒ Object



5883
5884
5885
5886
# File 'lib/voruby/stc/1.30/stc.rb', line 5883

def ==(c)
  super(c) and
  self.points == c.points
end

#to_sObject



5897
5898
5899
# File 'lib/voruby/stc/1.30/stc.rb', line 5897

def to_s
  "CHULL #{self.coord_system_id || IdRef.new('J2000')} #{self.points}"
end

#to_xml(name = nil) ⇒ Object



5888
5889
5890
5891
5892
5893
5894
5895
# File 'lib/voruby/stc/1.30/stc.rb', line 5888

def to_xml(name=nil)
  el = super(name)
  
  self.points.each{ |p| el.add_element(p.to_xml('Point')) }
  
  collapse_namespaces(el)
  el
end