2007-01-09 02:39:15 +00:00
|
|
|
class QgsRubberBand: QgsMapCanvasItem
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsrubberband.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2012-12-25 14:12:24 +01:00
|
|
|
enum IconType
|
|
|
|
{
|
|
|
|
ICON_NONE,
|
|
|
|
ICON_CROSS,
|
|
|
|
ICON_X,
|
|
|
|
ICON_BOX,
|
2013-10-29 07:17:52 +01:00
|
|
|
ICON_CIRCLE,
|
2017-04-05 16:10:46 +08:00
|
|
|
ICON_FULL_BOX,
|
|
|
|
ICON_DIAMOND,
|
|
|
|
ICON_FULL_DIAMOND
|
2012-12-25 14:12:24 +01:00
|
|
|
};
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsRubberBand( QgsMapCanvas *mapCanvas /TransferThis/, QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::LineGeometry );
|
2007-01-09 02:39:15 +00:00
|
|
|
~QgsRubberBand();
|
|
|
|
|
2017-05-03 07:45:22 +02:00
|
|
|
void setColor( const QColor &color );
|
2012-12-25 14:12:24 +01:00
|
|
|
|
2017-05-03 07:45:22 +02:00
|
|
|
void setFillColor( const QColor &color );
|
2014-10-27 17:11:39 +02:00
|
|
|
|
2017-03-24 14:49:37 +07:00
|
|
|
QColor fillColor() const;
|
|
|
|
|
2017-05-03 07:45:22 +02:00
|
|
|
void setStrokeColor( const QColor &color );
|
2014-10-27 17:11:39 +02:00
|
|
|
|
2017-03-24 14:49:37 +07:00
|
|
|
QColor strokeColor() const;
|
|
|
|
|
|
|
|
void setSecondaryStrokeColor( const QColor &color );
|
|
|
|
|
|
|
|
QColor secondaryStrokeColor() const;
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
void setWidth( int width );
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-03-24 14:49:37 +07:00
|
|
|
int width() const;
|
|
|
|
|
2012-12-25 14:12:24 +01:00
|
|
|
void setIcon( IconType icon );
|
|
|
|
|
2017-03-24 14:49:37 +07:00
|
|
|
IconType icon() const;
|
|
|
|
|
2014-01-27 09:22:24 +01:00
|
|
|
void setIconSize( int iconSize );
|
2012-12-25 14:12:24 +01:00
|
|
|
|
2017-03-24 14:49:37 +07:00
|
|
|
int iconSize() const;
|
|
|
|
|
2013-09-02 16:34:33 +02:00
|
|
|
void setLineStyle( Qt::PenStyle penStyle );
|
|
|
|
|
|
|
|
void setBrushStyle( Qt::BrushStyle brushStyle );
|
|
|
|
|
2016-08-04 09:10:08 +02:00
|
|
|
void reset( QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::LineGeometry );
|
2008-01-09 16:54:55 +00:00
|
|
|
|
2017-05-03 07:45:22 +02:00
|
|
|
void addPoint( const QgsPoint &p, bool doUpdate = true, int geometryIndex = 0 );
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2016-06-15 11:44:23 +10:00
|
|
|
void closePoints( bool doUpdate = true, int geometryIndex = 0 );
|
|
|
|
|
2013-04-18 17:50:38 +02:00
|
|
|
void removePoint( int index = 0, bool doUpdate = true, int geometryIndex = 0 );
|
|
|
|
|
2014-11-21 01:17:21 +01:00
|
|
|
void removeLastPoint( int geometryIndex = 0, bool doUpdate = true );
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-05-03 07:45:22 +02:00
|
|
|
void movePoint( const QgsPoint &p, int geometryIndex = 0 );
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void movePoint( int index, const QgsPoint &p, int geometryIndex = 0 );
|
2008-01-24 14:34:05 +00:00
|
|
|
|
2014-01-27 09:22:24 +01:00
|
|
|
int partSize( int geometryIndex ) const;
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setToGeometry( const QgsGeometry &geom, QgsVectorLayer *layer );
|
2010-05-16 18:36:20 +00:00
|
|
|
|
2016-02-02 19:46:18 +11:00
|
|
|
void setToCanvasRectangle( QRect rect );
|
2011-04-28 08:31:01 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void addGeometry( const QgsGeometry &geom, QgsVectorLayer *layer );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
void setTranslationOffset( double dx, double dy );
|
2008-01-09 16:54:55 +00:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
int size() const;
|
2010-05-16 18:36:20 +00:00
|
|
|
|
2008-01-09 16:54:55 +00:00
|
|
|
int numberOfVertices() const;
|
2007-09-30 23:45:36 +00:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
const QgsPoint *getPoint( int i, int j = 0 ) const;
|
|
|
|
|
2016-08-01 22:39:38 +10:00
|
|
|
QgsGeometry asGeometry() const;
|
2008-03-13 13:11:53 +00:00
|
|
|
|
2015-02-03 02:21:52 +01:00
|
|
|
virtual void updatePosition();
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
protected:
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void paint( QPainter *p );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-03-24 14:49:37 +07:00
|
|
|
void drawShape( QPainter *p, QVector<QPointF> &pts );
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
void updateRect();
|
|
|
|
|
|
|
|
};
|