fixes to drawing code

git-svn-id: http://svn.osgeo.org/qgis/trunk@46 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
gsherman 2002-07-27 06:35:03 +00:00
parent c94a18c603
commit 4983e92aae
3 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,6 @@
July 26, 2002
Drawing code now properly displays layers and calculates extents when
zooming. Zoom is still fixed zoom in rather than interactive.
July 20, 2002
Repaint automatic for layers.
July 18, 2002

View File

@ -268,5 +268,5 @@ QgisApp::drawPoint (double x, double y)
void QgisApp::drawLayers(){
cout << "In QgisApp::drawLayers()" << endl;
mapCanvas->render();
mapCanvas->render2();
}

View File

@ -56,14 +56,16 @@ void QgsMapCanvas::render2(){
cout << "MuppX is: " << muppX << "\nMuppY is: " << muppY << endl;
m_mupp = muppY > muppX?muppY:muppX;
// calculate the actual extent of the mapCanvas
double dxmin,dymin,dymax,whitespace;
double dxmin,dxmax,dymin,dymax,whitespace;
if(muppY > muppX){
dymin = currentExtent.yMin();
dymax = currentExtent.yMax();
whitespace = ((width() *m_mupp) - currentExtent.width())/2;
dxmin = currentExtent.xMin() - whitespace;
dxmax = currentExtent.xMax() + whitespace;
}else{
dxmin = currentExtent.xMin();
dxmax = currentExtent.xMax();
whitespace = ((height() *m_mupp) - currentExtent.height())/2;
dymin = currentExtent.yMin() - whitespace;
dymax = currentExtent.yMax() + whitespace;
@ -71,6 +73,11 @@ void QgsMapCanvas::render2(){
}
cout << "dxmin: " << dxmin << endl << "dymin: " << dymin << endl << "dymax: " << dymax << endl << "whitespace: " << whitespace << endl;
coordXForm->setParameters(m_mupp, dxmin,dymin,height()); //currentExtent.xMin(), currentExtent.yMin(), currentExtent.yMax());
// update the currentExtent to match the device coordinates
currentExtent.setXmin(dxmin);
currentExtent.setXmax(dxmax);
currentExtent.setYmin(dymin);
currentExtent.setYmax(dymax);
// render all layers in the stack, starting at the base
map<QString,QgsMapLayer *>::iterator mi = layers.begin();
while(mi != layers.end()){