26  setVertexDrawingEnabled( 
false );
 
   29QgsCurve *QgsMapToolCaptureRubberBand::curve()
 
   31  if ( mPoints.empty() )
 
   34  switch ( mStringType )
 
   40      if ( mPoints.count() != 3 )
 
   53bool QgsMapToolCaptureRubberBand::curveIsComplete()
 const 
   64  mFirstPolygonPoint = firstPolygonPoint;
 
   65  setStringType( stringType );
 
   66  setRubberBandGeometryType( geomType );
 
   69void QgsMapToolCaptureRubberBand::setRubberBandGeometryType( 
Qgis::GeometryType geomType )
 
   75void QgsMapToolCaptureRubberBand::addPoint( 
const QgsPoint &point, 
bool doUpdate )
 
   77  if ( mPoints.count() == 0 )
 
   78    mPoints.append( point );
 
   80  mPoints.append( point );
 
   86void QgsMapToolCaptureRubberBand::movePoint( 
const QgsPoint &point )
 
   88  if ( mPoints.count() > 0 )
 
   89    mPoints.last() = point;
 
   94void QgsMapToolCaptureRubberBand::movePoint( 
int index, 
const QgsPoint &point )
 
   96  if ( mPoints.count() > 0 && mPoints.size() > index )
 
   97    mPoints[index] = point;
 
  102int QgsMapToolCaptureRubberBand::pointsCount()
 
  104  return mPoints.size();
 
  112void QgsMapToolCaptureRubberBand::setStringType( 
Qgis::WkbType type )
 
  120    mPoints.removeAt( 1 );
 
  127QgsPoint QgsMapToolCaptureRubberBand::lastPoint()
 const 
  129  if ( mPoints.empty() )
 
  132  return mPoints.last();
 
  135QgsPoint QgsMapToolCaptureRubberBand::pointFromEnd( 
int posFromEnd )
 const 
  137  if ( posFromEnd < mPoints.size() )
 
  138    return mPoints.at( mPoints.size() - 1 - posFromEnd );
 
  143void QgsMapToolCaptureRubberBand::removeLastPoint()
 
  145  if ( mPoints.count() > 1 )
 
  146    mPoints.removeLast();
 
  156void QgsMapToolCaptureRubberBand::updateCurve()
 
  158  std::unique_ptr<QgsCurve> curve;
 
  159  switch ( mStringType )
 
  162      curve.reset( createLinearString() );
 
  165      curve.reset( createCircularString() );
 
  175    geom->setExteriorRing( curve.release() );
 
  176    setGeometry( geom.release() );
 
  180    setGeometry( curve.release() );
 
  184QgsCurve *QgsMapToolCaptureRubberBand::createLinearString()
 
  190    points.prepend( mFirstPolygonPoint );
 
  191    curve->setPoints( points );
 
  194    curve->setPoints( mPoints );
 
  196  return curve.release();
 
  199QgsCurve *QgsMapToolCaptureRubberBand::createCircularString()
 
  202  curve->setPoints( mPoints );
 
  207    polygonCurve->addVertex( mFirstPolygonPoint );
 
  208    if ( !mPoints.empty() )
 
  209      polygonCurve->addVertex( mPoints.first() );
 
  210    polygonCurve->addCurve( curve.release() );
 
  211    return polygonCurve.release();
 
  214    return curve.release();
 
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
 
WkbType
The WKB type describes the number of dimensions a geometry has.
 
@ CircularString
CircularString.
 
Abstract base class for all geometries.
 
Circular string geometry type.
 
Compound curve geometry type.
 
Curve polygon geometry type.
 
Abstract base class for curved geometry type.
 
A rubberband class for QgsAbstractGeometry (considering curved geometries).
 
void setGeometryType(Qgis::GeometryType geometryType)
Sets which geometry is handled by the rubber band, polygon or line.
 
virtual void setGeometry(QgsAbstractGeometry *geom)
Sets geometry (takes ownership). Geometry is expected to be in map coordinates.
 
Line string geometry type, with support for z-dimension and m-values.
 
Map canvas is a class for displaying all GIS data types on a canvas.
 
Point geometry type, with support for z-dimension and m-values.
 
QVector< QgsPoint > QgsPointSequence