From: <tim...@us...> - 2005-11-09 22:44:00
|
Update of /cvsroot/qgis/qgis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2227 Modified Files: qgsmapcanvas.cpp qgsmapcanvas.h qgsmapcanvasproperties.h Log Message: Merge of 0.7 mapcanvas goodies into head Thanks to Tom Elwertowski for resolving the conflicts Index: qgsmapcanvas.cpp =================================================================== RCS file: /cvsroot/qgis/qgis/src/qgsmapcanvas.cpp,v retrieving revision 1.168 retrieving revision 1.169 diff -C2 -d -r1.168 -r1.169 *** qgsmapcanvas.cpp 24 Oct 2005 04:10:19 -0000 1.168 --- qgsmapcanvas.cpp 9 Nov 2005 22:43:47 -0000 1.169 *************** *** 108,111 **** --- 108,112 ---- : QWidget(parent, name), mCanvasProperties( new CanvasProperties(width(), height()) ), + mUserInteractionAllowed(true), // by default we allow a user to interact with the canvas mLineEditing(false), mPolygonEditing(false) { *************** *** 209,216 **** // Adding the first layer. Set the previousOutputSRS to the output // SRS for the layer. [...969 lines suppressed...] + if( projectionsEnabled() ) + { + // Do reverse transformation before saving. If possible! + try + { + transformedPoint = vlayer->coordinateTransform()->transform(point, QgsCoordinateTransform::INVERSE); + } + catch(QgsCsException &cse) + { + //#ifdef QGISDEBUG + std::cout << "Caught transform error when " << whenmsg <<"." + << "Setting untransformed values." << std::endl; + //#endif + // Transformation failed,. Bail out with original rectangle. + return point; + } + return transformedPoint; + } + return point; + } Index: qgsmapcanvas.h =================================================================== RCS file: /cvsroot/qgis/qgis/src/qgsmapcanvas.h,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** qgsmapcanvas.h 24 Oct 2005 00:29:36 -0000 1.77 --- qgsmapcanvas.h 9 Nov 2005 22:43:47 -0000 1.78 *************** *** 308,311 **** --- 308,321 ---- protected: + /// implementation struct + class CanvasProperties; + + /// Handle pattern for implementation object + std::auto_ptr<CanvasProperties> mCanvasProperties; + + //! lets us know whether this canvas is being used as an overview canvas or note + bool mIsOverviewCanvas; + + private: /// this class is non-copyable /** *************** *** 322,331 **** QgsMapCanvas(); - /// implementation struct - class CanvasProperties; - - /// Handle pattern for implementation object - std::auto_ptr<CanvasProperties> mCanvasProperties; - /** List to store the points of digitised lines and polygons --- 332,335 ---- *************** *** 350,353 **** --- 354,363 ---- void drawLineToDigitisingCursor(QPainter* paint, bool last = true); + //! Overridden key press event + void keyPressEvent(QKeyEvent * e); + + //! Overridden key release event + void keyReleaseEvent(QKeyEvent * e); + //! Overridden mouse move event void mouseMoveEvent(QMouseEvent * e); *************** *** 381,390 **** void zoomByScale(int x, int y, double scaleFactor); //! determines whether user has requested to suppress rendering bool mRenderFlag; - //! lets us know whether this canvas is being used as an overview canvas or note - bool mIsOverviewCanvas; - /** debugging member invoked when a connect() is made to this object --- 391,412 ---- void zoomByScale(int x, int y, double scaleFactor); + //! Ends pan action and redraws the canvas. + void panActionEnd(QPoint releasePoint); + + //! Called when mouse is moving and pan is activated + void panAction(QMouseEvent * event); + + //! Helper function to inverse project a point if projections + // are enabled. Failsafe, returns the sent point if anything fails. + // @whenmsg is a part fo the error message. + QgsPoint maybeInversePoint(QgsPoint point, const char whenmsg[]); + + //! detrmines whether the user can interact with the canvas using a mouse + //(useful for locking the overview canvas) + bool mUserInteractionAllowed; + //! determines whether user has requested to suppress rendering bool mRenderFlag; /** debugging member invoked when a connect() is made to this object Index: qgsmapcanvasproperties.h =================================================================== RCS file: /cvsroot/qgis/qgis/src/qgsmapcanvasproperties.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** qgsmapcanvasproperties.h 9 Nov 2005 01:48:59 -0000 1.2 --- qgsmapcanvasproperties.h 9 Nov 2005 22:43:47 -0000 1.3 *************** *** 10,14 **** #include "qgsmaptopixel.h" #include "qgsvectorlayer.h" ! #include <qgsscalecalculator.h> --- 10,15 ---- #include "qgsmaptopixel.h" #include "qgsvectorlayer.h" ! #include "qgsscalecalculator.h" ! #include "qgsproject.h" *************** *** 32,35 **** --- 33,37 ---- pmCanvas( 0x0 ), bgColor( Qt::white ), + panSelectorDown( false ), dragging( false ), capturing( false ), *************** *** 57,60 **** --- 59,63 ---- pmCanvas( 0x0 ), bgColor( Qt::white ), + panSelectorDown( false ), dragging( false ), capturing( false ), *************** *** 95,98 **** --- 98,102 ---- mMapUnits = u; scaleCalculator->setMapUnits(mMapUnits); + QgsProject::instance()->mapUnits(u); } *************** *** 154,160 **** QRect zoomBox; - //! Beginning point of a rubber band box - QPoint boxStartPoint; - //! Last seen point of the mouse QPoint mouseLastXY; --- 158,161 ---- *************** *** 196,199 **** --- 197,203 ---- QColor bgColor; + //! Flag to indicate the pan selector key is held down by user + bool panSelectorDown; + //! Flag to indicate a map canvas drag operation is taking place bool dragging; *************** *** 202,208 **** bool capturing; - //! Flag to indicate the pan selector key is held down by user - bool panSelectorDown; - //! Vector containing the inital color for a layer std::vector < QColor > initialColor; --- 206,209 ---- |