Skip to content
Permalink
Browse files
[FEATURE]: text and form annotation tools are now in gui and app
git-svn-id: http://svn.osgeo.org/qgis/trunk@13189 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 29, 2010
1 parent 277fe89 commit 7ba75be847d253bfa4c3f5719b1a6d5ea90fdb6b
@@ -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>
@@ -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>
@@ -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>
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
@@ -28,6 +30,7 @@
%Include qgsprojectionselector.sip
%Include qgsquickprint.sip
%Include qgsrubberband.sip
%Include qgstextannotationitem.sip
%Include qgsvertexmarker.sip

%Include symbology-ng-gui.sip
@@ -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 );
};
@@ -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 );
};
@@ -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 );
};
@@ -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
@@ -46,6 +48,7 @@ SET(QGIS_APP_SRCS
qgsmaptoolselect.cpp
qgsmaptoolsimplify.cpp
qgsmaptoolsplitfeatures.cpp
qgsmaptooltextannotation.cpp
qgsmaptoolvertexedit.cpp
qgsmeasuredialog.cpp
qgsmeasuretool.cpp

0 comments on commit 7ba75be

Please sign in to comment.