提交 d1674eb2 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Documentation and tests

上级 16536c94
......@@ -26,7 +26,15 @@ import org.h2.util.geometry.GeometryUtils.DimensionSystemTarget;
import org.h2.util.geometry.GeometryUtils.Target;
/**
* Utilities for GEOMETRY data type.
* EWKB format support for GEOMETRY data type.
*
* <p>
* This class provides limited support of Well-known Binary Representation from
* OGC 06-103r4 plus PostGIS extensions for SRID support. This class can read
* dimension system marks in both OGC WKB and EWKB formats, but always writes
* them in EWKB format. As an addition POINT EMPTY is stored with NaN values as
* specified in <a href="http://www.geopackage.org/spec/">OGC 12-128r15</a>.
* </p>
*/
public final class EWKBUtils {
......
......@@ -29,7 +29,14 @@ import org.h2.util.geometry.GeometryUtils.DimensionSystemTarget;
import org.h2.util.geometry.GeometryUtils.Target;
/**
* Utilities for GEOMETRY data type.
* EWKT format support for GEOMETRY data type.
*
* <p>
* This class provides limited support of Well-known Text Representation from
* OGC 06-103r4 plus <a href=
* "https://postgis.net/docs/using_postgis_dbmanagement.html#EWKB_EWKT">PostGIS
* extension</a> for SRID support.
* </p>
*/
public final class EWKTUtils {
......
......@@ -106,7 +106,8 @@ public class TestGeometryUtils extends TestBase {
testGeometry("POINT (-1E32 1.000001)", "POINT (-1E32 1.000001)",
"POINT (-100000000000000000000000000000000 1.000001)", 2);
testGeometry("POINT Z (2.7 -3 34)", 3);
assertEquals("POINT Z (1 2 3)", EWKTUtils.ewkb2ewkt(EWKTUtils.ewkt2ewkb("POINTz(1 2 3)")));
assertEquals("POINT Z (1 2 3)", EWKTUtils.ewkb2ewkt(EWKTUtils.ewkt2ewkb("POINTZ(1 2 3)")));
assertEquals("POINT Z (1 2 3)", EWKTUtils.ewkb2ewkt(EWKTUtils.ewkt2ewkb("pointz(1 2 3)")));
}
private void testLineString() throws Exception {
......@@ -227,7 +228,8 @@ public class TestGeometryUtils extends TestBase {
private void testDimensionM() {
byte[] ewkb = EWKTUtils.ewkt2ewkb("POINT M (1 2 3)");
assertEquals("POINT M (1 2 3)", EWKTUtils.ewkb2ewkt(ewkb));
assertEquals("POINT M (1 2 3)", EWKTUtils.ewkb2ewkt(EWKTUtils.ewkt2ewkb("POINTm(1 2 3)")));
assertEquals("POINT M (1 2 3)", EWKTUtils.ewkb2ewkt(EWKTUtils.ewkt2ewkb("POINTM(1 2 3)")));
assertEquals("POINT M (1 2 3)", EWKTUtils.ewkb2ewkt(EWKTUtils.ewkt2ewkb("pointm(1 2 3)")));
Point p = (Point) JTSUtils.ewkb2geometry(ewkb);
CoordinateSequence cs = p.getCoordinateSequence();
assertEquals(4, cs.getDimension());
......@@ -242,7 +244,8 @@ public class TestGeometryUtils extends TestBase {
private void testDimensionZM() {
byte[] ewkb = EWKTUtils.ewkt2ewkb("POINT ZM (1 2 3 4)");
assertEquals("POINT ZM (1 2 3 4)", EWKTUtils.ewkb2ewkt(ewkb));
assertEquals("POINT ZM (1 2 3 4)", EWKTUtils.ewkb2ewkt(EWKTUtils.ewkt2ewkb("POINTzm(1 2 3 4)")));
assertEquals("POINT ZM (1 2 3 4)", EWKTUtils.ewkb2ewkt(EWKTUtils.ewkt2ewkb("POINTZM(1 2 3 4)")));
assertEquals("POINT ZM (1 2 3 4)", EWKTUtils.ewkb2ewkt(EWKTUtils.ewkt2ewkb("pointzm(1 2 3 4)")));
Point p = (Point) JTSUtils.ewkb2geometry(ewkb);
CoordinateSequence cs = p.getCoordinateSequence();
assertEquals(4, cs.getDimension());
......
......@@ -794,3 +794,4 @@ minxf maxxf minyf maxyf bminxf bmaxxf bminyf bmaxyf
minxd maxxd minyd maxyd bminxd bmaxxd bminyd bmaxyd
interior envelopes multilinestring multipoint packed exterior normalization awkward determination subgeometries
xym normalizes coord setz xyzm geometrycollection multipolygon mixup rings polygons rejection finite
pointzm pointz pointm
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论