Class: AIXM::Component::Geometry::Circle

Inherits:
Object
  • Object
show all
Includes:
AIXM::Concerns::Association, AIXM::Concerns::XMLBuilder
Defined in:
lib/aixm/component/geometry/circle.rb

Overview

Circles are defined by a #center_xy and a #radius.

Cheat Sheet in Pseudo Code:

circle = AIXM.circle(
  center_xy: AIXM.xy
  radius: AIXM.d
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AIXM::Concerns::XMLBuilder

#build_fragment, #to_uid, #to_xml

Methods included from AIXM::Concerns::Memoize

included, method

Methods included from AIXM::Concerns::Association

included

Constructor Details

#initialize(center_xy:, radius:) ⇒ Circle

See the cheat sheet for examples on how to create instances of this class.



42
43
44
# File 'lib/aixm/component/geometry/circle.rb', line 42

def initialize(center_xy:, radius:)
  self.center_xy, self.radius = center_xy, radius
end

Instance Attribute Details

#center_xyAIXM::XY #center_xy=(value) ⇒ Object

Center point

Overloads:



30
31
32
# File 'lib/aixm/component/geometry/circle.rb', line 30

def center_xy
  @center_xy
end

#radiusAIXM::D #radius=(value) ⇒ Object

Circle radius

Overloads:



38
39
40
# File 'lib/aixm/component/geometry/circle.rb', line 38

def radius
  @radius
end

Instance Method Details

#geometryAIXM::Component::Geometry

Returns geometry this segment belongs to.

Returns:



22
# File 'lib/aixm/component/geometry/circle.rb', line 22

belongs_to :geometry, as: :segment

#inspectString

Returns:

  • (String)


47
48
49
# File 'lib/aixm/component/geometry/circle.rb', line 47

def inspect
  %Q(#<#{self.class} center_xy="#{center_xy}" radius="#{radius.to_s}">)
end