Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Added settings to PAL for enable/disable partial shown labels
- Loading branch information
|
@@ -1361,7 +1361,12 @@ namespace pal |
|
|
// purge candidates that are outside the bbox |
|
|
for ( i = 0; i < nbp; i++ ) |
|
|
{ |
|
|
if ( !( *lPos )[i]->isIn( bbox ) ) |
|
|
bool outside = false; |
|
|
if ( f->layer->pal->getShowPartial() ) |
|
|
outside = !( *lPos )[i]->isIntersect( bbox ); |
|
|
else |
|
|
outside = !( *lPos )[i]->isInside( bbox ); |
|
|
if ( outside ) |
|
|
{ |
|
|
rnbp--; |
|
|
( *lPos )[i]->setCost( DBL_MAX ); // infinite cost => do not use |
|
|
|
@@ -184,6 +184,39 @@ namespace pal |
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
bool LabelPosition::isIntersect( double *bbox ) |
|
|
{ |
|
|
int i; |
|
|
|
|
|
for ( i = 0; i < 4; i++ ) |
|
|
{ |
|
|
if ( x[i] >= bbox[0] && x[i] <= bbox[2] && |
|
|
y[i] >= bbox[1] && y[i] <= bbox[3] ) |
|
|
return true; |
|
|
} |
|
|
|
|
|
if ( nextPart ) |
|
|
return nextPart->isIntersect( bbox ); |
|
|
else |
|
|
return false; |
|
|
} |
|
|
|
|
|
bool LabelPosition::isInside( double *bbox ) |
|
|
{ |
|
|
for (int i = 0; i < 4; i++ ) |
|
|
{ |
|
|
if ( !( x[i] >= bbox[0] && x[i] <= bbox[2] && |
|
|
y[i] >= bbox[1] && y[i] <= bbox[3] ) ) |
|
|
return false; |
|
|
} |
|
|
|
|
|
if ( nextPart ) |
|
|
return nextPart->isInside( bbox ); |
|
|
else |
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
void LabelPosition::print() |
|
|
{ |
|
|
|
@@ -109,12 +109,26 @@ namespace pal |
|
|
|
|
|
|
|
|
/** |
|
|
* \brief is the labelposition in the bounding-box ? |
|
|
* \brief Is the labelposition in the bounding-box ? (intersect or inside????) |
|
|
* |
|
|
*\param bbox the bounding-box double[4] = {xmin, ymin, xmax, ymax} |
|
|
*/ |
|
|
bool isIn( double *bbox ); |
|
|
|
|
|
/** |
|
|
* \brief Is the labelposition intersect the bounding-box ? |
|
|
* |
|
|
*\param bbox the bounding-box double[4] = {xmin, ymin, xmax, ymax} |
|
|
*/ |
|
|
bool isIntersect( double *bbox ); |
|
|
|
|
|
/** |
|
|
* \brief Is the labelposition inside the bounding-box ? |
|
|
* |
|
|
*\param bbox the bounding-box double[4] = {xmin, ymin, xmax, ymax} |
|
|
*/ |
|
|
bool isInside( double *bbox ); |
|
|
|
|
|
/** |
|
|
* \brief Check whether or not this overlap with another labelPosition |
|
|
* |
|
|
|
@@ -106,7 +106,9 @@ namespace pal |
|
|
point_p = 8; |
|
|
line_p = 8; |
|
|
poly_p = 8; |
|
|
|
|
|
|
|
|
showPartial = true; |
|
|
|
|
|
this->map_unit = pal::METER; |
|
|
|
|
|
std::cout.precision( 12 ); |
|
@@ -899,6 +901,11 @@ namespace pal |
|
|
if ( dpi > 0 ) |
|
|
this->dpi = dpi; |
|
|
} |
|
|
|
|
|
void Pal::setShowPartial(bool show) |
|
|
{ |
|
|
this->showPartial = show; |
|
|
} |
|
|
|
|
|
int Pal::getPointP() |
|
|
{ |
|
@@ -929,6 +936,11 @@ namespace pal |
|
|
{ |
|
|
return dpi; |
|
|
} |
|
|
|
|
|
bool Pal::getShowPartial() |
|
|
{ |
|
|
return showPartial; |
|
|
} |
|
|
|
|
|
SearchMethod Pal::getSearch() |
|
|
{ |
|
|
|
@@ -166,6 +166,11 @@ namespace pal |
|
|
int ejChainDeg; |
|
|
int tenure; |
|
|
double candListSize; |
|
|
|
|
|
/** |
|
|
* \brief show partial labels (cut-off by the map canvas) or not |
|
|
*/ |
|
|
bool showPartial; |
|
|
|
|
|
/** |
|
|
* \brief Problem factory |
|
@@ -352,8 +357,20 @@ namespace pal |
|
|
* @return map resolution (dot per inch) |
|
|
*/ |
|
|
int getDpi(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
*\brief Set flag show partial label |
|
|
* |
|
|
* @param show flag value |
|
|
*/ |
|
|
void setShowPartial(bool show); |
|
|
|
|
|
/** |
|
|
* \brief Get flag show partial label |
|
|
* |
|
|
* @return value of flag |
|
|
*/ |
|
|
bool getShowPartial(); |
|
|
|
|
|
/** |
|
|
* \brief set # candidates to generate for points features |
|
|