Module: TG::Geometry
- Defined in:
- lib/tg/geometry/version.rb,
lib/tg/geometry/registry.rb,
lib/tg/geometry/active_record_source.rb,
ext/tg_geometry/tg_geometry_ext.c
Defined Under Namespace
Modules: ActiveRecordSource, FeatureSource
Classes: ArgumentError, Error, FrozenIndexError, Geom, Index, Line, ParseError, Polygon, Rect, Registry, Ring, Segment
Constant Summary
collapse
- VERSION =
"0.2.0"
Class Method Summary
collapse
Class Method Details
._debug_fail_next_entries_alloc! ⇒ Object
2830
2831
2832
2833
2834
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2830
static VALUE rb_tg_geometry_debug_fail_next_entries_alloc(VALUE self) {
(void)self;
tg_debug_fail_next_entries_alloc = true;
return Qnil;
}
|
._debug_fail_next_match_buffer_alloc! ⇒ Object
2854
2855
2856
2857
2858
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2854
static VALUE rb_tg_geometry_debug_fail_next_match_buffer_alloc(VALUE self) {
(void)self;
tg_debug_fail_next_match_buffer_alloc = true;
return Qnil;
}
|
._debug_fail_next_rtree_alloc! ⇒ Object
2836
2837
2838
2839
2840
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2836
static VALUE rb_tg_geometry_debug_fail_next_rtree_alloc(VALUE self) {
(void)self;
tg_debug_fail_rtree_alloc_countdown = 0;
return Qnil;
}
|
._debug_fail_rtree_alloc_after!(count_value) ⇒ Object
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2842
static VALUE rb_tg_geometry_debug_fail_rtree_alloc_after(VALUE self, VALUE count_value) {
long count;
(void)self;
count = NUM2LONG(count_value);
if (count < 0) {
rb_raise(eTGGeometryArgumentError, "count must be >= 0");
}
tg_debug_fail_rtree_alloc_countdown = count;
return Qnil;
}
|
._debug_reset_test_hooks! ⇒ Object
2822
2823
2824
2825
2826
2827
2828
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2822
static VALUE rb_tg_geometry_debug_reset_test_hooks(VALUE self) {
(void)self;
tg_debug_fail_next_entries_alloc = false;
tg_debug_fail_rtree_alloc_countdown = -1;
tg_debug_fail_next_match_buffer_alloc = false;
return Qnil;
}
|
.empty_geometrycollection ⇒ Object
1021
1022
1023
1024
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1021
static VALUE rb_tg_geometry_empty_geometrycollection(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_geometrycollection_empty());
}
|
.empty_linestring ⇒ Object
996
997
998
999
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 996
static VALUE rb_tg_geometry_empty_linestring(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_linestring_empty());
}
|
.empty_multilinestring ⇒ Object
1011
1012
1013
1014
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1011
static VALUE rb_tg_geometry_empty_multilinestring(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_multilinestring_empty());
}
|
.empty_multipoint ⇒ Object
1006
1007
1008
1009
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1006
static VALUE rb_tg_geometry_empty_multipoint(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_multipoint_empty());
}
|
.empty_multipolygon ⇒ Object
1016
1017
1018
1019
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1016
static VALUE rb_tg_geometry_empty_multipolygon(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_multipolygon_empty());
}
|
.empty_point ⇒ Object
991
992
993
994
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 991
static VALUE rb_tg_geometry_empty_point(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_point_empty());
}
|
.empty_polygon ⇒ Object
1001
1002
1003
1004
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 1001
static VALUE rb_tg_geometry_empty_polygon(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_polygon_empty());
}
|
.parse(*args) ⇒ Object
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 797
static VALUE rb_tg_geometry_parse(int argc, VALUE *argv, VALUE self) {
VALUE input;
VALUE kwargs;
VALUE format_value;
VALUE index_value;
enum tg_geometry_parse_format format;
enum tg_index index;
(void)self;
rb_scan_args(argc, argv, "1:", &input, &kwargs);
format_value = kwargs_value(kwargs, id_format, ID2SYM(id_auto));
index_value = kwargs_value(kwargs, id_index, ID2SYM(id_ystripes));
format = parse_format_symbol(format_value);
index = parse_index_symbol(index_value);
return parse_string_with_format(input, format, index);
}
|
.parse_geobin(*args) ⇒ Object
876
877
878
879
880
881
882
883
884
885
886
887
888
889
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 876
static VALUE rb_tg_geometry_parse_geobin(int argc, VALUE *argv, VALUE self) {
VALUE input;
VALUE kwargs;
VALUE index_value;
enum tg_index index;
(void)self;
rb_scan_args(argc, argv, "1:", &input, &kwargs);
index_value = kwargs_value(kwargs, id_index, ID2SYM(id_ystripes));
index = parse_index_symbol(index_value);
return parse_string_with_format(input, TG_GEOMETRY_FORMAT_GEOBIN, index);
}
|
.parse_geojson(*args) ⇒ Object
816
817
818
819
820
821
822
823
824
825
826
827
828
829
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 816
static VALUE rb_tg_geometry_parse_geojson(int argc, VALUE *argv, VALUE self) {
VALUE input;
VALUE kwargs;
VALUE index_value;
enum tg_index index;
(void)self;
rb_scan_args(argc, argv, "1:", &input, &kwargs);
index_value = kwargs_value(kwargs, id_index, ID2SYM(id_ystripes));
index = parse_index_symbol(index_value);
return parse_string_with_format(input, TG_GEOMETRY_FORMAT_GEOJSON, index);
}
|
.parse_hex(*args) ⇒ Object
861
862
863
864
865
866
867
868
869
870
871
872
873
874
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 861
static VALUE rb_tg_geometry_parse_hex(int argc, VALUE *argv, VALUE self) {
VALUE input;
VALUE kwargs;
VALUE index_value;
enum tg_index index;
(void)self;
rb_scan_args(argc, argv, "1:", &input, &kwargs);
index_value = kwargs_value(kwargs, id_index, ID2SYM(id_ystripes));
index = parse_index_symbol(index_value);
return parse_string_with_format(input, TG_GEOMETRY_FORMAT_HEX, index);
}
|
.parse_wkb(*args) ⇒ Object
846
847
848
849
850
851
852
853
854
855
856
857
858
859
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 846
static VALUE rb_tg_geometry_parse_wkb(int argc, VALUE *argv, VALUE self) {
VALUE input;
VALUE kwargs;
VALUE index_value;
enum tg_index index;
(void)self;
rb_scan_args(argc, argv, "1:", &input, &kwargs);
index_value = kwargs_value(kwargs, id_index, ID2SYM(id_ystripes));
index = parse_index_symbol(index_value);
return parse_string_with_format(input, TG_GEOMETRY_FORMAT_WKB, index);
}
|
.parse_wkt(*args) ⇒ Object
831
832
833
834
835
836
837
838
839
840
841
842
843
844
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 831
static VALUE rb_tg_geometry_parse_wkt(int argc, VALUE *argv, VALUE self) {
VALUE input;
VALUE kwargs;
VALUE index_value;
enum tg_index index;
(void)self;
rb_scan_args(argc, argv, "1:", &input, &kwargs);
index_value = kwargs_value(kwargs, id_index, ID2SYM(id_ystripes));
index = parse_index_symbol(index_value);
return parse_string_with_format(input, TG_GEOMETRY_FORMAT_WKT, index);
}
|
.point(x_value, y_value) ⇒ Object
926
927
928
929
930
931
932
933
934
935
936
937
938
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 926
static VALUE rb_tg_geometry_point(VALUE self, VALUE x_value, VALUE y_value) {
double x = NUM2DBL(x_value);
double y = NUM2DBL(y_value);
struct tg_point point;
(void)self;
check_finite_double(x, "x");
check_finite_double(y, "y");
point.x = x;
point.y = y;
return wrap_constructed_geom(tg_geom_new_point(point));
}
|
.point_m(x_value, y_value, m_value) ⇒ Object
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 956
static VALUE rb_tg_geometry_point_m(VALUE self, VALUE x_value, VALUE y_value, VALUE m_value) {
double x = NUM2DBL(x_value);
double y = NUM2DBL(y_value);
double m = NUM2DBL(m_value);
struct tg_point point;
(void)self;
check_finite_double(x, "x");
check_finite_double(y, "y");
check_finite_double(m, "m");
point.x = x;
point.y = y;
return wrap_constructed_geom(tg_geom_new_point_m(point, m));
}
|
.point_z(x_value, y_value, z_value) ⇒ Object
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 940
static VALUE rb_tg_geometry_point_z(VALUE self, VALUE x_value, VALUE y_value, VALUE z_value) {
double x = NUM2DBL(x_value);
double y = NUM2DBL(y_value);
double z = NUM2DBL(z_value);
struct tg_point point;
(void)self;
check_finite_double(x, "x");
check_finite_double(y, "y");
check_finite_double(z, "z");
point.x = x;
point.y = y;
return wrap_constructed_geom(tg_geom_new_point_z(point, z));
}
|
.point_zm(x_value, y_value, z_value, m_value) ⇒ Object
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 972
static VALUE rb_tg_geometry_point_zm(VALUE self, VALUE x_value, VALUE y_value, VALUE z_value,
VALUE m_value) {
double x = NUM2DBL(x_value);
double y = NUM2DBL(y_value);
double z = NUM2DBL(z_value);
double m = NUM2DBL(m_value);
struct tg_point point;
(void)self;
check_finite_double(x, "x");
check_finite_double(y, "y");
check_finite_double(z, "z");
check_finite_double(m, "m");
point.x = x;
point.y = y;
return wrap_constructed_geom(tg_geom_new_point_zm(point, z, m));
}
|