lib/rgeo/geography/simple_spherical/point_impl.rb in rgeo-0.1.11 vs lib/rgeo/geography/simple_spherical/point_impl.rb in rgeo-0.1.12

- old
+ new

@@ -44,11 +44,11 @@ class PointImpl include Features::Point include Common::GeometryMethods - include GeometryMethods + include SimpleSpherical::GeometryMethods include Common::PointMethods def initialize(factory_, x_, y_) _set_factory(factory_) @@ -63,18 +63,19 @@ @y = -90.0 if @y < -90.0 super end - def xyz + def _xyz @xyz ||= PointXYZ.from_latlon(@y, @x) end def distance(rhs_) + rhs_ = @factory.cast(rhs_) case rhs_ - when Features::Point - Calculator.point_distance(self, rhs_) + when PointImpl + _xyz.dist_to_point(rhs_._xyz) * SimpleSpherical::RADIUS else super end end