示例#1
0
WayPointman::WayPointman()
{

    m_pWayPointList = new RoutePointList;

    pmarkicon_image_list = NULL;

    ocpnStyle::Style* style = g_StyleManager->GetCurrentStyle();
    m_pIconArray = new wxArrayPtrVoid();
    ProcessIcons( style );

    // Load user defined icons.

    wxString UserIconPath = g_PrivateDataDir;
    wxChar sep = wxFileName::GetPathSeparator();
    if( UserIconPath.Last() != sep ) UserIconPath.Append( sep );
    UserIconPath.Append( _T("UserIcons") );

    if( wxDir::Exists( UserIconPath ) ) {
        wxArrayString FileList;

        wxDir dir( UserIconPath );
        int n_files = dir.GetAllFiles( UserIconPath, &FileList );

        for( int ifile = 0; ifile < n_files; ifile++ ) {
            wxString name = FileList.Item( ifile );

            wxFileName fn( name );
            wxString iconname = fn.GetName();
            wxBitmap icon1;

            if( fn.GetExt().Lower() == _T("xpm") ) {
                if( icon1.LoadFile( name, wxBITMAP_TYPE_XPM ) ) {
                    ProcessIcon( icon1, iconname, iconname );
                }
            }
            if( fn.GetExt().Lower() == _T("png") ) {
                if( icon1.LoadFile( name, wxBITMAP_TYPE_PNG ) ) {
                    ProcessIcon( icon1, iconname, iconname );
                }
            }
        }
    }

    m_nGUID = 0;
}
示例#2
0
void PointMan::ProcessUserIcons( )
{
#ifdef __WXOSX__
    wxStandardPathsBase& std_path = wxStandardPathsBase::Get();
    wxString UserIconPath = std_path.GetUserConfigDir();
    UserIconPath += wxS("/opencpn/UserIcons");
    
    if( wxDir::Exists( UserIconPath ) ) {
        wxArrayString FileList;
        
        wxDir dir( UserIconPath );
        int n_files = dir.GetAllFiles( UserIconPath, &FileList );
#else
    wxString *UserIconPath = g_PrivateDataDir;
    wxChar sep = wxFileName::GetPathSeparator();
    if ( UserIconPath->IsNull() ) return;
    
    if( UserIconPath->Last() != sep ) UserIconPath->Append( sep );
    UserIconPath->Append( _T("UserIcons") );
    
    if( wxDir::Exists( *UserIconPath ) ) {
        wxArrayString FileList;
        
        wxDir dir( *UserIconPath );
        int n_files = dir.GetAllFiles( *UserIconPath, &FileList );
#endif
        
        for( int ifile = 0; ifile < n_files; ifile++ ) {
            wxString name = FileList.Item( ifile );
            
            wxFileName fn( name );
            wxString iconname = fn.GetName();
            wxBitmap icon1;
            
            if( fn.GetExt().Lower() == _T("xpm") ) {
                if( icon1.LoadFile( name, wxBITMAP_TYPE_XPM ) ) {
                    ProcessIcon( icon1, iconname, iconname );
                }
            }
            if( fn.GetExt().Lower() == _T("png") ) {
                if( icon1.LoadFile( name, wxBITMAP_TYPE_PNG ) ) {
                    ProcessIcon( icon1, iconname, iconname );
                }
            }
        }
    }
}


void PointMan::ProcessIcons( )
{
    ProcessIcon( GetIcon_PlugIn( _T("empty") ), _T("empty"), _T("Empty") );
    ProcessIcon( GetIcon_PlugIn( _T("airplane") ), _T("airplane"), _T("Airplane") );
    ProcessIcon( GetIcon_PlugIn( _T("anchorage") ), _T("anchorage"), _T("Anchorage") );
    ProcessIcon( GetIcon_PlugIn( _T("anchor") ), _T("anchor"), _T("Anchor") );
    ProcessIcon( GetIcon_PlugIn( _T("boarding") ), _T("boarding"), _T("Boarding Location") );
    ProcessIcon( GetIcon_PlugIn( _T("boundary") ), _T("boundary"), _T("Boundary Mark") );
    ProcessIcon( GetIcon_PlugIn( _T("bouy1") ), _T("bouy1"), _T("Bouy Type A") );
    ProcessIcon( GetIcon_PlugIn( _T("bouy2") ), _T("bouy2"), _T("Bouy Type B") );
    ProcessIcon( GetIcon_PlugIn( _T("campfire") ), _T("campfire"), _T("Campfire") );
    ProcessIcon( GetIcon_PlugIn( _T("camping") ), _T("camping"), _T("Camping Spot") );
    ProcessIcon( GetIcon_PlugIn( _T("coral") ), _T("coral"), _T("Coral") );
    ProcessIcon( GetIcon_PlugIn( _T("fishhaven") ), _T("fishhaven"), _T("Fish Haven") );
    ProcessIcon( GetIcon_PlugIn( _T("fishing") ), _T("fishing"), _T("Fishing Spot") );
    ProcessIcon( GetIcon_PlugIn( _T("fish") ), _T("fish"), _T("Fish") );
    ProcessIcon( GetIcon_PlugIn( _T("float") ), _T("float"), _T("Float") );
    ProcessIcon( GetIcon_PlugIn( _T("food") ), _T("food"), _T("Food") );
    ProcessIcon( GetIcon_PlugIn( _T("fuel") ), _T("fuel"), _T("Fuel") );
    ProcessIcon( GetIcon_PlugIn( _T("greenlite") ), _T("greenlite"), _T("Green Light") );
    ProcessIcon( GetIcon_PlugIn( _T("kelp") ), _T("kelp"), _T("Kelp") );
    ProcessIcon( GetIcon_PlugIn( _T("light") ), _T("light1"), _T("Light Type A") );
    ProcessIcon( GetIcon_PlugIn( _T("light1") ), _T("light"), _T("Light Type B") );
    ProcessIcon( GetIcon_PlugIn( _T("litevessel") ), _T("litevessel"), _T("Light Vessel") );
    ProcessIcon( GetIcon_PlugIn( _T("mob") ), _T("mob"), _T("MOB") );
    ProcessIcon( GetIcon_PlugIn( _T("mooring") ), _T("mooring"), _T("Mooring Bouy") );
    ProcessIcon( GetIcon_PlugIn( _T("oilbouy") ), _T("oilbouy"), _T("Oil Bouy") );
    ProcessIcon( GetIcon_PlugIn( _T("platform") ), _T("platform"), _T("Platform") );
    ProcessIcon( GetIcon_PlugIn( _T("redgreenlite") ), _T("redgreenlite"), _T("Red/Green Light") );
    ProcessIcon( GetIcon_PlugIn( _T("redlite") ), _T("redlite"), _T("Red Light") );
    ProcessIcon( GetIcon_PlugIn( _T("rock1") ), _T("rock1"), _T("Rock (exposed)") );
    ProcessIcon( GetIcon_PlugIn( _T("rock2") ), _T("rock2"), _T("Rock, (awash)") );
    ProcessIcon( GetIcon_PlugIn( _T("sand") ), _T("sand"), _T("Sand") );
    ProcessIcon( GetIcon_PlugIn( _T("scuba") ), _T("scuba"), _T("Scuba") );
    ProcessIcon( GetIcon_PlugIn( _T("shoal") ), _T("shoal"), _T("Shoal") );
    ProcessIcon( GetIcon_PlugIn( _T("snag") ), _T("snag"), _T("Snag") );
    ProcessIcon( GetIcon_PlugIn( _T("square") ), _T("square"), _T("Square") );
    ProcessIcon( GetIcon_PlugIn( _T("triangle") ), _T("triangle"), _T("Triangle") );
    ProcessIcon( GetIcon_PlugIn( _T("diamond") ), _T("diamond"), _T("Diamond") );
    ProcessIcon( GetIcon_PlugIn( _T("circle") ), _T("circle"), _T("Circle") );
    ProcessIcon( GetIcon_PlugIn( _T("wreck1") ), _T("wreck1"), _T("Wreck A") );
    ProcessIcon( GetIcon_PlugIn( _T("wreck2") ), _T("wreck2"), _T("Wreck B") );
    ProcessIcon( GetIcon_PlugIn( _T("xmblue") ), _T("xmblue"), _T("Blue X") );
    ProcessIcon( GetIcon_PlugIn( _T("xmgreen") ), _T("xmgreen"), _T("Green X") );
    ProcessIcon( GetIcon_PlugIn( _T("xmred") ), _T("xmred"), _T("Red X") );
    ProcessIcon( GetIcon_PlugIn( _T("activepoint") ), _T("activepoint"), _T("Active WP") );
// Load user defined icons.
    // Done after default icons are initialized,
    // so that user may substitute an icon by using the same name in the Usericons file.
    ProcessUserIcons( );
    
}
示例#3
0
void WayPointman::ProcessIcons( ocpnStyle::Style* style )
{
    ProcessIcon( style->GetIcon( _T("empty") ), _T("empty"), _T("Empty") );
    ProcessIcon( style->GetIcon( _T("airplane") ), _T("airplane"), _T("Airplane") );
    ProcessIcon( style->GetIcon( _T("anchorage") ), _T("anchorage"), _T("Anchorage") );
    ProcessIcon( style->GetIcon( _T("anchor") ), _T("anchor"), _T("Anchor") );
    ProcessIcon( style->GetIcon( _T("boarding") ), _T("boarding"), _T("Boarding Location") );
    ProcessIcon( style->GetIcon( _T("boundary") ), _T("boundary"), _T("Boundary Mark") );
    ProcessIcon( style->GetIcon( _T("bouy1") ), _T("bouy1"), _T("Bouy Type A") );
    ProcessIcon( style->GetIcon( _T("bouy2") ), _T("bouy2"), _T("Bouy Type B") );
    ProcessIcon( style->GetIcon( _T("campfire") ), _T("campfire"), _T("Campfire") );
    ProcessIcon( style->GetIcon( _T("camping") ), _T("camping"), _T("Camping Spot") );
    ProcessIcon( style->GetIcon( _T("coral") ), _T("coral"), _T("Coral") );
    ProcessIcon( style->GetIcon( _T("fishhaven") ), _T("fishhaven"), _T("Fish Haven") );
    ProcessIcon( style->GetIcon( _T("fishing") ), _T("fishing"), _T("Fishing Spot") );
    ProcessIcon( style->GetIcon( _T("fish") ), _T("fish"), _T("Fish") );
    ProcessIcon( style->GetIcon( _T("float") ), _T("float"), _T("Float") );
    ProcessIcon( style->GetIcon( _T("food") ), _T("food"), _T("Food") );
    ProcessIcon( style->GetIcon( _T("fuel") ), _T("fuel"), _T("Fuel") );
    ProcessIcon( style->GetIcon( _T("greenlite") ), _T("greenlite"), _T("Green Light") );
    ProcessIcon( style->GetIcon( _T("kelp") ), _T("kelp"), _T("Kelp") );
    ProcessIcon( style->GetIcon( _T("light") ), _T("light1"), _T("Light Type A") );
    ProcessIcon( style->GetIcon( _T("light1") ), _T("light"), _T("Light Type B") );
    ProcessIcon( style->GetIcon( _T("litevessel") ), _T("litevessel"), _T("Light Vessel") );
    ProcessIcon( style->GetIcon( _T("mob") ), _T("mob"), _T("MOB") );
    ProcessIcon( style->GetIcon( _T("mooring") ), _T("mooring"), _T("Mooring Bouy") );
    ProcessIcon( style->GetIcon( _T("oilbouy") ), _T("oilbouy"), _T("Oil Bouy") );
    ProcessIcon( style->GetIcon( _T("platform") ), _T("platform"), _T("Platform") );
    ProcessIcon( style->GetIcon( _T("redgreenlite") ), _T("redgreenlite"), _T("Red/Green Light") );
    ProcessIcon( style->GetIcon( _T("redlite") ), _T("redlite"), _T("Red Light") );
    ProcessIcon( style->GetIcon( _T("rock1") ), _T("rock1"), _T("Rock (exposed)") );
    ProcessIcon( style->GetIcon( _T("rock2") ), _T("rock2"), _T("Rock, (awash)") );
    ProcessIcon( style->GetIcon( _T("sand") ), _T("sand"), _T("Sand") );
    ProcessIcon( style->GetIcon( _T("scuba") ), _T("scuba"), _T("Scuba") );
    ProcessIcon( style->GetIcon( _T("shoal") ), _T("shoal"), _T("Shoal") );
    ProcessIcon( style->GetIcon( _T("snag") ), _T("snag"), _T("Snag") );
    ProcessIcon( style->GetIcon( _T("square") ), _T("square"), _T("Square") );
    ProcessIcon( style->GetIcon( _T("triangle") ), _T("triangle"), _T("Triangle") );
    ProcessIcon( style->GetIcon( _T("diamond") ), _T("diamond"), _T("Diamond") );
    ProcessIcon( style->GetIcon( _T("circle") ), _T("circle"), _T("Circle") );
    ProcessIcon( style->GetIcon( _T("wreck1") ), _T("wreck1"), _T("Wreck A") );
    ProcessIcon( style->GetIcon( _T("wreck2") ), _T("wreck2"), _T("Wreck B") );
    ProcessIcon( style->GetIcon( _T("xmblue") ), _T("xmblue"), _T("Blue X") );
    ProcessIcon( style->GetIcon( _T("xmgreen") ), _T("xmgreen"), _T("Green X") );
    ProcessIcon( style->GetIcon( _T("xmred") ), _T("xmred"), _T("Red X") );
    ProcessIcon( style->GetIcon( _T("activepoint") ), _T("activepoint"), _T("Active WP") );
}