Class: RGeo::Geos::CAPILineImpl

Inherits:
Object
  • Object
show all
Includes:
CAPIGeometryMethods, CAPILineMethods, CAPILineStringMethods
Defined in:
lib/rgeo/geos/capi_feature_classes.rb,
ext/geos_c_impl/globals.c

Overview

:nodoc:

Class Method Summary collapse

Methods included from CAPILineMethods

#geometry_type, #hash

Methods included from CAPILineStringMethods

#closed?, #coordinates, #end_point, #eql?, #geometry_type, #hash, #interpolate_point, #is_closed?, #is_ring?, #length, #num_points, #point_n, #points, #project_point, #rep_equals?, #ring?, #start_point

Methods included from CAPIGeometryMethods

#*, #+, #-, #==, #_as_text, #_steal, #as_binary, #as_text, #boundary, #buffer, #buffer_with_style, #contains?, #convex_hull, #crosses?, #difference, #dimension, #disjoint?, #distance, #empty?, #encode_with, #envelope, #eql?, #equals?, #factory, #factory=, #geometry_type, #init_with, #initialize_copy, #initialized?, #inspect, #intersection, #intersects?, #invalid_reason, #is_empty?, #is_simple?, #marshal_dump, #marshal_load, #overlaps?, #point_on_surface, #prepare!, #prepared?, #relate?, #rep_equals?, #simple?, #simplify, #simplify_preserve_topology, #srid, #sym_difference, #touches?, #unary_union, #union, #valid?, #within?

Class Method Details

._copy_from(factory, original) ⇒ Object


621
622
623
624
# File 'ext/geos_c_impl/line_string.c', line 621

static VALUE cmethod_line_copy_from(VALUE klass, VALUE factory, VALUE original)
{
  return impl_copy_from(klass, factory, original, 1);
}

.create(factory, start, end) ⇒ Object

Class methods for CAPILineImpl


544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
# File 'ext/geos_c_impl/line_string.c', line 544

static VALUE cmethod_create_line(VALUE module, VALUE factory, VALUE start, VALUE end)
{
  VALUE result;
  RGeo_FactoryData* factory_data;
  char has_z;
  VALUE point_type;
  GEOSContextHandle_t context;
  const GEOSGeometry* start_geom;
  const GEOSGeometry* end_geom;
  GEOSCoordSequence* coord_seq;
  GEOSGeometry* geom;

  result = Qnil;
  factory_data = RGEO_FACTORY_DATA_PTR(factory);
  has_z = (char)(factory_data->flags & RGEO_FACTORYFLAGS_SUPPORTS_Z_OR_M);
  point_type = rgeo_feature_point_module;
  context = factory_data->geos_context;

  start_geom = rgeo_convert_to_geos_geometry(factory, start, point_type);
  if (start_geom) {
    end_geom = rgeo_convert_to_geos_geometry(factory, end, point_type);
    if (end_geom) {
      coord_seq = GEOSCoordSeq_create_r(context, 2, 3);
      if (coord_seq) {
        populate_geom_into_coord_seq(context, start_geom, coord_seq, 0, has_z);
        populate_geom_into_coord_seq(context, end_geom, coord_seq, 1, has_z);
        geom = GEOSGeom_createLineString_r(context, coord_seq);
        if (geom) {
          result = rgeo_wrap_geos_geometry(factory, geom, rgeo_geos_line_class);
        }
      }
    }
  }

  return result;
}