Skip to content

Commit

Permalink
Some roadgraph plugin ux improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 17, 2016
1 parent 9abb6c4 commit 5d54b5b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/plugins/roadgraph/roadgraphplugin.cpp
Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand All @@ -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() ) );
Expand All @@ -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() ) );
Expand Down
12 changes: 7 additions & 5 deletions src/plugins/roadgraph/shortestpathwidget.cpp
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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 ) ) );
Expand Down

0 comments on commit 5d54b5b

Please sign in to comment.