2007-01-09 02:39:15 +00:00
|
|
|
class QgsRubberBand: QgsMapCanvasItem
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsrubberband.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
2007-04-23 14:58:15 +00:00
|
|
|
QgsRubberBand(QgsMapCanvas* mapCanvas /TransferThis/, bool isPolygon = false);
|
2007-01-09 02:39:15 +00:00
|
|
|
~QgsRubberBand();
|
|
|
|
|
|
|
|
void setColor(const QColor & color);
|
|
|
|
void setWidth(int width);
|
|
|
|
|
|
|
|
void reset(bool isPolygon = false);
|
2008-01-09 16:54:55 +00:00
|
|
|
|
2008-01-24 14:34:05 +00:00
|
|
|
//! Add point to rubberband and update canvas
|
|
|
|
//! If adding more points consider using update=false for better performance
|
|
|
|
//! geometryIndex is the index of the feature part (in case of multipart geometries)
|
|
|
|
void addPoint(const QgsPoint & p, bool update = true, int geometryIndex = 0);
|
2008-01-09 16:54:55 +00:00
|
|
|
|
2008-01-24 14:34:05 +00:00
|
|
|
//!Removes the last point. Most usefull in connection with undo operations
|
|
|
|
void removeLastPoint(int geometryIndex = 0);
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2008-01-24 14:34:05 +00:00
|
|
|
void movePoint(const QgsPoint & p, int geometryIndex = 0);
|
|
|
|
/**Moves the rubber band point specified by index. Note that if the rubber band is
|
|
|
|
not used to track the last mouse position, the first point of the rubber band has two vertices*/
|
|
|
|
void movePoint(int index, const QgsPoint& p, int geometryIndex = 0);
|
|
|
|
|
|
|
|
/**Sets this rubber band to the geometry of an existing feature.
|
2008-01-09 16:54:55 +00:00
|
|
|
This is usefull for feature highlighting.
|
|
|
|
@param geom the geometry object
|
|
|
|
@param layer the layer containing the feature (used for coord transformation)
|
|
|
|
@param render the maprender object (used for coord transformation)*/
|
|
|
|
void setToGeometry(QgsGeometry* geom, QgsVectorLayer& layer);
|
|
|
|
|
2008-01-24 14:34:05 +00:00
|
|
|
/**Adds translation to original coordinates (all in map coordinates)*/
|
2008-01-09 16:54:55 +00:00
|
|
|
void setTranslationOffset(double dx, double dy);
|
|
|
|
|
2008-01-24 14:34:05 +00:00
|
|
|
/**Returns count of vertices in all lists of mPoint*/
|
2008-01-09 16:54:55 +00:00
|
|
|
int numberOfVertices() const;
|
2007-09-30 23:45:36 +00:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
protected:
|
|
|
|
virtual void paint(QPainter* p);
|
|
|
|
|
|
|
|
//! recalculates needed rectangle
|
|
|
|
void updateRect();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2008-01-09 17:32:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|