Skip to content
Permalink
Browse files

update indentation of roadgraph plugin

git-svn-id: http://svn.osgeo.org/qgis/trunk@15123 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Feb 3, 2011
1 parent 0634c03 commit e35ee4ea618e8feeed0ea1cfa28efd6d612b6216
@@ -19,7 +19,7 @@
// Qgis includes

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

}
@@ -37,12 +37,12 @@ class RgGraphBuilder

//! Destructor
virtual ~RgGraphBuilder();

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

/**
* add vertex
*/
@@ -23,7 +23,7 @@
//forward declarations
class RgGraphBuilder;

/**
/**
* \class RgGraphDirector
* \brief Determine making the graph
*/
@@ -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;

/**
@@ -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();

@@ -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;
@@ -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;
}
}

@@ -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;
@@ -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:
@@ -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();
@@ -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 ];
@@ -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;
@@ -20,7 +20,7 @@
// Qgis includes

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

@@ -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;
*/

0 comments on commit e35ee4e

Please sign in to comment.
You can’t perform that action at this time.