Class: Topolys::Vertex

Inherits:
Object
  • Object
show all
Defined in:
lib/topolys/model.rb

Overview

Object

Instance Attribute Summary collapse

Attributes inherited from Object

#attributes, #children, #id, #parents

Instance Method Summary collapse

Methods inherited from Object

#debug, #hash, link, #link_child, #link_parent, #short_id, #short_name, #to_s, unlink, #unlink_child, #unlink_parent

Constructor Details

#initialize(point) ⇒ Vertex

Initializes a Vertex object, use Model.get_point instead

Throws if point is incorrect type

Parameters:



818
819
820
821
822
823
# File 'lib/topolys/model.rb', line 818

def initialize(point)
  super()
  @point = point

  recalculate
end

Instance Attribute Details

#pointPoint3D (readonly)

Returns Point3D geometry.

Returns:



810
811
812
# File 'lib/topolys/model.rb', line 810

def point
  @point
end

Instance Method Details

#child_classObject



839
840
841
# File 'lib/topolys/model.rb', line 839

def child_class
  NilClass
end

#edgesObject



843
844
845
# File 'lib/topolys/model.rb', line 843

def edges
  @parents
end

#parent_classObject



835
836
837
# File 'lib/topolys/model.rb', line 835

def parent_class
  Edge
end

#recalculateObject



831
832
833
# File 'lib/topolys/model.rb', line 831

def recalculate
  super()
end

#to_jsonObject



825
826
827
828
829
# File 'lib/topolys/model.rb', line 825

def to_json
  result = super
  result[:point] = { x: @point.x, y: @point.y, z: @point.z }
  return result
end