Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More travis debugging
  • Loading branch information
wonder-sk committed Mar 29, 2017
1 parent 57d52db commit 4f339cb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/qgssnappingutils.cpp
Expand Up @@ -166,6 +166,7 @@ static QgsPointLocator::Match _findClosestSegmentIntersection( const QgsPoint &p

static void _replaceIfBetter( QgsPointLocator::Match &mBest, const QgsPointLocator::Match &mNew, double maxDistance )
{
qDebug( "replace: old %d..%f / new %d..%f", mBest.type(), mBest.distance(), mNew.type(), mNew.distance() );
// is other match relevant?
if ( !mNew.isValid() || mNew.distance() > maxDistance )
return;
Expand All @@ -179,6 +180,7 @@ static void _replaceIfBetter( QgsPointLocator::Match &mBest, const QgsPointLocat
return;

mBest = mNew; // the other match is better!
qDebug( "using it!" );
}


Expand Down Expand Up @@ -209,7 +211,10 @@ inline QgsRectangle _areaOfInterest( const QgsPoint &point, double tolerance )
QgsPointLocator::Match QgsSnappingUtils::snapToMap( const QgsPoint &pointMap, QgsPointLocator::MatchFilter *filter )
{
if ( !mMapSettings.hasValidSettings() || !mSnappingConfig.enabled() )
{
qDebug( "snapToMap invalid" );
return QgsPointLocator::Match();
}

if ( mSnappingConfig.mode() == QgsSnappingConfig::ActiveLayer )
{
Expand Down Expand Up @@ -241,6 +246,7 @@ QgsPointLocator::Match QgsSnappingUtils::snapToMap( const QgsPoint &pointMap, Qg
}
else if ( mSnappingConfig.mode() == QgsSnappingConfig::AdvancedConfiguration )
{
qDebug( "snap to map advanced" );
QList<LayerAndAreaOfInterest> layers;
Q_FOREACH ( const LayerConfig &layerConfig, mLayers )
{
Expand All @@ -255,9 +261,11 @@ QgsPointLocator::Match QgsSnappingUtils::snapToMap( const QgsPoint &pointMap, Qg

Q_FOREACH ( const LayerConfig &layerConfig, mLayers )
{
qDebug( "snap - layer - %s", layerConfig.layer->name().toAscii().data() );
double tolerance = QgsTolerance::toleranceInProjectUnits( layerConfig.tolerance, layerConfig.layer, mMapSettings, layerConfig.unit );
if ( QgsPointLocator *loc = locatorForLayerUsingStrategy( layerConfig.layer, pointMap, tolerance ) )
{
qDebug( "got locator" );
_updateBestMatch( bestMatch, pointMap, loc, layerConfig.type, tolerance, filter );

if ( mSnappingConfig.intersectionSnapping() )
Expand Down Expand Up @@ -313,6 +321,7 @@ QgsPointLocator::Match QgsSnappingUtils::snapToMap( const QgsPoint &pointMap, Qg

void QgsSnappingUtils::prepareIndex( const QList<LayerAndAreaOfInterest> &layers )
{
qDebug( "prep index" );
if ( mIsIndexing )
return;
mIsIndexing = true;
Expand All @@ -328,6 +337,7 @@ void QgsSnappingUtils::prepareIndex( const QList<LayerAndAreaOfInterest> &layers
if ( !isIndexPrepared( vl, entry.second ) )
layersToIndex << entry;
}
qDebug( "layers to index: %d", layersToIndex.count() );
if ( !layersToIndex.isEmpty() )
{
// build indexes
Expand Down Expand Up @@ -397,9 +407,11 @@ void QgsSnappingUtils::prepareIndex( const QList<LayerAndAreaOfInterest> &layers
loc->init();

QgsDebugMsg( QString( "Index init: %1 ms (%2)" ).arg( tt.elapsed() ).arg( vl->id() ) );
qDebug( "Index init: %d ms (%s)", tt.elapsed(), vl->name().toAscii().data() );
prepareIndexProgress( ++i );
}
QgsDebugMsg( QString( "Prepare index total: %1 ms" ).arg( t.elapsed() ) );
qDebug( "Prepare index total: %d ms", t.elapsed() );
}
mIsIndexing = false;
}
Expand Down

0 comments on commit 4f339cb

Please sign in to comment.