Skip to content

Commit

Permalink
update indentation of roadgraph plugin
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15123 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Feb 3, 2011
1 parent d3854f6 commit 6645348
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/plugins/roadgraph/graphbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// Qgis includes

RgGraphBuilder::RgGraphBuilder( const QgsCoordinateReferenceSystem& crs ) :
mCrs( crs )
mCrs( crs )
{

}
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/roadgraph/graphbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ class RgGraphBuilder

//! Destructor
virtual ~RgGraphBuilder();

/**
* get destinaltion Crs
*/
QgsCoordinateReferenceSystem& destinationCrs();

/**
* add vertex
*/
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/roadgraph/graphdirector.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//forward declarations
class RgGraphBuilder;

/**
/**
* \class RgGraphDirector
* \brief Determine making the graph
*/
Expand All @@ -44,8 +44,8 @@ class RgGraphDirector
*
* @note if tiedPoints[i]==QgsPoint(0.0,0.0) then tied failed.
*/
virtual void makeGraph( RgGraphBuilder *builder,
const QVector< QgsPoint >& additionalPoints,
virtual void makeGraph( RgGraphBuilder *builder,
const QVector< QgsPoint >& additionalPoints,
QVector< QgsPoint>& tiedPoints ) const = 0;

/**
Expand Down
26 changes: 13 additions & 13 deletions src/plugins/roadgraph/linevectorlayerdirector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ QString RgLineVectorLayerDirector::name() const
return QString( "Vector line" );
}

void RgLineVectorLayerDirector::makeGraph( RgGraphBuilder *builder, const QVector< QgsPoint >& additionalPoints,
void RgLineVectorLayerDirector::makeGraph( RgGraphBuilder *builder, const QVector< QgsPoint >& additionalPoints,
QVector< QgsPoint >& tiedPoint ) const
{
QgsVectorLayer *vl = myLayer();

if ( vl == NULL )
return;

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

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

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

Expand All @@ -97,12 +97,12 @@ void RgLineVectorLayerDirector::makeGraph( RgGraphBuilder *builder, const QVecto
pt2 = ct.transform( *pointIt );
if ( !isFirstPoint )
{
int i=0;
int i = 0;
for ( i = 0; i != additionalPoints.size(); ++i )
{
TiePointInfo info;
info.mLength = additionalPoints[ i ].sqrDistToSegment( pt1.x(), pt1.y(), pt2.x(), pt2.y(), info.mTiedPoint );

if ( pointLengthMap[ i ].mLength > info.mLength )
{
info.mFirstPoint = pt1;
Expand Down Expand Up @@ -182,17 +182,17 @@ void RgLineVectorLayerDirector::makeGraph( RgGraphBuilder *builder, const QVecto
for ( pointIt = pl.begin(); pointIt != pl.end(); ++pointIt )
{
pt2 = ct.transform( *pointIt );

std::map< double, QgsPoint > pointsOnArc;
pointsOnArc[ 0.0 ] = pt1;
pointsOnArc[ pt1.sqrDist( pt2 ) ] = pt2;
pointsOnArc[ pt1.sqrDist( pt2 )] = pt2;

for( pointLengthIt = pointLengthMap.begin(); pointLengthIt != pointLengthMap.end(); ++pointLengthIt )
for ( pointLengthIt = pointLengthMap.begin(); pointLengthIt != pointLengthMap.end(); ++pointLengthIt )
{
if ( pointLengthIt->mFirstPoint == pt1 && pointLengthIt->mLastPoint == pt2 )
{
QgsPoint tiedPoint = pointLengthIt->mTiedPoint;
pointsOnArc[ pt1.sqrDist( tiedPoint ) ] = tiedPoint;
pointsOnArc[ pt1.sqrDist( tiedPoint )] = tiedPoint;
}
}

Expand All @@ -207,21 +207,21 @@ void RgLineVectorLayerDirector::makeGraph( RgGraphBuilder *builder, const QVecto
pt2 = pointsIt->second;
if ( !isFirstPoint )
{
double cost = da.measureLine( pt1, pt2 );
double cost = da.measureLine( pt1, pt2 );
if ( directionType == 1 ||
directionType == 3 )
{
builder->addArc( pt1, pt2, cost, speed*su.multipler() );
}
if ( directionType == 2 ||
if ( directionType == 2 ||
directionType == 3 )
{
builder->addArc( pt2, pt1, cost, speed*su.multipler() );
}
}
pt1 = pt2;
isFirstPoint = false;
}
}
} // if ( !isFirstPoint )
pt1 = pt2;
isFirstPoint = false;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/roadgraph/linevectorlayerdirector.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ class RgLineVectorLayerDirector : public RgGraphDirector
/**
* MANDATORY DIRECTOR PROPERTY DECLARATION
*/
void makeGraph( RgGraphBuilder *builder,
void makeGraph( RgGraphBuilder *builder,
const QVector< QgsPoint >& additionalPoints,
QVector< QgsPoint>& tiedPoints ) const;

QString name() const;

private:
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/roadgraph/roadgraphplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void RoadGraphPlugin::render( QPainter *painter )
if ( graphDirector == NULL )
return;

RgSimpleGraphBuilder builder ( mQGisIface->mapCanvas()->mapRenderer()->destinationSrs() );
RgSimpleGraphBuilder builder( mQGisIface->mapCanvas()->mapRenderer()->destinationSrs() );
QVector< QgsPoint > null;
graphDirector->makeGraph( &builder , null, null );
AdjacencyMatrix m = builder.adjacencyMatrix();
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/roadgraph/shortestpathwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ bool RgShortestPathWidget::getPath( AdjacencyMatrix& matrix, QgsPoint& p1, QgsPo
}
QVector< QgsPoint > points;
QVector< QgsPoint > tiedPoint;

points.push_back( mFrontPoint );
points.push_back( mBackPoint );
points.push_back( mBackPoint );

director->makeGraph( &builder, points, tiedPoint );
p1 = tiedPoint[ 0 ];
Expand All @@ -244,12 +244,12 @@ bool RgShortestPathWidget::getPath( AdjacencyMatrix& matrix, QgsPoint& p1, QgsPo
delete director;
}

if ( p1 == QgsPoint(0.0, 0.0) )
if ( p1 == QgsPoint( 0.0, 0.0 ) )
{
QMessageBox::critical( this, tr( "Tie point failed" ), tr( "Start point doesn't tie to the road!" ) );
return false;
}
if ( p1 == QgsPoint(0.0, 0.0) )
if ( p1 == QgsPoint( 0.0, 0.0 ) )
{
QMessageBox::critical( this, tr( "Tie point failed" ), tr( "Stop point doesn't tie to the road!" ) );
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/roadgraph/simplegraphbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// Qgis includes

RgSimpleGraphBuilder::RgSimpleGraphBuilder( const QgsCoordinateReferenceSystem& crs ) :
RgGraphBuilder( crs )
RgGraphBuilder( crs )
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/roadgraph/simplegraphbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ class RgSimpleGraphBuilder : public RgGraphBuilder
* default constructor
*/
RgSimpleGraphBuilder( const QgsCoordinateReferenceSystem& crs );

/**
* MANDATORY BUILDER PROPERTY DECLARATION
*/
void addVertex( const QgsPoint& pt );
void addArc( const QgsPoint& pt1, const QgsPoint& pt2, double cost, double speed );

/**
* return Adjacecncy matrix;
*/
Expand Down

0 comments on commit 6645348

Please sign in to comment.