Skip to content

Commit

Permalink
[labeling] Don't waste time trying to chop lines smaller then the rep…
Browse files Browse the repository at this point in the history
…eat distance
  • Loading branch information
nyalldawson committed Jul 25, 2019
1 parent 594e52f commit 00d3bec
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/pal/layer.cpp
Expand Up @@ -383,8 +383,18 @@ void Layer::chopFeaturesAtRepeatDistance()
std::unique_ptr< FeaturePart > fpart( mFeatureParts.takeFirst() );
const GEOSGeometry *geom = fpart->geos();
double chopInterval = fpart->repeatDistance();
bool shouldChop = false;
if ( chopInterval != 0. && GEOSGeomTypeId_r( geosctxt, geom ) == GEOS_LINESTRING )
{
double featureLen = 0;
( void )GEOSLength_r( geosctxt, geom, &featureLen );
if ( featureLen > chopInterval )
shouldChop = true;
}

if ( shouldChop )
{
QList<FeaturePart *> repeatParts;
chopInterval *= std::ceil( fpart->getLabelWidth() / fpart->repeatDistance() );

double bmin[2], bmax[2];
Expand Down

0 comments on commit 00d3bec

Please sign in to comment.