Changeset 13483

Show
Ignore:
Timestamp:
09/19/14 12:35:23 (13 days ago)
Author:
robert
Message:

Moved widgets from VolumeEditorWidget? to TransferFunctionWidget?, and widget utilities into WidgetUtils?.

Location:
OpenSceneGraph/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osgDB/ReaderWriter

    r13258 r13483  
    110110                    FILE_NOT_HANDLED, //!< File is not appropriate for this file reader, due to some incompatibility, but *not* a read error. 
    111111                    FILE_NOT_FOUND, //!< File could not be found or could not be read. 
     112                    ERROR_IN_READING_FILE, //!< File found, loaded, but an error was encountered during processing. 
    112113                    FILE_LOADED, //!< File successfully found, loaded, and converted into osg. 
    113114                    FILE_LOADED_FROM_CACHE, //!< File found in cache and returned. 
    114                     ERROR_IN_READING_FILE, //!< File found, loaded, but an error was encountered during processing. 
    115115                    FILE_REQUESTED, //!< Asynchronous file read has been requested, but returning immediately, keep polling plugin until file read has been completed. 
    116116                    INSUFFICIENT_MEMORY_TO_LOAD //!< File found but not loaded because estimated required memory surpasses available memory. 
     
    124124                ReadResult& operator = (const ReadResult& rr) { if (this==&rr) return *this; _status=rr._status; _message=rr._message;_object=rr._object; return *this; } 
    125125 
     126                bool operator < (const ReadResult& rhs) const { return _status < rhs._status; } 
     127                 
    126128                osg::Object* getObject(); 
    127129                osg::Image* getImage(); 
     
    172174                    NOT_IMPLEMENTED, //!< write*() method not implemented in concrete ReaderWriter. 
    173175                    FILE_NOT_HANDLED, 
    174                     FILE_SAVED, 
    175                     ERROR_IN_WRITING_FILE 
     176                    ERROR_IN_WRITING_FILE, 
     177                    FILE_SAVED 
    176178                }; 
    177179 
     
    181183                WriteResult(const WriteResult& rr):_status(rr._status),_message(rr._message) {} 
    182184                WriteResult& operator = (const WriteResult& rr) { if (this==&rr) return *this; _status=rr._status; _message=rr._message; return *this; } 
     185 
     186                bool operator < (const WriteResult& rhs) const { return _status < rhs._status; } 
    183187 
    184188                std::string& message() { return _message; } 
  • OpenSceneGraph/trunk/src/osgDB/Registry.cpp

    r13331 r13483  
    11671167    } 
    11681168 
    1169  
    1170     if (!results.empty()) 
    1171     { 
    1172         unsigned int num_FILE_NOT_HANDLED = 0; 
    1173         unsigned int num_FILE_NOT_FOUND = 0; 
    1174         unsigned int num_ERROR_IN_READING_FILE = 0; 
    1175  
    1176         Results::iterator ritr; 
    1177         for(ritr=results.begin(); 
    1178             ritr!=results.end(); 
    1179             ++ritr) 
    1180         { 
    1181             if (ritr->status()==ReaderWriter::ReadResult::FILE_NOT_HANDLED) ++num_FILE_NOT_HANDLED; 
    1182             else if (ritr->status()==ReaderWriter::ReadResult::NOT_IMPLEMENTED) ++num_FILE_NOT_HANDLED;//Freetype and others 
    1183             else if (ritr->status()==ReaderWriter::ReadResult::FILE_NOT_FOUND) ++num_FILE_NOT_FOUND; 
    1184             else if (ritr->status()==ReaderWriter::ReadResult::ERROR_IN_READING_FILE) ++num_ERROR_IN_READING_FILE; 
    1185         } 
    1186  
    1187         if (num_FILE_NOT_HANDLED!=results.size()) 
    1188         { 
    1189             for(ritr=results.begin(); ritr!=results.end(); ++ritr) 
    1190             { 
    1191                 if (ritr->status()==ReaderWriter::ReadResult::ERROR_IN_READING_FILE) 
    1192                 { 
    1193                     // OSG_NOTICE<<"Warning: error reading file \""<<readFunctor._filename<<"\""<<std::endl; 
    1194                     return *ritr; 
    1195                 } 
    1196             } 
    1197  
    1198             //If the filename is a URL, don't return FILE_NOT_FOUND until the CURL plugin is given a chance 
    1199             if (!osgDB::containsServerAddress(readFunctor._filename)) 
    1200             { 
    1201                 for(ritr=results.begin(); ritr!=results.end(); ++ritr) 
    1202                 { 
    1203                     if (ritr->status()==ReaderWriter::ReadResult::FILE_NOT_FOUND) 
    1204                     { 
    1205                         //OSG_NOTICE<<"Warning: could not find file \""<<readFunctor._filename<<"\""<<std::endl; 
    1206                         return *ritr; 
    1207                     } 
    1208                 } 
    1209             } 
    1210         } 
    1211     } 
    1212  
    1213     results.clear(); 
    1214  
    12151169    // now look for a plug-in to load the file. 
    12161170    std::string libraryName = createLibraryNameForFile(readFunctor._filename); 
     
    12441198    } 
    12451199 
    1246     if (!results.empty()) 
    1247     { 
    1248         unsigned int num_FILE_NOT_HANDLED = 0; 
    1249         unsigned int num_FILE_NOT_FOUND = 0; 
    1250         unsigned int num_ERROR_IN_READING_FILE = 0; 
    1251  
    1252         Results::iterator ritr; 
    1253         for(ritr=results.begin(); 
    1254             ritr!=results.end(); 
    1255             ++ritr) 
    1256         { 
    1257             if (ritr->status()==ReaderWriter::ReadResult::FILE_NOT_HANDLED) ++num_FILE_NOT_HANDLED; 
    1258             else if (ritr->status()==ReaderWriter::ReadResult::FILE_NOT_FOUND) ++num_FILE_NOT_FOUND; 
    1259             else if (ritr->status()==ReaderWriter::ReadResult::ERROR_IN_READING_FILE) ++num_ERROR_IN_READING_FILE; 
    1260         } 
    1261  
    1262         if (num_FILE_NOT_HANDLED!=results.size()) 
    1263         { 
    1264             for(ritr=results.begin(); ritr!=results.end(); ++ritr) 
    1265             { 
    1266                 if (ritr->status()==ReaderWriter::ReadResult::ERROR_IN_READING_FILE) 
    1267                 { 
    1268                     // OSG_NOTICE<<"Warning: error reading file \""<<readFunctor._filename<<"\""<<std::endl; 
    1269                     return *ritr; 
    1270                 } 
    1271             } 
    1272  
    1273             for(ritr=results.begin(); ritr!=results.end(); ++ritr) 
    1274             { 
    1275                 if (ritr->status()==ReaderWriter::ReadResult::FILE_NOT_FOUND) 
    1276                 { 
    1277                     // OSG_NOTICE<<"Warning: could not find file \""<<readFunctor._filename<<"\""<<std::endl; 
    1278                     return *ritr; 
    1279                 } 
    1280             } 
    1281         } 
    1282     } 
    1283     else 
     1200    if (results.empty()) 
    12841201    { 
    12851202        return ReaderWriter::ReadResult("Warning: Could not find plugin to read objects from file \""+readFunctor._filename+"\"."); 
    12861203    } 
    12871204 
    1288     return results.front(); 
     1205    // sort the results so the most relevant (i.e. ERROR_IN_READING_FILE is more relevant than FILE_NOT_FOUND) results get placed at the end of the results list. 
     1206    std::sort(results.begin(), results.end()); 
     1207    ReaderWriter::ReadResult result = results.back(); 
     1208     
     1209    if (result.message().empty()) 
     1210    { 
     1211        switch(result.status()) 
     1212        { 
     1213            case(ReaderWriter::ReadResult::FILE_NOT_HANDLED): result.message() = "Warning: reading \""+readFunctor._filename+"\" not supported."; break; 
     1214            case(ReaderWriter::ReadResult::FILE_NOT_FOUND): result.message() = "Warning: could not find file \""+readFunctor._filename+"\"."; break; 
     1215            case(ReaderWriter::ReadResult::ERROR_IN_READING_FILE): result.message() = "Warning: Error in reading to \""+readFunctor._filename+"\"."; break; 
     1216            default: break; 
     1217        } 
     1218    } 
     1219 
     1220    return result; 
    12891221} 
    12901222 
     
    13931325    } 
    13941326 
    1395     if (results.front().message().empty()) 
    1396     { 
    1397         switch(results.front().status()) 
    1398         { 
    1399             case(ReaderWriter::WriteResult::FILE_NOT_HANDLED): results.front().message() = "Warning: Write to \""+fileName+"\" not supported."; break; 
    1400             case(ReaderWriter::WriteResult::ERROR_IN_WRITING_FILE): results.front().message() = "Warning: Error in writing to \""+fileName+"\"."; break; 
     1327    // sort the results so the most relevant (i.e. ERROR_IN_WRITING_FILE is more relevant than FILE_NOT_FOUND) results get placed at the end of the results list. 
     1328    std::sort(results.begin(), results.end()); 
     1329    ReaderWriter::WriteResult result = results.back(); 
     1330     
     1331    if (result.message().empty()) 
     1332    { 
     1333        switch(result.status()) 
     1334        { 
     1335            case(ReaderWriter::WriteResult::FILE_NOT_HANDLED): result.message() = "Warning: Write to \""+fileName+"\" not supported."; break; 
     1336            case(ReaderWriter::WriteResult::ERROR_IN_WRITING_FILE): result.message() = "Warning: Error in writing to \""+fileName+"\"."; break; 
    14011337            default: break; 
    14021338        } 
    14031339    } 
    14041340 
    1405     return results.front(); 
     1341    return result; 
    14061342} 
    14071343 
     
    14281364    } 
    14291365 
    1430     results.clear(); 
    1431  
    14321366    // now look for a plug-in to save the file. 
    14331367    std::string libraryName = createLibraryNameForFile(fileName); 
     
    14471381    } 
    14481382 
    1449     if (results.front().message().empty()) 
    1450     { 
    1451         switch(results.front().status()) 
    1452         { 
    1453             case(ReaderWriter::WriteResult::FILE_NOT_HANDLED): results.front().message() = "Warning: Write to \""+fileName+"\" not supported."; break; 
    1454             case(ReaderWriter::WriteResult::ERROR_IN_WRITING_FILE): results.front().message() = "Warning: Error in writing to \""+fileName+"\"."; break; 
     1383    // sort the results so the most relevant (i.e. ERROR_IN_WRITING_FILE is more relevant than FILE_NOT_FOUND) results get placed at the end of the results list. 
     1384    std::sort(results.begin(), results.end()); 
     1385    ReaderWriter::WriteResult result = results.back(); 
     1386     
     1387    if (result.message().empty()) 
     1388    { 
     1389        switch(result.status()) 
     1390        { 
     1391            case(ReaderWriter::WriteResult::FILE_NOT_HANDLED): result.message() = "Warning: Write to \""+fileName+"\" not supported."; break; 
     1392            case(ReaderWriter::WriteResult::ERROR_IN_WRITING_FILE): result.message() = "Warning: Error in writing to \""+fileName+"\"."; break; 
    14551393            default: break; 
    14561394        } 
    14571395    } 
    14581396 
    1459     return results.front(); 
     1397    return result; 
    14601398} 
    14611399 
     
    14811419    } 
    14821420 
    1483     results.clear(); 
    1484  
    14851421    // now look for a plug-in to save the file. 
    14861422    std::string libraryName = createLibraryNameForFile(fileName); 
     
    14991435        return ReaderWriter::WriteResult("Warning: Could not find plugin to write HeightField to file \""+fileName+"\"."); 
    15001436    } 
    1501  
    1502     if (results.front().message().empty()) 
    1503     { 
    1504         switch(results.front().status()) 
    1505         { 
    1506             case(ReaderWriter::WriteResult::FILE_NOT_HANDLED): results.front().message() = "Warning: Write to \""+fileName+"\" not supported."; break; 
    1507             case(ReaderWriter::WriteResult::ERROR_IN_WRITING_FILE): results.front().message() = "Warning: Error in writing to \""+fileName+"\"."; break; 
     1437     
     1438    // sort the results so the most relevant (i.e. ERROR_IN_WRITING_FILE is more relevant than FILE_NOT_FOUND) results get placed at the end of the results list. 
     1439    std::sort(results.begin(), results.end()); 
     1440    ReaderWriter::WriteResult result = results.back(); 
     1441     
     1442    if (result.message().empty()) 
     1443    { 
     1444        switch(result.status()) 
     1445        { 
     1446            case(ReaderWriter::WriteResult::FILE_NOT_HANDLED): result.message() = "Warning: Write to \""+fileName+"\" not supported."; break; 
     1447            case(ReaderWriter::WriteResult::ERROR_IN_WRITING_FILE): result.message() = "Warning: Error in writing to \""+fileName+"\"."; break; 
    15081448            default: break; 
    15091449        } 
    15101450    } 
    15111451 
    1512     return results.front(); 
     1452    return result; 
    15131453} 
    15141454 
     
    15461486    } 
    15471487 
    1548     results.clear(); 
    1549  
    15501488    // now look for a plug-in to save the file. 
    15511489    std::string libraryName = createLibraryNameForFile(fileName); 
    15521490 
    1553  
    15541491    if (loadLibrary(libraryName)==LOADED) 
    15551492    { 
     
    15681505    } 
    15691506 
    1570     if (results.front().message().empty()) 
    1571     { 
    1572         switch(results.front().status()) 
    1573         { 
    1574             case(ReaderWriter::WriteResult::FILE_NOT_HANDLED): results.front().message() = "Warning: Write to \""+fileName+"\" not supported."; break; 
    1575             case(ReaderWriter::WriteResult::ERROR_IN_WRITING_FILE): results.front().message() = "Warning: Error in writing to \""+fileName+"\"."; break; 
     1507    // sort the results so the most relevant (i.e. ERROR_IN_WRITING_FILE is more relevant than FILE_NOT_FOUND) results get placed at the end of the results list. 
     1508    std::sort(results.begin(), results.end()); 
     1509    ReaderWriter::WriteResult result = results.back(); 
     1510     
     1511    if (result.message().empty()) 
     1512    { 
     1513        switch(result.status()) 
     1514        { 
     1515            case(ReaderWriter::WriteResult::FILE_NOT_HANDLED): result.message() = "Warning: Write to \""+fileName+"\" not supported."; break; 
     1516            case(ReaderWriter::WriteResult::ERROR_IN_WRITING_FILE): result.message() = "Warning: Error in writing to \""+fileName+"\"."; break; 
    15761517            default: break; 
    15771518        } 
    15781519    } 
    15791520 
    1580     return results.front(); 
     1521    return result; 
    15811522} 
    15821523 
     
    16201561    } 
    16211562 
    1622     if (results.front().message().empty()) 
    1623     { 
    1624         switch(results.front().status()) 
    1625         { 
    1626             case(ReaderWriter::WriteResult::FILE_NOT_HANDLED): results.front().message() = "Warning: Write to \""+fileName+"\" not supported."; break; 
    1627             case(ReaderWriter::WriteResult::ERROR_IN_WRITING_FILE): results.front().message() = "Warning: Error in writing to \""+fileName+"\"."; break; 
     1563    // sort the results so the most relevant (i.e. ERROR_IN_WRITING_FILE is more relevant than FILE_NOT_FOUND) results get placed at the end of the results list. 
     1564    std::sort(results.begin(), results.end()); 
     1565    ReaderWriter::WriteResult result = results.back(); 
     1566     
     1567    if (result.message().empty()) 
     1568    { 
     1569        switch(result.status()) 
     1570        { 
     1571            case(ReaderWriter::WriteResult::FILE_NOT_HANDLED): result.message() = "Warning: Write to \""+fileName+"\" not supported."; break; 
     1572            case(ReaderWriter::WriteResult::ERROR_IN_WRITING_FILE): result.message() = "Warning: Error in writing to \""+fileName+"\"."; break; 
    16281573            default: break; 
    16291574        } 
    16301575    } 
    16311576 
    1632     return results.front(); 
     1577    return result; 
    16331578} 
    16341579