void objsearch_pi::ScanArea( int latmin, int lonmin, int latmax, int lonmax, int scale )
{
    double lat = latmin;
    double lon = lonmin;
    double lat_step;
    double lon_step;
    double ppm_scale;
    
    while( !finishing && lat <= latmax )
    {
        JumpToPosition( lat, lon, m_vpppm );
        RequestRefresh(m_parent_window);
        wxMicroSleep(100);
        ppm_scale = CalculatePPM( scale );
        JumpToPosition( lat, lon, ppm_scale );
        RequestRefresh(m_parent_window);
        wxMicroSleep(100);
        lat_step = vplat_max - vplat_min;
        lon_step = vplon_max - vplon_min;
        while( !finishing && lon <= lonmax )
        {
            JumpToPosition(lat, lon, ppm_scale);
            RequestRefresh(m_parent_window);
            //wxMicroSleep(100);
            if (!finishing)
                wxYield();
            lon += lon_step;
        }
        lon = lonmin;
        lat += lat_step;
    }
    
    finishing = false;
}
Example #2
0
void GEUIDialog::GEClose()
{
//is all of the following needed?
      LogDebugMessage(_T("Closing GE requested"));
      if (NULL != app && m_bgeisuseable) 
      {
            LogDebugMessage(_T("Closing GE"));
            m_bgeisuseable = false;
            m_bclosed = true;
            try
            {
                  SendMessage((HWND) LongToHandle(app->GetMainHwnd()), WM_COMMAND, WM_QUIT, 0);
                  PostMessage((HWND) LongToHandle(app->GetMainHwnd()), WM_QUIT, 0, 0);
                  long is_initialized;
				  int cnt;
				  cnt = 0;
                  do {
	                  is_initialized = app->IsInitialized();
					  cnt++;
					  wxMicroSleep(1000);
                  } while ( is_initialized != 0 && cnt < 1000 );
                  app->Release();
                  //delete app;
                  app = NULL;
                  CoUninitialize();
            }
            catch(...) {
                  LogDebugMessage(_T("Error closing GE"));
            }
            LogDebugMessage(_T("GE closed"));
      }
}
Example #3
0
void WSortView::DoDelay(double delay)
{
    // must be called by the algorithm thread
    ASSERT(wmain->m_thread);
    ASSERT(wxThread::GetCurrentId() == wmain->m_thread->GetId());

    if (wmain->m_thread_terminate)
        wmain->m_thread->Exit();

    // idle until main thread signals a condition
    while (m_stepwise)
    {
        wxSemaError se = m_step_semaphore.WaitTimeout(200);
        if (se == wxSEMA_NO_ERROR)
            break;
        // else timeout, recheck m_stepwise and loop
        wmain->m_thread->TestDestroy();
        wmain->m_thread->Yield();
    }

    wmain->m_thread->TestDestroy();

#if __WXGTK__
    wxMicroSleep(delay * 1000.0);
#elif MSW_PERFORMANCECOUNTER
    mswMicroSleep(delay * 1000.0);
#else
    // wxMSW does not have a high resolution timer, maybe others do?
    wxMilliSleep(delay);
#endif
}
Example #4
0
void gravApp::iterateSessions()
{
    bool haveSessions = sessionManager->iterateSessions();

    // if there are no sessions, sleep so as not to spin and consume CPU
    // needlessly
    if ( !haveSessions )
        wxMicroSleep( 500 );
}
Example #5
0
bool SessionManager::iterateSessions()
{
    // kind of a hack to force this to wait, when removing etc.
    // mutex should do this but this thread seems way too eager
    if ( pause )
    {
        gravUtil::logVerbose( "Sessions temporarily paused...\n" );
        wxMicroSleep( 10 );
    }

    // note: iterate doesn't do lockSessions() since it shouldn't affect pause
    mutex_lock( sessionMutex );
    lockCount++;

    bool haveSessions = false;
    Group* sessions;
    SessionEntry* session;
    std::map<SessionType, Group*>::iterator i;

    // we iterate over the sessionmap here, instead of the regular group
    // children, since we might want to remove individual sessiongroups (like
    // audio) from that list for visual reasons
    for ( i = sessionMap.begin(); i != sessionMap.end(); ++i )
    {
        sessions = i->second;
        for ( int j = 0; j < sessions->numObjects(); j++ )
        {
            session = static_cast<SessionEntry*>( (*sessions)[j] );
            haveSessions = session->iterate() || haveSessions;
        }

        if ( haveSessions && gravApp::threadDebug )
        {
            if ( session->getTimestamp() % 1000 == 0 )
            {
                gravUtil::logVerbose( "SessionManager::iterate: "
                                      "have %u sessions in this group, last TS=%u\n",
                                      sessions->numObjects(), session->getTimestamp() );
            }
        }
    }

    lockCount--;
    mutex_unlock( sessionMutex );

    return haveSessions;
}
Example #6
0
void wxMilliSleep(unsigned long milliseconds)
{
    wxMicroSleep(milliseconds*1000);
}
Example #7
0
void rMicroSleep(u64 time)
{
	wxMicroSleep(time);
}