Skip to content

Commit

Permalink
[FEATURE]: text and form annotation tools are now in gui and app
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13189 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 29, 2010
1 parent 93d8bdc commit 466e864
Show file tree
Hide file tree
Showing 33 changed files with 2,814 additions and 5 deletions.
3 changes: 3 additions & 0 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
<file>themes/default/mActionAddSpatiaLiteLayer.png</file>
<file>themes/default/mActionAddVertex.png</file>
<file>themes/default/mActionAddWmsLayer.png</file>
<file>themes/default/mActionAnnotation.png</file>
<file>themes/default/mActionAlignBottom.png</file>
<file>themes/default/mActionAlignHCenter.png</file>
<file>themes/default/mActionAlignLeft.png</file>
Expand Down Expand Up @@ -146,6 +147,7 @@
<file>themes/default/mActionFileSaveAs.png</file>
<file>themes/default/mActionFileSmall.png</file>
<file>themes/default/mActionFolder.png</file>
<file>themes/default/mActionFormAnnotation.png</file>
<file>themes/default/mActionFromSelectedFeature.png</file>
<file>themes/default/mActionGroupItems.png</file>
<file>themes/default/mActionHelpAbout.png</file>
Expand Down Expand Up @@ -198,6 +200,7 @@
<file>themes/default/mActionShowPluginManager.png</file>
<file>themes/default/mActionSimplify.png</file>
<file>themes/default/mActionSplitFeatures.png</file>
<file>themes/default/mActionTextAnnotation.png</file>
<file>themes/default/mActionToggleEditing.png</file>
<file>themes/default/mActionUndo.png</file>
<file>themes/default/mActionUngroupItems.png</file>
Expand Down
Binary file added images/themes/default/mActionAnnotation.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/mActionFormAnnotation.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/mActionTextAnnotation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions python/gui/gui.sip
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@

%Import core/core.sip

%Include qgsannotationitem.sip
%Include qgscolorbutton.sip
%Include qgslegendinterface.sip
%Include qgisinterface.sip
%Include qgscomposerview.sip
%Include qgsencodingfiledialog.sip
%Include qgsformannotationitem.sip
%Include qgsgenericprojectionselector.sip
%Include qgsmapcanvas.sip
%Include qgsmapcanvasitem.sip
Expand All @@ -28,6 +30,7 @@
%Include qgsprojectionselector.sip
%Include qgsquickprint.sip
%Include qgsrubberband.sip
%Include qgstextannotationitem.sip
%Include qgsvertexmarker.sip

%Include symbology-ng-gui.sip
74 changes: 74 additions & 0 deletions python/gui/qgsannotationitem.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**An annotation item can be either placed either on screen corrdinates or on map coordinates.
It may reference a feature and displays that associatiation with a balloon like appearance*/
class QgsAnnotationItem: QgsMapCanvasItem
{
%TypeHeaderCode
#include <qgsannotationitem.h>
%End

public:
enum MouseMoveAction
{
NoAction,
MoveMapPosition,
MoveFramePosition,
ResizeFrameUp,
ResizeFrameDown,
ResizeFrameLeft,
ResizeFrameRight,
ResizeFrameLeftUp,
ResizeFrameRightUp,
ResizeFrameLeftDown,
ResizeFrameRightDown
};

QgsAnnotationItem( QgsMapCanvas* mapCanvas );
virtual ~QgsAnnotationItem();

/**Creates an editor widget (caller takes ownership)*/
virtual QDialog* createEditor() = 0;

void updatePosition();

QRectF boundingRect() const;

virtual QSizeF minimumFrameSize() const;

/**Returns the mouse move behaviour for a given position
@param pos the position in scene coordinates*/
QgsAnnotationItem::MouseMoveAction moveActionForPosition( const QPointF& pos) const;
/**Returns suitable cursor shape for mouse move action*/
Qt::CursorShape cursorShapeForAction( MouseMoveAction moveAction ) const;

//setters and getters
void setMapPositionFixed( bool fixed );
bool mapPositionFixed() const;

virtual void setMapPosition( const QgsPoint& pos );
QgsPoint mapPosition() const;

void setFrameSize( const QSizeF& size );
QSizeF frameSize() const;

void setOffsetFromReferencePoint( const QPointF& offset );
QPointF offsetFromReferencePoint() const;

/**Set symbol that is drawn on map position. Takes ownership*/
void setMarkerSymbol( QgsMarkerSymbolV2* symbol );
const QgsMarkerSymbolV2* markerSymbol() const;

void setFrameBorderWidth( double w );
double frameBorderWidth() const;

void setFrameColor( const QColor& c );
QColor frameColor() const;

void setFrameBackgroundColor( const QColor& c );
QColor frameBackgroundColor() const;

virtual void writeXML( QDomDocument& doc ) const = 0;
virtual void readXML( const QDomDocument& doc, const QDomElement& itemElem ) = 0;

void _writeXML( QDomDocument& doc, QDomElement& itemElem ) const;
void _readXML( const QDomDocument& doc, const QDomElement& annotationElem );
};
31 changes: 31 additions & 0 deletions python/gui/qgsformannotationitem.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class QgsFormAnnotationItem: QObject, QgsAnnotationItem
{
%TypeHeaderCode
#include <qgsformannotationitem.h>
%End

public:
QgsFormAnnotationItem( QgsMapCanvas* canvas, QgsVectorLayer* vlayer = 0, bool hasFeature = false, int feature = 0);
~QgsFormAnnotationItem();

void paint( QPainter * painter );

//! paint function called by map canvas
void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );

/**Create a configuration dialog*/
QDialog* createEditor();

QSizeF minimumFrameSize() const;
/**Returns the optimal frame size*/
QSizeF preferredFrameSize() const;

/**Reimplemented from QgsAnnotationItem*/
void setMapPosition( const QgsPoint& pos );

void setDesignerForm( const QString& uiFile );
QString designerForm() const;

void writeXML( QDomDocument& doc ) const;
void readXML( const QDomDocument& doc, const QDomElement& itemElem );
};
21 changes: 21 additions & 0 deletions python/gui/qgstextannotationitem.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class QgsTextAnnotationItem: QgsAnnotationItem
{
%TypeHeaderCode
#include <qgstextannotationitem.h>
%End
public:
QgsTextAnnotationItem( QgsMapCanvas* canvas );
~QgsTextAnnotationItem();

QDialog* createEditor();

/**Returns document (caller takes ownership)*/
QTextDocument* document() const;
/**Sets document (does not take ownership)*/
void setDocument( const QTextDocument* doc );

void writeXML( QDomDocument& doc ) const;
void readXML( const QDomDocument& doc, const QDomElement& itemElem );

void paint( QPainter* painter );
};
3 changes: 3 additions & 0 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ SET(QGIS_APP_SRCS
qgsmaptooladdvertex.cpp
qgsmaptooladdisland.cpp
qgsmaptooladdring.cpp
qgsmaptoolannotation.cpp
qgsmaptoolcapture.cpp
qgsmaptooldeletering.cpp
qgsmaptooldeletepart.cpp
qgsmaptooldeletevertex.cpp
qgsmaptooledit.cpp
qgsmaptoolformannotation.cpp
qgsmaptoolidentify.cpp
qgsmaptoolmeasureangle.cpp
qgsmaptoolmovefeature.cpp
Expand All @@ -46,6 +48,7 @@ SET(QGIS_APP_SRCS
qgsmaptoolselect.cpp
qgsmaptoolsimplify.cpp
qgsmaptoolsplitfeatures.cpp
qgsmaptooltextannotation.cpp
qgsmaptoolvertexedit.cpp
qgsmeasuredialog.cpp
qgsmeasuretool.cpp
Expand Down
Loading

0 comments on commit 466e864

Please sign in to comment.