lib/aixm/component/geometry/point.rb in aixm-0.2.3 vs lib/aixm/component/geometry/point.rb in aixm-0.3.0
- old
+ new
@@ -1,31 +1,47 @@
+using AIXM::Refinements
+
module AIXM
- module Component
+ class Component
class Geometry
- ##
- # Points are defined by +xy+ coordinates.
- class Point < Base
+ # Points are defined by {#xy} coordinates.
+ #
+ # ===Cheat Sheet in Pseudo Code:
+ # point = AIXM.point(
+ # xy: AIXM.xy
+ # )
+ #
+ # @see https://github.com/openflightmaps/ofmx/wiki/Airspace#point
+ class Point
extend Forwardable
- using AIXM::Refinements
- def_delegators :xy, :to_digest
+ def_delegators :xy
+ # @return [AIXM::XY] (starting) point
attr_reader :xy
def initialize(xy:)
- fail(ArgumentError, "invalid xy") unless xy.is_a? AIXM::XY
- @xy = xy
+ self.xy = xy
end
- ##
- # Render AIXM markup
- def to_aixm(*extensions)
+ # @return [String]
+ def inspect
+ %Q(#<#{self.class} xy="#{xy.to_s}">)
+ end
+
+ def xy=(value)
+ fail(ArgumentError, "invalid xy") unless value.is_a? AIXM::XY
+ @xy = value
+ end
+
+ # @return [String] AIXM or OFMX markup
+ def to_xml
builder = Builder::XmlMarkup.new(indent: 2)
builder.Avx do |avx|
avx.codeType('GRC')
- avx.geoLat(xy.lat(format_for(*extensions)))
- avx.geoLong(xy.long(format_for(*extensions)))
+ avx.geoLat(xy.lat(AIXM.schema))
+ avx.geoLong(xy.long(AIXM.schema))
avx.codeDatum('WGE')
end
end
end