Skip to content
Permalink
Browse files

roadgraph GUI update

git-svn-id: http://svn.osgeo.org/qgis/trunk@15261 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
stopa85
stopa85 committed Feb 25, 2011
1 parent f5b1607 commit 7fea9e01ded5609f861f25d4a1e0d5b28f328866
@@ -83,6 +83,12 @@ RgLineVectorLayerSettingsWidget::RgLineVectorLayerSettingsWidget( RgLineVectorLa
mcbSpeed = new QComboBox( frame );
h->addWidget( l );
h->addWidget( mcbSpeed );
mcbUnitOfSpeed = new QComboBox( this );
h->addWidget( mcbUnitOfSpeed );

mcbUnitOfSpeed->insertItem( 0, tr( "km/h" ) );
mcbUnitOfSpeed->insertItem( 0, tr( "m/s" ) );

v->addLayout( h );

frame = new QFrame( tab );
@@ -116,22 +122,6 @@ RgLineVectorLayerSettingsWidget::RgLineVectorLayerSettingsWidget( RgLineVectorLa
h->addWidget( msbSpeedDefault );
v->addLayout( h );

frame = new QFrame( tab );
tab->addTab( frame, tr( "Units" ) );
v = new QVBoxLayout( frame );
h = new QHBoxLayout();
l = new QLabel( tr( "Unit of speed" ) );
mcbUnitOfSpeed = new QComboBox( this );
h->addWidget( l );
h->addWidget( mcbUnitOfSpeed );
v->addLayout( h );

mcbUnitOfSpeed->insertItem( 0, tr( "km/h" ) );
mcbUnitOfSpeed->insertItem( 0, tr( "m/s" ) );
if ( s->mSpeedUnitName == "km/h" )
mcbUnitOfSpeed->setCurrentIndex( 1 );
else if ( s->mSpeedUnitName == "m/s" )
mcbUnitOfSpeed->setCurrentIndex( 0 );

// fill list of layers
QMap<QString, QgsMapLayer*> mapLayers = QgsMapLayerRegistry::instance()->mapLayers();
@@ -177,6 +167,11 @@ RgLineVectorLayerSettingsWidget::RgLineVectorLayerSettingsWidget( RgLineVectorLa
mcbDirectionDefault->setCurrentIndex( 2 );
break;
}
if ( s->mSpeedUnitName == "km/h" )
mcbUnitOfSpeed->setCurrentIndex( 1 );
else if ( s->mSpeedUnitName == "m/s" )
mcbUnitOfSpeed->setCurrentIndex( 0 );

} // RgLineVectorLayerSettingsWidget::RgLineVectorLayerSettingsWidget()

QgsVectorLayer* RgLineVectorLayerSettingsWidget::selectedLayer()
@@ -123,7 +123,10 @@ void RoadGraphPlugin::initGui()

connect( mQGisIface->mapCanvas(), SIGNAL( renderComplete( QPainter* ) ), this, SLOT( render( QPainter* ) ) );
connect( mQGisIface, SIGNAL( projectRead() ), this, SLOT( projectRead() ) );
connect( mQGisIface , SIGNAL( newProjectCreated() ), this, SLOT( newProject() ) );
connect( mQGisIface, SIGNAL( newProjectCreated() ), this, SLOT( newProject() ) );
connect( mQGisIface, SIGNAL( projectRead() ), mQShortestPathDock, SLOT( clear() ) );
connect( mQGisIface, SIGNAL( newProjectCreated() ), mQShortestPathDock, SLOT( clear() ) );

// load settings
projectRead();
} // RoadGraphPlugin::initGui()
@@ -250,7 +250,7 @@ bool RgShortestPathWidget::getPath( AdjacencyMatrix& matrix, QgsPoint& p1, QgsPo
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 ( p2 == QgsPoint( 0.0, 0.0 ) )
{
QMessageBox::critical( this, tr( "Tie point failed" ), tr( "Stop point doesn't tie to the road!" ) );
return false;
@@ -264,7 +264,11 @@ bool RgShortestPathWidget::getPath( AdjacencyMatrix& matrix, QgsPoint& p1, QgsPo
DijkstraFinder f( m, criterion );

matrix = f.find( p1, p2 );

if ( matrix.find( p1 ) == matrix.end() )
{
QMessageBox::critical( this, tr( "Path not found" ), tr( "Path not found" ) );
return false;
}
return true;
}

@@ -310,6 +314,8 @@ void RgShortestPathWidget::clear()
mBackPointLineEdit->setText( QString() );
mrbBackPoint->reset( true );
mrbPath->reset();
mPathCostLineEdit->setText( QString() );
mPathTimeLineEdit->setText( QString() );
}

void RgShortestPathWidget::exportPath()
@@ -96,11 +96,12 @@ class RgShortestPathWidget : public QDockWidget
*/
void clear();

private:
/**
* retrun path as a graph
*/
bool getPath( AdjacencyMatrix &m, QgsPoint& p1, QgsPoint& p2 );
private:

/**
* This line edit show front points coordinates
*/

0 comments on commit 7fea9e0

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