Refactored QgsCoordinateTransform to QgsMapToPixel

git-svn-id: http://svn.osgeo.org/qgis/trunk@2536 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
timlinux 2004-12-30 02:52:37 +00:00
parent b8293946bd
commit 977ff433ad
30 changed files with 64 additions and 66 deletions

View File

@ -42,7 +42,7 @@
#include "../../src/qgsmaplayer.h" #include "../../src/qgsmaplayer.h"
#include "../../src/qgsvectorlayer.h" #include "../../src/qgsvectorlayer.h"
#include "../../src/qgsdataprovider.h" #include "../../src/qgsdataprovider.h"
#include "../../src/qgscoordinatetransform.h" #include "../../src/qgsmaptopixel.h"
#include "../../src/qgsfeatureattribute.h" #include "../../src/qgsfeatureattribute.h"
extern "C" { extern "C" {

View File

@ -42,7 +42,7 @@
#include "../../src/qgsmaplayer.h" #include "../../src/qgsmaplayer.h"
#include "../../src/qgsvectorlayer.h" #include "../../src/qgsvectorlayer.h"
#include "../../src/qgsdataprovider.h" #include "../../src/qgsdataprovider.h"
#include "../../src/qgscoordinatetransform.h" #include "../../src/qgsmaptopixel.h"
#include "../../src/qgsfield.h" #include "../../src/qgsfield.h"
#include "../../src/qgsfeatureattribute.h" #include "../../src/qgsfeatureattribute.h"

View File

@ -27,7 +27,7 @@
#include "../../src/qgisapp.h" #include "../../src/qgisapp.h"
#include "../../src/qgspoint.h" #include "../../src/qgspoint.h"
#include "../../src/qgisiface.h" #include "../../src/qgisiface.h"
#include "../../src/qgscoordinatetransform.h" #include "../../src/qgsmaptopixel.h"
class QgsGrassProvider; class QgsGrassProvider;
#include "qgsgrasseditbase.h" #include "qgsgrasseditbase.h"
@ -276,7 +276,7 @@ private:
QPixmap *mPixmap; QPixmap *mPixmap;
//! Transformation //! Transformation
QgsCoordinateTransform *mTransform; QgsMapToPixel *mTransform;
//! Last point where user clicked (map units) //! Last point where user clicked (map units)
QgsPoint mLastPoint; QgsPoint mLastPoint;

View File

@ -325,7 +325,7 @@ void QgsGrassPlugin::displayRegion(QPainter *painter)
points[3].setX(window.west); points[3].setY(window.north); points[3].setX(window.west); points[3].setY(window.north);
points[4].setX(window.west); points[4].setY(window.south); points[4].setX(window.west); points[4].setY(window.south);
QgsCoordinateTransform *transform = mCanvas->getCoordinateTransform(); QgsMapToPixel *transform = mCanvas->getCoordinateTransform();
QPointArray pointArray(5); QPointArray pointArray(5);
for ( int i = 0; i < 5; i++ ) { for ( int i = 0; i < 5; i++ ) {

View File

@ -48,7 +48,7 @@
#include "../../src/qgsvectorlayer.h" #include "../../src/qgsvectorlayer.h"
#include "../../src/qgisiface.h" #include "../../src/qgisiface.h"
#include "../../src/qgsmapcanvas.h" #include "../../src/qgsmapcanvas.h"
#include "../../src/qgscoordinatetransform.h" #include "../../src/qgsmaptopixel.h"
#include "../../src/qgspoint.h" #include "../../src/qgspoint.h"
extern "C" { extern "C" {
@ -384,7 +384,7 @@ void QgsGrassRegion::displayRegion()
points[3].setX(mWindow.west); points[3].setY(mWindow.north); points[3].setX(mWindow.west); points[3].setY(mWindow.north);
points[4].setX(mWindow.west); points[4].setY(mWindow.south); points[4].setX(mWindow.west); points[4].setY(mWindow.south);
QgsCoordinateTransform *transform = mCanvas->getCoordinateTransform(); QgsMapToPixel *transform = mCanvas->getCoordinateTransform();
for ( int i = 0; i < 5; i++ ) { for ( int i = 0; i < 5; i++ ) {
transform->transform( &(points[i]) ); transform->transform( &(points[i]) );

View File

@ -10,7 +10,7 @@ void MapLayerTest::setQgisMainWindow(QMainWindow *app){
qgisApp = app; qgisApp = app;
} }
// set the coordinate transform for drawing the layer // set the coordinate transform for drawing the layer
void MapLayerTest::setCoordinateTransform(QgsCoordinateTransform *xform){ void MapLayerTest::setCoordinateTransform(QgsMapToPixel *xform){
coordTransform = xform; coordTransform = xform;
} }
void MapLayerTest::initGui(){ void MapLayerTest::initGui(){

View File

@ -3,13 +3,13 @@
#include <qmainwindow.h> #include <qmainwindow.h>
#include <qmenubar.h> #include <qmenubar.h>
#include "../../src/qgsmaplayerinterface.h" #include "../../src/qgsmaplayerinterface.h"
#include "../../src/qgscoordinatetransform.h" #include "../../src/qgsmaptopixel.h"
class MapLayerTest : public QgsMapLayerInterface{ class MapLayerTest : public QgsMapLayerInterface{
Q_OBJECT Q_OBJECT
public: public:
MapLayerTest(); MapLayerTest();
void setQgisMainWindow(QMainWindow *app); void setQgisMainWindow(QMainWindow *app);
void setCoordinateTransform(QgsCoordinateTransform *xform); void setCoordinateTransform(QgsMapToPixel *xform);
public slots: public slots:
void initGui(); void initGui();
void open(); void open();
@ -19,7 +19,7 @@ private:
QMainWindow *qgisApp; QMainWindow *qgisApp;
QMenuBar *menu; QMenuBar *menu;
int menuId; int menuId;
QgsCoordinateTransform *coordTransform; QgsMapToPixel *coordTransform;
}; };

View File

@ -43,7 +43,7 @@ email : sbr00pwb@users.sourceforge.net
#include <qpen.h> #include <qpen.h>
#include <qgspoint.h> #include <qgspoint.h>
#include <qpointarray.h> #include <qpointarray.h>
#include <qgscoordinatetransform.h> #include <qgsmaptopixel.h>
#include <qstring.h> #include <qstring.h>
#include <qfontmetrics.h> #include <qfontmetrics.h>
#include <qfont.h> #include <qfont.h>

View File

@ -172,9 +172,7 @@
<argumentsHintDelay>400</argumentsHintDelay> <argumentsHintDelay>400</argumentsHintDelay>
<headerCompletionDelay>250</headerCompletionDelay> <headerCompletionDelay>250</headerCompletionDelay>
</codecompletion> </codecompletion>
<references> <references/>
<pcs>Qt</pcs>
</references>
</kdevcppsupport> </kdevcppsupport>
<kdevdocumentation> <kdevdocumentation>
<projectdoc> <projectdoc>

View File

@ -49,7 +49,7 @@ headers = \
qgscolortable.h \ qgscolortable.h \
qgscontcoldialog.h \ qgscontcoldialog.h \
qgscontinuouscolrenderer.h \ qgscontinuouscolrenderer.h \
qgscoordinatetransform.h \ qgsmaptopixel.h \
qgscustomsymbol.h \ qgscustomsymbol.h \
qgsdataprovider.h \ qgsdataprovider.h \
qgsdatasource.h \ qgsdatasource.h \
@ -231,7 +231,7 @@ qgis_SOURCES = \
qgscolortable.cpp \ qgscolortable.cpp \
qgscontcoldialog.cpp \ qgscontcoldialog.cpp \
qgscontinuouscolrenderer.cpp \ qgscontinuouscolrenderer.cpp \
qgscoordinatetransform.cpp \ qgsmaptopixel.cpp \
qgscustomsymbol.cpp \ qgscustomsymbol.cpp \
qgsdatasource.cpp \ qgsdatasource.cpp \
qgsdlgvectorlayerproperties.cpp \ qgsdlgvectorlayerproperties.cpp \
@ -341,7 +341,7 @@ libqgis_la_SOURCES = \
qgsacetaterectangle.cpp \ qgsacetaterectangle.cpp \
qgscolortable.cpp \ qgscolortable.cpp \
qgscontinuouscolrenderer.cpp \ qgscontinuouscolrenderer.cpp \
qgscoordinatetransform.cpp \ qgsmaptopixel.cpp \
qgsfeatureattribute.cpp \ qgsfeatureattribute.cpp \
qgsfeature.cpp \ qgsfeature.cpp \
qgsfield.cpp \ qgsfield.cpp \

View File

@ -19,7 +19,7 @@
/* $Id$ */ /* $Id$ */
#include <qstring.h> #include <qstring.h>
#include <qpainter.h> #include <qpainter.h>
#include <qgscoordinatetransform.h> #include <qgsmaptopixel.h>
#include <qgspoint.h> #include <qgspoint.h>
#include <qgsrect.h> #include <qgsrect.h>
#include "qgsline.h" #include "qgsline.h"
@ -39,7 +39,7 @@ void QgsAcetateLines::add(QgsLine &line)
{ {
mLineCollection->push_back(line); mLineCollection->push_back(line);
} }
void QgsAcetateLines::draw(QPainter *painter, QgsCoordinateTransform *cXf) void QgsAcetateLines::draw(QPainter *painter, QgsMapToPixel *cXf)
{ {
painter->setPen(QColor(255,0,0)); painter->setPen(QColor(255,0,0));
painter->setBrush(Qt::NoBrush); painter->setBrush(Qt::NoBrush);

View File

@ -24,7 +24,7 @@
class QgsPoint; class QgsPoint;
class QgsLine; class QgsLine;
class QPainter; class QPainter;
class QgsCoordinateTransform; class QgsMapToPixel;
#include <vector> #include <vector>
//#include "qgsline.h" //#include "qgsline.h"
@ -36,7 +36,7 @@ class QgsCoordinateTransform;
* An acetate object is a graphic or text object that is drawn on top of the map canvas * An acetate object is a graphic or text object that is drawn on top of the map canvas
* after rendering of all map elements is completed. Acetate objects can be drawn in * after rendering of all map elements is completed. Acetate objects can be drawn in
* device coordinates or map coordinates. Drawing in map coordinates requires passing * device coordinates or map coordinates. Drawing in map coordinates requires passing
* a QgsCoordinateTransform object to the draw function. * a QgsMapToPixel object to the draw function.
* *
*/ */
class QgsAcetateLines : public QgsAcetateObject { class QgsAcetateLines : public QgsAcetateObject {
@ -58,7 +58,7 @@ class QgsAcetateLines : public QgsAcetateObject {
* assumed to be device coordinates * assumed to be device coordinates
* rather than map coordinates. * rather than map coordinates.
*/ */
void draw (QPainter * painter, QgsCoordinateTransform * cXf=0); void draw (QPainter * painter, QgsMapToPixel * cXf=0);
/** /**
* Set the origin point * Set the origin point
* @param value Point of origin * @param value Point of origin

View File

@ -18,7 +18,7 @@
/* $Id$ */ /* $Id$ */
#include <qgspoint.h> #include <qgspoint.h>
#include <qpainter.h> #include <qpainter.h>
#include <qgscoordinatetransform.h> #include <qgsmaptopixel.h>
#include "qgsacetateobject.h" #include "qgsacetateobject.h"
QgsAcetateObject::QgsAcetateObject(QgsPoint &origin) : QgsAcetateObject::QgsAcetateObject(QgsPoint &origin) :
@ -38,7 +38,7 @@ QgsAcetateObject::QgsAcetateObject()
QgsAcetateObject::~QgsAcetateObject() QgsAcetateObject::~QgsAcetateObject()
{ {
} }
/*void QgsAcetateObject::draw(QPainter * painter, QgsCoordinateTransform * cXf) /*void QgsAcetateObject::draw(QPainter * painter, QgsMapToPixel * cXf)
{ {
} }
*/ */

View File

@ -21,7 +21,7 @@
#define QGSACETATEOBJECT_H #define QGSACETATEOBJECT_H
class QgsPoint; class QgsPoint;
class QPainter; class QPainter;
class QgsCoordinateTransform; class QgsMapToPixel;
/*! \class QgsAcetateObject /*! \class QgsAcetateObject
* \brief Base class for all objects that are drawn on the acetate layer of a map canvas. * \brief Base class for all objects that are drawn on the acetate layer of a map canvas.
@ -29,7 +29,7 @@ class QgsCoordinateTransform;
* An acetate object is a graphic or text object that is drawn on top of the map canvas * An acetate object is a graphic or text object that is drawn on top of the map canvas
* after rendering of all map elements is completed. Acetate objects can be drawn in * after rendering of all map elements is completed. Acetate objects can be drawn in
* device coordinates or map coordinates. Drawing in map coordinates requires passing * device coordinates or map coordinates. Drawing in map coordinates requires passing
* a QgsCoordinateTransform object to the draw function. * a QgsMapToPixel object to the draw function.
* *
* The draw function must be overridden in a subclass to provide the specfic logic for * The draw function must be overridden in a subclass to provide the specfic logic for
* drawing the object. * drawing the object.
@ -62,7 +62,7 @@ public:
* this parameter is not specified, coordinates are assumed to be device coordinates * this parameter is not specified, coordinates are assumed to be device coordinates
* rather than map coordinates. * rather than map coordinates.
*/ */
virtual void draw (QPainter * painter, QgsCoordinateTransform * cXf=0)=0; virtual void draw (QPainter * painter, QgsMapToPixel * cXf=0)=0;
/** /**
* Set the origin point * Set the origin point
* @param value Point of origin * @param value Point of origin

View File

@ -18,7 +18,7 @@
/* $Id$ */ /* $Id$ */
#include <qstring.h> #include <qstring.h>
#include <qpainter.h> #include <qpainter.h>
#include <qgscoordinatetransform.h> #include <qgsmaptopixel.h>
#include <qgspoint.h> #include <qgspoint.h>
#include <qgsrect.h> #include <qgsrect.h>
#include "qgsacetaterectangle.h" #include "qgsacetaterectangle.h"
@ -33,7 +33,7 @@ QgsAcetateRectangle::~QgsAcetateRectangle()
} }
void QgsAcetateRectangle::draw(QPainter *painter, QgsCoordinateTransform *cXf) void QgsAcetateRectangle::draw(QPainter *painter, QgsMapToPixel *cXf)
{ {
painter->setPen(QColor(255,0,0)); painter->setPen(QColor(255,0,0));
painter->setBrush(Qt::NoBrush); painter->setBrush(Qt::NoBrush);

View File

@ -22,7 +22,7 @@
class QgsPoint; class QgsPoint;
class QPainter; class QPainter;
class QgsCoordinateTransform; class QgsMapToPixel;
#include <qgsrect.h> #include <qgsrect.h>
#include "qgsacetateobject.h" #include "qgsacetateobject.h"
@ -32,7 +32,7 @@ class QgsCoordinateTransform;
* An acetate object is a graphic or text object that is drawn on top of the map canvas * An acetate object is a graphic or text object that is drawn on top of the map canvas
* after rendering of all map elements is completed. Acetate objects can be drawn in * after rendering of all map elements is completed. Acetate objects can be drawn in
* device coordinates or map coordinates. Drawing in map coordinates requires passing * device coordinates or map coordinates. Drawing in map coordinates requires passing
* a QgsCoordinateTransform object to the draw function. * a QgsMapToPixel object to the draw function.
* *
*/ */
class QgsAcetateRectangle : public QgsAcetateObject { class QgsAcetateRectangle : public QgsAcetateObject {
@ -54,7 +54,7 @@ class QgsAcetateRectangle : public QgsAcetateObject {
* this parameter is not specified, coordinates are assumed to be device coordinates * this parameter is not specified, coordinates are assumed to be device coordinates
* rather than map coordinates. * rather than map coordinates.
*/ */
void draw (QPainter * painter, QgsCoordinateTransform * cXf=0); void draw (QPainter * painter, QgsMapToPixel * cXf=0);
/** /**
* Set the origin point * Set the origin point
* @param value Point of origin * @param value Point of origin

View File

@ -21,7 +21,7 @@
#include "qgsrenderer.h" #include "qgsrenderer.h"
#include "qgsrenderitem.h" #include "qgsrenderitem.h"
#include <qpainter.h> #include <qpainter.h>
#include "qgscoordinatetransform.h" #include "qgsmaptopixel.h"
#include "qgspoint.h" #include "qgspoint.h"
#include "qgsfeature.h" #include "qgsfeature.h"
#include <iostream> #include <iostream>

View File

@ -25,7 +25,7 @@
#include <iostream> #include <iostream>
#include "qgspoint.h" #include "qgspoint.h"
#include "qpainter.h" #include "qpainter.h"
#include "qgscoordinatetransform.h" #include "qgsmaptopixel.h"
#include "qgsfeature.h" #include "qgsfeature.h"
#include "qgsvectorlayer.h" #include "qgsvectorlayer.h"
#include "qgsdlgvectorlayerproperties.h" #include "qgsdlgvectorlayerproperties.h"

View File

@ -30,7 +30,7 @@
#include "qgsfeature.h" #include "qgsfeature.h"
#include "qgsfield.h" #include "qgsfield.h"
#include "qgsrect.h" #include "qgsrect.h"
#include "qgscoordinatetransform.h" #include "qgsmaptopixel.h"
#include "qgslabelattributes.h" #include "qgslabelattributes.h"
#include "qgslabeldialog.h" #include "qgslabeldialog.h"
@ -83,7 +83,7 @@ QString QgsLabel::fieldValue ( int attr, QgsFeature *feature )
} }
void QgsLabel::renderLabel( QPainter * painter, QgsRect *viewExtent, void QgsLabel::renderLabel( QPainter * painter, QgsRect *viewExtent,
QgsCoordinateTransform *transform, QPaintDevice* device, QgsMapToPixel *transform, QPaintDevice* device,
QgsFeature *feature, bool selected, QgsLabelAttributes *classAttributes ) QgsFeature *feature, bool selected, QgsLabelAttributes *classAttributes )
{ {
#if QGISDEBUG > 3 #if QGISDEBUG > 3

View File

@ -32,7 +32,7 @@ class QgsField;
class QgsMapCanvas; class QgsMapCanvas;
class QgsLabelAttributes; class QgsLabelAttributes;
class QgsRect; class QgsRect;
class QgsCoordinateTransform; class QgsMapToPixel;
/** Render class to display labels */ /** Render class to display labels */
class QgsLabel class QgsLabel
@ -70,7 +70,7 @@ public:
void dialog( QWidget * parent = 0 ); void dialog( QWidget * parent = 0 );
void renderLabel ( QPainter* painter, QgsRect* viewExtent, void renderLabel ( QPainter* painter, QgsRect* viewExtent,
QgsCoordinateTransform *transform, QPaintDevice *device, QgsMapToPixel *transform, QPaintDevice *device,
QgsFeature *feature, bool selected, QgsLabelAttributes *classAttributes=0); QgsFeature *feature, bool selected, QgsLabelAttributes *classAttributes=0);
/** Reads the renderer configuration from an XML file /** Reads the renderer configuration from an XML file

View File

@ -76,7 +76,7 @@
#include "qgsrect.h" #include "qgsrect.h"
#include "qgsacetaterectangle.h" #include "qgsacetaterectangle.h"
#include "qgsattributedialog.h" #include "qgsattributedialog.h"
#include "qgscoordinatetransform.h" #include "qgsmaptopixel.h"
#include "qgsfeature.h" #include "qgsfeature.h"
#include "qgslegend.h" #include "qgslegend.h"
#include "qgslegenditem.h" #include "qgslegenditem.h"
@ -116,7 +116,7 @@ public:
scaleCalculator( 0x0 ) scaleCalculator( 0x0 )
{ {
mapWindow = new QRect; mapWindow = new QRect;
coordXForm = new QgsCoordinateTransform; coordXForm = new QgsMapToPixel;
pmCanvas = new QPixmap(width, height); pmCanvas = new QPixmap(width, height);
scaleCalculator = new QgsScaleCalculator; scaleCalculator = new QgsScaleCalculator;
// set the initial extent - can't use a constructor since QgsRect // set the initial extent - can't use a constructor since QgsRect
@ -140,7 +140,7 @@ public:
scaleCalculator( 0x0 ) scaleCalculator( 0x0 )
{ {
mapWindow = new QRect; mapWindow = new QRect;
coordXForm = new QgsCoordinateTransform; coordXForm = new QgsMapToPixel;
pmCanvas = new QPixmap; pmCanvas = new QPixmap;
scaleCalculator = new QgsScaleCalculator; scaleCalculator = new QgsScaleCalculator;
} }
@ -206,8 +206,8 @@ public:
/** Pointer to the coordinate transform object used to transform /** Pointer to the coordinate transform object used to transform
coordinates from real world to device coordinates coordinates from real world to device coordinates
*/ */
//std::auto_ptr<QgsCoordinateTransform> coordXForm; //std::auto_ptr<QgsMapToPixel> coordXForm;
QgsCoordinateTransform * coordXForm; QgsMapToPixel * coordXForm;
/** /**
* \brief Currently selected map tool. * \brief Currently selected map tool.
@ -812,7 +812,7 @@ void QgsMapCanvas::render(QPaintDevice * theQPaintDevice)
// return the current coordinate transform based on the extents and // return the current coordinate transform based on the extents and
// device size // device size
QgsCoordinateTransform * QgsMapCanvas::getCoordinateTransform() QgsMapToPixel * QgsMapCanvas::getCoordinateTransform()
{ {
return mCanvasProperties->coordXForm; return mCanvasProperties->coordXForm;
} }

View File

@ -49,7 +49,7 @@ class QColor;
class QPaintDevice; class QPaintDevice;
class QMouseEvent; class QMouseEvent;
class QgsCoordinateTransform; class QgsMapToPixel;
class QgsMapLayer; class QgsMapLayer;
class QgsMapLayerInterface; class QgsMapLayerInterface;
class QgsLegend; class QgsLegend;
@ -166,7 +166,7 @@ class QgsMapCanvas : public QWidget
QgsScaleCalculator::units mapUnits() const; QgsScaleCalculator::units mapUnits() const;
//! Get the current coordinate transform //! Get the current coordinate transform
QgsCoordinateTransform * getCoordinateTransform(); QgsMapToPixel * getCoordinateTransform();
//! Declare the legend class as a friend of the map canvas //! Declare the legend class as a friend of the map canvas
//friend class QgsLegend; //friend class QgsLegend;

View File

@ -129,12 +129,12 @@ void QgsMapLayer::draw(QPainter *, QgsRect * viewExtent, int yTransform)
// std::cout << "In QgsMapLayer::draw" << std::endl; // std::cout << "In QgsMapLayer::draw" << std::endl;
} }
void QgsMapLayer::draw(QPainter *, QgsRect *, QgsCoordinateTransform *,QPaintDevice * ) void QgsMapLayer::draw(QPainter *, QgsRect *, QgsMapToPixel *,QPaintDevice * )
{ {
// std::cout << "In QgsMapLayer::draw" << std::endl; // std::cout << "In QgsMapLayer::draw" << std::endl;
} }
void QgsMapLayer::drawLabels(QPainter *, QgsRect *, QgsCoordinateTransform *,QPaintDevice * ) void QgsMapLayer::drawLabels(QPainter *, QgsRect *, QgsMapToPixel *,QPaintDevice * )
{ {
// std::cout << "In QgsMapLayer::draw" << std::endl; // std::cout << "In QgsMapLayer::draw" << std::endl;
} }

View File

@ -27,7 +27,7 @@
#include <qgsrect.h> #include <qgsrect.h>
#include <qgis.h> #include <qgis.h>
#include <qgscoordinatetransform.h> #include <qgsmaptopixel.h>
#include <qgisapp.h> #include <qgisapp.h>
#include <qgssymbol.h> #include <qgssymbol.h>
#include <qgsfield.h> #include <qgsfield.h>
@ -97,8 +97,8 @@ public:
virtual void draw(QPainter *, QgsRect *, int); virtual void draw(QPainter *, QgsRect *, int);
virtual void draw(QPainter *, QgsRect *, QgsCoordinateTransform * ,QPaintDevice *); virtual void draw(QPainter *, QgsRect *, QgsMapToPixel * ,QPaintDevice *);
virtual void drawLabels(QPainter *, QgsRect *, QgsCoordinateTransform * ,QPaintDevice *); virtual void drawLabels(QPainter *, QgsRect *, QgsMapToPixel * ,QPaintDevice *);
/*! Identify the feature(s) in this layer that are contained in the search rectangle /*! Identify the feature(s) in this layer that are contained in the search rectangle
*/ */
virtual void identify(QgsRect *) virtual void identify(QgsRect *)

View File

@ -806,7 +806,7 @@ QPixmap QgsRasterLayer::getPaletteAsPixmap()
void QgsRasterLayer::draw(QPainter * theQPainter, void QgsRasterLayer::draw(QPainter * theQPainter,
QgsRect * theViewExtent, QgsRect * theViewExtent,
QgsCoordinateTransform * theQgsCoordinateTransform, QgsMapToPixel * theQgsMapToPixel,
QPaintDevice* dst) QPaintDevice* dst)
{ {
//Dont waste time drawing if transparency is at 0 (completely transparent) //Dont waste time drawing if transparency is at 0 (completely transparent)
@ -867,8 +867,8 @@ void QgsRasterLayer::draw(QPainter * theQPainter,
} }
// get dimensions of clipped raster image in device coordinate space (this is the size of the viewport) // get dimensions of clipped raster image in device coordinate space (this is the size of the viewport)
myRasterViewPort->topLeftPoint = theQgsCoordinateTransform->transform(myRasterExtent.xMin(), myRasterExtent.yMax()); myRasterViewPort->topLeftPoint = theQgsMapToPixel->transform(myRasterExtent.xMin(), myRasterExtent.yMax());
myRasterViewPort->bottomRightPoint = theQgsCoordinateTransform->transform(myRasterExtent.xMax(), myRasterExtent.yMin()); myRasterViewPort->bottomRightPoint = theQgsMapToPixel->transform(myRasterExtent.xMax(), myRasterExtent.yMin());
myRasterViewPort->drawableAreaXDimInt = static_cast<int>(myRasterViewPort->bottomRightPoint.x()) - static_cast<int>(myRasterViewPort->topLeftPoint.x()); myRasterViewPort->drawableAreaXDimInt = static_cast<int>(myRasterViewPort->bottomRightPoint.x()) - static_cast<int>(myRasterViewPort->topLeftPoint.x());
myRasterViewPort->drawableAreaYDimInt = static_cast<int>(myRasterViewPort->bottomRightPoint.y()) - static_cast<int>(myRasterViewPort->topLeftPoint.y()); myRasterViewPort->drawableAreaYDimInt = static_cast<int>(myRasterViewPort->bottomRightPoint.y()) - static_cast<int>(myRasterViewPort->topLeftPoint.y());

View File

@ -361,7 +361,7 @@ public:
QPixmap getPaletteAsPixmap(); QPixmap getPaletteAsPixmap();
/** \brief This is called when the view on the rasterlayer needs to be refreshed (redrawn). */ /** \brief This is called when the view on the rasterlayer needs to be refreshed (redrawn). */
void draw(QPainter * theQPainter, QgsRect * theViewExtent, QgsCoordinateTransform * theQgsCoordinateTransform, QPaintDevice* dst); void draw(QPainter * theQPainter, QgsRect * theViewExtent, QgsMapToPixel * theQgsMapToPixel, QPaintDevice* dst);
/** \brief This is an overloaded version of the above function that is called by both draw above and drawThumbnail */ /** \brief This is an overloaded version of the above function that is called by both draw above and drawThumbnail */
void draw (QPainter * theQPainter, RasterViewPort * myRasterViewPort); void draw (QPainter * theQPainter, RasterViewPort * myRasterViewPort);

View File

@ -19,7 +19,7 @@
#define QGSRENDERER_H #define QGSRENDERER_H
class QgsFeature; class QgsFeature;
class QgsCoordinateTransform; class QgsMapToPixel;
class QgsVectorLayer; class QgsVectorLayer;
class QPainter; class QPainter;
class QgsDlgVectorLayerProperties; class QgsDlgVectorLayerProperties;

View File

@ -23,7 +23,7 @@
#include "qgsrenderitem.h" #include "qgsrenderitem.h"
#include "qgspoint.h" #include "qgspoint.h"
#include "qpainter.h" #include "qpainter.h"
#include "qgscoordinatetransform.h" #include "qgsmaptopixel.h"
#include "qgsdlgvectorlayerproperties.h" #include "qgsdlgvectorlayerproperties.h"
class QgsFeature; class QgsFeature;

View File

@ -44,7 +44,7 @@
#include "qgisapp.h" #include "qgisapp.h"
#include "qgsrect.h" #include "qgsrect.h"
#include "qgspoint.h" #include "qgspoint.h"
#include "qgscoordinatetransform.h" #include "qgsmaptopixel.h"
#include "qgsvectorlayer.h" #include "qgsvectorlayer.h"
#include "qgsidentifyresults.h" #include "qgsidentifyresults.h"
#include "qgsattributetable.h" #include "qgsattributetable.h"
@ -252,7 +252,7 @@ void QgsVectorLayer::setDisplayField(QString fldName)
// NOTE this is a temporary method added by Tim to prevent label clipping // NOTE this is a temporary method added by Tim to prevent label clipping
// which was occurring when labeller was called in the main draw loop // which was occurring when labeller was called in the main draw loop
// This method will probably be removed again in the near future! // This method will probably be removed again in the near future!
void QgsVectorLayer::drawLabels(QPainter * p, QgsRect * viewExtent, QgsCoordinateTransform * cXf, QPaintDevice* dst) void QgsVectorLayer::drawLabels(QPainter * p, QgsRect * viewExtent, QgsMapToPixel * cXf, QPaintDevice* dst)
{ {
if ( /*1 == 1 */ m_renderer) if ( /*1 == 1 */ m_renderer)
{ {
@ -309,7 +309,7 @@ void QgsVectorLayer::drawLabels(QPainter * p, QgsRect * viewExtent, QgsCoordinat
} }
} }
void QgsVectorLayer::draw(QPainter * p, QgsRect * viewExtent, QgsCoordinateTransform * cXf, QPaintDevice* dst) void QgsVectorLayer::draw(QPainter * p, QgsRect * viewExtent, QgsMapToPixel * cXf, QPaintDevice* dst)
{ {
if ( /*1 == 1 */ m_renderer) if ( /*1 == 1 */ m_renderer)
{ {
@ -1877,7 +1877,7 @@ bool QgsVectorLayer::rollBack()
return true; return true;
} }
void QgsVectorLayer::drawFeature(QPainter* p, QgsFeature* fet, QgsCoordinateTransform * cXf, QPicture* marker, double markerScaleFactor) void QgsVectorLayer::drawFeature(QPainter* p, QgsFeature* fet, QgsMapToPixel * cXf, QPicture* marker, double markerScaleFactor)
{ {
unsigned char *feature; unsigned char *feature;
bool attributesneeded = m_renderer->needsAttributes(); bool attributesneeded = m_renderer->needsAttributes();

View File

@ -22,7 +22,7 @@
class QPainter; class QPainter;
class QgsRect; class QgsRect;
class QLibrary; class QLibrary;
class QgsCoordinateTransform; class QgsMapToPixel;
class OGRLayer; class OGRLayer;
class OGRDataSource; class OGRDataSource;
class QgsDataProvider; class QgsDataProvider;
@ -292,12 +292,12 @@ protected:
void startEditing(); void startEditing();
void stopEditing(); void stopEditing();
void drawFeature(QPainter* p, QgsFeature* fet, QgsCoordinateTransform * cXf, QPicture* marker, double markerScaleFactor); void drawFeature(QPainter* p, QgsFeature* fet, QgsMapToPixel * cXf, QPicture* marker, double markerScaleFactor);
private: // Private attributes private: // Private attributes
//! Draws the layer labels using coordinate transformation //! Draws the layer labels using coordinate transformation
void drawLabels(QPainter * p, QgsRect * viewExtent, QgsCoordinateTransform * cXf, QPaintDevice * dst); void drawLabels(QPainter * p, QgsRect * viewExtent, QgsMapToPixel * cXf, QPaintDevice * dst);
/** tailor the right-click context menu with vector layer only stuff /** tailor the right-click context menu with vector layer only stuff
@ -306,7 +306,7 @@ private: // Private attributes
void initContextMenu_(QgisApp *); void initContextMenu_(QgisApp *);
//! Draws the layer using coordinate transformation //! Draws the layer using coordinate transformation
void draw(QPainter * p, QgsRect * viewExtent, QgsCoordinateTransform * cXf, QPaintDevice * dst); void draw(QPainter * p, QgsRect * viewExtent, QgsMapToPixel * cXf, QPaintDevice * dst);
//! Pointer to data provider derived from the abastract base class QgsDataProvider //! Pointer to data provider derived from the abastract base class QgsDataProvider
QgsVectorDataProvider *dataProvider; QgsVectorDataProvider *dataProvider;
//! index of the primary label field //! index of the primary label field