PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lw_dist2d_distribute_bruteforce()

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

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

371 {
372 
373  int t1 = lwg1->type;
374  int t2 = lwg2->type;
375 
376  switch ( t1 )
377  {
378  case POINTTYPE:
379  {
380  dl->twisted = 1;
381  switch ( t2 )
382  {
383  case POINTTYPE:
384  return lw_dist2d_point_point((LWPOINT *)lwg1, (LWPOINT *)lwg2, dl);
385  case LINETYPE:
386  return lw_dist2d_point_line((LWPOINT *)lwg1, (LWLINE *)lwg2, dl);
387  case POLYGONTYPE:
388  return lw_dist2d_point_poly((LWPOINT *)lwg1, (LWPOLY *)lwg2, dl);
389  case CIRCSTRINGTYPE:
390  return lw_dist2d_point_circstring((LWPOINT *)lwg1, (LWCIRCSTRING *)lwg2, dl);
391  case CURVEPOLYTYPE:
392  return lw_dist2d_point_curvepoly((LWPOINT *)lwg1, (LWCURVEPOLY *)lwg2, dl);
393  default:
394  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
395  }
396  }
397  case LINETYPE:
398  {
399  dl->twisted = 1;
400  switch ( t2 )
401  {
402  case POINTTYPE:
403  dl->twisted=(-1);
404  return lw_dist2d_point_line((LWPOINT *)lwg2, (LWLINE *)lwg1, dl);
405  case LINETYPE:
406  return lw_dist2d_line_line((LWLINE *)lwg1, (LWLINE *)lwg2, dl);
407  case POLYGONTYPE:
408  return lw_dist2d_line_poly((LWLINE *)lwg1, (LWPOLY *)lwg2, dl);
409  case CIRCSTRINGTYPE:
410  return lw_dist2d_line_circstring((LWLINE *)lwg1, (LWCIRCSTRING *)lwg2, dl);
411  case CURVEPOLYTYPE:
412  return lw_dist2d_line_curvepoly((LWLINE *)lwg1, (LWCURVEPOLY *)lwg2, dl);
413  default:
414  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
415  }
416  }
417  case CIRCSTRINGTYPE:
418  {
419  dl->twisted = 1;
420  switch ( t2 )
421  {
422  case POINTTYPE:
423  dl->twisted = -1;
424  return lw_dist2d_point_circstring((LWPOINT *)lwg2, (LWCIRCSTRING *)lwg1, dl);
425  case LINETYPE:
426  dl->twisted = -1;
427  return lw_dist2d_line_circstring((LWLINE *)lwg2, (LWCIRCSTRING *)lwg1, dl);
428  case POLYGONTYPE:
429  return lw_dist2d_circstring_poly((LWCIRCSTRING *)lwg1, (LWPOLY *)lwg2, dl);
430  case CIRCSTRINGTYPE:
431  return lw_dist2d_circstring_circstring((LWCIRCSTRING *)lwg1, (LWCIRCSTRING *)lwg2, dl);
432  case CURVEPOLYTYPE:
433  return lw_dist2d_circstring_curvepoly((LWCIRCSTRING *)lwg1, (LWCURVEPOLY *)lwg2, dl);
434  default:
435  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
436  }
437  }
438  case POLYGONTYPE:
439  {
440  dl->twisted = -1;
441  switch ( t2 )
442  {
443  case POINTTYPE:
444  return lw_dist2d_point_poly((LWPOINT *)lwg2, (LWPOLY *)lwg1, dl);
445  case LINETYPE:
446  return lw_dist2d_line_poly((LWLINE *)lwg2, (LWPOLY *)lwg1, dl);
447  case CIRCSTRINGTYPE:
448  return lw_dist2d_circstring_poly((LWCIRCSTRING *)lwg2, (LWPOLY *)lwg1, dl);
449  case POLYGONTYPE:
450  dl->twisted = 1;
451  return lw_dist2d_poly_poly((LWPOLY *)lwg1, (LWPOLY *)lwg2, dl);
452  case CURVEPOLYTYPE:
453  dl->twisted = 1;
454  return lw_dist2d_poly_curvepoly((LWPOLY *)lwg1, (LWCURVEPOLY *)lwg2, dl);
455  default:
456  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
457  }
458  }
459  case CURVEPOLYTYPE:
460  {
461  dl->twisted = (-1);
462  switch ( t2 )
463  {
464  case POINTTYPE:
465  return lw_dist2d_point_curvepoly((LWPOINT *)lwg2, (LWCURVEPOLY *)lwg1, dl);
466  case LINETYPE:
467  return lw_dist2d_line_curvepoly((LWLINE *)lwg2, (LWCURVEPOLY *)lwg1, dl);
468  case POLYGONTYPE:
469  return lw_dist2d_poly_curvepoly((LWPOLY *)lwg2, (LWCURVEPOLY *)lwg1, dl);
470  case CIRCSTRINGTYPE:
471  return lw_dist2d_circstring_curvepoly((LWCIRCSTRING *)lwg2, (LWCURVEPOLY *)lwg1, dl);
472  case CURVEPOLYTYPE:
473  dl->twisted = 1;
474  return lw_dist2d_curvepoly_curvepoly((LWCURVEPOLY *)lwg1, (LWCURVEPOLY *)lwg2, dl);
475  default:
476  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
477  }
478  }
479  default:
480  {
481  lwerror("Unsupported geometry type: %s", lwtype_name(t1));
482  }
483  }
484 
485  /*You shouldn't being able to get here*/
486  lwerror("unspecified error in function lw_dist2d_distribute_bruteforce");
487  return LW_FALSE;
488 }
#define LINETYPE
Definition: liblwgeom.h:86
int lw_dist2d_line_curvepoly(LWLINE *line, LWCURVEPOLY *poly, DISTPTS *dl)
Definition: measures.c:796
int lw_dist2d_circstring_circstring(LWCIRCSTRING *line1, LWCIRCSTRING *line2, DISTPTS *dl)
Definition: measures.c:943
int lw_dist2d_circstring_poly(LWCIRCSTRING *circ, LWPOLY *poly, DISTPTS *dl)
Definition: measures.c:927
int lw_dist2d_point_curvepoly(LWPOINT *point, LWCURVEPOLY *poly, DISTPTS *dl)
Definition: measures.c:659
int lw_dist2d_point_point(LWPOINT *point1, LWPOINT *point2, DISTPTS *dl)
point to point calculation
Definition: measures.c:575
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
int lw_dist2d_circstring_curvepoly(LWCIRCSTRING *circ, LWCURVEPOLY *poly, DISTPTS *dl)
Definition: measures.c:937
int lw_dist2d_point_poly(LWPOINT *point, LWPOLY *poly, DISTPTS *dl)
Definition: measures.c:611
int lw_dist2d_curvepoly_curvepoly(LWCURVEPOLY *poly1, LWCURVEPOLY *poly2, DISTPTS *dl)
Definition: measures.c:970
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:843
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define LW_FALSE
Definition: liblwgeom.h:77
int lw_dist2d_line_poly(LWLINE *line, LWPOLY *poly, DISTPTS *dl)
line to polygon calculation Brute force.
Definition: measures.c:733
int lw_dist2d_point_circstring(LWPOINT *point, LWCIRCSTRING *circ, DISTPTS *dl)
Definition: measures.c:598
int lw_dist2d_point_line(LWPOINT *point, LWLINE *line, DISTPTS *dl)
point to line calculation
Definition: measures.c:589
int lw_dist2d_line_circstring(LWLINE *line1, LWCIRCSTRING *line2, DISTPTS *dl)
Definition: measures.c:716
int lw_dist2d_poly_curvepoly(LWPOLY *poly1, LWCURVEPOLY *curvepoly2, DISTPTS *dl)
Definition: measures.c:918
int twisted
Definition: measures.h:55
int lw_dist2d_line_line(LWLINE *line1, LWLINE *line2, DISTPTS *dl)
line to line calculation
Definition: measures.c:707
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:396
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
Here is the call graph for this function:
Here is the caller graph for this function: