Ejemplo n.º 1
0
bool ODConfig::ExportGPXODPoints( wxWindow* parent, ODPointList *pODPoints, const wxString suggestedName )
{
    wxFileDialog saveDialog( NULL, _( "Export GPX file" ), m_gpx_path, suggestedName,
            wxT ( "GPX files (*.gpx)|*.gpx" ), wxFD_SAVE );

    int response = saveDialog.ShowModal();

    wxString path = saveDialog.GetPath();
    wxFileName fn( path );
    m_gpx_path = fn.GetPath();

    if( response == wxID_OK ) {
        fn.SetExt( _T ( "gpx" ) );

        if( wxFileExists( fn.GetFullPath() ) ) {
            int answer = OCPNMessageBox_PlugIn(NULL,  _("Overwrite existing file?"), _("Confirm"),
                    wxICON_QUESTION | wxYES_NO | wxCANCEL );
            if( answer != wxID_YES ) return false;
        }

        ODNavObjectChanges *pgpx = new ODNavObjectChanges;
        pgpx->AddGPXODPointsList( pODPoints );
        pgpx->SaveFile(fn.GetFullPath());
        delete pgpx;

        return true;
    } else
        return false;
}
Ejemplo n.º 2
0
void GribSettingsDialog::OnSpacingModeChange( wxCommandEvent& event )
{
    bool message = false;
    switch( event.GetId() ) {
    case BARBFIXSPACING:
        m_cBarbArrMinSpac->SetValue( !m_cBarbArrFixSpac->IsChecked() );
        if( m_cBarbArrFixSpac->IsChecked() ) message = true;
        break;
    case BARBMINSPACING:
        m_cBarbArrFixSpac->SetValue( !m_cBarbArrMinSpac->IsChecked() );
        break;
    case DIRFIXSPACING:
        m_cDirArrMinSpac->SetValue( !m_cDirArrFixSpac->IsChecked() );
        if( m_cDirArrFixSpac->IsChecked() ) message = true;
        break;
    case DIRMINSPACING:
        m_cDirArrFixSpac->SetValue( !m_cDirArrMinSpac->IsChecked() );
        break;
    case NUMFIXSPACING:
        m_cNumMinSpac->SetValue( !m_cNumFixSpac->IsChecked() );
        if( m_cNumFixSpac->IsChecked() ) message = true;
        break;
    case NUMMINSPACING:
        m_cNumFixSpac->SetValue( !m_cNumMinSpac->IsChecked() );
    }

    if( message ) {
        OCPNMessageBox_PlugIn(this, _("This option imply you authorize intrepolation\nDon't forget that data displayed will not be real but recomputed\nThis can decrease accuracy!"),
                            _("Warning!") );
    }
}
Ejemplo n.º 3
0
void GribSettingsDialog::OnCtrlandDataStyleChanged( wxCommandEvent& event )
{
    wxString messages;
    if( (m_Settings.m_iCtrlandDataStyle == 0 && !m_rbCurDataAttaWCap->GetValue()) )
        messages.Printf( _("You want to remove the dialog title/drag bar\n") );
    if( (m_Settings.m_iCtrlandDataStyle != 0 && m_rbCurDataAttaWCap->GetValue()) )
        messages.Printf( _("You want to add a title/drag bar to the dialog\n") );
    if( !messages.IsEmpty() ) {
        m_parent.pPlugIn->m_DialogStyleChanged = true;
        messages.Append( _("This change needs a complete reload.\nIt will be applied after closing and re-opening the plugin") );
        OCPNMessageBox_PlugIn(this, messages );
    }
}
Ejemplo n.º 4
0
void GribRequestSetting::OnTimeRangeChange(wxCommandEvent &event)
{
    m_pWModel->Show( IsZYGRIB && m_pWaves->IsChecked());

    if( m_pModel->GetCurrentSelection() == 0 ) {               //gfs
        if( m_pTimeRange->GetCurrentSelection() > 6 ) {         //time range more than 8 days
            m_pWaves->SetValue(0);
            m_pWaves->Enable(false);
            OCPNMessageBox_PlugIn(this, _("You request a forecast for more than 8 days horizon.\nThis is conflicting with Wave data which will be removed from your request.\nDon't forget that beyond the first 8 days, the resolution will be only 2.5\u00B0x2.5\u00B0\nand the time intervall 12 hours."),
                _("Warning!") );
        } else
            m_pWaves->Enable(true);
    }

    if(m_AllowSend) m_MailImage->SetValue( WriteMail() );

    SetRequestDialogSize();
}
Ejemplo n.º 5
0
void PathProp::OnPathPropMenuSelected( wxCommandEvent& event )
{
    switch( event.GetId() ) {
        case ID_PATHPROP_MENU_DELETE: {
            long item = -1;
            item = m_opList->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
            if( item == -1 ) break;

            ODPoint *op;
            op = (ODPoint *) m_opList->GetItemData( item );

            wxString sMessage( wxS("Are you sure you want to remove this ") );
            wxString sCaption( wxS("OCPN Draw Remove ") );
            wxString sType( wxS("") );
            if (!op || op->GetTypeString().IsNull() || op->GetTypeString().IsEmpty() )
                sType.append( wxS("Point") );
            else
                sType.append( op->GetTypeString() );
            sMessage.append( sType );
            sMessage.append( wxS("?") );
            sCaption.append( sType );
            
            int dlg_return = OCPNMessageBox_PlugIn( this, sMessage, sCaption, (long) wxYES_NO | wxCANCEL | wxYES_DEFAULT );

            if( dlg_return == wxID_YES ) {
                m_pPath->RemovePointFromPath( op, m_pPath );
            }
            break;
        }
        case ID_PATHPROP_MENU_EDIT_WP: {
            long item = -1;

            item = m_opList->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );

            if( item == -1 ) break;

            ODPoint *op = (ODPoint *) m_opList->GetItemData( item );
            if( !op ) break;

            PathManagerDialog::ODPointShowPropertiesDialog( op, this );
            break;
        }
    }
}
Ejemplo n.º 6
0
void GribSettingsDialog::OnIntepolateChange( wxCommandEvent& event )
{
    if( m_cInterpolate->IsChecked() ) {
        OCPNMessageBox_PlugIn(this, _("You have chosen to authorize interpolation.\nDon't forget that data displayed will not be real but recomputed\nThis can decrease accuracy!"),
                            _("Warning!") );
        m_tSlicesPerUpdate->Enable();
        m_sSlicesPerUpdate->Enable();
    } else {                                        //hide no suiting parameters
        m_tSlicesPerUpdate->Disable();
        m_sSlicesPerUpdate->Disable();
    }
    if( m_cLoopMode->IsChecked() ) {
        m_staticText26->Enable();
        m_cLoopStartPoint->Enable();
    } else {
        m_staticText26->Disable();
        m_cLoopStartPoint->Disable();
    }
    Refresh();
   // SetSettingsDialogSize();
}
Ejemplo n.º 7
0
void ODConfig::ExportGPX( wxWindow* parent, bool bviz_only, bool blayer )
{
    wxFileDialog saveDialog( NULL, _( "Export GPX file" ), m_gpx_path, wxT ( "" ),
            wxT ( "GPX files (*.gpx)|*.gpx" ), wxFD_SAVE );

    int response = saveDialog.ShowModal();

    wxString path = saveDialog.GetPath();
    wxFileName fn( path );
    m_gpx_path = fn.GetPath();

    if( response == wxID_OK ) {
        fn.SetExt( _T ( "gpx" ) );

        if( wxFileExists( fn.GetFullPath() ) ) {
            int answer = OCPNMessageBox_PlugIn( NULL, _("Overwrite existing file?"), _("Confirm"),
                    wxICON_QUESTION | wxYES_NO | wxCANCEL );
            if( answer != wxID_YES ) return;
        }

        ::wxBeginBusyCursor();

        ODNavObjectChanges *pgpx = new ODNavObjectChanges;

        wxProgressDialog *pprog = NULL;
        int count = g_pODPointMan->GetODPointList()->GetCount();
        if( count > 200) {
            pprog = new wxProgressDialog( _("Export GPX file"), _T("0/0"), count, NULL,
                                          wxPD_APP_MODAL | wxPD_SMOOTH |
                                          wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME );
            pprog->SetSize( 400, wxDefaultCoord );
            pprog->Centre();
        }

        //Points
        int ic = 0;

        wxODPointListNode *node = g_pODPointMan->GetODPointList()->GetFirst();
        ODPoint *pr;
        while( node ) {
            if(pprog) {
                wxString msg;
                msg.Printf(_T("%d/%d"), ic, count);
                pprog->Update( ic, msg );
                ic++;
            }

            pr = node->GetData();

            bool b_add = true;

            if( bviz_only && !pr->m_bIsVisible )
                b_add = false;

            if( pr->m_bIsInLayer && !blayer )
                b_add = false;
            if( b_add) {
                if( pr->m_bKeepXPath || !ODPointIsInPathList( pr ) )
                    pgpx->AddGPXODPoint( pr);
            }

            node = node->GetNext();
        }
        //Paths
        wxPathListNode *node1 = g_pPathList->GetFirst();
        while( node1 ) {
            ODPath *pPath = node1->GetData();

            bool b_add = true;

            if( bviz_only && !pPath->IsVisible() )
                b_add = false;

            if(  pPath->m_bIsInLayer && !blayer )
                b_add = false;

            if( b_add ) {
                pgpx->AddGPXPath( pPath ); 
                }
            node1 = node1->GetNext();
        }

        pgpx->SaveFile( fn.GetFullPath() );
        delete pgpx;
        ::wxEndBusyCursor();

        if( pprog)
            delete pprog;

    }
}