PostGIS  2.1.10dev-r@@SVN_REVISION@@
int lw_dist2d_distribute_bruteforce ( LWGEOM lwg1,
LWGEOM lwg2,
DISTPTS dl 
)

Definition at line 330 of file measures.c.

References CIRCSTRINGTYPE, CURVEPOLYTYPE, LINETYPE, lw_dist2d_circstring_circstring(), lw_dist2d_circstring_curvepoly(), lw_dist2d_circstring_poly(), lw_dist2d_curvepoly_curvepoly(), lw_dist2d_line_circstring(), lw_dist2d_line_curvepoly(), lw_dist2d_line_line(), lw_dist2d_line_poly(), lw_dist2d_point_circstring(), lw_dist2d_point_curvepoly(), lw_dist2d_point_line(), lw_dist2d_point_point(), lw_dist2d_point_poly(), lw_dist2d_poly_curvepoly(), lw_dist2d_poly_poly(), LW_FALSE, lwerror(), lwtype_name(), POINTTYPE, POLYGONTYPE, DISTPTS::twisted, and LWGEOM::type.

Referenced by lw_dist2d_recursive().

331 {
332 
333  int t1 = lwg1->type;
334  int t2 = lwg2->type;
335 
336  switch ( t1 )
337  {
338  case POINTTYPE:
339  {
340  dl->twisted = 1;
341  switch ( t2 )
342  {
343  case POINTTYPE:
344  return lw_dist2d_point_point((LWPOINT *)lwg1, (LWPOINT *)lwg2, dl);
345  case LINETYPE:
346  return lw_dist2d_point_line((LWPOINT *)lwg1, (LWLINE *)lwg2, dl);
347  case POLYGONTYPE:
348  return lw_dist2d_point_poly((LWPOINT *)lwg1, (LWPOLY *)lwg2, dl);
349  case CIRCSTRINGTYPE:
350  return lw_dist2d_point_circstring((LWPOINT *)lwg1, (LWCIRCSTRING *)lwg2, dl);
351  case CURVEPOLYTYPE:
352  return lw_dist2d_point_curvepoly((LWPOINT *)lwg1, (LWCURVEPOLY *)lwg2, dl);
353  default:
354  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
355  }
356  }
357  case LINETYPE:
358  {
359  dl->twisted = 1;
360  switch ( t2 )
361  {
362  case POINTTYPE:
363  dl->twisted=(-1);
364  return lw_dist2d_point_line((LWPOINT *)lwg2, (LWLINE *)lwg1, dl);
365  case LINETYPE:
366  return lw_dist2d_line_line((LWLINE *)lwg1, (LWLINE *)lwg2, dl);
367  case POLYGONTYPE:
368  return lw_dist2d_line_poly((LWLINE *)lwg1, (LWPOLY *)lwg2, dl);
369  case CIRCSTRINGTYPE:
370  return lw_dist2d_line_circstring((LWLINE *)lwg1, (LWCIRCSTRING *)lwg2, dl);
371  case CURVEPOLYTYPE:
372  return lw_dist2d_line_curvepoly((LWLINE *)lwg1, (LWCURVEPOLY *)lwg2, dl);
373  default:
374  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
375  }
376  }
377  case CIRCSTRINGTYPE:
378  {
379  dl->twisted = 1;
380  switch ( t2 )
381  {
382  case POINTTYPE:
383  dl->twisted = -1;
384  return lw_dist2d_point_circstring((LWPOINT *)lwg2, (LWCIRCSTRING *)lwg1, dl);
385  case LINETYPE:
386  dl->twisted = -1;
387  return lw_dist2d_line_circstring((LWLINE *)lwg2, (LWCIRCSTRING *)lwg1, dl);
388  case POLYGONTYPE:
389  return lw_dist2d_circstring_poly((LWCIRCSTRING *)lwg1, (LWPOLY *)lwg2, dl);
390  case CIRCSTRINGTYPE:
391  return lw_dist2d_circstring_circstring((LWCIRCSTRING *)lwg1, (LWCIRCSTRING *)lwg2, dl);
392  case CURVEPOLYTYPE:
393  return lw_dist2d_circstring_curvepoly((LWCIRCSTRING *)lwg1, (LWCURVEPOLY *)lwg2, dl);
394  default:
395  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
396  }
397  }
398  case POLYGONTYPE:
399  {
400  dl->twisted = -1;
401  switch ( t2 )
402  {
403  case POINTTYPE:
404  return lw_dist2d_point_poly((LWPOINT *)lwg2, (LWPOLY *)lwg1, dl);
405  case LINETYPE:
406  return lw_dist2d_line_poly((LWLINE *)lwg2, (LWPOLY *)lwg1, dl);
407  case CIRCSTRINGTYPE:
408  return lw_dist2d_circstring_poly((LWCIRCSTRING *)lwg2, (LWPOLY *)lwg1, dl);
409  case POLYGONTYPE:
410  dl->twisted = 1;
411  return lw_dist2d_poly_poly((LWPOLY *)lwg1, (LWPOLY *)lwg2, dl);
412  case CURVEPOLYTYPE:
413  dl->twisted = 1;
414  return lw_dist2d_poly_curvepoly((LWPOLY *)lwg1, (LWCURVEPOLY *)lwg2, dl);
415  default:
416  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
417  }
418  }
419  case CURVEPOLYTYPE:
420  {
421  dl->twisted = (-1);
422  switch ( t2 )
423  {
424  case POINTTYPE:
425  return lw_dist2d_point_curvepoly((LWPOINT *)lwg2, (LWCURVEPOLY *)lwg1, dl);
426  case LINETYPE:
427  return lw_dist2d_line_curvepoly((LWLINE *)lwg2, (LWCURVEPOLY *)lwg1, dl);
428  case POLYGONTYPE:
429  return lw_dist2d_poly_curvepoly((LWPOLY *)lwg2, (LWCURVEPOLY *)lwg1, dl);
430  case CIRCSTRINGTYPE:
431  return lw_dist2d_circstring_curvepoly((LWCIRCSTRING *)lwg2, (LWCURVEPOLY *)lwg1, dl);
432  case CURVEPOLYTYPE:
433  dl->twisted = 1;
434  return lw_dist2d_curvepoly_curvepoly((LWCURVEPOLY *)lwg1, (LWCURVEPOLY *)lwg2, dl);
435  default:
436  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
437  }
438  }
439  default:
440  {
441  lwerror("Unsupported geometry type: %s", lwtype_name(t1));
442  }
443  }
444 
445  /*You shouldn't being able to get here*/
446  lwerror("unspecified error in function lw_dist2d_distribute_bruteforce");
447  return LW_FALSE;
448 }
#define LINETYPE
Definition: liblwgeom.h:61
int lw_dist2d_line_curvepoly(LWLINE *line, LWCURVEPOLY *poly, DISTPTS *dl)
Definition: measures.c:756
int lw_dist2d_circstring_circstring(LWCIRCSTRING *line1, LWCIRCSTRING *line2, DISTPTS *dl)
Definition: measures.c:903
int lw_dist2d_circstring_poly(LWCIRCSTRING *circ, LWPOLY *poly, DISTPTS *dl)
Definition: measures.c:887
int lw_dist2d_point_curvepoly(LWPOINT *point, LWCURVEPOLY *poly, DISTPTS *dl)
Definition: measures.c:619
int lw_dist2d_point_point(LWPOINT *point1, LWPOINT *point2, DISTPTS *dl)
point to point calculation
Definition: measures.c:535
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define CURVEPOLYTYPE
Definition: liblwgeom.h:69
int lw_dist2d_circstring_curvepoly(LWCIRCSTRING *circ, LWCURVEPOLY *poly, DISTPTS *dl)
Definition: measures.c:897
int lw_dist2d_point_poly(LWPOINT *point, LWPOLY *poly, DISTPTS *dl)
Definition: measures.c:571
int lw_dist2d_curvepoly_curvepoly(LWCURVEPOLY *poly1, LWCURVEPOLY *poly2, DISTPTS *dl)
Definition: measures.c:930
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
int lw_dist2d_poly_poly(LWPOLY *poly1, LWPOLY *poly2, DISTPTS *dl)
Function handling polygon to polygon calculation 1 if we are looking for maxdistance, just check the outer rings.
Definition: measures.c:803
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
#define LW_FALSE
Definition: liblwgeom.h:52
int lw_dist2d_line_poly(LWLINE *line, LWPOLY *poly, DISTPTS *dl)
line to polygon calculation Brute force.
Definition: measures.c:693
int lw_dist2d_point_circstring(LWPOINT *point, LWCIRCSTRING *circ, DISTPTS *dl)
Definition: measures.c:558
int lw_dist2d_point_line(LWPOINT *point, LWLINE *line, DISTPTS *dl)
point to line calculation
Definition: measures.c:549
int lw_dist2d_line_circstring(LWLINE *line1, LWCIRCSTRING *line2, DISTPTS *dl)
Definition: measures.c:676
int lw_dist2d_poly_curvepoly(LWPOLY *poly1, LWCURVEPOLY *curvepoly2, DISTPTS *dl)
Definition: measures.c:878
int twisted
Definition: measures.h:27
int lw_dist2d_line_line(LWLINE *line1, LWLINE *line2, DISTPTS *dl)
line to line calculation
Definition: measures.c:667
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67

Here is the call graph for this function:

Here is the caller graph for this function: