Class: AIXM::Component::Geometry::Arc
- 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
-
#center_xy ⇒ AIXM::XY
Center point.
-
#clockwise ⇒ Boolean
writeonly
Wheter the arc is going clockwise (true) or not (false).
Attributes inherited from Point
Instance Method Summary collapse
-
#clockwise? ⇒ Boolean
Wheter the arc is going clockwise (true) or not (false).
-
#initialize(xy:, center_xy:, clockwise:) ⇒ Arc
constructor
A new instance of Arc.
- #inspect ⇒ String
-
#to_xml ⇒ String
AIXM or OFMX markup.
Constructor Details
#initialize(xy:, center_xy:, clockwise:) ⇒ Arc
Returns a new instance of Arc.
22 23 24 25 |
# File 'lib/aixm/component/geometry/arc.rb', line 22 def initialize(xy:, center_xy:, clockwise:) super(xy: xy) self.center_xy, self.clockwise = center_xy, clockwise end |
Instance Attribute Details
#center_xy ⇒ AIXM::XY
Returns center point.
20 21 22 |
# File 'lib/aixm/component/geometry/arc.rb', line 20 def center_xy @center_xy end |
#clockwise=(value) ⇒ Boolean (writeonly)
Returns wheter the arc is going clockwise (true) or not (false).
39 40 41 |
# File 'lib/aixm/component/geometry/arc.rb', line 39 def clockwise? @clockwise end |
Instance Method Details
#clockwise? ⇒ Boolean
Returns wheter the arc is going clockwise (true) or not (false).
39 40 41 |
# File 'lib/aixm/component/geometry/arc.rb', line 39 def clockwise? @clockwise end |
#inspect ⇒ String
28 29 30 |
# File 'lib/aixm/component/geometry/arc.rb', line 28 def inspect %Q(#<#{self.class} xy="#{xy}" center_xy="#{center_xy}" clockwise=#{clockwise}>) end |
#to_xml ⇒ String
Returns AIXM or OFMX markup.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/aixm/component/geometry/arc.rb', line 49 def to_xml builder = Builder::XmlMarkup.new(indent: 2) builder.Avx do |avx| avx.codeType(clockwise? ? 'CWA' : 'CCA') avx.geoLat(xy.lat(AIXM.schema)) avx.geoLong(xy.long(AIXM.schema)) avx.codeDatum('WGE') avx.geoLatArc(center_xy.lat(AIXM.schema)) avx.geoLongArc(center_xy.long(AIXM.schema)) end end |