Class: RGeo::Geos::CAPILineImpl

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

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, #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, #coordinate_dimension, #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, #invalid_reason_location, #is_3d?, #make_valid, #marshal_dump, #marshal_load, #measured?, #overlaps?, #point_on_surface, #polygonize, #prepare!, #prepared?, #relate?, #rep_equals?, #segmentize, #simple?, #simplify, #simplify_preserve_topology, #spatial_dimension, #srid, #sym_difference, #touches?, #unary_union, #union, #valid?, #within?

Methods included from ImplHelper::ValidityCheck

#check_validity!, included, #invalid_reason, #make_valid, override_classes

Methods included from Feature::Type

#add_subtype, #check_type, #each_immediate_subtype, extended, #subtype_of?, #supertype, #type_name

Methods included from Feature::LineString

#num_points, #point_n, #points

Methods included from Feature::Curve

#closed?, #end_point, #length, #ring?, #start_point

Methods included from Feature::Geometry

#*, #+, #-, #==, #as_binary, #as_text, #boundary, #buffer, #contains?, #convex_hull, #coordinate_dimension, #crosses?, #difference, #dimension, #disjoint?, #distance, #empty?, #envelope, #eql?, #equals?, #factory, #geometry_type, #intersection, #intersects?, #is_3d?, #locate_along, #locate_between, #measured?, #overlaps?, #relate?, #rep_equals?, #simple?, #spatial_dimension, #srid, #sym_difference, #touches?, #transform, #unary_union, #union, #within?

Class Method Details

._copy_from(factory, original) ⇒ Object



625
626
627
628
629
# File 'ext/geos_c_impl/line_string.c', line 625

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



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
580
581
582
583
584
585
# File 'ext/geos_c_impl/line_string.c', line 545

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;
  const GEOSGeometry* start_geom;
  const GEOSGeometry* end_geom;
  GEOSCoordSequence* coord_seq;
  GEOSGeometry* geom;
  int state = 0;

  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;

  start_geom =
    rgeo_convert_to_geos_geometry(factory, start, point_type, &state);
  if (state) {
    rb_jump_tag(state);
  }

  end_geom = rgeo_convert_to_geos_geometry(factory, end, point_type, &state);
  if (state) {
    rb_jump_tag(state);
  }

  coord_seq = GEOSCoordSeq_create(2, 3);
  if (coord_seq) {
    populate_geom_into_coord_seq(start_geom, coord_seq, 0, has_z);
    populate_geom_into_coord_seq(end_geom, coord_seq, 1, has_z);
    geom = GEOSGeom_createLineString(coord_seq);
    if (geom) {
      result = rgeo_wrap_geos_geometry(factory, geom, rgeo_geos_line_class);
    }
  }

  return result;
}