diff --git a/GNUmakefile.in b/GNUmakefile.in index d05cde399181746f87b2b10dd2e78ebaefb4479c..5556e3968a3d9abf5ad66ef2922342c33623f365 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -6,7 +6,7 @@ SUBDIRS = liblwgeom ifeq (@LIBLWGEOM_ONLY@,no) -SUBDIRS += libpgcommon postgis regress @RASTER@ @TOPOLOGY@ @SFCGAL@ loader utils doc @EXTENSIONS@ @DEPS_SUBDIR@ +SUBDIRS += libpgcommon postgis regress @RASTER@ @TOPOLOGY@ @SFCGAL@ loader endif ifeq (@CHECK_GEOGRIDCODER@,yes) @@ -17,6 +17,11 @@ ifeq (@CHECK_GEOMODEL@,yes) SUBDIRS += geomodel endif + +ifeq (@LIBLWGEOM_ONLY@,no) +SUBDIRS += utils doc @EXTENSIONS@ @DEPS_SUBDIR@ pyramid +endif + HAVE_SFCGAL=@HAVE_SFCGAL@ POSTGIS_MAJOR_VERSION=@POSTGIS_MAJOR_VERSION@ diff --git a/README.md b/README.md index b5b394e2885f4ae91cacdba14a2eefc56bc2bbbe..d96ce5d8147c079491db7d2e03e431173faa2db0 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,8 @@ Yukon(禹贡),基于 PostgreSQL 数据库扩展地理空间数据的存储 3. postgis_sfcgal:与 PostgreSQL 适配的 PostGIS 三维算法相关模块; 4. yukon_geomodel:Yukon 的三维模型数据模块; 5. yukon_geogridcoder:Yukon 的网格编码模块。 +6. yukon_vector_pyramid:Yukon 的矢量金字塔模块。 -模块之间的依赖关系如图: -![模块依赖图](doc/html/images/yukon_model_info.png "Yukon模块依赖图.png") 帮助文档参见 [Yukon在线文档](https://yukon.supermap.io/)。 \ No newline at end of file diff --git a/configure.ac b/configure.ac index ef6a864efff31d78b098e05beaf61973d3cd0450..5110c385d74e99a94691fda688b3303f6adce60a 100644 --- a/configure.ac +++ b/configure.ac @@ -1012,6 +1012,8 @@ else GEOMODEL_MAKEFILE_LIST="" fi +PYRAMID_MAKEFILE_LIST="pyramid/Makefile" + dnl =========================================================================== dnl Detect if protobuf-c installed dnl =========================================================================== @@ -1747,7 +1749,8 @@ AC_OUTPUT([GNUmakefile $RT_MAKEFILE_LIST $GEOGRIDCODER_MAKEFILE_LIST $GEOMODEL_MAKEFILE_LIST - $DEPS_MAKEFILE_LIST]) + $DEPS_MAKEFILE_LIST + $PYRAMID_MAKEFILE_LIST]) dnl =========================================================================== dnl Display the configuration status information diff --git a/geogridcoder/GSGUtil.cpp b/geogridcoder/GSGUtil.cpp index accf79e60598fbe1644eb00ac989f703923f3f9c..e5bdf31ca777ab6212af818a2690dec38b119ba7 100644 --- a/geogridcoder/GSGUtil.cpp +++ b/geogridcoder/GSGUtil.cpp @@ -2,7 +2,7 @@  *  * GSGUtil.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C) 2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geogridcoder/GSGUtil.h b/geogridcoder/GSGUtil.h index 8045035d796a9cfbfda811e56b85ba3eb7f30d10..70bed8e8f51a10f7f837c0ae5b9a23fe83cf0871 100644 --- a/geogridcoder/GSGUtil.h +++ b/geogridcoder/GSGUtil.h @@ -2,7 +2,7 @@  *  * GSGUtil.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C) 2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geogridcoder/GeoGrid.cpp b/geogridcoder/GeoGrid.cpp index 9f3cd6cd771df0c925498e03fa05f56c67ce31b9..8a306f7279deda14df15d45a34a8580da7cc9433 100644 --- a/geogridcoder/GeoGrid.cpp +++ b/geogridcoder/GeoGrid.cpp @@ -2,7 +2,7 @@  *  * GeoGrid.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C) 2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License @@ -477,8 +477,36 @@ Datum gsg_geosotgridagg(PG_FUNCTION_ARGS) result_array_data[i] = Datum(val); } - Oid namespaceId = GetSysCacheOid1(NAMESPACENAME, Anum_pg_namespace_oid, CStringGetDatum("public")); - Oid typ_ID = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid, PointerGetDatum("geosotgrid"), ObjectIdGetDatum(namespaceId)); + SysScanDesc scandesc; + HeapTuple tuple; + ScanKeyData entry[1]; + Oid nsp_oid = InvalidOid; + Oid ext_oid = get_extension_oid("yukon_geogridcoder", true); + if (ext_oid != InvalidOid) + { + Relation rel = table_open(ExtensionRelationId, AccessShareLock); + ScanKeyInit(&entry[0], Anum_pg_extension_oid, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(ext_oid)); + scandesc = systable_beginscan(rel, ExtensionOidIndexId, true, + NULL, 1, entry); + tuple = systable_getnext(scandesc); + if (HeapTupleIsValid(tuple)) + nsp_oid = ((Form_pg_extension)GETSTRUCT(tuple))->extnamespace; + else + nsp_oid = InvalidOid; + + systable_endscan(scandesc); + table_close(rel, AccessShareLock); + } + else + { + const char* proname = "gsg_geosotgrid"; + List* names = stringToQualifiedNameList(proname); + FuncCandidateList clist = FuncnameGetCandidates(names, -1, NIL, false, false, false); + if (!clist) + nsp_oid = InvalidOid; + nsp_oid = get_func_namespace(clist->oid); + } + Oid typ_ID = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid, PointerGetDatum("geosotgrid"), ObjectIdGetDatum(nsp_oid)); int16 elmlen; bool elmbyval; @@ -617,8 +645,36 @@ Datum gsg_geosotgrid(PG_FUNCTION_ARGS) } lwgeom_free(geom); - Oid namespaceId = GetSysCacheOid1(NAMESPACENAME, Anum_pg_namespace_oid, CStringGetDatum("public")); - Oid typ_ID = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid, PointerGetDatum("geosotgrid"), ObjectIdGetDatum(namespaceId)); + SysScanDesc scandesc; + HeapTuple tuple; + ScanKeyData entry[1]; + Oid nsp_oid = InvalidOid; + Oid ext_oid = get_extension_oid("yukon_geogridcoder", true); + if (ext_oid != InvalidOid) + { + Relation rel = table_open(ExtensionRelationId, AccessShareLock); + ScanKeyInit(&entry[0], Anum_pg_extension_oid, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(ext_oid)); + scandesc = systable_beginscan(rel, ExtensionOidIndexId, true, + NULL, 1, entry); + tuple = systable_getnext(scandesc); + if (HeapTupleIsValid(tuple)) + nsp_oid = ((Form_pg_extension)GETSTRUCT(tuple))->extnamespace; + else + nsp_oid = InvalidOid; + + systable_endscan(scandesc); + table_close(rel, AccessShareLock); + } + else + { + const char* proname = "gsg_geosotgrid"; + List* names = stringToQualifiedNameList(proname); + FuncCandidateList clist = FuncnameGetCandidates(names, -1, NIL, false, false, false); + if (!clist) + nsp_oid = InvalidOid; + nsp_oid = get_func_namespace(clist->oid); + } + Oid typ_ID = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid, PointerGetDatum("geosotgrid"), ObjectIdGetDatum(nsp_oid)); int16 elmlen; bool elmbyval; @@ -1178,8 +1234,37 @@ Datum gsg_geom_from_geosotgrid_array(PG_FUNCTION_ARGS) int16 elmlen; bool elmbyval; char elmalign; - Oid namespaceId = GetSysCacheOid1(NAMESPACENAME, Anum_pg_namespace_oid, CStringGetDatum("public")); - Oid typ_ID = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid, PointerGetDatum("geometry"), ObjectIdGetDatum(namespaceId)); + + SysScanDesc scandesc; + HeapTuple tuple; + ScanKeyData entry[1]; + Oid nsp_oid = InvalidOid; + Oid ext_oid = get_extension_oid("postgis", true); + if (ext_oid != InvalidOid) + { + Relation rel = table_open(ExtensionRelationId, AccessShareLock); + ScanKeyInit(&entry[0], Anum_pg_extension_oid, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(ext_oid)); + scandesc = systable_beginscan(rel, ExtensionOidIndexId, true, + NULL, 1, entry); + tuple = systable_getnext(scandesc); + if (HeapTupleIsValid(tuple)) + nsp_oid = ((Form_pg_extension)GETSTRUCT(tuple))->extnamespace; + else + nsp_oid = InvalidOid; + + systable_endscan(scandesc); + table_close(rel, AccessShareLock); + } + else + { + const char* proname = "postgis_full_version"; + List* names = stringToQualifiedNameList(proname); + FuncCandidateList clist = FuncnameGetCandidates(names, -1, NIL, false, false, false); + if (!clist) + nsp_oid = InvalidOid; + nsp_oid = get_func_namespace(clist->oid); + } + Oid typ_ID = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid, PointerGetDatum("geometry"), ObjectIdGetDatum(nsp_oid)); get_typlenbyvalalign(typ_ID, &elmlen, &elmbyval, &elmalign); ArrayType *result = construct_array(result_array_data, nelems, typ_ID, elmlen, elmbyval, elmalign); @@ -1423,8 +1508,37 @@ Datum gsg_aggregate_array(PG_FUNCTION_ARGS) bool elmbyval; char elmalign; - Oid namespaceId = GetSysCacheOid1(NAMESPACENAME, Anum_pg_namespace_oid, CStringGetDatum("public")); - Oid typ_ID = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid, PointerGetDatum("geosotgrid"), ObjectIdGetDatum(namespaceId)); + SysScanDesc scandesc; + HeapTuple tuple; + ScanKeyData entry[1]; + Oid nsp_oid = InvalidOid; + Oid ext_oid = get_extension_oid("yukon_geogridcoder", true); + if (ext_oid != InvalidOid) + { + Relation rel = table_open(ExtensionRelationId, AccessShareLock); + ScanKeyInit(&entry[0], Anum_pg_extension_oid, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(ext_oid)); + scandesc = systable_beginscan(rel, ExtensionOidIndexId, true, + NULL, 1, entry); + tuple = systable_getnext(scandesc); + if (HeapTupleIsValid(tuple)) + nsp_oid = ((Form_pg_extension)GETSTRUCT(tuple))->extnamespace; + else + nsp_oid = InvalidOid; + + systable_endscan(scandesc); + table_close(rel, AccessShareLock); + } + else + { + const char* proname = "gsg_geosotgrid"; + List* names = stringToQualifiedNameList(proname); + FuncCandidateList clist = FuncnameGetCandidates(names, -1, NIL, false, false, false); + if (!clist) + nsp_oid = InvalidOid; + nsp_oid = get_func_namespace(clist->oid); + } + Oid typ_ID = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid, PointerGetDatum("geosotgrid"), ObjectIdGetDatum(nsp_oid)); + get_typlenbyvalalign(typ_ID, &elmlen, &elmbyval, &elmalign); ArrayType *result = construct_array(result_array_data, nelems, typ_ID, data_size, elmbyval, elmalign); if (GEOSOTGRIDSIZE == data_size) diff --git a/geogridcoder/GeoGrid.h b/geogridcoder/GeoGrid.h index 9f42233ebcc922b200aefed5d2a3790ecbe6b79f..62ec329bd88637548c9803caeab2a6efa98a6943 100644 --- a/geogridcoder/GeoGrid.h +++ b/geogridcoder/GeoGrid.h @@ -2,7 +2,7 @@  *  * GeoGrid.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C) 2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License @@ -22,15 +22,21 @@ #define GEOGRID_H_ extern "C" { -#include "../libpgcommon/lwgeom_pg.h" -#include "../liblwgeom/liblwgeom.h" #include "postgres.h" #include "fmgr.h" #include "rtpostgis.h" +#include "access/genam.h" +#include "access/table.h" +#include "access/htup_details.h" #include "utils/array.h" #include "utils/syscache.h" +#include "utils/fmgroids.h" +#include "utils/regproc.h" #include "catalog/pg_type.h" #include "catalog/pg_namespace_d.h" +#include "catalog/pg_extension.h" +#include "catalog/indexing.h" +#include "commands/extension.h" } #include diff --git a/geogridcoder/RasterizeHash.cpp b/geogridcoder/RasterizeHash.cpp index 9c81414819bfe36802b7b8a9692e69e9c0078655..42b11681b17b33459ce76ae5876e753051f23e84 100644 --- a/geogridcoder/RasterizeHash.cpp +++ b/geogridcoder/RasterizeHash.cpp @@ -2,7 +2,7 @@  *  * rasterize_hash.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C) 2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geogridcoder/RasterizeHash.h b/geogridcoder/RasterizeHash.h index 39415ce7fd3a3236b2122c6c5adc1465ae8c24d8..c2349cbd233094487d1393035ec26c0942e69352 100644 --- a/geogridcoder/RasterizeHash.h +++ b/geogridcoder/RasterizeHash.h @@ -2,7 +2,7 @@  *  * rasterize_hash.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C) 2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geogridcoder/geomgrid_ops.cpp b/geogridcoder/geomgrid_ops.cpp index c118894b1528a52638e8f267d3c8fff12f70bb1c..be6341a626ae16f6ef8e0060f0f83c7aeabe6be3 100644 --- a/geogridcoder/geomgrid_ops.cpp +++ b/geogridcoder/geomgrid_ops.cpp @@ -2,7 +2,7 @@  *  * geomgrid_ops.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C) 2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geogridcoder/geosot.cpp b/geogridcoder/geosot.cpp index cd835d27406c1eb539cbb9d1b447dc0e7a0300b2..2b0deb0e0cb893a2865f3ba8789522899fd6c82e 100644 --- a/geogridcoder/geosot.cpp +++ b/geogridcoder/geosot.cpp @@ -2,7 +2,7 @@  *  * geosot.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C) 2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geogridcoder/geosot.h b/geogridcoder/geosot.h index f20a0382a13957242033a57a848788e7d3e8ade2..b8b762f3f3cd61b904b564657d51e13e9ccae2f6 100644 --- a/geogridcoder/geosot.h +++ b/geogridcoder/geosot.h @@ -2,7 +2,7 @@  *  * geosot.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C) 2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geogridcoder/rasterize_grid.cpp b/geogridcoder/rasterize_grid.cpp index 4256225280027537d33523d94e3c8927e8b9c5a9..14cfbbf35e16e4bce2bfbe14080f0761834cad95 100644 --- a/geogridcoder/rasterize_grid.cpp +++ b/geogridcoder/rasterize_grid.cpp @@ -2,7 +2,7 @@  *  * rasterize_grid.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C) 2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geogridcoder/rasterize_grid.h b/geogridcoder/rasterize_grid.h index 27530f0b7a6f41c599a5a8fe5c40d3c8749edffa..d570b701c8181a3005a21fbf4bc793db18d5d813 100644 --- a/geogridcoder/rasterize_grid.h +++ b/geogridcoder/rasterize_grid.h @@ -2,7 +2,7 @@  *  * rasterize_grid.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C) 2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkArray.h b/geomodel/libUGC/Include/Base/YkArray.h index 1e4413546896b00b90bf27eaab7372028d52ae64..715f553909a5401239a90371aa2b6152c075b715 100644 --- a/geomodel/libUGC/Include/Base/YkArray.h +++ b/geomodel/libUGC/Include/Base/YkArray.h @@ -2,7 +2,7 @@  *  * YkArray.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkColorDef.h b/geomodel/libUGC/Include/Base/YkColorDef.h index 8f7d85e07858e40a5d934b5b620f3e1677d02df8..a9505032f83bf9f3763aa7e1d9fc08152e2ea800 100644 --- a/geomodel/libUGC/Include/Base/YkColorDef.h +++ b/geomodel/libUGC/Include/Base/YkColorDef.h @@ -2,7 +2,7 @@  *  * YkColorDef.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkDefs.h b/geomodel/libUGC/Include/Base/YkDefs.h index 1dff5708d3893842b91e50c0258783308348fc3f..427cd5550d866349638dd513520079c03d88d7d9 100644 --- a/geomodel/libUGC/Include/Base/YkDefs.h +++ b/geomodel/libUGC/Include/Base/YkDefs.h @@ -2,7 +2,7 @@  *  * YkDefs.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkDict.h b/geomodel/libUGC/Include/Base/YkDict.h index 98dae59f9901ab586eaf77722aa7b9ea681f3891..5ba0f80c0053ec84f5dd91e8f46ca8e21c505900 100644 --- a/geomodel/libUGC/Include/Base/YkDict.h +++ b/geomodel/libUGC/Include/Base/YkDict.h @@ -2,7 +2,7 @@  *  * YkDict.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkExports.h b/geomodel/libUGC/Include/Base/YkExports.h index 0e6565978e829b8bdbb93eb25c596183d30c5eb8..3a687d91fa33b388236f50a5d154a14eb612cb31 100644 --- a/geomodel/libUGC/Include/Base/YkExports.h +++ b/geomodel/libUGC/Include/Base/YkExports.h @@ -2,7 +2,7 @@  *  * YkExports.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkList.h b/geomodel/libUGC/Include/Base/YkList.h index b4b8b9392a4461558c6b20e7989443a69dc17ff5..7a5519bb7c1d7781aad3e4bbc6df4c97d14d93a0 100644 --- a/geomodel/libUGC/Include/Base/YkList.h +++ b/geomodel/libUGC/Include/Base/YkList.h @@ -2,7 +2,7 @@  *  * YkList.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkPlatform.h b/geomodel/libUGC/Include/Base/YkPlatform.h index 97d70409d4bb03d4f0b1314caa2def3459815f6f..ed0c2568ad4c13100a022f5721ec091ba1475a19 100644 --- a/geomodel/libUGC/Include/Base/YkPlatform.h +++ b/geomodel/libUGC/Include/Base/YkPlatform.h @@ -2,7 +2,7 @@  *  * YkPlatform.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkPoint.h b/geomodel/libUGC/Include/Base/YkPoint.h index 34d077cfd97fe0803fb5cb07b8a197b3f4743f23..f5432d13c9681b5cfc2434d85dc61c5cd74d0f7d 100644 --- a/geomodel/libUGC/Include/Base/YkPoint.h +++ b/geomodel/libUGC/Include/Base/YkPoint.h @@ -2,7 +2,7 @@  *  * YkPoint.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkPoint2D.h b/geomodel/libUGC/Include/Base/YkPoint2D.h index 35c4c7cfecd3c30b16377738d3fdb44fba177cff..f9985adf95cdc5b33ebf5622c2fdf34d217a1ba2 100644 --- a/geomodel/libUGC/Include/Base/YkPoint2D.h +++ b/geomodel/libUGC/Include/Base/YkPoint2D.h @@ -2,7 +2,7 @@  *  * YkPoint2D.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkPoint3D.h b/geomodel/libUGC/Include/Base/YkPoint3D.h index b1d94821e63e10f876ee37655af2fc24dcd230db..2ced5fd9ae8b0721d41a38f0b8dab8b5c76ba383 100644 --- a/geomodel/libUGC/Include/Base/YkPoint3D.h +++ b/geomodel/libUGC/Include/Base/YkPoint3D.h @@ -2,7 +2,7 @@  *  * YkPoint3D.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkRect.h b/geomodel/libUGC/Include/Base/YkRect.h index cfd2e64c30dcdb82520d70ac9186a9cc2e8bab0d..af394b21b77d02812ae0895097dd4c4357fe9019 100644 --- a/geomodel/libUGC/Include/Base/YkRect.h +++ b/geomodel/libUGC/Include/Base/YkRect.h @@ -2,7 +2,7 @@  *  * YkRect.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkRect2D.h b/geomodel/libUGC/Include/Base/YkRect2D.h index 520ccffd9e4fea62f2f82ae5b95a46c5fd77af45..75cc10ab1d83a0ad3e84a017cbc530322015062e 100644 --- a/geomodel/libUGC/Include/Base/YkRect2D.h +++ b/geomodel/libUGC/Include/Base/YkRect2D.h @@ -2,7 +2,7 @@  *  * YkRect2D.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkSize.h b/geomodel/libUGC/Include/Base/YkSize.h index 2df1953e07f2d5e8fbc2b84a0ddfb30b7c6544c8..a48e3184ad1491086c32b4e7e178389590e3beee 100644 --- a/geomodel/libUGC/Include/Base/YkSize.h +++ b/geomodel/libUGC/Include/Base/YkSize.h @@ -2,7 +2,7 @@  *  * YkSize.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkSize2D.h b/geomodel/libUGC/Include/Base/YkSize2D.h index b3f5299832fbd2ece3b4595285c134717e7523eb..b9dd3257019bb8543374f466252ac746ad1fdc50 100644 --- a/geomodel/libUGC/Include/Base/YkSize2D.h +++ b/geomodel/libUGC/Include/Base/YkSize2D.h @@ -2,7 +2,7 @@  *  * YkSize2D.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkString.h b/geomodel/libUGC/Include/Base/YkString.h index c16216e7e6c082a004adbfc9fccb1576e54f4335..cd720fb7d319e91d61bd0dca1909e8f02a7e7cfe 100644 --- a/geomodel/libUGC/Include/Base/YkString.h +++ b/geomodel/libUGC/Include/Base/YkString.h @@ -2,7 +2,7 @@  *  * YkString.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkSystem.h b/geomodel/libUGC/Include/Base/YkSystem.h index c55f66e07d4c016841b1414940b4b4662036fdfe..26525180f5a6449c4ed15144c51fdf3430d9e1d0 100644 --- a/geomodel/libUGC/Include/Base/YkSystem.h +++ b/geomodel/libUGC/Include/Base/YkSystem.h @@ -2,7 +2,7 @@  *  * YkSystem.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base/YkTime.h b/geomodel/libUGC/Include/Base/YkTime.h index 2ec71928f1b05b19bc53c05ee50c049cda00a503..21bfd9f27312ee2f8747933781702cd44c2d47f4 100644 --- a/geomodel/libUGC/Include/Base/YkTime.h +++ b/geomodel/libUGC/Include/Base/YkTime.h @@ -2,7 +2,7 @@  *  * YkTime.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkBoundingBox.h b/geomodel/libUGC/Include/Base3D/YkBoundingBox.h index f934d79cde32ce13bde07258857d5d8b6a0784ab..fc9c22b24a2ff8b845e61281833ff218148c90c9 100644 --- a/geomodel/libUGC/Include/Base3D/YkBoundingBox.h +++ b/geomodel/libUGC/Include/Base3D/YkBoundingBox.h @@ -2,7 +2,7 @@  *  * YkBoundingBox.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkBoundingSphere.h b/geomodel/libUGC/Include/Base3D/YkBoundingSphere.h index 6b814b94850d0b2f0c67bd5d6b10f4a5a32a2224..03033fbc6b83d42659b0d105c957543d1fa437f0 100644 --- a/geomodel/libUGC/Include/Base3D/YkBoundingSphere.h +++ b/geomodel/libUGC/Include/Base3D/YkBoundingSphere.h @@ -2,7 +2,7 @@  *  * YkBoundingSphere.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkCommon3D.h b/geomodel/libUGC/Include/Base3D/YkCommon3D.h index 0e53359d80606262fb81916547f916edce8336d3..80bb56eba407bce34ee0ffe341658421e623af4b 100644 --- a/geomodel/libUGC/Include/Base3D/YkCommon3D.h +++ b/geomodel/libUGC/Include/Base3D/YkCommon3D.h @@ -2,7 +2,7 @@  *  * YkCommon3D.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkMaterial3D.h b/geomodel/libUGC/Include/Base3D/YkMaterial3D.h index f96613b22ed794e21ab9ac6b876bccfa08e8ba55..cb60948c5ae50eda7a4e92a024733877af9c655b 100644 --- a/geomodel/libUGC/Include/Base3D/YkMaterial3D.h +++ b/geomodel/libUGC/Include/Base3D/YkMaterial3D.h @@ -2,7 +2,7 @@  *  * YkMaterial3D.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkMathEngine.h b/geomodel/libUGC/Include/Base3D/YkMathEngine.h index cf7748a97d7f5967c77f969c6d136a5b2f7ddefe..51c06c942ee1cc920e8ea30b37096bcb39fd961a 100644 --- a/geomodel/libUGC/Include/Base3D/YkMathEngine.h +++ b/geomodel/libUGC/Include/Base3D/YkMathEngine.h @@ -2,7 +2,7 @@  *  * YkMathEngine.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkMatrix4d.h b/geomodel/libUGC/Include/Base3D/YkMatrix4d.h index 4f0bee4b2155db82b6e75d6180054f7daff19fb3..e292adc5c92b1320d9daef3b0d1edf9e0dddc6e4 100644 --- a/geomodel/libUGC/Include/Base3D/YkMatrix4d.h +++ b/geomodel/libUGC/Include/Base3D/YkMatrix4d.h @@ -2,7 +2,7 @@  *  * YkMatrix4d.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkModelEM.h b/geomodel/libUGC/Include/Base3D/YkModelEM.h index 4af9708c20d2ece832382d52f8851dbb2c960df7..ce2e37c203b2ee66b028955b33b773b691d111c3 100644 --- a/geomodel/libUGC/Include/Base3D/YkModelEM.h +++ b/geomodel/libUGC/Include/Base3D/YkModelEM.h @@ -2,7 +2,7 @@  *  * YkModelEM.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkModelElementPool.h b/geomodel/libUGC/Include/Base3D/YkModelElementPool.h index 3fc09211176455651bffeb80004ed62775c96cef..1b363b4c32c3511c667ecb82e87d00d9b72ea0dc 100644 --- a/geomodel/libUGC/Include/Base3D/YkModelElementPool.h +++ b/geomodel/libUGC/Include/Base3D/YkModelElementPool.h @@ -2,7 +2,7 @@  *  * YkModelElementPool.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkModelNode.h b/geomodel/libUGC/Include/Base3D/YkModelNode.h index 4f04908dfa07249bc1dea82d1161eae92dd01888..53c9263510e1b6eaf6dca8d4597a9259141c5978 100644 --- a/geomodel/libUGC/Include/Base3D/YkModelNode.h +++ b/geomodel/libUGC/Include/Base3D/YkModelNode.h @@ -2,7 +2,7 @@  *  * YkModelNode.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkModelNodeElements.h b/geomodel/libUGC/Include/Base3D/YkModelNodeElements.h index 4d727cdb83ea947e8eea5f71246f8fbefead07bf..9532588b5c5932a5fcf7693f2f8a350830702c9f 100644 --- a/geomodel/libUGC/Include/Base3D/YkModelNodeElements.h +++ b/geomodel/libUGC/Include/Base3D/YkModelNodeElements.h @@ -2,7 +2,7 @@  *  * YkModelNodeElements.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkModelNodeShells.h b/geomodel/libUGC/Include/Base3D/YkModelNodeShells.h index 578a56837e223c547aef7f5e1e3c2aaae89aabcc..24dfaabd0bbfe587e156fa320b55354b4e0a60f4 100644 --- a/geomodel/libUGC/Include/Base3D/YkModelNodeShells.h +++ b/geomodel/libUGC/Include/Base3D/YkModelNodeShells.h @@ -2,7 +2,7 @@  *  * YkModelNodeShells.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkModelNodeTools.h b/geomodel/libUGC/Include/Base3D/YkModelNodeTools.h index f0f9298c846a372ecacda4c80d4e0ba98b6dee59..4c14d17f867ec5bb9f19be285a969aeb748108e7 100644 --- a/geomodel/libUGC/Include/Base3D/YkModelNodeTools.h +++ b/geomodel/libUGC/Include/Base3D/YkModelNodeTools.h @@ -2,7 +2,7 @@  *  * YkModelNodeTools.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkModelSkeletonDataPackTemplate.h b/geomodel/libUGC/Include/Base3D/YkModelSkeletonDataPackTemplate.h index f454ae6a9c87a4438ef1ff75d9cc2b08ed24a0b6..b810d272c024faadd4c1dad9901a11661c1ee0bd 100644 --- a/geomodel/libUGC/Include/Base3D/YkModelSkeletonDataPackTemplate.h +++ b/geomodel/libUGC/Include/Base3D/YkModelSkeletonDataPackTemplate.h @@ -2,7 +2,7 @@  *  * YkModelSkeletonDataPackTemplate.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkPass.h b/geomodel/libUGC/Include/Base3D/YkPass.h index a9e489e4112d469acbf13a32ea7e12359a0a935d..3d13f32ed103ffdc13c98d0be1deb08fd187ab88 100644 --- a/geomodel/libUGC/Include/Base3D/YkPass.h +++ b/geomodel/libUGC/Include/Base3D/YkPass.h @@ -2,7 +2,7 @@  *  * YkPass.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkPrerequisites3D.h b/geomodel/libUGC/Include/Base3D/YkPrerequisites3D.h index 6713252c67552b0c37e77fef786b9aac7a08faed..8ba976a89a92e2b46d30950614ab0bf3d1e4b1f3 100644 --- a/geomodel/libUGC/Include/Base3D/YkPrerequisites3D.h +++ b/geomodel/libUGC/Include/Base3D/YkPrerequisites3D.h @@ -2,7 +2,7 @@  *  * YkPrerequisites3D.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkRenderOperationGroup.h b/geomodel/libUGC/Include/Base3D/YkRenderOperationGroup.h index 0b7ae2f44d0ed8935e6d11cf501d60c0531683ab..0231c900731626e055cae3e5f06088e1167dbcb1 100644 --- a/geomodel/libUGC/Include/Base3D/YkRenderOperationGroup.h +++ b/geomodel/libUGC/Include/Base3D/YkRenderOperationGroup.h @@ -2,7 +2,7 @@  *  * YkRenderOperationGroup.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkSharedPtr.h b/geomodel/libUGC/Include/Base3D/YkSharedPtr.h index eca92d8d54484cc9bade7f1e8e8f52b3e1f12d6b..12192f6b060059ce18f6e628b0c714bacfdb81e5 100644 --- a/geomodel/libUGC/Include/Base3D/YkSharedPtr.h +++ b/geomodel/libUGC/Include/Base3D/YkSharedPtr.h @@ -2,7 +2,7 @@  *  * YkSharedPtr.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkTechnique.h b/geomodel/libUGC/Include/Base3D/YkTechnique.h index 3c649dd9b197cbe23a9130b2dfa2cb088dccf2da..4894db51de228c0398c72485688024ba07ce7ffb 100644 --- a/geomodel/libUGC/Include/Base3D/YkTechnique.h +++ b/geomodel/libUGC/Include/Base3D/YkTechnique.h @@ -2,7 +2,7 @@  *  * YkTechnique.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkTextureData.h b/geomodel/libUGC/Include/Base3D/YkTextureData.h index d0b24795330381d473143d4cc6dc2bfb4099ac50..7bab5fda7e5e3cba35fa398bf12e764972bfb377 100644 --- a/geomodel/libUGC/Include/Base3D/YkTextureData.h +++ b/geomodel/libUGC/Include/Base3D/YkTextureData.h @@ -2,7 +2,7 @@  *  * YkTextureData.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkTextureUnitState.h b/geomodel/libUGC/Include/Base3D/YkTextureUnitState.h index 9e124b366d72702ae0977db6e6781919426914e0..868e9819f115e52cb57959ef231aa98b42f6a781 100644 --- a/geomodel/libUGC/Include/Base3D/YkTextureUnitState.h +++ b/geomodel/libUGC/Include/Base3D/YkTextureUnitState.h @@ -2,7 +2,7 @@  *  * YkTextureUnitState.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkVector3d.h b/geomodel/libUGC/Include/Base3D/YkVector3d.h index ff6352f32f422eb271d190bd2c8ea16884426255..c3d44ec73c4645a181ddc7e52f17664739162f02 100644 --- a/geomodel/libUGC/Include/Base3D/YkVector3d.h +++ b/geomodel/libUGC/Include/Base3D/YkVector3d.h @@ -2,7 +2,7 @@  *  * YkVector3d.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkVector4d.h b/geomodel/libUGC/Include/Base3D/YkVector4d.h index 8771f8d8174fb6f4dfb31bed4324fbf3df7ef56e..4a52219897a00816a4871a4088ca763b05b9907d 100644 --- a/geomodel/libUGC/Include/Base3D/YkVector4d.h +++ b/geomodel/libUGC/Include/Base3D/YkVector4d.h @@ -2,7 +2,7 @@  *  * YkVector4d.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Base3D/YkVertexDataPackageTemplate.h b/geomodel/libUGC/Include/Base3D/YkVertexDataPackageTemplate.h index c5ad3e43ffe93f272825830991304ad50ec95a61..3cf1718cbfbdb82b3161000b209a6fd59f052c31 100644 --- a/geomodel/libUGC/Include/Base3D/YkVertexDataPackageTemplate.h +++ b/geomodel/libUGC/Include/Base3D/YkVertexDataPackageTemplate.h @@ -2,7 +2,7 @@  *  * YkVertexDataPackageTemplate.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Geometry3D/YkGeoModel.h b/geomodel/libUGC/Include/Geometry3D/YkGeoModel.h index de61a366c769f567ff247923aab93768eee5b4e6..dd177562d151abc09d0196fbc78c173a5558065f 100644 --- a/geomodel/libUGC/Include/Geometry3D/YkGeoModel.h +++ b/geomodel/libUGC/Include/Geometry3D/YkGeoModel.h @@ -2,7 +2,7 @@  *  * YkGeoModel.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Geometry3D/YkGeometry.h b/geomodel/libUGC/Include/Geometry3D/YkGeometry.h index 445b895bcd7763747f76735693f51079e15bb413..4d80756dac5057ff83f51e86f97f85613f94ea77 100644 --- a/geomodel/libUGC/Include/Geometry3D/YkGeometry.h +++ b/geomodel/libUGC/Include/Geometry3D/YkGeometry.h @@ -2,7 +2,7 @@  *  * YkGeometry.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Geometry3D/YkWrapCGeoModel.h b/geomodel/libUGC/Include/Geometry3D/YkWrapCGeoModel.h index de0700484060fb447db111b90a9bfe6343e76a1d..750695648ee3de867d27c73cdaae0b446ddc9b80 100644 --- a/geomodel/libUGC/Include/Geometry3D/YkWrapCGeoModel.h +++ b/geomodel/libUGC/Include/Geometry3D/YkWrapCGeoModel.h @@ -2,7 +2,7 @@  *  * YkWrapCGeoModel.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Stream/YkByteArray.h b/geomodel/libUGC/Include/Stream/YkByteArray.h index 94a8ed336ec003b24b4b0b57e82f7d8983ec0da6..6ef6a478a26af1b33eaead9da4a625be17136694 100644 --- a/geomodel/libUGC/Include/Stream/YkByteArray.h +++ b/geomodel/libUGC/Include/Stream/YkByteArray.h @@ -2,7 +2,7 @@  *  * YkByteArray.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Stream/YkDefines.h b/geomodel/libUGC/Include/Stream/YkDefines.h index 386a03c4fd2976e8e1ab93dd5f62300c7d3a6112..31843759d78fd5585d25c5b197de9a1ea7dc8d18 100644 --- a/geomodel/libUGC/Include/Stream/YkDefines.h +++ b/geomodel/libUGC/Include/Stream/YkDefines.h @@ -2,7 +2,7 @@  *  * YkDefines.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Stream/YkExports.h b/geomodel/libUGC/Include/Stream/YkExports.h index 34d2667c655f6b4587825f81b1b9dca2abd9fd3e..29601fb9c489f6105ac0d1cc9b6c08dd614a9fab 100644 --- a/geomodel/libUGC/Include/Stream/YkExports.h +++ b/geomodel/libUGC/Include/Stream/YkExports.h @@ -2,7 +2,7 @@  *  * YkExports.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Stream/YkFile.h b/geomodel/libUGC/Include/Stream/YkFile.h index b3e38cea2ec611346955be6fc78dde4c1b6b70fb..68d8ca195d8a9dcae97ad71a4e820f8ae739e0c7 100644 --- a/geomodel/libUGC/Include/Stream/YkFile.h +++ b/geomodel/libUGC/Include/Stream/YkFile.h @@ -2,7 +2,7 @@  *  * YkFile.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Stream/YkFileStdio.h b/geomodel/libUGC/Include/Stream/YkFileStdio.h index 03f0ecce2bfe40c65176c7e0b75d49f569ad5c65..39c7e05a3e90a02ea8a9f89fab6564405dc0afd4 100644 --- a/geomodel/libUGC/Include/Stream/YkFileStdio.h +++ b/geomodel/libUGC/Include/Stream/YkFileStdio.h @@ -2,7 +2,7 @@  *  * YkFileStdio.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Stream/YkFileStream.h b/geomodel/libUGC/Include/Stream/YkFileStream.h index aec305f0b4d098799e7720c60d90dcb77dd4fea3..3815a85f975cb8f7d0be20fd8afd646a6c5f6043 100644 --- a/geomodel/libUGC/Include/Stream/YkFileStream.h +++ b/geomodel/libUGC/Include/Stream/YkFileStream.h @@ -2,7 +2,7 @@  *  * YkFileStream.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Stream/YkMemoryStream.h b/geomodel/libUGC/Include/Stream/YkMemoryStream.h index 373e3375154f0a9da097dba20508e9fcfaebcd48..c92d55075ccb8aa762d87b8240a4bcd86a9894d6 100644 --- a/geomodel/libUGC/Include/Stream/YkMemoryStream.h +++ b/geomodel/libUGC/Include/Stream/YkMemoryStream.h @@ -2,7 +2,7 @@  *  * YkMemoryStream.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Stream/YkNowin.h b/geomodel/libUGC/Include/Stream/YkNowin.h index 87b3e74f7f50a331f0fb2d2b705785b75148cabb..7b9b123c522ca23d365fa3ba9b447c96eded426e 100644 --- a/geomodel/libUGC/Include/Stream/YkNowin.h +++ b/geomodel/libUGC/Include/Stream/YkNowin.h @@ -2,7 +2,7 @@  *  * YkNowin.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Stream/YkPlatform.h b/geomodel/libUGC/Include/Stream/YkPlatform.h index 9f45dbc4ea197fbb99bc6a6f59ef38c384bcb303..d0d1891e5f9976f20f2227cf19b3555bb6a9e9fc 100644 --- a/geomodel/libUGC/Include/Stream/YkPlatform.h +++ b/geomodel/libUGC/Include/Stream/YkPlatform.h @@ -2,7 +2,7 @@  *  * YkPlatform.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Stream/YkStream.h b/geomodel/libUGC/Include/Stream/YkStream.h index 56c65cb32fd63ed89e5b3d1f96dc05825e9fc61b..f171fad8da7e58929a7ac85c2ef645e364233aae 100644 --- a/geomodel/libUGC/Include/Stream/YkStream.h +++ b/geomodel/libUGC/Include/Stream/YkStream.h @@ -2,7 +2,7 @@  *  * YkStream.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Stream/YkWin32.h b/geomodel/libUGC/Include/Stream/YkWin32.h index 755af61acccb1bf45111ca0988e86195d8fbede9..2299b1929ad6ee1bc981801c03c8da8882e4024a 100644 --- a/geomodel/libUGC/Include/Stream/YkWin32.h +++ b/geomodel/libUGC/Include/Stream/YkWin32.h @@ -2,7 +2,7 @@  *  * YkWin32.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Stream/prefix.h b/geomodel/libUGC/Include/Stream/prefix.h index b08ddaa517c908c6a05fb37efd65e063e0b6f14a..f25f68887cea3569cff549dcafde37edaa9cf4a1 100644 --- a/geomodel/libUGC/Include/Stream/prefix.h +++ b/geomodel/libUGC/Include/Stream/prefix.h @@ -2,7 +2,7 @@  *  * prefix.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Toolkit/YkColorValue3DEx.h b/geomodel/libUGC/Include/Toolkit/YkColorValue3DEx.h index f2597f4d51f28d0da99030009439146624a51cc3..7c7fd10fce6ea030a51b846305901b107abd10d3 100644 --- a/geomodel/libUGC/Include/Toolkit/YkColorValue3DEx.h +++ b/geomodel/libUGC/Include/Toolkit/YkColorValue3DEx.h @@ -2,7 +2,7 @@  *  * YkColorValue3DEx.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Toolkit/YkCompress.h b/geomodel/libUGC/Include/Toolkit/YkCompress.h index 0f42976a521fcc6cb1a4c2e84fe9acff9038e89d..2510c0ea1580ae73a65af3cedc3eda689b74f5f1 100644 --- a/geomodel/libUGC/Include/Toolkit/YkCompress.h +++ b/geomodel/libUGC/Include/Toolkit/YkCompress.h @@ -2,7 +2,7 @@  *  * YkCompress.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Toolkit/YkDataCodec.h b/geomodel/libUGC/Include/Toolkit/YkDataCodec.h index fdf3d8876832163fdf45901b05ae48a860003013..46a7661c26be4db879077a95a30c8d9fb3951745 100644 --- a/geomodel/libUGC/Include/Toolkit/YkDataCodec.h +++ b/geomodel/libUGC/Include/Toolkit/YkDataCodec.h @@ -2,7 +2,7 @@  *  * YkDataCodec.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Toolkit/YkHashCode.h b/geomodel/libUGC/Include/Toolkit/YkHashCode.h index 48e83bc77923caf5f935d6988b68f01bc56107a7..ed87626197faa83950bb6150ad856f839786a3c9 100644 --- a/geomodel/libUGC/Include/Toolkit/YkHashCode.h +++ b/geomodel/libUGC/Include/Toolkit/YkHashCode.h @@ -2,7 +2,7 @@  *  * YkHashCode.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Toolkit/YkImageOperator.h b/geomodel/libUGC/Include/Toolkit/YkImageOperator.h index 76e9e73fd8841482b34137341aa159584804d474..600d15d4626de862c6e887911f3dc4737ef37314 100644 --- a/geomodel/libUGC/Include/Toolkit/YkImageOperator.h +++ b/geomodel/libUGC/Include/Toolkit/YkImageOperator.h @@ -2,7 +2,7 @@  *  * YkImageOperator.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Toolkit/YkLicenseBase.h b/geomodel/libUGC/Include/Toolkit/YkLicenseBase.h new file mode 100644 index 0000000000000000000000000000000000000000..839f2d146e3c285ab0cf9654a0c2a8438a722917 --- /dev/null +++ b/geomodel/libUGC/Include/Toolkit/YkLicenseBase.h @@ -0,0 +1,120 @@ +/* + * + *YkLicenseBase.h + * + * Copyright (C)  2023 SuperMap Software Co., Ltd. + * + * Yukon is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see . * + */ + /*! + \class YkLicenseBase + \brief + 许可信息类。该类用于获得许可的相关信息,连接与断开许可,验证许可是否有效。 +*/ +#ifndef YkLICENSEBASE_H +#define YkLICENSEBASE_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Stream/YkDefines.h" +// #include "Stream/Ykplatform.h" +// #include "Toolkit/YkLicenseCore.h" + +enum ConnectMode +{ + All = 0, + HLOnly = 1, + LocalOnly = 2, + RemoteOnly = 3, + SpecifiedHostname = 4, + SpecifiedIP = 5, + SpecifiedKeyID = 6 +}; + + +#include +#include +using namespace std; +namespace Yk +{ + class TOOLKIT_API YkLicFeatureInfo + { + public: + YkLicFeatureInfo(); + ~YkLicFeatureInfo(); + + YkInt m_id; + YkString m_name; + YkBool m_isTrial; + YkInt m_maxlogins; + YkString m_connectmode; + YkBool m_vmenable; + YkTime m_startTime; + YkTime m_expiredTime; + YkUlong m_keyid; + YkString m_keyType; + string m_licData; + YkString m_signature; + YkInt m_watermarkMode; + YkString m_userTrademark; + }; + /*! + \class YkLicenseBase + \brief + 许可信息类。该类用于获得许可的相关信息,连接与断开许可,验证许可是否有效。 +*/ + class TOOLKIT_API YkLicenseBase + { + public: + + protected: + YkLicenseBase(); + public: + virtual ~YkLicenseBase(); + + + virtual YkInt Connect(YkInt featureID)=0; + virtual YkInt Verify()=0; + virtual void Disconnect()=0; + + // 获取许可相关系信息 + virtual YkLicFeatureInfo GetFeatureInfo() = 0; + protected: +//_AIX // 设置许可连接模式,如HLOnly仅本机、SpecifiedIP指定IP,SpecifiedKeyID指定锁号等 + virtual ConnectMode GetConnectMode(); + virtual void SetConnectMode(YkInt mode){}; + + // 设置连接的服务器地址,除了LocalOnly、RemoteOnly两种模式以外都有对应的用处 + // 如HLOnly时可以设置指定的IP或者计算机名,SpecifiedIP时设置指定IP, + // SpecifiedKeyID指定锁号、SpecifiedHostname指定计算机名 + virtual YkString GetConnectServer(){return YkString(_U(""));}; + virtual void SetConnectServer(YkString& server){}; + + private: + virtual YkString GetUser()=0; + virtual YkString GetCompany()=0; + + + // 设置连接错误时的重试次数,为了许可连接效率默认为1次连接, + // 如果要使用在Internet或通信不好的网络,适当增加一些次数 + virtual YkInt GetConnectTolerantCount() =0; + + + + + }; +} +#endif //YkLICENSE diff --git a/geomodel/libUGC/Include/Toolkit/YkLicenseRSA.h b/geomodel/libUGC/Include/Toolkit/YkLicenseRSA.h new file mode 100644 index 0000000000000000000000000000000000000000..efe820dae695532f48db3ab3886d2c13598e6b54 --- /dev/null +++ b/geomodel/libUGC/Include/Toolkit/YkLicenseRSA.h @@ -0,0 +1,166 @@ +/* + * + *YkLicenseRSA.h + * + * Copyright (C)  2023 SuperMap Software Co., Ltd. + * + * Yukon is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see . * + */ +#ifndef LICENSERSA_H_ +#define LICENSERSA_H_ + + +#include "Stream/YkDefines.h" +#include "Toolkit/YkLicenseBase.h" +using namespace Yk; + +//typedef unsigned char Byte; +typedef unsigned char Byte_; +typedef unsigned int UInt32_; +typedef YkLong Int64_; +typedef YkUlong UInt64_; +using namespace std; + +////////////////////////////////////////////////////////////////////////// +// LicenseWrap 文件型许可验证类型,使用自己的算法,与Hasp无关,主要处理Hasp无法运行的情况 +// Copyright (c) 2013 SuperMap Software Co., Ltd. +// by gouyu 2013-12-16 +////////////////////////////////////////////////////////////////////////// +namespace Yk +{ + class YkLicFeatureInfo; + +class TOOLKIT_API YkLicenseRSA :public YkLicenseBase +{ +public: + YkLicenseRSA(); + ~YkLicenseRSA() override; + + + YkInt Connect(YkInt featureID) override; + YkInt Verify() override; + + void Disconnect() override; + + static bool FindLicFile(); + + // 获取许可相关系信息 + YkLicFeatureInfo GetFeatureInfo() override; + + // 指定查找的文件许可位置,可以是指定的文件,也可以是指定的查找目录 + void SetSpecifyLicenseFilePath(YkString& path); + +private: + YkString GetUser() override; + YkString GetCompany() override; + + + // 设置连接错误时的重试次数,为了许可连接效率默认为1次连接, + // 如果要使用在Internet或通信不好的网络,适当增加一些次数 + YkInt GetConnectTolerantCount() override; + YkInt VerifyLicFromFile(YkInt featureID); + static YkInt VerifyDecryptData(string& decryptData, YkString& signature, YkLicFeatureInfo& featureInfo); + static string Decrypt(string& data); + static bool VerifyMACAddress(YkString& macAddress); + static bool VerifyComputerName(YkString& computerName); + static void FillMacAddressList(); + void FindAndReadConfig(); + //RSA + // 指定查找的文件许可位置,可以是指定的文件,也可以是指定的查找目录 + YkString GetSpecifyLicenseFilePath(); + + + + // 获取当前使用的文件许可的位置 + YkString GetCurrentLicFilePath(); + + static YkString VERSION_NUM; + static YkString g_currentLicFilePath; // 当前验证的许可文件路径 + static YkString g_specifyLicenseFilePath; // 指定的许可文件 或 去查找许可文件的目录 + static vector g_macAddressList; + + YkString m_user; + YkString m_company; + YkLicFeatureInfo m_featureInfo; + + +protected: + YkBool canUseLicWrap; + static YkBool g_configLoaded; +}; + +// 从C#代码中反编译而来,只用的最关键的modPow方法,其他的都是为了把这个方法编译过才移过来的 +class TOOLKIT_API BigInteger +{ + // Methods +public: + BigInteger(vector& inData); + + BigInteger modPow(BigInteger& exp, BigInteger& n); + vector getBytes(); + + BigInteger(); + BigInteger(Int64_ value); + BigInteger(const BigInteger& bi); + BigInteger(vector& inData); + YkInt bitCount(); + BigInteger BarrettReduction(BigInteger x, BigInteger n, BigInteger constant); + static void singleByteDivide(BigInteger& bi1, BigInteger& bi2, BigInteger& outQuotient, BigInteger& outRemainder); + static void multiByteDivide(BigInteger& bi1, BigInteger& bi2, BigInteger& outQuotient, BigInteger& outRemainder); + static YkInt shiftLeft(vector& buffer, YkInt shiftVal); + static YkInt shiftRight(vector& buffer, YkInt shiftVal); + + BigInteger operator + (BigInteger& bi2); + BigInteger operator - (BigInteger& bi2); + BigInteger operator * (BigInteger& bi2); + BigInteger operator / (BigInteger& bi2); + BigInteger operator % (BigInteger& bi2); + BigInteger operator ! (); // 就是取负号,因为和减冲突,所以改成这个 + BigInteger operator << (YkInt shiftVal); + bool operator >= (BigInteger& bi2); + bool operator > (BigInteger& bi2); + + // Fields +private: + vector data; + YkInt dataLength; + static const YkInt maxLength = 70; +}; + +class LCBase64 +{ +public: + + /*编码 + DataByte + [in]输入的数据长度,以字节为单位 + */ + static string Encode(const unsigned char* Data,YkInt DataByte); + + static string Encode(vector data); + + /*解码 + DataByte + [in]输入的数据长度,以字节为单位 + OutByte + [out]输出的数据长度,以字节为单位,请不要通过返回值计算 + 输出数据的长度 + */ + vector Decode(const char* Data,YkInt DataByte,YkInt& OutByte); + + vector Decode(string& data,YkInt& OutByte); +}; +} +#endif // !LicenseWrap_H_ + diff --git a/geomodel/libUGC/Include/Toolkit/YkMarkup.h b/geomodel/libUGC/Include/Toolkit/YkMarkup.h index 300a964b1cc16248613dfba202c76da1651d0298..a83f97bcc2a1d82b3552ef40d1241353d3220ab8 100644 --- a/geomodel/libUGC/Include/Toolkit/YkMarkup.h +++ b/geomodel/libUGC/Include/Toolkit/YkMarkup.h @@ -2,7 +2,7 @@  *  * YkMarkup.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Toolkit/YkMemImage.h b/geomodel/libUGC/Include/Toolkit/YkMemImage.h index 73b7da4493eb639ca2ad5b94d4f8c719e02db39b..7750d5cce009185825185735fae10b6d395de79b 100644 --- a/geomodel/libUGC/Include/Toolkit/YkMemImage.h +++ b/geomodel/libUGC/Include/Toolkit/YkMemImage.h @@ -2,7 +2,7 @@  *  * YkMemImage.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Toolkit/YkTextCodec.h b/geomodel/libUGC/Include/Toolkit/YkTextCodec.h index 195a665ebe6314ba7caa7a13fd2c736d9dc445ce..6b09295ffc0a523c7e991b7ca99d301b6f576837 100644 --- a/geomodel/libUGC/Include/Toolkit/YkTextCodec.h +++ b/geomodel/libUGC/Include/Toolkit/YkTextCodec.h @@ -2,7 +2,7 @@  *  * YkTextCodec.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Toolkit/YkTextureInfo.h b/geomodel/libUGC/Include/Toolkit/YkTextureInfo.h index 4a100a650d1682a4f3485e7d76ad6411bfdb5080..95e3b1865af15a2d318285edde0ffab2c1735eeb 100644 --- a/geomodel/libUGC/Include/Toolkit/YkTextureInfo.h +++ b/geomodel/libUGC/Include/Toolkit/YkTextureInfo.h @@ -2,7 +2,7 @@  *  * YkTextureInfo.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Toolkit/YkThread.h b/geomodel/libUGC/Include/Toolkit/YkThread.h index 125e61203935702a6854154e3c55ce1f23b09ce7..00b8277ced3111fb6730c6132084cb25fde1e21c 100644 --- a/geomodel/libUGC/Include/Toolkit/YkThread.h +++ b/geomodel/libUGC/Include/Toolkit/YkThread.h @@ -2,7 +2,7 @@  *  * YkThread.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Include/Toolkit/YkToolkit.h b/geomodel/libUGC/Include/Toolkit/YkToolkit.h index e75cd2f3acd74a09a8d3b5c721e7f7e077ccb7be..446bacaf92878c8270117aee3f651051b809d4a9 100644 --- a/geomodel/libUGC/Include/Toolkit/YkToolkit.h +++ b/geomodel/libUGC/Include/Toolkit/YkToolkit.h @@ -2,7 +2,7 @@  *  * YkToolkit.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base/YkDefs.cpp b/geomodel/libUGC/Src/Base/YkDefs.cpp index 869890a4f4dfad3f71ff57f16226f1ad183eac5d..ba680bebf878ff78cb92943c564554c88ed5a9b8 100644 --- a/geomodel/libUGC/Src/Base/YkDefs.cpp +++ b/geomodel/libUGC/Src/Base/YkDefs.cpp @@ -2,7 +2,7 @@  *  * YkDefs.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base/YkPlatform.cpp b/geomodel/libUGC/Src/Base/YkPlatform.cpp index 2b75a3e5c1daecb33e00281bab8c888e57f605af..ed62a5802f941e6b584b72844f49dc3a4f1d6bc5 100644 --- a/geomodel/libUGC/Src/Base/YkPlatform.cpp +++ b/geomodel/libUGC/Src/Base/YkPlatform.cpp @@ -2,7 +2,7 @@  *  * YkPlatform.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base/YkPoint.cpp b/geomodel/libUGC/Src/Base/YkPoint.cpp index 997e2e03d3f694a0922fd9e4f076fe8ebfa6511d..1a8957a9c77f3775d0a9a477d4a3a1e343118799 100644 --- a/geomodel/libUGC/Src/Base/YkPoint.cpp +++ b/geomodel/libUGC/Src/Base/YkPoint.cpp @@ -2,7 +2,7 @@  *  * YkPoint.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base/YkPoint2D.cpp b/geomodel/libUGC/Src/Base/YkPoint2D.cpp index b1fbd857d84ea0dc77596c0059303b5f45b58057..e2a5c7d2174f10f9e5608d5d0923f8d0b393cdd2 100644 --- a/geomodel/libUGC/Src/Base/YkPoint2D.cpp +++ b/geomodel/libUGC/Src/Base/YkPoint2D.cpp @@ -2,7 +2,7 @@  *  * YkPoint2D.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base/YkPoint3D.cpp b/geomodel/libUGC/Src/Base/YkPoint3D.cpp index e82bcde2f17af174837e8b6baf5166ecf7d5f571..351fc57dbe64c8ea8238623e51bd1954e9597bad 100644 --- a/geomodel/libUGC/Src/Base/YkPoint3D.cpp +++ b/geomodel/libUGC/Src/Base/YkPoint3D.cpp @@ -2,7 +2,7 @@  *  * YkPoint3D.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base/YkQString.cpp b/geomodel/libUGC/Src/Base/YkQString.cpp index 629246cef66cdaa1939cd3180e1daf48c1d02d7b..87a87b8eca119bc690cee1655d5a94cbbd36e3f3 100644 --- a/geomodel/libUGC/Src/Base/YkQString.cpp +++ b/geomodel/libUGC/Src/Base/YkQString.cpp @@ -2,7 +2,7 @@  *  * YkQString.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base/YkRect.cpp b/geomodel/libUGC/Src/Base/YkRect.cpp index 2b322706cd100c27d65105d21ed4cc6b4faba0d8..6dbf31715a7d5d50d85174f285e3e8155f260ce6 100644 --- a/geomodel/libUGC/Src/Base/YkRect.cpp +++ b/geomodel/libUGC/Src/Base/YkRect.cpp @@ -2,7 +2,7 @@  *  * YkRect.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base/YkRect2D.cpp b/geomodel/libUGC/Src/Base/YkRect2D.cpp index 2d63c177a8d47ed914a1f30138f678fa44a9de87..03e9c656c56fee5d7ad40f46bdf8ade4ba05a85d 100644 --- a/geomodel/libUGC/Src/Base/YkRect2D.cpp +++ b/geomodel/libUGC/Src/Base/YkRect2D.cpp @@ -2,7 +2,7 @@  *  * YkRect2D.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base/YkSize.cpp b/geomodel/libUGC/Src/Base/YkSize.cpp index 3bdba199611db2604221cdbfe532b5938eba7eb1..b0a32deb9e560d733c062da1a62d246ac70aed80 100644 --- a/geomodel/libUGC/Src/Base/YkSize.cpp +++ b/geomodel/libUGC/Src/Base/YkSize.cpp @@ -2,7 +2,7 @@  *  * YkSize.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base/YkSize2D.cpp b/geomodel/libUGC/Src/Base/YkSize2D.cpp index 0d6427988db59a3cae012c7fe3accd666e618fc1..b86ef70c0fb1758322f7fab5a52c93d24ce973e7 100644 --- a/geomodel/libUGC/Src/Base/YkSize2D.cpp +++ b/geomodel/libUGC/Src/Base/YkSize2D.cpp @@ -2,7 +2,7 @@  *  * YkSize2D.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base/YkString.cpp b/geomodel/libUGC/Src/Base/YkString.cpp index 7c5eb5530a5264cacc3811575cf6fc094ec5d686..3f3dcf94699ebccf11e1892f52a7268c86df7fb7 100644 --- a/geomodel/libUGC/Src/Base/YkString.cpp +++ b/geomodel/libUGC/Src/Base/YkString.cpp @@ -2,7 +2,7 @@  *  * YkString.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base/YkSystem.cpp b/geomodel/libUGC/Src/Base/YkSystem.cpp index 076b90c6ac6fbc7d264fc0bbdd9274875681d166..ec89ec3b69d25021cab01376de730853dbd1f615 100644 --- a/geomodel/libUGC/Src/Base/YkSystem.cpp +++ b/geomodel/libUGC/Src/Base/YkSystem.cpp @@ -2,7 +2,7 @@  *  * YkSystem.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base/YkTime.cpp b/geomodel/libUGC/Src/Base/YkTime.cpp index e478b7a6f88a385f55c6722d3e28352481e67cd1..b9eb789807091fbe060f178352fe648bf3ca279a 100644 --- a/geomodel/libUGC/Src/Base/YkTime.cpp +++ b/geomodel/libUGC/Src/Base/YkTime.cpp @@ -2,7 +2,7 @@  *  * YkTime.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkBoundingBox.cpp b/geomodel/libUGC/Src/Base3D/YkBoundingBox.cpp index 1cf87127958466015f69d0d9c0d78880a4743d15..546d0a43d1a6bbce37a82b1d7c9675872c86d22a 100644 --- a/geomodel/libUGC/Src/Base3D/YkBoundingBox.cpp +++ b/geomodel/libUGC/Src/Base3D/YkBoundingBox.cpp @@ -2,7 +2,7 @@  *  * YkBoundingBox.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkBoundingSphere.cpp b/geomodel/libUGC/Src/Base3D/YkBoundingSphere.cpp index dece1eb35c5b158701d12929b37ee1bc137069e2..c55791eba709f2fde26872f4675f408fda151e6f 100644 --- a/geomodel/libUGC/Src/Base3D/YkBoundingSphere.cpp +++ b/geomodel/libUGC/Src/Base3D/YkBoundingSphere.cpp @@ -2,7 +2,7 @@  *  * YkBoundingSphere.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkMaterial3D.cpp b/geomodel/libUGC/Src/Base3D/YkMaterial3D.cpp index 29d4f823618f0e6ea4fa35c8292b2d4148743f2b..94223887b5c61610082ae9db097d01b4817d0296 100644 --- a/geomodel/libUGC/Src/Base3D/YkMaterial3D.cpp +++ b/geomodel/libUGC/Src/Base3D/YkMaterial3D.cpp @@ -2,7 +2,7 @@  *  * YkMaterial3D.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkMathEngine.cpp b/geomodel/libUGC/Src/Base3D/YkMathEngine.cpp index c1ed7105832bbb920262a2b22f874cb3b8878203..dc94a3e668c632e6dbb63a315128a82e46886412 100644 --- a/geomodel/libUGC/Src/Base3D/YkMathEngine.cpp +++ b/geomodel/libUGC/Src/Base3D/YkMathEngine.cpp @@ -2,7 +2,7 @@  *  * YkMathEngine.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkMatrix4d.cpp b/geomodel/libUGC/Src/Base3D/YkMatrix4d.cpp index 58e1e31ed2700708be70a8753b4d371fbedca799..890c45d43d8678c6c80d8d376657dce38949e22b 100644 --- a/geomodel/libUGC/Src/Base3D/YkMatrix4d.cpp +++ b/geomodel/libUGC/Src/Base3D/YkMatrix4d.cpp @@ -2,7 +2,7 @@  *  * YkMatrix4d.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkModelEM.cpp b/geomodel/libUGC/Src/Base3D/YkModelEM.cpp index 82811ac2f11c0ac21265c05e1ecbe07b5be040b8..0c5cf6363a07c38c25fc321c4479713c220e581c 100644 --- a/geomodel/libUGC/Src/Base3D/YkModelEM.cpp +++ b/geomodel/libUGC/Src/Base3D/YkModelEM.cpp @@ -2,7 +2,7 @@  *  * YkModelEM.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkModelNode.cpp b/geomodel/libUGC/Src/Base3D/YkModelNode.cpp index c9836a9ddf39e2985275c16797db7c2a1e035737..ac6a39d255e873976bd54ee3204842c3c799a9a2 100644 --- a/geomodel/libUGC/Src/Base3D/YkModelNode.cpp +++ b/geomodel/libUGC/Src/Base3D/YkModelNode.cpp @@ -2,7 +2,7 @@  *  * YkModelNode.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkModelNodeElements.cpp b/geomodel/libUGC/Src/Base3D/YkModelNodeElements.cpp index a2eb5c50cf9496fa1540e2732b0c2d86f37bc462..6ed40b1866ca9ebc13a5dc6a57161ec6fe23e512 100644 --- a/geomodel/libUGC/Src/Base3D/YkModelNodeElements.cpp +++ b/geomodel/libUGC/Src/Base3D/YkModelNodeElements.cpp @@ -2,7 +2,7 @@  *  * YkModelNodeElements.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkModelNodeShells.cpp b/geomodel/libUGC/Src/Base3D/YkModelNodeShells.cpp index 3ea0d18fc40bddb5539efc6eca29ad2ad88b8f5c..7b76f651970f72733ddf4ba296baada7b767dc21 100644 --- a/geomodel/libUGC/Src/Base3D/YkModelNodeShells.cpp +++ b/geomodel/libUGC/Src/Base3D/YkModelNodeShells.cpp @@ -2,7 +2,7 @@  *  * YkModelNodeShells.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkModelNodeTools.cpp b/geomodel/libUGC/Src/Base3D/YkModelNodeTools.cpp index 7055ade2f7acacf1b180d9e697b7608c8d7437d9..e306fff0ccdf0a9875d3bdb6fc412b83cdf6f269 100644 --- a/geomodel/libUGC/Src/Base3D/YkModelNodeTools.cpp +++ b/geomodel/libUGC/Src/Base3D/YkModelNodeTools.cpp @@ -2,7 +2,7 @@  *  * YkModelNodeTools.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkPass.cpp b/geomodel/libUGC/Src/Base3D/YkPass.cpp index 565c6b2d44cc35e96cfcdef341db773f4e82c16e..1c960bdc17063c04f2fa46db3d21051edc801b6c 100644 --- a/geomodel/libUGC/Src/Base3D/YkPass.cpp +++ b/geomodel/libUGC/Src/Base3D/YkPass.cpp @@ -2,7 +2,7 @@  *  * YkPass.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkRenderOperationGroup.cpp b/geomodel/libUGC/Src/Base3D/YkRenderOperationGroup.cpp index 728bc13904308c3ab2c497b3718910e4eadeb92f..9e95ebaf2325973066d6029b5d90adecf6d429a6 100644 --- a/geomodel/libUGC/Src/Base3D/YkRenderOperationGroup.cpp +++ b/geomodel/libUGC/Src/Base3D/YkRenderOperationGroup.cpp @@ -2,7 +2,7 @@  *  * YkRenderOperationGroup.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkTechnique.cpp b/geomodel/libUGC/Src/Base3D/YkTechnique.cpp index e351a882ba3f2755a1ab5903393e1a23e827b266..18e50ce545b55b0fd1fc0fcf02de896ec67347b6 100644 --- a/geomodel/libUGC/Src/Base3D/YkTechnique.cpp +++ b/geomodel/libUGC/Src/Base3D/YkTechnique.cpp @@ -2,7 +2,7 @@  *  * YkTechnique.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkTextureData.cpp b/geomodel/libUGC/Src/Base3D/YkTextureData.cpp index 10c3a6e7ff0085718e34a90e6226e76dbe2e0020..f2903419b4dbf122c07992e90584279c6865f583 100644 --- a/geomodel/libUGC/Src/Base3D/YkTextureData.cpp +++ b/geomodel/libUGC/Src/Base3D/YkTextureData.cpp @@ -2,7 +2,7 @@  *  * YkTextureData.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkTextureUnitState.cpp b/geomodel/libUGC/Src/Base3D/YkTextureUnitState.cpp index 4bd5f4e0bccbae3a2019cb478e6bf3ed894bd198..a79533c61bd5fe0a463877a90cfa0ad814533acd 100644 --- a/geomodel/libUGC/Src/Base3D/YkTextureUnitState.cpp +++ b/geomodel/libUGC/Src/Base3D/YkTextureUnitState.cpp @@ -2,7 +2,7 @@  *  * YkTextureUnitState.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkVector3d.cpp b/geomodel/libUGC/Src/Base3D/YkVector3d.cpp index 07f97e2086a4b15218d811a0fa3f279f97f95ff7..86c34b77d4d4788a1943599f4833e41c058a6e5a 100644 --- a/geomodel/libUGC/Src/Base3D/YkVector3d.cpp +++ b/geomodel/libUGC/Src/Base3D/YkVector3d.cpp @@ -2,7 +2,7 @@  *  * YkVector3d.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Base3D/YkVector4d.cpp b/geomodel/libUGC/Src/Base3D/YkVector4d.cpp index 2702293061cb6dfb9c1450549e216b12d6ae8aaa..a652df209272536a110411d8cdf3cff0abb9bfd8 100644 --- a/geomodel/libUGC/Src/Base3D/YkVector4d.cpp +++ b/geomodel/libUGC/Src/Base3D/YkVector4d.cpp @@ -2,7 +2,7 @@  *  * YkVector4d.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Geometry3D/YkGeoModel.cpp b/geomodel/libUGC/Src/Geometry3D/YkGeoModel.cpp index c49f78b1259069d4311b0966a0dd75051a3e4ef1..2bc32426f9201134bf6ffee2a0c00db50a6c7bb3 100644 --- a/geomodel/libUGC/Src/Geometry3D/YkGeoModel.cpp +++ b/geomodel/libUGC/Src/Geometry3D/YkGeoModel.cpp @@ -2,7 +2,7 @@  *  * YkGeoModel.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Geometry3D/YkGeometry.cpp b/geomodel/libUGC/Src/Geometry3D/YkGeometry.cpp index a304aecd313f4a00194b36c8e81bc5382574b195..29f9b7ca0ba8f90949e401c066144d34cb0f68f1 100644 --- a/geomodel/libUGC/Src/Geometry3D/YkGeometry.cpp +++ b/geomodel/libUGC/Src/Geometry3D/YkGeometry.cpp @@ -2,7 +2,7 @@  *  * YkGeometry.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Geometry3D/YkWrapCGeoModel.cpp b/geomodel/libUGC/Src/Geometry3D/YkWrapCGeoModel.cpp index 8a2c3d5dd7768756075fde5f5bcb905635b11be7..49684a5895d72170b630ae69cfed9af2f0050ee9 100644 --- a/geomodel/libUGC/Src/Geometry3D/YkWrapCGeoModel.cpp +++ b/geomodel/libUGC/Src/Geometry3D/YkWrapCGeoModel.cpp @@ -2,7 +2,7 @@  *  * YkWrapCGeoModel.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Stream/YkByteArray.cpp b/geomodel/libUGC/Src/Stream/YkByteArray.cpp index fde11cc0e0d91897377dd66a34ff9ce9a34c72e7..1eed2af060c64d89b2184ed6923eb25ffef66d66 100644 --- a/geomodel/libUGC/Src/Stream/YkByteArray.cpp +++ b/geomodel/libUGC/Src/Stream/YkByteArray.cpp @@ -2,7 +2,7 @@  *  * YkByteArray.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Stream/YkDefines.cpp b/geomodel/libUGC/Src/Stream/YkDefines.cpp index 8b0a909216fedf7aef0c345c6d528742a541d2ef..f3cde8b59afe806e4c5760f6ef3cc6260276cb94 100644 --- a/geomodel/libUGC/Src/Stream/YkDefines.cpp +++ b/geomodel/libUGC/Src/Stream/YkDefines.cpp @@ -2,7 +2,7 @@  *  * YkDefines.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Stream/YkFile.cpp b/geomodel/libUGC/Src/Stream/YkFile.cpp index d45ba5386b1e9a42cde506e7085667b546ea465d..0a736458213da4c48eaf9b109a707246fa94cd5f 100644 --- a/geomodel/libUGC/Src/Stream/YkFile.cpp +++ b/geomodel/libUGC/Src/Stream/YkFile.cpp @@ -2,7 +2,7 @@  *  * YkFile.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Stream/YkFileStdio.cpp b/geomodel/libUGC/Src/Stream/YkFileStdio.cpp index f873f616bc5156537931a6660d0c80039d62716a..41d6da64658eddb0240009e0e33056148d6bde2d 100644 --- a/geomodel/libUGC/Src/Stream/YkFileStdio.cpp +++ b/geomodel/libUGC/Src/Stream/YkFileStdio.cpp @@ -2,7 +2,7 @@  *  * YkFileStdio.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Stream/YkFileStream.cpp b/geomodel/libUGC/Src/Stream/YkFileStream.cpp index ade47ff421f504fd1e11fa4538c4969fac36a7f9..f14c85420f371dea71e43c8b98a7f946419a6a85 100644 --- a/geomodel/libUGC/Src/Stream/YkFileStream.cpp +++ b/geomodel/libUGC/Src/Stream/YkFileStream.cpp @@ -2,7 +2,7 @@  *  * YkFileStream.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Stream/YkMemoryStream.cpp b/geomodel/libUGC/Src/Stream/YkMemoryStream.cpp index 91bfff4c5917ec15d23d21f17d6d31dedd1532be..00ab3db28fedc8659411caf6e42e28d4a270b16b 100644 --- a/geomodel/libUGC/Src/Stream/YkMemoryStream.cpp +++ b/geomodel/libUGC/Src/Stream/YkMemoryStream.cpp @@ -2,7 +2,7 @@  *  * YkMemoryStream.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Stream/YkNowin.cpp b/geomodel/libUGC/Src/Stream/YkNowin.cpp index 594eb736f0b7c1605cc417bd745e8564efa96704..e0968a0ea7eca74465b2924881ec2307798cdafe 100644 --- a/geomodel/libUGC/Src/Stream/YkNowin.cpp +++ b/geomodel/libUGC/Src/Stream/YkNowin.cpp @@ -2,7 +2,7 @@  *  * YkNowin.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Stream/YkPlatform.cpp b/geomodel/libUGC/Src/Stream/YkPlatform.cpp index 2c91fbc8f671c9d7a91cfe4fdaef36625f4baf4f..f01fe5acadf7b4695af57d4c7fc50ca0aad40450 100644 --- a/geomodel/libUGC/Src/Stream/YkPlatform.cpp +++ b/geomodel/libUGC/Src/Stream/YkPlatform.cpp @@ -2,7 +2,7 @@  *  * YkPlatform.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Stream/YkStream.cpp b/geomodel/libUGC/Src/Stream/YkStream.cpp index 0514bebd7a875f0b570b37c4a77e73601ed6556a..ff3553b4a9510a0fa622799738e988400c427cab 100644 --- a/geomodel/libUGC/Src/Stream/YkStream.cpp +++ b/geomodel/libUGC/Src/Stream/YkStream.cpp @@ -2,7 +2,7 @@  *  * YkStream.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Stream/YkWin32.cpp b/geomodel/libUGC/Src/Stream/YkWin32.cpp index 1d2de57bc4ab2e3fe45677c5b3f42842196e5716..f54848dd9796b0fb970553460adbe6d85dd286b5 100644 --- a/geomodel/libUGC/Src/Stream/YkWin32.cpp +++ b/geomodel/libUGC/Src/Stream/YkWin32.cpp @@ -2,7 +2,7 @@  *  * YkWin32.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Toolkit/YkColorValue3DEx.cpp b/geomodel/libUGC/Src/Toolkit/YkColorValue3DEx.cpp index 680126b2cc60d8f2598eed7702b212fd5ba2daaa..00df1126a5195c80d4e7c5df9239d3b549477cdc 100644 --- a/geomodel/libUGC/Src/Toolkit/YkColorValue3DEx.cpp +++ b/geomodel/libUGC/Src/Toolkit/YkColorValue3DEx.cpp @@ -2,7 +2,7 @@  *  * YkColorValue3DEx.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Toolkit/YkCompress.cpp b/geomodel/libUGC/Src/Toolkit/YkCompress.cpp index f5824d38a62614c4ca135b7000318eec0815f0aa..b77a44ded3f62cf4dcfa6500bf0e86eda467066e 100644 --- a/geomodel/libUGC/Src/Toolkit/YkCompress.cpp +++ b/geomodel/libUGC/Src/Toolkit/YkCompress.cpp @@ -2,7 +2,7 @@  *  * YkCompress.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Toolkit/YkHashCode.cpp b/geomodel/libUGC/Src/Toolkit/YkHashCode.cpp index 4ec22a950350aa99e0fc69d90e85fd23de8279c3..288211c663d6a7f733a029bdffb14a654d592b19 100644 --- a/geomodel/libUGC/Src/Toolkit/YkHashCode.cpp +++ b/geomodel/libUGC/Src/Toolkit/YkHashCode.cpp @@ -2,7 +2,7 @@  *  * YkHashCode.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Toolkit/YkImageOperator.cpp b/geomodel/libUGC/Src/Toolkit/YkImageOperator.cpp index 8fb3602f1e36da919cbc5a3d36aa675af78f32e3..72c3867199faa557ba5358e4043f7878c57470f1 100644 --- a/geomodel/libUGC/Src/Toolkit/YkImageOperator.cpp +++ b/geomodel/libUGC/Src/Toolkit/YkImageOperator.cpp @@ -2,7 +2,7 @@  *  * YkImageOperator.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Toolkit/YkMarkup.cpp b/geomodel/libUGC/Src/Toolkit/YkMarkup.cpp index f6ed2b316ec636c5c7eae41bbf7129d555255234..0dd2f34ffd748c2b057d920d83eba22c0fc652d2 100644 --- a/geomodel/libUGC/Src/Toolkit/YkMarkup.cpp +++ b/geomodel/libUGC/Src/Toolkit/YkMarkup.cpp @@ -2,7 +2,7 @@  *  * YkMarkup.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Toolkit/YkMemImage.cpp b/geomodel/libUGC/Src/Toolkit/YkMemImage.cpp index 07b7456188ad5fd41d5b7a6dee46c2346f52bd93..5b731390da097ce3f3e99cffdcaa2f76995ae9f9 100644 --- a/geomodel/libUGC/Src/Toolkit/YkMemImage.cpp +++ b/geomodel/libUGC/Src/Toolkit/YkMemImage.cpp @@ -2,7 +2,7 @@  *  * YkMemImage.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Toolkit/YkTextCodec.cpp b/geomodel/libUGC/Src/Toolkit/YkTextCodec.cpp index 29d09135e958e81e671731a8944577e50c67ef0a..6490e8fe93924f412bbbd7b908f646085367ad6d 100644 --- a/geomodel/libUGC/Src/Toolkit/YkTextCodec.cpp +++ b/geomodel/libUGC/Src/Toolkit/YkTextCodec.cpp @@ -2,7 +2,7 @@  *  * YkTextCodec.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Toolkit/YkTextureInfo.cpp b/geomodel/libUGC/Src/Toolkit/YkTextureInfo.cpp index 8072b97326e9516c495595d235a418060e9835ab..5d2d71b3e9976db8fabd302646ca75f046fa37f5 100644 --- a/geomodel/libUGC/Src/Toolkit/YkTextureInfo.cpp +++ b/geomodel/libUGC/Src/Toolkit/YkTextureInfo.cpp @@ -2,7 +2,7 @@  *  * YkTextureInfo.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Toolkit/YkThread.cpp b/geomodel/libUGC/Src/Toolkit/YkThread.cpp index d182541f95af0075a85b7aa15f140d97a4192b59..1a24302893fce5ead2bd660af7fbe0fbd63c166b 100644 --- a/geomodel/libUGC/Src/Toolkit/YkThread.cpp +++ b/geomodel/libUGC/Src/Toolkit/YkThread.cpp @@ -2,7 +2,7 @@  *  * YkThread.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Toolkit/YkToolkit.cpp b/geomodel/libUGC/Src/Toolkit/YkToolkit.cpp index 161b79b1370794cec2de24a95fc28c2598e545ba..4d451481d4e0d055d3c62d82e2b4cd2df911723b 100644 --- a/geomodel/libUGC/Src/Toolkit/YkToolkit.cpp +++ b/geomodel/libUGC/Src/Toolkit/YkToolkit.cpp @@ -2,7 +2,7 @@  *  * YkToolkit.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Toolkit/YkToolkitNowin.cpp b/geomodel/libUGC/Src/Toolkit/YkToolkitNowin.cpp index 216783695bc49c07bc2c0d0d25af7a30be230869..7b6f6764f24d22476820d9a13c2c4f68af33ddea 100644 --- a/geomodel/libUGC/Src/Toolkit/YkToolkitNowin.cpp +++ b/geomodel/libUGC/Src/Toolkit/YkToolkitNowin.cpp @@ -2,7 +2,7 @@  *  * YkToolkitNowin.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/libUGC/Src/Toolkit/YkToolkitWin32.cpp b/geomodel/libUGC/Src/Toolkit/YkToolkitWin32.cpp index 51db94651aae0013ef2f62f139f4909e805100f7..8d298a99a25dbbe9ae07e4d8516eed347d90703b 100644 --- a/geomodel/libUGC/Src/Toolkit/YkToolkitWin32.cpp +++ b/geomodel/libUGC/Src/Toolkit/YkToolkitWin32.cpp @@ -2,7 +2,7 @@  *  * YkToolkitWin32.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  2023 SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/src/Makefile.in b/geomodel/src/Makefile.in index 4898abe18276d2ed89f7fd33263352c8ff32a425..7fcfdf5911d15f1832db3006a81707e61d8d3463 100644 --- a/geomodel/src/Makefile.in +++ b/geomodel/src/Makefile.in @@ -5,6 +5,7 @@ POSTGIS_PGSQL_VERSION=92 COMPILE_TIME = $(shell date +"%Y-%m-%d %H:%M:%S") GIT_REVISION = $(shell git show -s --pretty=format:%h) +BUILDID = $(shell date +"%Y%m%d") EXTENSION = yukon_geomodel # the extensions name MODULE_big=yukon_geomodel-$(GEOMODEL_MAJRO_VERSION).$(GEOMODEL_MINOR_VERSION) @@ -24,7 +25,7 @@ LD_FLAGS.aarch64 = ../libUGC/Builds/MakeProject/Binaarch64_Linux LD_FLAGS += $(LD_FLAGS.$(uname_m)) override CFLAGS :=-I../../liblwgeom -I../../include -fpermissive $(IS_DEBUG) -D_UGUNICODE -D_UGQSTRING -PG_CPPFLAGS += -fPIC -I../libUGC/Include -I../../raster/rt_core/ -I../../raster/rt_pg $(CFLAGS) @CPPFLAGS@ @LIBGDAL_CFLAGS@ -DCOMPILEINFO="\" Compiled at:$(COMPILE_TIME)\"""\" Commit ID:$(GIT_REVISION) \"" +PG_CPPFLAGS += -fPIC -I../libUGC/Include -I../../raster/rt_core/ -I../../raster/rt_pg $(CFLAGS) @CPPFLAGS@ @LIBGDAL_CFLAGS@ -DCOMPILEINFO="\" BUILDID:$(BUILDID)\"""\" Compiled at:$(COMPILE_TIME)\"""\" Commit ID:$(GIT_REVISION) \"" #librtcore.a 的位置要放在 liblwgeom.a 的前面(librtcore.a 依赖于 liblwgeom.a),否则会造成有些函数无法链接到动态库 SHLIB_LINK = ../../raster/rt_core/librtcore.a ../../liblwgeom/.libs/liblwgeom.a -L$(LD_FLAGS) -lYkGeometry3D @SHLIB_LINK@ @LIBGDAL_LDFLAGS@ # postgres build stuff diff --git a/geomodel/src/geomodel.cpp b/geomodel/src/geomodel.cpp index 0104080aefb74cb345d4f9fdb5e5dfc0984bc62c..9d7671c4a165114dedb4ac3caef14543b90bcae4 100644 --- a/geomodel/src/geomodel.cpp +++ b/geomodel/src/geomodel.cpp @@ -2,7 +2,7 @@  *  * geomodel.c  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License @@ -72,8 +72,8 @@ Datum make_geomodelshell(PG_FUNCTION_ARGS); #include "gmserialized.h" #include "geomodel_util.h" -#define YUKON_VERSION "1.0.1(Community Edition)" -#define YUKON_LIB_VERSION "1.0.1_lib" +#define YUKON_VERSION "2.0(Community Edition)" +#define YUKON_LIB_VERSION "2.0_lib" using namespace Yk; @@ -417,7 +417,17 @@ Datum make_skeleton_from_tin(PG_FUNCTION_ARGS) YkIndexPackage *pIndexData = new YkIndexPackage(); LWCOLLECTION *col = lwgeom_as_lwcollection(geom); + if (col == nullptr) + { + elog(ERROR, "TIN is not valid!"); + PG_RETURN_NULL(); + } LWCOLLECTION *g1 = lwgeom_as_lwcollection(col->geoms[0]); + if (g1 == nullptr) + { + elog(ERROR, "TIN is not valid!"); + PG_RETURN_NULL(); + } LWTIN *item = lwgeom_as_lwtin(g1->geoms[0]); //数据填充 diff --git a/geomodel/src/geomodel.h b/geomodel/src/geomodel.h index ba657d24e8bc2a7fa0b5c15ef37ff7320cb376d2..181b7f38869fe9266c3b56416b316bd7cdd4af72 100644 --- a/geomodel/src/geomodel.h +++ b/geomodel/src/geomodel.h @@ -2,7 +2,7 @@  *  * geomodel.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/src/geomodel_util.cpp b/geomodel/src/geomodel_util.cpp index a19c4c9b1040a4af6a12a1b1bf51c8971f690187..6529bc69232db6c3477de8c40c1c944ba4b367ff 100644 --- a/geomodel/src/geomodel_util.cpp +++ b/geomodel/src/geomodel_util.cpp @@ -2,7 +2,7 @@  *  * geomodel_util.c  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/src/geomodel_util.h b/geomodel/src/geomodel_util.h index 70be8779087b73551bc27a6524bf624e08739051..059220b16fbedab3c76d3b1373c8fc6a420a3ab5 100644 --- a/geomodel/src/geomodel_util.h +++ b/geomodel/src/geomodel_util.h @@ -2,7 +2,7 @@  *  * geomodel_util.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/src/gmfuncs.cpp b/geomodel/src/gmfuncs.cpp index a357a0cbf7250f111ed1ede3f42c364ba388bebc..5000131958dd720ab5f8430b90ed74533fc8732e 100644 --- a/geomodel/src/gmfuncs.cpp +++ b/geomodel/src/gmfuncs.cpp @@ -2,7 +2,7 @@  *  * gmfuncs.c  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/src/gmserialized.h b/geomodel/src/gmserialized.h index dd422d85d5af9b0a2c9ba16aa9068cb5f9e5a6d2..572f6557bf939048c34fb5be77ec1a18f72a5daf 100644 --- a/geomodel/src/gmserialized.h +++ b/geomodel/src/gmserialized.h @@ -2,7 +2,7 @@  *  * gmserialized.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/src/gmserialized_typmod.cpp b/geomodel/src/gmserialized_typmod.cpp index defc8b17ee45e2a2e035e8e2a96529add4d96aeb..3bfb62bf5bc1e069d206fb0a9ea29b19f0809b38 100644 --- a/geomodel/src/gmserialized_typmod.cpp +++ b/geomodel/src/gmserialized_typmod.cpp @@ -2,7 +2,7 @@  *  * gmserialized_typmpd.c  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License @@ -231,7 +231,7 @@ gmserialized_typmod_in(ArrayType *arr) (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), errmsg("typmod array must not contain nulls"))); /** - * @brief 函数原型如下,具体的参数,可以通过 select * from pg_type 查看 + * @brief 函数原型如下,具体的参数,可以通过 selece * from pg_type 查看 * void deconstruct_array(ArrayType* array, Oid elmtype, int elmlen, * bool elmbyval, char elmalign, Datum** elemsp, * bool** nullsp, int* nelemsp) diff --git a/geomodel/src/paramobj.cpp b/geomodel/src/paramobj.cpp index f86948b4020e305fbfde0235bfe30ac1786d1657..91b9fe8ef5c7847b6af7e1e3cd8bed7388f90864 100644 --- a/geomodel/src/paramobj.cpp +++ b/geomodel/src/paramobj.cpp @@ -2,7 +2,7 @@  *  * src/paramobj.cpp  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/geomodel/src/paramobj.h b/geomodel/src/paramobj.h index d2bd02a935e8353c812bbc177b3dfff220f4cf5e..c83411c3ffc3e5e4a61fec5190171919b2ba3d4a 100644 --- a/geomodel/src/paramobj.h +++ b/geomodel/src/paramobj.h @@ -2,7 +2,7 @@  *  * src/paramobj.h  * - * Copyright (C) 2021 SuperMap Software Co., Ltd. + * Copyright (C)  SuperMap Software Co., Ltd.  *  * Yukon is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License diff --git a/liblwgeom/Makefile.in b/liblwgeom/Makefile.in index b21050735ec7e1ab1289eafce224aa66a1c8fd4e..6d74d5904fb27d27d42c9e4621dc122dd86012ab 100644 --- a/liblwgeom/Makefile.in +++ b/liblwgeom/Makefile.in @@ -64,6 +64,7 @@ SA_OBJS = \ lwline.o \ lwpoly.o \ lwellipse.o \ + lwbezier.o \ lwtriangle.o \ lwmpoint.o \ lwmline.o \ diff --git a/liblwgeom/gbox.c b/liblwgeom/gbox.c index ce9dad5019427c2a0750e1cebac38339c5f32e68..6c6c6b702d8d40f61fe97ce75332b9fc23bb0ac0 100644 --- a/liblwgeom/gbox.c +++ b/liblwgeom/gbox.c @@ -709,6 +709,21 @@ lwellipse_calculate_gbox_cartesian(LWELLIPSE *ellipse, GBOX *gbox) return res; } +static int +lwbezier_calculate_gbox_cartesian(LWBEZIER *bezier, GBOX *gbox) +{ + if (!bezier) + { + return LW_FAILURE; + } + /* convert it to linestring */ + LWLINE *temp = lwbezier_linearize(bezier, 72); + + int res = lwline_calculate_gbox_cartesian((LWLINE *)temp, gbox); + lwline_free(temp); + return res; +} + static int lwpoly_calculate_gbox_cartesian(LWPOLY *poly, GBOX *gbox) { if ( ! poly ) return LW_FAILURE; @@ -771,6 +786,8 @@ int lwgeom_calculate_gbox_cartesian(const LWGEOM *lwgeom, GBOX *gbox) return lwtriangle_calculate_gbox_cartesian((LWTRIANGLE *)lwgeom, gbox); case ELLIPSETYPE: return lwellipse_calculate_gbox_cartesian((LWELLIPSE *)lwgeom, gbox); + case BEZIERTYPE: + return lwbezier_calculate_gbox_cartesian((LWBEZIER *)lwgeom, gbox); case COMPOUNDTYPE: case CURVEPOLYTYPE: case MULTIPOINTTYPE: diff --git a/liblwgeom/gserialized2.c b/liblwgeom/gserialized2.c index 9701f57cab5f1163f5f3d8272fb5d0a99199bbfe..a62985830b4a32b151986ff4b82eab1c5984881e 100644 --- a/liblwgeom/gserialized2.c +++ b/liblwgeom/gserialized2.c @@ -734,6 +734,21 @@ static size_t gserialized2_from_lwellipse_size(const LWELLIPSE *ellipse) return size; } +static size_t +gserialized2_from_lwbezier_size(const LWBEZIER *bezier) +{ + size_t size = 4; /* Type number. */ + + assert(bezier); + POINTARRAY *point = bezier->data->points; + size += 4; /* Number of points (one or zero (empty)). */ + size += point->npoints * FLAGS_NDIMS(point->flags) * sizeof(double); + + LWDEBUGF(3, "bezier size = %d", size); + + return size; +} + static size_t gserialized2_from_lwcollection_size(const LWCOLLECTION *col) { size_t size = 4; /* Type number. */ @@ -773,6 +788,8 @@ static size_t gserialized2_from_any_size(const LWGEOM *geom) return gserialized2_from_lwcircstring_size((LWCIRCSTRING *)geom); case ELLIPSETYPE: return gserialized2_from_lwellipse_size((LWELLIPSE *)geom); + case BEZIERTYPE: + return gserialized2_from_lwbezier_size((LWBEZIER *)geom); case CURVEPOLYTYPE: case COMPOUNDTYPE: case MULTIPOINTTYPE: @@ -1059,6 +1076,37 @@ static size_t gserialized2_from_lwellipse(const LWELLIPSE *ellipse, uint8_t *buf return (size_t)(loc - buf); } +static size_t gserialized2_from_lwbezier(const LWBEZIER *bezier, uint8_t *buf) +{ +uint8_t *loc; + int ptsize; + size_t size; + int type = BEZIERTYPE; + + assert(bezier); + assert(buf); + ptsize = ptarray_point_size(bezier->data->points); + loc = buf; + + // write type + memcpy(loc, &type, sizeof(uint32_t)); + loc += sizeof(uint32_t); + + /* Write in the npoints. */ + memcpy(loc, &bezier->data->points->npoints, sizeof(uint32_t)); + loc += sizeof(uint32_t); + + /* Copy in the ordinates. */ + if (bezier->data->points->npoints > 0) + { + size = bezier->data->points->npoints * ptsize; + memcpy(loc, getPoint_internal(bezier->data->points, 0), size); + loc += size; + } + + return (size_t)(loc - buf); +} + static size_t gserialized2_from_lwcollection(const LWCOLLECTION *coll, uint8_t *buf) { size_t subsize = 0; @@ -1116,6 +1164,8 @@ static size_t gserialized2_from_lwgeom_any(const LWGEOM *geom, uint8_t *buf) return gserialized2_from_lwcircstring((LWCIRCSTRING *)geom, buf); case ELLIPSETYPE: return gserialized2_from_lwellipse((LWELLIPSE *)geom, buf); + case BEZIERTYPE: + return gserialized2_from_lwbezier((LWBEZIER *)geom, buf); case CURVEPOLYTYPE: case COMPOUNDTYPE: case MULTIPOINTTYPE: @@ -1454,6 +1504,38 @@ static LWELLIPSE * lwellipse_from_gserialized2_buffer(uint8_t *data_ptr, lwflags return ellipse; } +static LWBEZIER * lwbezier_from_gserialized2_buffer(uint8_t *data_ptr, lwflags_t lwflags, size_t *size, int32_t srid) +{ + uint8_t *start_ptr = data_ptr; + LWBEZIER *bezier; + int npoints = 0; + assert(data_ptr); + + bezier = (LWBEZIER *)lwalloc(sizeof(LWBEZIER)); + bezier->srid = srid; /* Default */ + bezier->bbox = NULL; + bezier->type = BEZIERTYPE; + bezier->flags = lwflags; + + data_ptr += 4; /* Skip past the type. */ + + npoints = gserialized2_get_uint32_t(data_ptr); /* Zero => empty geometry */ + data_ptr += 4; /* Skip past the npoints. */ + + //需要复制数据,否则会造成同一块空间释放两次 + bezier->data = lwalloc(sizeof(BEZIER)); + + if (npoints > 0) + bezier->data->points = + ptarray_construct_reference_data(FLAGS_GET_Z(lwflags), FLAGS_GET_M(lwflags), npoints, data_ptr); + + data_ptr += FLAGS_NDIMS(lwflags) * npoints * sizeof(double); + + if (size) + *size = data_ptr - start_ptr; + return bezier; +} + static LWCIRCSTRING * lwcircstring_from_gserialized2_buffer(uint8_t *data_ptr, lwflags_t lwflags, size_t *size, int32_t srid) { @@ -1571,6 +1653,8 @@ lwgeom_from_gserialized2_buffer(uint8_t *data_ptr, lwflags_t lwflags, size_t *g_ return (LWGEOM *)lwtriangle_from_gserialized2_buffer(data_ptr, lwflags, g_size, srid); case ELLIPSETYPE: return (LWGEOM *)lwellipse_from_gserialized2_buffer(data_ptr, lwflags, g_size, srid); + case BEZIERTYPE: + return (LWGEOM *)lwbezier_from_gserialized2_buffer(data_ptr, lwflags, g_size, srid); case MULTIPOINTTYPE: case MULTILINETYPE: case MULTIPOLYGONTYPE: diff --git a/liblwgeom/liblwgeom.h.in b/liblwgeom/liblwgeom.h.in index 075ef41ae624fe8b38d2fe1b3922599331e8c580..1fc06de2693b599086c1db19acf2b29a988018c8 100644 --- a/liblwgeom/liblwgeom.h.in +++ b/liblwgeom/liblwgeom.h.in @@ -129,7 +129,8 @@ const char* lwgeom_version(void); #define TRIANGLETYPE 14 #define TINTYPE 15 #define ELLIPSETYPE 16 -#define NUMTYPES 17 +#define BEZIERTYPE 17 +#define NUMTYPES 18 /** * Flags applied in EWKB to indicate Z/M dimensions and @@ -689,7 +690,7 @@ typedef struct } LWTIN; -/* TINTYPE */ +/* ELLIPSE TYPE */ typedef struct { GBOX *bbox; @@ -701,6 +702,22 @@ typedef struct } LWELLIPSE; +/* BEZIER TYPE */ +typedef struct +{ + POINTARRAY *points; +} BEZIER; + +typedef struct +{ + GBOX *bbox; + BEZIER *data; + int32_t srid; + lwflags_t flags; + uint8_t type; /* BEZIERTYPE */ + char pad[1]; /* Padding to 24 bytes (unused) */ +} LWBEZIER; + /* Casts LWGEOM->LW* (return NULL if cast is illegal) */ extern LWMPOLY *lwgeom_as_lwmpoly(const LWGEOM *lwgeom); extern LWMLINE *lwgeom_as_lwmline(const LWGEOM *lwgeom); @@ -1289,6 +1306,7 @@ extern void lwcollection_free(LWCOLLECTION *col); extern void lwcircstring_free(LWCIRCSTRING *curve); extern void lwgeom_free(LWGEOM *geom); extern void lwellipse_free(LWELLIPSE* e); +extern void lwbezier_free(LWBEZIER* e); /* * The *_release family of functions frees the LWGEOM structures diff --git a/liblwgeom/liblwgeom_internal.h b/liblwgeom/liblwgeom_internal.h index df0b26b813d76ece91bd451c8b21db959a16d71f..fd015a1267ecc2340860c3e85f1e2998705b51a7 100644 --- a/liblwgeom/liblwgeom_internal.h +++ b/liblwgeom/liblwgeom_internal.h @@ -118,7 +118,7 @@ #define WKB_TIN_TYPE 16 #define WKB_TRIANGLE_TYPE 17 #define WKB_ELLIPSE_TYPE 18 - +#define WKB_BEZIER_TYPE 19 /** * Macro that returns: @@ -201,6 +201,7 @@ uint32_t lwline_count_vertices(LWLINE *line); uint32_t lwpoly_count_vertices(LWPOLY *poly); uint32_t lwcollection_count_vertices(LWCOLLECTION *col); uint32_t lwellipse_count_vertices(LWELLIPSE *ellipse); +uint32_t lwbezier_count_vertices(LWBEZIER *bezier); /* * DP simplification @@ -270,7 +271,9 @@ double lwsector_elliptic_arc_area(const LWELLIPSE* pGeoSub, POINT2D pntAnchar); * 参数化对象拟合函数 * */ -LWLINE* lwellipse_get_spatialdata(LWELLIPSE* ellipse,unsigned int); +LWLINE* lwellipse_get_spatialdata(LWELLIPSE* ellipse, unsigned int); +LWLINE* lwbezier_linearize(LWBEZIER * bezier, unsigned int); +double lwbezier_area(const LWBEZIER *bezier, const POINT2D *pt); /** * Pull a #GBOX from the header of a #GSERIALIZED, if one is available. If @@ -306,7 +309,7 @@ double lwcurvepoly_perimeter(const LWCURVEPOLY *poly); double lwcurvepoly_perimeter_2d(const LWCURVEPOLY *poly); double lwtriangle_perimeter(const LWTRIANGLE *triangle); double lwtriangle_perimeter_2d(const LWTRIANGLE *triangle); - +double lwbezier_length_2d(const LWBEZIER *bezier); /* * Segmentization */ @@ -422,7 +425,7 @@ int lwcompound_is_closed(const LWCOMPOUND *curve); int lwpsurface_is_closed(const LWPSURFACE *psurface); int lwtin_is_closed(const LWTIN *tin); int lwellipse_is_closed(const LWELLIPSE *ellipse); - +int lwbezier_is_closed(const LWBEZIER *beizer); /** * Snap to grid */ diff --git a/liblwgeom/lwbezier.c b/liblwgeom/lwbezier.c new file mode 100644 index 0000000000000000000000000000000000000000..7f42a467ee987ba88bee5841e558ccba5cc89bc3 --- /dev/null +++ b/liblwgeom/lwbezier.c @@ -0,0 +1,228 @@ +#include +#include +#include +#include +#include +#include "liblwgeom_internal.h" +#include "lwgeom_log.h" + +int +lwbezier_is_closed(const LWBEZIER *beizer) +{ + POINT4D first,last; + getPoint4d_p(beizer->data->points, 0, &first); + getPoint4d_p(beizer->data->points, 3, &last); + + if (!(FP_EQUALS(first.x, last.x) && FP_EQUALS(first.y, last.y))) + { + return LW_FAILURE; + } + + return LW_TRUE; +} + +uint32_t lwbezier_count_vertices(LWBEZIER *beizer) +{ + assert(beizer); + if ( ! beizer->data->points ) + return 0; + return beizer->data->points->npoints; +} + +POINT2D +bezier_interpolation_func(float t, POINT2D *points, int count) +{ + assert(count > 0); + + POINT2D *tmp_points = malloc(sizeof(POINT2D) * count); + for (int i = 1; i < count; ++i) + { + for (int j = 0; j < count - i; ++j) + { + if (i == 1) + { + tmp_points[j].x = (float)(points[j].x * (1 - t) + points[j + 1].x * t); + tmp_points[j].y = (float)(points[j].y * (1 - t) + points[j + 1].y * t); + continue; + } + tmp_points[j].x = (float)(tmp_points[j].x * (1 - t) + tmp_points[j + 1].x * t); + tmp_points[j].y = (float)(tmp_points[j].y * (1 - t) + tmp_points[j + 1].y * t); + } + } + POINT2D res; + res.x = tmp_points[0].x; + res.y = tmp_points[0].y; + free(tmp_points); + return res; +} + +void +draw_bezier_curves(POINT2D *points, int count, POINT2D *out_points, int out_count) +{ + float step = 1.0 / out_count; + float t = 0; + for (int i = 0; i < out_count; i++) + { + POINT2D temp_point = bezier_interpolation_func(t, points, count); // 计算插值点 + t += step; + out_points[i] = temp_point; + } +} + +/** + * @brief 贝塞尔曲线拟合 + * + * @param bezier 贝塞尔曲线 + * @param seg 段数 + * @return LWLINE* 拟合后的线段 + */ +LWLINE * +lwbezier_linearize(LWBEZIER *bezier, unsigned int seg) +{ + // 拟合后的点 + POINT2D *output_points = malloc(sizeof(POINT2D) * seg); + + // 构造初始点 + int npoints = bezier->data->points->npoints; + POINT2D *source_point = malloc(sizeof(POINT2D) * npoints); + + for (int i = 0; i < npoints; i++) + { + POINT4D pt; + getPoint4d_p(bezier->data->points, i, &pt); + source_point[i].x = pt.x; + source_point[i].y = pt.y; + } + + // 拟合 + draw_bezier_curves(source_point, npoints, output_points, seg); + + // 构造返回值 + LWLINE *lwgeom = NULL; + POINTARRAY *parr = ptarray_construct_copy_data( + FLAGS_GET_Z(bezier->flags), FLAGS_GET_M(bezier->flags), seg, (uint8_t *)output_points); + lwgeom = lwline_construct(4326, NULL, parr); + free(source_point); + free(output_points); + return lwgeom; +} + +void +lwbezier_free(LWBEZIER *bezier) +{ + if (!bezier) + { + return; + } + + if (bezier->bbox) + { + lwfree(bezier->bbox); + } + if (bezier->data) + { + lwfree(bezier->data); + } + lwfree(bezier); +} + +double inte_grand(double t, double a, double b, double c, double d, double e) +{ + return sqrt(a * pow(t, 4) + b * pow(t, 3) + c * pow(t, 2) + d * t + e); +} + +double SimpsonsRuleIntegration(double a, double b, double c, double d, double e, double A, double B, int n) +{ + double intervalwidth = (B - A) / n; + double integral = inte_grand(A, a, b, c, d, e) + inte_grand(B, a, b, c, d, e); + + for(int i = 1; i <= n -1; i += 2) + { + integral += 4 * inte_grand(A + i * intervalwidth, a, b, c, d, e); + } + + for (int i = 2; i <= n - 2; i += 2) + { + integral += 2 * inte_grand(A + i * intervalwidth, a, b, c, d, e); + } + + return (intervalwidth / 3) * integral; +} + +POINT2D* Evaluate(double dt,const LWBEZIER *bezier) +{ + const POINT2D *pt = NULL; + double pos[4][2]; + for (int i = 0; i < 4; i++) + { + pt = getPoint2d_cp(bezier->data->points, i); + pos[i][0] = pt->x; + pos[i][1] = pt->y; + } + + double x = pow(1 - dt, 3) * pos[0][0] + 3 * pow(1 - dt, 2) * dt * pos[1][0] + 3 * (1 - dt) * pow(dt, 2) * pos[2][0] + pow(dt, 3) * pos[3][0]; + double y = pow(1 - dt, 3) * pos[0][1] + 3 * pow(1 - dt, 2) * dt * pos[1][1] + 3 * (1 - dt) * pow(dt, 2) * pos[2][1] + pow(dt, 3) * pos[3][1]; + + POINT2D *rpt = (POINT2D *)lwalloc(sizeof(POINT2D)); + rpt->x = x; + rpt->y = y; + return rpt; +} + +double lwbezier_area(const LWBEZIER *bezier, const POINT2D *pt) +{ + if (!bezier) + lwerror("lwbezier_area called with null bezier pointer!"); + + int numSegments = 200; // 你可以调整这个值以提高或降低精度 + double totalArea = 0.0; + + for (int i = 0; i < numSegments; ++i) + { + double t1 = (double)(i) / numSegments; + double t2 = (double)(i + 1) / numSegments; + + POINT2D *p1 = Evaluate(t1, bezier); + POINT2D *p2 = Evaluate(t2, bezier); + lwfree(p1); + lwfree(p2); + + totalArea += ((p2->x - pt->x) * (p1->y - pt->y) - (p1->x - pt->x) * (p2->y - pt->y)) / 2; + } + + return totalArea; +} + +double lwbezier_length_2d(const LWBEZIER *bezier) +{ + if (!bezier) + lwerror("lwbezier_length_2d called with null bezier pointer!"); + + const POINT2D *pt; + double pos[4][2]; + int n = bezier->data->points->npoints; + if (n != 4) + lwerror("invalid bezier3"); + for (int i = 0; i < 4; i++) + { + pt = getPoint2d_cp(bezier->data->points, i); + pos[i][0] = pt->x; + pos[i][1] = pt->y; + } + + double ax = -pos[0][0] + 3 * pos[1][0] - 3 * pos[2][0] + pos[3][0]; + double bx = 3 * pos[0][0] - 6 * pos[1][0] + 3 * pos[2][0]; + double cx = -3 * pos[0][0] + 3 * pos[1][0]; + + double ay = -pos[0][1] + 3 * pos[1][1] - 3 * pos[2][1] + pos[3][1]; + double by = 3 * pos[0][1] - 6 * pos[1][1] + 3 * pos[2][1]; + double cy = -3 * pos[0][1] + 3 * pos[1][1]; + + double A = 9 * (ax * ax + ay * ay); + double B = 12 * (ax * bx + ay * by); + double C = 4 * (bx * bx + by * by) + 6 * (ax * cx + ay * cy); + double D = 4 * (bx * cx + by * cy); + double E = cx * cx + cy * cy; + int numIntervals = 1000; // 你可以调整这个值以提高或降低精度 + return SimpsonsRuleIntegration(A, B, C, D, E, 0.0, 1.0, numIntervals); +} \ No newline at end of file diff --git a/liblwgeom/lwcollection.c b/liblwgeom/lwcollection.c index 6be82c01e3dd2f7dc5f912b600a790bdfffd7a4a..0e827aaa800529587ab7c44ca61ef8baf13e20f4 100644 --- a/liblwgeom/lwcollection.c +++ b/liblwgeom/lwcollection.c @@ -524,13 +524,13 @@ int lwcollection_allows_subtype(int collectiontype, int subtype) subtype == POLYGONTYPE ) return LW_TRUE; if ( collectiontype == COMPOUNDTYPE && - (subtype == LINETYPE || subtype == CIRCSTRINGTYPE || subtype == ELLIPSETYPE) ) + (subtype == LINETYPE || subtype == CIRCSTRINGTYPE || subtype == ELLIPSETYPE || subtype == BEZIERTYPE ) ) return LW_TRUE; if ( collectiontype == CURVEPOLYTYPE && - (subtype == CIRCSTRINGTYPE || subtype == LINETYPE || subtype == COMPOUNDTYPE || subtype == ELLIPSETYPE) ) + (subtype == CIRCSTRINGTYPE || subtype == LINETYPE || subtype == COMPOUNDTYPE || subtype == ELLIPSETYPE || subtype == BEZIERTYPE ) ) return LW_TRUE; if ( collectiontype == MULTICURVETYPE && - (subtype == CIRCSTRINGTYPE || subtype == LINETYPE || subtype == COMPOUNDTYPE) ) + (subtype == CIRCSTRINGTYPE || subtype == LINETYPE || subtype == COMPOUNDTYPE || subtype == ELLIPSETYPE || subtype == BEZIERTYPE) ) return LW_TRUE; if ( collectiontype == MULTISURFACETYPE && (subtype == POLYGONTYPE || subtype == CURVEPOLYTYPE) ) diff --git a/liblwgeom/lwcompound.c b/liblwgeom/lwcompound.c index b5f9aab4422dec9128ad37bcf35f3d2052dfa41f..4c1212ff6c68c80920cf06e7319cd63bb3df8c4e 100644 --- a/liblwgeom/lwcompound.c +++ b/liblwgeom/lwcompound.c @@ -147,18 +147,29 @@ int lwcompound_add_lwgeom(LWCOMPOUND *comp, LWGEOM *geom) LWELLIPSE *ellipse = (LWELLIPSE *)geom; getPoint4d_p(ellipse->data->points, 0, &first); } + else if(geom->type == BEZIERTYPE) + { + LWBEZIER *bezier = (LWBEZIER *)geom; + getPoint4d_p(bezier->data->points, 0, &first); + } else { newline = (LWLINE *)geom; getPoint4d_p(newline->points, 0, &first); } /*previous poiont of the collection we have added*/ - if (col->geoms[col->ngeoms - 1]->type == ELLIPSETYPE) + if ( col->geoms[col->ngeoms - 1]->type == ELLIPSETYPE ) { LWGEOM *prelwgeom = col->geoms[col->ngeoms - 1]; LWELLIPSE *ellipse = (LWELLIPSE *)prelwgeom; getPoint4d_p(ellipse->data->points, 1, &last); } + else if ( col->geoms[col->ngeoms - 1]->type == BEZIERTYPE ) + { + LWGEOM *prelwgeom = col->geoms[col->ngeoms - 1]; + LWBEZIER *beizer = (LWBEZIER *)prelwgeom; + getPoint4d_p(beizer->data->points, 3, &last); + } else { prevline = (LWLINE *)(col->geoms[col->ngeoms - 1]); diff --git a/liblwgeom/lwcurvepoly.c b/liblwgeom/lwcurvepoly.c index 2d29ce6b1a4023120f48ea3b6fa91bf4eac21003..1152e287003ee5888bc5bafefa0e39ae7aeb1bc1 100644 --- a/liblwgeom/lwcurvepoly.c +++ b/liblwgeom/lwcurvepoly.c @@ -247,7 +247,7 @@ int lwcurvepoly_add_ring(LWCURVEPOLY *poly, LWGEOM *ring) } /* Check that we're adding an allowed ring type */ - if ( ! ( ring->type == LINETYPE || ring->type == CIRCSTRINGTYPE || ring->type == COMPOUNDTYPE || ring->type == ELLIPSETYPE) ) + if ( ! ( ring->type == LINETYPE || ring->type == CIRCSTRINGTYPE || ring->type == COMPOUNDTYPE || ring->type == ELLIPSETYPE || ring->type == BEZIERTYPE) ) { LWDEBUGF(4,"got incorrect ring type: %s",lwtype_name(ring->type)); return LW_FAILURE; @@ -469,12 +469,12 @@ lwsector_elliptic_arc_area(const LWELLIPSE *pEllipticArc, POINT2D Pnt) if (isLeft(Pnt, pntStart, pntEnd) != isLeft(pntMid, pntStart, pntEnd)) //弓形走向为逆时针时,指定面积为正,否则为负 { - if (dTriangleArea < 0) + if (dTriangleArea < 0 && dEachArea < 0) { dEachArea = -dEachArea; } } - else + else if (dTriangleArea > 0 && dEachArea < 0) { dEachArea = -dEachArea; } diff --git a/liblwgeom/lwellipse.c b/liblwgeom/lwellipse.c index 33da6b1245806e4cfd6aca7112fc87b90815c0eb..f90c3a5a4dcdce7e8ae0e4a4d7ed533d12ca0a58 100644 --- a/liblwgeom/lwellipse.c +++ b/liblwgeom/lwellipse.c @@ -143,6 +143,7 @@ lwellipse_get_spatialdata(LWELLIPSE *geom, unsigned int segment) //创建 POINTARRAY POINTARRAY *parr = ptarray_construct_copy_data(FLAGS_GET_Z(geom->flags), FLAGS_GET_M(geom->flags), len, (uint8_t *)poarr); lwgeom = lwline_construct(4326, NULL, parr); + free(poarr); } return lwgeom; } diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c index 3ae12960fa5fcd00c93671152b38b439818bf9b1..3fea7573810496abdbe586609c1273f325fa1316 100644 --- a/liblwgeom/lwgeom.c +++ b/liblwgeom/lwgeom.c @@ -1186,6 +1186,9 @@ void lwgeom_free(LWGEOM *lwgeom) case ELLIPSETYPE: lwellipse_free((LWELLIPSE*)lwgeom); break; + case BEZIERTYPE: + lwbezier_free((LWBEZIER *)lwgeom); + break; case CURVEPOLYTYPE: case COMPOUNDTYPE: case MULTICURVETYPE: @@ -1270,6 +1273,9 @@ uint32_t lwgeom_count_vertices(const LWGEOM *geom) case ELLIPSETYPE: result = lwellipse_count_vertices((LWELLIPSE*)geom); break; + case BEZIERTYPE: + result = lwbezier_count_vertices((LWBEZIER*)geom); + break; case COMPOUNDTYPE: case CURVEPOLYTYPE: case MULTICURVETYPE: @@ -1983,6 +1989,8 @@ double lwgeom_length_2d(const LWGEOM *geom) return lwcircstring_length_2d((LWCIRCSTRING*)geom); else if ( type == COMPOUNDTYPE ) return lwcompound_length_2d((LWCOMPOUND*)geom); + else if ( type == BEZIERTYPE ) + return lwbezier_length_2d((LWBEZIER*)geom); else if ( lwgeom_is_collection(geom) ) { double length = 0.0; diff --git a/liblwgeom/lwin_wkb.c b/liblwgeom/lwin_wkb.c index c2451bd9452b9cb7cd99fca81cc71a8586e61454..6dca7634ce86368aa13243151698806840c2fee7 100644 --- a/liblwgeom/lwin_wkb.c +++ b/liblwgeom/lwin_wkb.c @@ -249,6 +249,9 @@ static void lwtype_from_wkb_state(wkb_parse_state *s, uint32_t wkb_type) case WKB_ELLIPSE_TYPE: s->lwtype = ELLIPSETYPE; break; + case WKB_BEZIER_TYPE: + s->lwtype = BEZIERTYPE; + break; default: /* Error! */ lwerror("Unknown WKB type (%d)! Full WKB type number was (%d).", wkb_simple_type, wkb_type); @@ -709,6 +712,34 @@ static LWELLIPSE * lwellipse_from_wkb_state(wkb_parse_state *s) res->flags = res->data->points->flags; return res; } + +/** + * BEZIER + */ +static LWBEZIER * +lwbezier_from_wkb_state(wkb_parse_state *s) +{ + LWBEZIER *res; + + /* TODO: 计算合理的数据长度 */ + // wkb_parse_state_check(s, sizeof(ELLIPSE)); + if (s->error) + return NULL; + + res = lwalloc(sizeof(LWBEZIER)); + if (res == NULL) + { + return NULL; + } + res->type = BEZIERTYPE; + res->srid = s->srid; + res->bbox = NULL; + res->data = lwalloc(sizeof(BEZIER)); + res->data->points = ptarray_from_wkb_state(s); + res->flags = res->data->points->flags; + return res; +} + /** * POLYHEDRALSURFACETYPE */ @@ -837,6 +868,9 @@ LWGEOM* lwgeom_from_wkb_state(wkb_parse_state *s) case ELLIPSETYPE: return (LWGEOM *)lwellipse_from_wkb_state(s); break; + case BEZIERTYPE: + return (LWGEOM *)lwbezier_from_wkb_state(s); + break; case MULTIPOINTTYPE: case MULTILINETYPE: case MULTIPOLYGONTYPE: diff --git a/liblwgeom/lwin_wkt.c b/liblwgeom/lwin_wkt.c index 6938a2665bc16868660d11ea8a5089929352c11a..54d8e765b2aa520860fe8078aee3f556e94d5b30 100644 --- a/liblwgeom/lwin_wkt.c +++ b/liblwgeom/lwin_wkt.c @@ -644,6 +644,10 @@ LWGEOM* wkt_parser_curvepolygon_add_ring(LWGEOM *poly, LWGEOM *ring) case ELLIPSETYPE: is_closed = lwellipse_is_closed((LWELLIPSE*)ring); break; + + case BEZIERTYPE: + is_closed = lwbezier_is_closed((LWBEZIER*)ring); + break; } if ( ! is_closed ) { @@ -919,6 +923,77 @@ wkt_parser_ellipse(POINT start, return (LWGEOM *)ellipse; } +LWGEOM * +wkt_parse_bezier3(POINT _1th, POINT _2th, POINT _3th, POINT _4th, char *dimensionality) +{ + lwflags_t flags = 0; + lwflags_t dim = wkt_dimensionality(dimensionality); + LWBEZIER *bezier = lwalloc(sizeof(LWBEZIER)); + // POINT3DZ p; + bezier->bbox = NULL; + bezier->data = lwalloc(sizeof(BEZIER)); + /* 这里我们新建一个空的 pointarray */ + bezier->data->points = ptarray_construct_empty(FLAGS_GET_Z(dim), FLAGS_GET_M(dim), 3); + + POINT4D pt; + pt.z = 0; + pt.m = 0; + // 第一个点 + pt.x = _1th.x; + pt.y = _1th.y; + if (FLAGS_GET_Z(bezier->data->points->flags)) + pt.z = _1th.z; + if (FLAGS_GET_M(bezier->data->points->flags)) + pt.m = _1th.m; + /* If the destination is XYM, we'll write the third coordinate to m */ + if (FLAGS_GET_M(bezier->data->points->flags) && !FLAGS_GET_Z(bezier->data->points->flags)) + pt.m = _1th.z; + ptarray_append_point(bezier->data->points, &pt, LW_TRUE); + // 第二个点 + pt.x = _2th.x; + pt.y = _2th.y; + if (FLAGS_GET_Z(bezier->data->points->flags)) + pt.z = _2th.z; + if (FLAGS_GET_M(bezier->data->points->flags)) + pt.m = _2th.m; + /* If the destination is XYM, we'll write the third coordinate to m */ + if (FLAGS_GET_M(bezier->data->points->flags) && !FLAGS_GET_Z(bezier->data->points->flags)) + pt.m = _2th.z; + ptarray_append_point(bezier->data->points, &pt, LW_TRUE); + // 第三个点 + pt.x = _3th.x; + pt.y = _3th.y; + if (FLAGS_GET_Z(bezier->data->points->flags)) + pt.z = _3th.z; + if (FLAGS_GET_M(bezier->data->points->flags)) + pt.m = _3th.m; + /* If the destination is XYM, we'll write the third coordinate to m */ + if (FLAGS_GET_M(bezier->data->points->flags) && !FLAGS_GET_Z(bezier->data->points->flags)) + pt.m = _3th.z; + ptarray_append_point(bezier->data->points, &pt, LW_TRUE); + // 第四个点 + pt.x = _4th.x; + pt.y = _4th.y; + if (FLAGS_GET_Z(bezier->data->points->flags)) + pt.z = _4th.z; + if (FLAGS_GET_M(bezier->data->points->flags)) + pt.m = _4th.m; + /* If the destination is XYM, we'll write the third coordinate to m */ + if (FLAGS_GET_M(bezier->data->points->flags) && !FLAGS_GET_Z(bezier->data->points->flags)) + pt.m = _4th.z; + ptarray_append_point(bezier->data->points, &pt, LW_TRUE); + + FLAGS_SET_BBOX(flags, 0); + FLAGS_SET_Z(flags, FLAGS_GET_Z(dim)); + FLAGS_SET_M(flags, FLAGS_GET_M(dim)); + + bezier->flags = flags; + bezier->srid = 0; + bezier->type = BEZIERTYPE; + + return (LWGEOM *)bezier; +} + LWGEOM* wkt_parser_collection_finalize(int lwtype, LWGEOM *geom, char *dimensionality) { lwflags_t flags = wkt_dimensionality(dimensionality); diff --git a/liblwgeom/lwin_wkt.h b/liblwgeom/lwin_wkt.h index 08b6cabb3b43c1a32f72e647fed9e787261abe05..2604dacb2a5f7cd6478f85ce7726beaaa086e647 100644 --- a/liblwgeom/lwin_wkt.h +++ b/liblwgeom/lwin_wkt.h @@ -77,5 +77,6 @@ LWGEOM* wkt_parser_compound_add_geom(LWGEOM *col, LWGEOM *geom); LWGEOM* wkt_parser_collection_new(LWGEOM *geom); LWGEOM* wkt_parser_collection_add_geom(LWGEOM *col, LWGEOM *geom); LWGEOM* wkt_parser_collection_finalize(int lwtype, LWGEOM *col, char *dimensionality); -LWGEOM* wkt_parser_ellipse(POINT start,POINT end, POINT center, double minor, double clockwise, double roattion, double axis,double ratio,char *dimensionality); +LWGEOM* wkt_parser_ellipse(POINT start,POINT end, POINT center, double minor, double clockwise, double roattion, double axis, double ratio, char *dimensionality); +LWGEOM *wkt_parse_bezier3(POINT _1th, POINT _2th, POINT _3th, POINT _4th, char *dimensionality); void wkt_parser_geometry_new(LWGEOM *geom, int32_t srid); diff --git a/liblwgeom/lwin_wkt_lex.c b/liblwgeom/lwin_wkt_lex.c index 88e06f9730369d050af944d65fe0e751da3e7fd8..bf997848a9609308d51256cf616d384ac5e940b9 100644 --- a/liblwgeom/lwin_wkt_lex.c +++ b/liblwgeom/lwin_wkt_lex.c @@ -383,8 +383,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 28 -#define YY_END_OF_BUFFER 29 +#define YY_NUM_RULES 29 +#define YY_END_OF_BUFFER 30 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -392,30 +392,31 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[192] = +static yyconst flex_int16_t yy_accept[204] = { 0, - 0, 0, 29, 27, 26, 26, 22, 23, 24, 27, - 27, 27, 25, 27, 27, 27, 27, 21, 27, 27, - 27, 27, 21, 26, 0, 0, 0, 1, 0, 0, + 0, 0, 30, 28, 27, 27, 23, 24, 25, 28, + 28, 28, 26, 28, 28, 28, 28, 28, 22, 28, + 28, 28, 28, 22, 27, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 19, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, - 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 7, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 10, 0, 0, 0, 6, 5, 0, 0, - 12, 0, 0, 0, 0, 13, 0, 0, 0, 0, - 0, 0, 8, 0, 20, 0, 0, 0, 15, 4, - 0 + 0, 21, 0, 0, 10, 0, 0, 0, 6, 5, + 0, 0, 12, 0, 0, 0, 0, 13, 0, 0, + 0, 0, 0, 0, 8, 0, 20, 0, 0, 0, + 15, 4, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -425,15 +426,15 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 4, 5, 1, 6, 7, 8, 9, 1, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 1, 11, 1, - 12, 1, 1, 1, 13, 1, 14, 15, 16, 17, - 18, 19, 20, 1, 1, 21, 22, 23, 24, 25, - 1, 26, 27, 28, 29, 30, 1, 1, 31, 32, - 1, 1, 1, 1, 1, 1, 33, 1, 34, 35, - - 36, 37, 38, 39, 40, 1, 1, 41, 42, 43, - 44, 45, 1, 46, 47, 48, 49, 50, 1, 1, - 51, 52, 1, 1, 1, 1, 1, 1, 1, 1, + 11, 10, 10, 10, 10, 10, 10, 1, 12, 1, + 13, 1, 1, 1, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 1, 1, 23, 24, 25, 26, 27, + 1, 28, 29, 30, 31, 32, 1, 1, 33, 34, + 1, 1, 1, 1, 1, 1, 35, 36, 37, 38, + + 39, 40, 41, 42, 43, 1, 1, 44, 45, 46, + 47, 48, 1, 49, 50, 51, 52, 53, 1, 1, + 54, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -450,176 +451,190 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[53] = +static yyconst flex_int32_t yy_meta[56] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1 + 1, 1, 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[192] = +static yyconst flex_int16_t yy_base[204] = { 0, - 0, 0, 402, 413, 51, 53, 413, 413, 413, 48, - 386, 57, 413, 41, 47, 47, 51, 43, 61, 51, - 50, 58, 55, 77, 384, 0, 98, 413, 108, 111, - 56, 64, 61, 88, 87, 92, 97, 101, 100, 104, - 106, 104, 108, 413, 383, 128, 123, 114, 111, 129, - 122, 129, 136, 125, 153, 131, 131, 148, 413, 151, - 136, 142, 151, 143, 144, 160, 150, 158, 413, 151, - 162, 204, 166, 169, 162, 167, 165, 413, 166, 174, - 209, 413, 180, 189, 198, 189, 202, 194, 194, 199, - 194, 195, 197, 208, 205, 202, 209, 218, 193, 89, - - 221, 218, 230, 226, 241, 226, 238, 233, 237, 248, - 235, 413, 237, 250, 243, 257, 241, 260, 260, 253, - 252, 268, 262, 256, 278, 284, 413, 270, 270, 282, - 280, 279, 288, 292, 282, 282, 293, 299, 292, 288, - 290, 298, 297, 304, 413, 413, 299, 413, 311, 323, - 311, 319, 310, 318, 315, 325, 322, 326, 334, 322, - 329, 337, 413, 328, 340, 342, 413, 413, 338, 347, - 413, 347, 361, 354, 361, 413, 356, 352, 363, 370, - 368, 368, 413, 375, 413, 366, 375, 369, 413, 413, - 413 - + 0, 0, 114, 458, 54, 56, 458, 458, 458, 51, + 53, 63, 458, 49, 49, 53, 51, 56, 48, 68, + 57, 56, 63, 62, 91, 98, 0, 108, 458, 118, + 124, 61, 89, 98, 96, 104, 104, 107, 111, 114, + 114, 118, 120, 119, 124, 458, 139, 166, 129, 137, + 132, 132, 144, 140, 151, 160, 149, 179, 158, 155, + 172, 458, 176, 174, 162, 168, 177, 170, 165, 183, + 173, 181, 458, 175, 186, 76, 183, 184, 194, 189, + 194, 195, 458, 200, 201, 216, 458, 208, 217, 239, + 216, 76, 223, 215, 218, 226, 226, 231, 231, 241, + + 241, 237, 245, 254, 145, 262, 251, 260, 249, 261, + 256, 265, 249, 263, 258, 262, 271, 262, 458, 268, + 283, 273, 276, 293, 277, 298, 297, 291, 286, 301, + 295, 288, 304, 310, 458, 299, 298, 298, 312, 312, + 310, 318, 325, 317, 317, 331, 338, 331, 323, 330, + 332, 335, 333, 340, 458, 458, 335, 458, 340, 353, + 341, 353, 352, 345, 353, 350, 362, 360, 364, 375, + 363, 458, 371, 379, 458, 372, 384, 381, 458, 458, + 376, 385, 458, 385, 392, 386, 393, 458, 388, 386, + 399, 406, 402, 405, 458, 414, 458, 405, 417, 411, + + 458, 458, 458 } ; -static yyconst flex_int16_t yy_def[192] = +static yyconst flex_int16_t yy_def[204] = { 0, - 191, 1, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 12, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 0 - + 203, 1, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 12, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + + 203, 203, 0 } ; -static yyconst flex_int16_t yy_nxt[466] = +static yyconst flex_int16_t yy_nxt[514] = { 0, 4, 5, 6, 7, 8, 4, 9, 10, 11, 12, - 13, 4, 4, 14, 4, 15, 4, 16, 4, 4, - 17, 18, 19, 4, 20, 4, 21, 22, 4, 4, - 4, 23, 4, 14, 4, 15, 4, 16, 4, 4, - 17, 18, 19, 4, 20, 4, 21, 22, 4, 4, - 4, 23, 24, 24, 24, 24, 25, 26, 28, 28, - 31, 28, 36, 28, 32, 29, 26, 34, 35, 33, - 37, 38, 30, 39, 40, 41, 44, 42, 24, 24, - 31, 47, 36, 43, 32, 48, 49, 34, 35, 33, - 37, 38, 30, 39, 40, 41, 44, 42, 100, 28, - - 28, 47, 28, 43, 28, 48, 49, 27, 50, 28, - 28, 51, 28, 30, 28, 52, 45, 27, 45, 53, - 46, 54, 55, 56, 57, 58, 59, 60, 50, 28, - 28, 51, 28, 30, 28, 52, 61, 46, 62, 53, - 63, 54, 55, 56, 57, 58, 59, 60, 64, 65, - 66, 67, 68, 70, 69, 69, 61, 69, 62, 69, - 63, 71, 72, 73, 74, 75, 76, 77, 64, 65, - 66, 67, 68, 70, 78, 79, 80, 81, 82, 83, - 84, 71, 72, 73, 74, 75, 76, 77, 86, 87, - 88, 89, 90, 91, 78, 79, 80, 81, 82, 83, - - 84, 92, 100, 97, 98, 99, 101, 100, 86, 87, - 88, 89, 90, 91, 102, 85, 103, 104, 105, 106, - 107, 92, 93, 97, 98, 108, 101, 109, 110, 94, - 111, 112, 113, 95, 102, 96, 103, 104, 105, 106, - 107, 114, 93, 115, 116, 108, 117, 109, 110, 94, - 111, 112, 113, 95, 118, 96, 119, 120, 121, 122, - 125, 114, 126, 115, 116, 127, 117, 123, 124, 128, - 129, 130, 131, 132, 118, 133, 119, 120, 121, 122, - 125, 134, 126, 135, 136, 127, 137, 123, 124, 128, - 129, 130, 131, 132, 138, 133, 139, 140, 141, 142, - - 143, 134, 144, 135, 136, 145, 137, 146, 147, 148, - 149, 150, 151, 152, 138, 153, 139, 140, 141, 142, - 143, 154, 144, 155, 156, 145, 157, 146, 147, 148, - 149, 150, 151, 152, 158, 153, 159, 160, 161, 162, - 163, 154, 164, 155, 156, 165, 157, 166, 167, 168, - 169, 170, 171, 172, 158, 173, 159, 160, 161, 162, - 163, 174, 164, 175, 176, 165, 177, 166, 167, 168, - 169, 170, 171, 172, 178, 173, 179, 180, 181, 182, - 183, 174, 184, 175, 176, 185, 177, 186, 187, 188, - 189, 190, 46, 27, 178, 27, 179, 180, 181, 182, - - 183, 191, 184, 191, 191, 185, 191, 186, 187, 188, - 189, 190, 3, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191 + 12, 13, 4, 4, 14, 15, 4, 16, 4, 17, + 4, 4, 18, 19, 20, 4, 21, 4, 22, 23, + 4, 4, 4, 24, 4, 14, 15, 4, 16, 4, + 17, 4, 4, 18, 19, 20, 4, 21, 4, 22, + 23, 4, 4, 4, 24, 25, 25, 25, 25, 26, + 27, 27, 28, 28, 29, 29, 32, 29, 38, 29, + 33, 30, 27, 27, 34, 36, 37, 39, 40, 35, + 31, 41, 42, 43, 44, 46, 108, 32, 90, 38, + 45, 33, 25, 25, 49, 34, 36, 37, 39, 40, + + 35, 31, 41, 42, 43, 44, 46, 28, 28, 29, + 29, 45, 29, 203, 29, 49, 50, 28, 28, 29, + 29, 51, 29, 52, 29, 31, 53, 28, 28, 47, + 54, 47, 55, 48, 48, 56, 57, 50, 58, 59, + 60, 61, 51, 62, 52, 63, 31, 53, 48, 48, + 64, 54, 65, 55, 106, 106, 56, 57, 66, 58, + 59, 60, 61, 67, 62, 68, 63, 29, 29, 69, + 29, 64, 29, 65, 70, 48, 48, 71, 72, 66, + 73, 73, 74, 73, 67, 73, 68, 75, 76, 77, + 69, 78, 79, 80, 81, 70, 82, 83, 71, 72, + + 84, 85, 86, 74, 87, 88, 89, 91, 75, 76, + 77, 92, 78, 79, 80, 81, 93, 82, 83, 94, + 95, 84, 85, 86, 96, 87, 88, 89, 91, 97, + 98, 99, 92, 103, 104, 107, 109, 93, 100, 110, + 94, 95, 101, 111, 102, 96, 105, 112, 106, 106, + 97, 98, 99, 113, 103, 104, 107, 109, 114, 100, + 110, 115, 116, 101, 111, 102, 117, 118, 112, 119, + 120, 106, 106, 121, 113, 122, 123, 124, 125, 114, + 126, 127, 115, 116, 128, 129, 130, 117, 118, 133, + 119, 120, 131, 132, 121, 134, 122, 123, 124, 125, + + 135, 126, 127, 136, 137, 128, 129, 130, 138, 139, + 133, 140, 141, 131, 132, 142, 134, 143, 144, 145, + 146, 135, 147, 148, 136, 137, 149, 150, 151, 138, + 139, 152, 140, 141, 153, 154, 142, 155, 143, 144, + 145, 146, 156, 147, 148, 157, 158, 149, 150, 151, + 159, 160, 152, 161, 162, 153, 154, 163, 155, 164, + 165, 166, 167, 156, 168, 169, 157, 158, 170, 171, + 172, 159, 160, 173, 161, 162, 174, 175, 163, 176, + 164, 165, 166, 167, 177, 168, 169, 178, 179, 170, + 171, 172, 180, 181, 173, 182, 183, 174, 175, 184, + + 176, 185, 186, 187, 188, 177, 189, 190, 178, 179, + 191, 192, 193, 180, 181, 194, 182, 183, 195, 196, + 184, 197, 185, 186, 187, 188, 198, 189, 190, 199, + 200, 191, 192, 193, 201, 202, 194, 203, 203, 195, + 196, 203, 197, 203, 203, 203, 203, 198, 203, 203, + 199, 200, 203, 203, 203, 201, 202, 3, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203 } ; -static yyconst flex_int16_t yy_chk[466] = +static yyconst flex_int16_t yy_chk[514] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 5, 5, 6, 6, 10, 10, 12, 12, - 14, 12, 16, 12, 14, 12, 12, 15, 15, 14, - 17, 18, 12, 19, 20, 21, 23, 22, 24, 24, - 14, 31, 16, 22, 14, 32, 33, 15, 15, 14, - 17, 18, 12, 19, 20, 21, 23, 22, 100, 27, - - 27, 31, 27, 22, 27, 32, 33, 27, 34, 29, - 29, 35, 29, 27, 29, 36, 30, 29, 30, 37, - 30, 38, 39, 40, 40, 41, 42, 43, 34, 46, - 46, 35, 46, 27, 46, 36, 47, 46, 48, 37, - 49, 38, 39, 40, 40, 41, 42, 43, 50, 51, - 52, 53, 54, 56, 55, 55, 47, 55, 48, 55, - 49, 57, 58, 60, 61, 62, 63, 64, 50, 51, - 52, 53, 54, 56, 65, 66, 67, 68, 70, 71, - 71, 57, 58, 60, 61, 62, 63, 64, 73, 74, - 75, 76, 77, 79, 65, 66, 67, 68, 70, 71, - - 71, 80, 99, 83, 84, 85, 86, 85, 73, 74, - 75, 76, 77, 79, 87, 72, 88, 89, 90, 91, - 92, 80, 81, 83, 84, 93, 86, 94, 95, 81, - 96, 97, 98, 81, 87, 81, 88, 89, 90, 91, - 92, 101, 81, 102, 103, 93, 104, 94, 95, 81, - 96, 97, 98, 81, 105, 81, 106, 107, 108, 109, - 111, 101, 113, 102, 103, 114, 104, 110, 110, 115, - 116, 117, 118, 119, 105, 120, 106, 107, 108, 109, - 111, 121, 113, 122, 123, 114, 124, 110, 110, 115, - 116, 117, 118, 119, 125, 120, 126, 128, 129, 130, - - 131, 121, 132, 122, 123, 133, 124, 134, 135, 136, - 137, 138, 139, 140, 125, 141, 126, 128, 129, 130, - 131, 142, 132, 143, 144, 133, 147, 134, 135, 136, - 137, 138, 139, 140, 149, 141, 150, 151, 152, 153, - 154, 142, 155, 143, 144, 156, 147, 157, 158, 159, - 160, 161, 162, 164, 149, 165, 150, 151, 152, 153, - 154, 166, 155, 169, 170, 156, 172, 157, 158, 159, - 160, 161, 162, 164, 173, 165, 174, 175, 177, 178, - 179, 166, 180, 169, 170, 181, 172, 182, 184, 186, - 187, 188, 45, 25, 173, 11, 174, 175, 177, 178, - - 179, 3, 180, 0, 0, 181, 0, 182, 184, 186, - 187, 188, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191 + 1, 1, 1, 1, 1, 5, 5, 6, 6, 10, + 10, 10, 11, 11, 12, 12, 14, 12, 17, 12, + 15, 12, 12, 12, 15, 16, 16, 18, 19, 15, + 12, 20, 21, 22, 23, 24, 92, 14, 76, 17, + 23, 15, 25, 25, 32, 15, 16, 16, 18, 19, + + 15, 12, 20, 21, 22, 23, 24, 26, 26, 28, + 28, 23, 28, 3, 28, 32, 33, 28, 28, 30, + 30, 34, 30, 35, 30, 28, 36, 30, 30, 31, + 37, 31, 38, 31, 31, 39, 40, 33, 41, 42, + 42, 43, 34, 44, 35, 45, 28, 36, 47, 47, + 49, 37, 50, 38, 105, 105, 39, 40, 51, 41, + 42, 42, 43, 52, 44, 53, 45, 48, 48, 54, + 48, 49, 48, 50, 55, 48, 48, 56, 57, 51, + 58, 58, 59, 58, 52, 58, 53, 60, 61, 63, + 54, 64, 65, 66, 67, 55, 68, 69, 56, 57, + + 70, 71, 72, 59, 74, 75, 75, 77, 60, 61, + 63, 78, 64, 65, 66, 67, 79, 68, 69, 80, + 81, 70, 71, 72, 82, 74, 75, 75, 77, 84, + 85, 86, 78, 88, 89, 91, 93, 79, 86, 94, + 80, 81, 86, 95, 86, 82, 90, 96, 90, 90, + 84, 85, 86, 97, 88, 89, 91, 93, 98, 86, + 94, 99, 100, 86, 95, 86, 101, 102, 96, 103, + 104, 106, 106, 107, 97, 108, 109, 110, 111, 98, + 112, 113, 99, 100, 114, 115, 116, 101, 102, 118, + 103, 104, 117, 117, 107, 120, 108, 109, 110, 111, + + 121, 112, 113, 122, 123, 114, 115, 116, 124, 125, + 118, 126, 127, 117, 117, 128, 120, 129, 130, 131, + 132, 121, 133, 134, 122, 123, 136, 137, 138, 124, + 125, 139, 126, 127, 140, 141, 128, 142, 129, 130, + 131, 132, 143, 133, 134, 144, 145, 136, 137, 138, + 146, 147, 139, 148, 149, 140, 141, 150, 142, 151, + 152, 153, 154, 143, 157, 159, 144, 145, 160, 161, + 162, 146, 147, 163, 148, 149, 164, 165, 150, 166, + 151, 152, 153, 154, 167, 157, 159, 168, 169, 160, + 161, 162, 170, 171, 163, 173, 174, 164, 165, 176, + + 166, 177, 178, 181, 182, 167, 184, 185, 168, 169, + 186, 187, 189, 170, 171, 190, 173, 174, 191, 192, + 176, 193, 177, 178, 181, 182, 194, 184, 185, 196, + 198, 186, 187, 189, 199, 200, 190, 0, 0, 191, + 192, 0, 193, 0, 0, 0, 0, 194, 0, 0, + 196, 198, 0, 0, 0, 199, 200, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203 } ; static yy_state_type yy_last_accepting_state; @@ -687,7 +702,7 @@ static void wkt_lexer_unknown() #define YY_NO_INPUT 1 /* Suppress the default implementations. */ -#line 691 "lwin_wkt_lex.c" +#line 706 "lwin_wkt_lex.c" #define INITIAL 0 @@ -870,7 +885,7 @@ YY_DECL #line 60 "lwin_wkt_lex.l" -#line 874 "lwin_wkt_lex.c" +#line 889 "lwin_wkt_lex.c" if ( !(yy_init) ) { @@ -923,13 +938,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 192 ) + if ( yy_current_state >= 204 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 191 ); + while ( yy_current_state != 203 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); @@ -1067,54 +1082,59 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 100 "lwin_wkt_lex.l" +#line 99 "lwin_wkt_lex.l" +{ return BEZIER_TOK; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 101 "lwin_wkt_lex.l" { LWDEBUG(5,"DIMENSIONALITY"); wkt_yylval.stringvalue = wkt_yytext; return DIMENSIONALITY_TOK; } YY_BREAK -case 22: -YY_RULE_SETUP -#line 106 "lwin_wkt_lex.l" -{ LWDEBUG(5,"LBRACKET"); return LBRACKET_TOK; } - YY_BREAK case 23: YY_RULE_SETUP #line 107 "lwin_wkt_lex.l" -{ LWDEBUG(5,"RBRACKET"); return RBRACKET_TOK; } +{ LWDEBUG(5,"LBRACKET"); return LBRACKET_TOK; } YY_BREAK case 24: YY_RULE_SETUP #line 108 "lwin_wkt_lex.l" -{ LWDEBUG(5,"COMMA"); return COMMA_TOK; } +{ LWDEBUG(5,"RBRACKET"); return RBRACKET_TOK; } YY_BREAK case 25: YY_RULE_SETUP #line 109 "lwin_wkt_lex.l" -{ LWDEBUG(5,"SEMICOLON"); return SEMICOLON_TOK; } +{ LWDEBUG(5,"COMMA"); return COMMA_TOK; } YY_BREAK case 26: -/* rule 26 can match eol */ YY_RULE_SETUP -#line 111 "lwin_wkt_lex.l" -{ /* ignore whitespace */ LWDEBUG(5,"WHITESPACE"); } +#line 110 "lwin_wkt_lex.l" +{ LWDEBUG(5,"SEMICOLON"); return SEMICOLON_TOK; } YY_BREAK case 27: +/* rule 27 can match eol */ +YY_RULE_SETUP +#line 112 "lwin_wkt_lex.l" +{ /* ignore whitespace */ LWDEBUG(5,"WHITESPACE"); } + YY_BREAK +case 28: YY_RULE_SETUP -#line 113 "lwin_wkt_lex.l" +#line 114 "lwin_wkt_lex.l" { /* Error out and stop parsing on unknown/unexpected characters */ LWDEBUG(5,"UNKNOWN"); wkt_lexer_unknown(); yyterminate(); } YY_BREAK -case 28: +case 29: YY_RULE_SETUP -#line 119 "lwin_wkt_lex.l" +#line 120 "lwin_wkt_lex.l" ECHO; YY_BREAK -#line 1118 "lwin_wkt_lex.c" +#line 1138 "lwin_wkt_lex.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1407,7 +1427,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 192 ) + if ( yy_current_state >= 204 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1435,11 +1455,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 192 ) + if ( yy_current_state >= 204 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 191); + yy_is_jam = (yy_current_state == 203); return yy_is_jam ? 0 : yy_current_state; } @@ -2050,7 +2070,7 @@ static int yy_flex_strlen (yyconst char * s ) #define YYTABLES_NAME "yytables" -#line 119 "lwin_wkt_lex.l" +#line 120 "lwin_wkt_lex.l" diff --git a/liblwgeom/lwin_wkt_lex.l b/liblwgeom/lwin_wkt_lex.l index 5bc26bdf7cb9788a8b3ea42b11f55ea11953ae73..65dbd0babd591f6b3f54a8d73d323940cd78352d 100644 --- a/liblwgeom/lwin_wkt_lex.l +++ b/liblwgeom/lwin_wkt_lex.l @@ -96,6 +96,7 @@ TIN { return TIN_TOK; } POINT { return POINT_TOK; } EMPTY { return EMPTY_TOK; } ELLIPTICALSTRING { return ELLIPTICALSTRING_TOK; } +BEZIER3CURVE { return BEZIER_TOK; } Z|M|ZM { LWDEBUG(5,"DIMENSIONALITY"); diff --git a/liblwgeom/lwin_wkt_parse.c b/liblwgeom/lwin_wkt_parse.c index e46be9c30eacc160dc4edaa6ef440d9f8c6972f2..957c9361d118fab1c6e74cf56129623effe92eb8 100644 --- a/liblwgeom/lwin_wkt_parse.c +++ b/liblwgeom/lwin_wkt_parse.c @@ -1,9 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.8.2. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, - Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -34,10 +33,6 @@ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ -/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, - especially those whose name start with YY_ or yy_. They are - private implementation details that can be changed or removed. */ - /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. @@ -45,11 +40,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Identify Bison output, and Bison version. */ -#define YYBISON 30802 +/* Identify Bison output. */ +#define YYBISON 1 -/* Bison version string. */ -#define YYBISON_VERSION "3.8.2" +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -70,12 +65,13 @@ #define yyerror wkt_yyerror #define yydebug wkt_yydebug #define yynerrs wkt_yynerrs + #define yylval wkt_yylval #define yychar wkt_yychar #define yylloc wkt_yylloc -/* First part of user prologue. */ -#line 1 "lwin_wkt_parse.y" +/* Copy the first part of user declarations. */ +#line 1 "lwin_wkt_parse.y" /* yacc.c:339 */ /* WKT Parser */ @@ -183,193 +179,142 @@ int lwgeom_parse_wkt(LWGEOM_PARSER_RESULT *parser_result, char *wktstr, int pars -#line 187 "lwin_wkt_parse.c" +#line 183 "lwin_wkt_parse.c" /* yacc.c:339 */ -# ifndef YY_CAST -# ifdef __cplusplus -# define YY_CAST(Type, Val) static_cast (Val) -# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) -# else -# define YY_CAST(Type, Val) ((Type) (Val)) -# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) -# endif -# endif # ifndef YY_NULLPTR -# if defined __cplusplus -# if 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr # else -# define YY_NULLPTR ((void*)0) +# define YY_NULLPTR 0 # endif # endif -#include "lwin_wkt_parse.h" -/* Symbol kind. */ -enum yysymbol_kind_t +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* In a future release of Bison, this section will be replaced + by #include "lwin_wkt_parse.h". */ +#ifndef YY_WKT_YY_LWIN_WKT_PARSE_H_INCLUDED +# define YY_WKT_YY_LWIN_WKT_PARSE_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int wkt_yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + POINT_TOK = 258, + LINESTRING_TOK = 259, + POLYGON_TOK = 260, + MPOINT_TOK = 261, + MLINESTRING_TOK = 262, + MPOLYGON_TOK = 263, + MSURFACE_TOK = 264, + MCURVE_TOK = 265, + CURVEPOLYGON_TOK = 266, + COMPOUNDCURVE_TOK = 267, + CIRCULARSTRING_TOK = 268, + COLLECTION_TOK = 269, + RBRACKET_TOK = 270, + LBRACKET_TOK = 271, + COMMA_TOK = 272, + EMPTY_TOK = 273, + SEMICOLON_TOK = 274, + TRIANGLE_TOK = 275, + TIN_TOK = 276, + POLYHEDRALSURFACE_TOK = 277, + ELLIPTICALSTRING_TOK = 278, + BEZIER_TOK = 279, + DOUBLE_TOK = 280, + DIMENSIONALITY_TOK = 281, + SRID_TOK = 282 + }; +#endif + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +union YYSTYPE { - YYSYMBOL_YYEMPTY = -2, - YYSYMBOL_YYEOF = 0, /* "end of file" */ - YYSYMBOL_YYerror = 1, /* error */ - YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ - YYSYMBOL_POINT_TOK = 3, /* POINT_TOK */ - YYSYMBOL_LINESTRING_TOK = 4, /* LINESTRING_TOK */ - YYSYMBOL_POLYGON_TOK = 5, /* POLYGON_TOK */ - YYSYMBOL_MPOINT_TOK = 6, /* MPOINT_TOK */ - YYSYMBOL_MLINESTRING_TOK = 7, /* MLINESTRING_TOK */ - YYSYMBOL_MPOLYGON_TOK = 8, /* MPOLYGON_TOK */ - YYSYMBOL_MSURFACE_TOK = 9, /* MSURFACE_TOK */ - YYSYMBOL_MCURVE_TOK = 10, /* MCURVE_TOK */ - YYSYMBOL_CURVEPOLYGON_TOK = 11, /* CURVEPOLYGON_TOK */ - YYSYMBOL_COMPOUNDCURVE_TOK = 12, /* COMPOUNDCURVE_TOK */ - YYSYMBOL_CIRCULARSTRING_TOK = 13, /* CIRCULARSTRING_TOK */ - YYSYMBOL_COLLECTION_TOK = 14, /* COLLECTION_TOK */ - YYSYMBOL_RBRACKET_TOK = 15, /* RBRACKET_TOK */ - YYSYMBOL_LBRACKET_TOK = 16, /* LBRACKET_TOK */ - YYSYMBOL_COMMA_TOK = 17, /* COMMA_TOK */ - YYSYMBOL_EMPTY_TOK = 18, /* EMPTY_TOK */ - YYSYMBOL_SEMICOLON_TOK = 19, /* SEMICOLON_TOK */ - YYSYMBOL_TRIANGLE_TOK = 20, /* TRIANGLE_TOK */ - YYSYMBOL_TIN_TOK = 21, /* TIN_TOK */ - YYSYMBOL_POLYHEDRALSURFACE_TOK = 22, /* POLYHEDRALSURFACE_TOK */ - YYSYMBOL_ELLIPTICALSTRING_TOK = 23, /* ELLIPTICALSTRING_TOK */ - YYSYMBOL_DOUBLE_TOK = 24, /* DOUBLE_TOK */ - YYSYMBOL_DIMENSIONALITY_TOK = 25, /* DIMENSIONALITY_TOK */ - YYSYMBOL_SRID_TOK = 26, /* SRID_TOK */ - YYSYMBOL_YYACCEPT = 27, /* $accept */ - YYSYMBOL_geometry = 28, /* geometry */ - YYSYMBOL_geometry_no_srid = 29, /* geometry_no_srid */ - YYSYMBOL_geometrycollection = 30, /* geometrycollection */ - YYSYMBOL_geometry_list = 31, /* geometry_list */ - YYSYMBOL_multisurface = 32, /* multisurface */ - YYSYMBOL_surface_list = 33, /* surface_list */ - YYSYMBOL_tin = 34, /* tin */ - YYSYMBOL_polyhedralsurface = 35, /* polyhedralsurface */ - YYSYMBOL_multipolygon = 36, /* multipolygon */ - YYSYMBOL_polygon_list = 37, /* polygon_list */ - YYSYMBOL_patch_list = 38, /* patch_list */ - YYSYMBOL_polygon = 39, /* polygon */ - YYSYMBOL_polygon_untagged = 40, /* polygon_untagged */ - YYSYMBOL_patch = 41, /* patch */ - YYSYMBOL_curvepolygon = 42, /* curvepolygon */ - YYSYMBOL_curvering_list = 43, /* curvering_list */ - YYSYMBOL_curvering = 44, /* curvering */ - YYSYMBOL_patchring_list = 45, /* patchring_list */ - YYSYMBOL_ring_list = 46, /* ring_list */ - YYSYMBOL_patchring = 47, /* patchring */ - YYSYMBOL_ring = 48, /* ring */ - YYSYMBOL_compoundcurve = 49, /* compoundcurve */ - YYSYMBOL_compound_list = 50, /* compound_list */ - YYSYMBOL_multicurve = 51, /* multicurve */ - YYSYMBOL_curve_list = 52, /* curve_list */ - YYSYMBOL_multilinestring = 53, /* multilinestring */ - YYSYMBOL_linestring_list = 54, /* linestring_list */ - YYSYMBOL_circularstring = 55, /* circularstring */ - YYSYMBOL_linestring = 56, /* linestring */ - YYSYMBOL_linestring_untagged = 57, /* linestring_untagged */ - YYSYMBOL_triangle_list = 58, /* triangle_list */ - YYSYMBOL_triangle = 59, /* triangle */ - YYSYMBOL_triangle_untagged = 60, /* triangle_untagged */ - YYSYMBOL_multipoint = 61, /* multipoint */ - YYSYMBOL_point_list = 62, /* point_list */ - YYSYMBOL_point_untagged = 63, /* point_untagged */ - YYSYMBOL_point = 64, /* point */ - YYSYMBOL_ptarray = 65, /* ptarray */ - YYSYMBOL_coordinate = 66, /* coordinate */ - YYSYMBOL_ellipse = 67 /* ellipse */ -}; -typedef enum yysymbol_kind_t yysymbol_kind_t; +#line 112 "lwin_wkt_parse.y" /* yacc.c:355 */ + int integervalue; + double doublevalue; + char *stringvalue; + LWGEOM *geometryvalue; + POINT coordinatevalue; + POINTARRAY *ptarrayvalue; +#line 260 "lwin_wkt_parse.c" /* yacc.c:355 */ +}; +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif -#ifdef short -# undef short +/* Location type. */ +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE YYLTYPE; +struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +}; +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 #endif -/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure - and (if available) are included - so that the code can choose integer types of a good width. */ -#ifndef __PTRDIFF_MAX__ -# include /* INFRINGES ON USER NAME SPACE */ -# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_STDINT_H -# endif -#endif +extern YYSTYPE wkt_yylval; +extern YYLTYPE wkt_yylloc; +int wkt_yyparse (void); -/* Narrow types that promote to a signed type and that can represent a - signed or unsigned integer of at least N bits. In tables they can - save space and decrease cache pressure. Promoting to a signed type - helps avoid bugs in integer arithmetic. */ +#endif /* !YY_WKT_YY_LWIN_WKT_PARSE_H_INCLUDED */ -#ifdef __INT_LEAST8_MAX__ -typedef __INT_LEAST8_TYPE__ yytype_int8; -#elif defined YY_STDINT_H -typedef int_least8_t yytype_int8; -#else -typedef signed char yytype_int8; -#endif +/* Copy the second part of user declarations. */ -#ifdef __INT_LEAST16_MAX__ -typedef __INT_LEAST16_TYPE__ yytype_int16; -#elif defined YY_STDINT_H -typedef int_least16_t yytype_int16; -#else -typedef short yytype_int16; -#endif +#line 291 "lwin_wkt_parse.c" /* yacc.c:358 */ -/* Work around bug in HP-UX 11.23, which defines these macros - incorrectly for preprocessor constants. This workaround can likely - be removed in 2023, as HPE has promised support for HP-UX 11.23 - (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of - . */ -#ifdef __hpux -# undef UINT_LEAST8_MAX -# undef UINT_LEAST16_MAX -# define UINT_LEAST8_MAX 255 -# define UINT_LEAST16_MAX 65535 +#ifdef short +# undef short #endif -#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ -typedef __UINT_LEAST8_TYPE__ yytype_uint8; -#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ - && UINT_LEAST8_MAX <= INT_MAX) -typedef uint_least8_t yytype_uint8; -#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; #else -typedef short yytype_uint8; +typedef signed char yytype_int8; #endif -#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ -typedef __UINT_LEAST16_TYPE__ yytype_uint16; -#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ - && UINT_LEAST16_MAX <= INT_MAX) -typedef uint_least16_t yytype_uint16; -#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX -typedef unsigned short yytype_uint16; +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; #else -typedef int yytype_uint16; +typedef unsigned short int yytype_uint16; #endif -#ifndef YYPTRDIFF_T -# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ -# define YYPTRDIFF_T __PTRDIFF_TYPE__ -# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ -# elif defined PTRDIFF_MAX -# ifndef ptrdiff_t -# include /* INFRINGES ON USER NAME SPACE */ -# endif -# define YYPTRDIFF_T ptrdiff_t -# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX -# else -# define YYPTRDIFF_T long -# define YYPTRDIFF_MAXIMUM LONG_MAX -# endif +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; #endif #ifndef YYSIZE_T @@ -377,28 +322,15 @@ typedef int yytype_uint16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned +# define YYSIZE_T unsigned int # endif #endif -#define YYSIZE_MAXIMUM \ - YY_CAST (YYPTRDIFF_T, \ - (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ - ? YYPTRDIFF_MAXIMUM \ - : YY_CAST (YYSIZE_T, -1))) - -#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) - - -/* Stored state numbers (used for stacks). */ -typedef yytype_int16 yy_state_t; - -/* State numbers in computations. */ -typedef int yy_state_fast_t; +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -412,43 +344,47 @@ typedef int yy_state_fast_t; # endif #endif - -#ifndef YY_ATTRIBUTE_PURE -# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) -# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) # else -# define YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE(Spec) /* empty */ # endif #endif +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + #ifndef YY_ATTRIBUTE_UNUSED -# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) -# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) # else -# define YY_ATTRIBUTE_UNUSED +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YY_USE(E) ((void) (E)) +# define YYUSE(E) ((void) (E)) #else -# define YY_USE(E) /* empty */ +# define YYUSE(E) /* empty */ #endif +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ -# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") -# else -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# endif -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -461,22 +397,8 @@ typedef int yy_state_fast_t; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif -#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ -# define YY_IGNORE_USELESS_CAST_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") -# define YY_IGNORE_USELESS_CAST_END \ - _Pragma ("GCC diagnostic pop") -#endif -#ifndef YY_IGNORE_USELESS_CAST_BEGIN -# define YY_IGNORE_USELESS_CAST_BEGIN -# define YY_IGNORE_USELESS_CAST_END -#endif - -#define YY_ASSERT(E) ((void) (0 && (E))) - -#if 1 +#if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -541,7 +463,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif -#endif /* 1 */ +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + #if (! defined yyoverflow \ && (! defined __cplusplus \ @@ -551,19 +474,18 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yy_state_t yyss_alloc; + yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \ - + YYSIZEOF (YYLTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -576,11 +498,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYPTRDIFF_T yynewbytes; \ + YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / YYSIZEOF (*yyptr); \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) @@ -592,12 +514,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYPTRDIFF_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -607,33 +529,30 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 84 +#define YYFINAL 88 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 344 +#define YYLAST 374 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 27 +#define YYNTOKENS 28 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 41 +#define YYNNTS 42 /* YYNRULES -- Number of rules. */ -#define YYNRULES 142 +#define YYNRULES 152 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 304 +#define YYNSTATES 332 -/* YYMAXUTOK -- Last valid token kind. */ -#define YYMAXUTOK 281 +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 282 - -/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, with out-of-bounds checking. */ -#define YYTRANSLATE(YYX) \ - (0 <= (YYX) && (YYX) <= YYMAXUTOK \ - ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ - : YYSYMBOL_YYUNDEF) +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex. */ -static const yytype_int8 yytranslate[] = + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -663,366 +582,382 @@ static const yytype_int8 yytranslate[] = 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26 + 25, 26, 27 }; #if YYDEBUG -/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_int16 yyrline[] = + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = { - 0, 219, 219, 221, 225, 226, 227, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 243, 245, 247, 249, 253, 255, 259, 261, 263, 265, - 269, 271, 273, 275, 277, 279, 283, 285, 287, 289, - 293, 295, 297, 299, 303, 305, 307, 309, 313, 315, - 319, 321, 325, 327, 329, 331, 335, 337, 341, 344, - 346, 348, 350, 354, 356, 360, 361, 362, 363, 364, - 367, 369, 373, 375, 379, 382, 385, 387, 389, 391, - 395, 397, 399, 401, 403, 405, 407, 409, 413, 415, - 417, 419, 423, 425, 427, 429, 431, 433, 435, 437, - 441, 443, 445, 447, 451, 453, 457, 459, 461, 463, - 467, 469, 471, 473, 477, 479, 483, 485, 489, 491, - 493, 495, 499, 503, 505, 507, 509, 513, 515, 519, - 521, 523, 527, 529, 531, 533, 537, 539, 543, 545, - 547, 550, 552 + 0, 221, 221, 223, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 246, 248, 250, 252, 256, 258, 262, 264, 266, + 268, 272, 274, 276, 278, 280, 282, 286, 288, 290, + 292, 296, 298, 300, 302, 306, 308, 310, 312, 316, + 318, 322, 324, 328, 330, 332, 334, 338, 340, 344, + 347, 349, 351, 353, 357, 359, 363, 364, 365, 366, + 367, 368, 371, 373, 377, 379, 383, 386, 389, 391, + 393, 395, 399, 401, 403, 405, 407, 409, 411, 413, + 415, 417, 421, 423, 425, 427, 431, 433, 435, 437, + 439, 441, 443, 445, 447, 449, 451, 453, 457, 459, + 461, 463, 467, 469, 473, 475, 477, 479, 483, 485, + 487, 489, 493, 495, 499, 501, 505, 507, 509, 511, + 515, 519, 521, 523, 525, 529, 531, 535, 537, 539, + 543, 545, 547, 549, 553, 555, 559, 561, 563, 566, + 568, 573, 575 }; #endif -/** Accessing symbol of state STATE. */ -#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) - -#if 1 -/* The user-facing name of the symbol whose (internal) number is - YYSYMBOL. No bounds checking. */ -static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; - +#if YYDEBUG || YYERROR_VERBOSE || 1 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "\"end of file\"", "error", "\"invalid token\"", "POINT_TOK", - "LINESTRING_TOK", "POLYGON_TOK", "MPOINT_TOK", "MLINESTRING_TOK", - "MPOLYGON_TOK", "MSURFACE_TOK", "MCURVE_TOK", "CURVEPOLYGON_TOK", - "COMPOUNDCURVE_TOK", "CIRCULARSTRING_TOK", "COLLECTION_TOK", - "RBRACKET_TOK", "LBRACKET_TOK", "COMMA_TOK", "EMPTY_TOK", - "SEMICOLON_TOK", "TRIANGLE_TOK", "TIN_TOK", "POLYHEDRALSURFACE_TOK", - "ELLIPTICALSTRING_TOK", "DOUBLE_TOK", "DIMENSIONALITY_TOK", "SRID_TOK", - "$accept", "geometry", "geometry_no_srid", "geometrycollection", - "geometry_list", "multisurface", "surface_list", "tin", - "polyhedralsurface", "multipolygon", "polygon_list", "patch_list", - "polygon", "polygon_untagged", "patch", "curvepolygon", "curvering_list", + "$end", "error", "$undefined", "POINT_TOK", "LINESTRING_TOK", + "POLYGON_TOK", "MPOINT_TOK", "MLINESTRING_TOK", "MPOLYGON_TOK", + "MSURFACE_TOK", "MCURVE_TOK", "CURVEPOLYGON_TOK", "COMPOUNDCURVE_TOK", + "CIRCULARSTRING_TOK", "COLLECTION_TOK", "RBRACKET_TOK", "LBRACKET_TOK", + "COMMA_TOK", "EMPTY_TOK", "SEMICOLON_TOK", "TRIANGLE_TOK", "TIN_TOK", + "POLYHEDRALSURFACE_TOK", "ELLIPTICALSTRING_TOK", "BEZIER_TOK", + "DOUBLE_TOK", "DIMENSIONALITY_TOK", "SRID_TOK", "$accept", "geometry", + "geometry_no_srid", "geometrycollection", "geometry_list", + "multisurface", "surface_list", "tin", "polyhedralsurface", + "multipolygon", "polygon_list", "patch_list", "polygon", + "polygon_untagged", "patch", "curvepolygon", "curvering_list", "curvering", "patchring_list", "ring_list", "patchring", "ring", "compoundcurve", "compound_list", "multicurve", "curve_list", "multilinestring", "linestring_list", "circularstring", "linestring", "linestring_untagged", "triangle_list", "triangle", "triangle_untagged", "multipoint", "point_list", "point_untagged", "point", "ptarray", - "coordinate", "ellipse", YY_NULLPTR + "coordinate", "ellipse", "bezier", YY_NULLPTR }; +#endif -static const char * -yysymbol_name (yysymbol_kind_t yysymbol) +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = { - return yytname[yysymbol]; -} -#endif + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282 +}; +# endif -#define YYPACT_NINF (-74) +#define YYPACT_NINF -79 -#define yypact_value_is_default(Yyn) \ - ((Yyn) == YYPACT_NINF) +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-79))) -#define YYTABLE_NINF (-1) +#define YYTABLE_NINF -1 -#define yytable_value_is_error(Yyn) \ +#define yytable_value_is_error(Yytable_value) \ 0 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int16 yypact[] = { - 175, 23, 55, 77, 81, 82, 87, 93, 99, 103, - 107, 113, 143, 149, 174, 204, 36, -15, 16, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -7, -74, 26, -7, - -74, 31, 5, -74, 44, 41, -74, 54, 59, -74, - 117, 121, -74, 148, 17, -74, 153, 51, -74, 184, - 14, -74, 187, 27, -74, 188, -7, -74, 215, 205, - -74, 216, 18, -74, 220, 30, -74, 221, 60, -74, - 224, -7, 65, 205, -74, 58, 176, -74, -7, -74, - 226, -7, -74, -7, 229, -74, 5, -74, -7, -74, - 230, -74, -74, 41, -74, -7, -74, 233, -74, 59, - -74, 5, -74, 234, -74, 121, -74, 237, -74, -74, - -74, 17, -74, -74, 238, -74, -74, -74, 51, -74, - 241, -74, -74, -74, -74, -74, -74, 14, -74, 242, - -74, -74, -74, -74, 27, -74, 245, -7, -74, -74, - 246, 205, -74, -7, 88, -74, 92, 249, -74, 30, - -74, 97, 250, -74, 60, -74, 110, -7, -74, 90, - -74, -7, 253, -74, 254, 257, -74, 5, 258, 105, - -74, 41, 261, 262, -74, 59, 265, 266, -74, 121, - 269, -74, 17, 270, -74, 51, 273, -74, 14, 274, - -74, 27, 277, -74, 278, -74, 205, 281, 282, -7, - -7, -74, 30, 285, -7, 286, -74, -74, 60, 289, - -7, 123, 106, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, 119, 290, 293, - -74, -74, 294, -74, 97, -74, -74, 126, -7, -74, - -74, 140, 141, -74, -74, -7, 159, -74, -74, 177, - -7, 136, 207, 295, 146, 197, 296, 297, 291, 292, - 300, 301, 298, 299, 302, 303, 304, 305, 307, 306, - 308, -74, 310, -74 + 184, 9, 27, 76, 85, 94, 103, 106, 109, 115, + 120, 152, 158, 183, 194, 230, 3, 40, -11, 16, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -1, -79, + 32, -1, -79, 80, 12, -79, 91, 60, -79, 121, + 124, -79, 127, 155, -79, 197, 59, -79, 198, 28, + -79, 203, 28, -79, 233, 45, -79, 237, -1, -79, + 242, 219, -79, 243, 17, -79, 247, 23, -79, 248, + 26, -79, 251, -1, 31, -1, 46, 219, -79, 42, + 185, -79, -1, -79, 220, -1, -79, -1, 253, -79, + 12, -79, -1, -79, 256, -79, -79, 60, -79, -1, + -79, 257, -79, 124, -79, 12, -79, 260, -79, 155, + -79, 261, -79, -79, -79, 59, -79, -79, 264, -79, + -79, -79, -79, -79, 28, -79, 265, -79, -79, -79, + -79, -79, -79, -79, 28, -79, 268, -79, -79, -79, + -79, -79, 45, -79, 269, -1, -79, -79, 272, 219, + -79, -1, 56, -79, 57, 273, -79, 23, -79, 64, + 276, -79, 26, -79, 67, -1, 70, -1, -79, 68, + -79, -1, 277, -79, 280, 281, -79, 12, 284, 99, + -79, 60, 285, 288, -79, 124, 289, 292, -79, 155, + 293, -79, 59, 296, -79, 28, 297, -79, 28, 300, + -79, 45, 301, -79, 304, -79, 219, 305, 308, -1, + -1, -79, 23, 309, -1, 312, -79, -79, 26, 313, + -1, 98, -1, 101, 129, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, 111, 316, 317, -79, -79, 320, -79, 64, + -79, -79, 132, -1, 145, -1, -79, -79, 150, 160, + -79, -79, -1, 162, -1, 186, -79, -79, 201, -1, + 217, -1, 225, 227, -1, 319, 321, 314, 325, -1, + 318, 324, -79, 327, 328, 322, -79, 323, 329, 332, + 326, 330, 333, 335, 331, 334, 336, 339, 337, -79, + 342, -79 }; -/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ static const yytype_uint8 yydefact[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, - 18, 13, 15, 16, 12, 8, 9, 7, 14, 11, - 6, 5, 17, 10, 4, 19, 0, 135, 0, 0, - 113, 0, 0, 55, 0, 0, 126, 0, 0, 103, - 0, 0, 47, 0, 0, 29, 0, 0, 91, 0, - 0, 62, 0, 0, 79, 0, 0, 109, 0, 0, - 23, 0, 0, 121, 0, 0, 39, 0, 0, 43, - 0, 0, 0, 0, 1, 0, 0, 137, 0, 134, - 0, 0, 112, 0, 0, 73, 0, 54, 0, 131, - 0, 128, 129, 0, 125, 0, 115, 0, 105, 0, - 102, 0, 57, 0, 49, 0, 46, 0, 33, 35, - 34, 0, 28, 97, 0, 96, 98, 99, 0, 90, - 0, 64, 67, 68, 66, 65, 69, 0, 61, 0, - 84, 85, 86, 87, 0, 78, 0, 0, 108, 25, - 0, 0, 22, 0, 0, 120, 0, 0, 117, 0, - 38, 0, 0, 51, 0, 42, 0, 0, 3, 138, - 132, 0, 0, 110, 0, 0, 52, 0, 0, 0, - 123, 0, 0, 0, 100, 0, 0, 0, 44, 0, - 0, 26, 0, 0, 88, 0, 0, 59, 0, 0, - 76, 0, 0, 106, 0, 20, 0, 0, 0, 0, - 0, 36, 0, 0, 0, 0, 71, 40, 0, 0, - 0, 0, 139, 136, 133, 111, 75, 72, 53, 130, - 127, 124, 114, 104, 101, 56, 48, 45, 30, 32, - 31, 27, 93, 92, 94, 95, 89, 63, 60, 80, - 81, 82, 83, 77, 107, 24, 21, 0, 0, 0, - 116, 37, 0, 58, 0, 50, 41, 0, 0, 140, - 118, 0, 0, 74, 70, 0, 0, 119, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 18, 13, 15, 16, 12, 8, 9, 7, 14, + 11, 6, 5, 17, 10, 4, 19, 20, 0, 143, + 0, 0, 121, 0, 0, 56, 0, 0, 134, 0, + 0, 111, 0, 0, 48, 0, 0, 30, 0, 0, + 95, 0, 0, 63, 0, 0, 81, 0, 0, 117, + 0, 0, 24, 0, 0, 129, 0, 0, 40, 0, + 0, 44, 0, 0, 0, 0, 0, 0, 1, 0, + 0, 145, 0, 142, 0, 0, 120, 0, 0, 75, + 0, 55, 0, 139, 0, 136, 137, 0, 133, 0, + 123, 0, 113, 0, 110, 0, 58, 0, 50, 0, + 47, 0, 34, 36, 35, 0, 29, 103, 0, 102, + 104, 107, 105, 106, 0, 94, 0, 65, 68, 69, + 67, 66, 70, 71, 0, 62, 0, 87, 88, 89, + 90, 91, 0, 80, 0, 0, 116, 26, 0, 0, + 23, 0, 0, 128, 0, 0, 125, 0, 39, 0, + 0, 52, 0, 43, 0, 0, 0, 0, 3, 146, + 140, 0, 0, 118, 0, 0, 53, 0, 0, 0, + 131, 0, 0, 0, 108, 0, 0, 0, 45, 0, + 0, 27, 0, 0, 92, 0, 0, 60, 0, 0, + 78, 0, 0, 114, 0, 21, 0, 0, 0, 0, + 0, 37, 0, 0, 0, 0, 73, 41, 0, 0, + 0, 0, 0, 0, 147, 144, 141, 119, 77, 74, + 54, 138, 135, 132, 122, 112, 109, 57, 49, 46, + 31, 33, 32, 28, 97, 96, 98, 99, 100, 101, + 93, 64, 61, 82, 83, 84, 85, 86, 79, 115, + 25, 22, 0, 0, 0, 124, 38, 0, 59, 0, + 51, 42, 0, 0, 0, 0, 148, 126, 0, 0, + 76, 72, 0, 0, 0, 0, 127, 130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 141, 0, 142 + 0, 0, 151, 0, 0, 0, 152, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 149, + 0, 150 }; -/* YYPGOTO[NTERM-NUM]. */ + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -74, -74, 1, -74, 179, -74, 206, -74, -74, -74, - 211, 167, -30, -35, 115, -29, 198, 138, -74, -73, - 70, 160, -49, 194, -74, 212, -74, 232, -54, -50, - -43, 180, -74, 130, -74, 240, 163, -74, -37, -45, - -48 + -79, -79, 1, -79, 199, -79, 235, -79, -79, -79, + 244, 172, -43, -51, 133, -42, 221, 156, -79, -78, + 87, 180, -28, 216, -79, 236, -79, 258, -55, -53, + -48, 202, -79, 151, -79, 267, 181, -79, -38, -47, + -44, -39 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_uint8 yydefgoto[] = + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = { - 0, 18, 149, 20, 150, 21, 117, 22, 23, 24, - 113, 162, 25, 114, 163, 26, 130, 131, 215, 94, - 216, 95, 27, 139, 28, 124, 29, 107, 30, 31, - 135, 157, 32, 158, 33, 100, 101, 34, 86, 87, - 35 + -1, 19, 157, 21, 158, 22, 121, 23, 24, 25, + 117, 170, 26, 118, 171, 27, 136, 137, 225, 98, + 226, 99, 28, 146, 29, 128, 30, 111, 31, 32, + 141, 165, 33, 166, 34, 104, 105, 35, 90, 91, + 36, 37 }; -/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_int16 yytable[] = + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_uint16 yytable[] = { - 102, 19, 90, 125, 83, 108, 133, 126, 123, 140, - 134, 132, 136, 141, 127, 143, 84, 85, 2, 119, - 142, 93, 3, 178, 118, 120, 10, 11, 9, 146, - 105, 2, 106, 111, 153, 112, 166, 16, 187, 36, - 11, 37, 88, 105, 89, 106, 156, 91, 38, 92, - 16, 172, 81, 179, 174, 2, 175, 98, 102, 99, - 96, 82, 97, 10, 11, 85, 108, 105, 183, 106, - 103, 39, 104, 40, 125, 105, 161, 106, 126, 123, - 41, 167, 169, 133, 168, 127, 119, 134, 132, 136, - 140, 118, 120, 42, 141, 43, 143, 45, 48, 46, - 49, 142, 44, 51, 209, 52, 47, 50, 210, 54, - 204, 55, 53, 214, 222, 57, 208, 58, 56, 60, - 229, 61, 221, 63, 59, 64, 223, 220, 62, 66, - 269, 67, 65, 109, 270, 110, 102, 111, 68, 112, - 268, 243, 233, 275, 133, 244, 242, 249, 134, 132, - 136, 250, 245, 252, 236, 277, 278, 239, 251, 69, - 283, 70, 238, 240, 115, 72, 116, 73, 71, 121, - 286, 122, 258, 259, 74, 267, 280, 262, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 75, 170, 76, 171, 281, 13, 14, 15, 16, 77, - 128, 17, 129, 137, 144, 138, 145, 255, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 78, 287, 79, 276, 284, 13, 14, 15, 16, 80, - 279, 147, 151, 148, 152, 282, 154, 159, 155, 160, - 164, 173, 165, 171, 176, 180, 177, 181, 184, 188, - 185, 189, 191, 194, 192, 195, 197, 200, 198, 201, - 203, 205, 171, 206, 211, 217, 212, 218, 224, 225, - 171, 171, 226, 228, 171, 177, 231, 232, 181, 171, - 234, 235, 185, 177, 237, 241, 189, 192, 246, 248, - 195, 198, 253, 254, 201, 171, 256, 257, 206, 171, - 261, 263, 212, 264, 266, 271, 218, 171, 272, 273, - 171, 171, 285, 288, 289, 290, 291, 292, 293, 296, - 297, 301, 294, 295, 300, 303, 190, 193, 298, 299, - 207, 219, 302, 265, 274, 199, 247, 227, 202, 213, - 196, 186, 260, 182, 230 + 106, 20, 112, 94, 129, 123, 130, 139, 87, 140, + 147, 131, 148, 122, 124, 132, 88, 149, 142, 83, + 133, 150, 188, 143, 89, 38, 151, 39, 97, 84, + 154, 127, 2, 161, 138, 40, 174, 197, 176, 164, + 10, 11, 169, 41, 109, 42, 110, 175, 92, 2, + 93, 16, 17, 43, 182, 189, 85, 184, 11, 185, + 106, 109, 177, 110, 3, 112, 86, 179, 16, 17, + 9, 193, 219, 220, 123, 115, 102, 116, 103, 129, + 224, 130, 122, 124, 230, 89, 131, 232, 178, 139, + 132, 140, 44, 234, 45, 133, 95, 147, 96, 148, + 142, 47, 46, 48, 149, 143, 127, 100, 150, 101, + 50, 49, 51, 151, 241, 283, 138, 214, 285, 53, + 52, 54, 56, 218, 57, 59, 287, 60, 231, 55, + 233, 62, 58, 63, 235, 61, 65, 107, 66, 108, + 109, 64, 110, 113, 106, 114, 67, 245, 248, 292, + 255, 251, 256, 139, 286, 140, 263, 257, 264, 250, + 252, 258, 294, 265, 142, 296, 259, 266, 68, 143, + 69, 115, 267, 116, 71, 297, 72, 254, 70, 299, + 138, 273, 274, 282, 73, 284, 277, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 74, + 180, 75, 181, 301, 13, 14, 15, 16, 17, 76, + 77, 18, 78, 119, 125, 120, 126, 270, 302, 134, + 79, 135, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 304, 183, 293, 181, 295, 13, + 14, 15, 16, 17, 307, 298, 80, 300, 81, 144, + 306, 145, 303, 152, 305, 153, 82, 308, 155, 159, + 156, 160, 313, 162, 167, 163, 168, 172, 186, 173, + 187, 190, 194, 191, 195, 198, 201, 199, 202, 204, + 207, 205, 208, 210, 213, 211, 181, 215, 221, 216, + 222, 227, 236, 228, 181, 237, 238, 181, 181, 240, + 243, 187, 191, 244, 246, 181, 195, 247, 249, 187, + 199, 253, 260, 202, 205, 262, 268, 208, 211, 269, + 271, 181, 216, 272, 276, 181, 222, 278, 281, 279, + 228, 288, 289, 181, 181, 290, 309, 181, 310, 311, + 312, 315, 316, 314, 229, 317, 320, 318, 319, 321, + 324, 322, 325, 328, 329, 323, 326, 331, 217, 327, + 203, 280, 330, 200, 261, 209, 291, 239, 212, 223, + 206, 196, 242, 275, 192 }; -static const yytype_int16 yycheck[] = +static const yytype_uint16 yycheck[] = { - 45, 0, 39, 57, 19, 48, 60, 57, 57, 63, - 60, 60, 60, 63, 57, 63, 0, 24, 4, 54, - 63, 16, 5, 96, 54, 54, 12, 13, 11, 66, - 16, 4, 18, 16, 16, 18, 81, 23, 111, 16, - 13, 18, 16, 16, 18, 18, 16, 16, 25, 18, - 23, 88, 16, 98, 91, 4, 93, 16, 103, 18, - 16, 25, 18, 12, 13, 24, 109, 16, 105, 18, - 16, 16, 18, 18, 128, 16, 16, 18, 128, 128, - 25, 16, 24, 137, 83, 128, 121, 137, 137, 137, - 144, 121, 121, 16, 144, 18, 144, 16, 16, 18, - 18, 144, 25, 16, 16, 18, 25, 25, 16, 16, - 147, 18, 25, 16, 24, 16, 153, 18, 25, 16, - 15, 18, 167, 16, 25, 18, 171, 17, 25, 16, - 24, 18, 25, 16, 15, 18, 181, 16, 25, 18, - 17, 195, 185, 17, 198, 195, 195, 201, 198, 198, - 198, 201, 195, 201, 189, 15, 15, 192, 201, 16, - 24, 18, 192, 192, 16, 16, 18, 18, 25, 16, - 24, 18, 209, 210, 25, 220, 17, 214, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 16, 15, 18, 17, 17, 20, 21, 22, 23, 25, - 16, 26, 18, 16, 16, 18, 18, 206, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 16, 24, 18, 268, 17, 20, 21, 22, 23, 25, - 275, 16, 16, 18, 18, 280, 16, 16, 18, 18, - 16, 15, 18, 17, 15, 15, 17, 17, 15, 15, - 17, 17, 15, 15, 17, 17, 15, 15, 17, 17, - 15, 15, 17, 17, 15, 15, 17, 17, 15, 15, - 17, 17, 15, 15, 17, 17, 15, 15, 17, 17, - 15, 15, 17, 17, 15, 15, 17, 17, 15, 15, - 17, 17, 15, 15, 17, 17, 15, 15, 17, 17, - 15, 15, 17, 17, 15, 15, 17, 17, 15, 15, - 17, 17, 17, 17, 17, 24, 24, 17, 17, 17, - 17, 15, 24, 24, 17, 15, 115, 121, 24, 24, - 151, 164, 24, 218, 264, 137, 198, 177, 144, 159, - 128, 109, 212, 103, 181 + 47, 0, 50, 41, 59, 56, 59, 62, 19, 62, + 65, 59, 65, 56, 56, 59, 0, 65, 62, 16, + 59, 65, 100, 62, 25, 16, 65, 18, 16, 26, + 68, 59, 4, 16, 62, 26, 83, 115, 85, 16, + 12, 13, 16, 16, 16, 18, 18, 16, 16, 4, + 18, 23, 24, 26, 92, 102, 16, 95, 13, 97, + 107, 16, 16, 18, 5, 113, 26, 25, 23, 24, + 11, 109, 16, 16, 125, 16, 16, 18, 18, 134, + 16, 134, 125, 125, 17, 25, 134, 17, 87, 144, + 134, 144, 16, 25, 18, 134, 16, 152, 18, 152, + 144, 16, 26, 18, 152, 144, 134, 16, 152, 18, + 16, 26, 18, 152, 15, 17, 144, 155, 17, 16, + 26, 18, 16, 161, 18, 16, 15, 18, 175, 26, + 177, 16, 26, 18, 181, 26, 16, 16, 18, 18, + 16, 26, 18, 16, 191, 18, 26, 195, 199, 17, + 205, 202, 205, 208, 25, 208, 211, 205, 211, 202, + 202, 205, 17, 211, 208, 15, 205, 211, 16, 208, + 18, 16, 211, 18, 16, 15, 18, 205, 26, 17, + 208, 219, 220, 230, 26, 232, 224, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, + 15, 18, 17, 17, 20, 21, 22, 23, 24, 26, + 16, 27, 18, 16, 16, 18, 18, 216, 17, 16, + 26, 18, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 17, 15, 283, 17, 285, 20, + 21, 22, 23, 24, 17, 292, 16, 294, 18, 16, + 25, 18, 299, 16, 301, 18, 26, 304, 16, 16, + 18, 18, 309, 16, 16, 18, 18, 16, 15, 18, + 17, 15, 15, 17, 17, 15, 15, 17, 17, 15, + 15, 17, 17, 15, 15, 17, 17, 15, 15, 17, + 17, 15, 15, 17, 17, 15, 15, 17, 17, 15, + 15, 17, 17, 15, 15, 17, 17, 15, 15, 17, + 17, 15, 15, 17, 17, 15, 15, 17, 17, 15, + 15, 17, 17, 15, 15, 17, 17, 15, 15, 17, + 17, 15, 15, 17, 17, 15, 17, 17, 17, 25, + 15, 17, 15, 25, 172, 17, 17, 25, 25, 17, + 17, 25, 17, 17, 15, 25, 25, 15, 159, 25, + 125, 228, 25, 119, 208, 144, 279, 187, 152, 167, + 134, 113, 191, 222, 107 }; -/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of - state STATE-NUM. */ -static const yytype_int8 yystos[] = + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 20, 21, 22, 23, 26, 28, 29, - 30, 32, 34, 35, 36, 39, 42, 49, 51, 53, - 55, 56, 59, 61, 64, 67, 16, 18, 25, 16, - 18, 25, 16, 18, 25, 16, 18, 25, 16, 18, - 25, 16, 18, 25, 16, 18, 25, 16, 18, 25, - 16, 18, 25, 16, 18, 25, 16, 18, 25, 16, - 18, 25, 16, 18, 25, 16, 18, 25, 16, 18, - 25, 16, 25, 19, 0, 24, 65, 66, 16, 18, - 65, 16, 18, 16, 46, 48, 16, 18, 16, 18, - 62, 63, 66, 16, 18, 16, 18, 54, 57, 16, - 18, 16, 18, 37, 40, 16, 18, 33, 39, 40, - 42, 16, 18, 49, 52, 55, 56, 57, 16, 18, - 43, 44, 49, 55, 56, 57, 67, 16, 18, 50, - 55, 56, 57, 67, 16, 18, 65, 16, 18, 29, - 31, 16, 18, 16, 16, 18, 16, 58, 60, 16, - 18, 16, 38, 41, 16, 18, 66, 16, 29, 24, - 15, 17, 65, 15, 65, 65, 15, 17, 46, 66, - 15, 17, 62, 65, 15, 17, 54, 46, 15, 17, - 37, 15, 17, 33, 15, 17, 52, 15, 17, 43, - 15, 17, 50, 15, 65, 15, 17, 31, 65, 16, - 16, 15, 17, 58, 16, 45, 47, 15, 17, 38, - 17, 66, 24, 66, 15, 15, 15, 48, 15, 15, - 63, 15, 15, 57, 15, 15, 40, 15, 39, 40, - 42, 15, 49, 55, 56, 57, 15, 44, 15, 55, - 56, 57, 67, 15, 15, 29, 15, 15, 65, 65, - 60, 15, 65, 15, 17, 41, 15, 66, 17, 24, - 15, 15, 15, 15, 47, 17, 66, 15, 15, 66, - 17, 17, 66, 24, 17, 17, 24, 24, 17, 17, - 24, 24, 17, 17, 24, 24, 17, 17, 24, 24, - 17, 15, 24, 15 + 12, 13, 14, 20, 21, 22, 23, 24, 27, 29, + 30, 31, 33, 35, 36, 37, 40, 43, 50, 52, + 54, 56, 57, 60, 62, 65, 68, 69, 16, 18, + 26, 16, 18, 26, 16, 18, 26, 16, 18, 26, + 16, 18, 26, 16, 18, 26, 16, 18, 26, 16, + 18, 26, 16, 18, 26, 16, 18, 26, 16, 18, + 26, 16, 18, 26, 16, 18, 26, 16, 18, 26, + 16, 18, 26, 16, 26, 16, 26, 19, 0, 25, + 66, 67, 16, 18, 66, 16, 18, 16, 47, 49, + 16, 18, 16, 18, 63, 64, 67, 16, 18, 16, + 18, 55, 58, 16, 18, 16, 18, 38, 41, 16, + 18, 34, 40, 41, 43, 16, 18, 50, 53, 56, + 57, 58, 68, 69, 16, 18, 44, 45, 50, 56, + 57, 58, 68, 69, 16, 18, 51, 56, 57, 58, + 68, 69, 16, 18, 66, 16, 18, 30, 32, 16, + 18, 16, 16, 18, 16, 59, 61, 16, 18, 16, + 39, 42, 16, 18, 67, 16, 67, 16, 30, 25, + 15, 17, 66, 15, 66, 66, 15, 17, 47, 67, + 15, 17, 63, 66, 15, 17, 55, 47, 15, 17, + 38, 15, 17, 34, 15, 17, 53, 15, 17, 44, + 15, 17, 51, 15, 66, 15, 17, 32, 66, 16, + 16, 15, 17, 59, 16, 46, 48, 15, 17, 39, + 17, 67, 17, 67, 25, 67, 15, 15, 15, 49, + 15, 15, 64, 15, 15, 58, 15, 15, 41, 15, + 40, 41, 43, 15, 50, 56, 57, 58, 68, 69, + 15, 45, 15, 56, 57, 58, 68, 69, 15, 15, + 30, 15, 15, 66, 66, 61, 15, 66, 15, 17, + 42, 15, 67, 17, 67, 17, 25, 15, 15, 15, + 15, 48, 17, 67, 17, 67, 15, 15, 67, 17, + 67, 17, 17, 67, 17, 67, 25, 17, 67, 17, + 17, 25, 15, 67, 25, 17, 15, 17, 25, 25, + 17, 17, 25, 25, 17, 17, 25, 25, 17, 15, + 25, 15 }; -/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ -static const yytype_int8 yyr1[] = + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = { - 0, 27, 28, 28, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 30, 30, 30, 30, 31, 31, 32, 32, 32, 32, - 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, - 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, - 38, 38, 39, 39, 39, 39, 40, 40, 41, 42, - 42, 42, 42, 43, 43, 44, 44, 44, 44, 44, - 45, 45, 46, 46, 47, 48, 49, 49, 49, 49, - 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, - 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, - 53, 53, 53, 53, 54, 54, 55, 55, 55, 55, - 56, 56, 56, 56, 57, 57, 58, 58, 59, 59, - 59, 59, 60, 61, 61, 61, 61, 62, 62, 63, - 63, 63, 64, 64, 64, 64, 65, 65, 66, 66, - 66, 67, 67 + 0, 28, 29, 29, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 31, 31, 31, 31, 32, 32, 33, 33, 33, + 33, 34, 34, 34, 34, 34, 34, 35, 35, 35, + 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, + 38, 39, 39, 40, 40, 40, 40, 41, 41, 42, + 43, 43, 43, 43, 44, 44, 45, 45, 45, 45, + 45, 45, 46, 46, 47, 47, 48, 49, 50, 50, + 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, + 54, 54, 55, 55, 56, 56, 56, 56, 57, 57, + 57, 57, 58, 58, 59, 59, 60, 60, 60, 60, + 61, 62, 62, 62, 62, 63, 63, 64, 64, 64, + 65, 65, 65, 65, 66, 66, 67, 67, 67, 68, + 68, 69, 69 }; -/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ -static const yytype_int8 yyr2[] = + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = { 0, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 4, 5, 3, 2, 3, 1, 4, 5, 3, 2, - 3, 3, 3, 1, 1, 1, 4, 5, 3, 2, - 4, 5, 3, 2, 4, 5, 3, 2, 3, 1, - 3, 1, 4, 5, 3, 2, 3, 1, 3, 4, - 5, 3, 2, 3, 1, 1, 1, 1, 1, 1, - 3, 1, 3, 1, 3, 3, 4, 5, 3, 2, - 3, 3, 3, 3, 1, 1, 1, 1, 4, 5, - 3, 2, 3, 3, 3, 3, 1, 1, 1, 1, - 4, 5, 3, 2, 3, 1, 4, 5, 3, 2, - 4, 5, 3, 2, 3, 1, 3, 1, 6, 7, - 3, 2, 5, 4, 5, 3, 2, 3, 1, 1, - 3, 1, 4, 5, 3, 2, 3, 1, 2, 3, - 4, 18, 19 + 1, 4, 5, 3, 2, 3, 1, 4, 5, 3, + 2, 3, 3, 3, 1, 1, 1, 4, 5, 3, + 2, 4, 5, 3, 2, 4, 5, 3, 2, 3, + 1, 3, 1, 4, 5, 3, 2, 3, 1, 3, + 4, 5, 3, 2, 3, 1, 1, 1, 1, 1, + 1, 1, 3, 1, 3, 1, 3, 3, 4, 5, + 3, 2, 3, 3, 3, 3, 3, 1, 1, 1, + 1, 1, 4, 5, 3, 2, 3, 3, 3, 3, + 3, 3, 1, 1, 1, 1, 1, 1, 4, 5, + 3, 2, 3, 1, 4, 5, 3, 2, 4, 5, + 3, 2, 3, 1, 3, 1, 6, 7, 3, 2, + 5, 4, 5, 3, 2, 3, 1, 1, 3, 1, + 4, 5, 3, 2, 3, 1, 2, 3, 4, 18, + 19, 10, 11 }; -enum { YYENOMEM = -2 }; - #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab -#define YYNOMEM goto yyexhaustedlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ - do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ - while (0) - -/* Backward compatibility with an undocumented macro. - Use YYerror or YYUNDEF. */ -#define YYERRCODE YYUNDEF +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends @@ -1066,27 +1001,20 @@ do { \ } while (0) -/* YYLOCATION_PRINT -- Print the location on the stream. +/* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ -# ifndef YYLOCATION_PRINT - -# if defined YY_LOCATION_PRINT - - /* Temporary convenience wrapper in case some people defined the - undocumented and private YY_LOCATION_PRINT macros. */ -# define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc)) - -# elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +#ifndef YY_LOCATION_PRINT +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ YY_ATTRIBUTE_UNUSED -static int +static unsigned yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) { - int res = 0; + unsigned res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { @@ -1106,71 +1034,63 @@ yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) res += YYFPRINTF (yyo, "-%d", end_col); } return res; -} + } -# define YYLOCATION_PRINT yy_location_print_ +# define YY_LOCATION_PRINT(File, Loc) \ + yy_location_print_ (File, &(Loc)) - /* Temporary convenience wrapper in case some people defined the - undocumented and private YY_LOCATION_PRINT macros. */ -# define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc)) - -# else - -# define YYLOCATION_PRINT(File, Loc) ((void) 0) - /* Temporary convenience wrapper in case some people defined the - undocumented and private YY_LOCATION_PRINT macros. */ -# define YY_LOCATION_PRINT YYLOCATION_PRINT - -# endif -# endif /* !defined YYLOCATION_PRINT */ +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif -# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Kind, Value, Location); \ + Type, Value, Location); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) -/*-----------------------------------. -| Print this symbol's value on YYO. | -`-----------------------------------*/ +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ static void -yy_symbol_value_print (FILE *yyo, - yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) { - FILE *yyoutput = yyo; - YY_USE (yyoutput); - YY_USE (yylocationp); + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (yylocationp); if (!yyvaluep) return; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YY_USE (yykind); - YY_IGNORE_MAYBE_UNINITIALIZED_END +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); } -/*---------------------------. -| Print this symbol on YYO. | -`---------------------------*/ +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ static void -yy_symbol_print (FILE *yyo, - yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) { - YYFPRINTF (yyo, "%s %s (", - yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - YYLOCATION_PRINT (yyo, yylocationp); - YYFPRINTF (yyo, ": "); - yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp); - YYFPRINTF (yyo, ")"); + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); + YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. @@ -1179,7 +1099,7 @@ yy_symbol_print (FILE *yyo, `------------------------------------------------------------------*/ static void -yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -1202,22 +1122,21 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, - int yyrule) +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) { - int yylno = yyrline[yyrule]; + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), - &yyvsp[(yyi + 1) - (yynrhs)], - &(yylsp[(yyi + 1) - (yynrhs)])); + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } @@ -1232,8 +1151,8 @@ do { \ multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ -# define YYDPRINTF(Args) ((void) 0) -# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -1256,77 +1175,28 @@ int yydebug; #endif -/* Context of a parse error. */ -typedef struct -{ - yy_state_t *yyssp; - yysymbol_kind_t yytoken; - YYLTYPE *yylloc; -} yypcontext_t; - -/* Put in YYARG at most YYARGN of the expected tokens given the - current YYCTX, and return the number of tokens stored in YYARG. If - YYARG is null, return the number of expected tokens (guaranteed to - be less than YYNTOKENS). Return YYENOMEM on memory exhaustion. - Return 0 if there are more than YYARGN expected tokens, yet fill - YYARG up to YYARGN. */ -static int -yypcontext_expected_tokens (const yypcontext_t *yyctx, - yysymbol_kind_t yyarg[], int yyargn) -{ - /* Actual size of YYARG. */ - int yycount = 0; - int yyn = yypact[+*yyctx->yyssp]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (!yyarg) - ++yycount; - else if (yycount == yyargn) - return 0; - else - yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx); - } - } - if (yyarg && yycount == 0 && 0 < yyargn) - yyarg[0] = YYSYMBOL_YYEMPTY; - return yycount; -} - - +#if YYERROR_VERBOSE - -#ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) -# else +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else /* Return the length of YYSTR. */ -static YYPTRDIFF_T +static YYSIZE_T yystrlen (const char *yystr) { - YYPTRDIFF_T yylen; + YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } +# endif # endif -#endif -#ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * @@ -1340,10 +1210,10 @@ yystpcpy (char *yydest, const char *yysrc) return yyd - 1; } +# endif # endif -#endif -#ifndef yytnamerr +# ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string @@ -1351,13 +1221,14 @@ yystpcpy (char *yydest, const char *yysrc) backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ -static YYPTRDIFF_T +static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - YYPTRDIFF_T yyn = 0; + YYSIZE_T yyn = 0; char const *yyp = yystr; + for (;;) switch (*++yyp) { @@ -1368,10 +1239,7 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - else - goto append; - - append: + /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; @@ -1386,20 +1254,36 @@ yytnamerr (char *yyres, const char *yystr) do_not_strip_quotes: ; } - if (yyres) - return yystpcpy (yyres, yystr) - yyres; - else + if (! yyres) return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; } -#endif +# endif +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ static int -yy_syntax_error_arguments (const yypcontext_t *yyctx, - yysymbol_kind_t yyarg[], int yyargn) +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) { - /* Actual size of YYARG. */ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ int yycount = 0; + /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action @@ -1423,78 +1307,63 @@ yy_syntax_error_arguments (const yypcontext_t *yyctx, one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ - if (yyctx->yytoken != YYSYMBOL_YYEMPTY) + if (yytoken != YYEMPTY) { - int yyn; - if (yyarg) - yyarg[yycount] = yyctx->yytoken; - ++yycount; - yyn = yypcontext_expected_tokens (yyctx, - yyarg ? yyarg + 1 : yyarg, yyargn - 1); - if (yyn == YYENOMEM) - return YYENOMEM; - else - yycount += yyn; + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } } - return yycount; -} - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, - const yypcontext_t *yyctx) -{ - enum { YYARGS_MAX = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat: reported tokens (one for the "unexpected", - one per "expected"). */ - yysymbol_kind_t yyarg[YYARGS_MAX]; - /* Cumulated lengths of YYARG. */ - YYPTRDIFF_T yysize = 0; - - /* Actual size of YYARG. */ - int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX); - if (yycount == YYENOMEM) - return YYENOMEM; switch (yycount) { -#define YYCASE_(N, S) \ +# define YYCASE_(N, S) \ case N: \ yyformat = S; \ - break - default: /* Avoid compiler warnings. */ + break YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -#undef YYCASE_ +# undef YYCASE_ } - /* Compute error message size. Don't count the "%s"s, but reserve - room for the terminator. */ - yysize = yystrlen (yyformat) - 2 * yycount + 1; { - int yyi; - for (yyi = 0; yyi < yycount; ++yyi) - { - YYPTRDIFF_T yysize1 - = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]); - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else - return YYENOMEM; - } + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -1503,7 +1372,7 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return -1; + return 1; } /* Avoid sprintf, as that infringes on the user's name space. @@ -1515,258 +1384,258 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { - yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]); + yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { - ++yyp; - ++yyformat; + yyp++; + yyformat++; } } return 0; } - +#endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void -yydestruct (const char *yymsg, - yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) { - YY_USE (yyvaluep); - YY_USE (yylocationp); + YYUSE (yyvaluep); + YYUSE (yylocationp); if (!yymsg) yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - switch (yykind) + switch (yytype) { - case YYSYMBOL_geometry_no_srid: /* geometry_no_srid */ -#line 196 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1552 "lwin_wkt_parse.c" + case 30: /* geometry_no_srid */ +#line 198 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1420 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_geometrycollection: /* geometrycollection */ -#line 197 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1558 "lwin_wkt_parse.c" + case 31: /* geometrycollection */ +#line 199 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1426 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_geometry_list: /* geometry_list */ -#line 198 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1564 "lwin_wkt_parse.c" + case 32: /* geometry_list */ +#line 200 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1432 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_multisurface: /* multisurface */ -#line 205 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1570 "lwin_wkt_parse.c" + case 33: /* multisurface */ +#line 207 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1438 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_surface_list: /* surface_list */ -#line 183 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1576 "lwin_wkt_parse.c" + case 34: /* surface_list */ +#line 185 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1444 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_tin: /* tin */ -#line 212 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1582 "lwin_wkt_parse.c" + case 35: /* tin */ +#line 214 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1450 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_polyhedralsurface: /* polyhedralsurface */ -#line 211 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1588 "lwin_wkt_parse.c" + case 36: /* polyhedralsurface */ +#line 213 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1456 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_multipolygon: /* multipolygon */ -#line 204 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1594 "lwin_wkt_parse.c" + case 37: /* multipolygon */ +#line 206 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1462 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_polygon_list: /* polygon_list */ -#line 184 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1600 "lwin_wkt_parse.c" + case 38: /* polygon_list */ +#line 186 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1468 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_patch_list: /* patch_list */ -#line 185 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1606 "lwin_wkt_parse.c" + case 39: /* patch_list */ +#line 187 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1474 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_polygon: /* polygon */ -#line 208 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1612 "lwin_wkt_parse.c" + case 40: /* polygon */ +#line 210 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1480 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_polygon_untagged: /* polygon_untagged */ -#line 210 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1618 "lwin_wkt_parse.c" + case 41: /* polygon_untagged */ +#line 212 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1486 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_patch: /* patch */ -#line 209 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1624 "lwin_wkt_parse.c" + case 42: /* patch */ +#line 211 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1492 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_curvepolygon: /* curvepolygon */ -#line 194 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1630 "lwin_wkt_parse.c" + case 43: /* curvepolygon */ +#line 196 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1498 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_curvering_list: /* curvering_list */ -#line 181 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1636 "lwin_wkt_parse.c" + case 44: /* curvering_list */ +#line 183 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1504 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_curvering: /* curvering */ -#line 195 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1642 "lwin_wkt_parse.c" + case 45: /* curvering */ +#line 197 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1510 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_patchring_list: /* patchring_list */ -#line 191 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1648 "lwin_wkt_parse.c" + case 46: /* patchring_list */ +#line 193 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1516 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_ring_list: /* ring_list */ -#line 190 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1654 "lwin_wkt_parse.c" + case 47: /* ring_list */ +#line 192 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1522 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_patchring: /* patchring */ -#line 180 "lwin_wkt_parse.y" - { ptarray_free(((*yyvaluep).ptarrayvalue)); } -#line 1660 "lwin_wkt_parse.c" + case 48: /* patchring */ +#line 182 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { ptarray_free(((*yyvaluep).ptarrayvalue)); } +#line 1528 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_ring: /* ring */ -#line 179 "lwin_wkt_parse.y" - { ptarray_free(((*yyvaluep).ptarrayvalue)); } -#line 1666 "lwin_wkt_parse.c" + case 49: /* ring */ +#line 181 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { ptarray_free(((*yyvaluep).ptarrayvalue)); } +#line 1534 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_compoundcurve: /* compoundcurve */ -#line 193 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1672 "lwin_wkt_parse.c" + case 50: /* compoundcurve */ +#line 195 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1540 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_compound_list: /* compound_list */ -#line 189 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1678 "lwin_wkt_parse.c" + case 51: /* compound_list */ +#line 191 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1546 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_multicurve: /* multicurve */ -#line 201 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1684 "lwin_wkt_parse.c" + case 52: /* multicurve */ +#line 203 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1552 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_curve_list: /* curve_list */ -#line 188 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1690 "lwin_wkt_parse.c" + case 53: /* curve_list */ +#line 190 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1558 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_multilinestring: /* multilinestring */ -#line 202 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1696 "lwin_wkt_parse.c" + case 54: /* multilinestring */ +#line 204 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1564 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_linestring_list: /* linestring_list */ -#line 187 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1702 "lwin_wkt_parse.c" + case 55: /* linestring_list */ +#line 189 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1570 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_circularstring: /* circularstring */ -#line 192 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1708 "lwin_wkt_parse.c" + case 56: /* circularstring */ +#line 194 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1576 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_linestring: /* linestring */ -#line 199 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1714 "lwin_wkt_parse.c" + case 57: /* linestring */ +#line 201 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1582 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_linestring_untagged: /* linestring_untagged */ -#line 200 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1720 "lwin_wkt_parse.c" + case 58: /* linestring_untagged */ +#line 202 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1588 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_triangle_list: /* triangle_list */ -#line 182 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1726 "lwin_wkt_parse.c" + case 59: /* triangle_list */ +#line 184 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1594 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_triangle: /* triangle */ -#line 213 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1732 "lwin_wkt_parse.c" + case 60: /* triangle */ +#line 215 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1600 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_triangle_untagged: /* triangle_untagged */ -#line 214 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1738 "lwin_wkt_parse.c" + case 61: /* triangle_untagged */ +#line 216 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1606 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_multipoint: /* multipoint */ -#line 203 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1744 "lwin_wkt_parse.c" + case 62: /* multipoint */ +#line 205 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1612 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_point_list: /* point_list */ -#line 186 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1750 "lwin_wkt_parse.c" + case 63: /* point_list */ +#line 188 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1618 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_point_untagged: /* point_untagged */ -#line 207 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1756 "lwin_wkt_parse.c" + case 64: /* point_untagged */ +#line 209 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1624 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_point: /* point */ -#line 206 "lwin_wkt_parse.y" - { lwgeom_free(((*yyvaluep).geometryvalue)); } -#line 1762 "lwin_wkt_parse.c" + case 65: /* point */ +#line 208 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { lwgeom_free(((*yyvaluep).geometryvalue)); } +#line 1630 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; - case YYSYMBOL_ptarray: /* ptarray */ -#line 178 "lwin_wkt_parse.y" - { ptarray_free(((*yyvaluep).ptarrayvalue)); } -#line 1768 "lwin_wkt_parse.c" + case 66: /* ptarray */ +#line 180 "lwin_wkt_parse.y" /* yacc.c:1257 */ + { ptarray_free(((*yyvaluep).ptarrayvalue)); } +#line 1636 "lwin_wkt_parse.c" /* yacc.c:1257 */ break; + default: break; } @@ -1774,7 +1643,9 @@ yydestruct (const char *yymsg, } -/* Lookahead token kind. */ + + +/* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ @@ -1789,8 +1660,6 @@ YYLTYPE yylloc int yynerrs; - - /*----------. | yyparse. | `----------*/ @@ -1798,48 +1667,53 @@ int yynerrs; int yyparse (void) { - yy_state_fast_t yystate = 0; + int yystate; /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus = 0; + int yyerrstatus; - /* Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + 'yyls': related to locations. - /* Their size. */ - YYPTRDIFF_T yystacksize = YYINITDEPTH; + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ - /* The state stack: array, bottom, top. */ - yy_state_t yyssa[YYINITDEPTH]; - yy_state_t *yyss = yyssa; - yy_state_t *yyssp = yyss; + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; - /* The semantic value stack: array, bottom, top. */ + /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp = yyvs; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - /* The location stack: array, bottom, top. */ + /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp = yyls; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[3]; + + YYSIZE_T yystacksize; int yyn; - /* The return value of yyparse. */ int yyresult; - /* Lookahead symbol kind. */ - yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[3]; - +#if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; - YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) @@ -1847,49 +1721,43 @@ yyparse (void) Keep to zero when no symbol should be popped. */ int yylen = 0; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yylsp = yyls = yylsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - yylsp[0] = yylloc; goto yysetstate; - /*------------------------------------------------------------. -| yynewstate -- push a new state, which is found in yystate. | +| yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ -yynewstate: + yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - -/*--------------------------------------------------------------------. -| yysetstate -- set current state (the top of the stack) to yystate. | -`--------------------------------------------------------------------*/ -yysetstate: - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - YY_ASSERT (0 <= yystate && yystate < YYNSTATES); - YY_IGNORE_USELESS_CAST_BEGIN - *yyssp = YY_CAST (yy_state_t, yystate); - YY_IGNORE_USELESS_CAST_END - YY_STACK_PRINT (yyss, yyssp); + yysetstate: + *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) -#if !defined yyoverflow && !defined YYSTACK_RELOCATE - YYNOMEM; -#else { /* Get the current used size of the three stacks, in elements. */ - YYPTRDIFF_T yysize = yyssp - yyss + 1; + YYSIZE_T yysize = yyssp - yyss + 1; -# if defined yyoverflow +#ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ - yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; YYLTYPE *yyls1 = yyls; /* Each stack pointer address is followed by the size of the @@ -1897,29 +1765,32 @@ yysetstate: conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * YYSIZEOF (*yyssp), - &yyvs1, yysize * YYSIZEOF (*yyvsp), - &yyls1, yysize * YYSIZEOF (*yylsp), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), &yystacksize); + + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; - yyls = yyls1; } -# else /* defined YYSTACK_RELOCATE */ +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - YYNOMEM; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { - yy_state_t *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = - YY_CAST (union yyalloc *, - YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) - YYNOMEM; + goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); YYSTACK_RELOCATE (yyls_alloc, yyls); @@ -1928,32 +1799,31 @@ yysetstate: YYSTACK_FREE (yyss1); } # endif +#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; yylsp = yyls + yysize - 1; - YY_IGNORE_USELESS_CAST_BEGIN - YYDPRINTF ((stderr, "Stack size increased to %ld\n", - YY_CAST (long, yystacksize))); - YY_IGNORE_USELESS_CAST_END + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } -#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; - /*-----------. | yybackup. | `-----------*/ yybackup: + /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1964,30 +1834,18 @@ yybackup: /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token\n")); + YYDPRINTF ((stderr, "Reading a token: ")); yychar = yylex (); } if (yychar <= YYEOF) { - yychar = YYEOF; - yytoken = YYSYMBOL_YYEOF; + yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } - else if (yychar == YYerror) - { - /* The scanner already issued an error message, process directly - to error recovery. But do not keep the error token as - lookahead, it is too special and may lead us to an endless - loop in error recovery. */ - yychar = YYUNDEF; - yytoken = YYSYMBOL_YYerror; - yyerror_range[1] = yylloc; - goto yyerrlab1; - } else { yytoken = YYTRANSLATE (yychar); @@ -2015,14 +1873,15 @@ yybackup: /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END *++yylsp = yylloc; - - /* Discard the shifted token. */ - yychar = YYEMPTY; goto yynewstate; @@ -2037,7 +1896,7 @@ yydefault: /*-----------------------------. -| yyreduce -- do a reduction. | +| yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -2053,861 +1912,919 @@ yyreduce: GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; - /* Default location. */ + /* Default location. */ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); - yyerror_range[1] = yyloc; YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: /* geometry: geometry_no_srid */ -#line 220 "lwin_wkt_parse.y" - { wkt_parser_geometry_new((yyvsp[0].geometryvalue), SRID_UNKNOWN); WKT_ERROR(); } -#line 2066 "lwin_wkt_parse.c" + case 2: +#line 222 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { wkt_parser_geometry_new((yyvsp[0].geometryvalue), SRID_UNKNOWN); WKT_ERROR(); } +#line 1924 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 3: /* geometry: SRID_TOK SEMICOLON_TOK geometry_no_srid */ -#line 222 "lwin_wkt_parse.y" - { wkt_parser_geometry_new((yyvsp[0].geometryvalue), (yyvsp[-2].integervalue)); WKT_ERROR(); } -#line 2072 "lwin_wkt_parse.c" + case 3: +#line 224 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { wkt_parser_geometry_new((yyvsp[0].geometryvalue), (yyvsp[-2].integervalue)); WKT_ERROR(); } +#line 1930 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 4: /* geometry_no_srid: point */ -#line 225 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2078 "lwin_wkt_parse.c" + case 4: +#line 227 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 1936 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 5: /* geometry_no_srid: linestring */ -#line 226 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2084 "lwin_wkt_parse.c" + case 5: +#line 228 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 1942 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 6: /* geometry_no_srid: circularstring */ -#line 227 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2090 "lwin_wkt_parse.c" + case 6: +#line 229 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 1948 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 7: /* geometry_no_srid: compoundcurve */ -#line 228 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2096 "lwin_wkt_parse.c" + case 7: +#line 230 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 1954 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 8: /* geometry_no_srid: polygon */ -#line 229 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2102 "lwin_wkt_parse.c" + case 8: +#line 231 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 1960 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 9: /* geometry_no_srid: curvepolygon */ -#line 230 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2108 "lwin_wkt_parse.c" + case 9: +#line 232 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 1966 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 10: /* geometry_no_srid: multipoint */ -#line 231 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2114 "lwin_wkt_parse.c" + case 10: +#line 233 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 1972 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 11: /* geometry_no_srid: multilinestring */ -#line 232 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2120 "lwin_wkt_parse.c" + case 11: +#line 234 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 1978 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 12: /* geometry_no_srid: multipolygon */ -#line 233 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2126 "lwin_wkt_parse.c" + case 12: +#line 235 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 1984 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 13: /* geometry_no_srid: multisurface */ -#line 234 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2132 "lwin_wkt_parse.c" + case 13: +#line 236 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 1990 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 14: /* geometry_no_srid: multicurve */ -#line 235 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2138 "lwin_wkt_parse.c" + case 14: +#line 237 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 1996 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 15: /* geometry_no_srid: tin */ -#line 236 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2144 "lwin_wkt_parse.c" + case 15: +#line 238 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 2002 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 16: /* geometry_no_srid: polyhedralsurface */ -#line 237 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2150 "lwin_wkt_parse.c" + case 16: +#line 239 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 2008 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 17: /* geometry_no_srid: triangle */ -#line 238 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2156 "lwin_wkt_parse.c" + case 17: +#line 240 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 2014 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 18: /* geometry_no_srid: geometrycollection */ -#line 239 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2162 "lwin_wkt_parse.c" + case 18: +#line 241 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 2020 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 19: /* geometry_no_srid: ellipse */ -#line 240 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2168 "lwin_wkt_parse.c" + case 19: +#line 242 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 2026 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 20: /* geometrycollection: COLLECTION_TOK LBRACKET_TOK geometry_list RBRACKET_TOK */ -#line 244 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(COLLECTIONTYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } -#line 2174 "lwin_wkt_parse.c" + case 20: +#line 243 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 2032 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 21: /* geometrycollection: COLLECTION_TOK DIMENSIONALITY_TOK LBRACKET_TOK geometry_list RBRACKET_TOK */ -#line 246 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(COLLECTIONTYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2180 "lwin_wkt_parse.c" + case 21: +#line 247 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(COLLECTIONTYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } +#line 2038 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 22: /* geometrycollection: COLLECTION_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 248 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(COLLECTIONTYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2186 "lwin_wkt_parse.c" + case 22: +#line 249 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(COLLECTIONTYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2044 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 23: /* geometrycollection: COLLECTION_TOK EMPTY_TOK */ -#line 250 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(COLLECTIONTYPE, NULL, NULL); WKT_ERROR(); } -#line 2192 "lwin_wkt_parse.c" + case 23: +#line 251 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(COLLECTIONTYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2050 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 24: /* geometry_list: geometry_list COMMA_TOK geometry_no_srid */ -#line 254 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2198 "lwin_wkt_parse.c" + case 24: +#line 253 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(COLLECTIONTYPE, NULL, NULL); WKT_ERROR(); } +#line 2056 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 25: /* geometry_list: geometry_no_srid */ -#line 256 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2204 "lwin_wkt_parse.c" + case 25: +#line 257 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2062 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 26: /* multisurface: MSURFACE_TOK LBRACKET_TOK surface_list RBRACKET_TOK */ -#line 260 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTISURFACETYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } -#line 2210 "lwin_wkt_parse.c" + case 26: +#line 259 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2068 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 27: /* multisurface: MSURFACE_TOK DIMENSIONALITY_TOK LBRACKET_TOK surface_list RBRACKET_TOK */ -#line 262 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTISURFACETYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2216 "lwin_wkt_parse.c" + case 27: +#line 263 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTISURFACETYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } +#line 2074 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 28: /* multisurface: MSURFACE_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 264 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTISURFACETYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2222 "lwin_wkt_parse.c" + case 28: +#line 265 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTISURFACETYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2080 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 29: /* multisurface: MSURFACE_TOK EMPTY_TOK */ -#line 266 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTISURFACETYPE, NULL, NULL); WKT_ERROR(); } -#line 2228 "lwin_wkt_parse.c" + case 29: +#line 267 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTISURFACETYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2086 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 30: /* surface_list: surface_list COMMA_TOK polygon */ -#line 270 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2234 "lwin_wkt_parse.c" + case 30: +#line 269 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTISURFACETYPE, NULL, NULL); WKT_ERROR(); } +#line 2092 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 31: /* surface_list: surface_list COMMA_TOK curvepolygon */ -#line 272 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2240 "lwin_wkt_parse.c" + case 31: +#line 273 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2098 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 32: /* surface_list: surface_list COMMA_TOK polygon_untagged */ -#line 274 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2246 "lwin_wkt_parse.c" + case 32: +#line 275 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2104 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 33: /* surface_list: polygon */ -#line 276 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2252 "lwin_wkt_parse.c" + case 33: +#line 277 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2110 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 34: /* surface_list: curvepolygon */ -#line 278 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2258 "lwin_wkt_parse.c" + case 34: +#line 279 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2116 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 35: /* surface_list: polygon_untagged */ -#line 280 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2264 "lwin_wkt_parse.c" + case 35: +#line 281 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2122 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 36: /* tin: TIN_TOK LBRACKET_TOK triangle_list RBRACKET_TOK */ -#line 284 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(TINTYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } -#line 2270 "lwin_wkt_parse.c" + case 36: +#line 283 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2128 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 37: /* tin: TIN_TOK DIMENSIONALITY_TOK LBRACKET_TOK triangle_list RBRACKET_TOK */ -#line 286 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(TINTYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2276 "lwin_wkt_parse.c" + case 37: +#line 287 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(TINTYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } +#line 2134 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 38: /* tin: TIN_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 288 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(TINTYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2282 "lwin_wkt_parse.c" + case 38: +#line 289 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(TINTYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2140 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 39: /* tin: TIN_TOK EMPTY_TOK */ -#line 290 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(TINTYPE, NULL, NULL); WKT_ERROR(); } -#line 2288 "lwin_wkt_parse.c" + case 39: +#line 291 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(TINTYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2146 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 40: /* polyhedralsurface: POLYHEDRALSURFACE_TOK LBRACKET_TOK patch_list RBRACKET_TOK */ -#line 294 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(POLYHEDRALSURFACETYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } -#line 2294 "lwin_wkt_parse.c" + case 40: +#line 293 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(TINTYPE, NULL, NULL); WKT_ERROR(); } +#line 2152 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 41: /* polyhedralsurface: POLYHEDRALSURFACE_TOK DIMENSIONALITY_TOK LBRACKET_TOK patch_list RBRACKET_TOK */ -#line 296 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(POLYHEDRALSURFACETYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2300 "lwin_wkt_parse.c" + case 41: +#line 297 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(POLYHEDRALSURFACETYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } +#line 2158 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 42: /* polyhedralsurface: POLYHEDRALSURFACE_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 298 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(POLYHEDRALSURFACETYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2306 "lwin_wkt_parse.c" + case 42: +#line 299 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(POLYHEDRALSURFACETYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2164 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 43: /* polyhedralsurface: POLYHEDRALSURFACE_TOK EMPTY_TOK */ -#line 300 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(POLYHEDRALSURFACETYPE, NULL, NULL); WKT_ERROR(); } -#line 2312 "lwin_wkt_parse.c" + case 43: +#line 301 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(POLYHEDRALSURFACETYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2170 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 44: /* multipolygon: MPOLYGON_TOK LBRACKET_TOK polygon_list RBRACKET_TOK */ -#line 304 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOLYGONTYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } -#line 2318 "lwin_wkt_parse.c" + case 44: +#line 303 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(POLYHEDRALSURFACETYPE, NULL, NULL); WKT_ERROR(); } +#line 2176 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 45: /* multipolygon: MPOLYGON_TOK DIMENSIONALITY_TOK LBRACKET_TOK polygon_list RBRACKET_TOK */ -#line 306 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOLYGONTYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2324 "lwin_wkt_parse.c" + case 45: +#line 307 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOLYGONTYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } +#line 2182 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 46: /* multipolygon: MPOLYGON_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 308 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOLYGONTYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2330 "lwin_wkt_parse.c" + case 46: +#line 309 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOLYGONTYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2188 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 47: /* multipolygon: MPOLYGON_TOK EMPTY_TOK */ -#line 310 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOLYGONTYPE, NULL, NULL); WKT_ERROR(); } -#line 2336 "lwin_wkt_parse.c" + case 47: +#line 311 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOLYGONTYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2194 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 48: /* polygon_list: polygon_list COMMA_TOK polygon_untagged */ -#line 314 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2342 "lwin_wkt_parse.c" + case 48: +#line 313 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOLYGONTYPE, NULL, NULL); WKT_ERROR(); } +#line 2200 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 49: /* polygon_list: polygon_untagged */ -#line 316 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2348 "lwin_wkt_parse.c" + case 49: +#line 317 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2206 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 50: /* patch_list: patch_list COMMA_TOK patch */ -#line 320 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2354 "lwin_wkt_parse.c" + case 50: +#line 319 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2212 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 51: /* patch_list: patch */ -#line 322 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2360 "lwin_wkt_parse.c" + case 51: +#line 323 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2218 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 52: /* polygon: POLYGON_TOK LBRACKET_TOK ring_list RBRACKET_TOK */ -#line 326 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_polygon_finalize((yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } -#line 2366 "lwin_wkt_parse.c" + case 52: +#line 325 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2224 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 53: /* polygon: POLYGON_TOK DIMENSIONALITY_TOK LBRACKET_TOK ring_list RBRACKET_TOK */ -#line 328 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_polygon_finalize((yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2372 "lwin_wkt_parse.c" + case 53: +#line 329 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_polygon_finalize((yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } +#line 2230 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 54: /* polygon: POLYGON_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 330 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_polygon_finalize(NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2378 "lwin_wkt_parse.c" + case 54: +#line 331 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_polygon_finalize((yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2236 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 55: /* polygon: POLYGON_TOK EMPTY_TOK */ -#line 332 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_polygon_finalize(NULL, NULL); WKT_ERROR(); } -#line 2384 "lwin_wkt_parse.c" + case 55: +#line 333 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_polygon_finalize(NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2242 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 56: /* polygon_untagged: LBRACKET_TOK ring_list RBRACKET_TOK */ -#line 336 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[-1].geometryvalue); } -#line 2390 "lwin_wkt_parse.c" + case 56: +#line 335 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_polygon_finalize(NULL, NULL); WKT_ERROR(); } +#line 2248 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 57: /* polygon_untagged: EMPTY_TOK */ -#line 338 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_polygon_finalize(NULL, NULL); WKT_ERROR(); } -#line 2396 "lwin_wkt_parse.c" + case 57: +#line 339 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[-1].geometryvalue); } +#line 2254 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 58: /* patch: LBRACKET_TOK patchring_list RBRACKET_TOK */ -#line 341 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[-1].geometryvalue); } -#line 2402 "lwin_wkt_parse.c" + case 58: +#line 341 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_polygon_finalize(NULL, NULL); WKT_ERROR(); } +#line 2260 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 59: /* curvepolygon: CURVEPOLYGON_TOK LBRACKET_TOK curvering_list RBRACKET_TOK */ -#line 345 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_curvepolygon_finalize((yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } -#line 2408 "lwin_wkt_parse.c" + case 59: +#line 344 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[-1].geometryvalue); } +#line 2266 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 60: /* curvepolygon: CURVEPOLYGON_TOK DIMENSIONALITY_TOK LBRACKET_TOK curvering_list RBRACKET_TOK */ -#line 347 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_curvepolygon_finalize((yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2414 "lwin_wkt_parse.c" + case 60: +#line 348 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_curvepolygon_finalize((yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } +#line 2272 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 61: /* curvepolygon: CURVEPOLYGON_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 349 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_curvepolygon_finalize(NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2420 "lwin_wkt_parse.c" + case 61: +#line 350 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_curvepolygon_finalize((yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2278 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 62: /* curvepolygon: CURVEPOLYGON_TOK EMPTY_TOK */ -#line 351 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_curvepolygon_finalize(NULL, NULL); WKT_ERROR(); } -#line 2426 "lwin_wkt_parse.c" + case 62: +#line 352 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_curvepolygon_finalize(NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2284 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 63: /* curvering_list: curvering_list COMMA_TOK curvering */ -#line 355 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_curvepolygon_add_ring((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2432 "lwin_wkt_parse.c" + case 63: +#line 354 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_curvepolygon_finalize(NULL, NULL); WKT_ERROR(); } +#line 2290 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 64: /* curvering_list: curvering */ -#line 357 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_curvepolygon_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2438 "lwin_wkt_parse.c" + case 64: +#line 358 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_curvepolygon_add_ring((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2296 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 65: /* curvering: linestring_untagged */ -#line 360 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2444 "lwin_wkt_parse.c" + case 65: +#line 360 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_curvepolygon_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2302 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 66: /* curvering: linestring */ -#line 361 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2450 "lwin_wkt_parse.c" + case 66: +#line 363 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 2308 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 67: /* curvering: compoundcurve */ -#line 362 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2456 "lwin_wkt_parse.c" + case 67: +#line 364 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 2314 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 68: /* curvering: circularstring */ -#line 363 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2462 "lwin_wkt_parse.c" + case 68: +#line 365 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 2320 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 69: /* curvering: ellipse */ -#line 364 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } -#line 2468 "lwin_wkt_parse.c" + case 69: +#line 366 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 2326 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 70: /* patchring_list: patchring_list COMMA_TOK patchring */ -#line 368 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_polygon_add_ring((yyvsp[-2].geometryvalue),(yyvsp[0].ptarrayvalue),'Z'); WKT_ERROR(); } -#line 2474 "lwin_wkt_parse.c" + case 70: +#line 367 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 2332 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 71: /* patchring_list: patchring */ -#line 370 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_polygon_new((yyvsp[0].ptarrayvalue),'Z'); WKT_ERROR(); } -#line 2480 "lwin_wkt_parse.c" + case 71: +#line 368 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = (yyvsp[0].geometryvalue); } +#line 2338 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 72: /* ring_list: ring_list COMMA_TOK ring */ -#line 374 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_polygon_add_ring((yyvsp[-2].geometryvalue),(yyvsp[0].ptarrayvalue),'2'); WKT_ERROR(); } -#line 2486 "lwin_wkt_parse.c" + case 72: +#line 372 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_polygon_add_ring((yyvsp[-2].geometryvalue),(yyvsp[0].ptarrayvalue),'Z'); WKT_ERROR(); } +#line 2344 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 73: /* ring_list: ring */ -#line 376 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_polygon_new((yyvsp[0].ptarrayvalue),'2'); WKT_ERROR(); } -#line 2492 "lwin_wkt_parse.c" + case 73: +#line 374 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_polygon_new((yyvsp[0].ptarrayvalue),'Z'); WKT_ERROR(); } +#line 2350 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 74: /* patchring: LBRACKET_TOK ptarray RBRACKET_TOK */ -#line 379 "lwin_wkt_parse.y" - { (yyval.ptarrayvalue) = (yyvsp[-1].ptarrayvalue); } -#line 2498 "lwin_wkt_parse.c" + case 74: +#line 378 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_polygon_add_ring((yyvsp[-2].geometryvalue),(yyvsp[0].ptarrayvalue),'2'); WKT_ERROR(); } +#line 2356 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 75: /* ring: LBRACKET_TOK ptarray RBRACKET_TOK */ -#line 382 "lwin_wkt_parse.y" - { (yyval.ptarrayvalue) = (yyvsp[-1].ptarrayvalue); } -#line 2504 "lwin_wkt_parse.c" + case 75: +#line 380 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_polygon_new((yyvsp[0].ptarrayvalue),'2'); WKT_ERROR(); } +#line 2362 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 76: /* compoundcurve: COMPOUNDCURVE_TOK LBRACKET_TOK compound_list RBRACKET_TOK */ -#line 386 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(COMPOUNDTYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } -#line 2510 "lwin_wkt_parse.c" + case 76: +#line 383 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.ptarrayvalue) = (yyvsp[-1].ptarrayvalue); } +#line 2368 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 77: /* compoundcurve: COMPOUNDCURVE_TOK DIMENSIONALITY_TOK LBRACKET_TOK compound_list RBRACKET_TOK */ -#line 388 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(COMPOUNDTYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2516 "lwin_wkt_parse.c" + case 77: +#line 386 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.ptarrayvalue) = (yyvsp[-1].ptarrayvalue); } +#line 2374 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 78: /* compoundcurve: COMPOUNDCURVE_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 390 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(COMPOUNDTYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2522 "lwin_wkt_parse.c" + case 78: +#line 390 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(COMPOUNDTYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } +#line 2380 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 79: /* compoundcurve: COMPOUNDCURVE_TOK EMPTY_TOK */ -#line 392 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(COMPOUNDTYPE, NULL, NULL); WKT_ERROR(); } -#line 2528 "lwin_wkt_parse.c" + case 79: +#line 392 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(COMPOUNDTYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2386 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 80: /* compound_list: compound_list COMMA_TOK circularstring */ -#line 396 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_compound_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2534 "lwin_wkt_parse.c" + case 80: +#line 394 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(COMPOUNDTYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2392 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 81: /* compound_list: compound_list COMMA_TOK linestring */ -#line 398 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_compound_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2540 "lwin_wkt_parse.c" + case 81: +#line 396 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(COMPOUNDTYPE, NULL, NULL); WKT_ERROR(); } +#line 2398 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 82: /* compound_list: compound_list COMMA_TOK linestring_untagged */ -#line 400 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_compound_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2546 "lwin_wkt_parse.c" + case 82: +#line 400 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_compound_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2404 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 83: /* compound_list: compound_list COMMA_TOK ellipse */ -#line 402 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_compound_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2552 "lwin_wkt_parse.c" + case 83: +#line 402 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_compound_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2410 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 84: /* compound_list: circularstring */ -#line 404 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_compound_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2558 "lwin_wkt_parse.c" + case 84: +#line 404 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_compound_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2416 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 85: /* compound_list: linestring */ -#line 406 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_compound_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2564 "lwin_wkt_parse.c" + case 85: +#line 406 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_compound_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2422 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 86: /* compound_list: linestring_untagged */ -#line 408 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_compound_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2570 "lwin_wkt_parse.c" + case 86: +#line 408 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_compound_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2428 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 87: /* compound_list: ellipse */ -#line 410 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_compound_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2576 "lwin_wkt_parse.c" + case 87: +#line 410 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_compound_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2434 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 88: /* multicurve: MCURVE_TOK LBRACKET_TOK curve_list RBRACKET_TOK */ -#line 414 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTICURVETYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } -#line 2582 "lwin_wkt_parse.c" + case 88: +#line 412 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_compound_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2440 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 89: /* multicurve: MCURVE_TOK DIMENSIONALITY_TOK LBRACKET_TOK curve_list RBRACKET_TOK */ -#line 416 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTICURVETYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2588 "lwin_wkt_parse.c" + case 89: +#line 414 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_compound_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2446 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 90: /* multicurve: MCURVE_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 418 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTICURVETYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2594 "lwin_wkt_parse.c" + case 90: +#line 416 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_compound_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2452 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 91: /* multicurve: MCURVE_TOK EMPTY_TOK */ -#line 420 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTICURVETYPE, NULL, NULL); WKT_ERROR(); } -#line 2600 "lwin_wkt_parse.c" + case 91: +#line 418 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_compound_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2458 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 92: /* curve_list: curve_list COMMA_TOK circularstring */ -#line 424 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2606 "lwin_wkt_parse.c" + case 92: +#line 422 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTICURVETYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } +#line 2464 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 93: /* curve_list: curve_list COMMA_TOK compoundcurve */ -#line 426 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2612 "lwin_wkt_parse.c" + case 93: +#line 424 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTICURVETYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2470 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 94: /* curve_list: curve_list COMMA_TOK linestring */ -#line 428 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2618 "lwin_wkt_parse.c" + case 94: +#line 426 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTICURVETYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2476 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 95: /* curve_list: curve_list COMMA_TOK linestring_untagged */ -#line 430 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2624 "lwin_wkt_parse.c" + case 95: +#line 428 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTICURVETYPE, NULL, NULL); WKT_ERROR(); } +#line 2482 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 96: /* curve_list: circularstring */ -#line 432 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2630 "lwin_wkt_parse.c" + case 96: +#line 432 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2488 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 97: /* curve_list: compoundcurve */ -#line 434 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2636 "lwin_wkt_parse.c" + case 97: +#line 434 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2494 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 98: /* curve_list: linestring */ -#line 436 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2642 "lwin_wkt_parse.c" + case 98: +#line 436 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2500 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 99: /* curve_list: linestring_untagged */ -#line 438 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2648 "lwin_wkt_parse.c" + case 99: +#line 438 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2506 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 100: /* multilinestring: MLINESTRING_TOK LBRACKET_TOK linestring_list RBRACKET_TOK */ -#line 442 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTILINETYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } -#line 2654 "lwin_wkt_parse.c" + case 100: +#line 440 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2512 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 101: /* multilinestring: MLINESTRING_TOK DIMENSIONALITY_TOK LBRACKET_TOK linestring_list RBRACKET_TOK */ -#line 444 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTILINETYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2660 "lwin_wkt_parse.c" + case 101: +#line 442 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2518 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 102: /* multilinestring: MLINESTRING_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 446 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTILINETYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2666 "lwin_wkt_parse.c" + case 102: +#line 444 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2524 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 103: /* multilinestring: MLINESTRING_TOK EMPTY_TOK */ -#line 448 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTILINETYPE, NULL, NULL); WKT_ERROR(); } -#line 2672 "lwin_wkt_parse.c" + case 103: +#line 446 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2530 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 104: /* linestring_list: linestring_list COMMA_TOK linestring_untagged */ -#line 452 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2678 "lwin_wkt_parse.c" + case 104: +#line 448 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2536 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 105: /* linestring_list: linestring_untagged */ -#line 454 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2684 "lwin_wkt_parse.c" + case 105: +#line 450 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2542 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 106: /* circularstring: CIRCULARSTRING_TOK LBRACKET_TOK ptarray RBRACKET_TOK */ -#line 458 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_circularstring_new((yyvsp[-1].ptarrayvalue), NULL); WKT_ERROR(); } -#line 2690 "lwin_wkt_parse.c" + case 106: +#line 452 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2548 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 107: /* circularstring: CIRCULARSTRING_TOK DIMENSIONALITY_TOK LBRACKET_TOK ptarray RBRACKET_TOK */ -#line 460 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_circularstring_new((yyvsp[-1].ptarrayvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2696 "lwin_wkt_parse.c" + case 107: +#line 454 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2554 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 108: /* circularstring: CIRCULARSTRING_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 462 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_circularstring_new(NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2702 "lwin_wkt_parse.c" + case 108: +#line 458 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTILINETYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } +#line 2560 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 109: /* circularstring: CIRCULARSTRING_TOK EMPTY_TOK */ -#line 464 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_circularstring_new(NULL, NULL); WKT_ERROR(); } -#line 2708 "lwin_wkt_parse.c" + case 109: +#line 460 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTILINETYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2566 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 110: /* linestring: LINESTRING_TOK LBRACKET_TOK ptarray RBRACKET_TOK */ -#line 468 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_linestring_new((yyvsp[-1].ptarrayvalue), NULL); WKT_ERROR(); } -#line 2714 "lwin_wkt_parse.c" + case 110: +#line 462 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTILINETYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2572 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 111: /* linestring: LINESTRING_TOK DIMENSIONALITY_TOK LBRACKET_TOK ptarray RBRACKET_TOK */ -#line 470 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_linestring_new((yyvsp[-1].ptarrayvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2720 "lwin_wkt_parse.c" + case 111: +#line 464 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTILINETYPE, NULL, NULL); WKT_ERROR(); } +#line 2578 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 112: /* linestring: LINESTRING_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 472 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_linestring_new(NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2726 "lwin_wkt_parse.c" + case 112: +#line 468 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2584 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 113: /* linestring: LINESTRING_TOK EMPTY_TOK */ -#line 474 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_linestring_new(NULL, NULL); WKT_ERROR(); } -#line 2732 "lwin_wkt_parse.c" + case 113: +#line 470 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2590 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 114: /* linestring_untagged: LBRACKET_TOK ptarray RBRACKET_TOK */ -#line 478 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_linestring_new((yyvsp[-1].ptarrayvalue), NULL); WKT_ERROR(); } -#line 2738 "lwin_wkt_parse.c" + case 114: +#line 474 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_circularstring_new((yyvsp[-1].ptarrayvalue), NULL); WKT_ERROR(); } +#line 2596 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 115: /* linestring_untagged: EMPTY_TOK */ -#line 480 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_linestring_new(NULL, NULL); WKT_ERROR(); } -#line 2744 "lwin_wkt_parse.c" + case 115: +#line 476 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_circularstring_new((yyvsp[-1].ptarrayvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2602 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 116: /* triangle_list: triangle_list COMMA_TOK triangle_untagged */ -#line 484 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2750 "lwin_wkt_parse.c" + case 116: +#line 478 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_circularstring_new(NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2608 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 117: /* triangle_list: triangle_untagged */ -#line 486 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2756 "lwin_wkt_parse.c" + case 117: +#line 480 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_circularstring_new(NULL, NULL); WKT_ERROR(); } +#line 2614 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 118: /* triangle: TRIANGLE_TOK LBRACKET_TOK LBRACKET_TOK ptarray RBRACKET_TOK RBRACKET_TOK */ -#line 490 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_triangle_new((yyvsp[-2].ptarrayvalue), NULL); WKT_ERROR(); } -#line 2762 "lwin_wkt_parse.c" + case 118: +#line 484 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_linestring_new((yyvsp[-1].ptarrayvalue), NULL); WKT_ERROR(); } +#line 2620 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 119: /* triangle: TRIANGLE_TOK DIMENSIONALITY_TOK LBRACKET_TOK LBRACKET_TOK ptarray RBRACKET_TOK RBRACKET_TOK */ -#line 492 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_triangle_new((yyvsp[-2].ptarrayvalue), (yyvsp[-5].stringvalue)); WKT_ERROR(); } -#line 2768 "lwin_wkt_parse.c" + case 119: +#line 486 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_linestring_new((yyvsp[-1].ptarrayvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2626 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 120: /* triangle: TRIANGLE_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 494 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_triangle_new(NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2774 "lwin_wkt_parse.c" + case 120: +#line 488 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_linestring_new(NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2632 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 121: /* triangle: TRIANGLE_TOK EMPTY_TOK */ -#line 496 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_triangle_new(NULL, NULL); WKT_ERROR(); } -#line 2780 "lwin_wkt_parse.c" + case 121: +#line 490 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_linestring_new(NULL, NULL); WKT_ERROR(); } +#line 2638 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 122: /* triangle_untagged: LBRACKET_TOK LBRACKET_TOK ptarray RBRACKET_TOK RBRACKET_TOK */ -#line 500 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_triangle_new((yyvsp[-2].ptarrayvalue), NULL); WKT_ERROR(); } -#line 2786 "lwin_wkt_parse.c" + case 122: +#line 494 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_linestring_new((yyvsp[-1].ptarrayvalue), NULL); WKT_ERROR(); } +#line 2644 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 123: /* multipoint: MPOINT_TOK LBRACKET_TOK point_list RBRACKET_TOK */ -#line 504 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOINTTYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } -#line 2792 "lwin_wkt_parse.c" + case 123: +#line 496 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_linestring_new(NULL, NULL); WKT_ERROR(); } +#line 2650 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 124: /* multipoint: MPOINT_TOK DIMENSIONALITY_TOK LBRACKET_TOK point_list RBRACKET_TOK */ -#line 506 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOINTTYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2798 "lwin_wkt_parse.c" + case 124: +#line 500 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2656 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 125: /* multipoint: MPOINT_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 508 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOINTTYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2804 "lwin_wkt_parse.c" + case 125: +#line 502 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2662 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 126: /* multipoint: MPOINT_TOK EMPTY_TOK */ -#line 510 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOINTTYPE, NULL, NULL); WKT_ERROR(); } -#line 2810 "lwin_wkt_parse.c" + case 126: +#line 506 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_triangle_new((yyvsp[-2].ptarrayvalue), NULL); WKT_ERROR(); } +#line 2668 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 127: /* point_list: point_list COMMA_TOK point_untagged */ -#line 514 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2816 "lwin_wkt_parse.c" + case 127: +#line 508 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_triangle_new((yyvsp[-2].ptarrayvalue), (yyvsp[-5].stringvalue)); WKT_ERROR(); } +#line 2674 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 128: /* point_list: point_untagged */ -#line 516 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } -#line 2822 "lwin_wkt_parse.c" + case 128: +#line 510 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_triangle_new(NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2680 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 129: /* point_untagged: coordinate */ -#line 520 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_point_new(wkt_parser_ptarray_new((yyvsp[0].coordinatevalue)),NULL); WKT_ERROR(); } -#line 2828 "lwin_wkt_parse.c" + case 129: +#line 512 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_triangle_new(NULL, NULL); WKT_ERROR(); } +#line 2686 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 130: /* point_untagged: LBRACKET_TOK coordinate RBRACKET_TOK */ -#line 522 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_point_new(wkt_parser_ptarray_new((yyvsp[-1].coordinatevalue)),NULL); WKT_ERROR(); } -#line 2834 "lwin_wkt_parse.c" + case 130: +#line 516 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_triangle_new((yyvsp[-2].ptarrayvalue), NULL); WKT_ERROR(); } +#line 2692 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 131: /* point_untagged: EMPTY_TOK */ -#line 524 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_point_new(NULL, NULL); WKT_ERROR(); } -#line 2840 "lwin_wkt_parse.c" + case 131: +#line 520 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOINTTYPE, (yyvsp[-1].geometryvalue), NULL); WKT_ERROR(); } +#line 2698 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 132: /* point: POINT_TOK LBRACKET_TOK ptarray RBRACKET_TOK */ -#line 528 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_point_new((yyvsp[-1].ptarrayvalue), NULL); WKT_ERROR(); } -#line 2846 "lwin_wkt_parse.c" + case 132: +#line 522 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOINTTYPE, (yyvsp[-1].geometryvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2704 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 133: /* point: POINT_TOK DIMENSIONALITY_TOK LBRACKET_TOK ptarray RBRACKET_TOK */ -#line 530 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_point_new((yyvsp[-1].ptarrayvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } -#line 2852 "lwin_wkt_parse.c" + case 133: +#line 524 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOINTTYPE, NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2710 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 134: /* point: POINT_TOK DIMENSIONALITY_TOK EMPTY_TOK */ -#line 532 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_point_new(NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } -#line 2858 "lwin_wkt_parse.c" + case 134: +#line 526 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_finalize(MULTIPOINTTYPE, NULL, NULL); WKT_ERROR(); } +#line 2716 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 135: /* point: POINT_TOK EMPTY_TOK */ -#line 534 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_point_new(NULL,NULL); WKT_ERROR(); } -#line 2864 "lwin_wkt_parse.c" + case 135: +#line 530 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_add_geom((yyvsp[-2].geometryvalue),(yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2722 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 136: /* ptarray: ptarray COMMA_TOK coordinate */ -#line 538 "lwin_wkt_parse.y" - { (yyval.ptarrayvalue) = wkt_parser_ptarray_add_coord((yyvsp[-2].ptarrayvalue), (yyvsp[0].coordinatevalue)); WKT_ERROR(); } -#line 2870 "lwin_wkt_parse.c" + case 136: +#line 532 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_collection_new((yyvsp[0].geometryvalue)); WKT_ERROR(); } +#line 2728 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 137: /* ptarray: coordinate */ -#line 540 "lwin_wkt_parse.y" - { (yyval.ptarrayvalue) = wkt_parser_ptarray_new((yyvsp[0].coordinatevalue)); WKT_ERROR(); } -#line 2876 "lwin_wkt_parse.c" + case 137: +#line 536 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_point_new(wkt_parser_ptarray_new((yyvsp[0].coordinatevalue)),NULL); WKT_ERROR(); } +#line 2734 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 138: /* coordinate: DOUBLE_TOK DOUBLE_TOK */ -#line 544 "lwin_wkt_parse.y" - { (yyval.coordinatevalue) = wkt_parser_coord_2((yyvsp[-1].doublevalue), (yyvsp[0].doublevalue)); WKT_ERROR(); } -#line 2882 "lwin_wkt_parse.c" + case 138: +#line 538 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_point_new(wkt_parser_ptarray_new((yyvsp[-1].coordinatevalue)),NULL); WKT_ERROR(); } +#line 2740 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 139: /* coordinate: DOUBLE_TOK DOUBLE_TOK DOUBLE_TOK */ -#line 546 "lwin_wkt_parse.y" - { (yyval.coordinatevalue) = wkt_parser_coord_3((yyvsp[-2].doublevalue), (yyvsp[-1].doublevalue), (yyvsp[0].doublevalue)); WKT_ERROR(); } -#line 2888 "lwin_wkt_parse.c" + case 139: +#line 540 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_point_new(NULL, NULL); WKT_ERROR(); } +#line 2746 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 140: /* coordinate: DOUBLE_TOK DOUBLE_TOK DOUBLE_TOK DOUBLE_TOK */ -#line 548 "lwin_wkt_parse.y" - { (yyval.coordinatevalue) = wkt_parser_coord_4((yyvsp[-3].doublevalue), (yyvsp[-2].doublevalue), (yyvsp[-1].doublevalue), (yyvsp[0].doublevalue)); WKT_ERROR(); } -#line 2894 "lwin_wkt_parse.c" + case 140: +#line 544 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_point_new((yyvsp[-1].ptarrayvalue), NULL); WKT_ERROR(); } +#line 2752 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 141: /* ellipse: ELLIPTICALSTRING_TOK LBRACKET_TOK coordinate COMMA_TOK coordinate COMMA_TOK coordinate COMMA_TOK DOUBLE_TOK COMMA_TOK DOUBLE_TOK COMMA_TOK DOUBLE_TOK COMMA_TOK DOUBLE_TOK COMMA_TOK DOUBLE_TOK RBRACKET_TOK */ -#line 551 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_ellipse((yyvsp[-15].coordinatevalue),(yyvsp[-13].coordinatevalue),(yyvsp[-11].coordinatevalue),(yyvsp[-9].doublevalue),(yyvsp[-7].doublevalue),(yyvsp[-5].doublevalue),(yyvsp[-3].doublevalue),(yyvsp[-1].doublevalue),NULL); WKT_ERROR(); } -#line 2900 "lwin_wkt_parse.c" + case 141: +#line 546 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_point_new((yyvsp[-1].ptarrayvalue), (yyvsp[-3].stringvalue)); WKT_ERROR(); } +#line 2758 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; - case 142: /* ellipse: ELLIPTICALSTRING_TOK DIMENSIONALITY_TOK LBRACKET_TOK coordinate COMMA_TOK coordinate COMMA_TOK coordinate COMMA_TOK DOUBLE_TOK COMMA_TOK DOUBLE_TOK COMMA_TOK DOUBLE_TOK COMMA_TOK DOUBLE_TOK COMMA_TOK DOUBLE_TOK RBRACKET_TOK */ -#line 553 "lwin_wkt_parse.y" - { (yyval.geometryvalue) = wkt_parser_ellipse((yyvsp[-15].coordinatevalue),(yyvsp[-13].coordinatevalue),(yyvsp[-11].coordinatevalue),(yyvsp[-9].doublevalue),(yyvsp[-7].doublevalue),(yyvsp[-5].doublevalue),(yyvsp[-3].doublevalue),(yyvsp[-1].doublevalue),(yyvsp[-17].stringvalue)); WKT_ERROR(); } -#line 2906 "lwin_wkt_parse.c" + case 142: +#line 548 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_point_new(NULL, (yyvsp[-1].stringvalue)); WKT_ERROR(); } +#line 2764 "lwin_wkt_parse.c" /* yacc.c:1646 */ break; + case 143: +#line 550 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_point_new(NULL,NULL); WKT_ERROR(); } +#line 2770 "lwin_wkt_parse.c" /* yacc.c:1646 */ + break; -#line 2910 "lwin_wkt_parse.c" + case 144: +#line 554 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.ptarrayvalue) = wkt_parser_ptarray_add_coord((yyvsp[-2].ptarrayvalue), (yyvsp[0].coordinatevalue)); WKT_ERROR(); } +#line 2776 "lwin_wkt_parse.c" /* yacc.c:1646 */ + break; + case 145: +#line 556 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.ptarrayvalue) = wkt_parser_ptarray_new((yyvsp[0].coordinatevalue)); WKT_ERROR(); } +#line 2782 "lwin_wkt_parse.c" /* yacc.c:1646 */ + break; + + case 146: +#line 560 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.coordinatevalue) = wkt_parser_coord_2((yyvsp[-1].doublevalue), (yyvsp[0].doublevalue)); WKT_ERROR(); } +#line 2788 "lwin_wkt_parse.c" /* yacc.c:1646 */ + break; + + case 147: +#line 562 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.coordinatevalue) = wkt_parser_coord_3((yyvsp[-2].doublevalue), (yyvsp[-1].doublevalue), (yyvsp[0].doublevalue)); WKT_ERROR(); } +#line 2794 "lwin_wkt_parse.c" /* yacc.c:1646 */ + break; + + case 148: +#line 564 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.coordinatevalue) = wkt_parser_coord_4((yyvsp[-3].doublevalue), (yyvsp[-2].doublevalue), (yyvsp[-1].doublevalue), (yyvsp[0].doublevalue)); WKT_ERROR(); } +#line 2800 "lwin_wkt_parse.c" /* yacc.c:1646 */ + break; + + case 149: +#line 567 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_ellipse((yyvsp[-15].coordinatevalue),(yyvsp[-13].coordinatevalue),(yyvsp[-11].coordinatevalue),(yyvsp[-9].doublevalue),(yyvsp[-7].doublevalue),(yyvsp[-5].doublevalue),(yyvsp[-3].doublevalue),(yyvsp[-1].doublevalue),NULL); WKT_ERROR(); } +#line 2806 "lwin_wkt_parse.c" /* yacc.c:1646 */ + break; + + case 150: +#line 569 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parser_ellipse((yyvsp[-15].coordinatevalue),(yyvsp[-13].coordinatevalue),(yyvsp[-11].coordinatevalue),(yyvsp[-9].doublevalue),(yyvsp[-7].doublevalue),(yyvsp[-5].doublevalue),(yyvsp[-3].doublevalue),(yyvsp[-1].doublevalue),(yyvsp[-17].stringvalue)); WKT_ERROR(); } +#line 2812 "lwin_wkt_parse.c" /* yacc.c:1646 */ + break; + + case 151: +#line 574 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parse_bezier3((yyvsp[-7].coordinatevalue), (yyvsp[-5].coordinatevalue), (yyvsp[-3].coordinatevalue), (yyvsp[-1].coordinatevalue), NULL); WKT_ERROR(); } +#line 2818 "lwin_wkt_parse.c" /* yacc.c:1646 */ + break; + + case 152: +#line 576 "lwin_wkt_parse.y" /* yacc.c:1646 */ + { (yyval.geometryvalue) = wkt_parse_bezier3((yyvsp[-7].coordinatevalue), (yyvsp[-5].coordinatevalue), (yyvsp[-3].coordinatevalue), (yyvsp[-1].coordinatevalue), (yyvsp[-9].stringvalue)); WKT_ERROR(); } +#line 2824 "lwin_wkt_parse.c" /* yacc.c:1646 */ + break; + + +#line 2828 "lwin_wkt_parse.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2921,10 +2838,11 @@ yyreduce: case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; + YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; *++yylsp = yyloc; @@ -2932,13 +2850,14 @@ yyreduce: /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - { - const int yylhs = yyr1[yyn] - YYNTOKENS; - const int yyi = yypgoto[yylhs] + *yyssp; - yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp - ? yytable[yyi] - : yydefgoto[yylhs]); - } + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; @@ -2949,45 +2868,50 @@ yyreduce: yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - yypcontext_t yyctx - = {yyssp, yytoken, &yylloc}; char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; - yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); + yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; - else if (yysyntax_error_status == -1) + else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - yymsg = YY_CAST (char *, - YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); - if (yymsg) + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) { - yysyntax_error_status - = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); - yymsgp = yymsg; + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; } else { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = YYENOMEM; + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; } } yyerror (yymsgp); - if (yysyntax_error_status == YYENOMEM) - YYNOMEM; + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR +#endif } yyerror_range[1] = yylloc; + if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an @@ -3016,12 +2940,14 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - /* Pacify compilers when the user code never invokes YYERROR and the - label yyerrorlab therefore never appears in user code. */ - if (0) - YYERROR; - ++yynerrs; + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + yyerror_range[1] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); @@ -3037,14 +2963,13 @@ yyerrorlab: yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ - /* Pop stack until we find a state that shifts the error token. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { - yyn += YYSYMBOL_YYerror; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) @@ -3058,7 +2983,7 @@ yyerrlab1: yyerror_range[1] = *yylsp; yydestruct ("Error: popping", - YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp); + yystos[yystate], yyvsp, yylsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -3069,11 +2994,13 @@ yyerrlab1: YY_IGNORE_MAYBE_UNINITIALIZED_END yyerror_range[2] = yylloc; - ++yylsp; - YYLLOC_DEFAULT (*yylsp, yyerror_range, 2); + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); + *++yylsp = yyloc; /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -3084,30 +3011,26 @@ yyerrlab1: `-------------------------------------*/ yyacceptlab: yyresult = 0; - goto yyreturnlab; - + goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; - goto yyreturnlab; + goto yyreturn; - -/*-----------------------------------------------------------. -| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | -`-----------------------------------------------------------*/ +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; - goto yyreturnlab; - + /* Fall through. */ +#endif -/*----------------------------------------------------------. -| yyreturnlab -- parsing is finished, clean up and return. | -`----------------------------------------------------------*/ -yyreturnlab: +yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at @@ -3123,18 +3046,19 @@ yyreturnlab: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp); + yystos[*yyssp], yyvsp, yylsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif +#if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); +#endif return yyresult; } - -#line 555 "lwin_wkt_parse.y" +#line 578 "lwin_wkt_parse.y" /* yacc.c:1906 */ diff --git a/liblwgeom/lwin_wkt_parse.h b/liblwgeom/lwin_wkt_parse.h index a270b1ef937cb7fd69e604165a942e8753f6fc5e..c9008432f095ba3abe686004993ae4a7a0faeae9 100644 --- a/liblwgeom/lwin_wkt_parse.h +++ b/liblwgeom/lwin_wkt_parse.h @@ -1,9 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.8.2. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, - Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -31,10 +30,6 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, - especially those whose name start with YY_ or yy_. They are - private implementation details that can be changed or removed. */ - #ifndef YY_WKT_YY_LWIN_WKT_PARSE_H_INCLUDED # define YY_WKT_YY_LWIN_WKT_PARSE_H_INCLUDED /* Debug traces. */ @@ -45,48 +40,45 @@ extern int wkt_yydebug; #endif -/* Token kinds. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { - YYEMPTY = -2, - YYEOF = 0, /* "end of file" */ - YYerror = 256, /* error */ - YYUNDEF = 257, /* "invalid token" */ - POINT_TOK = 258, /* POINT_TOK */ - LINESTRING_TOK = 259, /* LINESTRING_TOK */ - POLYGON_TOK = 260, /* POLYGON_TOK */ - MPOINT_TOK = 261, /* MPOINT_TOK */ - MLINESTRING_TOK = 262, /* MLINESTRING_TOK */ - MPOLYGON_TOK = 263, /* MPOLYGON_TOK */ - MSURFACE_TOK = 264, /* MSURFACE_TOK */ - MCURVE_TOK = 265, /* MCURVE_TOK */ - CURVEPOLYGON_TOK = 266, /* CURVEPOLYGON_TOK */ - COMPOUNDCURVE_TOK = 267, /* COMPOUNDCURVE_TOK */ - CIRCULARSTRING_TOK = 268, /* CIRCULARSTRING_TOK */ - COLLECTION_TOK = 269, /* COLLECTION_TOK */ - RBRACKET_TOK = 270, /* RBRACKET_TOK */ - LBRACKET_TOK = 271, /* LBRACKET_TOK */ - COMMA_TOK = 272, /* COMMA_TOK */ - EMPTY_TOK = 273, /* EMPTY_TOK */ - SEMICOLON_TOK = 274, /* SEMICOLON_TOK */ - TRIANGLE_TOK = 275, /* TRIANGLE_TOK */ - TIN_TOK = 276, /* TIN_TOK */ - POLYHEDRALSURFACE_TOK = 277, /* POLYHEDRALSURFACE_TOK */ - ELLIPTICALSTRING_TOK = 278, /* ELLIPTICALSTRING_TOK */ - DOUBLE_TOK = 279, /* DOUBLE_TOK */ - DIMENSIONALITY_TOK = 280, /* DIMENSIONALITY_TOK */ - SRID_TOK = 281 /* SRID_TOK */ + POINT_TOK = 258, + LINESTRING_TOK = 259, + POLYGON_TOK = 260, + MPOINT_TOK = 261, + MLINESTRING_TOK = 262, + MPOLYGON_TOK = 263, + MSURFACE_TOK = 264, + MCURVE_TOK = 265, + CURVEPOLYGON_TOK = 266, + COMPOUNDCURVE_TOK = 267, + CIRCULARSTRING_TOK = 268, + COLLECTION_TOK = 269, + RBRACKET_TOK = 270, + LBRACKET_TOK = 271, + COMMA_TOK = 272, + EMPTY_TOK = 273, + SEMICOLON_TOK = 274, + TRIANGLE_TOK = 275, + TIN_TOK = 276, + POLYHEDRALSURFACE_TOK = 277, + ELLIPTICALSTRING_TOK = 278, + BEZIER_TOK = 279, + DOUBLE_TOK = 280, + DIMENSIONALITY_TOK = 281, + SRID_TOK = 282 }; - typedef enum yytokentype yytoken_kind_t; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + union YYSTYPE { -#line 112 "lwin_wkt_parse.y" +#line 112 "lwin_wkt_parse.y" /* yacc.c:1909 */ int integervalue; double doublevalue; @@ -95,9 +87,9 @@ union YYSTYPE POINT coordinatevalue; POINTARRAY *ptarrayvalue; -#line 99 "lwin_wkt_parse.h" - +#line 91 "lwin_wkt_parse.h" /* yacc.c:1909 */ }; + typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -120,8 +112,6 @@ struct YYLTYPE extern YYSTYPE wkt_yylval; extern YYLTYPE wkt_yylloc; - int wkt_yyparse (void); - #endif /* !YY_WKT_YY_LWIN_WKT_PARSE_H_INCLUDED */ diff --git a/liblwgeom/lwin_wkt_parse.y b/liblwgeom/lwin_wkt_parse.y index 88cb6529dc98a21db301400db90f831cf3c00ca9..414bb19b0695b18e564dc79ce39064d0a596e387 100644 --- a/liblwgeom/lwin_wkt_parse.y +++ b/liblwgeom/lwin_wkt_parse.y @@ -127,6 +127,7 @@ int lwgeom_parse_wkt(LWGEOM_PARSER_RESULT *parser_result, char *wktstr, int pars %token TRIANGLE_TOK TIN_TOK %token POLYHEDRALSURFACE_TOK %token ELLIPTICALSTRING_TOK +%token BEZIER_TOK %token DOUBLE_TOK %token DIMENSIONALITY_TOK @@ -172,6 +173,7 @@ int lwgeom_parse_wkt(LWGEOM_PARSER_RESULT *parser_result, char *wktstr, int pars %type triangle_list %type triangle_untagged %type ellipse +%type bezier /* These clean up memory on errors and parser aborts. */ @@ -237,7 +239,8 @@ geometry_no_srid : polyhedralsurface { $$ = $1; } | triangle { $$ = $1; } | geometrycollection { $$ = $1; } | - ellipse { $$ = $1; }; + ellipse { $$ = $1; }; | + bezier { $$ = $1; }; geometrycollection : COLLECTION_TOK LBRACKET_TOK geometry_list RBRACKET_TOK @@ -361,7 +364,8 @@ curvering : linestring { $$ = $1; } | compoundcurve { $$ = $1; } | circularstring { $$ = $1; } | - ellipse { $$ = $1; } ;; + ellipse { $$ = $1; } | + bezier { $$ = $1; }; patchring_list : patchring_list COMMA_TOK patchring @@ -400,6 +404,8 @@ compound_list : { $$ = wkt_parser_compound_add_geom($1,$3); WKT_ERROR(); } | compound_list COMMA_TOK ellipse { $$ = wkt_parser_compound_add_geom($1,$3); WKT_ERROR(); } | + compound_list COMMA_TOK bezier + { $$ = wkt_parser_compound_add_geom($1,$3); WKT_ERROR(); } | circularstring { $$ = wkt_parser_compound_new($1); WKT_ERROR(); } | linestring @@ -407,7 +413,9 @@ compound_list : linestring_untagged { $$ = wkt_parser_compound_new($1); WKT_ERROR(); } | ellipse - { $$ = wkt_parser_compound_new($1); WKT_ERROR(); } ; + { $$ = wkt_parser_compound_new($1); WKT_ERROR(); } | + bezier + { $$ = wkt_parser_compound_new($1); WKT_ERROR(); }; multicurve : MCURVE_TOK LBRACKET_TOK curve_list RBRACKET_TOK @@ -428,12 +436,20 @@ curve_list : { $$ = wkt_parser_collection_add_geom($1,$3); WKT_ERROR(); } | curve_list COMMA_TOK linestring_untagged { $$ = wkt_parser_collection_add_geom($1,$3); WKT_ERROR(); } | + curve_list COMMA_TOK ellipse + { $$ = wkt_parser_collection_add_geom($1,$3); WKT_ERROR(); } | + curve_list COMMA_TOK bezier + { $$ = wkt_parser_collection_add_geom($1,$3); WKT_ERROR(); } | circularstring { $$ = wkt_parser_collection_new($1); WKT_ERROR(); } | compoundcurve { $$ = wkt_parser_collection_new($1); WKT_ERROR(); } | linestring { $$ = wkt_parser_collection_new($1); WKT_ERROR(); } | + ellipse + { $$ = wkt_parser_collection_new($1); WKT_ERROR(); } | + bezier + { $$ = wkt_parser_collection_new($1); WKT_ERROR(); } | linestring_untagged { $$ = wkt_parser_collection_new($1); WKT_ERROR(); } ; @@ -552,5 +568,12 @@ ellipse : ELLIPTICALSTRING_TOK DIMENSIONALITY_TOK LBRACKET_TOK coordinate COMMA_TOK coordinate COMMA_TOK coordinate COMMA_TOK DOUBLE_TOK COMMA_TOK DOUBLE_TOK COMMA_TOK DOUBLE_TOK COMMA_TOK DOUBLE_TOK COMMA_TOK DOUBLE_TOK RBRACKET_TOK { $$ = wkt_parser_ellipse($4,$6,$8,$10,$12,$14,$16,$18,$2); WKT_ERROR(); } ; +bezier : + // 三阶贝塞尔曲线 + BEZIER_TOK LBRACKET_TOK coordinate COMMA_TOK coordinate COMMA_TOK coordinate COMMA_TOK coordinate RBRACKET_TOK + { $$ = wkt_parse_bezier3($3, $5, $7, $9, NULL); WKT_ERROR(); } | + BEZIER_TOK DIMENSIONALITY_TOK LBRACKET_TOK coordinate COMMA_TOK coordinate COMMA_TOK coordinate COMMA_TOK coordinate RBRACKET_TOK + { $$ = wkt_parse_bezier3($4, $6, $8, $10, $2); WKT_ERROR(); } ; + %% diff --git a/liblwgeom/lwout_wkb.c b/liblwgeom/lwout_wkb.c index 4b8aede93e824a3972f8ee53019eff18b7d04f2c..ef1c3736edf3cd12c98c6a9d9d38fb7e81be4c3a 100644 --- a/liblwgeom/lwout_wkb.c +++ b/liblwgeom/lwout_wkb.c @@ -134,6 +134,9 @@ static uint32_t lwgeom_wkb_type(const LWGEOM *geom, uint8_t variant) case ELLIPSETYPE: wkb_type = WKB_ELLIPSE_TYPE; break; + case BEZIERTYPE: + wkb_type = WKB_BEZIER_TYPE; + break; default: lwerror("%s: Unsupported geometry type: %s", __func__, lwtype_name(geom->type)); } @@ -692,6 +695,24 @@ static size_t lwellipse_to_wkb_size(const LWELLIPSE *e, uint8_t variant) return size; } +/* + BEZIER +*/ +static size_t lwbezier_to_wkb_size(const LWBEZIER *bezier, uint8_t variant) +{ + /* endian flag + type number */ + size_t size = WKB_BYTE_SIZE + WKB_INT_SIZE; + + /* Extended WKB needs space for optional SRID integer */ + if (lwgeom_wkb_needs_srid((LWGEOM *)bezier, variant)) + size += WKB_INT_SIZE; + + /* control points */ + size += ptarray_to_wkb_size(bezier->data->points, variant); + + return size; +} + static uint8_t* lwellipse_to_wkb_buf(const LWELLIPSE *e, uint8_t *buf, uint8_t variant) { /* Set the endian flag */ @@ -720,6 +741,32 @@ static uint8_t* lwellipse_to_wkb_buf(const LWELLIPSE *e, uint8_t *buf, uint8_t v return buf; } +/* + BEZIER +*/ +static uint8_t* lwbezier_to_wkb_buf(const LWBEZIER *bezier, uint8_t *buf, uint8_t variant) +{ + /* Set the endian flag */ + LWDEBUGF(4, "Entering function, buf = %p", buf); + buf = endian_to_wkb_buf(buf, variant); + LWDEBUGF(4, "Endian set, buf = %p", buf); + /* Set the geometry type */ + buf = integer_to_wkb_buf(lwgeom_wkb_type((LWGEOM*)bezier, variant), buf, variant); + LWDEBUGF(4, "Type set, buf = %p", buf); + + /* Set the optional SRID for extended variant */ + if ( lwgeom_wkb_needs_srid((LWGEOM*)bezier, variant) ) + { + buf = integer_to_wkb_buf(bezier->srid, buf, variant); + LWDEBUGF(4, "SRID set, buf = %p", buf); + } + + /* control points */ + buf = ptarray_to_wkb_buf(bezier->data->points, buf, variant); + + return buf; +} + /* * GEOMETRY */ @@ -765,7 +812,9 @@ lwgeom_to_wkb_size(const LWGEOM *geom, uint8_t variant) case ELLIPSETYPE: size += lwellipse_to_wkb_size((LWELLIPSE*)geom, variant); break; - + case BEZIERTYPE: + size += lwbezier_to_wkb_size((LWBEZIER*)geom, variant); + break; /* All these Collection types have ngeoms and geoms elements */ case MULTIPOINTTYPE: case MULTILINETYPE: @@ -816,7 +865,8 @@ static uint8_t* lwgeom_to_wkb_buf(const LWGEOM *geom, uint8_t *buf, uint8_t vari return lwtriangle_to_wkb_buf((LWTRIANGLE*)geom, buf, variant); case ELLIPSETYPE: return lwellipse_to_wkb_buf((LWELLIPSE*)geom, buf, variant); - + case BEZIERTYPE: + return lwbezier_to_wkb_buf((LWBEZIER*)geom, buf, variant); /* All these Collection types have 'ngeoms' and 'geoms' elements */ case MULTIPOINTTYPE: case MULTILINETYPE: diff --git a/liblwgeom/lwout_wkt.c b/liblwgeom/lwout_wkt.c index eaa78830f8f4fb3077891e04428ef6dcddb25a83..1277f8167aba274c2fe3be92b55eb57a6870295c 100644 --- a/liblwgeom/lwout_wkt.c +++ b/liblwgeom/lwout_wkt.c @@ -306,6 +306,22 @@ static void lwellipse_to_wkt_sb(const LWELLIPSE *ellipse, stringbuffer_t *sb, in stringbuffer_append_len(sb, ")", 1); } +/* + * BEZIER + */ +static void +lwbezier_to_wkt_sb(const LWBEZIER *bezier, stringbuffer_t *sb, int precision, uint8_t variant) +{ + if (!(variant & WKT_NO_TYPE)) + { + stringbuffer_append_len(sb, "BEZIER3CURVE", 12); + dimension_qualifiers_to_wkt_sb((LWGEOM *)bezier, sb, variant); + } + stringbuffer_append_len(sb, "(", 1); + ptarray_to_wkt_sb(bezier->data->points, sb, precision, variant | WKT_NO_PARENS); + stringbuffer_append_len(sb, ")", 1); +} + /* * MULTIPOLYGON */ @@ -373,10 +389,14 @@ static void lwcompound_to_wkt_sb(const LWCOMPOUND *comp, stringbuffer_t *sb, int { lwcircstring_to_wkt_sb((LWCIRCSTRING*)comp->geoms[i], sb, precision, variant ); } - else if (type == ELLIPSETYPE) + else if ( type == ELLIPSETYPE ) { lwellipse_to_wkt_sb((LWELLIPSE *)comp->geoms[i], sb, precision, variant); } + else if ( type == BEZIERTYPE ) + { + lwbezier_to_wkt_sb((LWBEZIER *)comp->geoms[i], sb, precision, variant); + } else { lwerror("lwcompound_to_wkt_sb: Unknown type received %d - %s", type, lwtype_name(type)); @@ -429,6 +449,10 @@ static void lwcurvepoly_to_wkt_sb(const LWCURVEPOLY *cpoly, stringbuffer_t *sb, /* And ellipse subgeoms *do* get type identifiers */ lwellipse_to_wkt_sb((LWELLIPSE*)cpoly->rings[i], sb, precision, variant ); break; + case BEZIERTYPE: + /* And bezier subgeoms *do* get type identifiers */ + lwbezier_to_wkt_sb((LWBEZIER*)cpoly->rings[i], sb, precision, variant ); + break; default: lwerror("lwcurvepoly_to_wkt_sb: Unknown type received %d - %s", type, lwtype_name(type)); } @@ -477,6 +501,12 @@ static void lwmcurve_to_wkt_sb(const LWMCURVE *mcurv, stringbuffer_t *sb, int pr /* And compoundcurve subgeoms *do* get type identifiers */ lwcompound_to_wkt_sb((LWCOMPOUND*)mcurv->geoms[i], sb, precision, variant ); break; + case ELLIPSETYPE: + lwellipse_to_wkt_sb((LWELLIPSE*)mcurv->geoms[i], sb, precision, variant); + break; + case BEZIERTYPE: + lwbezier_to_wkt_sb((LWBEZIER*)mcurv->geoms[i], sb, precision, variant); + break; default: lwerror("lwmcurve_to_wkt_sb: Unknown type received %d - %s", type, lwtype_name(type)); } @@ -671,6 +701,9 @@ static void lwgeom_to_wkt_sb(const LWGEOM *geom, stringbuffer_t *sb, int precisi case ELLIPSETYPE: lwellipse_to_wkt_sb((LWELLIPSE*)geom, sb, precision, variant); break; + case BEZIERTYPE: + lwbezier_to_wkt_sb((LWBEZIER*)geom, sb, precision, variant); + break; case COLLECTIONTYPE: lwcollection_to_wkt_sb((LWCOLLECTION*)geom, sb, precision, variant); break; diff --git a/liblwgeom/lwstroke.c b/liblwgeom/lwstroke.c index 870bb69ba6231350e2b818c640999213df37a3a7..854f71b1e7323b486a70059bcbb74e9cbc7ada1b 100644 --- a/liblwgeom/lwstroke.c +++ b/liblwgeom/lwstroke.c @@ -617,10 +617,19 @@ lwcompound_linearize(const LWCOMPOUND *icompound, double tol, ptarray_append_point(ptarray, &p, LW_TRUE); } } - else if(geom->type == ELLIPSETYPE) + else if (geom->type == ELLIPSETYPE) { - //convert ellipsearc to linestring - tmp = lwellipse_get_spatialdata((LWELLIPSE*)geom,72); + // convert ellipsearc to linestring + tmp = lwellipse_get_spatialdata((LWELLIPSE *)geom, 72); + for (j = 0; j < tmp->points->npoints; j++) + { + getPoint4d_p(tmp->points, j, &p); + ptarray_append_point(ptarray, &p, LW_TRUE); + } + } + else if (geom->type == BEZIERTYPE) + { + tmp = lwbezier_linearize((LWBEZIER*)geom,72); for (j = 0; j < tmp->points->npoints; j++) { getPoint4d_p(tmp->points, j, &p); @@ -688,6 +697,12 @@ lwcurvepoly_linearize(const LWCURVEPOLY *curvepoly, double tol, ptarray[i] = ptarray_clone_deep(line->points); lwline_free(line); } + else if (tmp->type == BEZIERTYPE) + { + line = lwbezier_linearize((LWBEZIER *)tmp, 72); + ptarray[i] = ptarray_clone_deep(line->points); + lwline_free(line); + } else { lwerror("Invalid ring type found in CurvePoly."); @@ -743,6 +758,14 @@ lwmcurve_linearize(const LWMCURVE *mcurve, double tol, { lines[i] = (LWGEOM *)lwcompound_linearize((LWCOMPOUND *)tmp, tol, type, flags); } + else if (tmp->type == ELLIPSETYPE) + { + lines[i] = (LWGEOM *)lwellipse_get_spatialdata((LWELLIPSE *)tmp, tol); + } + else if (tmp->type == BEZIERTYPE) + { + lines[i] = (LWGEOM *)lwbezier_linearize((LWBEZIER *)tmp, tol); + } else { lwerror("Unsupported geometry found in MultiCurve."); @@ -879,6 +902,9 @@ lwcurve_linearize(const LWGEOM *geom, double tol, case ELLIPSETYPE: ogeom = (LWGEOM *)lwellipse_get_spatialdata((LWELLIPSE *)geom, 72); break; + case BEZIERTYPE: + ogeom = (LWGEOM *)lwbezier_linearize((LWBEZIER *)geom, 72); + break; default: ogeom = lwgeom_clone_deep(geom); } diff --git a/liblwgeom/lwutil.c b/liblwgeom/lwutil.c index 908f2329a58d2db0347f5edbbfa6750af97ac4c3..94f351542b1ae31b7114991170b573659ab76480 100644 --- a/liblwgeom/lwutil.c +++ b/liblwgeom/lwutil.c @@ -75,7 +75,8 @@ static char *lwgeomTypeName[] = "PolyhedralSurface", "Triangle", "Tin", - "EllipticalString" + "EllipticalString", + "Bezier3Curve" }; /* @@ -216,7 +217,7 @@ lwdebug(int level, const char *fmt, ...) const char* lwtype_name(uint8_t type) { - if ( type > 16 ) + if ( type > 17 ) { /* assert(0); */ return "Invalid type"; @@ -370,6 +371,11 @@ struct geomtype_struct struct geomtype_struct geomtype_struct_array[] = { + { "BEZIER3CURVEZM", BEZIERTYPE, 1, 1 }, + { "BEZIER3CURVEZ", BEZIERTYPE, 1, 0 }, + { "BEZIER3CURVEM", BEZIERTYPE, 0, 1 }, + { "BEZIER3CURVE", BEZIERTYPE, 0, 0 }, + { "ELLIPTICALSTRINGZM", ELLIPSETYPE, 1, 1 }, { "ELLIPTICALSTRINGZ", ELLIPSETYPE, 1, 0 }, { "ELLIPTICALSTRINGM", ELLIPSETYPE, 0, 1 }, diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c index 9fb872fd9f0a374cbcea4937c7d68f4cd9d4c8cf..a95fc55e142fdc5d6422b0a3e1079fa386d668d3 100644 --- a/postgis/lwgeom_functions_basic.c +++ b/postgis/lwgeom_functions_basic.c @@ -295,7 +295,11 @@ Datum ST_AreaParam(PG_FUNCTION_ARGS) double area = 0.0; LWCURVEPOLY *curvepoly = NULL; LWGEOM *tmp = NULL; - POINT2D pntAnchar = {0, 0}; + POINT2D pntAnchar; + GBOX box; + lwgeom_calculate_gbox(lwgeom, &box); + pntAnchar.x = box.xmin; + pntAnchar.y = box.ymin; if (lwgeom->type != CURVEPOLYTYPE) { @@ -355,6 +359,11 @@ Datum ST_AreaParam(PG_FUNCTION_ARGS) { area += lwsector_elliptic_arc_area((LWELLIPSE *)comptmp, pntAnchar); } + else if (comptmp->type == BEZIERTYPE) + { + const LWBEZIER *ber = (const LWBEZIER *)comptmp; + area -= lwbezier_area(ber, &pntAnchar); + } } } else if (tmp->type == ELLIPSETYPE) // 一个完整的椭圆 diff --git a/postgis/lwgeom_ogc.c b/postgis/lwgeom_ogc.c index f319faf5aaa24200d896c57e8bd7d122b2b15a58..d4d3ecb81f28619595e808ddb7c81fde1440f08c 100644 --- a/postgis/lwgeom_ogc.c +++ b/postgis/lwgeom_ogc.c @@ -190,7 +190,8 @@ static char *stTypeName[] = {"Unknown", "ST_PolyhedralSurface", "ST_Triangle", "ST_Tin", - "ST_ELLIPTICALSTRING"}; + "ST_ELLIPTICALSTRING", + "ST_BEZIER3CURVE"}; /* returns a string representation of this geometry's type */ PG_FUNCTION_INFO_V1(geometry_geometrytype); diff --git a/pyramid/Makefile.in b/pyramid/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..ea2766263aebb2dc94f6c3559f3b60fe5b9aee13 --- /dev/null +++ b/pyramid/Makefile.in @@ -0,0 +1,34 @@ +# pyramid extension makefile.in +PYRAMID_MAJRO_VERSION=1 +PYRAMID_MINOR_VERSION=0 + + +EXTENSION = yukon_vector_pyramid # the extensions name +MODULE_big = yukon_vector_pyramid-$(PYRAMID_MAJRO_VERSION).$(PYRAMID_MINOR_VERSION) + +DATA = yukon_vector_pyramid--1.0.sql # script files to install + +COMPILE_TIME = $(shell date +"%Y-%m-%d %H:%M:%S") +GIT_REVISION = $(shell git show -s --pretty=format:%h) + +PYRAMID_OBJS= \ + pyramid.o \ + util.o + +OBJS=$(PYRAMID_OBJS) + + +override CFLAGS := -fpermissive +PG_CPPFLAGS += -std=c++11 -g -O2 $(CFLAGS) @CPPFLAGS@ @LIBGDAL_CFLAGS@ -DCOMPILEINFO="\" Compiled at: $(COMPILE_TIME)\"""\" Commit ID:$(GIT_REVISION) \"" + +#librtcore.a 的位置要放在 liblwgeom.a 的前面(librtcore.a 依赖于 liblwgeom.a),否则会造成有些函数无法链接到动态库 +SHLIB_LINK = @SHLIB_LINK@ -lstdc++ + +# postgres build stuff +PG_CONFIG := @PG_CONFIG@ +PGXS := $(shell $(PG_CONFIG) --pgxs) + +include $(PGXS) + +distclean: clean + rm -f Makefile \ No newline at end of file diff --git a/pyramid/pyramid.cpp b/pyramid/pyramid.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b5b690860a4d5fa0c5498bae71f42619585d2a00 --- /dev/null +++ b/pyramid/pyramid.cpp @@ -0,0 +1,1994 @@ +/* + * + * pyramid.cpp + * + * Copyright (C) 2023 SuperMap Software Co., Ltd. + * + * Yukon is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see . * + */ +#include "util.h" +#include +#include +#include +#include +#include +#include + +using namespace std::chrono; + +extern "C" { +#include "postgres.h" +#include "fmgr.h" +#include "utils/palloc.h" +#include "lib/stringinfo.h" /* For binary input */ +#include "utils/array.h" /* for ArrayType */ +#include "utils/builtins.h" /* for pg_atoi */ +#include "catalog/pg_type.h" /* for all oid */ +#include "executor/spi.h" /* for spi */ + +PG_MODULE_MAGIC; + +PG_FUNCTION_INFO_V1(yukon_pyramid_version); +Datum yukon_pyramid_version(PG_FUNCTION_ARGS); +PG_FUNCTION_INFO_V1(buildpyramid); +Datum buildpyramid(PG_FUNCTION_ARGS); +PG_FUNCTION_INFO_V1(buildTile); +Datum buildTile(PG_FUNCTION_ARGS); +PG_FUNCTION_INFO_V1(updatePyramid); +Datum updatePyramid(PG_FUNCTION_ARGS); +} + +#define YUKON_PYRAMID_VERSION "yukon_pyramid 1.0.0" +#define QUERYSIZE 4096 + + +// 这里我们直接将定义包含在这里,不用包含 liblwgeom.h 头文件 +typedef struct { + uint16_t flags; + double xmin; + double xmax; + double ymin; + double ymax; + double zmin; + double zmax; + double mmin; + double mmax; +} GBOX; + +static bool +isTouch(GBOX *gbox, Tile t) +{ + if ((gbox->xmax > t.minx && t.maxx > gbox->xmin) && (gbox->ymax > t.miny && t.maxy > gbox->ymin)) + { + return true; + } + return false; +} + +/** + * 从 'BOX(115.375 39.416670000654165,117.49999999999999 41.08333000065866)' 字符串中找到 x,y 的最大最小值 + */ +static void +getextent(const char *str, double extent[]) +{ + Assert(str); + Assert(xmin); + Assert(ymin); + Assert(xmax); + Assert(ymax); + + char *temp = static_cast(palloc0(strlen(str) - 1)); + memcpy(temp, str + 4, strlen(str) - 5); + char *pos[4] = {0}; + pos[0] = temp; + for (int i = 0, j = 1; temp[i] != 0; i++) + { + if (temp[i] == ' ' || temp[i] == ',') + { + temp[i] = 0; + pos[j++] = temp + i + 1; + } + } + + for (int i = 0; i < 4; i++) + { + extent[i] = atof(pos[i]); + } + + pfree(temp); +} + +Datum +yukon_pyramid_version(PG_FUNCTION_ARGS) +{ + char src[100] = {0}; + const char *ver = YUKON_PYRAMID_VERSION; + const char *compileinfo = COMPILEINFO; + strcat(src, ver); + strcat(src, compileinfo); + text *result = cstring_to_text(src); + PG_RETURN_TEXT_P(result); +} + +Datum +// ST_BuildPyramid(tablename text, columnname text, config text) +buildpyramid(PG_FUNCTION_ARGS) +{ + int ret = 0; // SPI_execute 返回的结果 + int tuplecount = 0; + int srid = 0; + double dbbox[4] = {0}; + std::vector table_field; + std::ostringstream sql_buffer; + sql_buffer << std::setprecision(15); + std::string geomtype; + // 1. 参数校验 + + if (PG_ARGISNULL(0) || PG_ARGISNULL(1) || PG_ARGISNULL(2)) + { + PG_RETURN_BOOL(false); + } + const char *schemaname = text_to_cstring(PG_GETARG_TEXT_P(0)); + const char *tablename = text_to_cstring(PG_GETARG_TEXT_P(1)); + const char *columname = text_to_cstring(PG_GETARG_TEXT_P(2)); + const char *pszconfig = text_to_cstring(PG_GETARG_TEXT_P(3)); + + // 添加表名长度限制,如果太长,则限制生成 + + if ((strlen(tablename) + strlen(columname) > 248)) + { + elog(ERROR, "%s:%s", __FUNCTION__, "table's name or column'name is to long"); + PG_RETURN_BOOL(false); + } + + // 解析配置 + std::string errmsg; + std::vector configres = parseConfig(pszconfig, errmsg); + + // 如果 configres 为空,则报错 + if (configres.size() == 0) + { + // 如果有具体的错误信息,则显示具体的错误信息,否则提示 json 格式错误 + if (errmsg.empty()) + { + elog(ERROR, "%s:Json format is invalid,%s", __FUNCTION__, pszconfig); + } + else + { + elog(ERROR, "%s:%s", __FUNCTION__, errmsg.c_str()); + } + } + + if (SPI_OK_CONNECT != SPI_connect()) + { + elog(NOTICE, "%s: could not connect to SPI manager", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 检查图层是否存在 + char query[QUERYSIZE] = {0}; + snprintf( + query, + QUERYSIZE, + "select count(*) from geometry_columns where f_table_name=\'%s\' and f_geometry_column=\'%s\' and f_table_schema=\'%s\' ", + tablename, + columname, + schemaname); + + ret = SPI_execute(query, true, 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + tuplecount = atoi(tupleval); + pfree(tupleval); + if (tuplecount == 0) + { + elog(ERROR, "%s:%s is not a valid geometry table.", __FUNCTION__, tablename); + } + } + else + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 检查 geometry 类型 + bzero(query, QUERYSIZE); + snprintf(query, + QUERYSIZE, + "SELECT GeometryType(\"%s\") FROM \"%s\".\"%s\" LIMIT 1", + columname, + schemaname, + tablename); + + ret = SPI_execute(query, true, 0); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + if (tuptable->numvals > 0) + { + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + geomtype = std::string(tupleval); + pfree(tupleval); + } + else + { + elog(ERROR, "%s: can not get the geometry type", __FUNCTION__); + } + } + else + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 获取 SRID + snprintf( + query, + QUERYSIZE, + "select srid from geometry_columns where f_table_name=\'%s\' and f_geometry_column=\'%s\' and f_table_schema=\'%s\'", + tablename, + columname, + schemaname); + + ret = SPI_execute(query, true, 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + srid = atoi(tupleval); + pfree(tupleval); + } + else + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + /** + * 检查划分的规则是否合法,包括划分等级,划分方法,要添加的属性字段, + * filter 暂时不做检查,由用户检查 + */ + + bzero(query, QUERYSIZE); + snprintf( + query, + QUERYSIZE, + "SELECT A.attname FROM pg_class AS C, pg_attribute AS A WHERE C.relname = \'%s\' AND C.relnamespace = (select oid from pg_namespace where nspname = \'%s\' ) AND A.attrelid = C.oid ;", + tablename, + schemaname); + + ret = SPI_execute(query, true, 0); + + // 获取该表的所有字段 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + + for (size_t i = 0; i < tuptable->numvals; i++) + { + HeapTuple tuple = tuptable->vals[i]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + table_field.push_back(std::string(tupleval)); + pfree(tupleval); + } + } + else + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 检查配置是否正确 + for (size_t i = 0; i < configres.size(); i++) + { + auto e = configres.at(i); + // gridrule check + if (e.gridrule != "quad" && e.gridrule != "geosot") + { + elog(ERROR, + "%s: gridrule must be quad or geosot \nconfig:%s", + __FUNCTION__, + e.to_string().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // level check + if (e.level < 0 || e.level > MAX_LEVEL) + { + elog(ERROR, "%s: level must be between 0 - 16\nconfig:%s", __FUNCTION__, e.to_string().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // attribute check + for (auto s : e.attribute) + { + auto it = find(table_field.begin(), table_field.end(), s); + + if (it == table_field.end()) + { + elog(ERROR, + "%s:%s is invalid\nconfig:%s", + __FUNCTION__, + s.c_str(), + e.to_string().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + } + } + + // MULTIPOLYGON 或 LINESTRING 数据 + if (geomtype == "MULTIPOLYGON" || geomtype == "POLYGON" || geomtype == "LINESTRING" || + geomtype == "MULTILINESTRING") + { + /** + * 创建存储金字塔的表,这里将每个简化的单独形成一张表 + */ + for (auto e : configres) + { + sql_buffer.str(""); + sql_buffer << "create table \""; + sql_buffer << schemaname; + sql_buffer << "\"" + << ".\"pyd_" << tablename << "_" << columname << "_" << e.level << "\"" + << " as select "; + + // attribute + for (auto attr : e.attribute) + { + sql_buffer << "\"" << attr << "\" ,"; + } + + if (e.resolution == 0.0 && srid == 4326) + { + + e.resolution = e.tolerance = rateconfigs[e.level + 1].resolution; + } + else if (e.resolution == 0.0 && srid == 3857) + { + e.resolution = e.tolerance = rateconfigs[e.level + 1].distance; + } + else if (e.resolution == 0.0) + { + elog(ERROR, "%s:Only supports 4326 and 3857 coordinate systems.", __FUNCTION__); + } + + // 如果 level 大于 10,则使用简化算法,否则使用 snaptogrid 算法 + if (e.level > 10) + { + sql_buffer << "st_simplify(\"" << columname << "\"," << e.tolerance << "," + << e.preserveCollapsed << ") as \"" << columname << "\""; + } + else + { + sql_buffer << "st_snaptogrid(\"" << columname << "\"," << e.tolerance << ") as \"" + << columname << "\""; + } + + // from + sql_buffer << " from " + << "\"" << schemaname << "\"" + << "." + << "\"" << tablename << "\""; + + // filter + if (e.filter != "null") + { + sql_buffer << " where " << e.filter; + } + + bzero(query, QUERYSIZE); + snprintf(query, QUERYSIZE, "%s", sql_buffer.str().c_str()); + + ret = SPI_exec(query, 1); + + if (ret <= 0) + { + elog(ERROR, "%s: SPI_execute error!SQL:%s", __FUNCTION__, query); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 删除 EMPTY 数据 + + sql_buffer.str(""); + sql_buffer << "DELETE FROM \"" << schemaname << "\"" + << ".\"pyd_" << tablename << "_" << columname << "_" << e.level + << "\" WHERE ST_ISEMPTY(\"" << columname << "\")"; + bzero(query, QUERYSIZE); + snprintf(query, QUERYSIZE, "%s", sql_buffer.str().c_str()); + + ret = SPI_exec(query, 1); + + if (ret <= 0) + { + elog(ERROR, "%s: SPI_execute error!SQL:%s", __FUNCTION__, query); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 存储元信息 + sql_buffer.str(""); + sql_buffer + << "insert into pyramid_columns (f_schema_name, f_table_name, f_geometry_column, f_pyramid_table_name, resolution, config) values("; + sql_buffer << "\'" << schemaname << "\'" + << "," + << "\'" << tablename << "\'" + << "," + << "\'" << columname << "\'" + << "," + << "\'" + << "pyd_" << tablename << "_" << columname << "_" << e.level << "\'" + << "," << e.tolerance << "," + << "\'" << e.to_string() << "\'" + << ")"; + bzero(query, QUERYSIZE); + snprintf(query, QUERYSIZE, "%s", sql_buffer.str().c_str()); + ret = SPI_exec(query, 1); + + if (ret <= 0) + { + elog(ERROR, "%s: SPI_execute error!SQL:%s", __FUNCTION__, query); + SPI_finish(); + PG_RETURN_BOOL(false); + } + } + } + // POINT 类型数据 + else if (geomtype == "POINT" || geomtype == "MULTIPOINT") + { + // 获取边界范围 + memset(query, 0, QUERYSIZE); + snprintf(query, QUERYSIZE, "ANALYZE \"%s\".\"%s\"", schemaname, tablename); + ret = SPI_exec(query, 0); + + if (ret <= 0) + { + elog(ERROR, "%s:analyze error!", __FUNCTION__); + } + + memset(query, 0, QUERYSIZE); + snprintf(query, + QUERYSIZE, + "SELECT ST_EstimatedExtent(\'%s\',\'%s\',\'%s\')", + schemaname, + tablename, + columname); + ret = SPI_exec(query, 1); + + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *bbox = SPI_getvalue(tuple, tupdesc, 1); + getextent(bbox, dbbox); + pfree(bbox); + } + else + { + elog(ERROR, "%s: SPI_execute error!SQL:%s", __FUNCTION__, query); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 生成点抽稀表 + for (auto e : configres) + { + + // 计算格子总数 + if (e.resolution == 0.0 && srid == 4326) + { + + e.resolution = e.tolerance = rateconfigs[e.level + 1].resolution; + } + else if (e.resolution == 0.0 && srid == 3857) + { + e.resolution = e.tolerance = rateconfigs[e.level + 1].distance; + } + else if (e.resolution == 0.0) + { + elog(ERROR, "%s:Only supports 4326 and 3857 coordinate systems.", __FUNCTION__); + } + int xbuckets = (int(dbbox[2]) - int(dbbox[0])) / e.resolution; + int ybuckets = (int(dbbox[3]) - int(dbbox[1])) / e.resolution; + + // 这里我们只生成一个临时表 + sql_buffer.str(""); + sql_buffer << "create table \""; + sql_buffer << schemaname; + sql_buffer << "\"" + << ".\"pyd_" << tablename << "_" << columname << "_temp_" << e.level << "\"" + << " as select \"" << columname << "\" from ("; + sql_buffer << "SELECT WIDTH_BUCKET(st_x(" + << "\"" << columname << "\"" + << "), " << int(dbbox[0]) << "," << int(dbbox[2]) + 1 << "," << xbuckets + << ") grid_x," + << "WIDTH_BUCKET(st_y(" + << "\"" << columname << "\"" + << ")," << int(dbbox[1]) << ", " << int(dbbox[3]) + 1 << ", " << ybuckets + << ") grid_y," + << "ST_GeometryN(ST_collect(" + << "\"" << columname << "\"" + << "),1) \"" << columname << "\""; + + // from + sql_buffer << " from " + << "\"" << schemaname << "\"" + << "." + << "\"" << tablename << "\""; + + // filter + if (e.filter != "null") + { + sql_buffer << " where " << e.filter; + } + + sql_buffer << " GROUP BY grid_x,grid_y) as temp"; + + // 执行 SQL + bzero(query, QUERYSIZE); + snprintf(query, QUERYSIZE, "%s", sql_buffer.str().c_str()); + ret = SPI_exec(query, 1); + + if (ret <= 0) + { + elog(ERROR, "%s: SPI_execute error!SQL:%s", __FUNCTION__, query); + SPI_finish(); + PG_RETURN_BOOL(false); + } + // 这里我们将附带的信息加入到概化表中 + + sql_buffer.str(""); + sql_buffer << "create table \""; + sql_buffer << schemaname; + sql_buffer << "\"" + << ".\"pyd_" << tablename << "_" << columname << "_" << e.level << "\"" + << " as select "; + + // attribute + for (auto attr : e.attribute) + { + sql_buffer << "a.\"" << attr << "\" ,"; + } + // geometry + sql_buffer << "a.\"" << columname << "\""; + // from + sql_buffer << " from " + << "\"" << schemaname << "\"" + << "." + << "\"" << tablename << "\" as a," + << "\"" << schemaname; + + sql_buffer << "\"" + << ".\"pyd_" << tablename << "_" << columname << "_temp_" << e.level << "\" as b"; + + sql_buffer << " where a." + << "\"" << columname << "\"" + << "=b." + << "\"" << columname << "\""; + + bzero(query, QUERYSIZE); + snprintf(query, QUERYSIZE, "%s", sql_buffer.str().c_str()); + ret = SPI_exec(query, 1); + + if (ret <= 0) + { + elog(ERROR, "%s: SPI_execute error!SQL:%s", __FUNCTION__, query); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 删除临时表 + sql_buffer.str(""); + sql_buffer << "DROP TABLE IF EXISTS \"" << schemaname << "\"" + << ".\"pyd_" << tablename << "_" << columname << "_temp_" << e.level << "\""; + bzero(query, QUERYSIZE); + snprintf(query, QUERYSIZE, "%s", sql_buffer.str().c_str()); + ret = SPI_exec(query, 1); + + if (ret <= 0) + { + elog(ERROR, "%s: SPI_execute error!SQL:%s", __FUNCTION__, query); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 存储元信息 + sql_buffer.str(""); + sql_buffer + << "insert into pyramid_columns (f_schema_name, f_table_name, f_geometry_column, f_pyramid_table_name, resolution, config) values("; + sql_buffer << "\'" << schemaname << "\'" + << "," + << "\'" << tablename << "\'" + << "," + << "\'" << columname << "\'" + << "," + << "\'" + << "pyd_" << tablename << "_" << columname << "_" << e.level << "\'" + << "," << e.resolution << "," + << "\'" << e.to_string() << "\'" + << ")"; + + bzero(query, QUERYSIZE); + snprintf(query, QUERYSIZE, "%s", sql_buffer.str().c_str()); + ret = SPI_exec(query, 1); + + if (ret <= 0) + { + elog(ERROR, "%s: SPI_execute error!SQL:%s", __FUNCTION__, query); + SPI_finish(); + PG_RETURN_BOOL(false); + } + } + } + else + { + elog(ERROR, "%s: Not Supported Geometry Type:%s", __FUNCTION__, geomtype.c_str()); + } + + SPI_finish(); + PG_RETURN_BOOL(true); +} + +Datum +buildTile(PG_FUNCTION_ARGS) +{ + int ret = 0; + int srid = 0; + char query[QUERYSIZE] = {0}; + if (PG_ARGISNULL(0) || PG_ARGISNULL(1) || PG_ARGISNULL(2)) + { + PG_RETURN_BOOL(false); + } + + const char *schema = text_to_cstring(PG_GETARG_TEXT_P(0)); + const char *table = text_to_cstring(PG_GETARG_TEXT_P(1)); + const char *column = text_to_cstring(PG_GETARG_TEXT_P(2)); + unsigned int max_level = PG_GETARG_INT32(3); + + if (SPI_OK_CONNECT != SPI_connect()) + { + elog(NOTICE, "%s: could not connect to SPI manager", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 检查是否包含 geometry 数据 + snprintf( + query, + QUERYSIZE, + "select count(*) from geometry_columns where f_table_name=\'%s\' and f_geometry_column=\'%s\' and f_table_schema=\'%s\'", + table, + column, + schema); + + ret = SPI_execute(query, true, 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + int tuplecount = atoi(tupleval); + pfree(tupleval); + if (tuplecount == 0) + { + elog(ERROR, "%s:%s is not a valid geometry table.", __FUNCTION__, table); + } + } + else + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 获取 SRID + snprintf( + query, + QUERYSIZE, + "select srid from geometry_columns where f_table_name=\'%s\' and f_geometry_column=\'%s\' and f_table_schema=\'%s\'", + table, + column, + schema); + + ret = SPI_execute(query, true, 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + srid = atoi(tupleval); + pfree(tupleval); + } + else + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 创建矢量瓦片表 + snprintf(query, + QUERYSIZE, + "CREATE TABLE IF NOT EXISTS \"%s\".\"tile_%s_%s\" (id bigint,mvt bytea);", + schema, + table, + column); + ret = SPI_exec(query, 1); + + if (ret != SPI_OK_UTILITY) + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 构建稀疏矩阵 + + std::queue qtiles; + std::vector vtiles; + vtiles.reserve(20000); + + unsigned int point_thredhold = 10000; + double minx, miny, maxx, maxy, centerx, centery; + std::ostringstream sql_buffer; + std::ostringstream _extent; + sql_buffer << std::setprecision(15); + _extent << std::setprecision(15); + + if (srid == 4326) + { + minx = -180.0000000000000000; + miny = -270.0000000000000000; + maxx = 180.0000000000000000; + maxy = 90.0000000000000000; + } + else if (srid == 3857) + { + minx = -20037508.3427870012819767; + miny = -20037508.3427809961140156; + maxx = 20037508.3427809998393059; + maxy = 20037508.3427870012819767; + } + else + { + elog(ERROR, "%s:Only supports 4326 and 3857 coordinate systems.", __FUNCTION__); + PG_RETURN_BOOL(false); + } +#ifdef DEBUG + auto indexstart = system_clock::now(); +#endif + // 添加初始 Tile + qtiles.push({0, 0, 0, minx, miny, maxx, maxy, INT_MAX}); + + while (!qtiles.empty()) + { + auto t = qtiles.front(); + + // 这里加入等级限制 + if (t.z >= max_level) + { + break; + } + + // 检查当前点数 + if (t.pts > point_thredhold) + { + // 如果大于当前设定的容限值,则将其四分后,加入到队列,等待后续处理 + // 1 + centerx = (t.minx + t.maxx) / 2; + centery = (t.miny + t.maxy) / 2; + Tile t1{t.x * 2, t.y * 2, t.z + 1, t.minx, centery, centerx, t.maxy}; + _extent.str(""); + sql_buffer.str(""); + _extent << "'BOX(" << t1.minx << " " << t1.miny << "," << t1.maxx << " " << t1.maxy + << ")'::BOX2D"; + sql_buffer << "with a as (select (st_dumppoints(" + << "\"" << column + << "\"" + ")).geom as geom from " + << "\"" << schema << "\"" + << "." + << "\"" << table << "\"" + << " where " + << "\"" << column << "\"" + << " && " << _extent.str() << ") select count(*) from a where a.geom && " + << _extent.str(); + + ret = SPI_execute(sql_buffer.str().c_str(), true, 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + unsigned int tuplecount = atoi(tupleval); + pfree(tupleval); + t1.pts = tuplecount; + if (tuplecount > point_thredhold) + { + // 如果点数大于阈值,则加入队列等待处理 + qtiles.push(t1); + } + else + { + // 否则直接加入到最后的结果集中 + vtiles.push_back(t1); + } + } + else + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 2 + Tile t2{t.x * 2 + 1, t.y * 2, t.z + 1, centerx, centery, t.maxx, t.maxy}; + _extent.str(""); + sql_buffer.str(""); + _extent << "'BOX(" << t2.minx << " " << t2.miny << "," << t2.maxx << " " << t2.maxy + << ")'::BOX2D"; + sql_buffer << "with a as (select (st_dumppoints(" + << "\"" << column + << "\"" + ")).geom as geom from " + << "\"" << schema << "\"" + << "." + << "\"" << table << "\"" + << " where " + << "\"" << column << "\"" + << " && " << _extent.str() << ") select count(*) from a where a.geom && " + << _extent.str(); + ret = SPI_execute(sql_buffer.str().c_str(), true, 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + unsigned tuplecount = atoi(tupleval); + pfree(tupleval); + t2.pts = tuplecount; + if (tuplecount > point_thredhold) + { + // 如果点数大于阈值,则加入队列等待处理 + qtiles.push(t2); + } + else + { + // 否则直接加入到最后的结果集中 + vtiles.push_back(t2); + } + } + else + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + // 3 + Tile t3{t.x * 2, t.y * 2 + 1, t.z + 1, t.minx, t.miny, centerx, centery}; + _extent.str(""); + sql_buffer.str(""); + _extent << "'BOX(" << t3.minx << " " << t3.miny << "," << t3.maxx << " " << t3.maxy + << ")'::BOX2D"; + sql_buffer << "with a as (select (st_dumppoints(" + << "\"" << column + << "\"" + ")).geom as geom from " + << "\"" << schema << "\"" + << "." + << "\"" << table << "\"" + << " where " + << "\"" << column << "\"" + << " && " << _extent.str() << ") select count(*) from a where a.geom && " + << _extent.str(); + ret = SPI_execute(sql_buffer.str().c_str(), true, 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + unsigned int tuplecount = atoi(tupleval); + pfree(tupleval); + t3.pts = tuplecount; + if (tuplecount > point_thredhold) + { + // 如果点数大于阈值,则加入队列等待处理 + qtiles.push(t3); + } + else + { + // 否则直接加入到最后的结果集中 + vtiles.push_back(t3); + } + } + else + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + // 4 + Tile t4{t.x * 2 + 1, t.y * 2 + 1, t.z + 1, centerx, t.miny, t.maxx, centery}; + _extent.str(""); + sql_buffer.str(""); + _extent << "'BOX(" << t4.minx << " " << t4.miny << "," << t4.maxx << " " << t4.maxy + << ")'::BOX2D"; + sql_buffer << "with a as (select (st_dumppoints(" + << "\"" << column + << "\"" + ")).geom as geom from " + << "\"" << schema << "\"" + << "." + << "\"" << table << "\"" + << " where " + << "\"" << column << "\"" + << " && " << _extent.str() << ") select count(*) from a where a.geom && " + << _extent.str(); + + ret = SPI_execute(sql_buffer.str().c_str(), true, 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + unsigned int tuplecount = atoi(tupleval); + pfree(tupleval); + t4.pts = tuplecount; + if (tuplecount > point_thredhold) + { + // 如果点数大于阈值,则加入队列等待处理 + qtiles.push(t4); + } + else + { + // 否则直接加入到最后的结果集中 + vtiles.push_back(t4); + } + } + else + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + } + + vtiles.push_back(t); + qtiles.pop(); + } + + // 将剩余的没有划分的加入到最终结果 + while (!qtiles.empty()) + { + vtiles.push_back(qtiles.front()); + qtiles.pop(); + } +#ifdef DEBUG + auto indexend = system_clock::now(); + auto indexdiff = std::chrono::duration_cast(indexend - indexstart); + sql_buffer.str(""); + sql_buffer << "build index use:" << indexdiff.count() << "ms"; + elog(NOTICE, "%s", sql_buffer.str().c_str()); + + sql_buffer.str(""); + sql_buffer << "DROP TABLE IF EXISTS indextable"; + SPI_exec(sql_buffer.str().c_str(), 0); + sql_buffer.str(""); + sql_buffer << "CREATE TABLE indextable(geom geometry,pcount int,level int, row int,col int)"; + SPI_exec(sql_buffer.str().c_str(), 0); + + for (auto t : vtiles) + { + sql_buffer.str(""); + sql_buffer << "insert into indextable(geom, pcount, level,row,col) values (ST_MakeEnvelope( " << t.minx + << "," << t.miny << "," << t.maxx << "," << t.maxy << "," << srid << ")," << t.pts << "," + << t.z << "," << t.y << "," << t.x << ");"; + SPI_execute(sql_buffer.str().c_str(), false, 0); + } + +#endif + // 到这里我们就可以准备生成矢量瓦片了 + std::vector simple_table_status; + simple_table_status.resize(20, SimpleStatus::UNKNOWN); + std::string tablename; + + for (auto t : vtiles) + { + if (t.pts == 0) + { + continue; + } + // 检查简化表是否存在 + // 状态未知 + if (simple_table_status.at(t.z) == SimpleStatus::UNKNOWN) + { + // 如果以前没有检查到存在简化表先判断一次 + tablename = std::string("pyd_") + table + std::string("_") + column + std::string("_") + + std::to_string(t.z); + memset(query, 0, QUERYSIZE); + snprintf( + query, + QUERYSIZE, + "SELECT count(*) from pyramid_columns where f_schema_name= \'%s\' and f_pyramid_table_name = \'%s\';", + schema, + tablename.c_str()); + ret = SPI_exec(query, 1); + // 这里我们重复使用 tablename 变量作为了全路径 + tablename = "\"" + std::string(schema) + "\".\"" + std::string("pyd_") + table + + std::string("_") + column + std::string("_") + std::to_string(t.z) + "\""; + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *count = SPI_getvalue(tuple, tupdesc, 1); + if (atoi(count) == 0) + { + // 简化表不存在 + tablename = "\"" + std::string(schema) + "\".\"" + std::string(table) + "\""; + simple_table_status.at(t.z) = SimpleStatus::NOTEXIST; + } + else + { + // 简化表存在 + tablename = "\"" + std::string(schema) + "\".\"" + std::string("pyd_") + table + + std::string("_") + column + std::string("_") + std::to_string(t.z) + + "\""; + simple_table_status.at(t.z) = SimpleStatus::EXIST; + } + pfree(count); + } + else + { + elog(ERROR, "%s: SPI_execute error!SQL:%s", __FUNCTION__, query); + SPI_finish(); + PG_RETURN_BOOL(false); + } + } + else if (simple_table_status.at(t.z) == SimpleStatus::NOTEXIST) + { + // 不存在 + tablename = "\"" + std::string(schema) + "\".\"" + std::string(table) + "\""; + } + + long long id = (((long long)t.z) << 50) + (((long long)t.x) << 25) + t.y; + +#ifdef DEBUG + auto tilestart = system_clock::now(); +#endif + // 这里我们可以开始生成矢量金字塔了 + snprintf(query, + QUERYSIZE, + "WITH mvtgeom AS(SELECT ST_AsMVTGeom(\"%s\", ST_MakeEnvelope(%f,%f,%f,%f,%d)) AS geom FROM %s " + " WHERE \"%s\" && ST_MakeEnvelope(%f,%f,%f,%f,%d))" + " insert into \"%s\".\"tile_%s_%s\"(id,mvt)(select %lld,ST_AsMVT(mvtgeom.*) from mvtgeom)", + column, + t.minx, + t.miny, + t.maxx, + t.maxy, + srid, + tablename.c_str(), + column, + t.minx, + t.miny, + t.maxx, + t.maxy, + srid, + schema, + table, + column, + id); + + SPI_exec(query, 1); +#ifdef DEBUG + // elog(NOTICE, "%s:mvt sql:%s", __FUNCTION__, query); + auto tileend = system_clock::now(); + auto tilediff = std::chrono::duration_cast(tileend - tilestart); + sql_buffer.str(""); + sql_buffer << "build " << t.z << "/" << t.x << "/" << t.y << " use " << tilediff.count() << " ms"; + elog(NOTICE, "%s", sql_buffer.str().c_str()); +#endif + } + + SPI_finish(); + PG_RETURN_BOOL(true); +} + +/** + * @brief 用来更新一个 geometry 数据变化的概化表和矢量金字塔 + * + * @return Datum + */ +Datum +updatePyramid(PG_FUNCTION_ARGS) +{ + // 1. 开始检查参数 + + if (PG_ARGISNULL(0) || PG_ARGISNULL(1) || PG_ARGISNULL(2) || PG_ARGISNULL(3)) + { + elog(NOTICE, "%s:%d:paramater can not be null", __FUNCTION__, __LINE__); + PG_RETURN_BOOL(false); + } + + std::string schemaname = std::string(text_to_cstring(PG_GETARG_TEXT_P(0))); + std::string tablename = std::string(text_to_cstring(PG_GETARG_TEXT_P(1))); + std::string columname = std::string(text_to_cstring(PG_GETARG_TEXT_P(2))); + unsigned int max_level = PG_GETARG_INT32(4); + if (max_level < 0 || max_level > MAX_LEVEL) + { + elog(ERROR, "exceed the max level:%d", MAX_LEVEL); + PG_RETURN_BOOL(false); + } + int origin_srid = 0; + GBOX *box; + int ret = 0; + box = (GBOX *)PG_GETARG_POINTER(3); + if (box->xmax - box->xmin <= 0 || box->ymax - box->ymin <= 0) + { + elog(ERROR, "%s: Geometric bounds are too small", __FUNCTION__); + PG_RETURN_BOOL(false); + } + + // 连接 SPI + if (SPI_OK_CONNECT != SPI_connect()) + { + elog(ERROR, "%s: could not connect to SPI manager", __FUNCTION__); + + PG_RETURN_BOOL(false); + } + + std::ostringstream sql_buffer; + sql_buffer << std::setprecision(16); + + // 1.1 获取 geometry 类型 + std::string geomtype; + sql_buffer.str(""); + sql_buffer << "SELECT GeometryType(\"" << columname << "\") FROM " + << "\"" << schemaname << "\"." + << "\"" << tablename << "\"" + << " LIMIT 1"; + + ret = SPI_exec(sql_buffer.str().c_str(), 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + if (tuptable->numvals > 0) + { + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + geomtype = std::string(tupleval); + pfree(tupleval); + } + else + { + elog(ERROR, "%s: can not get the geometry type", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + } + else + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 获取 srid + sql_buffer.str(""); + sql_buffer << "select srid from geometry_columns where f_table_name=" + << "\'" << tablename << "\'" + << " and f_geometry_column= " + << "\'" << columname << "\'" + << " and f_table_schema= " + << "\'" << schemaname << "\'"; + + ret = SPI_exec(sql_buffer.str().c_str(), 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + origin_srid = atoi(tupleval); + pfree(tupleval); + } + else + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 1.3 根据获取到的概化的表,然后我们来先删除原来的数据 + sql_buffer.str(""); + sql_buffer << " select f_pyramid_table_name,config from pyramid_columns where f_schema_name= " + << "\'" << schemaname << "\'" + << " and f_table_name = " + << "\'" << tablename << "\'" + << " and f_geometry_column = " + << "\'" << columname << "\'"; +#ifdef DEBUG + elog(NOTICE, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); +#endif + ret = SPI_exec(sql_buffer.str().c_str(), 0); + + if (ret < 0) + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + for (size_t i = 0; i < tuptable->numvals; i++) + { + HeapTuple tuple = tuptable->vals[i]; + char *val1 = SPI_getvalue(tuple, tupdesc, 1); + std::string pydtable = std::string(val1); + char *val2 = SPI_getvalue(tuple, tupdesc, 2); + std::string config = std::string(val2); + pfree(val1); + pfree(val2); + + // 这里我们开始删除与边框相交的数据 + sql_buffer.str(""); + sql_buffer << "DELETE FROM " + << "\"" << schemaname << "\"." + << "\"" << pydtable << "\" WHERE \"" << columname << "\" && ST_MakeEnvelope(" << box->xmin + << "," << box->ymin << "," << box->xmax << "," << box->ymax << "," << origin_srid << ")"; + + int ret = SPI_exec(sql_buffer.str().c_str(), 0); + + if (ret < 0) + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + LevelConfig e; + parseConfig(config.c_str(), e); + + // 1.3 这里将新数据插入到概化表中 + if (geomtype == "MULTIPOLYGON" || geomtype == "POLYGON" || geomtype == "LINESTRING" || + geomtype == "MULTILINESTRING") + { + sql_buffer.str(""); + sql_buffer << "INSERT INTO " + << "\"" << schemaname << "\"." + << "\"" << pydtable << "\"("; + for (auto attr : e.attribute) + { + sql_buffer << "\"" << attr << "\"" + << ","; + } + sql_buffer << "\"" << columname << "\")"; + sql_buffer << " SELECT "; + for (auto attr : e.attribute) + { + sql_buffer << "\"" << attr << "\"" + << ","; + } + + if (e.level > 10) + { + sql_buffer << "st_simplify(\"" << columname << "\"," << e.resolution << "," + << e.preserveCollapsed << ") as \"" << columname << "\""; + } + else + { + sql_buffer << "st_snaptogrid(\"" << columname << "\"," << e.resolution << ") as \"" + << columname << "\""; + } + + // from + sql_buffer << " from " + << "\"" << schemaname << "\"" + << "." + << "\"" << tablename << "\""; + + // filter + if (e.filter != "null") + { + sql_buffer << " where " << e.filter; + sql_buffer << " and " + << "\"" << columname << "\"" + << " && ST_MakeEnvelope(" << box->xmin << "," << box->ymin << "," + << box->xmax << "," << box->ymax << "," << origin_srid << ")"; + } + else + { + sql_buffer << " where " + << "\"" << columname << "\"" + << " && ST_MakeEnvelope(" << box->xmin << "," << box->ymin << "," + << box->xmax << "," << box->ymax << "," << origin_srid << ")"; + } + + ret = SPI_exec(sql_buffer.str().c_str(), 1); + if (ret < 0) + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + sql_buffer.str(""); + sql_buffer << "DELETE FROM \"" << schemaname << "\"" + << ".\"pyd_" << tablename << "_" << columname << "_" << e.level + << "\" WHERE ST_ISEMPTY(\"" << columname << "\")"; + ret = SPI_exec(sql_buffer.str().c_str(), 1); + + if (ret <= 0) + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + } + else if (geomtype == "POINT" || geomtype == "MULTIPOINT") + { + double dbbox[4] = {0}; + sql_buffer.str(""); + sql_buffer << "ANALYZE " + << "\"" << schemaname << "\"." + << "\"" << tablename << "\""; + + ret = SPI_exec(sql_buffer.str().c_str(), 0); + + if (ret < 0) + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + sql_buffer.str(""); + sql_buffer << "SELECT ST_EstimatedExtent(" + << " \'" << schemaname << "\'" + << ",\'" << tablename << "\'" + << ",\'" << columname << "\')"; + ret = SPI_exec(sql_buffer.str().c_str(), 0); + + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *bbox = SPI_getvalue(tuple, tupdesc, 1); + getextent(bbox, dbbox); + pfree(bbox); + } + else + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + int xbuckets = (int(dbbox[2]) - int(dbbox[0])) / e.resolution; + int ybuckets = (int(dbbox[3]) - int(dbbox[1])) / e.resolution; + + // 这里我们只生成一个临时表 + sql_buffer.str(""); + sql_buffer << "create table \""; + sql_buffer << schemaname; + sql_buffer << "\"" + << ".\"pyd_" << tablename << "_" << columname << "_temp_" << e.level << "\"" + << " as select \"" << columname << "\" from ("; + sql_buffer << "SELECT WIDTH_BUCKET(st_x(" + << "\"" << columname << "\"" + << "), " << int(dbbox[0]) << "," << int(dbbox[2]) + 1 << "," << xbuckets + << ") grid_x," + << "WIDTH_BUCKET(st_y(" + << "\"" << columname << "\"" + << ")," << int(dbbox[1]) << ", " << int(dbbox[3]) + 1 << ", " << ybuckets + << ") grid_y," + << "ST_GeometryN(ST_collect(" + << "\"" << columname << "\"" + << "),1) \"" << columname << "\""; + + // from + sql_buffer << " from " + << "\"" << schemaname << "\"" + << "." + << "\"" << tablename << "\""; + + // filter + if (e.filter != "null") + { + sql_buffer << " where " << e.filter; + sql_buffer << " and " + << "\"" << columname << "\"" + << " && ST_MakeEnvelope(" << box->xmin << "," << box->ymin << "," + << box->xmax << "," << box->ymax << "," << origin_srid << ")"; + } + else + { + sql_buffer << " where " + << "\"" << columname << "\"" + << " && ST_MakeEnvelope(" << box->xmin << "," << box->ymin << "," + << box->xmax << "," << box->ymax << "," << origin_srid << ")"; + } + + sql_buffer << " GROUP BY grid_x,grid_y) as temp"; + + ret = SPI_exec(sql_buffer.str().c_str(), 1); + + if (ret <= 0) + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 这里我们将附带的信息加入到概化表中 + + sql_buffer.str(""); + sql_buffer << "INSERT INTO " + << "\"" << schemaname << "\"." + << "\"" << pydtable << "\"("; + for (auto attr : e.attribute) + { + sql_buffer << "\"" << attr << "\"" + << ","; + } + sql_buffer << "\"" << columname << "\")"; + sql_buffer << " SELECT "; + + // attribute + for (auto attr : e.attribute) + { + sql_buffer << "a.\"" << attr << "\" ,"; + } + // geometry + sql_buffer << "a.\"" << columname << "\""; + // from + sql_buffer << " from " + << "\"" << schemaname << "\"" + << "." + << "\"" << tablename << "\" as a," + << "\"" << schemaname; + + sql_buffer << "\"" + << ".\"pyd_" << tablename << "_" << columname << "_temp_" << e.level << "\" as b"; + + sql_buffer << " where a." + << "\"" << columname << "\"" + << "=b." + << "\"" << columname << "\""; + + ret = SPI_exec(sql_buffer.str().c_str(), 1); + + if (ret <= 0) + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 删除临时表 + sql_buffer.str(""); + sql_buffer << "DROP TABLE IF EXISTS \"" << schemaname << "\"" + << ".\"pyd_" << tablename << "_" << columname << "_temp_" << e.level << "\""; + ret = SPI_exec(sql_buffer.str().c_str(), 1); + + if (ret <= 0) + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + } + +#ifdef DEBUG + elog(NOTICE, "%s", sql_buffer.str().c_str()); +#endif + } + + // 2.1 这里我们开始更新 tile 表 + // 检查是否存在一个瓦片的表 + sql_buffer.str(""); + sql_buffer << "SELECT count(*) from pg_tables where schemaname = " + << "\'" << schemaname << "\'" + << " and " + << " tablename= " + << "\'" + << "tile_" << tablename << "_" << columname << "\'"; + ret = SPI_exec(sql_buffer.str().c_str(), 0); + + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + int count = atoi(tupleval); + + if (count == 0) + { + elog(NOTICE, "does not have a tile table"); + SPI_finish(); + PG_RETURN_BOOL(true); + } + + pfree(tupleval); + } + else + { + elog(ERROR, "%s: SPI_execute error!", __FUNCTION__); + SPI_finish(); + PG_RETURN_BOOL(false); + } + + // 如果存在一个表的话,我们需要重新构建矢量金字塔 + // 构建稀疏矩阵 + + std::queue qtiles; + std::vector vtiles; + vtiles.reserve(20000); + + unsigned int point_thredhold = 10000; + double minx, miny, maxx, maxy, centerx, centery; + std::ostringstream _extent; + _extent << std::setprecision(15); + + if (origin_srid == 4326) + { + minx = -180.0000000000000000; + miny = -270.0000000000000000; + maxx = 180.0000000000000000; + maxy = 90.0000000000000000; + } + else if (origin_srid == 3857) + { + minx = -20037508.3427870012819767; + miny = -20037508.3427809961140156; + maxx = 20037508.3427809998393059; + maxy = 20037508.3427870012819767; + } + else + { + elog(ERROR, "%s:Only supports 4326 and 3857 coordinate systems.", __FUNCTION__); + PG_RETURN_BOOL(false); + } +#ifdef DEBUG + auto indexstart = system_clock::now(); +#endif + // 添加初始 Tile + qtiles.push({0, 0, 0, minx, miny, maxx, maxy, INT_MAX}); + + while (!qtiles.empty()) + { + auto t = qtiles.front(); + + // 这里加入等级限制 + if (t.z >= max_level) + { + break; + } + + // 检查当前点数 + if (t.pts > point_thredhold) + { + // 如果大于当前设定的容限值,则将其四分后,加入到队列,等待后续处理 + // 1 + centerx = (t.minx + t.maxx) / 2; + centery = (t.miny + t.maxy) / 2; + Tile t1{t.x * 2, t.y * 2, t.z + 1, t.minx, centery, centerx, t.maxy}; + + if (isTouch(box, t1)) + { + _extent.str(""); + sql_buffer.str(""); + _extent << "'BOX(" << t1.minx << " " << t1.miny << "," << t1.maxx << " " << t1.maxy + << ")'::BOX2D"; + sql_buffer << "with a as (select (st_dumppoints(" + << "\"" << columname + << "\"" + ")).geom as geom from " + << "\"" << schemaname << "\"" + << "." + << "\"" << tablename << "\"" + << " where " + << "\"" << columname << "\"" + << " && " << _extent.str() << ") select count(*) from a where a.geom && " + << _extent.str(); + + ret = SPI_execute(sql_buffer.str().c_str(), true, 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + unsigned int tuplecount = atoi(tupleval); + pfree(tupleval); + t1.pts = tuplecount; + if (tuplecount > point_thredhold) + { + // 如果点数大于阈值,则加入队列等待处理 + qtiles.push(t1); + } + else + { + // 否则直接加入到最后的结果集中 + vtiles.push_back(t1); + } + } + else + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + } + + // 2 + Tile t2{t.x * 2 + 1, t.y * 2, t.z + 1, centerx, centery, t.maxx, t.maxy}; + + if (isTouch(box, t2)) + { + _extent.str(""); + sql_buffer.str(""); + _extent << "'BOX(" << t2.minx << " " << t2.miny << "," << t2.maxx << " " << t2.maxy + << ")'::BOX2D"; + sql_buffer << "with a as (select (st_dumppoints(" + << "\"" << columname + << "\"" + ")).geom as geom from " + << "\"" << schemaname << "\"" + << "." + << "\"" << tablename << "\"" + << " where " + << "\"" << columname << "\"" + << " && " << _extent.str() << ") select count(*) from a where a.geom && " + << _extent.str(); + ret = SPI_execute(sql_buffer.str().c_str(), true, 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + unsigned tuplecount = atoi(tupleval); + pfree(tupleval); + t2.pts = tuplecount; + if (tuplecount > point_thredhold) + { + // 如果点数大于阈值,则加入队列等待处理 + qtiles.push(t2); + } + else + { + // 否则直接加入到最后的结果集中 + vtiles.push_back(t2); + } + } + else + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + } + + // 3 + Tile t3{t.x * 2, t.y * 2 + 1, t.z + 1, t.minx, t.miny, centerx, centery}; + + if (isTouch(box, t3)) + { + _extent.str(""); + sql_buffer.str(""); + _extent << "'BOX(" << t3.minx << " " << t3.miny << "," << t3.maxx << " " << t3.maxy + << ")'::BOX2D"; + sql_buffer << "with a as (select (st_dumppoints(" + << "\"" << columname + << "\"" + ")).geom as geom from " + << "\"" << schemaname << "\"" + << "." + << "\"" << tablename << "\"" + << " where " + << "\"" << columname << "\"" + << " && " << _extent.str() << ") select count(*) from a where a.geom && " + << _extent.str(); + ret = SPI_execute(sql_buffer.str().c_str(), true, 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + unsigned int tuplecount = atoi(tupleval); + pfree(tupleval); + t3.pts = tuplecount; + if (tuplecount > point_thredhold) + { + // 如果点数大于阈值,则加入队列等待处理 + qtiles.push(t3); + } + else + { + // 否则直接加入到最后的结果集中 + vtiles.push_back(t3); + } + } + else + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + } + + // 4 + Tile t4{t.x * 2 + 1, t.y * 2 + 1, t.z + 1, centerx, t.miny, t.maxx, centery}; + if (isTouch(box, t4)) + { + _extent.str(""); + sql_buffer.str(""); + _extent << "'BOX(" << t4.minx << " " << t4.miny << "," << t4.maxx << " " << t4.maxy + << ")'::BOX2D"; + sql_buffer << "with a as (select (st_dumppoints(" + << "\"" << columname + << "\"" + ")).geom as geom from " + << "\"" << schemaname << "\"" + << "." + << "\"" << tablename << "\"" + << " where " + << "\"" << columname << "\"" + << " && " << _extent.str() << ") select count(*) from a where a.geom && " + << _extent.str(); + + ret = SPI_execute(sql_buffer.str().c_str(), true, 1); + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *tupleval = SPI_getvalue(tuple, tupdesc, 1); + unsigned int tuplecount = atoi(tupleval); + pfree(tupleval); + t4.pts = tuplecount; + if (tuplecount > point_thredhold) + { + // 如果点数大于阈值,则加入队列等待处理 + qtiles.push(t4); + } + else + { + // 否则直接加入到最后的结果集中 + vtiles.push_back(t4); + } + } + else + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + } + } + + vtiles.push_back(t); + qtiles.pop(); + } + + // 将剩余的没有划分的加入到最终结果 + while (!qtiles.empty()) + { + vtiles.push_back(qtiles.front()); + qtiles.pop(); + } +#ifdef DEBUG + auto indexend = system_clock::now(); + auto indexdiff = std::chrono::duration_cast(indexend - indexstart); + sql_buffer.str(""); + sql_buffer << "build index use:" << indexdiff.count() << "ms"; + elog(NOTICE, "%s", sql_buffer.str().c_str()); + + sql_buffer.str(""); + sql_buffer << "DROP TABLE IF EXISTS indextable"; + SPI_exec(sql_buffer.str().c_str(), 0); + sql_buffer.str(""); + sql_buffer << "CREATE TABLE indextable(geom geometry,pcount int,level int, row int,col int)"; + SPI_exec(sql_buffer.str().c_str(), 0); + + for (auto t : vtiles) + { + sql_buffer.str(""); + sql_buffer << "insert into indextable(geom, pcount, level,row,col) values (ST_MakeEnvelope( " << t.minx + << "," << t.miny << "," << t.maxx << "," << t.maxy << "," << origin_srid << ")," << t.pts + << "," << t.z << "," << t.y << "," << t.x << ");"; + SPI_execute(sql_buffer.str().c_str(), false, 0); + } + +#endif + + // 到这里我们已经找到所有受到影响的瓦片,我们先将原来瓦片删除,然后插入新的瓦片 + // 到这里我们就可以准备生成矢量瓦片了 + std::vector simple_table_status; + simple_table_status.resize(20, SimpleStatus::UNKNOWN); + std::string simptablename; + + for (auto t : vtiles) + { + if (t.pts == 0) + { + continue; + } + // 检查简化表是否存在 + // 状态未知 + if (simple_table_status.at(t.z) == SimpleStatus::UNKNOWN) + { + // 如果以前没有检查到存在简化表先判断一次 + simptablename = std::string("pyd_") + tablename + std::string("_") + columname + + std::string("_") + std::to_string(t.z); + sql_buffer.str(""); + sql_buffer << " SELECT count(*) from pyramid_columns where f_schema_name= " + << "\'" << schemaname << "\'" + << " and f_pyramid_table_name = " + << "\'" << simptablename << "\'"; + ret = SPI_exec(sql_buffer.str().c_str(), 1); + // 这里我们重复使用 tablename 变量作为了全路径 + simptablename = "\"" + std::string(schemaname) + "\".\"" + std::string("pyd_") + tablename + + std::string("_") + columname + std::string("_") + std::to_string(t.z) + "\""; + + // 获取执行结果 + if (ret > 0 && SPI_tuptable != NULL) + { + SPITupleTable *tuptable = SPI_tuptable; + TupleDesc tupdesc = tuptable->tupdesc; + HeapTuple tuple = tuptable->vals[0]; + char *count = SPI_getvalue(tuple, tupdesc, 1); + if (atoi(count) == 0) + { + // 简化表不存在 + simptablename = + "\"" + std::string(schemaname) + "\".\"" + std::string(tablename) + "\""; + simple_table_status.at(t.z) = SimpleStatus::NOTEXIST; + } + else + { + // 简化表存在 + simptablename = "\"" + std::string(schemaname) + "\".\"" + std::string("pyd_") + + tablename + std::string("_") + columname + std::string("_") + + std::to_string(t.z) + "\""; + simple_table_status.at(t.z) = SimpleStatus::EXIST; + } + pfree(count); + } + else + { + elog(ERROR, "%s:%d:sql:%s", __FUNCTION__, __LINE__, sql_buffer.str().c_str()); + SPI_finish(); + PG_RETURN_BOOL(false); + } + } + else if (simple_table_status.at(t.z) == SimpleStatus::NOTEXIST) + { + // 不存在 + simptablename = "\"" + std::string(schemaname) + "\".\"" + std::string(tablename) + "\""; + } + + long long id = (((long long)t.z) << 50) + (((long long)t.x) << 25) + t.y; + + // 删除原来的旧数据 + sql_buffer.str(""); + sql_buffer << "DELETE FROM " + << "\"" << schemaname << "\"." + << "\"" + << "tile_" << tablename << "_" << columname << "\" WHERE id= " << id; + SPI_exec(sql_buffer.str().c_str(), 0); + +#ifdef DEBUG + auto tilestart = system_clock::now(); +#endif + // 这里我们可以开始生成矢量金字塔了 + char query[QUERYSIZE]; + snprintf(query, + QUERYSIZE, + "WITH mvtgeom AS(SELECT ST_AsMVTGeom(\"%s\", ST_MakeEnvelope(%f,%f,%f,%f,%d)) AS geom FROM %s " + " WHERE \"%s\" && ST_MakeEnvelope(%f,%f,%f,%f,%d))" + " insert into \"%s\".\"tile_%s_%s\"(id,mvt)(select %lld,ST_AsMVT(mvtgeom.*) from mvtgeom)", + columname.c_str(), + t.minx, + t.miny, + t.maxx, + t.maxy, + origin_srid, + tablename.c_str(), + columname.c_str(), + t.minx, + t.miny, + t.maxx, + t.maxy, + origin_srid, + schemaname.c_str(), + tablename.c_str(), + columname.c_str(), + id); + + SPI_exec(query, 1); +#ifdef DEBUG + // elog(NOTICE, "%s:mvt sql:%s", __FUNCTION__, query); + auto tileend = system_clock::now(); + auto tilediff = std::chrono::duration_cast(tileend - tilestart); + sql_buffer.str(""); + sql_buffer << "build " << t.z << "/" << t.x << "/" << t.y << " use " << tilediff.count() << " ms"; + elog(NOTICE, "%s", sql_buffer.str().c_str()); +#endif + } + SPI_finish(); + PG_RETURN_BOOL(true); +} \ No newline at end of file diff --git a/pyramid/util.cpp b/pyramid/util.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d2d6a7b1e3be3b25808b0893f6882a1892dda36e --- /dev/null +++ b/pyramid/util.cpp @@ -0,0 +1,429 @@ +/* + * + * util.cpp + * + * Copyright (C) 2023 SuperMap Software Co., Ltd. + * + * Yukon is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see . * + */ +#include "util.h" +#include "json.h" +#include "json_object.h" +#include "json_types.h" + +static double +toDegrees(double angrad) +{ + return angrad * 180.0 / PI; +} + +static double +toRadians(double angdeg) +{ + return angdeg / 180.0 * PI; +} + +double +tile2lat(int y, int z) +{ + double n = PI - (2.0 * PI * y) / pow(2.0, z); + return toDegrees(atan(sinh(n))); +} + +double +tile2lon(int x, int z) +{ + return x / pow(2.0, z) * 360.0 - 180; +} + +BoundingBox +tile2boundingBox(int x, int y, int z) +{ + BoundingBox box; + box.ymin = tile2lat(y, z); + box.ymax = tile2lat(y + 1, z); + box.xmin = tile2lon(x, z); + box.ymax = tile2lon(x + 1, z); + return box; +} + +Tile +getTileNumber(double lat, double lon, int z) +{ + int xtile = (int)floor((lon + 180) / 360 * (1 << z)); + int ytile = (int)floor((1 - log(tan(toRadians(lat)) + 1 / cos(toRadians(lat))) / PI) / 2 * (1 << z)); + if (xtile < 0) + xtile = 0; + if (xtile >= (1 << z)) + xtile = ((1 << z) - 1); + if (ytile < 0) + ytile = 0; + if (ytile >= (1 << z)) + ytile = ((1 << z) - 1); + Tile tile; + tile.x = xtile; + tile.y = ytile; + tile.z = z; + return tile; +} + + +/** + * @brief 将一个 LevelConfig 对象转换为一个 json 字符串 + * + * @return std::string + */ +std::string +LevelConfig::to_string() +{ +#if 0 + std::ostringstream output; + output << std::setprecision(15); + output << "level:" + std::to_string(level) + "\n"; + output << "bbox:" + bbox + "\n"; + output << "gridrule:" + gridrule + "\n"; + output << "extent:" + std::to_string(extent) + "\n"; + output << "buffer:" + std::to_string(buffer) + "\n"; + output << "srid:" + std::to_string(srid) + "\n"; + output << "filter:" + filter + "\n"; + output << "attribute:"; + for (size_t i = 0; i < attribute.size(); i++) + { + output << attribute[i] + " "; + } + output << "\n"; + output << "buildrule:" + buildrule + "\n"; + output << "tolerance:" << tolerance << "\n"; + output << "preserveCollapsed:" + preserveCollapsed + "\n"; + output << "resolution:" << resolution << "\n"; + return output.str(); +#endif + json_object *root; + const char *jsonString; + std::string res; + + // Create the JSON object + root = json_object_new_object(); + json_object_object_add(root, "level", json_object_new_int(level)); + json_object_object_add(root, "resolution", json_object_new_double(resolution)); + json_object_object_add(root, "filter", json_object_new_string(filter.c_str())); + + json_object *attriarray = json_object_new_array(); + for (auto a : attribute) + { + json_object_array_add(attriarray, json_object_new_string(a.c_str())); + } + json_object_object_add(root, "attribute", attriarray); + + // Convert the JSON object to a string + jsonString = json_object_to_json_string(root); + res = std::string(jsonString); + json_object_put(root); + return res; +} + +/** + * @brief 解析具体的配置规则 + * + * @param config 配置规则 + * @param rules 解析后的结果 + * @param index 配置规则数组的下标 + * @param errmsg 错误信息 + * @return int + * 0 - 解析正常 + * -1 - 解析错误 + */ +static int +parseConfigDetial(json_object *config, std::vector &rules, int index, std::string &errmsg) +{ + LevelConfig &elem = rules.at(index); + + // level + json_object *jo_level = json_object_object_get(config, "level"); + if (!jo_level || json_object_get_type(jo_level) != json_type_int) + { + errmsg = std::string("config must be contain level field and it's type is integer value"); + return -1; + } + + elem.level = json_object_get_uint64(jo_level); + + // resolution + + json_object *jo_resolution = json_object_object_get(config, "resolution"); + + if (jo_resolution && json_object_get_type(jo_resolution) == json_type_double) + { + elem.resolution = json_object_get_double(jo_resolution); + } + + json_object *jo_bbox = json_object_object_get(config, "bbox"); + + if (jo_bbox && json_object_get_type(jo_bbox) == json_type_string) + { + elem.bbox = std::string(json_object_get_string(jo_bbox)); + } + + json_object *jo_gridrule = json_object_object_get(config, "gridrule"); + + if (jo_gridrule && json_object_get_type(jo_gridrule) == json_type_string) + { + elem.gridrule = std::string(json_object_get_string(jo_gridrule)); + } + + json_object *jo_extent = json_object_object_get(config, "extent"); + + if (jo_extent && json_object_get_type(jo_extent) == json_type_int) + { + elem.extent = json_object_get_uint64(jo_extent); + } + + json_object *jo_buffer = json_object_object_get(config, "buffer"); + + if (jo_buffer && json_object_get_type(jo_buffer) == json_type_int) + { + elem.buffer = json_object_get_uint64(jo_buffer); + } + + json_object *jo_srid = json_object_object_get(config, "srid"); + + if (jo_srid && json_object_get_type(jo_srid) == json_type_int) + { + elem.srid = json_object_get_uint64(jo_srid); + } + + json_object *jo_filter = json_object_object_get(config, "filter"); + + if (jo_filter && json_object_get_type(jo_filter) == json_type_string) + { + elem.filter = std::string(json_object_get_string(jo_filter)); + } + + json_object *jo_attribute = json_object_object_get(config, "attribute"); + + if (jo_attribute && json_object_get_type(jo_attribute) == json_type_array) + { + int n = json_object_array_length(jo_attribute); + for (int i = 0; i < n; i++) + { + json_object *jo_str = json_object_array_get_idx(jo_attribute, i); + if (json_object_get_type(jo_str) == json_type_string) + { + elem.attribute.push_back(std::string(json_object_get_string(jo_str))); + } + } + } + + // json_object *jo_simplify = json_object_object_get(config, "simplify"); + + // if (jo_simplify) + // { + + json_object *jo_buildrule = json_object_object_get(config, "buildrule"); + if (jo_buildrule && json_object_get_type(jo_buildrule) == json_type_string) + { + elem.buildrule = json_object_get_string(jo_buildrule); + } + + json_object *jo_tolerance = json_object_object_get(config, "tolerance"); + if (jo_tolerance && json_object_get_type(jo_tolerance) == json_type_double) + { + elem.tolerance = json_object_get_double(jo_tolerance); + } + + json_object *jo_preserveCollapsed = json_object_object_get(config, "preserveCollapsed"); + if (jo_preserveCollapsed && json_object_get_type(jo_preserveCollapsed) == json_type_boolean) + { + elem.preserveCollapsed = + json_object_get_boolean(jo_preserveCollapsed) ? std::string("true") : std::string("false"); + } + // } + + // 检查等级超过 19 级且未提供 resolution 参数则报错 + if (elem.level > MAX_LEVEL && elem.resolution == 0) + { + errmsg = std::string("the level has exceeded .provide the resolution parameter"); + return -1; + } + + return 0; +} + +/** + * @brief 解析配置文件 + * + * @param config 配置字符串 + * @return std::vector + */ +std::vector +parseConfig(const char *config, std::string &errmsg) +{ + json_object *jo_root_obj = json_tokener_parse(config); + std::vector vres; + if (!jo_root_obj) + { + return vres; + } + + // 检查最顶层是否为 level + // json_object *jo_level_obj = json_object_object_get(jo_root, "level"); + + // if (jo_level_obj == NULL) + // { + // fprintf(stderr, "you should contain a top object named level,for example:{\"level\":[]}\n"); + // json_object_put(jo_root); + // return vres; + // } + + // json_type type; + + // 配置 json 是一个数组 + // type = json_object_get_type(jo_root_obj); + + // if (type != json_type_array) + // { + // fprintf(stderr, "the json format should be:{\"level\":[]}\n"); + // json_object_put(jo_root); + // return vres; + // } + + // int itemsize = json_object_array_length(jo_level); + + // if (itemsize == 0) + // { + // fprintf(stderr, "the array can not be empty\n"); + // json_object_put(jo_root); + // return vres; + // } + + // // 划分等级个数 + // json_object *jo_levels_key = json_object_array_get_idx(jo_level, 0); + + // if (!jo_levels_key) + // { + // fprintf(stderr, "format parse error\n"); + // json_object_put(jo_root); + // return vres; + // } + + // 获取等级数组 + // json_object *jo_levels_objs = json_object_object_get(jo_root_obj, "levels"); + + // jo_root_obj 不为空,并且是一个 array + if (json_object_get_type(jo_root_obj) != json_type_array) + { + fprintf(stderr, "levels parse error!\n"); + json_object_put(jo_root_obj); + return vres; + } + int levels_size = json_object_array_length(jo_root_obj); + vres.resize(levels_size); + + // // 填充结果中的等级信息 + // for (int i = 0; i < levels_size; i++) + // { + // json_object *jo_level_num = json_object_array_get_idx(jo_levels, i); + // if (json_object_get_type(jo_level_num) == json_type_int) + // { + // vres[i].level = json_object_get_uint64(jo_level_num); + // } + // else + // { + // // 等级数组中含有非 int 型数据,返回空 + // fprintf(stderr, "levels should be only contains int value\n"); + // vres.resize(0); + // json_object_put(jo_root); + // return vres; + // } + // } + + for (int i = 0; i < levels_size; i++) + { + json_object *jo_detail = json_object_array_get_idx(jo_root_obj, i); + + // 解析具体的规则 + if (parseConfigDetial(jo_detail, vres, i, errmsg) != 0) + { + vres.clear(); + break; + } + } + + json_object_put(jo_root_obj); + return vres; +} + +/** + * @brief 这个函数将单个配置字符串解析为一个 LevelConfig 对象, + * 这个函数只用于更新时使用 + * + * @param config + * @return LevelConfig + */ +int +parseConfig(const char *config, LevelConfig &levelconfig) +{ + json_object *jo_root_obj = json_tokener_parse(config); + + if (jo_root_obj != nullptr) + { + // level + json_object *jo_level = json_object_object_get(jo_root_obj, "level"); + if (!jo_level || json_object_get_type(jo_level) != json_type_int) + { + return -1; + } + + levelconfig.level = json_object_get_uint64(jo_level); + + // resolution + + json_object *jo_resolution = json_object_object_get(jo_root_obj, "resolution"); + + if (jo_resolution && json_object_get_type(jo_resolution) == json_type_double) + { + levelconfig.resolution = json_object_get_double(jo_resolution); + } + + json_object *jo_attribute = json_object_object_get(jo_root_obj, "attribute"); + + if (jo_attribute && json_object_get_type(jo_attribute) == json_type_array) + { + int n = json_object_array_length(jo_attribute); + for (int i = 0; i < n; i++) + { + json_object *jo_str = json_object_array_get_idx(jo_attribute, i); + if (json_object_get_type(jo_str) == json_type_string) + { + levelconfig.attribute.push_back(std::string(json_object_get_string(jo_str))); + } + } + } + } + + json_object_put(jo_root_obj); + return 0; +} + +RateConfig rateconfigs[] = { + {0, "1:591658710.91", 1.406250000000, 78271.51696}, {1, "1:295829355.455", 0.703125000000, 39135.75848}, + {2, "1:147914677.727", 0.351562500000, 19567.87924}, {3, "1:73957338.864", 0.175781250000, 9783.939621}, + {4, "1:36978669.432", 0.087890625000, 4891.96981}, {5, "1:18489334.716", 0.043945312500, 2445.984905}, + {6, "1:9244667.358", 0.021972656250, 1222.992453}, {7, "1:4622333.679", 0.010986328125, 611.4962263}, + {8, "1:2311166.839", 0.005493164063, 305.7481131}, {9, "1:1155583.42", 0.002746582031, 152.8740566}, + {10, "1:577791.71", 0.001373291016, 76.43702829}, {11, "1:288895.855", 0.000686645508, 38.21851414}, + {12, "1:144447.927", 0.000343322754, 19.10925707}, {13, "1:72223.964", 0.000171661377, 9.554628536}, + {14, "1:36111.982", 0.000085830688, 4.777314268}, {15, "1:18055.991", 0.000042915344, 2.388657134}, + {16, "1:9027.995", 0.000021457672, 1.194328567}, {17, "1:4513.998", 0.000010728836, 0.597164283}, + {18, "1:2256.999", 0.000005364418, 0.298582142}, {19, "1:1128.499", 0.000002682209, 0.149291071}}; \ No newline at end of file diff --git a/pyramid/util.h b/pyramid/util.h new file mode 100644 index 0000000000000000000000000000000000000000..c0b435babc3fe76345dc79229cf18f36a36d0a26 --- /dev/null +++ b/pyramid/util.h @@ -0,0 +1,102 @@ +/* + * + * util.h + * + * Copyright (C) 2023 SuperMap Software Co., Ltd. + * + * Yukon is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see . * + */ + +#ifndef PYRAMID_UTIL_H__ +#define PYRAMID_UTIL_H__ + +#define PI 3.14159265358979323846 +#define MAX_LEVEL 16 + +#include +#include +#include +#include +#include +#include +struct BoundingBox { + double xmin; + double ymin; + double xmax; + double ymax; +}; + +struct Tile { + unsigned int x; + unsigned int y; + unsigned int z; + double minx; + double miny; + double maxx; + double maxy; + unsigned int pts; +}; + +struct RateConfig { + int _level; + std::string _scale; + double resolution; + double distance; +}; + +enum class SimpleStatus : char +{ + UNKNOWN, + EXIST, + NOTEXIST +}; + +struct LevelConfig { + // 划分等级 + int level = -1; + // 存放与之相交对象的矢量金字塔,如果 bbox 为 null,默认是整个图层的范围 + std::string bbox = "null"; + // 瓦片划分规则,默认为 'quad' ,可选 geosot + std::string gridrule = "quad"; + // 矢量瓦片大小,默认为 1024 + int extent = 1024; + // 矢量瓦片缓存大小 + int buffer = 8; + // 矢量金字塔输出坐标,默认 3857,可选 4326 + int srid = 3857; + // 过滤条件 where 语句,默认为 null + std::string filter = "null"; + // 添加到矢量瓦片中的其他信息 + std::vector attribute; + // st_simplicify 参数 + double tolerance = 0.0; + std::string preserveCollapsed = "false"; + std::string buildrule = "simplify"; + + // resolution 分辨率 + double resolution = 0.0; + + std::string to_string(); +}; + +double tile2lon(int x, int z); +double tile2lat(int y, int z); +Tile getTileNumber(double lat, double lon, int z); +BoundingBox tile2boundingBox(int x, int y, int z); +std::string json_version(); + +std::vector parseConfig(const char *config, std::string &errmsg); +int parseConfig(const char *config, LevelConfig &levelconfig); +extern RateConfig rateconfigs[]; +#endif \ No newline at end of file diff --git a/pyramid/yukon_vector_pyramid--1.0.sql b/pyramid/yukon_vector_pyramid--1.0.sql new file mode 100644 index 0000000000000000000000000000000000000000..9c1e1a716b142a53c4d5a77efbb3152b1c4312bd --- /dev/null +++ b/pyramid/yukon_vector_pyramid--1.0.sql @@ -0,0 +1,237 @@ +--complain if script is sourced in psql, rather than via CREATE EXTENSION +\echo Use "CREATE EXTENSION yukon_vector_pyramid" to load this file. \quit + + +CREATE TABLE pyramid_columns ( + id bigserial primary key, + f_schema_name varchar(256), + f_table_name varchar(256), + f_geometry_column varchar(256), + f_pyramid_table_name varchar(256), + resolution float8, + config text +); + + +CREATE OR REPLACE FUNCTION yukon_pyramid_version() +RETURNS text + AS '$libdir/yukon_vector_pyramid-1.0','yukon_pyramid_version' +LANGUAGE 'c' IMMUTABLE STRICT ; + + + +CREATE OR REPLACE FUNCTION ST_BuildPyramid(schemaname text, tablename text, columnname text, config text) +RETURNS boolean + AS '$libdir/yukon_vector_pyramid-1.0','buildpyramid' +LANGUAGE 'c' IMMUTABLE STRICT ; + + +CREATE OR REPLACE FUNCTION ST_ListPyramid(schemaname text, tablename text, columnname text) +RETURNS SETOF text +AS +$$ +DECLARE + sql_statment text; + item text; +BEGIN + sql_statment = 'SELECT config FROM pyramid_columns WHERE f_table_name = ' || QUOTE_LITERAL(tablename) || + ' and f_geometry_column=' || QUOTE_LITERAL(columnname) || ' and f_schema_name =' || QUOTE_LITERAL(schemaname) ; + FOR item IN EXECUTE sql_statment + LOOP + RETURN NEXT item; + END LOOP; + RETURN; +END; +$$ +LANGUAGE 'plpgsql' VOLATILE STRICT; + +-- 查看是否有矢量金字塔层 +CREATE OR REPLACE FUNCTION ST_HasPyramid(schemaname text, tablename text, columnname text) + RETURNS boolean +AS +$$ +DECLARE + ret integer; + tmp VARCHAR(512); +BEGIN + tmp = 'SELECT count(*) FROM pyramid_columns WHERE f_table_name = ' || QUOTE_LITERAL(tablename) || + ' and f_geometry_column=' || QUOTE_LITERAL(columnname) || ' and f_schema_name =' || QUOTE_LITERAL(schemaname) ; + execute tmp into ret; + return ret != 0; +END; +$$ + LANGUAGE 'plpgsql' VOLATILE STRICT; + + +CREATE OR REPLACE FUNCTION ST_DeletePyramid(schemaname text, tablename text, columnname text) + RETURNS void + AS $$ + DECLARE + tmp VARCHAR(512); + rec record; +BEGIN + tmp:= 'select * from pyramid_columns where f_table_name = ' || QUOTE_LITERAL(tablename) || + ' and f_geometry_column =' || QUOTE_LITERAL(columnname) || ' and f_schema_name =' || QUOTE_LITERAL(schemaname); + + FOR rec IN EXECUTE tmp LOOP + -- tmp := 'DROP TABLE '|| quote_ident(rec.f_pyramid_table_name) || ' CASCADE;'; + -- 删除数据表 + EXECUTE 'DROP TABLE IF EXISTS '|| quote_ident(rec.f_schema_name) || '.' ||quote_ident(rec.f_pyramid_table_name) || ' CASCADE;'; + -- 删除元信息表中的记录 + EXECUTE 'DELETE from pyramid_columns where f_schema_name='|| quote_literal(rec.f_schema_name) || ' and f_pyramid_table_name=' ||quote_literal(rec.f_pyramid_table_name); + + END LOOP; +END; +$$ +LANGUAGE 'plpgsql' VOLATILE STRICT; + +-- 为了使与 opengauss 保持兼容,不使用触发器 + +-- /* +-- * 创建触发器函数,用于当删除数据表时,同时删除 pyramid 表 +-- * 当手动删除 pyramid 表时,删除 pyramid_columns 中的记录 +-- */ + +-- CREATE OR REPLACE FUNCTION drop_pyramid_table_trigger_function() +-- RETURNS EVENT_TRIGGER +-- LANGUAGE PLPGSQL AS +-- $$ +-- DECLARE +-- obj record; +-- tablename record; +-- sql_text text; +-- BEGIN +-- FOR obj in SELECT * FROM pg_event_trigger_dropped_objects() +-- LOOP +-- -- 如果当前删除的是一个表 +-- IF obj.object_type = 'table' then +-- -- 在元信息表中查找当前表是否有 pyramid 的表 +-- FOR tablename in SELECT f_pyramid_table_name FROM pyramid_columns WHERE f_table_name = obj.object_name +-- LOOP +-- -- 删除表 +-- sql_text = 'DROP TABLE IF EXISTS ' || quote_ident(tablename.f_pyramid_table_name) || ' CASCADE'; +-- EXECUTE sql_text; +-- -- 删除 pyramid_columns 中的记录 +-- sql_text = 'DELETE FROM pyramid_columns WHERE f_table_name = ' || +-- quote_literal(obj.object_name); +-- EXECUTE sql_text; +-- END LOOP; +-- -- 查找当前的表是否是 pyramid 的表 +-- FOR tablename in SELECT f_pyramid_table_name FROM pyramid_columns WHERE f_pyramid_table_name = obj.object_name +-- LOOP +-- -- 删除 pyramid_columns 中的记录 +-- sql_text = 'DELETE FROM pyramid_columns WHERE f_pyramid_table_name = ' || +-- quote_literal(obj.object_name); +-- EXECUTE sql_text; +-- END LOOP; + +-- END IF; +-- END LOOP; +-- END; +-- $$; + + +-- /* +-- * 创建触发器 +-- */ +-- CREATE EVENT TRIGGER drop_pyramid_triger +-- ON sql_drop +-- EXECUTE FUNCTION drop_pyramid_table_trigger_function(); + + + + +CREATE OR REPLACE FUNCTION ST_BuildTile(schemaname text, tablename text, columnname text, maxlevel int) +RETURNS boolean + AS '$libdir/yukon_vector_pyramid-1.0','buildTile' +LANGUAGE 'c' VOLATILE ; + +CREATE OR REPLACE FUNCTION ST_UpdatePyramid(schemaname text, tablename text, columnname text, updateextent BOX2D, maxlevel int) +RETURNS boolean + AS '$libdir/yukon_vector_pyramid-1.0','updatePyramid' +LANGUAGE 'c' VOLATILE ; + + + +CREATE OR REPLACE FUNCTION ST_AsTile(schemaname text, tablename text, columnname text, z int8, x int8, y int8) + RETURNS bytea +AS +$$ +DECLARE + sql VARCHAR(512); + pydtable text; + id bigint; + cnt int8; + srid int8; + res bytea; +BEGIN + -- 检查是否包含 geometry 数据 + sql = 'select count(*) from geometry_columns where f_table_schema=' || quote_literal(schemaname) || + ' and f_table_name=' || quote_literal(tablename) || ' and f_geometry_column = ' || quote_literal(columnname); + EXECUTE sql into cnt; + + if cnt = 0 then + raise '% is not a geometry table',tablename; + end if; + + -- 获取 srid,目前只支持 4326 和 3857 坐标系 + sql = 'select srid from geometry_columns where f_table_schema=' || quote_literal(schemaname) || + ' and f_table_name=' || quote_literal(tablename) || ' and f_geometry_column = ' || quote_literal(columnname); + EXECUTE sql into srid; + + if srid != 4326 and srid != 3857 then + raise 'only support 4326 or 3857 coordinate'; + end if; + + -- 先检查瓦片表是否存在 + pydtable := 'tile_' || tablename || '_' || columnname; + + sql := 'select count(*) from pg_class where relnamespace = (select oid from pg_namespace where nspname =' || + quote_literal(schemaname) || ') and relname = ' || quote_literal(pydtable); + EXECUTE sql into cnt; + -- 说明不存在矢量金字塔表,则直接生成 + if cnt = 0 then + -- 这里我们提示没有矢量金字塔表 + raise '% does not have a pyramid table',tablename; + end if; + + -- 这里我们组装 ld + id = (z * pow(2, 50))::bigint + (x * pow(2, 25))::bigint + y; + + -- 检查一下在矢量金字塔表中是否存在相应的数据 + sql := 'select count(*) from ' || quote_ident(schemaname) || '.' || quote_ident(pydtable) || ' where id = ' || id; + EXECUTE sql into cnt; + if cnt = 0 then + -- 这是我们根据原表直接生成 + if srid = 3857 then + sql := 'WITH mvtgeom AS ( SELECT ST_AsMVTGeom(' || quote_ident(columnname) + || ', ST_TileEnvelope( ' || z || ',' || x || ',' || y || ')) AS geom FROM ' + || quote_ident(schemaname) || '.' || quote_ident(tablename) || + ' WHERE ' || quote_ident(columnname) || ' && ST_TileEnvelope(' || z || ',' || x || ',' || y || ') + ) SELECT ST_AsMVT(mvtgeom.*) FROM mvtgeom;'; + raise notice 'generate:z:%,x:%,y:%',z,x,y; + execute sql into res; + return res; + else + sql := 'WITH mvtgeom AS ( SELECT ST_AsMVTGeom(' + || quote_ident(columnname) + || ', ST_TileEnvelope( ' || z || ',' || x || ',' || y || + ',ST_MakeEnvelope(-180, -270, 180, 90, 4326))) AS geom FROM ' + || quote_ident(schemaname) || '.' || quote_ident(tablename) || + ' WHERE ' || quote_ident(columnname) || ' && ST_TileEnvelope(' || z || ',' || x || ',' || y || ',ST_MakeEnvelope(-180, -270, 180, 90, 4326)) + ) SELECT ST_AsMVT(mvtgeom.*) FROM mvtgeom;'; + raise notice 'generate:z:%,x:%,y:%',z,x,y; + execute sql into res; + return res; + + end if; + + else + sql := 'select mvt from ' || quote_ident(pydtable) || ' where id = ' || id; + execute sql into res; + return res; + end if; +END ; +$$ + LANGUAGE 'plpgsql' VOLATILE + STRICT; diff --git a/pyramid/yukon_vector_pyramid.control b/pyramid/yukon_vector_pyramid.control new file mode 100644 index 0000000000000000000000000000000000000000..c26c84848825ae85db57226f21a4cc0c65649323 --- /dev/null +++ b/pyramid/yukon_vector_pyramid.control @@ -0,0 +1,4 @@ +comment = 'yukon vector pyramid extension' +default_version = '1.0' +module_pathname = '$libdir/yukon_vector_pyramid' +relocatable = true \ No newline at end of file diff --git a/regress/core/geosotgrid.sql b/regress/core/geosotgrid.sql index 813a1de37c2d1ecda25250509037ac0fe95161ca..36d61b3ac06911c9cca9d16dc976aa07aab365e5 100644 --- a/regress/core/geosotgrid.sql +++ b/regress/core/geosotgrid.sql @@ -11,7 +11,8 @@ SELECT array_length(ST_GeoSOTGrid(ST_GeomFromText('MULTIPOLYGON (((118.359498893 , 4490),21),1); SELECT array_length(ST_GeoSOTGrid(ST_GeomFromText('MULTIPOLYGON (((118.35949889355601 32.809604400008496, 118.3596968618916 32.80899202183754, 118.36005349666094 32.80884561755304, 118.36015229494569 32.808626677902716, 118.36024493713795 32.80773313835468, 118.35949253782682 32.80670413084837, 118.35893288492495 32.80643149145906, 118.35751703332369 32.806579511199594, 118.35615747606215 32.8060163603961, 118.35418359442757 32.804396609811384, 118.35282058834792 32.803587297409116, 118.35244144512224 32.8035175550485, 118.35090752871746 32.8023351312754, 118.35072802536008 32.80187092749049, 118.35091050036917 32.80160357415574, 118.35142165097149 32.801358943886335, 118.35366635578647 32.80135552336618, 118.35422709418016 32.80149567982458, 118.35470444942315 32.80230636119275, 118.35545532453452 32.802615191262255, 118.35656425412338 32.80133257225893, 118.35669433503853 32.799987605568575, 118.35654785736406 32.79989209844715, 118.35726091847559 32.79896504479679, 118.35937304927371 32.798323618288386, 118.35983538405011 32.79845055675622, 118.35995818220293 32.798897115870545, 118.35918005313671 32.799819137943445, 118.35883837023526 32.800667549690495, 118.35925471580393 32.80115923666334, 118.35928027231374 32.80144182485759, 118.3590032287468 32.801715756868056, 118.35840602697569 32.80192179776719, 118.35833385597145 32.80215895070426, 118.35834077483098 32.80264669159818, 118.35878019020589 32.80293776141729, 118.35914577819572 32.802777660489134, 118.35941978011473 32.802157294376414, 118.36017094645557 32.80129915643249, 118.36016261862042 32.80115785413548, 118.35958090074342 32.800839643196376, 118.35989508324036 32.80018729345609, 118.36080400435365 32.79993518769732, 118.36148851267502 32.800148397255704, 118.361991548273 32.800115721942774, 118.36249513453646 32.79952044012142, 118.36249548189984 32.80011015001076, 118.362840008422 32.80057497170332, 118.36307405655556 32.80167398906179, 118.36340833954192 32.801722408938126, 118.36314489762128 32.8026198983897, 118.36308073989748 32.80373388338926, 118.36339701668454 32.80486181835052, 118.36388741228778 32.805765535128415, 118.3638337932425 32.806526568217286, 118.36318570790408 32.80721409672573, 118.36298784687922 32.80769134074979, 118.36190120397042 32.808175750170264, 118.36152711488313 32.80799892206737, 118.36104199655972 32.80719409713123, 118.36100342856014 32.80760130112362, 118.36123355931069 32.808266922006375, 118.36072981596779 32.80925064251398, 118.36003742358405 32.80984204416404, 118.35949889355601 32.809604400008496)))' , 4490),20),1); --- +--网格编码正确性 +SELECT array_length(ST_GeoSOTGrid(st_makeenvelope(115.605179,39.602211,116.782204,40.494509,4490),18),1); SELECT array_length(ST_GeoSOTGrid(st_makeenvelope(115.605179,39.602211,116.782204,40.494509,4490),22),1); SELECT array_length(ST_GeoSOTGridAgg(st_makeenvelope(115.605179,39.602211,116.782204,40.494509,4490),22,1),1); SELECT array_length(ST_GeoSOTGridAgg(st_makeenvelope(115.605179,39.602211,116.782204,40.494509,4490),21,1),1); @@ -66,4 +67,25 @@ SELECT ST_GeoSOTGridAgg(ST_MAKEENVELOPE(0, 0, 1, 1, 4490), 15, 9) @> ST_GeoSOTGr with a as (select unnest(ST_GeoSOTGrid(ST_GeomFromText('POLYGON ((115.68333333333334 39.833333333333336, 115.68333333333334 39.85, 115.7 39.85, 115.7 39.833333333333336, 115.68333333333334 39.833333333333336))',4490),18)) grid) select count(*) from a where array [ST_GeoSOTGridFromText('G001310233-321021')]&&array[a.grid] ; with a as (select unnest(ST_GeoSOTGridAgg(ST_GeomFromText('POLYGON ((115.68333333333334 39.833333333333336, 115.68333333333334 39.85, 115.7 39.85, 115.7 39.833333333333336, 115.68333333333334 39.833333333333336))',4490),18,16)) grid) -select count(*) from a where array [ST_GeoSOTGridFromText('G001310233-321021')]&&array[a.grid] ; \ No newline at end of file +select count(*) from a where array [ST_GeoSOTGridFromText('G001310233-321021')]&&array[a.grid] ; + +---- GiST index +CREATE or replace function testidx_grids_15_create() returns boolean +LANGUAGE 'plpgsql' AS $$ +BEGIN + create table testidx_grids_15(id serial4,grid _geosotgrid); + insert into testidx_grids_15(grid) SELECT array[unnest(ST_GeoSOTGrid(st_makeenvelope(115.605179,39.602211,116.782204,40.494509,4490),15))] as grid; + create index testidx_grids_15_grididx on testidx_grids_15 using gin(grid); + + create table testidx_select(id serial4,grids _geosotgrid); + insert into testidx_select(grids) SELECT ST_GeoSOTGrid(st_geomfromgeosotgrid(ST_GeoSOTGridFromText('G001310233-321021')),18) ; + insert into testidx_select(grids) SELECT array[ST_GeoSOTGridFromText('G001310233-301301')]; + insert into testidx_select(grids) select array_append (grids,ST_GeoSOTGridFromText('G001310233-301401') ) from testidx_select where id=2; + + return true; +END; +$$; +select testidx_grids_15_create(); +select count(*) from testidx_grids_15,testidx_select a where testidx_grids_15.grid &&a.grids; + +---- BTREE index \ No newline at end of file diff --git a/regress/core/geosotgrid_expected b/regress/core/geosotgrid_expected index ac5154aaa7de0161c534c742d946c72faec12dad..8a114b3473d285faf516307d6c2eba798f0d1b4e 100644 --- a/regress/core/geosotgrid_expected +++ b/regress/core/geosotgrid_expected @@ -5,6 +5,7 @@ 524 980 271 +242950 54460350 49050 27576 @@ -48,3 +49,5 @@ f f 64 4 +t +3 diff --git a/regress/core/tests.mk.in b/regress/core/tests.mk.in index b751498e086492bca27a7c666a1e4ac007777691..eabc61ddf4bd7e26b1c96d29eed3303da1b2e308 100644 --- a/regress/core/tests.mk.in +++ b/regress/core/tests.mk.in @@ -203,4 +203,5 @@ ifeq (@HAVE_PROTOBUF@,yes) endif TESTS += \ $(topsrcdir)/regress/core/geomodel \ - $(topsrcdir)/regress/core/geosotgrid + $(topsrcdir)/regress/core/geosotgrid \ + $(topsrcdir)/regress/core/vector_pyramid diff --git a/regress/core/vector_pyramid.sql b/regress/core/vector_pyramid.sql new file mode 100644 index 0000000000000000000000000000000000000000..5d1bae09f246c535ace775b95cdd396394a1335f --- /dev/null +++ b/regress/core/vector_pyramid.sql @@ -0,0 +1,39 @@ +----create table---- + +CREATE TABLE geometry_point(id serial, geog geometry(geometry, 4326) ); + +with a as (select id, (random()*10)::float x, (random()*10)::float y from generate_series(1,10000) t(id)) insert into geometry_point select id, ST_MakePoint(165+x, 30+y) from a; + +----create Pyramid----- +select ST_BuildPyramid('public','geometry_point', + 'geog', + '[{ "level": 5,"attribute": ["id"] },{ "level": 6,"attribute": ["id"] }]'); +----create Tile---- +select ST_BuildTile('public','geometry_point','geog',6); + +----information---- +select yukon_pyramid_version(); + +select ST_HasPyramid('public', 'geometry_point', 'geog'); + +select ST_ListPyramid('public', 'geometry_point', 'geog'); + +select count(*) from tile_geometry_point_geog; + +----update---- +with a as (select id, (random()*5)::float x, (random()*5)::float y from generate_series(1,70000) t(id)) insert into geometry_point select id, ST_MakePoint(165+x, 30+y) from a; + +select ST_UpdatePyramid('public', 'geometry_point', 'geog', 'BOX(165 30,170 35)'::box2d, 6); + +select count(*) from tile_geometry_point_geog; + +select ST_UpdatePyramid('public', 'geometry_point', 'geog', 'BOX(165 30,170 35)'::box2d, 7); + +select count(*) from tile_geometry_point_geog; + +----Tile---- +select LENGTH(st_astile('public','geometry_point','geog',4,15,2)); + +----delete---- +select ST_DeletePyramid('public', 'geometry_point', 'geog'); +select ST_HasPyramid('public', 'geometry_point', 'geog'); \ No newline at end of file diff --git a/regress/core/vector_pyramid_expected b/regress/core/vector_pyramid_expected new file mode 100644 index 0000000000000000000000000000000000000000..e9b29200909329c29ae23faaa4fce5577df1f566 --- /dev/null +++ b/regress/core/vector_pyramid_expected @@ -0,0 +1,13 @@ +t +t +yukon_pyramid 1.0.0 Compiled at: 2023-06-16 17:18:04 Commit ID:27246b1 +t +{ "level": 5, "resolution": 0.02197265625, "filter": "null", "attribute": [ "id" ] } +{ "level": 6, "resolution": 0.010986328125, "filter": "null", "attribute": [ "id" ] } +2 +t +12 +t +20 +880018 +f diff --git a/regress/run_test.pl b/regress/run_test.pl index 93543f05c66b4948d110cfa161c52def2763e81f..1988998b3e4862a64aac6dd211eab025b64ad876 100755 --- a/regress/run_test.pl +++ b/regress/run_test.pl @@ -1493,6 +1493,14 @@ sub prepare_spatial_extensions fail "Error encountered creating extension yukon_geogridcoder", $REGRESS_LOG; die; } + + $sql = "create extension yukon_vector_pyramid"; + $cmd = "psql $psql_opts -c \"". $sql . "\" $DB >> $REGRESS_LOG 2>&1"; + my $rv = system($cmd); + if ( $rv ) { + fail "Error encountered creating extension yukon_vector_pyramid", $REGRESS_LOG; + die; + } return 1; } diff --git a/utils/Makefile.in b/utils/Makefile.in index b6cbbad6ee765da8f536a4d0020817efe2701d49..383de63ad51dd687b2e649320c95666081a4abc4 100644 --- a/utils/Makefile.in +++ b/utils/Makefile.in @@ -18,7 +18,7 @@ MODULE_doc=postgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@ MODULEDIR=contrib/$(MODULE_doc) # Files to be copied to the contrib/ directory -DATA_built=postgis_restore.pl +DATA_built=postgis_restore.pl yk_tool # PGXS information PG_CONFIG := @PG_CONFIG@ @@ -77,15 +77,18 @@ postgis_restore.pl: postgis_restore.pl.in uname_m = $(shell uname -m) LD_FLAGS.x86_64 = ../geomodel/libUGC/Builds/MakeProject/Bin64_Linux LD_FLAGS.aarch64 = ../geomodel/libUGC/Builds/MakeProject/Binaarch64_Linux -LD_FLAGS += $(LD_FLAGS.$(uname_m)) @YUKON_LICENSE_LDFLAGS@ - +LD_FLAGS += $(LD_FLAGS.$(uname_m)) -lYkToolkit -lYkStream -D_UGUNICODE -lYkBase -lYkLicense COMPILETIME = $(shell date +"%Y-%m-%d %H:%M:%S") COMMITID = $(shell git show -s --pretty=format:%h) +ifeq (@CHECK_GEOGRIDCODER@,yes) yk_tool:yk_tool.cpp - g++ -std=c++11 $^ -DCOMPILEINFO="\" compiled at:$(COMPILETIME)\"""\" commit id:$(COMMITID) \"" -o $@ - + g++ -std=c++11 $^ -I../geomodel/libUGC/Include -L$(LD_FLAGS) -DCOMPILEINFO="\" compiled at:$(COMPILETIME)\"""\" commit id:$(COMMITID) \"" -o $@ +else +yk_tool:yk_tool.cpp + echo "yk_tool must be compile after geomodel compiled." +endif distclean: clean rm -f Makefile diff --git a/utils/yk_tool.cpp b/utils/yk_tool.cpp index 191633a99aa7c83abbcea907f64952d02bd7d8ba..cfa1ae93e662398c3efdf39def1cc9fe5022c7db 100644 --- a/utils/yk_tool.cpp +++ b/utils/yk_tool.cpp @@ -9,610 +9,688 @@ #include #include -#define YUKONVERSION "Yukon 1.0.1(Community Edition)" +#include "../postgis_config.h" + +#include "Toolkit/YkLicenseRSA.h" + #define YUKONDEPFILE "yukondepfile.txt" +#define YUKONPKGFILE "yukonpkgfile.txt" +#define YUKONSQLFILE "yukonsqlfile.txt" + +#define YUKONVERSION "Yukon 2.0(Community Edition)" + enum class InfoLevel { - VERSION, - INFO, - WARNING, - ERROR + VERSION, + INFO, + WARNING, + ERROR }; enum class ErrorCode : int { - E0000, // no error - E0001, // pg_config 命令未找到,或运行不正确 - E0002, // pg_config --pkglibdir 命令错误,一般情况下不会出错 - E0003, // pg_config --sharedir 命令错误,一般情况下不会出错 - E0004, // pg_config --bindir 命令错误,一般情况下不会出错 - E0005, // pg_config --libdir 命令错误,一般情况下不会出错 - E0006, // 拷贝文件到 pkglibdir 错误 - E0007, // 拷贝文件到 sharedir 错误 - E0008, // 拷贝第三方依赖库到 libdir 错误 - E0009, // 将文件写入到 YKDEPFILE 错误 - E0010, // 拷贝文件到 bindir 错误 + E0000, // no error + E0001, // pg_config 命令未找到,或运行不正确 + E0002, // pg_config --pkglibdir 命令错误,一般情况下不会出错 + E0003, // pg_config --sharedir 命令错误,一般情况下不会出错 + E0004, // pg_config --bindir 命令错误,一般情况下不会出错 + E0005, // pg_config --libdir 命令错误,一般情况下不会出错 + E0006, // 拷贝文件到 pkglibdir 错误 + E0007, // 拷贝文件到 sharedir 错误 + E0008, // 拷贝第三方依赖库到 libdir 错误 + E0009, // 将文件写入到 YKDEPFILE 错误 + E0010, // 拷贝文件到 bindir 错误 }; std::string codeGetString(ErrorCode code) { - switch (code) - { - case ErrorCode::E0001: - return std::string("E0001"); - case ErrorCode::E0002: - return std::string("E0002"); - case ErrorCode::E0003: - return std::string("E0003"); - case ErrorCode::E0004: - return std::string("E0004"); - case ErrorCode::E0005: - return std::string("E0005"); - case ErrorCode::E0006: - return std::string("E0006"); - case ErrorCode::E0007: - return std::string("E0007"); - case ErrorCode::E0008: - return std::string("E0008"); - case ErrorCode::E0009: - return std::string("E0009"); - case ErrorCode::E0010: - return std::string("E0010"); - default: - return std::string(); - } - - return std::string(); + switch (code) + { + case ErrorCode::E0001: + return std::string("E0001"); + case ErrorCode::E0002: + return std::string("E0002"); + case ErrorCode::E0003: + return std::string("E0003"); + case ErrorCode::E0004: + return std::string("E0004"); + case ErrorCode::E0005: + return std::string("E0005"); + case ErrorCode::E0006: + return std::string("E0006"); + case ErrorCode::E0007: + return std::string("E0007"); + case ErrorCode::E0008: + return std::string("E0008"); + case ErrorCode::E0009: + return std::string("E0009"); + case ErrorCode::E0010: + return std::string("E0010"); + default: + return std::string(); + } + + return std::string(); } std::string codeGetString(InfoLevel level) { - switch (level) - { - case InfoLevel::VERSION: - return std::string("VERSION"); - case InfoLevel::INFO: - return std::string("INFO"); - case InfoLevel::WARNING: - return std::string("WARNING"); - case InfoLevel::ERROR: - return std::string("ERROR"); - default: - return std::string(); - } - return std::string(); + switch (level) + { + case InfoLevel::VERSION: + return std::string("VERSION"); + case InfoLevel::INFO: + return std::string("INFO"); + case InfoLevel::WARNING: + return std::string("WARNING"); + case InfoLevel::ERROR: + return std::string("ERROR"); + default: + return std::string(); + } + return std::string(); } -void -log(InfoLevel level, std::string msg, ErrorCode code = ErrorCode::E0000) +void log(InfoLevel level, std::string msg, ErrorCode code = ErrorCode::E0000) { - // 输出消息类型 - if (level == InfoLevel::INFO) - { - std::cout << "\033[32m" << codeGetString(level) << "\033[0m" - << ":"; - } - else if (level == InfoLevel::WARNING) - { - std::cout << "\033[33m" << codeGetString(level) << "\033[0m" - << ":"; - } - else if (level == InfoLevel::ERROR) - { - std::cout << "\033[31m" << codeGetString(level) << "\033[0m" - << ":"; - } - - // 如果错误码不是 E0000,则输出 - if (code != ErrorCode::E0000) - { - std::cout << codeGetString(code) << ":"; - } - - // 输出最多 100 个字符的信息 - if (msg.length() > 100) - { - msg = msg.substr(0, 100); - } - - std::cout << msg << std::endl; + // 输出消息类型 + if (level == InfoLevel::INFO) + { + std::cout << "\033[32m" << codeGetString(level) << "\033[0m" + << ":"; + } + else if (level == InfoLevel::WARNING) + { + std::cout << "\033[33m" << codeGetString(level) << "\033[0m" + << ":"; + } + else if (level == InfoLevel::ERROR) + { + std::cout << "\033[31m" << codeGetString(level) << "\033[0m" + << ":"; + } + + // 如果错误码不是 E0000,则输出 + if (code != ErrorCode::E0000) + { + std::cout << codeGetString(code) << ":"; + } + + // 输出最多 100 个字符的信息 + if (msg.length() > 100) + { + msg = msg.substr(0, 100); + } + + std::cout << msg << std::endl; } std::string exec(const char *cmd) { - char buffer[128]; - std::string result = ""; - FILE *pipe = popen((std::string(cmd) + " 2>&1").c_str(), "r"); - if (!pipe) - throw std::runtime_error("popen() failed!"); - try - { - while (fgets(buffer, sizeof buffer, pipe) != NULL) - { - result += buffer; - } - } - catch (...) - { - pclose(pipe); - std::cout << "command error" << std::endl; - } - pclose(pipe); - return result; + char buffer[128]; + std::string result = ""; + FILE *pipe = popen((std::string(cmd) + " 2>&1").c_str(), "r"); + if (!pipe) + throw std::runtime_error("popen() failed!"); + try + { + while (fgets(buffer, sizeof buffer, pipe) != NULL) + { + result += buffer; + } + } + catch (...) + { + pclose(pipe); + std::cout << "command error" << std::endl; + } + pclose(pipe); + return result; } -int -install(std::string pkg) +int install(std::string pkg) { - std::string databasetype; - std::string databasever; - std::string pkglibdir; - std::string sharedir; - std::string bindir; - std::string libdir; - - // 获取当前系统环境 - // getosenv(); - log(InfoLevel::INFO, "install precheck..."); - std::string pgconfigpath; - // 执行 pg_config 命令,获取 - if (!pkg.empty()) - { - pgconfigpath = pkg; - log(InfoLevel::INFO, "user specified pg_config path: " + pgconfigpath); - } - else - { - pgconfigpath = "pg_config"; - } - - // 1. 数据库版本 - std::string ret; - ret = exec((pgconfigpath + std::string(" --version")).c_str()); - - // 命令错误 - if (ret.find("sh") != std::string::npos) - { - log(InfoLevel::ERROR, "pg_config command is not valid," + ret, ErrorCode::E0001); - return -1; - } - else - { - // 否则解析数据库类型和版本 - // 首先检查是否是 openGauss/GaussDB 数据库 - std::regex reggs("(opengauss|gaussdb).*", std::regex::icase); - std::regex regpg("PostgreSQL.*", std::regex::icase); - std::smatch results; - if (std::regex_search(ret, results, reggs)) - { - std::string db = results[0]; - if (db.at(db.size() - 1) == '\n') - { - db.erase(db.size() - 1); - } - int pos = db.find(' '); - databasetype = db.substr(0, pos); - databasever = db.substr(pos + 1, db.size() - 1); - - } // 然后检查是否是 postgresql 数据库 - else if (std::regex_search(ret, results, regpg)) - { - std::string db = results[0]; - if (db.at(db.size() - 1) == '\n') - { - db.erase(db.size() - 1); - } - int pos = db.find(' '); - databasetype = db.substr(0, pos); - databasever = db.substr(pos + 1, db.size() - 1); - } - else - { - std::cerr << "Not Supported Database" << std::endl; - return -1; - } - // 然后检查是否是 postgres 数据库 - log(InfoLevel::INFO, "database:" + databasetype); - log(InfoLevel::INFO, "version:" + databasever); - } - - // pkglibdir - ret = exec((pgconfigpath + std::string(" --pkglibdir")).c_str()); - if (ret.empty()) - { - log(InfoLevel::ERROR, "pkglibdir not find!", ErrorCode::E0002); - return -1; - } - else - { - pkglibdir = ret; - if (pkglibdir.at(pkglibdir.size() - 1) == '\n') - { - pkglibdir.erase(pkglibdir.size() - 1); - } - log(InfoLevel::INFO, "pkglibdir:" + pkglibdir); - } - - // sharedir - ret = exec((pgconfigpath + std::string(" --sharedir")).c_str()); - if (ret.empty()) - { - log(InfoLevel::ERROR, "shareddir not find!", ErrorCode::E0003); - return -1; - } - else - { - sharedir = ret; - if (sharedir.at(sharedir.size() - 1) == '\n') - { - sharedir.erase(sharedir.size() - 1); - } - log(InfoLevel::INFO, "shareddir:" + sharedir); - } - - // bindir - ret = exec((pgconfigpath + std::string(" --bindir")).c_str()); - if (ret.empty()) - { - log(InfoLevel::ERROR, "bindir not find!", ErrorCode::E0004); - return -1; - } - else - { - bindir = ret; - if (bindir.at(bindir.size() - 1) == '\n') - { - bindir.erase(bindir.size() - 1); - } - log(InfoLevel::INFO, "bindir:" + bindir); - } - - // libdir - ret = exec((pgconfigpath + std::string(" --libdir")).c_str()); - if (ret.empty()) - { - log(InfoLevel::ERROR, "libdir not find!", ErrorCode::E0005); - return -1; - } - else - { - libdir = ret; - if (libdir.at(libdir.size() - 1) == '\n') - { - libdir.erase(libdir.size() - 1); - } - log(InfoLevel::INFO, "libdir:" + libdir); - } - - // 开始安装,拷贝文件 - log(InfoLevel::INFO, "start install..."); - - log(InfoLevel::INFO, "install lib file..."); - ret = exec((std::string("cp lib/* ") + pkglibdir + "/").c_str()); - if (!ret.empty()) - { - log(InfoLevel::ERROR, "install lib file failed." + ret, ErrorCode::E0006); - return -1; - } - - log(InfoLevel::INFO, "install extension file..."); - ret = exec((std::string("cp extension/* ") + sharedir + "/extension").c_str()); - - if (!ret.empty()) - { - log(InfoLevel::ERROR, "install extension file failed." + ret, ErrorCode::E0007); - return -1; - } - - // 拷贝三方依赖库文件 - log(InfoLevel::INFO, "install third dependency file..."); - ret = exec("ls yukon_dep"); - std::istringstream inlibsname(ret); - std::ostringstream outlibsname; - std::string libname; - while (inlibsname >> libname) - { - struct stat sb; - int retcode = stat((libdir + "/" + libname).c_str(), &sb); - if (retcode != 0 && errno == ENOENT) - { - // 文件不存在,则拷贝到 libdir 目录 - std::string cmd = (std::string("cp yukon_dep/") + libname + " " + libdir + "/"); - ret = exec(cmd.c_str()); - - if (!ret.empty()) - { - log(InfoLevel::ERROR, "install third dependency file failed" + ret, ErrorCode::E0008); - return -1; - } - - outlibsname << libname << std::endl; - } - } - - // 将安装文件记录到 yukondepfile - std::string path = libdir + "/" + YUKONDEPFILE; - std::ofstream outfile(path, std::ios::out | std::ios::trunc); - if (outfile.is_open()) - { - outfile << outlibsname.str(); - } - else - { - log(InfoLevel::ERROR, "write depenency file failed.", ErrorCode::E0009); - return -1; - } - outfile.close(); - - // 拷贝可执行文件 - ret = exec((std::string("cp ./bin/* ") + bindir + "/").c_str()); - - if (!ret.empty()) - { - log(InfoLevel::ERROR, "copy binary file failed." + ret, ErrorCode::E0010); - return -1; - } - - log(InfoLevel::INFO, "install finished"); - return 0; + std::string databasetype; + std::string databasever; + std::string pkglibdir; + std::string sharedir; + std::string bindir; + std::string libdir; + + // 获取当前系统环境 + // getosenv(); + log(InfoLevel::INFO, "install precheck..."); + std::string pgconfigpath; + // 执行 pg_config 命令,获取 + if (!pkg.empty()) + { + pgconfigpath = pkg; + log(InfoLevel::INFO, "user specified pg_config path: " + pgconfigpath); + } + else + { + pgconfigpath = "pg_config"; + } + + // 1. 数据库版本 + std::string ret; + ret = exec((pgconfigpath + std::string(" --version")).c_str()); + + // 命令错误 + if (ret.find("sh") != std::string::npos) + { + log(InfoLevel::ERROR, "pg_config command is not valid," + ret, ErrorCode::E0001); + return -1; + } + else + { + // 否则解析数据库类型和版本 + // 首先检查是否是 openGauss/GaussDB 数据库 + std::regex reggs("(opengauss|gaussdb).*", std::regex::icase); + std::regex regpg("PostgreSQL.*", std::regex::icase); + std::smatch results; + if (std::regex_search(ret, results, reggs)) + { + std::string db = results[0]; + if (db.at(db.size() - 1) == '\n') + { + db.erase(db.size() - 1); + } + int pos = db.find(' '); + databasetype = db.substr(0, pos); + databasever = db.substr(pos + 1, db.size() - 1); + + } // 然后检查是否是 postgresql 数据库 + else if (std::regex_search(ret, results, regpg)) + { + std::string db = results[0]; + if (db.at(db.size() - 1) == '\n') + { + db.erase(db.size() - 1); + } + int pos = db.find(' '); + databasetype = db.substr(0, pos); + databasever = db.substr(pos + 1, db.size() - 1); + } + else + { + std::cerr << "Not Supported Database" << std::endl; + return -1; + } + // 然后检查是否是 postgres 数据库 + log(InfoLevel::INFO, "database:" + databasetype); + log(InfoLevel::INFO, "version:" + databasever); + } + + // pkglibdir + ret = exec((pgconfigpath + std::string(" --pkglibdir")).c_str()); + if (ret.empty()) + { + log(InfoLevel::ERROR, "pkglibdir not find!", ErrorCode::E0002); + return -1; + } + else + { + pkglibdir = ret; + if (pkglibdir.at(pkglibdir.size() - 1) == '\n') + { + pkglibdir.erase(pkglibdir.size() - 1); + } + log(InfoLevel::INFO, "pkglibdir:" + pkglibdir); + } + + // sharedir + ret = exec((pgconfigpath + std::string(" --sharedir")).c_str()); + if (ret.empty()) + { + log(InfoLevel::ERROR, "shareddir not find!", ErrorCode::E0003); + return -1; + } + else + { + sharedir = ret; + if (sharedir.at(sharedir.size() - 1) == '\n') + { + sharedir.erase(sharedir.size() - 1); + } + log(InfoLevel::INFO, "shareddir:" + sharedir); + } + + // bindir + ret = exec((pgconfigpath + std::string(" --bindir")).c_str()); + if (ret.empty()) + { + log(InfoLevel::ERROR, "bindir not find!", ErrorCode::E0004); + return -1; + } + else + { + bindir = ret; + if (bindir.at(bindir.size() - 1) == '\n') + { + bindir.erase(bindir.size() - 1); + } + log(InfoLevel::INFO, "bindir:" + bindir); + } + + // libdir + ret = exec((pgconfigpath + std::string(" --libdir")).c_str()); + if (ret.empty()) + { + log(InfoLevel::ERROR, "libdir not find!", ErrorCode::E0005); + return -1; + } + else + { + libdir = ret; + if (libdir.at(libdir.size() - 1) == '\n') + { + libdir.erase(libdir.size() - 1); + } + log(InfoLevel::INFO, "libdir:" + libdir); + } + + // 开始安装,拷贝文件 + log(InfoLevel::INFO, "start install..."); + + log(InfoLevel::INFO, "install lib file..."); + ret = exec((std::string("cp lib/* ") + pkglibdir + "/").c_str()); + if (!ret.empty()) + { + log(InfoLevel::ERROR, "install lib file failed." + ret, ErrorCode::E0006); + return -1; + } + + log(InfoLevel::INFO, "install extension file..."); + ret = exec((std::string("cp extension/* ") + sharedir + "/extension").c_str()); + + if (!ret.empty()) + { + log(InfoLevel::ERROR, "install extension file failed." + ret, ErrorCode::E0007); + return -1; + } + + // 拷贝三方依赖库文件 + log(InfoLevel::INFO, "install third dependency file..."); + ret = exec("ls yukon_dep"); + std::istringstream inlibsname(ret); + std::ostringstream outlibsname; + std::string libname; + while (inlibsname >> libname) + { + struct stat sb; + int retcode = stat((libdir + "/" + libname).c_str(), &sb); + if (retcode != 0 && errno == ENOENT) + { + // 文件不存在,则拷贝到 libdir 目录 + std::string cmd = (std::string("cp yukon_dep/") + libname + " " + libdir + "/"); + ret = exec(cmd.c_str()); + + if (!ret.empty()) + { + log(InfoLevel::ERROR, "install third dependency file failed" + ret, ErrorCode::E0008); + return -1; + } + + outlibsname << libname << std::endl; + } + } + + // 将安装文件记录到 yukondepfile + std::string path = libdir + "/" + YUKONDEPFILE; + std::ofstream outfile(path, std::ios::out | std::ios::trunc); + if (outfile.is_open()) + { + outfile << outlibsname.str(); + } + else + { + log(InfoLevel::ERROR, "write depenency file failed.", ErrorCode::E0009); + return -1; + } + outfile.close(); + + // 拷贝可执行文件 + ret = exec((std::string("cp ./bin/* ") + bindir + "/").c_str()); + + if (!ret.empty()) + { + log(InfoLevel::ERROR, "copy binary file failed." + ret, ErrorCode::E0010); + return -1; + } + + log(InfoLevel::INFO, "install finished"); + return 0; } -int -uninstall(std::string pkg) +int uninstall(std::string pkg) { - std::string databasetype; - std::string databasever; - std::string pkglibdir; - std::string sharedir; - std::string bindir; - std::string libdir; - log(InfoLevel::INFO, "uninstall precheck..."); - std::string pgconfigpath; - // 执行 pg_config 命令,获取 - if (!pkg.empty()) - { - pgconfigpath = pkg; - log(InfoLevel::INFO, "user specified pg_config path: " + pgconfigpath); - } - else - { - pgconfigpath = "pg_config"; - } - - // 1. 数据库版本 - std::string ret; - ret = exec((pgconfigpath + std::string(" --version")).c_str()); - - // 命令错误 - if (ret.find("sh") != std::string::npos) - { - log(InfoLevel::ERROR, "pg_config command not valid," + ret, ErrorCode::E0001); - return -1; - } - else - { - // 否则解析数据库类型和版本 - // 首先检查是否是 openGauss/GaussDB 数据库 - std::regex reggs("(opengauss|gaussdb).*", std::regex::icase); - std::regex regpg("PostgreSQL.*", std::regex::icase); - std::smatch results; - if (std::regex_search(ret, results, reggs)) - { - std::string db = results[0]; - if (db.at(db.size() - 1) == '\n') - { - db.erase(db.size() - 1); - } - int pos = db.find(' '); - databasetype = db.substr(0, pos); - databasever = db.substr(pos + 1, db.size() - 1); - - } // 然后检查是否是 postgresql 数据库 - else if (std::regex_search(ret, results, regpg)) - { - std::string db = results[0]; - if (db.at(db.size() - 1) == '\n') - { - db.erase(db.size() - 1); - } - int pos = db.find(' '); - databasetype = db.substr(0, pos); - databasever = db.substr(pos + 1, db.size() - 1); - } - else - { - std::cerr << "Not Supported Database" << std::endl; - return -1; - } - // 然后检查是否是 postgres 数据库 - log(InfoLevel::INFO, "database:" + databasetype); - log(InfoLevel::INFO, "version:" + databasever); - } - - // pkglibdir - ret = exec((pgconfigpath + std::string(" --pkglibdir")).c_str()); - if (ret.empty()) - { - log(InfoLevel::ERROR, "pkglibdir not find!", ErrorCode::E0002); - return -1; - } - else - { - pkglibdir = ret; - if (pkglibdir.at(pkglibdir.size() - 1) == '\n') - { - pkglibdir.erase(pkglibdir.size() - 1); - } - log(InfoLevel::INFO, "pkglibdir:" + pkglibdir); - } - - // sharedir - ret = exec((pgconfigpath + std::string(" --sharedir")).c_str()); - if (ret.empty()) - { - log(InfoLevel::ERROR, "shareddir not find!", ErrorCode::E0003); - return -1; - } - else - { - sharedir = ret; - if (sharedir.at(sharedir.size() - 1) == '\n') - { - sharedir.erase(sharedir.size() - 1); - } - log(InfoLevel::INFO, "shareddir:" + sharedir); - } - - // bindir - ret = exec((pgconfigpath + std::string(" --bindir")).c_str()); - if (ret.empty()) - { - log(InfoLevel::ERROR, "bindir not find!", ErrorCode::E0004); - return -1; - } - else - { - bindir = ret; - if (bindir.at(bindir.size() - 1) == '\n') - { - bindir.erase(bindir.size() - 1); - } - log(InfoLevel::INFO, "bindir:" + bindir); - } - - // libdir - ret = exec((pgconfigpath + std::string(" --libdir")).c_str()); - if (ret.empty()) - { - log(InfoLevel::ERROR, "libdir not find!", ErrorCode::E0005); - return -1; - } - else - { - libdir = ret; - if (libdir.at(libdir.size() - 1) == '\n') - { - libdir.erase(libdir.size() - 1); - } - log(InfoLevel::INFO, "libdir:" + libdir); - } - - log(InfoLevel::INFO, "start uninstall..."); - - log(InfoLevel::INFO, "uninstall extension file ..."); - exec(("rm -rf " + sharedir + "/extension/postgis*").c_str()); - exec(("rm -rf " + sharedir + "/extension/yukon*").c_str()); - exec(("rm -rf " + sharedir + "/extension/citus*").c_str()); - exec(("rm -rf " + sharedir + "/extension/ogr_fdw*").c_str()); - exec(("rm -rf " + sharedir + "/extension/oracle_fdw*").c_str()); - exec(("rm -rf " + sharedir + "/extension/postgres_fdw*").c_str()); - - log(InfoLevel::INFO, "uninstall lib file ..."); - exec(("rm -rf " + pkglibdir + "/postgis*").c_str()); - exec(("rm -rf " + pkglibdir + "/yukon*").c_str()); - exec(("rm -rf " + pkglibdir + "/citus*").c_str()); - exec(("rm -rf " + pkglibdir + "/ogr_fdw*").c_str()); - exec(("rm -rf " + pkglibdir + "/oracle_fdw*").c_str()); - exec(("rm -rf " + pkglibdir + "/postgres_fdw*").c_str()); - - log(InfoLevel::INFO, "uninstall binary file ..."); - exec(("rm -rf " + bindir + "/raster2pgsql").c_str()); - exec(("rm -rf " + bindir + "/shp2pgsql").c_str()); - exec(("rm -rf " + bindir + "/pgsql2shp").c_str()); - exec(("rm -rf " + bindir + "/yk_tool").c_str()); - - log(InfoLevel::INFO, "uninstall dependendy file ..."); - - std::string path = libdir + "/" + YUKONDEPFILE; - std::ifstream infile(path, std::ios::in); - - if (infile.is_open()) - { - std::string libname; - while (infile >> libname) - { - exec(("rm -rf " + libdir + "/" + libname).c_str()); - } - // 关闭文件,删除第三方库记录文件 - infile.close(); - exec((std::string("rm -rf ") + path).c_str()); - } - else - { - // 如果找不到,则提示用户 - log(InfoLevel::WARNING, - "yukondepfile file not found,delete third-party dependent library files manually"); - } - - log(InfoLevel::INFO, "uninstall finished"); - - return 0; + std::string databasetype; + std::string databasever; + std::string pkglibdir; + std::string sharedir; + std::string bindir; + std::string libdir; + log(InfoLevel::INFO, "uninstall precheck..."); + std::string pgconfigpath; + // 执行 pg_config 命令,获取 + if (!pkg.empty()) + { + pgconfigpath = pkg; + log(InfoLevel::INFO, "user specified pg_config path: " + pgconfigpath); + } + else + { + pgconfigpath = "pg_config"; + } + + // 1. 数据库版本 + std::string ret; + ret = exec((pgconfigpath + std::string(" --version")).c_str()); + + // 命令错误 + if (ret.find("sh") != std::string::npos) + { + log(InfoLevel::ERROR, "pg_config command not valid," + ret, ErrorCode::E0001); + return -1; + } + else + { + // 否则解析数据库类型和版本 + // 首先检查是否是 openGauss/GaussDB 数据库 + std::regex reggs("(opengauss|gaussdb).*", std::regex::icase); + std::regex regpg("PostgreSQL.*", std::regex::icase); + std::smatch results; + if (std::regex_search(ret, results, reggs)) + { + std::string db = results[0]; + if (db.at(db.size() - 1) == '\n') + { + db.erase(db.size() - 1); + } + int pos = db.find(' '); + databasetype = db.substr(0, pos); + databasever = db.substr(pos + 1, db.size() - 1); + + } // 然后检查是否是 postgresql 数据库 + else if (std::regex_search(ret, results, regpg)) + { + std::string db = results[0]; + if (db.at(db.size() - 1) == '\n') + { + db.erase(db.size() - 1); + } + int pos = db.find(' '); + databasetype = db.substr(0, pos); + databasever = db.substr(pos + 1, db.size() - 1); + } + else + { + std::cerr << "Not Supported Database" << std::endl; + return -1; + } + // 然后检查是否是 postgres 数据库 + log(InfoLevel::INFO, "database:" + databasetype); + log(InfoLevel::INFO, "version:" + databasever); + } + + // pkglibdir + ret = exec((pgconfigpath + std::string(" --pkglibdir")).c_str()); + if (ret.empty()) + { + log(InfoLevel::ERROR, "pkglibdir not find!", ErrorCode::E0002); + return -1; + } + else + { + pkglibdir = ret; + if (pkglibdir.at(pkglibdir.size() - 1) == '\n') + { + pkglibdir.erase(pkglibdir.size() - 1); + } + log(InfoLevel::INFO, "pkglibdir:" + pkglibdir); + } + + // sharedir + ret = exec((pgconfigpath + std::string(" --sharedir")).c_str()); + if (ret.empty()) + { + log(InfoLevel::ERROR, "shareddir not find!", ErrorCode::E0003); + return -1; + } + else + { + sharedir = ret; + if (sharedir.at(sharedir.size() - 1) == '\n') + { + sharedir.erase(sharedir.size() - 1); + } + log(InfoLevel::INFO, "shareddir:" + sharedir); + } + + // bindir + ret = exec((pgconfigpath + std::string(" --bindir")).c_str()); + if (ret.empty()) + { + log(InfoLevel::ERROR, "bindir not find!", ErrorCode::E0004); + return -1; + } + else + { + bindir = ret; + if (bindir.at(bindir.size() - 1) == '\n') + { + bindir.erase(bindir.size() - 1); + } + log(InfoLevel::INFO, "bindir:" + bindir); + } + + // libdir + ret = exec((pgconfigpath + std::string(" --libdir")).c_str()); + if (ret.empty()) + { + log(InfoLevel::ERROR, "libdir not find!", ErrorCode::E0005); + return -1; + } + else + { + libdir = ret; + if (libdir.at(libdir.size() - 1) == '\n') + { + libdir.erase(libdir.size() - 1); + } + log(InfoLevel::INFO, "libdir:" + libdir); + } + + log(InfoLevel::INFO, "start uninstall..."); + + log(InfoLevel::INFO, "uninstall extension file ..."); + { + std::string path = sharedir + "/extension/" + YUKONSQLFILE; + std::ifstream infile(path, std::ios::in); + if (infile.is_open()) + { + std::string libname; + while (infile >> libname) + { + exec(("rm -rf " + libdir + "/extension/" + libname).c_str()); + } + // 关闭文件,删除第三方库记录文件 + infile.close(); + exec((std::string("rm -rf ") + path).c_str()); + } + else + { + // 如果找不到,则提示用户 + log(InfoLevel::WARNING, + "yukonsqlfile file not found,delete sql files manually"); + } + + log(InfoLevel::INFO, "uninstall lib file ..."); + { + std::string path = pkglibdir + "/" + YUKONPKGFILE; + std::ifstream infile(path, std::ios::in); + if (infile.is_open()) + { + std::string libname; + while (infile >> libname) + { + exec(("rm -rf " + pkglibdir + "/" + libname).c_str()); + } + // 关闭文件,删除第三方库记录文件 + infile.close(); + exec((std::string("rm -rf ") + path).c_str()); + } + else + { + // 如果找不到,则提示用户 + log(InfoLevel::WARNING, + "yukonpkgfile file not found,delete pkg files manually"); + } + } + + log(InfoLevel::INFO, "uninstall binary file ..."); + exec(("rm -rf " + bindir + "/raster2pgsql").c_str()); + exec(("rm -rf " + bindir + "/shp2pgsql").c_str()); + exec(("rm -rf " + bindir + "/pgsql2shp").c_str()); + exec(("rm -rf " + bindir + "/yk_tool").c_str()); + + log(InfoLevel::INFO, "uninstall dependendy file ..."); + + { + std::string path = libdir + "/" + YUKONDEPFILE; + std::ifstream infile(path, std::ios::in); + if (infile.is_open()) + { + std::string libname; + while (infile >> libname) + { + exec(("rm -rf " + libdir + "/" + libname).c_str()); + } + // 关闭文件,删除第三方库记录文件 + infile.close(); + exec((std::string("rm -rf ") + path).c_str()); + } + else + { + // 如果找不到,则提示用户 + log(InfoLevel::WARNING, + "yukondepfile file not found,delete third-party dependent library files manually"); + } + } + } + + log(InfoLevel::INFO, "uninstall finished"); + + return 0; } -int -version() +int version() { - - std::ostringstream version; - version << YUKONVERSION; - version << COMPILEINFO; - log(InfoLevel::VERSION, version.str()); - return 0; + std::ostringstream version; + version << YUKONVERSION; + version << COMPILEINFO; + log(InfoLevel::VERSION, version.str()); + return 0; } -int -license() +int license() { - return 0; + std::string licstr = ""; + YkLicenseRSA rsa; + int ret = rsa.Connect(20100); + YkLicFeatureInfo licinfo = rsa.GetFeatureInfo(); + struct tm starttm; + struct tm endtm; + licinfo.m_startTime.GetDateTime(starttm); + licinfo.m_expiredTime.GetDateTime(endtm); + if (0 == ret) + { + licstr += "License validity: "; + licstr += to_string(starttm.tm_year); + licstr += "/"; + licstr += to_string(starttm.tm_mon); + licstr += "/"; + licstr += to_string(starttm.tm_mday); + licstr += "-"; + licstr += to_string(endtm.tm_year); + licstr += "/"; + licstr += to_string(endtm.tm_mon); + licstr += "/"; + licstr += to_string(endtm.tm_mday); + } + // 5001-过期 5002-未开始 + else if (5001 == ret || 5002 == ret) + { + licstr = "Not within the validity period of the license"; + } + //-1-无法使用许可 31-没有许可文件 + else if (-1 == ret || 31 == ret) + { + licstr = "no license file"; + } + // 5006-计算机名不对 5007-特征码不对 + else + { + licstr = "license file is invalid"; + } + + std::cout << licstr << std::endl; + + return 0; } -int -main(int argc, char *argv[]) +int main(int argc, char *argv[]) { - // 禁止使用 root 用户执行本程序 - - std::string ret = exec("echo `id -u`"); - if (!ret.empty() && ret.at(0) == '0') - { - log(InfoLevel::ERROR, "Do not use root user to run this program"); - exit(-1); - } - - cmdline::parser toolparser; - toolparser.add("version", 'v', "Yukon Version Infomation"); - toolparser.add("remove", 'r', "Remove Yukon"); - toolparser.add("install", 'i', "Install Yukon"); - toolparser.add("pkgpath", 0, "pg_config path", false, ""); - - toolparser.parse_check(argc, argv); - - if (argc == 1) - { - std::cout << toolparser.usage(); - return 0; - } - - std::string pgconfigPath = toolparser.get("pkgpath"); - - // boolean flags are referred by calling exist() method. - if (toolparser.exist("version")) - { - version(); - } - if (toolparser.exist("install")) - { - if (install(pgconfigPath) != 0) - { - std::cerr << "Install Failed" << std::endl; - } - } - - if (toolparser.exist("remove")) - { - uninstall(pgconfigPath); - } + // 禁止使用 root 用户执行本程序 + + std::string ret = exec("echo `id -u`"); + if (!ret.empty() && ret.at(0) == '0') + { + log(InfoLevel::ERROR, "Do not use root user to run this program"); + exit(-1); + } + + cmdline::parser toolparser; + toolparser.add("version", 'v', "Yukon Version Infomation"); + toolparser.add("license", 'l', "Yukon License Information"); + toolparser.add("remove", 'r', "Remove Yukon"); + toolparser.add("install", 'i', "Install Yukon"); + toolparser.add("pkgpath", 0, "pg_config path", false, ""); + + toolparser.parse_check(argc, argv); + + if (argc == 1) + { + std::cout << toolparser.usage(); + return 0; + } + + std::string pgconfigPath = toolparser.get("pkgpath"); + + // boolean flags are referred by calling exist() method. + if (toolparser.exist("version")) + { + version(); + } + if (toolparser.exist("install")) + { + if (install(pgconfigPath) != 0) + { + std::cerr << "Install Failed" << std::endl; + } + } + + if (toolparser.exist("remove")) + { + uninstall(pgconfigPath); + } + if (toolparser.exist("license")) + { + license(); + } } \ No newline at end of file