-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE]: move/rotate/change label edit tools to interactively chang…
…e data defined label properties git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14697 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
mhugent
committed
Nov 17, 2010
1 parent
535b533
commit 1ae742e
Showing
30 changed files
with
1,721 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/*************************************************************************** | ||
qgsmaptoolchangelabelproperties.cpp | ||
--------------------------------- | ||
begin : 2010-11-11 | ||
copyright : (C) 2010 by Marco Hugentobler | ||
email : marco dot hugentobler at sourcepole dot ch | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsmaptoolchangelabelproperties.h" | ||
#include "qgslabelpropertydialog.h" | ||
#include "qgsmapcanvas.h" | ||
#include "qgsrubberband.h" | ||
#include "qgsvectorlayer.h" | ||
|
||
QgsMapToolChangeLabelProperties::QgsMapToolChangeLabelProperties( QgsMapCanvas* canvas ): QgsMapToolLabel( canvas ) | ||
{ | ||
} | ||
|
||
QgsMapToolChangeLabelProperties::~QgsMapToolChangeLabelProperties() | ||
{ | ||
} | ||
|
||
void QgsMapToolChangeLabelProperties::canvasPressEvent( QMouseEvent * e ) | ||
{ | ||
deleteRubberBands(); | ||
|
||
if ( !labelAtPosition( e, mCurrentLabelPos ) ) | ||
{ | ||
return; | ||
} | ||
|
||
QgsVectorLayer* vlayer = currentLayer(); | ||
if ( !vlayer || !vlayer->isEditable() ) | ||
{ | ||
return; | ||
} | ||
|
||
createRubberBands(); | ||
} | ||
|
||
void QgsMapToolChangeLabelProperties::canvasReleaseEvent( QMouseEvent * e ) | ||
{ | ||
QgsVectorLayer* vlayer = currentLayer(); | ||
if ( mLabelRubberBand && mCanvas && vlayer ) | ||
{ | ||
QgsLabelPropertyDialog d( mCurrentLabelPos.layerID, mCurrentLabelPos.featureId, mCanvas->mapRenderer() ); | ||
if ( d.exec() == QDialog::Accepted ) | ||
{ | ||
const QgsAttributeMap& changes = d.changedProperties(); | ||
if ( changes.size() > 0 ) | ||
{ | ||
vlayer->beginEditCommand( tr( "Label properties changed" ) ); | ||
|
||
QgsAttributeMap::const_iterator changeIt = changes.constBegin(); | ||
for ( ; changeIt != changes.constEnd(); ++changeIt ) | ||
{ | ||
vlayer->changeAttributeValue( mCurrentLabelPos.featureId, changeIt.key(), changeIt.value(), false ); | ||
} | ||
|
||
vlayer->endEditCommand(); | ||
mCanvas->refresh(); | ||
} | ||
} | ||
deleteRubberBands(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*************************************************************************** | ||
qgsmaptoolchangelabelproperties.h | ||
--------------------------------- | ||
begin : 2010-11-11 | ||
copyright : (C) 2010 by Marco Hugentobler | ||
email : marco dot hugentobler at sourcepole dot ch | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSMAPTOOLCHANGELABELPROPERTIES_H | ||
#define QGSMAPTOOLCHANGELABELPROPERTIES_H | ||
|
||
#include "qgsmaptoollabel.h" | ||
|
||
class QgsMapToolChangeLabelProperties: public QgsMapToolLabel | ||
{ | ||
public: | ||
QgsMapToolChangeLabelProperties( QgsMapCanvas* canvas ); | ||
~QgsMapToolChangeLabelProperties(); | ||
|
||
virtual void canvasPressEvent( QMouseEvent * e ); | ||
virtual void canvasReleaseEvent( QMouseEvent * e ); | ||
|
||
}; | ||
|
||
#endif // QGSMAPTOOLCHANGELABEL_H |
Oops, something went wrong.