Skip to content

Commit

Permalink
Merge pull request #1624 from 3nids/cadtool_single
Browse files Browse the repository at this point in the history
Advanced digitizing tools (aka CAD tools)
  • Loading branch information
3nids committed Dec 9, 2014
2 parents 2b1b79d + d39a854 commit d65a6f7
Show file tree
Hide file tree
Showing 45 changed files with 2,771 additions and 138 deletions.
6 changes: 6 additions & 0 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,12 @@
<file>themes/default/mActionScaleHighlightFeature.svg</file>
<file>themes/default/mActionPanHighlightFeature.svg</file>
<file>flags/sr@latin.png</file>
<file>themes/default/cadtools/construction.png</file>
<file>themes/default/cadtools/delta.png</file>
<file>themes/default/cadtools/cad.png</file>
<file>themes/default/cadtools/lock.png</file>
<file>themes/default/cadtools/parallel.png</file>
<file>themes/default/cadtools/perpendicular.png</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
Expand Down
Binary file added images/themes/default/cadtools/cad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/default/cadtools/construction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/default/cadtools/delta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/default/cadtools/lock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/default/cadtools/parallel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/default/cadtools/perpendicular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions python/core/qgsmaptopixel.sip
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class QgsMapToPixel
QgsPoint toMapCoordinates( QPoint p ) const;

QgsPoint toMapPoint( double x, double y ) const;

/*! Set map units per pixel
* @param mapUnitsPerPixel Map units per pixel
*/
Expand Down
6 changes: 6 additions & 0 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ SET(QGIS_APP_SRCS
qgsattributetabledialog.cpp
qgsbookmarks.cpp
qgsbrowserdockwidget.cpp
qgsadvanceddigitizingdockwidget.cpp
qgsadvanceddigitizingcanvasitem.cpp
qgsclipboard.cpp
qgsconfigureshortcutsdialog.cpp
qgscustomization.cpp
Expand Down Expand Up @@ -43,6 +45,7 @@ SET(QGIS_APP_SRCS
qgslabelinggui.cpp
qgslabelpreview.cpp
qgsloadstylefromdbdialog.cpp
qgsmapmouseevent.cpp
qgssavestyletodbdialog.cpp
qgsguivectorlayertools.cpp

Expand All @@ -63,6 +66,7 @@ SET(QGIS_APP_SRCS
qgsmaptoolshowhidelabels.cpp
qgsmaptoolidentifyaction.cpp
qgsmaptoollabel.cpp
qgsmaptooladvanceddigitizing.cpp
qgsmaptoolmeasureangle.cpp
qgsmaptoolmovefeature.cpp
qgsmaptoolmovelabel.cpp
Expand Down Expand Up @@ -167,6 +171,7 @@ SET (QGIS_APP_MOC_HDRS
qgsattributetabledialog.h
qgsbookmarks.h
qgsbrowserdockwidget.h
qgsadvanceddigitizingdockwidget.h
qgsclipboard.h
qgsconfigureshortcutsdialog.h
qgscustomization.h
Expand Down Expand Up @@ -211,6 +216,7 @@ SET (QGIS_APP_MOC_HDRS
qgsmaptoolpinlabels.h
qgsmaptoolshowhidelabels.h
qgsmaptoolidentifyaction.h
qgsmaptooladvanceddigitizing.h
qgsmaptoolmeasureangle.h
qgsmaptoolmovefeature.h
qgsmaptoolmovelabel.h
Expand Down
18 changes: 18 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
#include "qgsattributetabledialog.h"
#include "qgsbookmarks.h"
#include "qgsbrowserdockwidget.h"
#include "qgsadvanceddigitizingdockwidget.h"
#include "qgsclipboard.h"
#include "qgscomposer.h"
#include "qgscomposermanager.h"
Expand Down Expand Up @@ -584,6 +585,10 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
mUndoWidget = new QgsUndoWidget( NULL, mMapCanvas );
mUndoWidget->setObjectName( "Undo" );

// Advanced Digitizing dock
mAdvancedDigitizingDockWidget = new QgsAdvancedDigitizingDockWidget( mMapCanvas, this );
mAdvancedDigitizingDockWidget->setObjectName( "Cad" );

createActions();
createActionGroups();
createMenus();
Expand Down Expand Up @@ -620,6 +625,9 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
addDockWidget( Qt::LeftDockWidgetArea, mBrowserWidget2 );
mBrowserWidget2->hide();

addDockWidget( Qt::LeftDockWidgetArea, mAdvancedDigitizingDockWidget );
mAdvancedDigitizingDockWidget->hide();

// create the GPS tool on starting QGIS - this is like the browser
mpGpsWidget = new QgsGPSInformationWidget( mMapCanvas );
//create the dock widget
Expand Down Expand Up @@ -1632,6 +1640,11 @@ void QgisApp::createToolBars()
actionWhatsThis->setIcon( QgsApplication::getThemeIcon( "/mActionWhatsThis.svg" ) );
mHelpToolBar->addAction( actionWhatsThis );

// Cad toolbar
QAction* cadAction = mAdvancedDigitizingDockWidget->toggleViewAction();
cadAction->setText( tr( "Show CAD tools" ) );
cadAction->setIcon( QgsApplication::getThemeIcon( "/cadtools/cad.png" ) );
mAdvancedDigitizeToolBar->insertAction( mActionUndo, cadAction );
}

void QgisApp::createStatusBar()
Expand Down Expand Up @@ -4844,6 +4857,11 @@ void QgisApp::labeling()
activateDeactivateLayerRelatedActions( vlayer );
}

void QgisApp::setCadDockVisible( bool visible )
{
mAdvancedDigitizingDockWidget->setVisible( visible );
}

void QgisApp::fieldCalculator()
{
QgsVectorLayer *myLayer = qobject_cast<QgsVectorLayer *>( activeLayer() );
Expand Down
10 changes: 10 additions & 0 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class QgsMapCanvas;
class QgsMapLayer;
class QgsMapTip;
class QgsMapTool;
class QgsMapToolAdvancedDigitizing;
class QgsPoint;
class QgsProviderRegistry;
class QgsPythonUtils;
Expand All @@ -68,6 +69,7 @@ class QNetworkProxy;
class QAuthenticator;

class QgsBrowserDockWidget;
class QgsAdvancedDigitizingDockWidget;
class QgsSnappingDialog;
class QgsGPSInformationWidget;

Expand Down Expand Up @@ -420,6 +422,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QToolBar *databaseToolBar() { return mDatabaseToolBar; }
QToolBar *webToolBar() { return mWebToolBar; }

//! return CAD dock widget
QgsAdvancedDigitizingDockWidget* cadDockWidget() { return mAdvancedDigitizingDockWidget; }

//! show layer properties
void showLayerProperties( QgsMapLayer *ml );

Expand Down Expand Up @@ -1090,6 +1095,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! shows label settings dialog (for labeling-ng)
void labeling();

//! set the CAD dock widget visible
void setCadDockVisible( bool visible );

/** Check if deprecated labels are used in project, and flag projects that use them */
void checkForDeprecatedLabelsInProject();

Expand Down Expand Up @@ -1543,6 +1551,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QgsBrowserDockWidget* mBrowserWidget;
QgsBrowserDockWidget* mBrowserWidget2;

QgsAdvancedDigitizingDockWidget* mAdvancedDigitizingDockWidget;

QgsSnappingDialog* mSnappingDialog;

QgsPluginManager* mPluginManager;
Expand Down
1 change: 1 addition & 0 deletions src/app/qgisappinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "qgscomposerview.h"
#include "qgsmaplayer.h"
#include "qgsmaplayerregistry.h"
#include "qgsmaptooladvanceddigitizing.h"
#include "qgsmapcanvas.h"
#include "qgsproject.h"
#include "qgslayertreeview.h"
Expand Down
Loading

0 comments on commit d65a6f7

Please sign in to comment.