Module: RGeo::Geos::FFILineStringMethods

Included in:
FFILineImpl, FFILineStringImpl, FFILinearRingImpl
Defined in:
lib/rgeo/geos/ffi_feature_methods.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#end_pointObject


436
437
438
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 436

def end_point
  point_n(@fg_geom.num_points - 1)
end

#geometry_typeObject


403
404
405
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 403

def geometry_type
  Feature::LineString
end

#hashObject


469
470
471
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 469

def hash
  @hash ||= Utils.ffi_coord_seq_hash(@fg_geom.coord_seq, [@factory, geometry_type].hash)
end

#is_closed?Boolean

Returns:

  • (Boolean)

453
454
455
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 453

def is_closed?
  @fg_geom.closed?
end

#is_ring?Boolean

Returns:

  • (Boolean)

458
459
460
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 458

def is_ring?
  @fg_geom.ring?
end

#lengthObject


408
409
410
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 408

def length
  @fg_geom.length
end

#num_pointsObject


413
414
415
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 413

def num_points
  @fg_geom.num_points
end

#point_n(n_) ⇒ Object


418
419
420
421
422
423
424
425
426
427
428
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 418

def point_n(n_)
  if n_ >= 0 && n_ < @fg_geom.num_points
    coord_seq_ = @fg_geom.coord_seq
    x_ = coord_seq_.get_x(n_)
    y_ = coord_seq_.get_y(n_)
    extra_ = @factory._has_3d ? [coord_seq_.get_z(n_)] : []
    @factory.point(x_, y_, *extra_)
  else
    nil
  end
end

#pointsObject


441
442
443
444
445
446
447
448
449
450
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 441

def points
  coord_seq_ = @fg_geom.coord_seq
  has_3d_ = @factory._has_3d
  ::Array.new(@fg_geom.num_points) do |n_|
    x_ = coord_seq_.get_x(n_)
    y_ = coord_seq_.get_y(n_)
    extra_ = has_3d_ ? [coord_seq_.get_z(n_)] : []
    @factory.point(x_, y_, *extra_)
  end
end

#rep_equals?(rhs_) ⇒ Boolean

Returns:

  • (Boolean)

463
464
465
466
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 463

def rep_equals?(rhs_)
  rhs_.class == self.class && rhs_.factory.eql?(@factory) &&
    Utils.ffi_coord_seqs_equal?(rhs_.fg_geom.coord_seq, @fg_geom.coord_seq, @factory._has_3d)
end

#start_pointObject


431
432
433
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 431

def start_point
  point_n(0)
end