PostGIS
2.4.9dev-r@@SVN_REVISION@@
lwgeom_geos_prepared.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 2008 Paul Ramsey <pramsey@cleverelephant.ca>
22
*
23
**********************************************************************/
24
25
26
#ifndef LWGEOM_GEOS_PREPARED_H_
27
#define LWGEOM_GEOS_PREPARED_H_ 1
28
29
#include "postgres.h"
30
#include "fmgr.h"
31
#include "miscadmin.h"
32
#include "utils/hsearch.h"
33
#include "utils/memutils.h"
34
#include "access/hash.h"
35
36
#include "lwgeom_pg.h"
37
#include "
liblwgeom.h
"
38
#include "
lwgeom_geos.h
"
39
40
/*
41
* Cache structure. We use GSERIALIZED as keys so no transformations
42
* are needed before we memcmp them with other keys. We store the
43
* size to avoid having to calculate the size every time.
44
* The argnum gives the number of function arguments we are caching.
45
* Intersects requires that both arguments be checked for cacheability,
46
* while Contains only requires that the containing argument be checked.
47
* Both the Geometry and the PreparedGeometry have to be cached,
48
* because the PreparedGeometry contains a reference to the geometry.
49
*
50
* Note that the first 6 entries are part of the common GeomCache
51
* structure and have to remain in order to allow the overall caching
52
* system to share code (the cache checking code is common between
53
* prepared geometry, circtrees, recttrees, and rtrees).
54
*/
55
typedef
struct
{
56
int
type
;
// <GeomCache>
57
GSERIALIZED
*
geom1
;
//
58
GSERIALIZED
*
geom2
;
//
59
size_t
geom1_size
;
//
60
size_t
geom2_size
;
//
61
int32
argnum
;
// </GeomCache>
62
MemoryContext
context_statement
;
63
MemoryContext
context_callback
;
64
const
GEOSPreparedGeometry*
prepared_geom
;
65
const
GEOSGeometry*
geom
;
66
}
PrepGeomCache
;
67
68
69
/*
70
** Get the current cache, given the input geometries.
71
** Function will create cache if none exists, and prepare geometries in
72
** cache if necessary, or pull an existing cache if possible.
73
**
74
** If you are only caching one argument (e.g., in contains) supply 0 as the
75
** value for pg_geom2.
76
*/
77
PrepGeomCache
*
GetPrepGeomCache
(FunctionCallInfo fcinfo,
GSERIALIZED
*pg_geom1,
GSERIALIZED
*pg_geom2);
78
79
#endif
/* LWGEOM_GEOS_PREPARED_H_ */
int32
unsigned int int32
Definition:
shpopen.c:273
PrepGeomCache::geom2
GSERIALIZED * geom2
Definition:
lwgeom_geos_prepared.h:58
PrepGeomCache::prepared_geom
const GEOSPreparedGeometry * prepared_geom
Definition:
lwgeom_geos_prepared.h:64
PrepGeomCache::geom2_size
size_t geom2_size
Definition:
lwgeom_geos_prepared.h:60
PrepGeomCache::geom1
GSERIALIZED * geom1
Definition:
lwgeom_geos_prepared.h:57
PrepGeomCache::type
int type
Definition:
lwgeom_geos_prepared.h:56
PrepGeomCache::context_statement
MemoryContext context_statement
Definition:
lwgeom_geos_prepared.h:62
PrepGeomCache::argnum
int32 argnum
Definition:
lwgeom_geos_prepared.h:61
PrepGeomCache::geom
const GEOSGeometry * geom
Definition:
lwgeom_geos_prepared.h:65
GSERIALIZED
Definition:
liblwgeom.h:379
PrepGeomCache
Definition:
lwgeom_geos_prepared.h:55
lwgeom_geos.h
PrepGeomCache::context_callback
MemoryContext context_callback
Definition:
lwgeom_geos_prepared.h:63
GetPrepGeomCache
PrepGeomCache * GetPrepGeomCache(FunctionCallInfo fcinfo, GSERIALIZED *pg_geom1, GSERIALIZED *pg_geom2)
Given a couple potential geometries and a function call context, return a prepared structure for one ...
Definition:
lwgeom_geos_prepared.c:466
PrepGeomCache::geom1_size
size_t geom1_size
Definition:
lwgeom_geos_prepared.h:59
liblwgeom.h
This library is the generic geometry handling section of PostGIS.
postgis
lwgeom_geos_prepared.h
Generated by
1.8.13