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

#coordinatesObject



374
375
376
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 374

def coordinates
  points.map(&:coordinates)
end

#end_pointObject



342
343
344
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 342

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

#geometry_typeObject



316
317
318
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 316

def geometry_type
  Feature::LineString
end

#hashObject



370
371
372
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 370

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

#is_closed?Boolean

Returns:

  • (Boolean)


357
358
359
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 357

def is_closed?
  @fg_geom.closed?
end

#is_ring?Boolean

Returns:

  • (Boolean)


361
362
363
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 361

def is_ring?
  @fg_geom.ring?
end

#lengthObject



320
321
322
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 320

def length
  @fg_geom.length
end

#num_pointsObject



324
325
326
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 324

def num_points
  @fg_geom.num_points
end

#point_n(n_) ⇒ Object



328
329
330
331
332
333
334
335
336
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 328

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_)
  end
end

#pointsObject



346
347
348
349
350
351
352
353
354
355
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 346

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)


365
366
367
368
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 365

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



338
339
340
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 338

def start_point
  point_n(0)
end