class AIXM::Component::Geometry::Arc
Arcs are clockwise or counter clockwise circle segments around a {#center_xy} and starting at {#xy}.
Cheat Sheet in Pseudo Code:¶ ↑
arc = AIXM.arc( xy: AIXM.xy center_xy: AIXM.xy clockwise: true or false )
Attributes
center_xy[R]
@return [AIXM::XY] center point
Public Class Methods
new(xy:, center_xy:, clockwise:)
click to toggle source
Calls superclass method
# File lib/aixm/component/geometry/arc.rb 22 def initialize(xy:, center_xy:, clockwise:) 23 super(xy: xy) 24 self.center_xy, self.clockwise = center_xy, clockwise 25 end
Public Instance Methods
center_xy=(value)
click to toggle source
# File lib/aixm/component/geometry/arc.rb 32 def center_xy=(value) 33 fail(ArgumentError, "invalid center xy") unless value.is_a? AIXM::XY 34 @center_xy = value 35 end
clockwise=(value)
click to toggle source
# File lib/aixm/component/geometry/arc.rb 43 def clockwise=(value) 44 fail(ArgumentError, "clockwise must be true or false") unless [true, false].include? value 45 @clockwise = value 46 end
clockwise?()
click to toggle source
@!attribute [w] clockwise @return [Boolean] wheter the arc is going clockwise (true) or not (false)
# File lib/aixm/component/geometry/arc.rb 39 def clockwise? 40 @clockwise 41 end
inspect()
click to toggle source
@return [String]
# File lib/aixm/component/geometry/arc.rb 28 def inspect 29 %Q(#<#{self.class} xy="#{xy}" center_xy="#{center_xy}" clockwise=#{clockwise}>) 30 end
to_xml()
click to toggle source
@return [String] AIXM
or OFMX markup
# File lib/aixm/component/geometry/arc.rb 49 def to_xml 50 builder = Builder::XmlMarkup.new(indent: 2) 51 builder.Avx do |avx| 52 avx.codeType(clockwise? ? 'CWA' : 'CCA') 53 avx.geoLat(xy.lat(AIXM.schema)) 54 avx.geoLong(xy.long(AIXM.schema)) 55 avx.codeDatum('WGE') 56 avx.geoLatArc(center_xy.lat(AIXM.schema)) 57 avx.geoLongArc(center_xy.long(AIXM.schema)) 58 end 59 end