Skip to content
Permalink
Browse files
Move Martins labeling-ng from plugin to core/app
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13607 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed May 31, 2010
1 parent 6933d1d commit 5946f8935e68736c14dbe7499a1baa130536fd0a
@@ -157,6 +157,7 @@
<file>themes/default/mActionInOverview.png</file>
<file>themes/default/mActionInvertSelection.png</file>
<file>themes/default/mActionLabel.png</file>
<file>themes/default/mActionLabeling.png</file>
<file>themes/default/mActionLowerItems.png</file>
<file>themes/default/mActionMapTips.png</file>
<file>themes/default/mActionMeasure.png</file>
File renamed without changes.
@@ -27,6 +27,9 @@ SET(QGIS_APP_SRCS
qgshelpviewer.cpp
qgsidentifyresults.cpp
qgslabeldialog.cpp
qgslabelengineconfigdialog.cpp
qgslabelinggui.cpp
qgslabelpreview.cpp
qgsmaptooladdfeature.cpp
qgsmaptooladdvertex.cpp
qgsmaptooladdisland.cpp
@@ -140,6 +143,8 @@ SET (QGIS_APP_MOC_HDRS
qgsdelattrdialog.h
qgsfieldcalculator.h
qgsformannotationdialog.h
qgslabelinggui.h
qgslabelengineconfigdialog.h
qgsmaptoolmeasureangle.h
qgsnewvectorlayerdialog.h
qgsgraduatedsymboldialog.h
@@ -112,6 +112,7 @@
#include "qgsexception.h"
#include "qgsfeature.h"
#include "qgsformannotationitem.h"
#include "qgslabelinggui.h"
#include "qgsnewvectorlayerdialog.h"
#include "qgshelpviewer.h"
#include "qgsgenericprojectionselector.h"
@@ -525,6 +526,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
mMapCanvas->freeze( false );
mMapCanvas->clearExtentHistory(); // reset zoomnext/zoomlast
mLastComposerId = 0;
mLBL = new QgsPalLabeling();;
} // QgisApp ctor


@@ -570,6 +572,8 @@ QgisApp::~QgisApp()
deletePrintComposers();
removeAnnotationItems();

delete mLBL;

// delete map layer registry and provider registry
QgsApplication::exitQgis();
}
@@ -959,6 +963,9 @@ void QgisApp::createActions()
mActionAnnotation->setCheckable( true );
connect( mActionAnnotation, SIGNAL( triggered() ), this, SLOT( modifyAnnotation() ) );

mActionLabeling = new QAction( getThemeIcon( "mActionLabeling.png" ), tr( "Labeling" ), this );
connect( mActionLabeling, SIGNAL( triggered() ), this, SLOT( labeling() ) );

// Layer Menu Items

mActionNewVectorLayer = new QAction( getThemeIcon( "mActionNewVectorLayer.png" ), tr( "New Shapefile Layer..." ), this );
@@ -1483,6 +1490,7 @@ void QgisApp::createMenus()

mLayerMenu->addAction( mActionHideAllLayers );
mLayerMenu->addAction( mActionShowAllLayers );
mLayerMenu->addAction( mActionLabeling );

// Settings Menu

@@ -1653,6 +1661,7 @@ void QgisApp::createToolBars()
mAttributesToolBar->addAction( mActionMapTips );
mAttributesToolBar->addAction( mActionShowBookmarks );
mAttributesToolBar->addAction( mActionNewBookmark );
mAttributesToolBar->addAction( mActionLabeling );
// Annotation tools
QToolButton *annotationToolButton = new QToolButton();
annotationToolButton->setPopupMode( QToolButton::InstantPopup );
@@ -3017,9 +3026,9 @@ void QgisApp::newVectorLayer()
return;
}

fileName = openFileDialog->selectedFiles().first();
fileName = openFileDialog->selectedFiles().first();

if( fileformat == "ESRI Shapefile" && !fileName.endsWith( ".shp", Qt::CaseInsensitive ) )
if ( fileformat == "ESRI Shapefile" && !fileName.endsWith( ".shp", Qt::CaseInsensitive ) )
fileName += ".shp";

enc = openFileDialog->encoding();
@@ -3738,6 +3747,31 @@ void QgisApp::modifyAnnotation()
mMapCanvas->setMapTool( mMapTools.mAnnotation );
}

void QgisApp::labeling()
{
QgsMapLayer* layer = activeLayer();
if ( layer == NULL || layer->type() != QgsMapLayer::VectorLayer )
{
QMessageBox::warning( this, "Labeling", "Please select a vector layer first." );
return;
}
QgsVectorLayer* vlayer = dynamic_cast<QgsVectorLayer*>( layer );

QgsLabelingGui labelGui( mLBL, vlayer, this );

if ( labelGui.exec() )
{
// alter labeling - save the changes
labelGui.layerSettings().writeToLayer( vlayer );

// trigger refresh
if ( mMapCanvas )
{
mMapCanvas->refresh();
}
}
}

void QgisApp::attributeTable()
{
if ( mMapCanvas && mMapCanvas->isDrawing() )
@@ -52,6 +52,7 @@ class QgsMapCanvas;
class QgsMapLayer;
class QgsMapTip;
class QgsMapTool;
class QgsPalLabeling;
class QgsPoint;
class QgsProviderRegistry;
class QgsPythonUtils;
@@ -650,6 +651,9 @@ class QgisApp : public QMainWindow
void addTextAnnotation();
void modifyAnnotation();

//! shows label settings dialog (for labeling-ng)
void labeling();

//! show the attribute table for the currently selected layer
void attributeTable();

@@ -876,6 +880,7 @@ class QgisApp : public QMainWindow
QAction *mActionTextAnnotation;
QAction *mActionFormAnnotation;
QAction *mActionAnnotation;
QAction *mActionLabeling;

QAction *mActionNewVectorLayer;
QAction *mActionNewSpatialiteLayer;
@@ -1116,6 +1121,9 @@ class QgisApp : public QMainWindow
//! Persistent GPS toolbox
QgsGPSInformationWidget * mpGpsWidget;
#endif

QgsPalLabeling* mLBL;

//! project changed
void projectChanged( const QDomDocument & );
};
@@ -1,8 +1,8 @@
#include "engineconfigdialog.h"
#include "qgslabelengineconfigdialog.h"

#include "pallabeling.h"
#include "qgspallabeling.h"

EngineConfigDialog::EngineConfigDialog( PalLabeling* lbl, QWidget* parent )
QgsLabelEngineConfigDialog::QgsLabelEngineConfigDialog( QgsPalLabeling* lbl, QWidget* parent )
: QDialog( parent ), mLBL( lbl )
{
setupUi( this );
@@ -25,10 +25,10 @@ EngineConfigDialog::EngineConfigDialog( PalLabeling* lbl, QWidget* parent )
}


void EngineConfigDialog::onOK()
void QgsLabelEngineConfigDialog::onOK()
{
// save
mLBL->setSearchMethod(( PalLabeling::Search ) cboSearchMethod->currentIndex() );
mLBL->setSearchMethod(( QgsPalLabeling::Search ) cboSearchMethod->currentIndex() );

mLBL->setNumCandidatePositions( spinCandPoint->value(),
spinCandLine->value(),
@@ -0,0 +1,23 @@
#ifndef QGSLABELENGINECONFIGDIALOG_H
#define QGSLABELENGINECONFIGDIALOG_H

#include <QDialog>

#include "ui_qgsengineconfigdialog.h"

class QgsPalLabeling;

class QgsLabelEngineConfigDialog : public QDialog, private Ui::QgsEngineConfigDialog
{
Q_OBJECT
public:
QgsLabelEngineConfigDialog( QgsPalLabeling* lbl, QWidget* parent = NULL );

public slots:
void onOK();

protected:
QgsPalLabeling* mLBL;
};

#endif // QGSLABELENGINECONFIGDIALOG_H

0 comments on commit 5946f89

Please sign in to comment.