PostGIS  2.5.7dev-r@@SVN_REVISION@@
lwmpoly.c
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) 2001-2006 Refractions Research Inc.
22  *
23  **********************************************************************/
24 
25 
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <string.h>
29 #include "liblwgeom_internal.h"
30 #include "lwgeom_log.h"
31 
32 
33 void
35 {
37 }
38 
39 LWMPOLY *
40 lwmpoly_construct_empty(int srid, char hasz, char hasm)
41 {
43  return ret;
44 }
45 
46 
48 {
49  return (LWMPOLY*)lwcollection_add_lwgeom((LWCOLLECTION*)mobj, (LWGEOM*)obj);
50 }
51 
52 
53 void lwmpoly_free(LWMPOLY *mpoly)
54 {
55  uint32_t i;
56  if ( ! mpoly ) return;
57  if ( mpoly->bbox )
58  lwfree(mpoly->bbox);
59 
60  for ( i = 0; i < mpoly->ngeoms; i++ )
61  if ( mpoly->geoms && mpoly->geoms[i] )
62  lwpoly_free(mpoly->geoms[i]);
63 
64  if ( mpoly->geoms )
65  lwfree(mpoly->geoms);
66 
67  lwfree(mpoly);
68 }
69 
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:94
LWGEOM * lwmpoly_as_lwgeom(const LWMPOLY *obj)
Definition: lwgeom.c:285
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
void lwfree(void *mem)
Definition: lwutil.c:244
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:187
void lwpoly_free(LWPOLY *poly)
Definition: lwpoly.c:175
void lwgeom_release(LWGEOM *lwgeom)
Free the containing LWGEOM and the associated BOX.
Definition: lwgeom.c:459
void lwmpoly_release(LWMPOLY *lwmpoly)
Definition: lwmpoly.c:34
LWMPOLY * lwmpoly_construct_empty(int srid, char hasz, char hasm)
Definition: lwmpoly.c:40
void lwmpoly_free(LWMPOLY *mpoly)
Definition: lwmpoly.c:53
LWMPOLY * lwmpoly_add_lwpoly(LWMPOLY *mobj, const LWPOLY *obj)
Definition: lwmpoly.c:47
GBOX * bbox
Definition: liblwgeom.h:495
uint32_t ngeoms
Definition: liblwgeom.h:497
LWPOLY ** geoms
Definition: liblwgeom.h:499
unsigned int uint32_t
Definition: uthash.h:78