163{
165
168
170
171
174
175
177
178
179
180 if ( tree_cache && tree_cache->
gcache.argnum && tree_cache->
index )
181 {
187 int geomtype_cached;
188 int geomtype;
190
191
192 if ( tree_cache->
gcache.argnum == 1 )
193 {
194 g_cached = g1;
195 g = g2;
196 geomtype_cached = type1;
197 geomtype = type2;
198 }
199 else if ( tree_cache->
gcache.argnum == 2 )
200 {
201 g_cached = g2;
202 g = g1;
203 geomtype_cached = type2;
204 geomtype = type1;
205 }
206 else
207 {
208 lwpgerror("geography_distance_cache this cannot happen!");
210 }
211
214 {
216 if (
CircTreePIP(circtree_cached, g_cached, &p4d) )
217 {
221 }
222 }
223
226 {
232 {
237 }
238 }
239
244 }
245 else
246 {
248 }
249}
static int CircTreePIP(const CIRC_NODE *tree1, const GSERIALIZED *g1, const POINT4D *in_point)
static CircTreeGeomCache * GetCircTreeGeomCache(FunctionCallInfo fcinfo, const GSERIALIZED *g1, const GSERIALIZED *g2)
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
int lwgeom_startpoint(const LWGEOM *lwgeom, POINT4D *pt)
void lwgeom_free(LWGEOM *geom)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
double circ_tree_distance_tree(const CIRC_NODE *n1, const CIRC_NODE *n2, const SPHEROID *spheroid, double threshold)
CIRC_NODE * lwgeom_calculate_circ_tree(const LWGEOM *lwgeom)
int circ_tree_get_point(const CIRC_NODE *node, POINT2D *pt)
Returns a POINT2D that is a vertex of the input shape.
void circ_tree_free(CIRC_NODE *node)
Recurse from top of node tree and free all children.
static double distance(double x1, double y1, double x2, double y2)
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.