Class: VORuby::STC::V1_30::CoordIntervalType

Inherits:
STCBaseType
  • Object
show all
Defined in:
lib/voruby/stc/1.30/stc.rb

Overview

Abstact coordinate interval type.

Instance Attribute Summary collapse

Attributes included from STCReference

#id, #idref, #ucd, #xlink_href, #xlink_type

Class Method Summary collapse

Instance Method Summary collapse

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(lo_include = true, hi_include = true, options = {}) ⇒ CoordIntervalType

Returns a new instance of CoordIntervalType.



3651
3652
3653
3654
3655
3656
# File 'lib/voruby/stc/1.30/stc.rb', line 3651

def initialize(lo_include=true, hi_include=true, options={})
  super(options)
  self.lo_include = lo_include.nil? ? true : lo_include
  self.hi_include = hi_include.nil? ? true : hi_include
  options[:fill_factor] = options[:fill_factor] ? options[:fill_factor] : 1.0
end

Instance Attribute Details

#fill_factorObject

Returns the value of attribute fill_factor.



3649
3650
3651
# File 'lib/voruby/stc/1.30/stc.rb', line 3649

def fill_factor
  @fill_factor
end

#frame_idObject

Returns the value of attribute frame_id.



3649
3650
3651
# File 'lib/voruby/stc/1.30/stc.rb', line 3649

def frame_id
  @frame_id
end

#hi_includeObject

Returns the value of attribute hi_include.



3649
3650
3651
# File 'lib/voruby/stc/1.30/stc.rb', line 3649

def hi_include
  @hi_include
end

#lo_includeObject

Returns the value of attribute lo_include.



3649
3650
3651
# File 'lib/voruby/stc/1.30/stc.rb', line 3649

def lo_include
  @lo_include
end

Class Method Details

.coord_interval_from_xml(root) ⇒ Object



3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
# File 'lib/voruby/stc/1.30/stc.rb', line 3704

def self.coord_interval_from_xml(root)
  options = STCBaseType.stc_base_from_xml(root)
  
  frame_id = root.attributes.get_attribute_ns(obj_ns.uri, 'frame_id')
  options[:frame_id] = IdRef.new(frame_id.value) if frame_id
  
  fill_factor = root.attributes.get_attribute_ns(obj_ns.uri, 'fill_factor')
  options[:fill_factor] = Float(fill_factor.value) if fill_factor
  
  lo_include = root.attributes.get_attribute_ns(obj_ns.uri, 'lo_include')
  hi_include = root.attributes.get_attribute_ns(obj_ns.uri, 'hi_include')
  fill_factor = root.attributes.get_attribute_ns(obj_ns.uri, 'fill_factor')
  
  [
    lo_include ? (lo_include.value == 'true' ? true : false) : nil,
    hi_include ? (hi_include.value == 'true' ? true : false) : nil,
    options
  ]
end

.from_xml(xml) ⇒ Object



3724
3725
3726
3727
# File 'lib/voruby/stc/1.30/stc.rb', line 3724

def self.from_xml(xml)
  root = element_from(xml)
  self.new(*coord_interval_from_xml(root))
end

Instance Method Details

#==(i) ⇒ Object



3685
3686
3687
3688
3689
3690
3691
# File 'lib/voruby/stc/1.30/stc.rb', line 3685

def ==(i)
  super(i) and
  self.lo_include == i.lo_include and
  self.hi_include == i.hi_include and
  self.fill_factor == i.fill_factor and
  self.frame_id == i.frame_id
end

#hi_include?Boolean

Returns:

  • (Boolean)


3670
# File 'lib/voruby/stc/1.30/stc.rb', line 3670

def hi_include?; @hi_include ? true : false end

#lo_include?Boolean

Returns:

  • (Boolean)


3663
# File 'lib/voruby/stc/1.30/stc.rb', line 3663

def lo_include?; @lo_include ? true : false end

#to_xml(name = nil) ⇒ Object



3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
# File 'lib/voruby/stc/1.30/stc.rb', line 3693

def to_xml(name=nil)
  el = super(name)
  
  el.attributes["#{obj_ns.prefix}:lo_include"] = self.lo_include.to_s
  el.attributes["#{obj_ns.prefix}:hi_include"] = self.hi_include.to_s
  el.attributes["#{obj_ns.prefix}:fill_factor"] = self.fill_factor.to_s if self.fill_factor
  el.attributes["#{obj_ns.prefix}:frame_id"] = self.frame_id.to_s if self.frame_id
  
  el
end