Click to See Complete Forum and Search --> : World View Zooming factor


Kaatja
November 6th, 2008, 05:47 AM
Hello,

I firstly would like to introduce myself to you sinds I am a new comer in this discussion board. My name is Kaatja and am a software developer for a company in europe.

Now back to the business. We use QT-tookit in order to develope our GUI with it. But the programming language is C++. I am at this time busy making a world view interface(just like Google earth) see the below image.

http://img56.imageshack.us/my.php?image=79406270bm9.jpg

As i marked the small view at the right bottom corner of the view, I have also the same small view which has some drawing objects in it. And a big view which has also the same drawing objects as the small one.

When I select some area in the small view OnMouseRelease, I tend to zoom the same selected area in the bigger view. Can someone please give any idea how can I achieve this?

I have tried it myself too, and this is the code:


//class WorldView (the small view)
void WorldView::mouseReleaseEvent(QMouseEvent *e)
{

dScale2 = 2.0;
m_WorldViewSelect = false;

int x = 0;
int y = 0;

if ( m_bSelect )
{
//The selected area draws in the form of rectangle
SetSelect(0,0,0,0);
m_Select = m_Select.normalize();

m_bSelect = false;
x = -( m_Dev.Left() - ((m_Select.left() + m_Select.right()) / 2) );
y = -( m_Dev.Top() - ((m_Select.top() + m_Select.bottom()) / 2) );

QRect R = rect();

XFactor = (double)R.width() / (double)m_Select.width();
YFactor = (double)R.height() / (double)m_Select.height();

if (XFactor > YFactor)
dScale2 = YFactor;
else
dScale2 = XFactor;

if (m_pOtherView->View())
{
// if the other view the selected rectangle should be drawn in to the other view en aftwewards that selected area should be zoomed in

m_Zoomed = true;
m_pOtherView->View()->SetSelect(m_Select.x(), m_Select.y(),
m_Select.width(), m_Select.height());

m_pOtherView->View()->mouseReleaseEvent(e);

// After doing this, the zoomfactor for the other view is not correct and the selected area(Rectangle) is not been drown in the good position.

}

}
}


Thank you!

Kaatja