PostGIS  2.5.7dev-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.

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  return LW_FALSE;
396  }
397  }
398  case LINETYPE:
399  {
400  dl->twisted = 1;
401  switch ( t2 )
402  {
403  case POINTTYPE:
404  dl->twisted=(-1);
405  return lw_dist2d_point_line((LWPOINT *)lwg2, (LWLINE *)lwg1, dl);
406  case LINETYPE:
407  return lw_dist2d_line_line((LWLINE *)lwg1, (LWLINE *)lwg2, dl);
408  case POLYGONTYPE:
409  return lw_dist2d_line_poly((LWLINE *)lwg1, (LWPOLY *)lwg2, dl);
410  case CIRCSTRINGTYPE:
411  return lw_dist2d_line_circstring((LWLINE *)lwg1, (LWCIRCSTRING *)lwg2, dl);
412  case CURVEPOLYTYPE:
413  return lw_dist2d_line_curvepoly((LWLINE *)lwg1, (LWCURVEPOLY *)lwg2, dl);
414  default:
415  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
416  return LW_FALSE;
417  }
418  }
419  case CIRCSTRINGTYPE:
420  {
421  dl->twisted = 1;
422  switch ( t2 )
423  {
424  case POINTTYPE:
425  dl->twisted = -1;
426  return lw_dist2d_point_circstring((LWPOINT *)lwg2, (LWCIRCSTRING *)lwg1, dl);
427  case LINETYPE:
428  dl->twisted = -1;
429  return lw_dist2d_line_circstring((LWLINE *)lwg2, (LWCIRCSTRING *)lwg1, dl);
430  case POLYGONTYPE:
431  return lw_dist2d_circstring_poly((LWCIRCSTRING *)lwg1, (LWPOLY *)lwg2, dl);
432  case CIRCSTRINGTYPE:
433  return lw_dist2d_circstring_circstring((LWCIRCSTRING *)lwg1, (LWCIRCSTRING *)lwg2, dl);
434  case CURVEPOLYTYPE:
435  return lw_dist2d_circstring_curvepoly((LWCIRCSTRING *)lwg1, (LWCURVEPOLY *)lwg2, dl);
436  default:
437  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
438  return LW_FALSE;
439  }
440  }
441  case POLYGONTYPE:
442  {
443  dl->twisted = -1;
444  switch ( t2 )
445  {
446  case POINTTYPE:
447  return lw_dist2d_point_poly((LWPOINT *)lwg2, (LWPOLY *)lwg1, dl);
448  case LINETYPE:
449  return lw_dist2d_line_poly((LWLINE *)lwg2, (LWPOLY *)lwg1, dl);
450  case CIRCSTRINGTYPE:
451  return lw_dist2d_circstring_poly((LWCIRCSTRING *)lwg2, (LWPOLY *)lwg1, dl);
452  case POLYGONTYPE:
453  dl->twisted = 1;
454  return lw_dist2d_poly_poly((LWPOLY *)lwg1, (LWPOLY *)lwg2, dl);
455  case CURVEPOLYTYPE:
456  dl->twisted = 1;
457  return lw_dist2d_poly_curvepoly((LWPOLY *)lwg1, (LWCURVEPOLY *)lwg2, dl);
458  default:
459  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
460  return LW_FALSE;
461  }
462  }
463  case CURVEPOLYTYPE:
464  {
465  dl->twisted = (-1);
466  switch ( t2 )
467  {
468  case POINTTYPE:
469  return lw_dist2d_point_curvepoly((LWPOINT *)lwg2, (LWCURVEPOLY *)lwg1, dl);
470  case LINETYPE:
471  return lw_dist2d_line_curvepoly((LWLINE *)lwg2, (LWCURVEPOLY *)lwg1, dl);
472  case POLYGONTYPE:
473  return lw_dist2d_poly_curvepoly((LWPOLY *)lwg2, (LWCURVEPOLY *)lwg1, dl);
474  case CIRCSTRINGTYPE:
475  return lw_dist2d_circstring_curvepoly((LWCIRCSTRING *)lwg2, (LWCURVEPOLY *)lwg1, dl);
476  case CURVEPOLYTYPE:
477  dl->twisted = 1;
478  return lw_dist2d_curvepoly_curvepoly((LWCURVEPOLY *)lwg1, (LWCURVEPOLY *)lwg2, dl);
479  default:
480  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
481  return LW_FALSE;
482  }
483  }
484  default:
485  {
486  lwerror("Unsupported geometry type: %s", lwtype_name(t1));
487  return LW_FALSE;
488  }
489  }
490 
491  return LW_FALSE;
492 }
#define LW_FALSE
Definition: liblwgeom.h:77
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define LINETYPE
Definition: liblwgeom.h:86
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
int lw_dist2d_circstring_curvepoly(LWCIRCSTRING *circ, LWCURVEPOLY *poly, DISTPTS *dl)
Definition: measures.c:941
int lw_dist2d_line_curvepoly(LWLINE *line, LWCURVEPOLY *poly, DISTPTS *dl)
Definition: measures.c:800
int lw_dist2d_line_circstring(LWLINE *line1, LWCIRCSTRING *line2, DISTPTS *dl)
Definition: measures.c:720
int lw_dist2d_poly_poly(LWPOLY *poly1, LWPOLY *poly2, DISTPTS *dl)
Function handling polygon to polygon calculation 1 if we are looking for maxdistance,...
Definition: measures.c:847
int lw_dist2d_point_curvepoly(LWPOINT *point, LWCURVEPOLY *poly, DISTPTS *dl)
Definition: measures.c:663
int lw_dist2d_point_circstring(LWPOINT *point, LWCIRCSTRING *circ, DISTPTS *dl)
Definition: measures.c:602
int lw_dist2d_circstring_poly(LWCIRCSTRING *circ, LWPOLY *poly, DISTPTS *dl)
Definition: measures.c:931
int lw_dist2d_curvepoly_curvepoly(LWCURVEPOLY *poly1, LWCURVEPOLY *poly2, DISTPTS *dl)
Definition: measures.c:974
int lw_dist2d_poly_curvepoly(LWPOLY *poly1, LWCURVEPOLY *curvepoly2, DISTPTS *dl)
Definition: measures.c:922
int lw_dist2d_point_line(LWPOINT *point, LWLINE *line, DISTPTS *dl)
point to line calculation
Definition: measures.c:593
int lw_dist2d_line_line(LWLINE *line1, LWLINE *line2, DISTPTS *dl)
line to line calculation
Definition: measures.c:711
int lw_dist2d_line_poly(LWLINE *line, LWPOLY *poly, DISTPTS *dl)
line to polygon calculation Brute force.
Definition: measures.c:737
int lw_dist2d_circstring_circstring(LWCIRCSTRING *line1, LWCIRCSTRING *line2, DISTPTS *dl)
Definition: measures.c:947
int lw_dist2d_point_poly(LWPOINT *point, LWPOLY *poly, DISTPTS *dl)
Definition: measures.c:615
int lw_dist2d_point_point(LWPOINT *point1, LWPOINT *point2, DISTPTS *dl)
point to point calculation
Definition: measures.c:579
int twisted
Definition: measures.h:55
uint8_t type
Definition: liblwgeom.h:399

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().

Here is the call graph for this function:
Here is the caller graph for this function: