Skip to content

Commit

Permalink
fix 'on the fly' transform problem
Browse files Browse the repository at this point in the history
  • Loading branch information
stopa85milk committed May 26, 2011
1 parent 3dad741 commit dd01e40
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/analysis/network/qgsgraphbuilderintr.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ class ANALYSIS_EXPORT QgsGraphBuilderInterface
}

//! get measurement tool
QgsDistanceArea& distanceArea()
QgsDistanceArea* distanceArea()
{
return mDa;
return &mDa;
}

//! add vertex
Expand Down
20 changes: 12 additions & 8 deletions src/analysis/network/qgslinevectorlayerdirector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,23 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
int featureCount = ( int ) vl->featureCount() * 2;
int step = 0;

QgsCoordinateTransform ct( vl->crs(), builder->destinationCrs() );

QgsDistanceArea da;
da.setSourceCrs( builder->destinationCrs().srsid() );
da.setProjectionsEnabled( true );

QgsCoordinateTransform ct;
ct.setSourceCrs( vl->crs() );
if ( builder->coordinateTransformationEnabled() )
{
ct.setDestCRS( builder->destinationCrs() );
}else
{
ct.setDestCRS( vl->crs() );
}

tiedPoint = QVector< QgsPoint >( additionalPoints.size(), QgsPoint( 0.0, 0.0 ) );
TiePointInfo tmpInfo;
tmpInfo.mLength = std::numeric_limits<double>::infinity();

QVector< TiePointInfo > pointLengthMap( additionalPoints.size(), tmpInfo );
QVector< TiePointInfo >::iterator pointLengthIt;

// begin: tie points to the graph
QgsAttributeList la;
vl->select( la );
Expand Down Expand Up @@ -229,7 +233,7 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
pt2 = pointsIt->second;
if ( !isFirstPoint )
{
double distance = da.measureLine( pt1, pt2 );
double distance = builder->distanceArea()->measureLine( pt1, pt2 );
QVector< QVariant > prop;
QList< QgsEdgeProperter* >::const_iterator it;
for ( it = mProperterList.begin(); it != mProperterList.end(); ++it )
Expand Down

0 comments on commit dd01e40

Please sign in to comment.