Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port polygon and polyline items to layouts
- Loading branch information
1 parent
b41fea9
commit 783636d
Showing
33 changed files
with
1,991 additions
and
0 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
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,181 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/layout/qgslayoutitemnodeitem.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsLayoutNodesItem: QgsLayoutItem | ||
{ | ||
%Docstring | ||
An abstract layout item that provides generic methods for node based | ||
shapes such as polygon or polylines. | ||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgslayoutitemnodeitem.h" | ||
%End | ||
public: | ||
|
||
bool addNode( QPointF point, bool checkArea = true, double radius = 10 ); | ||
%Docstring | ||
Add a node in current shape. | ||
\param point is the location of the new node (in scene coordinates) | ||
\param checkArea is a flag to indicate if there's a space constraint. | ||
\param radius is the space contraint and is used only if checkArea is | ||
true. Typically, if this flag is true, the new node has to be nearer | ||
than radius to the shape to be added. | ||
:rtype: bool | ||
%End | ||
|
||
void setDisplayNodes( bool display = true ); | ||
%Docstring | ||
Set whether the item's nodes should be displayed. | ||
%End | ||
|
||
bool moveNode( int index, QPointF node ); | ||
%Docstring | ||
Moves a node to a new position. | ||
\param index the index of the node to move | ||
\param node is the new position in scene coordinate | ||
:rtype: bool | ||
%End | ||
|
||
int nodeAtPosition( QPointF point, bool searchInRadius = true, double radius = 10 ) const; | ||
%Docstring | ||
Search for the nearest node in the shape within a maximal area. Returns the | ||
index of the nearest node or -1 if no node was found. | ||
\param point is the location to search for nodes from (in scene coordinates) | ||
\param searchInRadius is a flag to indicate if the area of research is | ||
limited in space. | ||
\param radius is only used if searchInRadius is true | ||
:rtype: int | ||
%End | ||
|
||
bool nodePosition( int index, QPointF &position ) const; | ||
%Docstring | ||
Gets the position of a node in scene coordinates. | ||
\param index of the node | ||
\param position the position of the node | ||
:return: true if the index is valid and the position is set, false otherwise | ||
:rtype: bool | ||
%End | ||
|
||
bool removeNode( int index ); | ||
%Docstring | ||
Remove a node with specified ``index`` from the shape. | ||
:rtype: bool | ||
%End | ||
|
||
int nodesSize() const; | ||
%Docstring | ||
Returns the number of nodes in the shape. | ||
:rtype: int | ||
%End | ||
|
||
bool setSelectedNode( int index ); | ||
%Docstring | ||
Selects a node by ``index``. | ||
:rtype: bool | ||
%End | ||
|
||
int selectedNode() const; | ||
%Docstring | ||
Returns the currently selected node, or -1 if no node is selected. | ||
:rtype: int | ||
%End | ||
|
||
void deselectNode(); | ||
%Docstring | ||
Deselects any selected nodes. | ||
%End | ||
|
||
QPolygonF nodes() const; | ||
%Docstring | ||
Returns the nodes the shape consists of. | ||
:rtype: QPolygonF | ||
%End | ||
|
||
protected: | ||
|
||
QgsLayoutNodesItem( QgsLayout *layout ); | ||
%Docstring | ||
Constructor | ||
\param tagName tag used in XML file | ||
\param layout parent layout | ||
%End | ||
|
||
QgsLayoutNodesItem( const QPolygonF &polygon, QgsLayout *layout ); | ||
%Docstring | ||
Constructor | ||
\param tagName tag used in XML file | ||
\param polygon nodes of the shape | ||
\param layout parent layout | ||
%End | ||
|
||
virtual void draw( QgsRenderContext &context, const QStyleOptionGraphicsItem *itemStyle = 0 ); | ||
|
||
virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const; | ||
|
||
virtual bool readPropertiesFromElement( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context ); | ||
|
||
|
||
|
||
virtual bool _addNode( const int nodeIndex, QPointF newNode, const double radius ) = 0; | ||
%Docstring | ||
Method called in addNode. | ||
:rtype: bool | ||
%End | ||
|
||
virtual bool _removeNode( const int nodeIndex ) = 0; | ||
%Docstring | ||
Method called in removeNode. | ||
:rtype: bool | ||
%End | ||
|
||
virtual void _draw( QgsRenderContext &context, const QStyleOptionGraphicsItem *itemStyle = 0 ) = 0; | ||
%Docstring | ||
Method called in paint. | ||
%End | ||
|
||
virtual void _readXmlStyle( const QDomElement &elmt, const QgsReadWriteContext &context ) = 0; | ||
%Docstring | ||
Method called in readXml. | ||
%End | ||
|
||
virtual void _writeXmlStyle( QDomDocument &doc, QDomElement &elmt, const QgsReadWriteContext &context ) const = 0; | ||
%Docstring | ||
Method called in writeXml. | ||
%End | ||
|
||
void rescaleToFitBoundingBox(); | ||
%Docstring | ||
Rescale the current shape according to the item's bounding box. Useful when | ||
the shape is resized thanks to the rubber band. | ||
%End | ||
|
||
double computeDistance( QPointF pt1, QPointF pt2 ) const; | ||
%Docstring | ||
Compute an euclidian distance between 2 nodes. | ||
:rtype: float | ||
%End | ||
|
||
void updateSceneRect(); | ||
%Docstring | ||
Update the current scene rectangle for this item. | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/layout/qgslayoutitemnodeitem.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
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,85 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/layout/qgslayoutitempolygon.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
class QgsLayoutItemPolygon: QgsLayoutNodesItem | ||
{ | ||
%Docstring | ||
Layout item for node based polygon shapes. | ||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgslayoutitempolygon.h" | ||
%End | ||
public: | ||
|
||
QgsLayoutItemPolygon( QgsLayout *layout ); | ||
%Docstring | ||
Constructor for QgsLayoutItemPolygon for the specified ``layout``. | ||
%End | ||
|
||
QgsLayoutItemPolygon( const QPolygonF &polygon, QgsLayout *layout ); | ||
%Docstring | ||
Constructor for QgsLayoutItemPolygon for the specified ``polygon`` | ||
and ``layout``. | ||
%End | ||
|
||
static QgsLayoutItemPolygon *create( QgsLayout *layout ) /Factory/; | ||
%Docstring | ||
Returns a new polygon item for the specified ``layout``. | ||
|
||
The caller takes responsibility for deleting the returned object. | ||
:rtype: QgsLayoutItemPolygon | ||
%End | ||
|
||
virtual int type() const; | ||
|
||
virtual QString stringType() const; | ||
|
||
virtual QString displayName() const; | ||
|
||
|
||
QgsFillSymbol *symbol(); | ||
%Docstring | ||
Returns the fill symbol used to draw the shape. | ||
.. seealso:: setSymbol() | ||
:rtype: QgsFillSymbol | ||
%End | ||
|
||
void setSymbol( QgsFillSymbol *symbol ); | ||
%Docstring | ||
Sets the ``symbol`` used to draw the shape. | ||
Ownership of ``symbol`` is not transferred. | ||
.. seealso:: symbol() | ||
%End | ||
|
||
protected: | ||
virtual bool _addNode( const int indexPoint, QPointF newPoint, const double radius ); | ||
|
||
virtual bool _removeNode( const int nodeIndex ); | ||
|
||
virtual void _draw( QgsRenderContext &context, const QStyleOptionGraphicsItem *itemStyle = 0 ); | ||
|
||
virtual void _readXmlStyle( const QDomElement &elmt, const QgsReadWriteContext &context ); | ||
|
||
virtual void _writeXmlStyle( QDomDocument &doc, QDomElement &elmt, const QgsReadWriteContext &context ) const; | ||
|
||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/layout/qgslayoutitempolygon.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
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,86 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/layout/qgslayoutitempolyline.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsLayoutItemPolyline: QgsLayoutNodesItem | ||
{ | ||
%Docstring | ||
Layout item for node based polyline shapes. | ||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgslayoutitempolyline.h" | ||
%End | ||
public: | ||
|
||
QgsLayoutItemPolyline( QgsLayout *layout ); | ||
%Docstring | ||
Constructor for QgsLayoutItemPolyline for the specified ``layout``. | ||
%End | ||
|
||
QgsLayoutItemPolyline( const QPolygonF &polyline, QgsLayout *layout ); | ||
%Docstring | ||
Constructor for QgsLayoutItemPolyline for the specified ``polyline`` | ||
and ``layout``. | ||
%End | ||
|
||
static QgsLayoutItemPolyline *create( QgsLayout *layout ) /Factory/; | ||
%Docstring | ||
Returns a new polyline item for the specified ``layout``. | ||
|
||
The caller takes responsibility for deleting the returned object. | ||
:rtype: QgsLayoutItemPolyline | ||
%End | ||
|
||
virtual int type() const; | ||
|
||
virtual QString stringType() const; | ||
|
||
virtual QString displayName() const; | ||
|
||
|
||
QgsLineSymbol *symbol(); | ||
%Docstring | ||
Returns the line symbol used to draw the shape. | ||
.. seealso:: setSymbol() | ||
:rtype: QgsLineSymbol | ||
%End | ||
|
||
void setSymbol( QgsLineSymbol *symbol ); | ||
%Docstring | ||
Sets the ``symbol`` used to draw the shape. | ||
Ownership of ``symbol`` is not transferred. | ||
.. seealso:: symbol() | ||
%End | ||
|
||
protected: | ||
|
||
virtual bool _addNode( const int indexPoint, QPointF newPoint, const double radius ); | ||
|
||
virtual bool _removeNode( const int nodeIndex ); | ||
|
||
virtual void _draw( QgsRenderContext &context, const QStyleOptionGraphicsItem *itemStyle = 0 ); | ||
|
||
virtual void _readXmlStyle( const QDomElement &elmt, const QgsReadWriteContext &context ); | ||
|
||
virtual void _writeXmlStyle( QDomDocument &doc, QDomElement &elmt, const QgsReadWriteContext &context ) const; | ||
|
||
|
||
}; | ||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/layout/qgslayoutitempolyline.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
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
Oops, something went wrong.