Class: VORuby::STC::V1_30::ConvexType

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

Overview

A convex polygon defined by one or more halfspaces.

Direct Known Subclasses

Convex, Convex2

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(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, options={})
  super(area, lo_include, hi_include, options)
  self.halfspaces = halfspaces
end

Instance Attribute Details

#halfspacesObject

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_sObject



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