Skip to content

Commit dd01e40

Browse files
committedMay 26, 2011
fix 'on the fly' transform problem
1 parent 3dad741 commit dd01e40

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed
 

‎src/analysis/network/qgsgraphbuilderintr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ class ANALYSIS_EXPORT QgsGraphBuilderInterface
7272
}
7373

7474
//! get measurement tool
75-
QgsDistanceArea& distanceArea()
75+
QgsDistanceArea* distanceArea()
7676
{
77-
return mDa;
77+
return &mDa;
7878
}
7979

8080
//! add vertex

‎src/analysis/network/qgslinevectorlayerdirector.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,23 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
6969
int featureCount = ( int ) vl->featureCount() * 2;
7070
int step = 0;
7171

72-
QgsCoordinateTransform ct( vl->crs(), builder->destinationCrs() );
73-
74-
QgsDistanceArea da;
75-
da.setSourceCrs( builder->destinationCrs().srsid() );
76-
da.setProjectionsEnabled( true );
77-
72+
QgsCoordinateTransform ct;
73+
ct.setSourceCrs( vl->crs() );
74+
if ( builder->coordinateTransformationEnabled() )
75+
{
76+
ct.setDestCRS( builder->destinationCrs() );
77+
}else
78+
{
79+
ct.setDestCRS( vl->crs() );
80+
}
81+
7882
tiedPoint = QVector< QgsPoint >( additionalPoints.size(), QgsPoint( 0.0, 0.0 ) );
7983
TiePointInfo tmpInfo;
8084
tmpInfo.mLength = std::numeric_limits<double>::infinity();
8185

8286
QVector< TiePointInfo > pointLengthMap( additionalPoints.size(), tmpInfo );
8387
QVector< TiePointInfo >::iterator pointLengthIt;
84-
88+
8589
// begin: tie points to the graph
8690
QgsAttributeList la;
8791
vl->select( la );
@@ -229,7 +233,7 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
229233
pt2 = pointsIt->second;
230234
if ( !isFirstPoint )
231235
{
232-
double distance = da.measureLine( pt1, pt2 );
236+
double distance = builder->distanceArea()->measureLine( pt1, pt2 );
233237
QVector< QVariant > prop;
234238
QList< QgsEdgeProperter* >::const_iterator it;
235239
for ( it = mProperterList.begin(); it != mProperterList.end(); ++it )

0 commit comments

Comments
 (0)
Please sign in to comment.