Class: RGeo::Cartesian::PointImpl

Inherits:
Object
  • Object
show all
Includes:
GeometryMethods, Feature::Point, ImplHelper::BasicGeometryMethods, ImplHelper::BasicPointMethods
Defined in:
lib/rgeo/cartesian/feature_classes.rb

Overview

:nodoc:

Constant Summary

Constants included from Feature::Type

Feature::Type::Instance

Instance Method Summary collapse

Methods included from GeometryMethods

#envelope, #srid

Methods included from ImplHelper::BasicPointMethods

#boundary, #convex_hull, #dimension, #envelope, #eql?, #equals?, #geometry_type, #initialize, #is_empty?, #is_simple?, #m, #x, #y, #z

Methods included from ImplHelper::BasicGeometryMethods

#_set_factory, #_validate_geometry, #as_binary, #as_text, #factory, #inspect, #to_s

Methods included from Feature::Point

#m, #x, #y, #z

Methods included from Feature::Type

#check_type, #subtype_of?, #type_name

Methods included from Feature::Geometry

#*, #+, #-, #==, #as_binary, #as_text, #boundary, #buffer, #contains?, #convex_hull, #crosses?, #difference, #dimension, #disjoint?, #envelope, #eql?, #equals?, #factory, #geometry_type, #intersection, #intersects?, #is_empty?, #is_simple?, #overlaps?, #relate, #srid, #sym_difference, #touches?, #union, #within?

Instance Method Details

#distance(rhs_) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/rgeo/cartesian/feature_classes.rb', line 51

def distance(rhs_)
  rhs_ = ::RGeo::Feature.cast(rhs_, @factory)
  case rhs_
  when PointImpl
    dx_ = @x - rhs_.x
    dy_ = @y - rhs_.y
    ::Math.sqrt(dx_ * dx_ + dy_ * dy_)
  else
    super
  end
end