void BoatDialog::RepopulatePolars()
{
    m_lPolars->DeleteAllItems();
#if 0
    if(m_Boat.Polars.size() == 0) {
        Polar generic_polar;
        wxString message, generic_polar_path = *GetpSharedDataLocation()
            + _T("plugins/weather_routing_pi/data/polars/60ft_mono.pol");
        bool success = generic_polar.Open(generic_polar_path, message);
        if(success)
            m_Boat.Polars.push_back(generic_polar);
        if(message.size())
            wxLogMessage(wxT("weather_routing_pi: ") + wxString(success ? _T("warning") : _T("error")) +
                         _T(" loading generic polar \"") + generic_polar_path + _T("\""));
    }
#endif
    for(unsigned int i=0; i<m_Boat.Polars.size(); i++) {
        wxListItem info;
        info.SetId(i);
        info.SetData(i);
        long idx = m_lPolars->InsertItem(info);
        Polar &polar = m_Boat.Polars[i];
        m_lPolars->SetItem(idx, spFILENAME, wxFileName(polar.FileName).GetFullName());
        m_lPolars->SetColumnWidth(spFILENAME, wxLIST_AUTOSIZE);
    }

//        m_lPolars->SetColumnWidth(spFILENAME, wxLIST_AUTOSIZE);
//    m_lPolars->SetColumnWidth(spFILENAME, 80);

    int enable = m_Boat.Polars.size();
    m_bRemovePolar->Enable(enable);
}
void InternetRetrievalDialog::Load()
{
    if(m_bLoaded)
        return;

    m_bLoaded = true;

    // create a image list for the list with check
    wxImageList *imglist = new wxImageList(20, 20, true, 1);
    imglist->Add(wxBitmap(check_xpm));
    m_lUrls->AssignImageList(imglist, wxIMAGE_LIST_SMALL);

    m_lUrls->InsertColumn(SELECTED, _("Selected"));
    m_lUrls->InsertColumn(SERVER, _("Server"));
    m_lUrls->InsertColumn(CONTENTS, _("Contents"));
    m_lUrls->InsertColumn(MAP_AREA, _("Map Area"));

    wxFileConfig *pConf = m_weatherfax_pi.m_pconfig;

    /* remove from config all cordinate sets */
    pConf->SetPath ( _T ( "/Settings/WeatherFax/InternetRetrieval" ) );

    wxString s;
    pConf->Read ( _T ( "ContainsLat" ), &s, _T("") );
    m_tContainsLat->SetValue(s);
    pConf->Read ( _T ( "ContainsLon" ), &s, _T("") );
    m_tContainsLon->SetValue(s);

    wxString servers;
    pConf->Read ( _T ( "Servers" ), &servers, _T(""));

    /* split at each ; to get all the names in a list */
    std::list<wxString> serverlist;
    while(servers.size()) {
        serverlist.push_back(servers.BeforeFirst(';'));
        servers = servers.AfterFirst(';');
    }

    s = wxFileName::GetPathSeparator();
    OpenXML(*GetpSharedDataLocation() + _T("plugins")
            + s + _T("weatherfax_pi") + s + _T("data") + s
            + _T("WeatherFaxInternetRetrieval.xml"));

    m_lServers->DeselectAll();
    for(unsigned int i=0; i < m_lServers->GetCount(); i++)
        for(std::list<wxString>::iterator it = serverlist.begin();
            it != serverlist.end(); it++)
            if(m_lServers->GetString(i) == *it)
                m_lServers->SetSelection(i);

    m_bDisableFilter = false;
    Filter();
}
void BR24DisplayOptionsDialog::OnSelectSoundClick(wxCommandEvent &event)
{
    wxString *sharedData = GetpSharedDataLocation();
    wxString sound_dir;

    sound_dir.Append( *sharedData );
    sound_dir.Append( wxT("sounds") );

    wxFileDialog *openDialog = new wxFileDialog( NULL, _("Select Sound File"), sound_dir, wxT(""),
                                                _("WAV files (*.wav)|*.wav|All files (*.*)|*.*"), wxFD_OPEN );
    int response = openDialog->ShowModal();
    if (response == wxID_OK ) {
        pPlugIn->settings.alert_audio_file = openDialog->GetPath();
    }
}
void WeatherRouting::OnInformation ( wxCommandEvent& event )
{
    InformationDialog dlg(GetParent());
#ifdef __WXOSX__
    wxStandardPathsBase& std_path = wxStandardPathsBase::Get();
    wxString infolocation = std_path.GetUserConfigDir()
    + _("/opencpn/plugins/weather_routing/data/WeatherRoutingInformation.html");
#else
    wxString infolocation = *GetpSharedDataLocation()
        + _("plugins/weather_routing_pi/data/WeatherRoutingInformation.html");
#endif
    if(dlg.m_htmlInformation->LoadFile(infolocation))
        dlg.ShowModal();
    else {
        wxMessageDialog mdlg(this, _("Failed to load file:\n") + infolocation,
                             _("Weather Routing"), wxOK | wxICON_ERROR);
        mdlg.ShowModal();
    }
}
Exemple #5
0
void initialize_images(void)
{
	{
		wxMemoryInputStream sm("\211PNG\r\n\032\n\000\000\000\rIHDR\000\000\000 \000\000\000 \b\006\000\000\000szz\364\000\000\000\006bKGD\000\000\000\000\000\000\371C\273\177\000\000\000\011pHYs\000\000\016\304\000\000\016\304\001\225+\016\033\000\000\000\atIME\a\337\n\035\a&\016\346V+\037\000\000\000\031tEXtComment\000Created with GIMPW\201\016\027\000\000\000\341IDATX\303\355VA\016\2030\014s\"\036\304\245\377\177@/\374\250\\\206\324im\023\027J7\215H\034\020)\211\035;\000<\361\304\277\207`M\321\225\271I\030\321\200\2723\275\215\222\261\334Eu\002by\004,\372\216Q\324\212s#\030&\302\036\r\020,\344\350\005\b_\307\200\336%\274\022z\256\201\234\366\013-\2513\321s\"\364\242\17715\257\001\000i\023x\212\367\215\340\342o\202x7\227\205\344`\207A_d\240\2666[\353\3642\027XE\314\3479\3725\235\263\241\000\341\270\272\3419\004\253\036\337\346\367\236\021\275\2357\232PB\255a\204\036\204Y\032\265\\\027\372\212}\205)\356A\377\361\016\243\211\245\203\262\320\370\275\n\254(\225Z4\215\334\352ycsJ\002\342)\253M\376\253\376\375\330\001\004qXP\375\316Y\343\000\000\000\000IEND\256B`\202", 377);
		_img_sweepplot = new wxBitmap(wxImage(sm));
	}

#ifdef SWEEPPLOT_USE_SVG
    wxFileName fn;
    fn.SetPath(*GetpSharedDataLocation());
    fn.AppendDir(_T("plugins"));
    fn.AppendDir(_T("sweepplot_pi"));
    fn.AppendDir(_T("data"));
    fn.SetFullName(_T("sweepplot_pi.svg"));
    _svg_sweepplot = fn.GetFullPath();
    fn.SetFullName(_T("sweepplot_pi_rollover.svg"));
    _svg_sweepplot_rollover = fn.GetFullPath();
    fn.SetFullName(_T("sweepplot_pi_toggled.svg"));
    _svg_sweepplot_toggled = fn.GetFullPath();
#endif

	return;
}
Exemple #6
0
void initialize_images(void)
{
{
		wxMemoryInputStream sm("\211PNG\r\n\032\n\000\000\000\rIHDR\000\000\000 \000\000\000 \b\006\000\000\000szz\364\000\000\000\004sBIT\b\b\b\b|\bd\210\000\000\000\001sRGB\000\256\316\034\351\000\000\000\004gAMA\000\000\261\217\013\374a\005\000\000\000\011pHYs\000\000\016\304\000\000\016\304\001\225+\016\033\000\000\000\031tEXtSoftware\000www.inkscape.org\233\356<\032\000\000\001\336IDATXG\355\227I\216\302@\014E\2350\b\204\230\357\301\236C \261e\013W\342\000p \270\004K\226\b\026\bH\347\033~\344\016\011I\025\335j\265\304\223L\\\203\253~\031\247\020A\024#%\301\324 \b\036\255;\267\333M\373`\\*=\347\025N\002\000\247c\343J\245\242>\261K\225\025\021>\236\245\341\302\330\374p8\310~\277\3276p99q\026\000pz\260Z\255d>\237\253o\323\357\"\304K@\030\336\303j\265\232\324\353u\365}q\026\200\2232\003\360)\306bk\241\bg\0016\275y\251\376\365\257\340'\371\b\370{\001\250X\227\252\005\266\310\\c\011\3434\003.Uk7D\034c]\016b\347\206\351\005\256\327k\342\347\031\357\001\314\205\001\216\025\305\003\354\211\373\003\353$5\300\323\340\216\247\237e\b\254V\253\032\323j\265\244\331l\252\2178\214\025\305[\264/V\025m6\033Y.\227\272\030U\246A?6\300\023\206\271\333\355Vv\273\235L\247S9\036\217\3118\237\026\264/\227\213\214\307cY,\026I\237f\000\367\371p8\224v\273-\335n7\323z\275\336S\273\321h\350\357\301`0\3206\254\337\357K\247\323\3716\227\3631\306\214\001\025\031\177x\263^\257\243\331l\366h\271\023\327@\224{\017\304\343OFXx\247\323I\316\347\263\372Y\363\323\226\0065\220+\300\026\016\215\320\317\352\177eY\344\nx\005O\223>Y\326)\213p\026`7\261'\363\331\0348\013\260\251\304\246\274\224\362R\\\204\327W`\301;O|D\274-\340]>\002\376\247\000\337\212\317\302K\000\337y\\\311\274\212\211\353}\360V\006F\243\221L&\023\365\211kv\274\376\035\303\354\373O\270Ty\021\"_\311\203\262\204\345eyb\000\000\000\000IEND\256B`\202", 638);
		_img_DR_pi = new wxBitmap(wxImage(sm));
	}
	{
		wxMemoryInputStream sm("\211PNG\r\n\032\n\000\000\000\rIHDR\000\000\000 \000\000\000 \b\006\000\000\000szz\364\000\000\000\004sBIT\b\b\b\b|\bd\210\000\000\000\001sRGB\000\256\316\034\351\000\000\000\004gAMA\000\000\261\217\013\374a\005\000\000\000\011pHYs\000\000\016\304\000\000\016\304\001\225+\016\033\000\000\000\031tEXtSoftware\000www.inkscape.org\233\356<\032\000\000\004\031IDATXG\265W\301N\024A\020\255\351\235\335\005!\234\314^\364\004\321\340\315HH\\\023\274p\222#7\221\204\030\277\306\020\344\003\364 \011\011\034\371\201\365\242Q\201\360\001`\004\023\301x$@\200]vg\255W\335\265\364\016=\231\321\304\232}\351\351\352\252W\325\3353];Q\227\205Xvvvh\177\177\237:\235\016\272\377MJ\245\022\215\216\216\322\304\304\204\364%\201\325\325U\272s\367\016\325\353u\252V\252\324\345\013\277L\211\030\0117&\"\311\037}\b|\374{_X\037\361\325l5\351\313\347/tttD\363\363\363\024mmmuONNhzz\232\332\355\266%\314\021I\220\245\034\227)\212\"\272\272\272\222\276\n8\240\017\011\364q\034S\243\321\240\221\221\0212{{{T\177\\\227\314\220\000\266 \027\355\016\031c\250\361\241AKo\226\204\020\372v\307\372'\335\244\337\336\003b \026b\"\266i]\265\250T.Q\322I\304\261\bt\206\307\307\307t\370\363P\2267Ix\014\200\215\266Y\340X\210\211\330\006d\022\\\011\n\240\223\360,\271\225D\334s\200>vF\306y\246j\233\011\216\011?\323S 3\337 \003\335\304\006\023\002\357\036\376\330\002\350\220Ho,\004/\326u\002\0148\345A\355t\025\372\220\232D\332W\341\333\310\026(\031\332<\250\235\020\270\200\332\a\271o\233\005\365\221-\300~\311\036\202\254\000:]g\017\022\347\253}A\300'\004\370\300\337>\204p\304>\026\205\006c\310\254\374\207.d\037\002\333\"v\377C\230\a\265s\316\222\274#S\335\r\237\020\234=`tOnd\030\200\006\324\375\003\231&\"+\301\aT\332'\004\261u\260+\340e\245\003\332\367\241z\004\302+\207S\r\220q&n'\356>\013\232\260\3676H\002P\3428-W\312T)W\004\270\277\201\262E\245\3026\214\241[CT\035\250\312X\265Z\225B\006\275\330\245}\001\256\035rj\352\2049\351hqi\261;\363l\206\336\276{K\315f\323\225\214\260h\201A\302\br\360\343\200~\377\372MSO\247\350\374\374\\\352\003\210K\206\217v\016\222\226V\263E/\346_\320\375{\367\305nm}\215\242\327\213\257\273\263\263\263R\"q6\243d\342\027\022I\000\307-\223\017\016\016\322\346\327M\332\375\266K\257^\276\242\323\323S;\016\023N0$\230\361\303G\017\251v\273&v\275\004\346\236\317\311\037\205\236d$\000b\004A;P\035\240\215\215\r\372\370\351#-//\313\n@t\225\202\302y\3113\303\023\200\335\372\332:\031!\344\013\263G\231\024\360V4/o\002K\250c\227\227\227\324j\265\344a\024\235\"\345\323\a\346\306\203\014A\\\0242\323\353\244\301\203A\360\030\366\332\224\214\275\217\\\253\272\220\217B\271\035 \262\002\205/g\213\237\210\334\332$l\367//\346\263\011(BY\373\360m\031\2305\364\314u\255O\373\204\320\307\201%d%\226O\2261\017j\247\263\026\022#\257\036t}\266Yp[%\366r\003\245\355\344#M\346\2403\223~\310/\r\347\303\355\265\242\020<\022\231\265\257\323{\337>\013j\327#\371[\270\255\370g\177\206\363\r\017\346\001\aW/8'\203~\332\246\020@\022\227b\351\biA8g\353\347\022\011\331\205\000[\304\024\277\270\314\037\025|:\241\032\ni\001\bQ\314p\311\243\365\311\363 \0372\210\311\261\315\203\361\aRT\206\207\206m\031\345\222\231\a\004\212\r\a\346V\236|^\011$\2021m3\3011\020\0131\307\307\307\355\307\351\312\373\025\373q\372\244.\377\005\362\004\305\bA\317N\317\350\342\342\202j\265\232\224W\324\024~\031\235UXPs\364\343taa\301&\200\201\355\355m\372\276\377]\376\251\024\025,'V\000\177J\213\n\336\375\261\3211\232\234\234\344\036\321\037F#5\277\231\\\242e\000\000\000\000IEND\256B`\202", 1209);
		_img_DR = new wxBitmap(wxImage(sm));
	}
	
#ifdef DR_USE_SVG
	wxFileName fn;
	fn.SetPath(*GetpSharedDataLocation());
	fn.AppendDir(_T("plugins"));
	fn.AppendDir(_T("dr_pi"));
	fn.AppendDir(_T("data"));
	fn.SetFullName(_T("dr_pi.svg"));
	_svg_dr = fn.GetFullPath();
	fn.SetFullName(_T("dr_pi_toggled.svg"));
	_svg_dr_toggled = fn.GetFullPath();
#endif
	return;
}
Exemple #7
0
int grib_pi::Init(void)
{
      AddLocaleCatalog( _T("opencpn-grib_pi") );

      // Set some default private member parameters
      m_CtrlBarxy = wxPoint( 0 ,0 );
      m_CursorDataxy = wxPoint( 0, 0 );

      m_pGribCtrlBar = NULL;
      m_pGRIBOverlayFactory = NULL;

      ::wxDisplaySize(&m_display_width, &m_display_height);

      m_DialogStyleChanged = false;

      //    Get a pointer to the opencpn configuration object
      m_pconfig = GetOCPNConfigObject();

      //    And load the configuration items
      LoadConfig();

      // Get a pointer to the opencpn display canvas, to use as a parent for the GRIB dialog
      m_parent_window = GetOCPNCanvasWindow();

//      int m_height = GetChartbarHeight();
      //    This PlugIn needs a CtrlBar icon, so request its insertion if enabled locally
	  if (m_bGRIBShowIcon) {
		  wxString shareLocn = *GetpSharedDataLocation() +
			  _T("plugins") + wxFileName::GetPathSeparator() +
			  _T("grib_pi") + wxFileName::GetPathSeparator()
			  + _T("data") + wxFileName::GetPathSeparator();

		  wxString normalIcon = shareLocn + _T("grib.svg");
		  wxString toggledIcon = shareLocn + _T("grib_toggled.svg");
		  wxString rolloverIcon = shareLocn + _T("grib_rollover.svg");

		  //  For journeyman styles, we prefer the built-in raster icons which match the rest of the toolbar.
		  if (GetActiveStyleName().Lower() != _T("traditional")){
			  normalIcon = _T("");
			  toggledIcon = _T("");
			  rolloverIcon = _T("");
		  }

		  wxLogMessage(normalIcon);
		  m_leftclick_tool_id = InsertPlugInToolSVG(_T(""), normalIcon, rolloverIcon, toggledIcon, wxITEM_CHECK,
			  _("Grib"), _T(""), NULL, GRIB_TOOL_POSITION, 0, this);
	  }

      if( !QualifyCtrlBarPosition( m_CtrlBarxy, m_CtrlBar_Sizexy ) ) {
          m_CtrlBarxy = wxPoint( 20, 60 );   //reset to the default position
          m_CursorDataxy = wxPoint( 20, 170 );
      }

      return (WANTS_OVERLAY_CALLBACK |
              WANTS_OPENGL_OVERLAY_CALLBACK |
              WANTS_CURSOR_LATLON       |
              WANTS_TOOLBAR_CALLBACK    |
              INSTALLS_TOOLBAR_TOOL     |
              WANTS_CONFIG              |
              WANTS_PREFERENCES         |
              WANTS_PLUGIN_MESSAGING    |
              WANTS_MOUSE_EVENTS
            );
}
wxString ClimatologyDataDirectory()
{
    wxString s =wxFileName::GetPathSeparator();
    return *GetpSharedDataLocation() + "plugins"
        + s + "climatology_pi" + s + "data" + s;
}
void BoatDialog::OnAddPolar( wxCommandEvent& event )
{
    wxFileConfig *pConf = GetOCPNConfigObject();
    pConf->SetPath ( _T( "/PlugIns/WeatherRouting/BoatDialog" ) );

    wxString path;
    pConf->Read ( _T ( "FilePath" ), &path, *GetpSharedDataLocation()
                  + _T("plugins/weather_routing_pi/data/polars"));
    path = wxFileName(path).GetPath();

    wxFileDialog openDialog
        ( this, _( "Select Polar File" ), path, wxT ( "" ),
          wxT ( "CSV, POL, TXT (*.csv, *.pol, *.txt)|*.CSV;*.csv;*.csv.gz;*.csv.bz2;*.POL;*.pol;*.pol.gz;*.pol.bz2;*.TXT;*.txt;*.txt.gz;*.txt.bz2|All files (*.*)|*.*" ),
          wxFD_OPEN | wxFD_MULTIPLE );

    if( openDialog.ShowModal() != wxID_OK )
        return;

    pConf->Write( _T ( "FilePath" ), openDialog.GetPath());

    wxArrayString paths;
    openDialog.GetPaths(paths);

    bool generate = false, existed = true;
    for(unsigned int i=0; i<paths.GetCount(); i++) {
        wxString filename = paths[i], message;
        Polar polar;

        for(unsigned int j=0; j<m_Boat.Polars.size(); j++)
            if(m_Boat.Polars[j].FileName == filename)
                goto skip;

        existed = wxFileName::Exists(filename);

        // write dummy file
        if(!existed) {
            wxFile file;
            if(file.Open(filename, wxFile::write))
                file.Write(dummy_polar);
        }
        
        if(polar.Open(filename, message)) {
            m_Boat.Polars.push_back(polar);
            RepopulatePolars();
            m_lPolars->SetItemState(m_Boat.Polars.size()-1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
            generate = true;
        } else {
            wxMessageDialog md(this, message,
                               _("OpenCPN Weather Routing Plugin"),
                               wxICON_ERROR | wxOK );
            md.ShowModal();
        }
    skip:;
    }

    if(generate)
        GenerateCrossOverChart();
            
    if(!existed)
        OnEditPolar(event);
}
static wxString DataDirectory()
{
    wxString s = wxFileName::GetPathSeparator();
    return *GetpSharedDataLocation() + "plugins" + s + "celestial_navigation_pi" + s + "data" + s;
}