Skip to content
Permalink
Browse files

Some roadgraph plugin ux improvements

  • Loading branch information
nyalldawson committed Jun 17, 2016
1 parent 9abb6c4 commit 5d54b5b4a52ff4a4797a50fecc46d77268390738
Showing with 11 additions and 9 deletions.
  1. +4 −4 src/plugins/roadgraph/roadgraphplugin.cpp
  2. +7 −5 src/plugins/roadgraph/shortestpathwidget.cpp
@@ -57,7 +57,7 @@
// standard includes

static const QString sName = QObject::tr( "Road graph plugin" );
static const QString sDescription = QObject::tr( "It solves the shortest path problem." );
static const QString sDescription = QObject::tr( "Solves the shortest path problem by tracing along line layers." );
static const QString sCategory = QObject::tr( "Vector" );
static const QString sPluginVersion = QObject::tr( "Version 0.1" );
static const QString sPluginIcon = ":/roadgraph/road-fast.png";
@@ -102,7 +102,7 @@ void RoadGraphPlugin::initGui()
mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mQShortestPathDock );

// Create the action for tool
mQSettingsAction = new QAction( QIcon( ":/roadgraph/road.png" ), tr( "Settings" ), this );
mQSettingsAction = new QAction( QIcon( ":/roadgraph/road.png" ), tr( "Settings..." ), this );
mQSettingsAction->setObjectName( "mQSettingsAction" );

// Set the what's this text
@@ -113,7 +113,7 @@ void RoadGraphPlugin::initGui()
// Connect the action to slots
connect( mQSettingsAction, SIGNAL( triggered() ), this, SLOT( property() ) );

mQGisIface->addPluginToVectorMenu( tr( "Road graph" ), mQSettingsAction );
mQGisIface->addPluginToVectorMenu( tr( "Road Graph" ), mQSettingsAction );

connect( mQGisIface, SIGNAL( projectRead() ), this, SLOT( projectRead() ) );
connect( mQGisIface, SIGNAL( newProjectCreated() ), this, SLOT( newProject() ) );
@@ -128,7 +128,7 @@ void RoadGraphPlugin::initGui()
void RoadGraphPlugin::unload()
{
// remove the GUI
mQGisIface->removePluginVectorMenu( tr( "Road graph" ), mQSettingsAction );
mQGisIface->removePluginVectorMenu( tr( "Road Graph" ), mQSettingsAction );

// disconnect
disconnect( mQGisIface->mainWindow(), SIGNAL( projectRead() ), this, SLOT( projectRead() ) );
@@ -66,6 +66,8 @@ RgShortestPathWidget::RgShortestPathWidget( QWidget* theParent, RoadGraphPlugin
setWidget( myWidget );

QVBoxLayout *v = new QVBoxLayout( myWidget );
v->setMargin( 0 );
v->setContentsMargins( 0, 0, 0, 0 );
QHBoxLayout *h = nullptr;
QLabel *l = nullptr;

@@ -197,8 +199,8 @@ void RgShortestPathWidget::onSelectFrontPoint()
void RgShortestPathWidget::setFrontPoint( const QgsPoint& pt )
{
mPlugin->iface()->mapCanvas()->unsetMapTool( mFrontPointMapTool );
mFrontPointLineEdit->setText( QString( "(" ) + QString().setNum( pt.x() ) + QLatin1String( "," ) +
QString().setNum( pt.y() ) + QLatin1String( ")" ) );
mFrontPointLineEdit->setText( QString( "(%1, %2)" ).arg( QString::number( pt.x(), 'f' ),
QString::number( pt.y(), 'f' ) ) );
mFrontPoint = pt;

double mupp = mPlugin->iface()->mapCanvas()->getCoordinateTransform()->mapUnitsPerPixel() * 2;
@@ -221,8 +223,8 @@ void RgShortestPathWidget::setBackPoint( const QgsPoint& pt )
mPlugin->iface()->mapCanvas()->unsetMapTool( mBackPointMapTool );

mBackPoint = pt;
mBackPointLineEdit->setText( QString( "(" ) + QString().setNum( pt.x() ) + QLatin1String( "," ) +
QString().setNum( pt.y() ) + QLatin1String( ")" ) );
mBackPointLineEdit->setText( QString( "(%1, %2)" ).arg( QString::number( pt.x(), 'f' ),
QString::number( pt.y(), 'f' ) ) );

double mupp = mPlugin->iface()->mapCanvas()->getCoordinateTransform()->mapUnitsPerPixel() * 2;

@@ -250,7 +252,7 @@ QgsGraph* RgShortestPathWidget::getPath( QgsPoint& p1, QgsPoint& p2 )
const QgsGraphDirector *director = mPlugin->director();
if ( !director )
{
QMessageBox::critical( this, tr( "Plugin isn't configured" ), tr( "Plugin isn't configured! Please go to the Vector Road graph → Settings to configure it." ) );
QMessageBox::critical( this, tr( "Plugin isn't configured" ), tr( "Plugin isn't configured! Please go to the Vector menu, Road Graph, Settings option to configure it." ) );
return nullptr;
}
connect( director, SIGNAL( buildProgress( int, int ) ), mPlugin->iface()->mainWindow(), SLOT( showProgress( int, int ) ) );

0 comments on commit 5d54b5b

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