PostGIS  2.4.9dev-r@@SVN_REVISION@@
lwin_wkt.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * PostGIS - Spatial Types for PostgreSQL
4  * http://postgis.net
5  *
6  * PostGIS is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * PostGIS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
18  *
19  **********************************************************************
20  *
21  * Copyright (C) 2010-2015 Paul Ramsey <pramsey@cleverelephant.ca>
22  * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
23  *
24  **********************************************************************/
25 
26 #include "liblwgeom_internal.h"
27 
28 /*
29 * Coordinate object to hold information about last coordinate temporarily.
30 * We need to know how many dimensions there are at any given time.
31 */
32 typedef struct
33 {
35  double x;
36  double y;
37  double z;
38  double m;
39 }
40 POINT;
41 
42 /*
43 * Global that holds the final output geometry for the WKT parser.
44 */
46 extern const char *parser_error_messages[];
47 
48 /*
49 * Prototypes for the lexer
50 */
51 extern void wkt_lexer_init(char *str);
52 extern void wkt_lexer_close(void);
53 extern int wkt_yylex_destroy(void);
54 
55 
56 /*
57 * Functions called from within the bison parser to construct geometries.
58 */
59 int wkt_lexer_read_srid(char *str);
60 POINT wkt_parser_coord_2(double c1, double c2);
61 POINT wkt_parser_coord_3(double c1, double c2, double c3);
62 POINT wkt_parser_coord_4(double c1, double c2, double c3, double c4);
65 LWGEOM* wkt_parser_point_new(POINTARRAY *pa, char *dimensionality);
66 LWGEOM* wkt_parser_linestring_new(POINTARRAY *pa, char *dimensionality);
67 LWGEOM* wkt_parser_circularstring_new(POINTARRAY *pa, char *dimensionality);
68 LWGEOM* wkt_parser_triangle_new(POINTARRAY *pa, char *dimensionality);
69 LWGEOM* wkt_parser_polygon_new(POINTARRAY *pa, char dimcheck);
70 LWGEOM* wkt_parser_polygon_add_ring(LWGEOM *poly, POINTARRAY *pa, char dimcheck);
71 LWGEOM* wkt_parser_polygon_finalize(LWGEOM *poly, char *dimensionality);
74 LWGEOM* wkt_parser_curvepolygon_finalize(LWGEOM *poly, char *dimensionality);
79 LWGEOM* wkt_parser_collection_finalize(int lwtype, LWGEOM *col, char *dimensionality);
80 void wkt_parser_geometry_new(LWGEOM *geom, int srid);
81 
double x
Definition: lwin_wkt.h:35
LWGEOM * wkt_parser_polygon_finalize(LWGEOM *poly, char *dimensionality)
Definition: lwin_wkt.c:535
LWGEOM * wkt_parser_triangle_new(POINTARRAY *pa, char *dimensionality)
Definition: lwin_wkt.c:424
double m
Definition: lwin_wkt.h:38
LWGEOM * wkt_parser_collection_add_geom(LWGEOM *col, LWGEOM *geom)
Definition: lwin_wkt.c:791
LWGEOM * wkt_parser_point_new(POINTARRAY *pa, char *dimensionality)
Create a new point.
Definition: lwin_wkt.c:320
int wkt_yylex_destroy(void)
LWGEOM * wkt_parser_polygon_add_ring(LWGEOM *poly, POINTARRAY *pa, char dimcheck)
Definition: lwin_wkt.c:485
LWGEOM * wkt_parser_curvepolygon_new(LWGEOM *ring)
Definition: lwin_wkt.c:567
int wkt_lexer_read_srid(char *str)
Read the SRID number from an SRID=<> string.
Definition: lwin_wkt.c:61
LWGEOM * wkt_parser_circularstring_new(POINTARRAY *pa, char *dimensionality)
Create a new circularstring.
Definition: lwin_wkt.c:388
LWGEOM * wkt_parser_collection_new(LWGEOM *geom)
Definition: lwin_wkt.c:698
LWGEOM_PARSER_RESULT global_parser_result
double y
Definition: lwin_wkt.h:36
LWGEOM * wkt_parser_collection_finalize(int lwtype, LWGEOM *col, char *dimensionality)
Definition: lwin_wkt.c:805
LWGEOM * wkt_parser_linestring_new(POINTARRAY *pa, char *dimensionality)
Create a new linestring.
Definition: lwin_wkt.c:354
void wkt_lexer_init(char *str)
LWGEOM * wkt_parser_curvepolygon_finalize(LWGEOM *poly, char *dimensionality)
Definition: lwin_wkt.c:666
POINTARRAY * wkt_parser_ptarray_new(POINT p)
Start a point array from the first coordinate.
Definition: lwin_wkt.c:303
POINTARRAY * wkt_parser_ptarray_add_coord(POINTARRAY *pa, POINT p)
Definition: lwin_wkt.c:265
Parser result structure: returns the result of attempting to convert (E)WKT/(E)WKB to LWGEOM...
Definition: liblwgeom.h:2020
double z
Definition: lwin_wkt.h:37
void wkt_lexer_close(void)
Definition: lwin_wkt.h:32
POINT wkt_parser_coord_2(double c1, double c2)
Build a 2d coordinate.
Definition: lwin_wkt.c:221
LWGEOM * wkt_parser_compound_add_geom(LWGEOM *col, LWGEOM *geom)
Definition: lwin_wkt.c:759
LWGEOM * wkt_parser_polygon_new(POINTARRAY *pa, char dimcheck)
Definition: lwin_wkt.c:460
const char * parser_error_messages[]
Definition: lwin_wkt.c:37
POINT wkt_parser_coord_3(double c1, double c2, double c3)
Note, if this is an XYM coordinate we&#39;ll have to fix it later when we build the object itself and hav...
Definition: lwin_wkt.c:237
LWGEOM * wkt_parser_compound_new(LWGEOM *element)
Definition: lwin_wkt.c:724
void wkt_parser_geometry_new(LWGEOM *geom, int srid)
Definition: lwin_wkt.c:859
LWGEOM * wkt_parser_curvepolygon_add_ring(LWGEOM *poly, LWGEOM *ring)
Definition: lwin_wkt.c:585
unsigned char uint8_t
Definition: uthash.h:79
uint8_t flags
Definition: lwin_wkt.h:34
POINT wkt_parser_coord_4(double c1, double c2, double c3, double c4)
Definition: lwin_wkt.c:252