22 #include "../Config.h" 57 CPPUNIT_ASSERT(pt2D->
getSRID() == 2378);
68 CPPUNIT_ASSERT(ptM->
getSRID() == 2378);
79 CPPUNIT_ASSERT(ptZ->
getSRID() == 2378);
90 CPPUNIT_ASSERT(ptZM->
getSRID() == 2378);
101 CPPUNIT_ASSERT(l2D->
getSRID() == 2378);
112 CPPUNIT_ASSERT(lM->
getSRID() == 2378);
123 CPPUNIT_ASSERT(lZ->
getSRID() == 2378);
134 CPPUNIT_ASSERT(lZM->
getSRID() == 2378);
145 CPPUNIT_ASSERT(pol2D->
getSRID() == 2378);
156 CPPUNIT_ASSERT(polM->
getSRID() == 2378);
167 CPPUNIT_ASSERT(polZ->
getSRID() == 2378);
178 CPPUNIT_ASSERT(polZM->
getSRID() == 2378);
189 CPPUNIT_ASSERT(gc2D->
getSRID() == 2378);
200 CPPUNIT_ASSERT(gcM->
getSRID() == 2378);
211 CPPUNIT_ASSERT(gcZ->
getSRID() == 2378);
222 CPPUNIT_ASSERT(gcZM->
getSRID() == 2378);
233 CPPUNIT_ASSERT(mpt2D->
getSRID() == 2378);
244 CPPUNIT_ASSERT(mptM->
getSRID() == 2378);
255 CPPUNIT_ASSERT(mptZ->
getSRID() == 2378);
266 CPPUNIT_ASSERT(mptZM->
getSRID() == 2378);
277 CPPUNIT_ASSERT(ml2D->
getSRID() == 2378);
288 CPPUNIT_ASSERT(mlM->
getSRID() == 2378);
299 CPPUNIT_ASSERT(mlZ->
getSRID() == 2378);
310 CPPUNIT_ASSERT(mlZM->
getSRID() == 2378);
321 CPPUNIT_ASSERT(mpoly2D->
getSRID() == 2378);
332 CPPUNIT_ASSERT(mpolyM->
getSRID() == 2378);
343 CPPUNIT_ASSERT(mpolyZ->
getSRID() == 2378);
354 CPPUNIT_ASSERT(mpolyZM->
getSRID() == 2378);
363 CPPUNIT_ASSERT(polyhedral2D->
getGeometryType() ==
"PolyhedralSurface");
365 CPPUNIT_ASSERT(polyhedral2D->
getSRID() == 2378);
376 CPPUNIT_ASSERT(polyhedralM->
getSRID() == 2378);
387 CPPUNIT_ASSERT(polyhedralZ->
getSRID() == 2378);
396 CPPUNIT_ASSERT(polyhedralZM->
getGeometryType() ==
"PolyhedralSurface");
398 CPPUNIT_ASSERT(polyhedralZM->
getSRID() == 2378);
404 CPPUNIT_ASSERT(
typeid(*tin2D) ==
typeid(
te::gm::TIN));
409 CPPUNIT_ASSERT(tin2D->
getSRID() == 2378);
415 CPPUNIT_ASSERT(
typeid(*tinM) ==
typeid(
te::gm::TIN));
420 CPPUNIT_ASSERT(tinM->
getSRID() == 2378);
426 CPPUNIT_ASSERT(
typeid(*tinZ) ==
typeid(
te::gm::TIN));
431 CPPUNIT_ASSERT(tinZ->
getSRID() == 2378);
437 CPPUNIT_ASSERT(
typeid(*tinZM) ==
typeid(
te::gm::TIN));
442 CPPUNIT_ASSERT(tinZM->
getSRID() == 2378);
453 CPPUNIT_ASSERT(tri2D->
getSRID() == 2378);
464 CPPUNIT_ASSERT(triM->
getSRID() == 2378);
475 CPPUNIT_ASSERT(triZ->
getSRID() == 2378);
486 CPPUNIT_ASSERT(triZM->
getSRID() == 2378);
497 CPPUNIT_ASSERT(pt.
getX() == 27.3);
498 CPPUNIT_ASSERT(pt.
getY() == 28.5);
499 CPPUNIT_ASSERT(pt.
getZ() == TE_DOUBLE_NOT_A_NUMBER);
500 CPPUNIT_ASSERT(pt.
getM() == TE_DOUBLE_NOT_A_NUMBER);
505 CPPUNIT_ASSERT(pt.
getSRID() == 4326);
507 CPPUNIT_ASSERT(pt.
getSRID() == 4128);
509 CPPUNIT_ASSERT(pt.
getSRID() == 4326);
512 std::unique_ptr<te::gm::Geometry> envelope(pt.
getEnvelope());
514 CPPUNIT_ASSERT(pt.
getMBR());
526 CPPUNIT_ASSERT(pt.
asText() ==
"point(18.9 9.81)");
531 CPPUNIT_ASSERT(size == 21);
532 char* wkb =
new char[size];
536 const char* validHWKB =
"01010000006666666666E632401F85EB51B89E2340";
537 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
544 CPPUNIT_ASSERT(size == 21);
547 const char* validHWKB =
"01010000006666666666E632401F85EB51B89E2340";
548 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
552 CPPUNIT_ASSERT(pt.
isEmpty() ==
false);
553 CPPUNIT_ASSERT(pt.
isSimple() ==
true);
554 CPPUNIT_ASSERT(pt.
isValid() ==
true);
555 CPPUNIT_ASSERT(pt.
is3D() ==
false);
557 std::unique_ptr<te::gm::Geometry> boundary(pt.
getBoundary());
561 std::unique_ptr<te::gm::Geometry> pt_clone(static_cast<te::gm::Geometry*>(pt.
clone()));
562 CPPUNIT_ASSERT(pt.
equals((pt_clone.get())));
563 CPPUNIT_ASSERT(pt.
disjoint(pt_clone.get()) ==
false);
564 CPPUNIT_ASSERT(pt.
intersects(pt_clone.get()));
565 CPPUNIT_ASSERT(pt.
touches(pt_clone.get()) ==
false);
577 CPPUNIT_ASSERT(pt.
getX() == 27.3);
578 CPPUNIT_ASSERT(pt.
getY() == 28.5);
579 CPPUNIT_ASSERT(pt.
getZ() == 99.9);
580 CPPUNIT_ASSERT(pt.
getM() == TE_DOUBLE_NOT_A_NUMBER);
585 CPPUNIT_ASSERT(pt.
getSRID() == 4326);
587 CPPUNIT_ASSERT(pt.
getSRID() == 4128);
589 CPPUNIT_ASSERT(pt.
getSRID() == 4326);
592 std::unique_ptr<te::gm::Geometry> envelope(pt.
getEnvelope());
594 CPPUNIT_ASSERT(pt.
getMBR());
607 CPPUNIT_ASSERT(pt.
asText() ==
"point z(18.9 9.81 77.7)");
612 CPPUNIT_ASSERT(size == 29);
613 char* wkb =
new char[size];
617 const char* validHWKB =
"01E90300006666666666E632401F85EB51B89E2340CDCCCCCCCC6C5340";
618 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
625 CPPUNIT_ASSERT(size == 29);
628 const char* validHWKB =
"01E90300006666666666E632401F85EB51B89E2340CDCCCCCCCC6C5340";
629 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
633 CPPUNIT_ASSERT(pt.
isEmpty() ==
false);
634 CPPUNIT_ASSERT(pt.
isSimple() ==
true);
635 CPPUNIT_ASSERT(pt.
isValid() ==
true);
636 CPPUNIT_ASSERT(pt.
is3D() ==
true);
638 std::unique_ptr<te::gm::Geometry> boundary(pt.
getBoundary());
642 std::unique_ptr<te::gm::Geometry> pt_clone(static_cast<te::gm::Geometry*>(pt.
clone()));
643 CPPUNIT_ASSERT(pt.
equals((pt_clone.get())));
644 CPPUNIT_ASSERT(pt.
disjoint(pt_clone.get()) ==
false);
645 CPPUNIT_ASSERT(pt.
intersects(pt_clone.get()));
646 CPPUNIT_ASSERT(pt.
touches(pt_clone.get()) ==
false);
658 CPPUNIT_ASSERT(pt.
getX() == 27.3);
659 CPPUNIT_ASSERT(pt.
getY() == 28.5);
660 CPPUNIT_ASSERT(pt.
getZ() == TE_DOUBLE_NOT_A_NUMBER);
661 CPPUNIT_ASSERT(pt.
getM() == 99.9);
666 CPPUNIT_ASSERT(pt.
getSRID() == 4326);
668 CPPUNIT_ASSERT(pt.
getSRID() == 4128);
670 CPPUNIT_ASSERT(pt.
getSRID() == 4326);
673 std::unique_ptr<te::gm::Geometry> envelope(pt.
getEnvelope());
675 CPPUNIT_ASSERT(pt.
getMBR());
688 CPPUNIT_ASSERT(pt.
asText() ==
"point m(18.9 9.81 77.7)");
693 CPPUNIT_ASSERT(size == 29);
694 char* wkb =
new char[size];
698 const char* validHWKB =
"01D10700006666666666E632401F85EB51B89E2340CDCCCCCCCC6C5340";
699 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
706 CPPUNIT_ASSERT(size == 29);
709 const char* validHWKB =
"01D10700006666666666E632401F85EB51B89E2340CDCCCCCCCC6C5340";
710 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
714 CPPUNIT_ASSERT(pt.
isEmpty() ==
false);
715 CPPUNIT_ASSERT(pt.
isSimple() ==
true);
716 CPPUNIT_ASSERT(pt.
isValid() ==
true);
717 CPPUNIT_ASSERT(pt.
is3D() ==
false);
719 std::unique_ptr<te::gm::Geometry> boundary(pt.
getBoundary());
723 std::unique_ptr<te::gm::Geometry> pt_clone(static_cast<te::gm::Geometry*>(pt.
clone()));
724 CPPUNIT_ASSERT(pt.
equals(pt_clone.get()));
725 CPPUNIT_ASSERT(pt.
disjoint(pt_clone.get()) ==
false);
726 CPPUNIT_ASSERT(pt.
intersects(pt_clone.get()));
727 CPPUNIT_ASSERT(pt.
touches(pt_clone.get()) ==
false);
740 CPPUNIT_ASSERT(pt.
getX() == 27.3);
741 CPPUNIT_ASSERT(pt.
getY() == 28.5);
742 CPPUNIT_ASSERT(pt.
getZ() == 99.9);
743 CPPUNIT_ASSERT(pt.
getM() == 180.0);
748 CPPUNIT_ASSERT(pt.
getSRID() == 4326);
750 CPPUNIT_ASSERT(pt.
getSRID() == 4128);
752 CPPUNIT_ASSERT(pt.
getSRID() == 4326);
755 std::unique_ptr<te::gm::Geometry> envelope(pt.
getEnvelope());
757 CPPUNIT_ASSERT(pt.
getMBR());
771 CPPUNIT_ASSERT(pt.
asText() ==
"point zm(18.9 9.81 77.7 55.5)");
776 CPPUNIT_ASSERT(size == 37);
777 char* wkb =
new char[size];
781 const char* validHWKB =
"01B90B00006666666666E632401F85EB51B89E2340CDCCCCCCCC6C53400000000000C04B40";
782 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
789 CPPUNIT_ASSERT(size == 37);
792 const char* validHWKB =
"01B90B00006666666666E632401F85EB51B89E2340CDCCCCCCCC6C53400000000000C04B40";
793 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
797 CPPUNIT_ASSERT(pt.
isEmpty() ==
false);
798 CPPUNIT_ASSERT(pt.
isSimple() ==
true);
799 CPPUNIT_ASSERT(pt.
isValid() ==
true);
800 CPPUNIT_ASSERT(pt.
is3D() ==
true);
802 std::unique_ptr<te::gm::Geometry> boundary(pt.
getBoundary());
805 std::unique_ptr<te::gm::Geometry> pt_clone(static_cast<te::gm::Geometry*>(pt.
clone()));
806 CPPUNIT_ASSERT(pt.
equals(pt_clone.get()));
807 CPPUNIT_ASSERT(pt.
disjoint(pt_clone.get()) ==
false);
808 CPPUNIT_ASSERT(pt.
intersects(pt_clone.get()));
809 CPPUNIT_ASSERT(pt.
touches(pt_clone.get()) ==
false);
821 CPPUNIT_ASSERT(line.
getX(0) == 1.0);
822 CPPUNIT_ASSERT(line.
getY(0) == 1.5);
823 CPPUNIT_ASSERT(line.
getX(1) == 3.0);
824 CPPUNIT_ASSERT(line.
getY(1) == 3.3);
825 CPPUNIT_ASSERT(line.
getX(2) == 3.1);
826 CPPUNIT_ASSERT(line.
getY(2) == 2.1);
831 CPPUNIT_ASSERT(line.
getSRID() == 4326);
833 CPPUNIT_ASSERT(line.
getSRID() == 4128);
835 CPPUNIT_ASSERT(line.
getSRID() == 4326);
838 std::unique_ptr<te::gm::Geometry> envelope(line.
getEnvelope());
840 CPPUNIT_ASSERT(line.
getMBR());
852 CPPUNIT_ASSERT(line.
asText() ==
"linestring(1 1.5,3 3.3,18.9 9.81)");
857 CPPUNIT_ASSERT(size == 57);
858 char* wkb =
new char[size];
862 const char* validHWKB =
"010200000003000000000000000000F03F000000000000F83F00000000000008406666666666660A406666666666E632401F85EB51B89E2340";
863 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
870 CPPUNIT_ASSERT(size == 57);
873 const char* validHWKB =
"010200000003000000000000000000F03F000000000000F83F00000000000008406666666666660A406666666666E632401F85EB51B89E2340";
874 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
878 CPPUNIT_ASSERT(line.
isEmpty() ==
false);
879 CPPUNIT_ASSERT(line.
isSimple() ==
true);
880 CPPUNIT_ASSERT(line.
isValid() ==
true);
881 CPPUNIT_ASSERT(line.
is3D() ==
false);
883 std::unique_ptr<te::gm::Geometry> boundary(line.
getBoundary());
887 std::unique_ptr<te::gm::Geometry> line_clone(static_cast<te::gm::Geometry*>(line.
clone()));
888 CPPUNIT_ASSERT(line.
equals(line_clone.get()));
889 CPPUNIT_ASSERT(line.
disjoint(line_clone.get()) ==
false);
890 CPPUNIT_ASSERT(line.
intersects(line_clone.get()));
891 CPPUNIT_ASSERT(line.
touches(line_clone.get()) ==
false);
903 CPPUNIT_ASSERT(line.
getX(0) == 1.0);
904 CPPUNIT_ASSERT(line.
getY(0) == 1.5);
905 CPPUNIT_ASSERT(line.
getZ(0) == 8.1);
906 CPPUNIT_ASSERT(line.
getX(1) == 3.0);
907 CPPUNIT_ASSERT(line.
getY(1) == 3.3);
908 CPPUNIT_ASSERT(line.
getZ(1) == 9.2);
909 CPPUNIT_ASSERT(line.
getX(2) == 3.1);
910 CPPUNIT_ASSERT(line.
getY(2) == 2.1);
911 CPPUNIT_ASSERT(line.
getZ(2) == 10.3);
916 CPPUNIT_ASSERT(line.
getSRID() == 4326);
918 CPPUNIT_ASSERT(line.
getSRID() == 4128);
920 CPPUNIT_ASSERT(line.
getSRID() == 4326);
923 std::unique_ptr<te::gm::Geometry> envelope(line.
getEnvelope());
925 CPPUNIT_ASSERT(line.
getMBR());
938 CPPUNIT_ASSERT(line.
asText() ==
"linestring z(1 1.5 8.1,3 3.3 9.2,18.9 9.81 19.81)");
943 CPPUNIT_ASSERT(size == 81);
944 char* wkb =
new char[size];
948 const char* validHWKB =
"01EA03000003000000000000000000F03F000000000000F83F333333333333204000000000000008406666666666660A4066666666666622406666666666E632401F85EB51B89E23408FC2F5285CCF3340";
949 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
956 CPPUNIT_ASSERT(size == 81);
959 const char* validHWKB =
"01EA03000003000000000000000000F03F000000000000F83F333333333333204000000000000008406666666666660A4066666666666622406666666666E632401F85EB51B89E23408FC2F5285CCF3340";
960 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
964 CPPUNIT_ASSERT(line.
isEmpty() ==
false);
965 CPPUNIT_ASSERT(line.
isSimple() ==
true);
966 CPPUNIT_ASSERT(line.
isValid() ==
true);
967 CPPUNIT_ASSERT(line.
is3D() ==
true);
969 std::unique_ptr<te::gm::Geometry> boundary(line.
getBoundary());
973 std::unique_ptr<te::gm::Geometry> line_clone(static_cast<te::gm::Geometry*>(line.
clone()));
974 CPPUNIT_ASSERT(line.
equals(line_clone.get()));
975 CPPUNIT_ASSERT(line.
disjoint(line_clone.get()) ==
false);
976 CPPUNIT_ASSERT(line.
intersects(line_clone.get()));
977 CPPUNIT_ASSERT(line.
touches(line_clone.get()) ==
false);
989 CPPUNIT_ASSERT(line.
getX(0) == 1.0);
990 CPPUNIT_ASSERT(line.
getY(0) == 1.5);
991 CPPUNIT_ASSERT(line.
getM(0) == 8.1);
992 CPPUNIT_ASSERT(line.
getX(1) == 3.0);
993 CPPUNIT_ASSERT(line.
getY(1) == 3.3);
994 CPPUNIT_ASSERT(line.
getM(1) == 9.2);
995 CPPUNIT_ASSERT(line.
getX(2) == 3.1);
996 CPPUNIT_ASSERT(line.
getY(2) == 2.1);
997 CPPUNIT_ASSERT(line.
getM(2) == 10.3);
1002 CPPUNIT_ASSERT(line.
getSRID() == 4326);
1004 CPPUNIT_ASSERT(line.
getSRID() == 4128);
1006 CPPUNIT_ASSERT(line.
getSRID() == 4326);
1009 std::unique_ptr<te::gm::Geometry> envelope(line.
getEnvelope());
1011 CPPUNIT_ASSERT(line.
getMBR());
1018 line.
setM(2, 19.81);
1024 CPPUNIT_ASSERT(line.
asText() ==
"linestring m(1 1.5 8.1,3 3.3 9.2,18.9 9.81 19.81)");
1029 CPPUNIT_ASSERT(size == 81);
1030 char* wkb =
new char[size];
1034 const char* validHWKB =
"01D207000003000000000000000000F03F000000000000F83F333333333333204000000000000008406666666666660A4066666666666622406666666666E632401F85EB51B89E23408FC2F5285CCF3340";
1035 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
1042 CPPUNIT_ASSERT(size == 81);
1045 const char* validHWKB =
"01D207000003000000000000000000F03F000000000000F83F333333333333204000000000000008406666666666660A4066666666666622406666666666E632401F85EB51B89E23408FC2F5285CCF3340";
1046 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
1050 CPPUNIT_ASSERT(line.
isEmpty() ==
false);
1051 CPPUNIT_ASSERT(line.
isSimple() ==
true);
1052 CPPUNIT_ASSERT(line.
isValid() ==
true);
1053 CPPUNIT_ASSERT(line.
is3D() ==
false);
1055 std::unique_ptr<te::gm::Geometry> boundary(line.
getBoundary());
1059 std::unique_ptr<te::gm::Geometry> line_clone(static_cast<te::gm::Geometry*>(line.
clone()));
1060 CPPUNIT_ASSERT(line.
equals(line_clone.get()));
1061 CPPUNIT_ASSERT(line.
disjoint(line_clone.get()) ==
false);
1062 CPPUNIT_ASSERT(line.
intersects(line_clone.get()));
1063 CPPUNIT_ASSERT(line.
touches(line_clone.get()) ==
false);
1075 CPPUNIT_ASSERT(line.
getX(0) == 1.0);
1076 CPPUNIT_ASSERT(line.
getY(0) == 1.5);
1077 CPPUNIT_ASSERT(line.
getZ(0) == 8.1);
1078 CPPUNIT_ASSERT(line.
getM(0) == 21.3);
1079 CPPUNIT_ASSERT(line.
getX(1) == 3.0);
1080 CPPUNIT_ASSERT(line.
getY(1) == 3.3);
1081 CPPUNIT_ASSERT(line.
getZ(1) == 9.2);
1082 CPPUNIT_ASSERT(line.
getM(1) == 98.4);
1083 CPPUNIT_ASSERT(line.
getX(2) == 3.1);
1084 CPPUNIT_ASSERT(line.
getY(2) == 2.1);
1085 CPPUNIT_ASSERT(line.
getZ(2) == 10.3);
1086 CPPUNIT_ASSERT(line.
getM(2) == 63.7);
1091 CPPUNIT_ASSERT(line.
getSRID() == 4326);
1093 CPPUNIT_ASSERT(line.
getSRID() == 4128);
1095 CPPUNIT_ASSERT(line.
getSRID() == 4326);
1098 std::unique_ptr<te::gm::Geometry> envelope(line.
getEnvelope());
1100 CPPUNIT_ASSERT(line.
getMBR());
1107 line.
setZ(2, 19.81);
1114 CPPUNIT_ASSERT(line.
asText() ==
"linestring zm(1 1.5 8.1 21.3,3 3.3 9.2 98.4,18.9 9.81 19.81 43.5)");
1119 CPPUNIT_ASSERT(size == 105);
1120 char* wkb =
new char[size];
1124 const char* validHWKB =
"01BA0B000003000000000000000000F03F000000000000F83F3333333333332040CDCCCCCCCC4C354000000000000008406666666666660A4066666666666622409A999999999958406666666666E632401F85EB51B89E23408FC2F5285CCF33400000000000C04540";
1125 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
1132 CPPUNIT_ASSERT(size == 105);
1135 const char* validHWKB =
"01BA0B000003000000000000000000F03F000000000000F83F3333333333332040CDCCCCCCCC4C354000000000000008406666666666660A4066666666666622409A999999999958406666666666E632401F85EB51B89E23408FC2F5285CCF33400000000000C04540";
1136 CPPUNIT_ASSERT(strcmp(hwkb, validHWKB) == 0);
1140 CPPUNIT_ASSERT(line.
isEmpty() ==
false);
1141 CPPUNIT_ASSERT(line.
isSimple() ==
true);
1142 CPPUNIT_ASSERT(line.
isValid() ==
true);
1143 CPPUNIT_ASSERT(line.
is3D() ==
true);
1145 std::unique_ptr<te::gm::Geometry> boundary(line.
getBoundary());
1149 std::unique_ptr<te::gm::Geometry> line_clone(static_cast<te::gm::Geometry*>(line.
clone()));
1150 CPPUNIT_ASSERT(line.
equals(line_clone.get()));
1151 CPPUNIT_ASSERT(line.
disjoint(line_clone.get()) ==
false);
1152 CPPUNIT_ASSERT(line.
intersects(line_clone.get()));
1153 CPPUNIT_ASSERT(line.
touches(line_clone.get()) ==
false);
1170 CPPUNIT_ASSERT(poly.
getRingN(9) == 0);
1171 CPPUNIT_ASSERT(poly[9] == 0);
1185 CPPUNIT_ASSERT(poly.
getArea() == 0.0);
1186 std::unique_ptr<te::gm::Geometry> centroid1(poly.
getCentroid());
1194 CPPUNIT_ASSERT(poly.
getSRID() == 4326);
1196 CPPUNIT_ASSERT(poly.
getSRID() == 4128);
1198 CPPUNIT_ASSERT(poly.
getSRID() == 4326);
1201 std::unique_ptr<te::gm::Geometry> envelope(poly.
getEnvelope());
1203 CPPUNIT_ASSERT(poly.
getMBR());
1204 std::string polytext = poly.
asText();
1205 CPPUNIT_ASSERT(poly.
asText() ==
"polygon()");
1208 CPPUNIT_ASSERT(poly.
isEmpty() ==
true);
1209 CPPUNIT_ASSERT(poly.
isSimple() ==
true);
1210 CPPUNIT_ASSERT(poly.
isValid() ==
true);
1211 CPPUNIT_ASSERT(poly.
is3D() ==
false);
1213 std::unique_ptr<te::gm::Geometry> boundary(poly.
getBoundary());
1217 std::unique_ptr<te::gm::Geometry> clone(static_cast<te::gm::Geometry*>(poly.
clone()));
1218 CPPUNIT_ASSERT(poly.
equals(clone.get()));
1219 CPPUNIT_ASSERT(poly.
disjoint(clone.get()) ==
false);
1220 CPPUNIT_ASSERT(poly.
intersects(clone.get()));
1221 CPPUNIT_ASSERT(poly.
touches(clone.get()));
1247 std::vector<WKBEntry> hwkbVec;
1251 std::cout << std::endl <<
" Reading geom from wkt, transforming to New SRID and transforing back to the Orig SRID" << std::endl;
1252 for(
size_t i = 0; i < hwkbVec.size(); ++i)
1258 CPPUNIT_ASSERT(g.get());
1260 std::cout << std::endl;
1261 std::cout <<
" SRID= " << hwkb.
m_srid <<
" asText= " << hwkb.
m_wkt << std::endl;
1264 CPPUNIT_ASSERT_NO_THROW(g->transform(3031));
1265 std::string ustring1 = g->asText();
1266 std::cout <<
" New SRID= " << g->getSRID() <<
" asText= " << ustring1 << std::endl;
1269 CPPUNIT_ASSERT_NO_THROW(g->transform(hwkb.
m_srid ));
1270 std::string ustring2 = g->asText();
1271 std::cout <<
" Orig SRID= " << g->getSRID() <<
" asText= " << ustring2 << std::endl;
1274 std::cout << std::endl;
1284 std::vector<WKBEntry> hwkbVec;
1288 std::cout << std::endl <<
" Create a geom from wkt and check geom->asText()..." << std::endl;
1289 for(
size_t i = 0; i < hwkbVec.size(); ++i)
1295 CPPUNIT_ASSERT(g.get());
1299 std::cout << std::endl <<
" hwkb.m_wkt = " << hwkb.
m_wkt << std::endl;
1300 std::cout << std::endl <<
" g->asText() = " << g->asText() << std::endl;
1304 std::cout << std::endl;
1312 std::vector<WKBEntry> hwkbVec;
1316 for(
size_t i = 0; i < hwkbVec.size(); ++i)
1322 CPPUNIT_ASSERT(g.get());
1327 CPPUNIT_ASSERT(g->getCoordinateDimension() == hwkb.
m_ndims);
1330 CPPUNIT_ASSERT(g->getSRID() == hwkb.
m_srid);
1331 std::unique_ptr<te::gm::Geometry> envelope(g->getEnvelope());
1333 CPPUNIT_ASSERT(g->getMBR());
1335 std::cout << std::endl << g->asText() << std::endl;
1336 std::cout <<
"hwkb.m_wkt=" << hwkb.
m_wkt << std::endl;
1338 char* myWkb = g->asBinary(wkbSize);
1341 CPPUNIT_ASSERT(myHwkb == hwkb.
m_hwkb);
1344 CPPUNIT_ASSERT(g->isEmpty() ==
false);
1348 CPPUNIT_ASSERT(g->isSimple() ==
true);
1349 CPPUNIT_ASSERT(g->isValid() ==
true);
1350 std::unique_ptr<te::gm::Geometry> boundary;
1351 CPPUNIT_ASSERT_NO_THROW(boundary.reset(g->getBoundary()));
1352 CPPUNIT_ASSERT(boundary.get());
1354 CPPUNIT_ASSERT(g->is3D() == hwkb.
m_is3D);
1374 CPPUNIT_ASSERT(f != NULL);
1378 std::vector<std::string> values;
1379 std::string value(
"");
1383 char c = (char)(fgetc(f));
1387 values.push_back(value);
1393 values.push_back(value);
1400 if(values.size() != 9)
1406 fe.
m_srid = atoi(values[1].c_str());
1409 fe.
m_ndims = atoi(values[4].c_str());
1410 fe.
m_wkt = values[5];
1412 fe.
m_is3D = values[7] ==
"t";
1415 hwkbVec.push_back(fe);
void setZ(std::size_t i, const double &z)
It sets the n-th z coordinate value.
const std::string & getGeometryType() const
The name of the Geometry subtype is: MultiLineString.
Dimensionality getDimension() const
Surfaces are 2-dimensional objects.
PolyhedralSurface is a contiguous collection of polygons, which share common boundary segments...
std::size_t getNumRings() const
It returns the number of rings in this CurvePolygon.
void tcCreatePolygon()
Test Case: Creating a polygon.
Curve * getInteriorRingN(std::size_t i) const
It returns the n-th interior ring for this curve polygon as a curve.
virtual Dimensionality getDimension() const
For non-homogeneous collections this method will return the largest dimension of the contained object...
void add(Curve *ring)
It adds the ring to the curve polygon.
void push_back(Curve *ring)
It adds the curve to the curve polygon.
MultiPolygon is a MultiSurface whose elements are Polygons.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
void tcCreatePoint()
Test Case: Creating a point object.
void computeMBR(bool cascade) const
It computes the minimum bounding rectangle for the linestring.
void setX(std::size_t i, const double &x)
It sets the n-th x coordinate value.
void setSRID(int srid) _NOEXCEPT_OP(true)
It sets the Spatial Reference System ID of the Point.
void setSRID(int srid)
It sets the Spatial Reference System ID of the geometry and all its parts if it is a GeometryCollecti...
Dimensionality getDimension() const
MultiPoint is 0-dimensional.
std::string Convert2LCase(const std::string &value)
It converts a string to lower case.
void loadGeometry(std::vector< WKBEntry > &hwkbVec) const
Auxiliary method for reading geometry information from an ASCII file.
char * Hex2Binary(const char *hex)
It converts each pair of hex characters from a NULL-terminated string of hex characters into a binary...
void tcCreatePolygonZM()
Test Case: Creating a polygon with ZM values.
virtual te::dt::AbstractData * clone() const
It clones the linestring.
void computeMBR(bool cascade) const _NOEXCEPT_OP(true)
It computes the minimum bounding rectangle for the point.
std::size_t getNumInteriorRings() const
It returns the number of interior rings in this CurvePolygon.
const std::string & getGeometryType() const
It returns the name of the instantiable subtype of Geometry of which this geometric object is an inst...
virtual const std::string & getGeometryType() const
The name of the Geometry subtype is: GeometryCollection.
bool isMeasured() const _NOEXCEPT_OP(true)
It returns true if this geometric object has m coordinate values.
GeomType getGeomTypeId() const _NOEXCEPT_OP(true)
It returns the geometry subclass type identifier.
Curve * getExteriorRing() const
It returns the exterior ring of this CurvePolygon.
double m_urx
Upper right corner x-coordinate.
void tcCreateLineStringZM()
Test Case: Creating a linestring with z and m value.
static const MachineByteOrder sm_machineByteOrder
A flag that indicates the machine byte order (Big Endian or Little Endian).
virtual bool disjoint(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if the geometry object is spatially disjoint from rhs geometry.
void tcCreatePolygonZ()
Test Case: Creating a polygon with Z values.
std::string Convert2UCase(const std::string &value)
It converts a string to upper case.
Dimensionality getDimension() const _NOEXCEPT_OP(true)
Points are 0-dimensional objects.
void tcCreateLineStringM()
Test Case: Creating a linestring with m value.
void removeRingN(std::size_t i)
It removes the n-th ring in this CurvePolygon.
static std::string fromUTF8(const std::string &src)
Convert a string in UTF-8 to the current locale encoding.
virtual bool intersects(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if the geometry object spatially intersects rhs geometry.
Proxy file for the real file terralib_defines.h.
virtual bool touches(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if the geometry object spatially touches rhs geometry.
virtual bool isSimple() const _NOEXCEPT_OP(false)
It returns true if this geometric object has no anomalous points, such as self intersection or self t...
std::size_t getWkbSize() const _NOEXCEPT_OP(true)
It returns the size required by a WKB representation for this geometric object.
Dimensionality getDimension() const
MultiSurface is 2-dimenional.
An static class with global definitions.
void tcCreatePointZ()
Test Case: Creating a point with z value.
const double & getY(std::size_t i) const
It returns the n-th y coordinate value.
virtual te::dt::AbstractData * clone() const
It clones the linestring.
void setNumRings(std::size_t size)
It sets the number of rings in this curve polygon.
TIN (triangulated irregular network) is a PolyhedralSurface consisting only of Triangle patches...
Test suite for the Vector Geometry Model.
int getSRID() const _NOEXCEPT_OP(true)
It returns the Spatial Reference System ID associated to this geometric object.
const std::string & getGeometryType() const
The name of the Geometry subtype is: MultiPolygon.
MultiPoint is a GeometryCollection whose elements are restricted to points.
double m_llx
Lower left corner x-coordinate.
Geometry * getEnvelope() const _NOEXCEPT_OP(true)
It returns the minimum bounding rectangle (MBR) for the geometry.
std::size_t getNPoints() const
it returns the number of points (vertexes) in the geometry.
LineString is a curve with linear interpolation between points.
void tcBasicGeometryMethods()
Test Case: testing the basic geometry methods.
Triangle is a polygon with 3 distinct, non-collinear vertices and no interior boundary.
std::size_t getNPoints() const _NOEXCEPT_OP(true)
it returns the number of points (vertexes) in the geometry.
const double & getY() const
It returns the Point y-coordinate value.
A point with x and y coordinate values.
const Envelope * getMBR() const _NOEXCEPT_OP(true)
It returns the minimum bounding rectangle for the geometry in an internal representation.
void setPoint(std::size_t i, const double &x, const double &y)
It sets the value of the specified point.
virtual bool isValid() const _NOEXCEPT_OP(false)
It tells if the geometry is well formed.
virtual te::dt::AbstractData * clone() const
It clones the point.
const double & getX(std::size_t i) const
It returns the n-th x coordinate value.
std::string asText() const _NOEXCEPT_OP(true)
It returns an string with the Well-Known Text Representation for the geometry.
void setM(const double &m)
It sets the Point m-coordinate value.
Dimensionality
From Wikipedia: "in mathematics, the dimension of an object is an intrinsic property, independent of the space in which the object may happen to be embedded".
Dimensionality getDimension() const
MultiCurves are 1-dimensional.
virtual bool isEmpty() const _NOEXCEPT_OP(false)
It returns true if this geometric object is the empty Geometry.
Point * getPointOnSurface() const
It returns a point guaranteed to be on this surface.
virtual const std::string & getGeometryType() const
The name of the geometry subtype for PolyhedralSurface is: PolyhedralSurface.
void tcCreatePointM()
Test Case: Creating a point with m value.
This file contains several utilities functions for dealing with HEX strings.
std::size_t getNPoints() const
It returns the number of points (vertexes) in the linestring.
A class for handling character enconding/decoding.
void setPointZ(std::size_t i, const double &x, const double &y, const double &z)
It sets the value of the specified point.
bool is3D() const _NOEXCEPT_OP(true)
It returns true if this geometric object has z coordinate values.
char * asBinary(std::size_t &size) const _NOEXCEPT_OP(false)
It serializes the geometric object to a Well-known Binary Representation (WKB).
Coord2D * getCoordOnSurface() const
It returns a coordinate guaranteed to be on this surface.
void tcMisc()
Test Case: Creating several type of objects and testing some basic methods.
const double & getZ() const
It returns the Point z-coordinate value, if it has one or DoubleNotANumber otherwise.
double m_lly
Lower left corner y-coordinate.
void setM(std::size_t i, const double &m)
It sets the n-th m measure value.
double getArea() const
It returns the area of this surface, as measured in the spatial reference system of this surface...
MultiLineString is a MultiCurve whose elements are LineStrings.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
void setPointZM(std::size_t i, const double &x, const double &y, const double &z, const double &m)
It sets the value of the specified point.
void setX(const double &x)
It sets the Point x-coordinate value.
Test suite for the Vector Geometry Model.
double m_ury
Upper right corner y-coordinate.
Dimensionality getDimension() const
Curves are 1-dimensional objects.
const std::string & getGeometryType() const _NOEXCEPT_OP(true)
The name of instantiable subtype is: Point.
void tcCreatePointZM()
Test Case: Creating a point with z and m value.
Coord2D * getCentroidCoord() const
It returns the mathematical centroid for this surface as a coordinate.
void tcCreatePolygonM()
Test Case: Creating a polygon with M values.
Point * getCentroid() const
It returns the mathematical centroid for this surface as a point.
void clear()
It deletes all the rings of the CurvePolygon and clear it.
void setSRID(int srid)
It sets the Spatial Reference System ID of the linestring.
virtual Geometry * getBoundary() const _NOEXCEPT_OP(false)
It returns the geometry boundary.
const double & getM() const
It returns the Point m-coordinate value, if it has one or DoubleNotANumber otherwise.
const double & getZ(std::size_t i) const
It returns the n-th z coordinate value.
This file contains include headers for the TerraLib Common Runtime module.
void setPointM(std::size_t i, const double &x, const double &y, const double &m)
It sets the value of the specified point.
virtual const std::string & getGeometryType() const
It returns the name of the instantiable subtype of Geometry of which this geometric object is an inst...
const double & getM(std::size_t i) const
It returns the n-th m measure value.
void tcAsText()
Test Case: Reading (binary) geometries and getting the WKT.
void setY(const double &y)
It sets the Point y-coordinate value.
void setY(std::size_t i, const double &y)
It sets the n-th y coordinate value.
This file contains include headers for the Vector Geometry model of TerraLib.
void tcSpatialRelationsMethods()
Test Case: testing the basic geometry methods.
const std::string & getGeometryType() const
The name of the instantiable subtype of geometry: MultiPoint.
void tcCreateLineStringZ()
Test Case: Creating a linestring with z value.
It is a collection of other geometric objects.
char * Binary2Hex(const char *s, std::size_t size)
Each char from the array of characters in binary format is converted into a pair of hex characters...
CPPUNIT_TEST_SUITE_REGISTRATION(TsGeometry)
const double & getX() const
It returns the Point x-coordinate value.
void tcTransform()
Test Case: Reading WKT geometries and conveting to another proj SRID.
int getCoordinateDimension() const _NOEXCEPT_OP(true)
It returns the number of measurements or axes needed to describe a position in a coordinate system...
Curve * getRingN(std::size_t i) const
It returns the n-th ring for this curve polygon as a curve.
static Geometry * read(const char *wkb)
It returns a valid geometry from a given WKB.
void setZ(const double &z)
It sets the Point z-coordinate value.
virtual bool equals(const Geometry *const rhs, const bool exact=false) const _NOEXCEPT_OP(false)
It returns true if the geometry object is spatially equal to rhs geometry.
void setRingN(std::size_t i, Curve *r)
It sets the informed position ring to the new one.
void getWkb(char *wkb, te::common::MachineByteOrder byteOrder) const _NOEXCEPT_OP(false)
It serializes the geometry to a WKB representation into the specified buffer.
static Geometry * read(const char *wkt)
It returns a valid Geometry from a given WKT.
void tcCreateLineString()
Test Case: Creating a linestring object.
const std::string & getGeometryType() const
The name of instantiable subtype is: LineString.