Hello
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)
{
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) );
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.
}
}
}
//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.
}
}
}
To copy to clipboard, switch view to plain text mode
Thank you!
Bookmarks