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
Classes: ArgumentError, Error, FrozenIndexError, Geom, Index, Line, ParseError, Polygon, Rect, Registry, Ring, Segment
Constant Summary
collapse
- VERSION =
"0.1.0"
Class Method Summary
collapse
Class Method Details
._debug_fail_next_entries_alloc! ⇒ Object
2800
2801
2802
2803
2804
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2800
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
2824
2825
2826
2827
2828
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2824
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
2806
2807
2808
2809
2810
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2806
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
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2812
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
2792
2793
2794
2795
2796
2797
2798
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2792
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
991
992
993
994
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 991
static VALUE rb_tg_geometry_empty_geometrycollection(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_geometrycollection_empty());
}
|
.empty_linestring ⇒ Object
966
967
968
969
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 966
static VALUE rb_tg_geometry_empty_linestring(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_linestring_empty());
}
|
.empty_multilinestring ⇒ Object
981
982
983
984
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 981
static VALUE rb_tg_geometry_empty_multilinestring(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_multilinestring_empty());
}
|
.empty_multipoint ⇒ Object
976
977
978
979
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 976
static VALUE rb_tg_geometry_empty_multipoint(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_multipoint_empty());
}
|
.empty_multipolygon ⇒ Object
986
987
988
989
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 986
static VALUE rb_tg_geometry_empty_multipolygon(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_multipolygon_empty());
}
|
.empty_point ⇒ Object
961
962
963
964
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 961
static VALUE rb_tg_geometry_empty_point(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_point_empty());
}
|
.empty_polygon ⇒ Object
971
972
973
974
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 971
static VALUE rb_tg_geometry_empty_polygon(VALUE self) {
(void)self;
return wrap_constructed_geom(tg_geom_new_polygon_empty());
}
|
.parse(*args) ⇒ Object
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 767
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
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_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
786
787
788
789
790
791
792
793
794
795
796
797
798
799
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 786
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
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_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
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_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
801
802
803
804
805
806
807
808
809
810
811
812
813
814
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 801
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
896
897
898
899
900
901
902
903
904
905
906
907
908
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 896
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
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 926
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
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 910
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
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
|
# File 'ext/tg_geometry/tg_geometry_ext.c', line 942
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));
}
|