PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lw_dist2d_distribute_bruteforce()

int lw_dist2d_distribute_bruteforce ( const LWGEOM lwg1,
const LWGEOM lwg2,
DISTPTS dl 
)

Definition at line 356 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().

357 {
358 
359  int t1 = lwg1->type;
360  int t2 = lwg2->type;
361 
362  switch ( t1 )
363  {
364  case POINTTYPE:
365  {
366  dl->twisted = 1;
367  switch ( t2 )
368  {
369  case POINTTYPE:
370  return lw_dist2d_point_point((LWPOINT *)lwg1, (LWPOINT *)lwg2, dl);
371  case LINETYPE:
372  return lw_dist2d_point_line((LWPOINT *)lwg1, (LWLINE *)lwg2, dl);
373  case POLYGONTYPE:
374  return lw_dist2d_point_poly((LWPOINT *)lwg1, (LWPOLY *)lwg2, dl);
375  case CIRCSTRINGTYPE:
376  return lw_dist2d_point_circstring((LWPOINT *)lwg1, (LWCIRCSTRING *)lwg2, dl);
377  case CURVEPOLYTYPE:
378  return lw_dist2d_point_curvepoly((LWPOINT *)lwg1, (LWCURVEPOLY *)lwg2, dl);
379  default:
380  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
381  }
382  }
383  case LINETYPE:
384  {
385  dl->twisted = 1;
386  switch ( t2 )
387  {
388  case POINTTYPE:
389  dl->twisted=(-1);
390  return lw_dist2d_point_line((LWPOINT *)lwg2, (LWLINE *)lwg1, dl);
391  case LINETYPE:
392  return lw_dist2d_line_line((LWLINE *)lwg1, (LWLINE *)lwg2, dl);
393  case POLYGONTYPE:
394  return lw_dist2d_line_poly((LWLINE *)lwg1, (LWPOLY *)lwg2, dl);
395  case CIRCSTRINGTYPE:
396  return lw_dist2d_line_circstring((LWLINE *)lwg1, (LWCIRCSTRING *)lwg2, dl);
397  case CURVEPOLYTYPE:
398  return lw_dist2d_line_curvepoly((LWLINE *)lwg1, (LWCURVEPOLY *)lwg2, dl);
399  default:
400  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
401  }
402  }
403  case CIRCSTRINGTYPE:
404  {
405  dl->twisted = 1;
406  switch ( t2 )
407  {
408  case POINTTYPE:
409  dl->twisted = -1;
410  return lw_dist2d_point_circstring((LWPOINT *)lwg2, (LWCIRCSTRING *)lwg1, dl);
411  case LINETYPE:
412  dl->twisted = -1;
413  return lw_dist2d_line_circstring((LWLINE *)lwg2, (LWCIRCSTRING *)lwg1, dl);
414  case POLYGONTYPE:
415  return lw_dist2d_circstring_poly((LWCIRCSTRING *)lwg1, (LWPOLY *)lwg2, dl);
416  case CIRCSTRINGTYPE:
417  return lw_dist2d_circstring_circstring((LWCIRCSTRING *)lwg1, (LWCIRCSTRING *)lwg2, dl);
418  case CURVEPOLYTYPE:
419  return lw_dist2d_circstring_curvepoly((LWCIRCSTRING *)lwg1, (LWCURVEPOLY *)lwg2, dl);
420  default:
421  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
422  }
423  }
424  case POLYGONTYPE:
425  {
426  dl->twisted = -1;
427  switch ( t2 )
428  {
429  case POINTTYPE:
430  return lw_dist2d_point_poly((LWPOINT *)lwg2, (LWPOLY *)lwg1, dl);
431  case LINETYPE:
432  return lw_dist2d_line_poly((LWLINE *)lwg2, (LWPOLY *)lwg1, dl);
433  case CIRCSTRINGTYPE:
434  return lw_dist2d_circstring_poly((LWCIRCSTRING *)lwg2, (LWPOLY *)lwg1, dl);
435  case POLYGONTYPE:
436  dl->twisted = 1;
437  return lw_dist2d_poly_poly((LWPOLY *)lwg1, (LWPOLY *)lwg2, dl);
438  case CURVEPOLYTYPE:
439  dl->twisted = 1;
440  return lw_dist2d_poly_curvepoly((LWPOLY *)lwg1, (LWCURVEPOLY *)lwg2, dl);
441  default:
442  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
443  }
444  }
445  case CURVEPOLYTYPE:
446  {
447  dl->twisted = (-1);
448  switch ( t2 )
449  {
450  case POINTTYPE:
451  return lw_dist2d_point_curvepoly((LWPOINT *)lwg2, (LWCURVEPOLY *)lwg1, dl);
452  case LINETYPE:
453  return lw_dist2d_line_curvepoly((LWLINE *)lwg2, (LWCURVEPOLY *)lwg1, dl);
454  case POLYGONTYPE:
455  return lw_dist2d_poly_curvepoly((LWPOLY *)lwg2, (LWCURVEPOLY *)lwg1, dl);
456  case CIRCSTRINGTYPE:
457  return lw_dist2d_circstring_curvepoly((LWCIRCSTRING *)lwg2, (LWCURVEPOLY *)lwg1, dl);
458  case CURVEPOLYTYPE:
459  dl->twisted = 1;
460  return lw_dist2d_curvepoly_curvepoly((LWCURVEPOLY *)lwg1, (LWCURVEPOLY *)lwg2, dl);
461  default:
462  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
463  }
464  }
465  default:
466  {
467  lwerror("Unsupported geometry type: %s", lwtype_name(t1));
468  }
469  }
470 
471  /*You shouldn't being able to get here*/
472  lwerror("unspecified error in function lw_dist2d_distribute_bruteforce");
473  return LW_FALSE;
474 }
#define LINETYPE
Definition: liblwgeom.h:71
int lw_dist2d_line_curvepoly(LWLINE *line, LWCURVEPOLY *poly, DISTPTS *dl)
Definition: measures.c:782
int lw_dist2d_circstring_circstring(LWCIRCSTRING *line1, LWCIRCSTRING *line2, DISTPTS *dl)
Definition: measures.c:929
int lw_dist2d_circstring_poly(LWCIRCSTRING *circ, LWPOLY *poly, DISTPTS *dl)
Definition: measures.c:913
int lw_dist2d_point_curvepoly(LWPOINT *point, LWCURVEPOLY *poly, DISTPTS *dl)
Definition: measures.c:645
int lw_dist2d_point_point(LWPOINT *point1, LWPOINT *point2, DISTPTS *dl)
point to point calculation
Definition: measures.c:561
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define CURVEPOLYTYPE
Definition: liblwgeom.h:79
int lw_dist2d_circstring_curvepoly(LWCIRCSTRING *circ, LWCURVEPOLY *poly, DISTPTS *dl)
Definition: measures.c:923
int lw_dist2d_point_poly(LWPOINT *point, LWPOLY *poly, DISTPTS *dl)
Definition: measures.c:597
int lw_dist2d_curvepoly_curvepoly(LWCURVEPOLY *poly1, LWCURVEPOLY *poly2, DISTPTS *dl)
Definition: measures.c:956
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:829
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
#define LW_FALSE
Definition: liblwgeom.h:62
int lw_dist2d_line_poly(LWLINE *line, LWPOLY *poly, DISTPTS *dl)
line to polygon calculation Brute force.
Definition: measures.c:719
int lw_dist2d_point_circstring(LWPOINT *point, LWCIRCSTRING *circ, DISTPTS *dl)
Definition: measures.c:584
int lw_dist2d_point_line(LWPOINT *point, LWLINE *line, DISTPTS *dl)
point to line calculation
Definition: measures.c:575
int lw_dist2d_line_circstring(LWLINE *line1, LWCIRCSTRING *line2, DISTPTS *dl)
Definition: measures.c:702
int lw_dist2d_poly_curvepoly(LWPOLY *poly1, LWCURVEPOLY *curvepoly2, DISTPTS *dl)
Definition: measures.c:904
int twisted
Definition: measures.h:28
int lw_dist2d_line_line(LWLINE *line1, LWLINE *line2, DISTPTS *dl)
line to line calculation
Definition: measures.c:693
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
uint8_t type
Definition: liblwgeom.h:380
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
Here is the call graph for this function:
Here is the caller graph for this function: