~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/app/qgsmaptooledit.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    qgsmaptooledit.h  -  base class for editing map tools
 
3
    ---------------------
 
4
    begin                : Juli 2007
 
5
    copyright            : (C) 2007 by Marco Hugentobler
 
6
    email                : marco dot hugentobler at karto dot baug dot ethz dot ch
 
7
 ***************************************************************************
 
8
 *                                                                         *
 
9
 *   This program is free software; you can redistribute it and/or modify  *
 
10
 *   it under the terms of the GNU General Public License as published by  *
 
11
 *   the Free Software Foundation; either version 2 of the License, or     *
 
12
 *   (at your option) any later version.                                   *
 
13
 *                                                                         *
 
14
 ***************************************************************************/
 
15
/* $Id$ */
 
16
 
 
17
#ifndef QGSMAPTOOLEDIT_H
 
18
#define QGSMAPTOOLEDIT_H
 
19
 
 
20
#include "qgsmaptool.h"
 
21
#include "qgsmapcanvassnapper.h"
 
22
 
 
23
class QgsRubberBand;
 
24
class QKeyEvent;
 
25
 
 
26
/**Base class for map tools that edit vector geometry*/
 
27
class QgsMapToolEdit: public QgsMapTool
 
28
{
 
29
  public:
 
30
    QgsMapToolEdit( QgsMapCanvas* canvas );
 
31
    virtual ~QgsMapToolEdit();
 
32
 
 
33
    virtual bool isEditTool() { return true; }
 
34
 
 
35
  protected:
 
36
    /**Snapper object that reads the settings from project and option
 
37
     and applies it to the map canvas*/
 
38
    QgsMapCanvasSnapper mSnapper;
 
39
 
 
40
    /**Inserts vertices to the snapped segments of the editing layer.
 
41
     This is useful for topological editing if snap to segment is enabled.
 
42
     @param snapResults results collected from the snapping operation
 
43
     @param editedLayer pointer to the editing layer
 
44
     @return 0 in case of success*/
 
45
    int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults, QgsVectorLayer* editedLayer );
 
46
 
 
47
    /**Extracts a single snapping point from a set of snapping results.
 
48
       This is useful for snapping operations that just require a position to snap to and not all the
 
49
       snapping results. If the list is empty, the screen coordinates are transformed into map coordinates and returned
 
50
       @param snapResults results collected from the snapping operation.
 
51
       @return the snapped point in map coordinates*/
 
52
    QgsPoint snapPointFromResults( const QList<QgsSnappingResult>& snapResults, const QPoint& screenCoords );
 
53
 
 
54
    /**Creates a rubber band with the color/line width from
 
55
     the QGIS settings. The caller takes ownership of the
 
56
    returned object*/
 
57
    QgsRubberBand* createRubberBand( bool isPolygon = false );
 
58
 
 
59
    /**Returns the current vector layer of the map canvas or 0*/
 
60
    QgsVectorLayer* currentVectorLayer();
 
61
 
 
62
    /**Adds vertices to other features to keep topology up to date, e.g. to neighbouring polygons.
 
63
       @param geom list of points (in layer coordinate system)
 
64
       @return 0 in case of success*/
 
65
    int addTopologicalPoints( const QList<QgsPoint>& geom );
 
66
};
 
67
 
 
68
#endif