Ejemplo n.º 1
0
void wxGISMapView::RotateBy(wxPoint MouseLocation)
{
	if(m_nDrawingState == enumGISMapRotating)
	{
		if(m_pGISDisplay)
		{
			//compute angle
			double dX = m_FrameCenter.x - MouseLocation.x;
			double dY = m_FrameCenter.y - MouseLocation.y;
			double dAngle = atan2(dY, dX);
			dAngle -= m_dOriginAngle;
			if(dAngle < 0)
				dAngle += 2 * M_PI;

			wxClientDC CDC(this);
			m_pGISDisplay->RotatingDraw(dAngle, &CDC);

			m_dCurrentAngle = DOUBLEPI - m_pGISDisplay->GetRotate() - dAngle;
			if(m_dCurrentAngle >= DOUBLEPI)
				m_dCurrentAngle -= DOUBLEPI;
			if(m_dCurrentAngle < 0)
				m_dCurrentAngle += DOUBLEPI;
			DrawToolTip(CDC, wxString::Format(_("%.4f degree"), m_dCurrentAngle * DEGPI));
		}
	}
}
Ejemplo n.º 2
0
/**
 *  Zeichenfunktion WindowManager-Klasse.
 *  Zeichnet Desktop und alle Fenster.
 *
 *  @author OLiver
 *  @author FloSoft
 */
void WindowManager::Draw(void)
{
    // ist ein neuer Desktop eingetragen? Wenn ja, wechseln
    if(nextdesktop)
        Switch();

    // haben wir einen gültigen Desktop?
    if(!desktop)
        return;

    // ja, Msg_PaintBefore aufrufen
    desktop->Msg_PaintBefore();

    // und Desktop zeichnen
    desktop->Draw();

    // haben wir Fenster?
    if(!windows.empty())
    {
        for(IgwListIterator it = windows.begin(); it != windows.end(); ++it)
        {
            // Soll Fenster geschlossen werden?
            if((*it)->ShouldBeClosed())
            {
                // Fenster schliessen
                Close(*it);

                // und raus (korruption der liste verhindern)
                break;
            }

            // Fenster zeichnen
            (*it)->Draw();

            // wurde es minimiert?
            if(!(*it)->GetMinimized())
            {
                // nein, Msg_PaintAfter aufrufen
                (*it)->Msg_PaintAfter();
            }
        }
    }

    DrawToolTip();

    // Msg_PaintAfter aufrufen
    desktop->Msg_PaintAfter();
}
Ejemplo n.º 3
0
void wxGISMapView::OnMouseWheel(wxMouseEvent& event)
{
	//event.Skip(false);
    DestroyDrawThread();

	int nDirection = event.GetWheelRotation();
	int nDelta = event.GetWheelDelta();
	int nFactor = nDirection / nDelta;
	m_nDrawingState = enumGISMapWheeling;

	m_nFactor += ZOOM_FACTOR * (double)nFactor;


	if(m_pGISDisplay)
	{
		double dZoom = 1;
		if(m_nFactor < 0)
			dZoom = fabs(1.0 / (m_nFactor - 1));
		else if(m_nFactor > 0)
			dZoom = 1 + m_nFactor;
        wxClientDC CDC(this);
		m_pGISDisplay->WheelingDraw(dZoom, &CDC);

		//draw scale text
		OGREnvelope Env = CreateEnvelopeFromZoomFactor(dZoom);
		if(Env.IsInit())
		{
			double sScale = GetScaleRatio( Env, CDC );
			wxString sFormatScale = NumberScale(sScale);
			sFormatScale.Prepend(wxT("1 : "));
			DrawToolTip(CDC, sFormatScale);
		}
	}

	//if(!m_timer.IsRunning())
		m_timer.Start(TM_WHEELING);
}