Skip to content

Commit 5b800be

Browse files
committedFeb 2, 2012
Fix for locateBetween method
1 parent 6ba79ca commit 5b800be

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed
 

‎src/analysis/vector/qgsgeometryanalyzer.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -951,9 +951,9 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer*
951951

952952
int nEventFeatures = eventLayer->pendingFeatureCount();
953953
int featureCounter = 0;
954-
if( p )
954+
if ( p )
955955
{
956-
p->setWindowModality(Qt::WindowModal);
956+
p->setWindowModality( Qt::WindowModal );
957957
p->setMinimum( 0 );
958958
p->setMaximum( nEventFeatures );
959959
p->show();
@@ -962,9 +962,9 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer*
962962
while ( eventLayer->nextFeature( fet ) )
963963
{
964964
//update progress dialog
965-
if( p )
965+
if ( p )
966966
{
967-
if( p->wasCanceled() )
967+
if ( p->wasCanceled() )
968968
{
969969
break;
970970
}
@@ -1011,7 +1011,7 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer*
10111011
}
10121012
}
10131013

1014-
if( p )
1014+
if ( p )
10151015
{
10161016
p->setValue( nEventFeatures );
10171017
}
@@ -1268,6 +1268,18 @@ bool QgsGeometryAnalyzer::clipSegmentByRange( double x1, double y1, double m1, d
12681268
secondPointClipped = reversed;
12691269
}
12701270

1271+
//range1 and range 2 both inside the segment
1272+
if ( range1 >= m1 && range2 <= m2 )
1273+
{
1274+
double dist1 = ( range1 - m1 ) / ( m2 - m1 );
1275+
double dist2 = ( range2 - m1 ) / ( m2 - m1 );
1276+
pt1.setX( x1 + ( x2 - x1 ) * dist1 );
1277+
pt1.setY( y1 + ( y2 - y1 ) * dist1 );
1278+
pt2.setX( x1 + ( x2 - x1 ) * dist2 );
1279+
pt2.setY( y1 + ( y2 - y1 ) * dist2 );
1280+
secondPointClipped = true;
1281+
}
1282+
12711283
if ( reversed ) //switch p1 and p2
12721284
{
12731285
QgsPoint tmpPt = pt1;

0 commit comments

Comments
 (0)
Please sign in to comment.