QGIS/python/gui/qgshighlight.sip
Nyall Dawson bd7d913379 Refine QgsFeature geometry getters/setters
All pointer based methods have been removed.

Now we have only:

  void setGeometry( const QgsGeometry& geom )

and

  QgsGeometry geometry() const

Benefits include avoiding a whole lot of tricky pointer lifetime
issues, potential memory leaks, and finally closing #777, which
has survived for over 9 years!...

Impacts on PyQGIS code:
- no more need for the messy
  g = QgsGeometry( feature.geometry() )
  workaround, just use g = feature.geometry() instead
- IMPORTANT: you can no longer test whether a feature has geometry
 using `if f.geometry():`, since QgsFeature::geometry() will
 *always* return an object. Instead, use
 `if not f.geometry().isEmpty():`, or preferably the new method
 `if not f.hasGeometry():`

Fix #777
2016-08-01 16:25:46 +10:00

39 lines
1.1 KiB
Plaintext

class QgsHighlight : QgsMapCanvasItem
{
%TypeHeaderCode
#include <qgshighlight.h>
%End
public:
QgsHighlight( QgsMapCanvas *mapCanvas, const QgsGeometry& geom, QgsVectorLayer *layer );
~QgsHighlight();
/** Set line/outline to color, polygon fill to color with alpha = 63.
* This is legacy function, use setFillColor() after setColor() if different fill color is required. */
void setColor( const QColor & color );
/** Set polygons fill color.
* @note: added in version 2.3 */
void setFillColor( const QColor & fillColor );
/** Set width. Ignored in feature mode. */
void setWidth( int width );
/** Set line / outline buffer in millimeters.
* @note: added in version 2.3 */
void setBuffer( double buffer );
/** Set minimum line / outline width in millimeters.
* @note: added in version 2.3 */
void setMinWidth( double width );
const QgsMapLayer *layer() const;
virtual void updatePosition();
protected:
virtual void paint( QPainter* p );
//! recalculates needed rectangle
void updateRect();
};