Class: AIXM::Component::Geometry::Arc

Inherits:
Point show all
Defined in:
lib/aixm/component/geometry/arc.rb

Overview

Arcs are clockwise or counter clockwise circle segments around a #center_xy and starting at Point#xy.

Cheat Sheet in Pseudo Code:

arc = AIXM.arc(
  xy: AIXM.xy
  center_xy: AIXM.xy
  clockwise: true or false
)

Instance Attribute Summary collapse

Attributes inherited from Point

#xy

Instance Method Summary collapse

Methods inherited from Point

#geometry

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(xy:, center_xy:, clockwise:) ⇒ Arc

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



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

def initialize(xy:, center_xy:, clockwise:)
  super(xy: xy)
  self.center_xy, self.clockwise = center_xy, clockwise
end

Instance Attribute Details

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

Center point

Overloads:



26
27
28
# File 'lib/aixm/component/geometry/arc.rb', line 26

def center_xy
  @center_xy
end

#clockwise?Boolean #clockwise=(value) ⇒ Object

Whether the arc is going clockwise

Overloads:

  • #clockwise?Boolean

    Returns clockwise (true) or counterclockwise (false).

    Returns:

    • (Boolean)

      clockwise (true) or counterclockwise (false)

  • #clockwise=(value) ⇒ Object

    Parameters:

    • value (Boolean)

      clockwise (true) or counterclockwise (false)



52
53
54
# File 'lib/aixm/component/geometry/arc.rb', line 52

def clockwise?
  @clockwise
end

Instance Method Details

#clockwise?Boolean #clockwise=(value) ⇒ Object

Whether the arc is going clockwise

Overloads:

  • #clockwise?Boolean

    Returns clockwise (true) or counterclockwise (false).

    Returns:

    • (Boolean)

      clockwise (true) or counterclockwise (false)

  • #clockwise=(value) ⇒ Object

    Parameters:

    • value (Boolean)

      clockwise (true) or counterclockwise (false)



52
53
54
# File 'lib/aixm/component/geometry/arc.rb', line 52

def clockwise?
  @clockwise
end

#inspectString

Returns:

  • (String)


36
37
38
# File 'lib/aixm/component/geometry/arc.rb', line 36

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