├── README.md ├── src └── ossimPlanet │ ├── ossimPlanetTerrainLayer.cpp │ ├── ossimPlanetId.cpp │ ├── ossimPlanetIdManager.cpp │ ├── ossimPlanetShaderProgramSetup.cpp │ ├── ossimPlanetIoRoutableMessageHandler.cpp │ ├── ossimPlanetThreadImp.cpp │ ├── ossimPlanetNodeFactory.cpp │ ├── ossimPlanetArchiveMapping.cpp │ ├── ossimPlanetActionReceiver.cpp │ ├── ossimPlanetVideoLayer.cpp │ ├── ossimPlanetOssimImage.cpp │ ├── ossimPlanetKmlLayerNode.cpp │ ├── ossimPlanetLookAt.cpp │ ├── ossimPlanetAction.cpp │ ├── ossimPlanetElevationFactory.cpp │ ├── ossimPlanetBoundingBox.cpp │ ├── ossimPlanetLayerFactory.cpp │ ├── netMessage.cpp │ ├── ossimPlanetThread.cpp │ ├── ossimPlanetElevationRegistry.cpp │ ├── netBuffer.cpp │ ├── iochannel.cpp │ ├── ossimPlanetNodeRegistry.cpp │ ├── ulError.cpp │ ├── ossimPlanetThreadPool.cpp │ ├── ossimPlanetTexture2D.cpp │ ├── ossimPlanetLayerRegistry.cpp │ ├── ossimPlanetGeocoder.cpp │ ├── ossimPlanetVisitors.cpp │ ├── ossimPlanetPlaneGrid.cpp │ ├── ulClock.cpp │ ├── ulList.cpp │ ├── ossimPlanetDestinationCommandAction.cpp │ ├── ossimPlanetElevationDatabase.cpp │ └── ossimPlanetTextureLayerRegistry.cpp ├── include └── ossimPlanet │ ├── ossimPlanetSetup.h │ ├── net.h │ ├── ossimPlanetLandNormalType.h │ ├── ossimPlanetIdManager.h │ ├── ossimPlanetRefBlock.h │ ├── ossimPlanetKmlReaderWriter.h │ ├── ossimPlanetElevationFactory.h │ ├── ossimPlanetLayerFactoryBase.h │ ├── iowin32.h │ ├── ossimPlanetIoRoutableMessageHandler.h │ ├── ossimPlanetNodeFactory.h │ ├── ossimPlanetInputDevice.h │ ├── ossimPlanetNodeFactoryBase.h │ ├── ossimPlanetLayerFactory.h │ ├── ossimPlanetOssimImage.h │ ├── ossimPlanetKmlNetworkLinkNode.h │ ├── ossimPlanetPagedLandLodRefreshType.h │ ├── ossimPlanetIntersectUserData.h │ ├── ossimPlanetJpegImage.h │ ├── ossimPlanetTextureLayerFactory.h │ ├── ossimPlanetLandTreeNode.h │ ├── ossimPlanetArchiveMapping.h │ ├── ossimPlanetServerMessageHandler.h │ ├── ossimPlanetYahooGeocoder.h │ ├── ossimPlanetIoMessageHandler.h │ ├── ossimPlanetThreadImp.h │ ├── ossimPlanetThreadPool.h │ ├── ossimPlanetThread.h │ ├── ossimPlanetOrthoFlatLandNode.h │ ├── ossimPlanetActionReceiver.h │ ├── ossimPlanetArchive.h │ ├── ossimPlanetNodeRegistry.h │ ├── ossimPlanetPlaneGrid.h │ ├── ossimPlanetUtility.h │ ├── ossimPlanetElevationRegistry.h │ ├── ossimPlanetNetworkConnection.h │ ├── ossimPlanetTexture2D.h │ ├── ossimPlanetLayerRegistry.h │ ├── ossimPlanetCubeGrid.h │ ├── ossimPlanetKmlLayerNode.h │ ├── ulLocal.h │ ├── ossimPlanetLayer.h │ ├── ossimPlanetStandardTextureLayerFactory.h │ ├── ossimPlanetSceneView.h │ ├── ossimPlanetElevationGrid.h │ ├── ossimPlanetKmlScreenOverlayNode.h │ ├── ossimPlanetMessage.h │ ├── ossimPlanetIconGeom.h │ ├── ossimPlanetTextureLayerRegistry.h │ ├── ossimPlanetId.h │ ├── ossimPlanetVideoLayer.h │ ├── ossimPlanetPagedRequestNode.h │ ├── ossimPlanetLandCullCallback.h │ ├── ossimPlanetExport.h │ ├── ossimPlanetElevationDatabase.h │ ├── ossimPlanetVideoLayerNode.h │ ├── ossimPlanetShaderProgramSetup.h │ ├── ossimPlanetSocketNetworkConnection.h │ ├── ossimPlanetDatabasePager.h │ ├── ossimPlanetGeocoder.h │ ├── ossimPlanetTerrainTileId.h │ ├── ossimPlanetXmlAction.h │ ├── ossimPlanetDestinationCommandAction.h │ ├── ioapi.h │ ├── ossimPlanetAnnotationLayer.h │ ├── ossimPlanetFadeText.h │ ├── ossimPlanetLabelGeom.h │ ├── ossimPlanetElevationDatabaseGroup.h │ ├── netChat.h │ ├── ossimPlanetKmlPlacemarkNode.h │ ├── ossimPlanetAnimatedPointModel.h │ ├── ossimPlanetLatLonHud.h │ ├── ossimPlanetBillboardIcon.h │ ├── ossimPlanetServerThread.h │ ├── ossimPlanetOssimElevationDatabase.h │ ├── netMonitor.h │ ├── ossimPlanetReentrantMutex.h │ ├── sg_file.h │ ├── ossimPlanetIoThread.h │ ├── ossimPlanetCompass.h │ ├── ossimPlanetCallback.h │ └── ossimPlanetSrtmElevationDatabase.h ├── examples ├── ossimplanetviewer │ ├── opvLoadModel.h │ ├── readme.txt │ └── archive_manager.kwl └── ossimplanetinfo │ └── ossimplanetinfo.cpp ├── README.txt ├── LICENSE ├── binds.act └── schema └── AnimationPath.xsd /README.md: -------------------------------------------------------------------------------- 1 | # ossim-planet 2 | Contains C++ library code for 3D visualization of imagery 3 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetTerrainLayer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetId.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | ossim_int64 ossimPlanetId::theInvalidId = -1; 4 | 5 | ossim_int64 ossimPlanetId::invalidId() 6 | { 7 | return theInvalidId; 8 | } 9 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetSetup.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetSetup_HEADER 2 | #define ossimPlanetSetup_HEADER 3 | 4 | // Comment this out if you want to build without ephemeris support 5 | // On by default 6 | #define OSSIMPLANET_HAS_LIBZ 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /examples/ossimplanetviewer/opvLoadModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // opvLoadModel.h 3 | // 4 | // osgPlanetView load model functionality 5 | // 6 | 7 | osg::ref_ptr createCityModel(const ossimFilename& file, 8 | ossimPlanetLandType landType, int utmZone, int utmX, int utmY); 9 | 10 | -------------------------------------------------------------------------------- /include/ossimPlanet/net.h: -------------------------------------------------------------------------------- 1 | #ifndef __PLIB_NET_H__ 2 | #define __PLIB_NET_H__ 1 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /examples/ossimplanetviewer/readme.txt: -------------------------------------------------------------------------------- 1 | The osgplanetviewer now only accepts a keywordlist. See archive_manager.kwl for the sample format. You will have to modify the cache_dir. See the comments in archive_manager.kwl 2 | 3 | example: 4 | 5 | osgplanetviewer archive_manager.kwl 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetLandNormalType.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetLandNormalType_HEADER 2 | #define ossimPlanetLandNormalType_HEADER 3 | 4 | enum ossimPlanetLandNormalType 5 | { 6 | ossimPlanetLandNormalType_ELLIPSOIDAL = 0, 7 | ossimPlanetLandNormalType_FLAT = 0 8 | }; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | 2 | PACKAGES required: 3 | 4 | 1. OSSIM, found at ossim.org. This is the core geospatial image and corrdinate processing ngine used by ossimPlanet 5 | 6 | 2. libwms. Used for WMS access. This uses libcurl for the http protocol. 7 | 8 | 3. OpenSceneGraph. Found at http://www.openscenegraph.org. This is used for the 3-D visualization. 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetIdManager.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | ossimPlanetId ossimPlanetIdManager::theCurrentId = 0; 5 | std::recursive_mutex ossimPlanetIdManager::theMutex; 6 | 7 | ossimPlanetId ossimPlanetIdManager::nextId() 8 | { 9 | std::lock_guard lock(theMutex); 10 | 11 | return ++theCurrentId; 12 | } 13 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetIdManager.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetIdManager_HEADER 2 | #define ossimPlanetIdManager_HEADER 3 | #include "ossimPlanetId.h" 4 | #include "ossimPlanetExport.h" 5 | #include 6 | 7 | class OSSIMPLANET_DLL ossimPlanetIdManager 8 | { 9 | public: 10 | static ossimPlanetId nextId(); 11 | 12 | protected: 13 | static ossimPlanetId theCurrentId; 14 | static std::recursive_mutex theMutex; 15 | }; 16 | #endif 17 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetRefBlock.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetRefBlock_HEADER 2 | #define ossimPlanetRefBlock_HEADER 3 | #include 4 | #include 5 | #include "ossimPlanetExport.h" 6 | 7 | class OSSIMPLANET_DLL ossimPlanetRefBlock : virtual public osg::Referenced, 8 | public OpenThreads::Block 9 | { 10 | public: 11 | ossimPlanetRefBlock() 12 | {} 13 | }; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetKmlReaderWriter.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetKmlReaderWriter_HEADER 2 | #define ossimPlanetKmlReaderWriter_HEADER 3 | #include 4 | 5 | class ossimPlanetKmlReaderWriter : : public osgDB::ReaderWriter 6 | { 7 | public: 8 | ossimPlanetKmlReaderWriter(); 9 | 10 | virtual ReadResult readNode(const std::string& /*fileName*/, const Options* =NULL) const; 11 | 12 | protected: 13 | 14 | }; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetShaderProgramSetup.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | osg::ref_ptr ossimPlanetShaderProgramSetup::getUniform(const ossimString& name) 4 | { 5 | ossim_uint32 idx = 0; 6 | 7 | for(idx = 0; idx < theUniformList.size(); ++idx) 8 | { 9 | if(theUniformList[idx]->getName() == name.string()) 10 | { 11 | return theUniformList[idx].get(); 12 | } 13 | } 14 | 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetElevationFactory.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetElevationFactory_HEADER 2 | #define ossimPlanetElevationFactory_HEADER 3 | #include 4 | class ossimPlanetElevationFactory : public ossimPlanetElevationRegistry::FactoryBase 5 | { 6 | public: 7 | ossimPlanetElevationFactory(); 8 | virtual ossimPlanetElevationDatabase* openDatabase(const ossimString& location); 9 | static ossimPlanetElevationFactory* instance(); 10 | }; 11 | 12 | #endif -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetLayerFactoryBase.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetLayerFactoryBase_HEADER 2 | #define ossimPlanetLayerFactoryBase_HEADER 3 | #include 4 | #include 5 | #include 6 | class ossimPlanetLayer; 7 | class OSSIMPLANET_DLL ossimPlanetLayerFactoryBase : public osg::Referenced 8 | { 9 | public: 10 | ossimPlanetLayerFactoryBase(){} 11 | 12 | virtual ossimPlanetLayer* create(const ossimString& type)const=0; 13 | }; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /include/ossimPlanet/iowin32.h: -------------------------------------------------------------------------------- 1 | /* iowin32.h -- IO base function header for compress/uncompress .zip 2 | files using zlib + zip or unzip API 3 | This IO API version uses the Win32 API (for Microsoft Windows) 4 | 5 | Version 1.01e, February 12th, 2005 6 | 7 | Copyright (C) 1998-2005 Gilles Vollant 8 | */ 9 | 10 | #include 11 | 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetIoRoutableMessageHandler.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetIoRoutableMessageHandler_HEADER 2 | #define ossimPlanetIoRoutableMessageHandler_HEADER 3 | #include 4 | 5 | class ossimPlanetIoRoutableMessageHandler : public ossimPlanetIoMessageHandler 6 | { 7 | public: 8 | ossimPlanetIoRoutableMessageHandler() 9 | { 10 | theName = "Routable Message Handler"; 11 | } 12 | virtual bool handleMessage(osg::ref_ptr message); 13 | }; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetNodeFactory.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetNodeFactory_HEADER 2 | #define ossimPlanetNodeFactory_HEADER 3 | #include "ossimPlanetNodeFactoryBase.h" 4 | 5 | class OSSIMPLANET_DLL ossimPlanetNodeFactory : public ossimPlanetNodeFactoryBase 6 | { 7 | public: 8 | ossimPlanetNodeFactory(); 9 | virtual ~ossimPlanetNodeFactory(); 10 | static ossimPlanetNodeFactory* instance(); 11 | virtual ossimPlanetNode* create(const ossimString& type)const; 12 | 13 | protected: 14 | static ossimPlanetNodeFactory* theInstance; 15 | }; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetInputDevice.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetInputDevice_HEADER 2 | #define ossimPlanetInputDevice_HEADER 3 | 4 | #include 5 | #include 6 | // device driver interface for user input devices 7 | 8 | class OSSIMPLANET_DLL ossimPlanetInputDevice :public osg::Referenced 9 | { 10 | public: 11 | ossimPlanetInputDevice() {} 12 | virtual ~ossimPlanetInputDevice() {} 13 | 14 | virtual void processInput() = 0; 15 | // update interaction valuators and execute actions 16 | 17 | }; 18 | 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetNodeFactoryBase.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetNodeFactoryBase_HEADER 2 | #define ossimPlanetNodeFactoryBase_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | class ossimPlanetNode; 8 | class OSSIMPLANET_DLL ossimPlanetNodeFactoryBase : public osg::Referenced 9 | { 10 | public: 11 | ossimPlanetNodeFactoryBase(){} 12 | virtual ~ossimPlanetNodeFactoryBase() 13 | { 14 | } 15 | virtual ossimPlanetNode* create(const ossimString& type)const=0; 16 | }; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetLayerFactory.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetLayerFactory_HEADER 2 | #define ossimPlanetLayerFactory_HEADER 3 | #include "ossimPlanetLayerFactoryBase.h" 4 | #include 5 | 6 | class ossimPlanetLayerFactory : public ossimPlanetLayerFactoryBase 7 | { 8 | public: 9 | ossimPlanetLayerFactory(); 10 | virtual ~ossimPlanetLayerFactory(); 11 | 12 | static ossimPlanetLayerFactory* instance(); 13 | 14 | virtual ossimPlanetLayer* create(const ossimString& type)const; 15 | protected: 16 | static ossimPlanetLayerFactory* theInstance; 17 | 18 | }; 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetOssimImage.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetOssimImage_HEADER 2 | #define ossimPlanetOssimImage_HEADER 3 | #include 4 | #include "ossimPlanetExport.h" 5 | #include 6 | #include 7 | 8 | class ossimPlanetImage; 9 | class OSSIMPLANET_DLL ossimPlanetOssimImage : public osg::Referenced 10 | { 11 | public: 12 | ossimPlanetOssimImage(); 13 | virtual ~ossimPlanetOssimImage(); 14 | bool loadFile(const std::string& inputFile, 15 | ossimPlanetImage& image); 16 | 17 | protected: 18 | ossimRefPtr theHandler; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetKmlNetworkLinkNode.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetKmlNetworkLinkNode_HEADER 2 | #define ossimPlanetKmlNetworkLinkNode_HEADER 3 | #include 4 | 5 | class OSSIMPLANET_DLL ossimPlanetKmlNetworkLinkNode : public ossimPlanetKmlLayerNode 6 | { 7 | public: 8 | ossimPlanetKmlNetworkLinkNode(ossimPlanetKmlLayer* layer = 0, 9 | ossimPlanetKmlObject* obj = 0); 10 | virtual void traverse(osg::NodeVisitor& nv); 11 | virtual bool init(); 12 | 13 | protected: 14 | osg::ref_ptr theKmlData; 15 | bool theScheduledFlag; 16 | 17 | }; 18 | #endif 19 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetPagedLandLodRefreshType.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetPagedLandLodRefreshType_HEADER 2 | #define ossimPlanetPagedLandLodRefreshType_HEADER 3 | 4 | // Been moved to ossimPlanetConstants.h 5 | // This file is deprecated 6 | #error File header depcricated, plaese use ossimPlanet/ossimPlanetConstants.h 7 | 8 | /* enum ossimPlanetPagedLandLodRefreshType */ 9 | /* { */ 10 | /* ossimPlanetPagedLandLodRefreshType_NONE = 0, */ 11 | /* ossimPlanetPagedLandLodRefreshType_TEXTURE = 1, */ 12 | /* ossimPlanetPagedLandLodRefreshType_GEOM = 2, */ 13 | /* ossimPlanetPagedLandLodRefreshType_PRUNE = 3, */ 14 | /* }; */ 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetIoRoutableMessageHandler.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | bool ossimPlanetIoRoutableMessageHandler::handleMessage(osg::ref_ptr message) 6 | { 7 | bool result = false; 8 | if(!enableFlag()) return result; 9 | if(!message->data().empty()) 10 | { 11 | if(*(message->data().begin()) == ':') 12 | { 13 | result = true; 14 | ossimPlanetDestinationCommandAction(std::string(message->data().begin(), 15 | message->data().end())).execute(); 16 | } 17 | } 18 | 19 | return result; 20 | } 21 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetThreadImp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | ossimPlanetThreadImp::~ossimPlanetThreadImp() 4 | { 5 | 6 | } 7 | 8 | int ossimPlanetThreadImp::cancel() 9 | { 10 | setDoneFlag(true); 11 | updateThreadBlock(); 12 | return 0; 13 | } 14 | 15 | void ossimPlanetThreadImp::setDoneFlag(bool flag) 16 | { 17 | std::lock_guard lock(theImpMutex); 18 | theDoneFlag = flag; 19 | } 20 | 21 | bool ossimPlanetThreadImp::doneFlag()const 22 | { 23 | std::lock_guard lock(theImpMutex); 24 | return theDoneFlag; 25 | } 26 | 27 | void ossimPlanetThreadImp::threadPooled() 28 | { 29 | } 30 | 31 | void ossimPlanetThreadImp::updateThreadBlock() 32 | { 33 | } 34 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetIntersectUserData.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetIntersectUserData_HEADER 2 | #define ossimPlanetIntersectUserData_HEADER 3 | #include 4 | #include 5 | 6 | class OSSIMPLANET_DLL ossimPlanetIntersectUserData : public osg::Referenced 7 | { 8 | public: 9 | ossimPlanetIntersectUserData(int maxLevel=9999999) 10 | :theMaxLevelToIntersect(maxLevel) 11 | { 12 | } 13 | 14 | void setMaxLevelToIntersect(int maxLevel) 15 | { 16 | theMaxLevelToIntersect = maxLevel; 17 | } 18 | int getMaxLevelToIntersect()const 19 | { 20 | return theMaxLevelToIntersect; 21 | } 22 | protected: 23 | virtual ~ossimPlanetIntersectUserData(){} 24 | 25 | int theMaxLevelToIntersect; 26 | }; 27 | #endif 28 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetJpegImage.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetJpegImage_HEADER 2 | #define ossimPlanetJpegImage_HEADER 3 | #include 4 | #include "ossimPlanetExport.h" 5 | 6 | class ossimPlanetImage; 7 | class OSSIMPLANET_DLL ossimPlanetJpegImage 8 | { 9 | public: 10 | ossimPlanetJpegImage(); 11 | virtual ~ossimPlanetJpegImage(); 12 | bool loadFile(std::string& inputFile, 13 | ossimPlanetImage& image); 14 | bool saveFile(std::string& outputFile, 15 | ossimPlanetImage& image); 16 | 17 | bool loadFile(std::istream& inputStream, 18 | ossimPlanetImage& image); 19 | bool saveFile( std::ostream& stream, 20 | ossimPlanetImage &image, 21 | bool verbose=false); 22 | }; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetTextureLayerFactory.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetTextureLayerFactory_HEADER 2 | #define ossimPlanetTextureLayerFactory_HEADER 3 | #include 4 | #include 5 | #include 6 | 7 | class OSSIMPLANET_DLL ossimPlanetTextureLayerFactory : public osg::Referenced 8 | { 9 | public: 10 | virtual osg::ref_ptr createLayer(const ossimString& name, bool openAllEntriesFlag=true)const=0; 11 | 12 | protected: 13 | ossimPlanetTextureLayerFactory(){} 14 | ossimPlanetTextureLayerFactory(const ossimPlanetTextureLayerFactory&):osg::Referenced(){} 15 | const ossimPlanetTextureLayerFactory& operator = (const ossimPlanetTextureLayerFactory& /*src*/){return *this;} 16 | 17 | }; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetLandTreeNode.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetLandTreeNode_HEADER 2 | #define ossimPlanetLandTreeNode_HEADER 3 | #include 4 | 5 | class ossimPlanetLandTreeNode : public osg::Node 6 | { 7 | public: 8 | ossimPlanetLandTreeNode(ossim_uint32 level, 9 | ossim_uint64 row, 10 | ossim_uint64 col); 11 | 12 | protected: 13 | ossim_uint32 theLevel; 14 | ossim_uint32 theRow; 15 | ossim_uint32 theCol; 16 | ossimPlanetLandTreeNode* theParent; 17 | ossimPlanetLandTreeNode* theRightNeighbor; 18 | ossimPlanetLandTreeNode* theLeftNeighbor; 19 | ossimPlanetLandTreeNode* theTopNeighbor; 20 | ossimPlanetLandTreeNode* theBottomNeighbor; 21 | ossimRefPtr theChildren[4]; 22 | 23 | 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetNodeFactory.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | ossimPlanetNodeFactory* ossimPlanetNodeFactory::theInstance = 0; 5 | 6 | ossimPlanetNodeFactory::ossimPlanetNodeFactory() 7 | { 8 | theInstance = this; 9 | } 10 | 11 | ossimPlanetNodeFactory::~ossimPlanetNodeFactory() 12 | { 13 | theInstance = 0; 14 | } 15 | 16 | 17 | ossimPlanetNodeFactory* ossimPlanetNodeFactory::instance() 18 | { 19 | if(!theInstance) 20 | { 21 | theInstance = new ossimPlanetNodeFactory; 22 | } 23 | 24 | return theInstance; 25 | } 26 | 27 | ossimPlanetNode* ossimPlanetNodeFactory::create(const ossimString& type)const 28 | { 29 | if(type == "Placemark") 30 | { 31 | return new ossimPlanetAnnotationPlacemark; 32 | } 33 | return 0; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetArchiveMapping.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetArchiveMapping_HEADER 2 | #define ossimPlanetArchiveMapping_HEADER 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | class OSSIMPLANET_DLL ossimPlanetArchiveMapping 11 | { 12 | private: 13 | ossimFilename src; 14 | ossimFilename dest; 15 | 16 | public: 17 | ossimPlanetArchiveMapping(); 18 | ossimPlanetArchiveMapping(const ossimFilename &source, const ossimFilename &destination); 19 | ~ossimPlanetArchiveMapping(); 20 | 21 | ossimFilename getSource(); 22 | void setSource(const ossimFilename &source); 23 | 24 | ossimFilename getDestination(); 25 | void setDestination(const ossimFilename &destination); 26 | }; 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetServerMessageHandler.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetServerMessageHandler_HEADER 2 | #define ossimPlanetServerMessageHandler_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class ossimPlanetServerMessageHandler : public osg::Referenced 9 | { 10 | public: 11 | ossimPlanetServerMessageHandler() 12 | :theEnableFlag(true) 13 | { 14 | } 15 | virtual bool handleMessage(const ossimString& message, 16 | osg::ref_ptr iochannel)=0; 17 | void setEnableFlag(bool flag) 18 | { 19 | theEnableFlag = flag; 20 | } 21 | bool getEnableFalg()const 22 | { 23 | return theEnableFlag; 24 | } 25 | 26 | protected: 27 | bool theEnableFlag; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetYahooGeocoder.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetYahooGeocoder_HEADER 2 | #define ossimPlanetYahooGeocoder_HEADER 3 | #include 4 | #include 5 | 6 | class OSSIMPLANET_DLL ossimPlanetYahooGeocoder : public ossimPlanetGoecoder 7 | { 8 | public: 9 | ossimPlanetYahooGeocoder(const ossimString url = "http://api.local.yahoo.com/MapsService/V1/geocode?", 10 | const ossimString yahooAppId = "YahooDemo") 11 | :theUrl(url), 12 | theAppId(yahooAppId) 13 | { 14 | } 15 | virtual void getLocationFromAddress(std::vector >& result, 16 | const ossimString& location)const; 17 | 18 | protected: 19 | ossimString theUrl; 20 | ossimString theAppId; 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetArchiveMapping.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | ossimPlanetArchiveMapping::ossimPlanetArchiveMapping() 5 | { 6 | } 7 | 8 | ossimPlanetArchiveMapping::ossimPlanetArchiveMapping(const ossimFilename &source, const ossimFilename &destination) 9 | { 10 | src = source; 11 | dest = destination; 12 | } 13 | 14 | ossimPlanetArchiveMapping::~ossimPlanetArchiveMapping() 15 | { 16 | } 17 | 18 | ossimFilename ossimPlanetArchiveMapping::getSource() 19 | { 20 | return src; 21 | } 22 | 23 | void ossimPlanetArchiveMapping::setSource(const ossimFilename &source) 24 | { 25 | src = source; 26 | } 27 | 28 | ossimFilename ossimPlanetArchiveMapping::getDestination() 29 | { 30 | return dest; 31 | } 32 | 33 | void ossimPlanetArchiveMapping::setDestination(const ossimFilename &destination) 34 | { 35 | dest = destination; 36 | } 37 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetIoMessageHandler.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetIoMessageHandler_HEADER 2 | #define ossimPlanetIoMessageHandler_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class ossimPlanetIoMessageHandler : public osg::Referenced 10 | { 11 | public: 12 | ossimPlanetIoMessageHandler() 13 | :theName(""), 14 | theEnableFlag(true) 15 | {} 16 | virtual bool handleMessage(osg::ref_ptr message)=0; 17 | void setEnableFlag(bool flag) 18 | { 19 | theEnableFlag = flag; 20 | } 21 | bool enableFlag()const 22 | { 23 | return theEnableFlag; 24 | } 25 | 26 | void setName(const ossimString& name) 27 | { 28 | theName = name; 29 | } 30 | const ossimString& name()const 31 | { 32 | return theName; 33 | } 34 | protected: 35 | ossimString theName; 36 | bool theEnableFlag; 37 | }; 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetThreadImp.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetThreadImp_HEADER 2 | #define ossimPlanetThreadImp_HEADER 3 | #include 4 | #include 5 | #include "ossimPlanetExport.h" 6 | #include "ossimPlanetRefBlock.h" 7 | #include 8 | 9 | class ossimPlanetThread; 10 | class OSSIMPLANET_DLL ossimPlanetThreadImp 11 | { 12 | public: 13 | ossimPlanetThreadImp() 14 | :theThread(0), 15 | theDoneFlag(false) 16 | { 17 | } 18 | virtual ~ossimPlanetThreadImp(); 19 | virtual void setThread(ossimPlanetThread* thread) 20 | { 21 | theThread = thread; 22 | } 23 | ossimPlanetThread* thread() 24 | { 25 | return theThread; 26 | } 27 | virtual void run()=0; 28 | virtual int cancel(); 29 | virtual void threadPooled(); 30 | virtual void setDoneFlag(bool flag); 31 | virtual bool doneFlag()const; 32 | virtual void updateThreadBlock(); 33 | protected: 34 | mutable std::recursive_mutex theImpMutex; 35 | ossimPlanetThread* theThread; 36 | bool theDoneFlag; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetThreadPool.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetThreadPool_HEADER 2 | #define ossimPlanetThreadPool_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "ossimPlanetExport.h" 8 | #include 9 | 10 | class ossimPlanetThread; 11 | 12 | class OSSIMPLANET_DLL ossimPlanetThreadPool : public osg::Referenced 13 | { 14 | public: 15 | static osg::ref_ptr instance(); 16 | void makeAvailable(osg::ref_ptr thread); 17 | osg::ref_ptr nextAvailable(); 18 | static void setMaxThread(int maxThreads); 19 | 20 | protected: 21 | ossimPlanetThreadPool(); 22 | 23 | unsigned int totalThreads()const; 24 | std::vector > theAvailableList; 25 | std::vector > theUnavailableList; 26 | mutable std::recursive_mutex theListMutex; 27 | static unsigned int theMaxThreads; 28 | static osg::ref_ptr theInstance; 29 | 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetThread.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetThread_HEADER 2 | #define ossimPlanetThread_HEADER 3 | #include 4 | #include 5 | #include 6 | #include "ossimPlanetThreadImp.h" 7 | #include "ossimPlanetExport.h" 8 | #include 9 | 10 | class ossimPlanetThreadPool; 11 | class OSSIMPLANET_DLL ossimPlanetThread : public osg::Referenced, 12 | public OpenThreads::Thread 13 | { 14 | public: 15 | ossimPlanetThread(); 16 | virtual void run(); 17 | virtual int cancel(); 18 | virtual void updateThreadBlock(); 19 | void setImplementation(ossimPlanetThreadImp* implementation); 20 | void setThreadPool(ossimPlanetThreadPool* threadPool); 21 | ossimPlanetThreadImp* implementation(); 22 | const ossimPlanetThreadImp* implementation()const; 23 | void setRetainThreadFlag(bool flag); 24 | protected: 25 | ossimPlanetThreadImp* theImplementation; 26 | ossimPlanetThreadPool* theThreadPool; 27 | bool theRetainThreadFlag; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetActionReceiver.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | ossimPlanetActionReceiver::~ossimPlanetActionReceiver() 5 | { 6 | if (pathname_ != ":") 7 | ossimPlanetActionRouter::instance()->unregisterReceiver(this); 8 | } 9 | 10 | std::string ossimPlanetActionReceiver::name() const 11 | { 12 | return pathname_.substr(pathname_.rfind(':')+1, pathname_.length()); 13 | } 14 | 15 | void ossimPlanetActionReceiver::setPathname(const std::string& newPath) 16 | { 17 | pathname_ = newPath; 18 | } 19 | 20 | void ossimPlanetActionReceiver::setPathnameAndRegister(const std::string& newPath) 21 | { 22 | // we will unregister if already registered 23 | // 24 | ossimPlanetActionReceiver* r = ossimPlanetActionRouter::instance()->receiver(pathname()); 25 | if(r==this) // if we are ourselves then we can change our pathname 26 | { 27 | ossimPlanetActionRouter::instance()->unregisterReceiver(this); 28 | } 29 | setPathname(newPath); 30 | ossimPlanetActionRouter::instance()->registerReceiver(this); 31 | } 32 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetOrthoFlatLandNode.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetOrthoFlatLandNode_HEADER 2 | #define ossimPlanetOrthoFlatLandNode_HEADER 3 | #include "ossimPlanetFlatLandNode.h" 4 | #include 5 | 6 | class OSSIMPLANET_DLL ossimPlanetOrthoFlatLandNode : public ossimPlanetFlatLandNode 7 | { 8 | public: 9 | ossimPlanetOrthoFlatLandNode(ossim_uint32 level = 0, 10 | ossim_uint32 row = 0, 11 | ossim_uint32 col = 0); 12 | ossimPlanetOrthoFlatLandNode(const ossimPlanetFlatLandNode& plod,const osg::CopyOp& copyop); 13 | virtual ~ossimPlanetOrthoFlatLandNode(); 14 | virtual osg::Object* cloneType() const { return new ossimPlanetOrthoFlatLandNode(); } 15 | virtual bool isSameKindAs(const osg::Object* obj) const 16 | { 17 | return dynamic_cast(obj)!=NULL; 18 | } 19 | virtual const char* className() const { return "OrthoFlatLandNode"; } 20 | virtual const char* libraryName() const { return ""; } 21 | virtual void handleCullTraversal(osg::NodeVisitor& nv); 22 | 23 | 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetActionReceiver.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetActionReciever_HEADER 2 | #define ossimPlanetActionReciever_HEADER 3 | 4 | // abstract superclass for objects that can receive Actions. 5 | 6 | /* #include */ 7 | #include 8 | #include "ossimPlanetAction.h" 9 | #include 10 | 11 | class OSSIMPLANET_DLL ossimPlanetActionReceiver { 12 | public: 13 | virtual ~ossimPlanetActionReceiver(); 14 | 15 | std::string name() const; 16 | // this receiver's name, the last name in its pathname 17 | 18 | const std::string& pathname() const 19 | // this receiver's full name 20 | { return pathname_; } 21 | 22 | void setPathname(const std::string& newPath); 23 | 24 | void setPathnameAndRegister(const std::string& newPath); 25 | // call setPathname() and register *this with ActionRouter 26 | // assert(newPath[0] == ':') 27 | 28 | virtual void execute(const ossimPlanetAction& a) = 0; 29 | // execute the given action 30 | 31 | protected: 32 | 33 | std::string pathname_; 34 | // this receiver's full name 35 | }; 36 | 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetArchive.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ossimPlanetArchive_HEADER 3 | #define ossimPlanetArchive_HEADER 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | class OSSIMPLANET_DLL ossimPlanetArchive : public osg::Referenced 13 | { 14 | private: 15 | bool useArchiveMapping; 16 | std::vector mappingList; 17 | mutable std::recursive_mutex theArchiveMutex; 18 | 19 | public: 20 | ossimPlanetArchive(); 21 | protected: 22 | ~ossimPlanetArchive(); 23 | 24 | public: 25 | void addMapping(ossimPlanetArchiveMapping &mapping); 26 | void removeMapping(ossimPlanetArchiveMapping &mapping); 27 | ossimFilename matchPath(const ossimFilename &filename); 28 | ossimFilename convertToDirectory(ossimFilename &filename); 29 | void setArchiveMappingEnabledFlag(bool enabled = false); 30 | bool archiveMappingEnabled(); 31 | std::vector getMappingList(); 32 | }; 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetNodeRegistry.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetNodeRegistry_HEADER 2 | #define ossimPlanetNodeRegistry_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class ossimPlanetNodeRegistry 9 | { 10 | public: 11 | typedef std::vector > FactoryListType; 12 | ossimPlanetNodeRegistry(); 13 | ~ossimPlanetNodeRegistry(); 14 | static ossimPlanetNodeRegistry* instance(); 15 | void finalize(); 16 | ossimPlanetNode* create(const ossimString& type)const; 17 | void registerFactory(ossimPlanetNodeFactoryBase* factory, 18 | bool insertFrontFlag=false); 19 | void unregisterFactory(const ossimPlanetNodeFactoryBase* factory); 20 | 21 | protected: 22 | bool hasFactory(const ossimPlanetNodeFactoryBase* factory)const; 23 | 24 | static ossimPlanetNodeRegistry* theInstance; 25 | static ossim_uint32 theInitializeCount; 26 | mutable OpenThreads::ReadWriteMutex theFactoryListMutex; 27 | FactoryListType theFactoryList; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetPlaneGrid.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetPlaneGrid_HEADER 2 | #define ossimPlanetPlaneGrid_HEADER 3 | #include 4 | 5 | class OSSIMPLANET_DLL ossimPlanetPlaneGrid : public ossimPlanetGridUtility 6 | { 7 | public: 8 | ossimPlanetPlaneGrid(ossim_uint32 tileWidth = 256, 9 | ossim_uint32 tileHeight = 256) 10 | :ossimPlanetGridUtility(tileWidth, tileHeight) 11 | { 12 | } 13 | virtual ossim_uint32 getNumberOfFaces()const; 14 | virtual void getPixelScale(double& dx, 15 | double& dy, 16 | ossimUnitType& pixelScaleUnits, 17 | ossim_uint32 level, 18 | ossim_uint64 row, 19 | ossim_uint64 col)const; 20 | 21 | virtual void getGridPoint(ossimPlanetGridUtility::GridPoint& gridPoint, 22 | const osg::Vec3d& latLon)const; 23 | 24 | virtual void getLatLon(osg::Vec3d& latLon, 25 | const ossimPlanetGridUtility::GridPoint& gridPoint)const; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetUtility.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetUtility_HEADER 2 | #define ossimPlanetUtility_HEADER 3 | #include 4 | #include 5 | #include "ossimPlanetExport.h" 6 | 7 | class OSSIMPLANET_DLL ossimPlanetUtility 8 | { 9 | public: 10 | static double getMaxDistance() 11 | { 12 | return 1.0e10; 13 | } 14 | static osg::Vec3d normal(const osg::EllipsoidModel& model, 15 | double x, double y, double z); 16 | static void ellipsoidToXYZ( const osg::EllipsoidModel& model, 17 | double latitude, double longitude, double height, 18 | double &x, double &y, double &z); 19 | static void XYZToEllipsoid( const osg::EllipsoidModel& model, 20 | double x, double y, double z, 21 | double& latitude, double& longitude, double& height); 22 | 23 | static bool intersectsEllipsoid(const osg::EllipsoidModel& model, 24 | osg::Vec3d& intersection, 25 | const osg::Vec3d& start, 26 | const osg::Vec3d& end); 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetElevationRegistry.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetElevationRegistry_HEADER 2 | #define ossimPlanetElevationRegistry_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class OSSIMPLANET_DLL ossimPlanetElevationRegistry 9 | { 10 | public: 11 | class OSSIMPLANET_DLL FactoryBase 12 | { 13 | public: 14 | virtual ~FactoryBase(){} 15 | virtual ossimPlanetElevationDatabase* openDatabase(const ossimString& location)=0; 16 | 17 | ossimString id(){return theId;} 18 | void setId(const ossimString& value){theId = value;} 19 | protected: 20 | ossimString theId; 21 | }; 22 | typedef std::vector FactoryList; 23 | 24 | ossimPlanetElevationRegistry(); 25 | bool registerFactory(FactoryBase* factory); 26 | void unregisterFactory(FactoryBase* factory); 27 | ossimPlanetElevationDatabase* openDatabase(const ossimString& location); 28 | 29 | static ossimPlanetElevationRegistry* instance(); 30 | 31 | protected: 32 | std::recursive_mutex theMutex; 33 | FactoryList theFactoryList; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetVideoLayer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef OSSIMPLANET_ENABLE_PREDATOR 3 | #include 4 | #endif 5 | #include 6 | #include 7 | 8 | void ossimPlanetVideoLayer::traverse(osg::NodeVisitor& nv) 9 | { 10 | if(!theEnableFlag) return; 11 | 12 | switch(nv.getVisitorType()) 13 | { 14 | case osg::NodeVisitor::UPDATE_VISITOR: 15 | { 16 | if(!thePlanet) 17 | { 18 | thePlanet = ossimPlanet::findPlanet(this); 19 | } 20 | break; 21 | } 22 | default: 23 | { 24 | break; 25 | } 26 | } 27 | 28 | ossimPlanetLayer::traverse(nv); 29 | } 30 | 31 | bool ossimPlanetVideoLayer::add(const ossimFilename& file) 32 | { 33 | #ifdef OSSIMPLANET_ENABLE_PREDATOR 34 | // later we will stage in a background thread but for now we will just open here for testing 35 | // until we get the drawing working 36 | // 37 | osg::ref_ptr node = new ossimPlanetPredatorVideoLayerNode(this); 38 | 39 | if(node->open(file)) 40 | { 41 | addChild(node.get()); 42 | return true; 43 | } 44 | #endif 45 | return false; 46 | } 47 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetOssimImage.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | ossimPlanetOssimImage::ossimPlanetOssimImage() 10 | { 11 | } 12 | ossimPlanetOssimImage::~ossimPlanetOssimImage() 13 | { 14 | } 15 | 16 | bool ossimPlanetOssimImage::loadFile(const std::string& inputFile, 17 | ossimPlanetImage& image) 18 | { 19 | if(theHandler.valid()) 20 | { 21 | theHandler->close(); 22 | if(!theHandler->open(ossimFilename(inputFile))) 23 | { 24 | theHandler = 0; 25 | } 26 | } 27 | ossimRefPtr data; 28 | if(!theHandler.valid()) 29 | { 30 | theHandler = ossimImageHandlerRegistry::instance()->open(ossimFilename(inputFile.c_str())); 31 | } 32 | if(theHandler.valid()) 33 | { 34 | data = theHandler->getTile(theHandler->getBoundingRect()); 35 | if(data.valid()) 36 | { 37 | image.fromOssimImage(data); 38 | return true; 39 | } 40 | } 41 | 42 | return false; 43 | } 44 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetNetworkConnection.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetNetworkConnection_HEADER 2 | #define ossimPlanetNetworkConnection_HEADER 3 | 4 | // abstract interface to network. 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | class OSSIMPLANET_DLL ossimPlanetNetworkConnection 12 | { 13 | public: 14 | ossimPlanetNetworkConnection(const std::string& name) : name_(name) {} 15 | virtual ~ossimPlanetNetworkConnection() {} 16 | 17 | const std::string& name() const 18 | // name of the connection 19 | { return name_; } 20 | 21 | const std::string& error() const 22 | // current error status, empty if no error. 23 | { return error_; } 24 | 25 | virtual void send(const ossimPlanetAction& a, const std::string& destination) = 0; 26 | // send action to the specified destination host. 27 | 28 | virtual void receive() = 0; 29 | // read any pending incoming actions and execute them. 30 | // should discard any incoming sent by me where destination is me or all 31 | 32 | protected: 33 | std::string name_; 34 | // name of the connection 35 | 36 | std::string error_; 37 | // current error status, empty if no error. 38 | }; 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetTexture2D.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetTexture2D_HEADER 2 | #define ossimPlanetTexture2D_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class ossimPlanetImage; 10 | class OSSIMPLANET_DLL ossimPlanetTexture2D : public osg::Texture2D 11 | { 12 | public: 13 | ossimPlanetTexture2D(const ossimPlanetTerrainTileId& id=ossimPlanetTerrainTileId(0,0,0,0)); 14 | ossimPlanetTexture2D(osg::Image* image, 15 | const ossimPlanetTerrainTileId& id=ossimPlanetTerrainTileId(0,0,0,0)); 16 | ossimPlanetTexture2D(ossimPlanetImage* image); 17 | 18 | /** Copy constructor using CopyOp to manage deep vs shallow copy. */ 19 | ossimPlanetTexture2D(const ossimPlanetTexture2D& text,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); 20 | virtual ~ossimPlanetTexture2D(); 21 | 22 | void setImage(ossimPlanetImage* image); 23 | const ossimPlanetTerrainTileId& tileId()const; 24 | void setId(const ossimPlanetTerrainTileId& id); 25 | 26 | protected: 27 | ossimPlanetTerrainTileId theTileId; 28 | ossim_uint32 theFace; 29 | ossim_uint32 theLevel; 30 | ossim_uint64 theRow; 31 | ossim_uint64 theCol; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetLayerRegistry.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetLayerRegistry_HEADER 2 | #define ossimPlanetLayerRegistry_HEADER 3 | #include "ossimPlanetExport.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "ossimPlanetLayerFactoryBase.h" 9 | #include 10 | 11 | class ossimPlanetLayer; 12 | class ossimPlanetLayerRegistry 13 | { 14 | public: 15 | typedef std::vector > FactoryListType; 16 | 17 | ossimPlanetLayerRegistry(); 18 | ~ossimPlanetLayerRegistry(); 19 | static ossimPlanetLayerRegistry* instance(); 20 | void finalize(); 21 | 22 | /** 23 | * @param type is the type name of the layer to create 24 | */ 25 | ossimPlanetLayer* create(const ossimString& type)const; 26 | 27 | void registerFactory(ossimPlanetLayerFactoryBase* factory, 28 | bool insertFrontFlag=false); 29 | void unregisterFactory(const ossimPlanetLayerFactoryBase* factory); 30 | 31 | protected: 32 | bool hasFactory(const ossimPlanetLayerFactoryBase* factory)const; 33 | 34 | mutable OpenThreads::ReadWriteMutex theFactoryListMutex; 35 | static ossimPlanetLayerRegistry* theInstance; 36 | FactoryListType theFactoryList; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /binds.act: -------------------------------------------------------------------------------- 1 | # // need to say something like this in C++ when create the iac (InteractionController) 2 | 3 | :iac tie x_mouse LON YAW 4 | :iac tie y_mouse LAT ZOOM PITCH 5 | 6 | :iac bind left_mousedown {:navigator rotatestart} 7 | :iac bind left_mouseup {:navigator rotatestop} 8 | :iac bind middle_mousedown {:navigator losrotatestart} 9 | :iac bind middle_mouseup {:navigator losrotatestop} 10 | :iac bind right_mousedown {:navigator loszoomstart} 11 | :iac bind right_mouseup {:navigator loszoomstop} 12 | :iac bind shift_middle_mousedown {:navigator zoomstart} 13 | :iac bind shift_middle_mouseup {:navigator zoomstop} 14 | :iac bind shift_right_mousedown {:navigator lookstart} 15 | :iac bind shift_right_mouseup {:navigator lookstop} 16 | :iac bind left_key {:navigator flystart .015625 0} 17 | :iac bind right_key {:navigator flystart -.015625 0.0} 18 | :iac bind down_key {:navigator flystart 0.0 .015625} 19 | :iac bind up_key {:navigator flystart 0.0 -.015625} 20 | :iac bind u_key {:navigator resetzoomlook} 21 | :iac bind z_key {:navigator recordanimation} 22 | :iac bind Z_key {:navigator playanimation} 23 | :iac bind p_key {:navigator printlatlonelev} 24 | :iac bind P_key {:navigator printlookcoordinates} 25 | :iac bind space_key {:navigator reset} 26 | :iac bind return_key {:navigator stop} 27 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetKmlLayerNode.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | ossimPlanetKmlLayerNode::ossimPlanetKmlLayerNode(ossimPlanetKmlLayer* layer, 5 | ossimPlanetKmlObject* obj) 6 | :theLayer(layer), 7 | theKmlObject(obj) 8 | { 9 | ossimPlanetKmlFeature* feature = dynamic_cast(obj); 10 | if(feature) 11 | { 12 | setName(feature->name()); 13 | setDescription(feature->description()); 14 | setId(feature->id()); 15 | } 16 | } 17 | 18 | void ossimPlanetKmlLayerNode::traverse(osg::NodeVisitor& nv) 19 | { 20 | if(!enableFlag()) return; 21 | 22 | ossimPlanetNode::traverse(nv); 23 | } 24 | 25 | void ossimPlanetKmlLayerNode::setLayer(ossimPlanetKmlLayer* layer) 26 | { 27 | theLayer = layer; 28 | } 29 | 30 | ossimPlanetKmlLayer* ossimPlanetKmlLayerNode::layer() 31 | { 32 | return theLayer; 33 | } 34 | 35 | void ossimPlanetKmlLayerNode::setKmlObject(ossimPlanetKmlObject* obj) 36 | { 37 | theKmlObject = obj; 38 | ossimPlanetKmlFeature* feature = dynamic_cast(obj); 39 | if(feature) 40 | { 41 | setName(feature->name()); 42 | setDescription(feature->description()); 43 | setId(feature->id()); 44 | } 45 | } 46 | 47 | bool ossimPlanetKmlLayerNode::init() 48 | { 49 | return true; 50 | } 51 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetLookAt.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | bool ossimPlanetLookAt::loadXml(ossimRefPtr xmlNode) 4 | { 5 | const std::vector >& childNodes = xmlNode->getChildNodes(); 6 | ossim_uint32 idx; 7 | ossim_uint32 upper=childNodes.size(); 8 | 9 | for(idx = 0; idx < upper; ++idx) 10 | { 11 | ossimString tag = childNodes[idx]->getTag(); 12 | 13 | if(tag == "latitude") 14 | { 15 | theLat = childNodes[idx]->getText().toDouble(); 16 | } 17 | else if(tag == "longitude") 18 | { 19 | theLon = childNodes[idx]->getText().toDouble(); 20 | } 21 | else if(tag == "altitude") 22 | { 23 | theAltitude = childNodes[idx]->getText().toDouble(); 24 | } 25 | else if(tag == "range") 26 | { 27 | theRange = childNodes[idx]->getText().toDouble(); 28 | } 29 | else if(tag == "roll") 30 | { 31 | theRoll = childNodes[idx]->getText().toDouble(); 32 | } 33 | else if(tag == "tilt") 34 | { 35 | thePitch = childNodes[idx]->getText().toDouble(); 36 | } 37 | else if(tag == "heading") 38 | { 39 | theHeading = childNodes[idx]->getText().toDouble(); 40 | } 41 | else if(tag == "altitudeMode") 42 | { 43 | theMode = modeFromString(childNodes[idx]->getText()); 44 | } 45 | } 46 | 47 | return true; 48 | } 49 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetAction.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | ossimPlanetAction::ossimPlanetAction(const ossimString& originatingFederate) : 9 | theOrigin(originatingFederate) 10 | { 11 | } 12 | 13 | 14 | 15 | void ossimPlanetAction::printError(const char* message) const 16 | { 17 | ossimString code; 18 | sourceCode(code); 19 | ossimNotify(ossimNotifyLevel_WARN) << "ossimPlanetAction Error (" << message << ") \"" << code << '"' << std::endl; 20 | } 21 | 22 | void ossimPlanetAction::printError(const ossimString& message) const 23 | { 24 | printError(message.c_str()); 25 | } 26 | 27 | void ossimPlanetAction::execute() const 28 | { 29 | ossimPlanetActionRouter::instance()->route(*this); 30 | } 31 | 32 | void ossimPlanetAction::post()const 33 | { 34 | ossimPlanetActionRouter::instance()->post(*this); 35 | } 36 | 37 | void ossimPlanetAction::allExecute() const 38 | { 39 | ossimPlanetActionRouter::instance()->allRoute(*this); 40 | } 41 | 42 | void ossimPlanetAction::tellExecute(const ossimString& destination) const 43 | { 44 | ossimPlanetActionRouter::instance()->tellRoute(*this, destination); 45 | } 46 | 47 | 48 | // protected 49 | 50 | 51 | const ossimString& ossimPlanetAction::defaultOrigin() 52 | { 53 | return ossimPlanetActionRouter::instance()->federateName(); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /examples/ossimplanetviewer/archive_manager.kwl: -------------------------------------------------------------------------------- 1 | // Note: If you are specifying opacity values then the 2 | // bottom layer is not applied since it is just initially copied into the destination 3 | // All layers after that are blended based on the apacity. The default opacity is 255 4 | // which indicates completely opaque and anything less than that defines how 5 | // translucent the layer is. 6 | // 7 | // Note: You must name each layer archive0 upto archive . 8 | // So currently if you delete a layer you must manually re-number 9 | // each keyword in the list. 10 | // 11 | // We support local and remote files. Currently for remote we only support 12 | // wms and you must give the full string for STYLES and layers you want and 13 | // make sure you end it with an &. 14 | // 15 | 16 | 17 | 18 | //archive0.type: local 19 | //archive0.file0: /data/earth/land_shallow_topo_east_tiled.tif 20 | //archive0.file1: /data/earth/land_shallow_topo_west_tiled.tif 21 | //archive0.transparent_color_flag:0 22 | //archive0.transparent_color: 0 0 0 23 | //archive0.opacity: 255 24 | 25 | //archive0.type: wms 26 | //archive0.server: http://neptune.flids.com/cgi-bin/ngos.cgi?LAYERS=Earth_Image,ngos 27 | //archive0.cache_dir: c:/data/wms/ngos/all 28 | 29 | //archive0.server: http://wmt.jpl.nasa.gov/cgi-bin/wmt.cgi?STYLES=visual&LAYERS=global_mosaic&sharp=0.0& 30 | 31 | archive0.type:wms 32 | archive0.server: http://wms.telascience.org/cgi-bin/bmng_wms_t?LAYERS=BMNG 33 | archive0.cache_dir: /data/wms/bmng 34 | archive0.opacity: 255 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetElevationFactory.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | ossimPlanetElevationFactory::ossimPlanetElevationFactory() 7 | { 8 | setId("default"); 9 | } 10 | 11 | ossimPlanetElevationFactory* ossimPlanetElevationFactory::instance() 12 | { 13 | static ossimPlanetElevationFactory* theInstance = 0; 14 | if(!theInstance) 15 | { 16 | theInstance = new ossimPlanetElevationFactory; 17 | } 18 | 19 | return theInstance; 20 | } 21 | 22 | ossimPlanetElevationDatabase* ossimPlanetElevationFactory::openDatabase(const ossimString& location) 23 | { 24 | // check SRTM database 25 | osg::ref_ptr database = new ossimPlanetSrtmElevationDatabase; 26 | 27 | if(database->open(location) == ossimPlanetTextureLayer_VALID) 28 | { 29 | return database.release(); 30 | } 31 | else 32 | { 33 | database = new ossimPlanetDtedElevationDatabase; 34 | if(database->open(location) == ossimPlanetTextureLayer_VALID) 35 | { 36 | return database.release(); 37 | } 38 | else 39 | { 40 | database = new ossimPlanetGeneralRasterElevationDatabase; 41 | if(database->open(location) == ossimPlanetTextureLayer_VALID) 42 | { 43 | return database.release(); 44 | } 45 | } 46 | } 47 | 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetCubeGrid.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetCubeGrid_HEADER 2 | #define ossimPlanetCubeGrid_HEADER 3 | #include 4 | #include 5 | 6 | class OSSIMPLANET_DLL ossimPlanetCubeGrid : public ossimPlanetGridUtility 7 | { 8 | public: 9 | ossimPlanetCubeGrid(ossim_uint32 tileWidth = 256, 10 | ossim_uint32 tileHeight = 256) 11 | :ossimPlanetGridUtility(tileWidth, tileHeight) 12 | { 13 | } 14 | virtual void getPixelScale(double& dx, 15 | double& dy, 16 | ossimUnitType& pixelScaleUnits, 17 | ossim_uint32 level, 18 | ossim_uint64 row, 19 | ossim_uint64 col)const; 20 | virtual void getWidthHeightInDegrees(double& deltaX, 21 | double& deltaY, 22 | ossim_uint32 level, 23 | ossim_uint64 row, 24 | ossim_uint64 col)const; 25 | // this is from GeoFusion SPEC 26 | virtual void getLatLon(osg::Vec3d& latLon, 27 | const ossimPlanetGridUtility::GridPoint& gridPoint)const; 28 | 29 | // this is from Geofusion SPEC 30 | virtual void getGridPoint(ossimPlanetGridUtility::GridPoint& gridPoint, 31 | const osg::Vec3d& latLon)const; 32 | 33 | virtual ossim_uint32 getNumberOfFaces()const; 34 | 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetKmlLayerNode.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetKmlLayerNode_HEADER 2 | #define ossimPlanetKmlLayerNode_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | class ossimPlanetKmlLayer; 9 | 10 | class OSSIMPLANET_DLL ossimPlanetKmlLayerNode : public ossimPlanetNode 11 | { 12 | public: 13 | ossimPlanetKmlLayerNode(ossimPlanetKmlLayer* layer = 0, 14 | ossimPlanetKmlObject* obj = 0); 15 | void setKmlLayer(ossimPlanetKmlLayer* layer) 16 | { 17 | theLayer = layer; 18 | } 19 | void setLayer(ossimPlanetKmlLayer* layer); 20 | void setKmlObject(ossimPlanetKmlObject* obj); 21 | ossimPlanetKmlLayer* layer(); 22 | 23 | osg::ref_ptr kmlObject() 24 | { 25 | return theKmlObject.get(); 26 | } 27 | 28 | virtual void traverse(osg::NodeVisitor& nv); 29 | 30 | /** 31 | * This is a convenient method for interactive GUIs to call to allow a KML node to change its state 32 | * in the scene graph. 33 | */ 34 | virtual void doNormalStyle(){} 35 | 36 | /** 37 | * This is a convenient method for interactive GUIs to call to allow the KML node to change its state 38 | * in the scene graph. 39 | */ 40 | virtual void doHighlightStyle(){} 41 | 42 | virtual bool init(); 43 | 44 | protected: 45 | ossimPlanetKmlLayer* theLayer; 46 | osg::ref_ptr theKmlObject; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetBoundingBox.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | bool ossimPlanetBoundingBox::intersects(const osg::Polytope& frustum)const 7 | { 8 | const osg::Polytope::PlaneList& planeList = frustum.getPlaneList(); 9 | unsigned int idx = 0; 10 | unsigned int ptIdx = 0; 11 | unsigned int outsideCount = 0; 12 | unsigned int upperBound = planeList.size(); 13 | double testValue = 0.0; 14 | for(; idx < upperBound;++idx) 15 | { 16 | const osg::Vec4& plane = planeList[idx].asVec4(); 17 | outsideCount = 0; 18 | for(ptIdx = 0; ptIdx < 8; ++ptIdx) 19 | { 20 | testValue = (((((double)plane[0])*theCorners[ptIdx][0] + 21 | ((double)plane[1])*theCorners[ptIdx][1] + 22 | ((double)plane[2])*theCorners[ptIdx][2])) + (double)plane[3]); 23 | if(testValue >-FLT_EPSILON) 24 | { 25 | break; 26 | } 27 | else 28 | { 29 | ++outsideCount; 30 | } 31 | } 32 | if(outsideCount == 8) 33 | { 34 | return false; 35 | } 36 | } 37 | 38 | return true; 39 | } 40 | 41 | bool ossimPlanetBoundingBox::isInFront(const osg::Vec3d& eye, 42 | const osg::Vec3d& direction)const 43 | { 44 | ossim_uint32 idx = 0; 45 | osg::Vec3d deltaP; 46 | for(idx = 0; idx < 8; ++idx) 47 | { 48 | deltaP = theCorners[idx]-eye; 49 | if((deltaP*direction) > -FLT_EPSILON) 50 | { 51 | return true; 52 | } 53 | } 54 | 55 | return false; 56 | } 57 | -------------------------------------------------------------------------------- /include/ossimPlanet/ulLocal.h: -------------------------------------------------------------------------------- 1 | /* 2 | PLIB - A Suite of Portable Game Libraries 3 | Copyright (C) 1998,2002 Steve Baker 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | For further information visit http://plib.sourceforge.net 20 | 21 | $Id: ulLocal.h 1568 2002-09-02 06:05:49Z sjbaker $ 22 | */ 23 | 24 | #ifndef _UL_LOCAL_H_ 25 | #define _UL_LOCAL_H_ 1 26 | 27 | #include "ul.h" 28 | 29 | class ulListNode 30 | { 31 | protected: 32 | 33 | ulListNode *next ; 34 | void *data ; 35 | 36 | public: 37 | 38 | ulListNode ( void *dt, ulListNode *next_node ) 39 | { 40 | data = dt ; 41 | next = next_node ; 42 | } 43 | 44 | void * getData ( void ) const { return data ; } 45 | void setData ( void *d ) { data = d ; } 46 | 47 | ulListNode * getNext ( void ) const { return next ; } 48 | void setNext ( ulListNode *n ) { next = n ; } 49 | } ; 50 | 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetLayer.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetLayer_HEADER 2 | #define ossimPlanetLayer_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class ossimPlanet; 12 | 13 | class OSSIMPLANET_DLL ossimPlanetLayer :public ossimPlanetNode 14 | { 15 | public: 16 | friend class ossimPlanetLayerUpdateCallback; 17 | 18 | ossimPlanetLayer(); 19 | virtual ~ossimPlanetLayer(); 20 | 21 | virtual void execute(const ossimPlanetAction& action); 22 | 23 | virtual void setModel(ossimPlanetGeoRefModel* model) 24 | { 25 | theModel = model; 26 | } 27 | const ossimPlanetGeoRefModel* model()const 28 | { 29 | return theModel.get(); 30 | } 31 | ossimPlanetGeoRefModel* model() 32 | { 33 | return theModel.get(); 34 | } 35 | virtual void setPlanet(ossimPlanet* planet) 36 | { 37 | thePlanet = planet; 38 | } 39 | ossimPlanet* planet() 40 | { 41 | return thePlanet; 42 | } 43 | const ossimPlanet* planet()const 44 | { 45 | return thePlanet; 46 | } 47 | virtual void needsRemoving(osg::Node* /*node*/){} 48 | static ossimPlanetLayer* findLayer(osg::Node* startNode); 49 | static ossimPlanetLayer* findLayer(osg::NodePath& currentNodePath); 50 | 51 | virtual void traverse(osg::NodeVisitor& nv); 52 | 53 | protected: 54 | ossimPlanet* thePlanet; 55 | osg::ref_ptr theModel; 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetStandardTextureLayerFactory.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetStandardTextureLayerFactory_HEADER 2 | #define ossimPlanetStandardTextureLayerFactory_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class OSSIMPLANET_DLL ossimPlanetStandardTextureLayerFactory : public ossimPlanetTextureLayerFactory 10 | { 11 | public: 12 | ossimPlanetStandardTextureLayerFactory(); 13 | 14 | static ossimPlanetStandardTextureLayerFactory* instance(); 15 | virtual osg::ref_ptr createLayer(const ossimString& name, bool openAllEntriesFlag)const; 16 | 17 | protected: 18 | ossimPlanetStandardTextureLayerFactory(const ossimPlanetStandardTextureLayerFactory& src):ossimPlanetTextureLayerFactory(src) { } 19 | const ossimPlanetStandardTextureLayerFactory& operator =(const ossimPlanetStandardTextureLayerFactory& ) { return *this;} 20 | 21 | osg::ref_ptr createLayerFromFilename(const ossimFilename& name, bool openAllEntriesFlag)const; 22 | osg::ref_ptr createLayerFromKwl(const ossimKeywordlist& kwl, 23 | const ossimString& prefix=ossimString())const; 24 | osg::ref_ptr createLayerFromOldKwl(const ossimKeywordlist& kwl, 25 | const ossimString& prefix=ossimString())const; 26 | static ossimPlanetStandardTextureLayerFactory* theInstance; 27 | mutable std::recursive_mutex theMutex; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetSceneView.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetSceneView_HEADER 2 | #define ossimPlanetSceneView_HEADER 3 | #include 4 | #include 5 | #include 6 | 7 | class OSSIMPLANET_DLL ossimPlanetSceneView : public osgUtil::SceneView 8 | { 9 | public: 10 | ossimPlanetSceneView(); 11 | virtual bool pickObjects(osgUtil::IntersectVisitor::HitList& hits, 12 | osg::Node* startNode, 13 | double vx, double vy, 14 | double startPointShift); 15 | 16 | /* virtual bool intersectScene(osg::Node* startNode, */ 17 | /* osg::Vec3d& intersection, */ 18 | /* const osg::Vec3d& startPt, */ 19 | /* const osg::Vec3d& endPt); */ 20 | virtual bool intersectScene(osg::Node* startNode, 21 | osg::Vec3d& intersectionPoint, 22 | double vx, double vy, 23 | double startPointShift=0.0); 24 | /* virtual bool computeNadirIntersection(osg::Vec3d& intersectionPoint, */ 25 | /* double startPointShift=0.0); */ 26 | virtual bool computeLineOfSiteIntersection(osg::Vec3d& intersectionPoint, 27 | double startPointShift=0.0); 28 | void getEyePosition(osg::Vec3d& eye)const; 29 | void getLookDirection(osg::Vec3d& direction)const; 30 | /* bool makeRay(osg::Vec3d& origin, */ 31 | /* osg::Vec3d& ray, */ 32 | /* double vx, double vy); */ 33 | 34 | protected: 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetElevationGrid.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetElevationGrid_HEADER 2 | #define ossimPlanetElevationGrid_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class OSSIMPLANET_DLL ossimPlanetElevationGrid : public osg::Referenced 10 | { 11 | public: 12 | ossimPlanetElevationGrid(ossim_uint32 w=1, 13 | ossim_uint32 h=1); 14 | 15 | float& operator[](ossim_uint32 idx) 16 | { 17 | return theGrid[idx]; 18 | } 19 | const float& operator[](ossim_uint32 idx)const 20 | { 21 | return theGrid[idx]; 22 | } 23 | float* row(ossim_uint32 rowIdx) 24 | { 25 | return &theGrid[rowIdx*theWidth]; 26 | } 27 | ossim_uint32 getWidth()const 28 | { 29 | return theWidth; 30 | } 31 | ossim_uint32 getHeight()const 32 | { 33 | return theHeight; 34 | } 35 | 36 | void resize(ossim_uint32 w, 37 | ossim_uint32 h); 38 | 39 | const ossim_float32* data()const 40 | { 41 | return theGrid; 42 | } 43 | ossim_float32* data() 44 | { 45 | return theGrid; 46 | } 47 | osg::ref_ptr scaleBy2Nearest()const; 48 | osg::ref_ptr scaleBy2Bilinear()const; 49 | void copyGrid(ossim_uint32 ulx, 50 | ossim_uint32 uly, 51 | osg::ref_ptr output)const; 52 | bool isEqualTo(osg::ref_ptr grid)const; 53 | protected: 54 | virtual ~ossimPlanetElevationGrid(); 55 | ossim_uint32 theWidth; 56 | ossim_uint32 theHeight; 57 | ossim_float32* theGrid; 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetLayerFactory.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | ossimPlanetLayerFactory* ossimPlanetLayerFactory::theInstance = 0; 11 | 12 | ossimPlanetLayerFactory::ossimPlanetLayerFactory() 13 | { 14 | theInstance = this; 15 | } 16 | 17 | ossimPlanetLayerFactory::~ossimPlanetLayerFactory() 18 | { 19 | theInstance = 0; 20 | } 21 | 22 | ossimPlanetLayerFactory* ossimPlanetLayerFactory::instance() 23 | { 24 | if(!theInstance) 25 | { 26 | theInstance = new ossimPlanetLayerFactory; 27 | } 28 | 29 | return theInstance; 30 | } 31 | 32 | ossimPlanetLayer* ossimPlanetLayerFactory::create(const ossimString& type)const 33 | { 34 | if(type == "ossimPlanetLand") 35 | { 36 | return new ossimPlanetLand; 37 | } 38 | else if(type == "osismPlanetTerrain") 39 | { 40 | return new ossimPlanetTerrain; 41 | } 42 | else if(type == "ossimPlanetVideoLayer") 43 | { 44 | } 45 | else if(type == "ossimPlanetLatLonHud") 46 | { 47 | return new ossimPlanetLatLonHud; 48 | } 49 | else if(type == "ossimPlanetSousaLayer") 50 | { 51 | return new ossimPlanetSousaLayer; 52 | } 53 | else if(type == "ossimPlanetKmlLayer") 54 | { 55 | return new ossimPlanetKmlLayer; 56 | } 57 | else if(type == "ossimPlanetAnnotationLayer") 58 | { 59 | return new ossimPlanetAnnotationLayer; 60 | } 61 | 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetKmlScreenOverlayNode.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetKmlScreenOverlayNode_HEADER 2 | #define ossimPlanetKmlScreenOverlayNode_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | class ossimPlanetKmlScreenOverlayNode : public ossimPlanetKmlLayerNode 11 | { 12 | public: 13 | ossimPlanetKmlScreenOverlayNode(ossimPlanetKmlLayer* layer = 0, 14 | ossimPlanetKmlObject* obj = 0); 15 | virtual void traverse(osg::NodeVisitor& nv); 16 | virtual bool init(); 17 | 18 | protected: 19 | void update(); 20 | void computeOverlayXY(osg::Vec3d& position); 21 | void computeScreenXY(osg::Vec3d& position); 22 | void computeSize(osg::Vec3d& size); 23 | 24 | osg::ref_ptr theCameraNode; 25 | osg::ref_ptr theGroup; 26 | osg::ref_ptr theViewport; 27 | osg::ref_ptr theIconGeode; 28 | osg::ref_ptr theIconGeom; 29 | bool theViewportChangedFlag; 30 | bool theNeedsUpdateFlag; 31 | 32 | osg::Vec2d theOverlayOrigin; 33 | ossimPlanetKmlUnits theOverlayXUnits; 34 | ossimPlanetKmlUnits theOverlayYUnits; 35 | osg::Vec2d theScreenOrigin; 36 | ossimPlanetKmlUnits theScreenXUnits; 37 | ossimPlanetKmlUnits theScreenYUnits; 38 | 39 | osg::Vec2d theRotationOrigin; 40 | ossimPlanetKmlUnits theRotationXUnits; 41 | ossimPlanetKmlUnits theRotationYUnits; 42 | osg::Vec2d theSize; 43 | ossimPlanetKmlUnits theSizeXUnits; 44 | ossimPlanetKmlUnits theSizeYUnits; 45 | float theRotation; 46 | }; 47 | 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/ossimPlanet/netMessage.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | PLIB - A Suite of Portable Game Libraries 3 | Copyright (C) 1998,2002 Steve Baker 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | For further information visit http://plib.sourceforge.net 20 | 21 | $Id: netMessage.cxx 1899 2004-03-21 17:41:07Z sjbaker $ 22 | */ 23 | 24 | #include 25 | 26 | 27 | void 28 | netMessageChannel::handleBufferRead (netBuffer& in_buffer) 29 | { 30 | int n = in_buffer.getLength () ; 31 | while ( n >= 2 ) 32 | { 33 | unsigned short msg_len = *( (unsigned short*)in_buffer.getData() ) ; 34 | if ( n >= msg_len ) 35 | { 36 | //we have a complete message; handle it 37 | netMessage msg(in_buffer.getData(),msg_len); 38 | in_buffer.remove(0,msg_len); 39 | handleMessage ( msg ); 40 | 41 | //ulSetError ( UL_DEBUG, "netMessageChannel: %d read", msg_len ) ; 42 | n -= msg_len ; 43 | } 44 | else 45 | { 46 | //ulSetError ( UL_DEBUG, "netMessageChannel: %d waiting", n ) ; 47 | break ; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetThread.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | ossimPlanetThread::ossimPlanetThread() 5 | { 6 | theImplementation = 0; 7 | theThreadPool = 0; 8 | theRetainThreadFlag = false; 9 | } 10 | 11 | void ossimPlanetThread::run() 12 | { 13 | if(theImplementation) 14 | { 15 | theImplementation->run(); 16 | if(theThreadPool&&!theRetainThreadFlag) 17 | { 18 | theThreadPool->makeAvailable(this); 19 | } 20 | } 21 | } 22 | 23 | int ossimPlanetThread::cancel() 24 | { 25 | if(theImplementation) 26 | { 27 | theImplementation->cancel(); 28 | while(isRunning()) 29 | { 30 | OpenThreads::Thread::YieldCurrentThread(); 31 | } 32 | } 33 | 34 | return 0; 35 | } 36 | 37 | void ossimPlanetThread::updateThreadBlock() 38 | { 39 | if(theImplementation) 40 | { 41 | theImplementation->updateThreadBlock(); 42 | } 43 | } 44 | 45 | void ossimPlanetThread::setImplementation(ossimPlanetThreadImp* implementation) 46 | { 47 | if(theImplementation) 48 | { 49 | theImplementation->setThread(0); 50 | theImplementation->cancel(); 51 | } 52 | theImplementation = implementation; 53 | if(theImplementation) 54 | { 55 | theImplementation->setThread(this); 56 | } 57 | } 58 | 59 | void ossimPlanetThread::setThreadPool(ossimPlanetThreadPool* threadPool) 60 | { 61 | theThreadPool = threadPool; 62 | } 63 | 64 | ossimPlanetThreadImp* ossimPlanetThread::implementation() 65 | { 66 | return theImplementation; 67 | } 68 | 69 | const ossimPlanetThreadImp* ossimPlanetThread::implementation()const 70 | { 71 | return theImplementation; 72 | } 73 | 74 | void ossimPlanetThread::setRetainThreadFlag(bool flag) 75 | { 76 | theRetainThreadFlag = flag; 77 | } 78 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetMessage.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetMessage_HEADER 2 | #define ossimPlanetMessage_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class OSSIMPLANET_DLL ossimPlanetMessage : public osg::Referenced 9 | { 10 | public: 11 | typedef unsigned char DataType; 12 | typedef std::vector StorageType; 13 | 14 | ossimPlanetMessage(const ossimString& id=ossimString("") ) 15 | { 16 | setId(id); 17 | } 18 | ossimPlanetMessage(const ossimString& id, const ossimString& data ) 19 | { 20 | setId(id); 21 | setData(data); 22 | } 23 | ossimPlanetMessage(const ossimString& id, const std::vector& byteBuffer): 24 | theId(id), 25 | theData(byteBuffer.begin(), byteBuffer.end()) 26 | { 27 | } 28 | ossimPlanetMessage(const ossimString& id, const StorageType& buf): 29 | theId(id), 30 | theData(buf) 31 | { 32 | } 33 | ossimPlanetMessage(const ossimPlanetMessage& src) 34 | :theId(src.theId), 35 | theData(src.theData){} 36 | ossimPlanetMessage* clone()const{return new ossimPlanetMessage(*this);} 37 | const ossimString& id()const{return theId;} 38 | void setId(const ossimString& id){theId = id;} 39 | void setData(const ossimPlanetMessage::StorageType& data){theData = data;} 40 | void setData(const ossimString& data){theData.clear();theData.insert(theData.begin(), data.begin(), data.end());} 41 | ossim_uint32 dataSize()const{return (ossim_uint32)theData.size();} 42 | const ossimPlanetMessage::StorageType& data()const{return theData;} 43 | protected: 44 | ossimString theId; 45 | ossimPlanetMessage::StorageType theData; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetIconGeom.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetIconGeom_HEADER 2 | #define ossimPlanetIconGeom_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class ossimPlanetIconGeom : public osg::Geometry 9 | { 10 | public: 11 | /** 12 | * We will setup a unit geometry for the icon. 13 | */ 14 | ossimPlanetIconGeom( const osg::Vec3d& corner=osg::Vec3d(-.5, 15 | 0.0, 16 | -.5), 17 | const osg::Vec3d& width=osg::Vec3d(1.0,0.0,0.0), 18 | const osg::Vec3d& height=osg::Vec3d(0.0,0.0,1.0)); 19 | void setTexture(osg::ref_ptr img); 20 | void setTexture(osg::ref_ptr texture); 21 | void resetToUnitGeometry(); 22 | void setGeometry(const osg::Vec3d& corner, 23 | const osg::Vec3d& width, 24 | const osg::Vec3d& height); 25 | void setTextureCoordinatesGivenPixels(int originX, 26 | int originY, 27 | int pixelWidth, 28 | int pixelHeight); 29 | virtual void drawImplementation(osg::RenderInfo& renderInfo) const; 30 | ossim_uint32 width()const; 31 | ossim_uint32 height()const; 32 | osg::ref_ptr texture(); 33 | const osg::ref_ptr texture()const; 34 | protected: 35 | void setupGeom(const osg::Vec3d& corner, 36 | const osg::Vec3d& width, 37 | const osg::Vec3d& height); 38 | osg::ref_ptr theTexture; 39 | mutable osg::ref_ptr theColorArray; 40 | float theAlpha; 41 | }; 42 | 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetTextureLayerRegistry.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetTextureLayerRegistry_HEADER 2 | #define ossimPlanetTextureLayerRegistry_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class OSSIMPLANET_DLL ossimPlanetTextureLayerRegistry : public osg::Referenced 9 | { 10 | public: 11 | ossimPlanetTextureLayerRegistry(); 12 | virtual ~ossimPlanetTextureLayerRegistry(); 13 | static ossimPlanetTextureLayerRegistry* instance(); 14 | 15 | void registerFactory(ossimPlanetTextureLayerFactory* factory); 16 | void registerFactoryToFront(ossimPlanetTextureLayerFactory* factory); 17 | void unregisterFactory(ossimPlanetTextureLayerFactory* factory); 18 | /** 19 | * The passed in string could be a WMS http string, keyword list 20 | * describing archives or a local image file, .. etc. A layer will be returned. 21 | * 22 | * Note this layer could be a grouped layer. For instance. An image may have multiple 23 | * handlers and will return a group of all images. 24 | * 25 | */ 26 | osg::ref_ptr createLayer(const ossimString& name, bool openAllEntriesFlag=true)const; 27 | 28 | 29 | protected: 30 | ossimPlanetTextureLayerRegistry(const ossimPlanetTextureLayerRegistry& /*src*/):osg::Referenced(){} 31 | const ossimPlanetTextureLayerRegistry& operator = (const ossimPlanetTextureLayerRegistry& /*src*/){return *this;} 32 | bool containsFactory(ossimPlanetTextureLayerFactory* factory)const; 33 | 34 | static ossimPlanetTextureLayerRegistry* theInstance; 35 | std::vector theFactoryList; 36 | mutable OpenThreads::ReadWriteMutex theFactoryListMutex; 37 | mutable bool destroyingFlag; 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetId.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetId_HEADER 2 | #define ossimPlanetId_HEADER 3 | #include 4 | #include "ossimPlanetExport.h" 5 | 6 | class OSSIMPLANET_DLL ossimPlanetId 7 | { 8 | public: 9 | ossimPlanetId(ossim_int64 value = theInvalidId) 10 | :theId(value) 11 | { 12 | } 13 | ossim_int64 id()const 14 | { 15 | return theId; 16 | } 17 | ossimPlanetId& operator ++() 18 | { 19 | ++theId; 20 | return *this; 21 | } 22 | ossimPlanetId operator ++(int) 23 | { 24 | ossimPlanetId id(theId); 25 | ++theId; 26 | return id; 27 | } 28 | bool operator()()const 29 | { 30 | return (theId != theInvalidId); 31 | } 32 | bool operator <(const ossimPlanetId& id)const 33 | { 34 | return (theId < id.theId); 35 | } 36 | bool operator <(ossim_int64 id)const 37 | { 38 | return (theId < id); 39 | } 40 | bool operator >(const ossimPlanetId& id)const 41 | { 42 | return (theId > id.theId); 43 | } 44 | bool operator >(ossim_int64 id)const 45 | { 46 | return (theId > id); 47 | } 48 | bool operator <=(const ossimPlanetId& id)const 49 | { 50 | return (theId <= id.theId); 51 | } 52 | bool operator <=(ossim_int64 id)const 53 | { 54 | return (theId <= id); 55 | } 56 | bool operator >=(const ossimPlanetId& id)const 57 | { 58 | return (theId >= id.theId); 59 | } 60 | bool operator >=(ossim_int64 id)const 61 | { 62 | return (theId >= id); 63 | } 64 | bool operator ==(const ossimPlanetId& id)const 65 | { 66 | return (theId == id.theId); 67 | } 68 | bool operator ==(ossim_int64 id)const 69 | { 70 | return (theId == id); 71 | } 72 | static ossim_int64 invalidId(); 73 | protected: 74 | ossim_int64 theId; 75 | 76 | static ossim_int64 theInvalidId; 77 | }; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetElevationRegistry.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | ossimPlanetElevationRegistry::ossimPlanetElevationRegistry() 7 | { 8 | } 9 | 10 | bool ossimPlanetElevationRegistry::registerFactory(FactoryBase* factory) 11 | { 12 | std::lock_guard lock(theMutex); 13 | bool result = false; 14 | FactoryList::iterator iter = std::find(theFactoryList.begin(), theFactoryList.end(), factory); 15 | 16 | if(iter == theFactoryList.end()) 17 | { 18 | theFactoryList.push_back(factory); 19 | result = true; 20 | } 21 | 22 | return result; 23 | } 24 | 25 | void ossimPlanetElevationRegistry::unregisterFactory(FactoryBase* factory) 26 | { 27 | std::lock_guard lock(theMutex); 28 | FactoryList::iterator iter = std::find(theFactoryList.begin(), theFactoryList.end(), factory); 29 | 30 | if(iter != theFactoryList.end()) 31 | { 32 | theFactoryList.erase(iter); 33 | } 34 | } 35 | 36 | ossimPlanetElevationDatabase* ossimPlanetElevationRegistry::openDatabase(const ossimString& location) 37 | { 38 | std::lock_guard lock(theMutex); 39 | ossimPlanetElevationDatabase* result = 0; 40 | 41 | FactoryList::iterator iter = theFactoryList.begin(); 42 | while(!result&&(iter != theFactoryList.end())) 43 | { 44 | result = (*iter)->openDatabase(location); 45 | ++iter; 46 | } 47 | 48 | return result; 49 | } 50 | 51 | ossimPlanetElevationRegistry* ossimPlanetElevationRegistry::instance() 52 | { 53 | static ossimPlanetElevationRegistry* theInstance = 0; 54 | if(!theInstance) 55 | { 56 | theInstance = new ossimPlanetElevationRegistry(); 57 | theInstance->registerFactory(ossimPlanetElevationFactory::instance()); 58 | } 59 | 60 | return theInstance; 61 | } 62 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetVideoLayer.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetVideoLayer_HEADER 2 | #define ossimPlanetVideoLayer_HEADER 3 | #include "ossimPlanetLayer.h" 4 | #include 5 | #include 6 | 7 | class ossimPlanet; 8 | class OSSIMPLANET_DLL ossimPlanetVideoLayer : public ossimPlanetLayer 9 | { 10 | public: 11 | ossimPlanetVideoLayer() 12 | { 13 | } 14 | virtual osg::Object* cloneType() const { return new ossimPlanetVideoLayer(); } 15 | virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=0; } 16 | virtual const char* className() const { return "ossimPlanetVideoLayer"; } 17 | virtual const char* libraryName() const { return ""; } 18 | 19 | virtual void traverse(osg::NodeVisitor& nv); 20 | 21 | virtual bool add(const ossimFilename& file); 22 | 23 | 24 | virtual bool addChild( Node *child ) 25 | { 26 | if(dynamic_cast(child)) 27 | { 28 | return ossimPlanetLayer::addChild(child); 29 | } 30 | return false; 31 | } 32 | virtual bool insertChild( unsigned int index, Node *child ) 33 | { 34 | if(dynamic_cast(child)) 35 | { 36 | return ossimPlanetLayer::insertChild(index, child); 37 | } 38 | return false; 39 | 40 | } 41 | virtual bool replaceChild( Node *origChild, Node* newChild ) 42 | { 43 | if(dynamic_cast(newChild)) 44 | { 45 | return ossimPlanetLayer::replaceChild(origChild, newChild); 46 | } 47 | return false; 48 | } 49 | virtual bool setChild( unsigned int i, Node* node ) 50 | { 51 | if(dynamic_cast(node)) 52 | { 53 | return ossimPlanetLayer::setChild(i, node); 54 | } 55 | return false; 56 | } 57 | 58 | 59 | }; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetPagedRequestNode.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetPagedRequestNode_HEADER 2 | #define ossimPlanetPagedRequestNode_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "ossimPlanetElevationGrid.h" 9 | #include 10 | 11 | class OSSIMPLANET_DLL ossimPlanetPagedRequestNode : public osg::Node 12 | { 13 | public: 14 | ossimPlanetPagedRequestNode(ossim_uint32 level=0, 15 | ossim_uint32 row=0, 16 | ossim_uint32 col=0, 17 | osg::ref_ptr texture=0) 18 | :osg::Node(), 19 | theLevel(level), 20 | theRow(row), 21 | theCol(col), 22 | theTexture(texture) 23 | { 24 | } 25 | virtual ~ossimPlanetPagedRequestNode() 26 | { 27 | } 28 | osg::ref_ptr getTexture() 29 | { 30 | return theTexture; 31 | } 32 | osg::ref_ptr getElevation() 33 | { 34 | return theElevationGrid; 35 | } 36 | const osg::ref_ptr getElevation()const 37 | { 38 | return theElevationGrid; 39 | } 40 | void setElevation(osg::ref_ptr elevationGrid) 41 | { 42 | theElevationGrid = elevationGrid; 43 | } 44 | void setTexture(osg::ref_ptr texture) 45 | { 46 | theTexture = texture; 47 | } 48 | ossim_uint32 getLevel()const 49 | { 50 | return theLevel; 51 | } 52 | ossim_uint32 getRow()const 53 | { 54 | return theRow; 55 | } 56 | ossim_uint32 getCol()const 57 | { 58 | return theCol; 59 | } 60 | 61 | 62 | protected: 63 | ossim_uint32 theLevel; 64 | ossim_uint32 theRow; 65 | ossim_uint32 theCol; 66 | osg::ref_ptr theTexture; 67 | osg::ref_ptr theElevationGrid; 68 | }; 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetLandCullCallback.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetLandCullCallback_HEADER 2 | #define ossimPlanetLandCullCallback_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | class ossimPlanetPagedLandLod; 9 | 10 | class OSSIMPLANET_DLL ossimPlanetLandCullCallback : public osg::NodeCallback 11 | { 12 | public: 13 | ossimPlanetLandCullCallback(); 14 | ossimPlanetLandCullCallback(const ossimPlanetLandCullCallback& src) 15 | :osg::NodeCallback(src), 16 | theFreezeRequestFlag(src.theFreezeRequestFlag), 17 | theCullingFlag(src.theCullingFlag), 18 | theSplitMetric(src.theSplitMetric), 19 | theSplitPriorityType(src.theSplitPriorityType), 20 | theLineOfSiteValidFlag(src.theLineOfSiteValidFlag), 21 | theLineOfSite(src.theLineOfSite) 22 | { 23 | } 24 | ossimPlanetLandCullCallback* clone()const 25 | { 26 | return new ossimPlanetLandCullCallback(*this); 27 | } 28 | virtual void operator()(osg::Node* node, osg::NodeVisitor* nv); 29 | void setLineOfSite(const osg::Vec3d& lineOfSite); 30 | void setLineOfSiteValidFlag(bool flag); 31 | bool isLineOfSiteValid()const; 32 | 33 | void setSplitMetricRatio(double ratio); 34 | double getSplitMetricRatio()const; 35 | 36 | void setSplitPriorityType(ossimPlanetPriorityType priorityType); 37 | ossimPlanetPriorityType getSplitPriorityType()const; 38 | 39 | void setCullingFlag(bool flag); 40 | bool getCullingFlag()const; 41 | 42 | void setFreezeRequestFlag(bool flag); 43 | bool getFreezRequestFlag()const; 44 | protected: 45 | void applyStandardCull(ossimPlanetPagedLandLod* n, osg::NodeVisitor* nv); 46 | // void applyOrthoCull(ossimPlanetPagedLandLod* n, osg::NodeVisitor* nv); 47 | 48 | bool theFreezeRequestFlag; 49 | bool theCullingFlag; 50 | double theSplitMetric; 51 | ossimPlanetPriorityType theSplitPriorityType; 52 | bool theLineOfSiteValidFlag; 53 | osg::Vec3d theLineOfSite; 54 | }; 55 | #endif 56 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetExport.h: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- libwms - Copyright (C) since 2004 Garrett Potts 2 | * 3 | * This library is open source and may be redistributed and/or modified under 4 | * the terms of the libwms Public License (WMSGPL) version 0.0 or 5 | * (at your option) any later version. The full license is in LICENSE file 6 | * included with this distribution. 7 | * 8 | * This library is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * libwms Public License for more details. 12 | */ 13 | #ifndef ossimPlanetExport_HEADER 14 | #define ossimPlanetExport_HEADER 15 | // define used to include in API which is being fazed out 16 | // if you can compile your apps with this turned off you are 17 | // well placed for compatablity with future versions. 18 | #define USE_DEPRECATED_API 19 | 20 | #if defined(_MSC_VER) 21 | #pragma warning( disable : 4244 ) 22 | #pragma warning( disable : 4251 ) 23 | #pragma warning( disable : 4267 ) 24 | #pragma warning( disable : 4275 ) 25 | #pragma warning( disable : 4290 ) 26 | #pragma warning( disable : 4786 ) 27 | #pragma warning( disable : 4305 ) 28 | #endif 29 | 30 | #if defined(_MSC_VER) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__) 31 | # ifdef OSSIMPLANET_LIBRARY 32 | # define OSSIMPLANET_EXPORT __declspec(dllexport) 33 | # define OSSIMPLANET_DLL OSSIMPLANET_EXPORT 34 | # else 35 | # define OSSIMPLANET_EXPORT __declspec(dllimport) 36 | # define OSSIMPLANET_DLL OSSIMPLANET_EXPORT 37 | # endif /* OSSIMPLANET_LIBRARY */ 38 | #else 39 | # define OSSIMPLANET_EXPORT 40 | # define OSSIMPLANET_DLL OSSIMPLANET_EXPORT 41 | #endif 42 | 43 | // set up define for whether member templates are supported by VisualStudio compilers. 44 | #ifdef _MSC_VER 45 | # if (_MSC_VER >= 1300) 46 | # define __STL_MEMBER_TEMPLATES 47 | # endif 48 | #endif 49 | 50 | /* Define NULL pointer value */ 51 | 52 | #ifndef NULL 53 | #ifdef __cplusplus 54 | #define NULL 0 55 | #else 56 | #define NULL ((void *)0) 57 | #endif 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/ossimPlanet/netBuffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | PLIB - A Suite of Portable Game Libraries 3 | Copyright (C) 1998,2002 Steve Baker 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | For further information visit http://plib.sourceforge.net 20 | 21 | $Id: netBuffer.cxx 1568 2002-09-02 06:05:49Z sjbaker $ 22 | */ 23 | 24 | #include 25 | 26 | void 27 | netBufferChannel::handleRead (void) 28 | { 29 | int max_read = in_buffer.getMaxLength() - in_buffer.getLength() ; 30 | if (max_read) 31 | { 32 | char* data = in_buffer.getData() + in_buffer.getLength() ; 33 | int num_read = recv (data, max_read) ; 34 | if (num_read > 0) 35 | { 36 | in_buffer.append (num_read) ; 37 | //ulSetError ( UL_DEBUG, "netBufferChannel: %d read", num_read ) ; 38 | } 39 | } 40 | if (in_buffer.getLength()) 41 | { 42 | handleBufferRead (in_buffer); 43 | } 44 | } 45 | 46 | void 47 | netBufferChannel::handleWrite (void) 48 | { 49 | if (out_buffer.getLength()) 50 | { 51 | if (isConnected()) 52 | { 53 | int length = out_buffer.getLength() ; 54 | if (length>512) 55 | length=512; 56 | int num_sent = netChannel::send ( 57 | out_buffer.getData(), length); 58 | if (num_sent > 0) 59 | { 60 | out_buffer.remove (0, num_sent); 61 | //ulSetError ( UL_DEBUG, "netBufferChannel: %d sent", num_sent ) ; 62 | } 63 | } 64 | } 65 | else if (should_close) 66 | { 67 | close(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/ossimPlanet/iochannel.cpp: -------------------------------------------------------------------------------- 1 | // iochannel.cxx -- High level IO channel class 2 | // 3 | // Written by Curtis Olson, started November 1999. 4 | // 5 | // Copyright (C) 1999 Curtis L. Olson - http://www.flightgear.org/~curt 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation; either version 2 of the 10 | // License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | // 21 | // $Id: iochannel.cpp 11616 2007-08-15 18:23:33Z gpotts $ 22 | 23 | 24 | #include 25 | 26 | 27 | // constructor 28 | SGIOChannel::SGIOChannel() 29 | :theReadlineDelimiter('\n') 30 | { 31 | } 32 | 33 | 34 | // destructor 35 | SGIOChannel::~SGIOChannel() 36 | { 37 | } 38 | 39 | 40 | // dummy configure routine 41 | bool SGIOChannel::open( const SGProtocolDir /*d*/ ) { 42 | return false; 43 | } 44 | 45 | 46 | // dummy process routine 47 | int SGIOChannel::read( char * /*buf*/, int /*length*/ ) { 48 | return 0; 49 | } 50 | 51 | 52 | // dummy process routine 53 | int SGIOChannel::readline( char * /*buf*/, int /*length*/ ) { 54 | return 0; 55 | } 56 | 57 | void SGIOChannel::setReadlineDelimiter(char delimiter) 58 | { 59 | theReadlineDelimiter = delimiter; 60 | } 61 | 62 | 63 | // dummy process routine 64 | int SGIOChannel::write( const char * /*buf*/, const int /*length*/ ) { 65 | return false; 66 | } 67 | 68 | 69 | // dummy process routine 70 | int SGIOChannel::writestring( const char * /*str*/ ) { 71 | return false; 72 | } 73 | 74 | 75 | // dummy close routine 76 | bool SGIOChannel::close() { 77 | return false; 78 | } 79 | 80 | 81 | // dummy eof routine 82 | bool SGIOChannel::eof() { 83 | return false; 84 | } 85 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetNodeRegistry.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | ossimPlanetNodeRegistry* ossimPlanetNodeRegistry::theInstance = 0; 5 | ossim_uint32 ossimPlanetNodeRegistry::theInitializeCount = 0; 6 | 7 | 8 | ossimPlanetNodeRegistry::ossimPlanetNodeRegistry() 9 | { 10 | theInstance = this; 11 | } 12 | ossimPlanetNodeRegistry::~ossimPlanetNodeRegistry() 13 | { 14 | theInstance = 0; 15 | } 16 | 17 | ossimPlanetNodeRegistry* ossimPlanetNodeRegistry::instance() 18 | { 19 | if(!theInstance) 20 | { 21 | theInstance = new ossimPlanetNodeRegistry; 22 | theInstance->registerFactory(ossimPlanetNodeFactory::instance()); 23 | } 24 | 25 | return theInstance; 26 | } 27 | 28 | void ossimPlanetNodeRegistry::finalize() 29 | { 30 | } 31 | 32 | ossimPlanetNode* ossimPlanetNodeRegistry::create(const ossimString& type)const 33 | { 34 | ossimPlanetNode* layerNode = 0; 35 | theFactoryListMutex.readLock(); 36 | FactoryListType::const_iterator iter = theFactoryList.begin(); 37 | while((iter != theFactoryList.end())&&(!layerNode)) 38 | { 39 | layerNode = (*iter)->create(type); 40 | ++iter; 41 | } 42 | theFactoryListMutex.readUnlock(); 43 | return layerNode; 44 | } 45 | 46 | bool ossimPlanetNodeRegistry::hasFactory(const ossimPlanetNodeFactoryBase* factory)const 47 | { 48 | FactoryListType::const_iterator iter = std::find(theFactoryList.begin(), 49 | theFactoryList.end(), 50 | factory); 51 | return (iter != theFactoryList.end()); 52 | } 53 | 54 | void ossimPlanetNodeRegistry::registerFactory(ossimPlanetNodeFactoryBase* factory, 55 | bool insertFrontFlag) 56 | { 57 | if(!hasFactory(factory)) 58 | { 59 | theFactoryListMutex.writeLock(); 60 | if(!insertFrontFlag) 61 | { 62 | theFactoryList.push_back(factory); 63 | } 64 | else 65 | { 66 | theFactoryList.insert(theFactoryList.begin(), 67 | factory); 68 | } 69 | theFactoryListMutex.writeUnlock(); 70 | } 71 | } 72 | 73 | void ossimPlanetNodeRegistry::unregisterFactory(const ossimPlanetNodeFactoryBase* factory) 74 | { 75 | theFactoryListMutex.writeLock(); 76 | FactoryListType::iterator iter = std::find(theFactoryList.begin(), 77 | theFactoryList.end(), 78 | factory); 79 | if(iter!=theFactoryList.end()) 80 | { 81 | theFactoryList.erase(iter); 82 | } 83 | theFactoryListMutex.writeUnlock(); 84 | } 85 | -------------------------------------------------------------------------------- /src/ossimPlanet/ulError.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | PLIB - A Suite of Portable Game Libraries 3 | Copyright (C) 1998,2002 Steve Baker 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | For further information visit http://plib.sourceforge.net 20 | 21 | $Id: ulError.cxx 1967 2004-10-02 12:20:43Z wolfram_kuss $ 22 | */ 23 | 24 | 25 | #include 26 | 27 | static char _ulErrorBuffer [ 1024 ] = { '\0' } ; 28 | static ulErrorCallback _ulErrorCB = 0 ; 29 | 30 | static const char* _ulSeverityText [ UL_MAX_SEVERITY ] = 31 | { 32 | "DEBUG", 33 | "WARNING", 34 | "FATAL", 35 | }; 36 | 37 | 38 | void ulSetError ( enum ulSeverity severity, const char *fmt, ... ) 39 | { 40 | va_list argp; 41 | va_start ( argp, fmt ) ; 42 | vsprintf ( _ulErrorBuffer, fmt, argp ) ; 43 | va_end ( argp ) ; 44 | 45 | if ( _ulErrorCB ) 46 | { 47 | (*_ulErrorCB)( severity, _ulErrorBuffer ) ; 48 | } 49 | else 50 | { 51 | fprintf ( stderr, "%s: %s\n", 52 | _ulSeverityText[ severity ], _ulErrorBuffer ) ; 53 | if ( severity == UL_FATAL ) 54 | { 55 | #ifdef WIN32 56 | // A Windows user that does not start the program from the command line 57 | // will not see output to stderr 58 | ::MessageBox(0, _ulErrorBuffer, "fatal error!:", 0); 59 | #endif 60 | exit (1) ; 61 | } 62 | } 63 | } 64 | 65 | 66 | char* ulGetError ( void ) 67 | { 68 | return _ulErrorBuffer ; 69 | } 70 | 71 | 72 | void ulClearError ( void ) 73 | { 74 | _ulErrorBuffer [0] = 0 ; 75 | } 76 | 77 | 78 | ulErrorCallback ulGetErrorCallback ( void ) 79 | { 80 | return _ulErrorCB ; 81 | } 82 | 83 | 84 | void ulSetErrorCallback ( ulErrorCallback cb ) 85 | { 86 | _ulErrorCB = cb ; 87 | } 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetElevationDatabase.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetElevationDatabase_HEADER 2 | #define ossimPlanetElevationDatabase_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | class OSSIMPLANET_DLL ossimPlanetElevationDatabase : public ossimPlanetTextureLayer 13 | { 14 | public: 15 | ossimPlanetElevationDatabase() 16 | :ossimPlanetTextureLayer(), 17 | theFillNullWithGeoidOffsetFlag(false) 18 | {} 19 | ossimPlanetElevationDatabase(const ossimPlanetElevationDatabase& src) 20 | : ossimPlanetTextureLayer(src) 21 | { 22 | } 23 | 24 | virtual osg::ref_ptr getTexture(const ossimPlanetTerrainTileId& tileId, 25 | osg::ref_ptr theGrid); 26 | 27 | virtual ossimPlanetTextureLayerStateCode open(const std::string& location)=0; 28 | 29 | virtual const std::string& getLocation()const 30 | { 31 | return theLocation; 32 | } 33 | bool fillNullWithGeoidOffsetFlag()const 34 | { 35 | return theFillNullWithGeoidOffsetFlag; 36 | } 37 | virtual void setFillNullWithGeoidOffsetFlag(bool flag) 38 | { 39 | theFillNullWithGeoidOffsetFlag = flag; 40 | } 41 | virtual void setGeoRefModel(osg::ref_ptr model) 42 | { 43 | theGeoRefModel = model.get(); 44 | } 45 | ossimPlanetGeoRefModel* geoRefModel()const 46 | { 47 | return theGeoRefModel.get(); 48 | } 49 | virtual void sortByGsd() 50 | { 51 | 52 | } 53 | protected: 54 | /** 55 | * 56 | * destData is always assumed to be 1 band float and both buffers are of the same size. It will make sure it's float before 57 | * merging the src into the destination. This function basically copys good pixels into 58 | * non null regions of the destination. 59 | * 60 | */ 61 | void mergeDataObjects(ossimRefPtr destData, 62 | ossimRefPtr srcData); 63 | 64 | std::string theLocation; 65 | bool theFillNullWithGeoidOffsetFlag; 66 | osg::ref_ptr theGeoRefModel; 67 | }; 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetVideoLayerNode.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetVideoLayerNode_HEADER 2 | #define ossimPlanetVideoLayerNode_HEADER 3 | #include 4 | #include 5 | 6 | class ossimPlanetVideoLayer; 7 | /** 8 | * 9 | * I will eventually have this do the drawing and let the derived classes just populate the geometries. 10 | * For now, I will put the implementation in ossimPlanetPredatorVideoLayerNode and move implementations out 11 | * as we finish and test them. 12 | * 13 | */ 14 | class OSSIMPLANET_DLL ossimPlanetVideoLayerNode : public ossimPlanetAnnotationLayerNode 15 | { 16 | public: 17 | enum Status 18 | { 19 | STATUS_NONE = 0, 20 | STATUS_PLAYING, 21 | STATUS_PAUSED 22 | }; 23 | enum RenderMode 24 | { 25 | RENDER_SCREEN = 0, 26 | RENDER_BILLBOARD = 1, 27 | RENDER_OVERLAY = 2 28 | }; 29 | ossimPlanetVideoLayerNode(ossimPlanetVideoLayer* layer):theLayer(layer){} 30 | virtual ~ossimPlanetVideoLayerNode(){} 31 | virtual bool open(const ossimFilename& file)=0; 32 | 33 | virtual void pause()=0; 34 | virtual void rewind()=0; 35 | virtual void play()=0; 36 | virtual ossim_float64 duration()const=0; 37 | virtual ossimPlanetVideoLayerNode::Status status()const = 0; 38 | virtual void setReferenceTime(ossim_float64 reference)=0; 39 | virtual ossim_float64 referenceTime()const=0; 40 | virtual ossimPlanetVideoLayerNode::RenderMode renderMode()const 41 | { 42 | std::lock_guard lock(theVideoLayerNodeMutex); 43 | return theRenderMode; 44 | } 45 | virtual void setRenderMode(ossimPlanetVideoLayerNode::RenderMode mode) 46 | { 47 | std::lock_guard lock(theVideoLayerNodeMutex); 48 | theRenderMode = mode; 49 | } 50 | 51 | void setVideoLayer(ossimPlanetVideoLayer* layer) 52 | { 53 | std::lock_guard lock(theVideoLayerNodeMutex); 54 | theLayer = layer; 55 | } 56 | ossimPlanetVideoLayer* videoLayer() 57 | { 58 | std::lock_guard lock(theVideoLayerNodeMutex); 59 | return theLayer; 60 | } 61 | const ossimPlanetVideoLayer* videoLayer()const 62 | { 63 | std::lock_guard lock(theVideoLayerNodeMutex); 64 | return theLayer; 65 | } 66 | 67 | protected: 68 | mutable std::recursive_mutex theVideoLayerNodeMutex; 69 | ossimPlanetVideoLayer* theLayer; 70 | ossimPlanetVideoLayerNode::RenderMode theRenderMode; 71 | }; 72 | #endif 73 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetShaderProgramSetup.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetShaderProgramSetup_HEADER 2 | #define ossimPlanetShaderProgramSetup_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | class OSSIMPLANET_DLL ossimPlanetShaderProgramSetup : public osg::Referenced 13 | { 14 | public: 15 | enum ossimPlanetFragmentShaderType 16 | { 17 | NO_SHADER = 0, 18 | TOP, 19 | REFERENCE, 20 | OPACITY, 21 | HORIZONTAL_SWIPE, 22 | VERTICAL_SWIPE, 23 | BOX_SWIPE, 24 | CIRCLE_SWIPE, 25 | ABSOLUTE_DIFFERENCE, 26 | FALSE_COLOR_REPLACEMENT 27 | }; 28 | ossimPlanetShaderProgramSetup(ossim_uint32 minNumberOfTextureArguments=2) 29 | :theMinNumberOfTextureArguments(minNumberOfTextureArguments), 30 | theFragmentShaderType(NO_SHADER) 31 | { 32 | } 33 | void setProgram(osg::Program* program) 34 | { 35 | theProgram = program; 36 | } 37 | osg::Program* getProgram() 38 | { 39 | return theProgram.get(); 40 | } 41 | const osg::Program* getProgram()const 42 | { 43 | return theProgram.get(); 44 | } 45 | ossim_uint32 getNumberOfUniforms()const 46 | { 47 | return theUniformList.size(); 48 | } 49 | osg::ref_ptr getUniform(const ossimString& name); 50 | osg::ref_ptr getUniform(ossim_uint32 idx) 51 | { 52 | if(idx < theUniformList.size()) 53 | { 54 | return theUniformList[idx].get(); 55 | } 56 | 57 | return 0; 58 | } 59 | void clearUniformList() 60 | { 61 | theUniformList.clear(); 62 | } 63 | 64 | void addUniform(osg::Uniform* uniform) 65 | { 66 | theUniformList.push_back(uniform); 67 | } 68 | ossim_uint32 minNumberOfTextureArguments()const 69 | { 70 | return theMinNumberOfTextureArguments; 71 | } 72 | void setFragmentType(ossimPlanetFragmentShaderType fragType) 73 | { 74 | theFragmentShaderType = fragType; 75 | } 76 | ossimPlanetFragmentShaderType fragmentType()const 77 | { 78 | return theFragmentShaderType; 79 | } 80 | protected: 81 | ossim_uint32 theMinNumberOfTextureArguments; 82 | osg::ref_ptr theProgram; 83 | std::vector > theUniformList; 84 | ossimPlanetFragmentShaderType theFragmentShaderType; 85 | }; 86 | #endif 87 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetSocketNetworkConnection.h: -------------------------------------------------------------------------------- 1 | class ossimPlanetSocketNetworkConnection; 2 | #ifndef ossimPlanetSocketNetworkConnection_H 3 | #define ossimPlanetSocketNetworkConnection_H 4 | 5 | #include 6 | #include 7 | #include 8 | // point to point socket connection. 9 | // XXX see bugs below 10 | 11 | #include 12 | /* #include */ 13 | #include "ossimPlanet/ossimPlanetNetworkConnection.h" 14 | 15 | class ossimPlanetSocketNetworkConnection : public ossimPlanetNetworkConnection 16 | { 17 | public: 18 | class ossimPlanetNetSocketRef : public netSocket, 19 | public osg::Referenced 20 | { 21 | public: 22 | ossimPlanetNetSocketRef(){} 23 | virtual ~ossimPlanetNetSocketRef(){} 24 | }; 25 | ossimPlanetSocketNetworkConnection(const std::string& hostname, int port, char delimiter = '\0'); 26 | ~ossimPlanetSocketNetworkConnection(); 27 | 28 | void send(const ossimPlanetAction& a, const std::string& destination); 29 | // XXX doesn't really handle destination correctly 30 | // we don't encode the destination (or the origin) of the sent Action. 31 | // so the remote receiver has to infer origin from which socket he got it off of. 32 | // also the remote receiver can't know the intended destination, since we don't 33 | // encode it and broadcast it to all NetworkConnections. 34 | 35 | void receive(); 36 | // XXX doesn't yet handle broadcast semantics or destination correctly. 37 | // XXX our protocol here doesn't support origin names, so we just use 38 | // the NetworkConnection name as the originating federate name. 39 | 40 | protected: 41 | void attemptToFlushOutBuffer(); 42 | // if outBuffer_ is not empty, write() as much of it as possible and remove the written part from outBuffer_ 43 | // assert(socket_ >= 0) 44 | 45 | // osg::ref_ptr theSocket; 46 | osg::ref_ptr theSocket; 47 | char actionDelimiter_; 48 | // character that marks end of action. usually \n or \0 49 | 50 | std::string inBuffer_; 51 | // buffer for accumulating incoming Actions 52 | 53 | std::string outBuffer_; 54 | // buffer for accumulating outgoing Actions, in the case of write() failing somehow. 55 | 56 | 57 | #if 0 58 | int socket_; 59 | // socket descriptor 60 | 61 | struct timeval timeout_; 62 | // select() timeout structure 63 | 64 | #endif 65 | }; 66 | 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetThreadPool.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | unsigned int ossimPlanetThreadPool::theMaxThreads = 32; 6 | 7 | osg::ref_ptr ossimPlanetThreadPool::theInstance = 0; 8 | osg::ref_ptr ossimPlanetThreadPool::instance() 9 | { 10 | if(!theInstance) 11 | { 12 | theInstance = new ossimPlanetThreadPool; 13 | } 14 | return theInstance; 15 | } 16 | 17 | ossimPlanetThreadPool::ossimPlanetThreadPool() 18 | { 19 | theInstance = this; 20 | } 21 | 22 | unsigned int ossimPlanetThreadPool::totalThreads()const 23 | { 24 | return theAvailableList.size()+theUnavailableList.size(); 25 | } 26 | 27 | 28 | void ossimPlanetThreadPool::makeAvailable(osg::ref_ptr thread) 29 | { 30 | ossimPlanetThreadImp* imp = thread->implementation(); 31 | bool pooled = false; 32 | { 33 | std::lock_guard lock(theListMutex); 34 | std::vector >::iterator iter = std::find(theUnavailableList.begin(), 35 | theUnavailableList.end(), 36 | thread); 37 | if(iter!=theUnavailableList.end()) 38 | { 39 | pooled = true; 40 | theUnavailableList.erase(iter); 41 | thread->setImplementation(0); 42 | theAvailableList.push_back(thread); 43 | } 44 | } 45 | if(pooled) 46 | { 47 | imp->threadPooled(); 48 | } 49 | 50 | 51 | } 52 | 53 | osg::ref_ptr ossimPlanetThreadPool::nextAvailable() 54 | { 55 | osg::ref_ptr thread = NULL; 56 | std::lock_guard lock(theListMutex); 57 | if(theAvailableList.size() < 1) 58 | { 59 | if(totalThreads() < theMaxThreads) 60 | { 61 | osg::ref_ptr thread = new ossimPlanetThread; 62 | thread->setThreadPool(this); 63 | theAvailableList.push_back(thread); 64 | } 65 | else 66 | { 67 | return thread; 68 | } 69 | } 70 | if(theAvailableList.size() > 0) 71 | { 72 | thread = theAvailableList[theAvailableList.size()-1]; 73 | theAvailableList.pop_back(); 74 | theUnavailableList.push_back(thread); 75 | } 76 | 77 | return thread; 78 | } 79 | 80 | void ossimPlanetThreadPool::setMaxThread(int maxThreads) 81 | { 82 | theMaxThreads = maxThreads; 83 | } 84 | -------------------------------------------------------------------------------- /schema/AnimationPath.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetTexture2D.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | //#define OSGPLANET_ENABLE_ALLOCATION_COUNT 6 | #ifdef OSGPLANET_ENABLE_ALLOCATION_COUNT 7 | static std::mutex objectCountMutex; 8 | static ossim_uint32 textureCount = 0; 9 | #endif 10 | #include 11 | ossimPlanetTexture2D::ossimPlanetTexture2D(const ossimPlanetTerrainTileId& id) 12 | 13 | :osg::Texture2D(), 14 | theTileId(id) 15 | { 16 | #ifdef OSGPLANET_ENABLE_ALLOCATION_COUNT 17 | std::lock_guard lock(objectCountMutex); 18 | ++textureCount; 19 | std::cout << "ossimPlanetTexture2D count = " << textureCount << "\n"; 20 | #endif 21 | } 22 | 23 | ossimPlanetTexture2D::ossimPlanetTexture2D(osg::Image* image, 24 | const ossimPlanetTerrainTileId& id) 25 | :osg::Texture2D(image), 26 | theTileId(id) 27 | { 28 | #ifdef OSGPLANET_ENABLE_ALLOCATION_COUNT 29 | std::lock_guard lock(objectCountMutex); 30 | ++textureCount; 31 | std::cout << "ossimPlanetTexture2D count = " << textureCount << "\n"; 32 | #endif 33 | } 34 | ossimPlanetTexture2D::ossimPlanetTexture2D(ossimPlanetImage* image) 35 | :osg::Texture2D(image), 36 | theTileId(image?image->tileId():ossimPlanetTerrainTileId()) 37 | { 38 | #ifdef OSGPLANET_ENABLE_ALLOCATION_COUNT 39 | std::lock_guard lock(objectCountMutex); 40 | ++textureCount; 41 | std::cout << "ossimPlanetTexture2D count = " << textureCount << "\n"; 42 | #endif 43 | } 44 | 45 | ossimPlanetTexture2D::ossimPlanetTexture2D(const ossimPlanetTexture2D& text,const osg::CopyOp& copyop) 46 | :osg::Texture2D(text, copyop) 47 | { 48 | #ifdef OSGPLANET_ENABLE_ALLOCATION_COUNT 49 | std::lock_guard lock(objectCountMutex); 50 | ++textureCount; 51 | std::cout << "ossimPlanetTexture2D count = " << textureCount << "\n"; 52 | #endif 53 | } 54 | 55 | ossimPlanetTexture2D::~ossimPlanetTexture2D() 56 | { 57 | #ifdef OSGPLANET_ENABLE_ALLOCATION_COUNT 58 | std::lock_guard lock(objectCountMutex); 59 | --textureCount; 60 | std::cout << "ossimPlanetTexture2D count = " << textureCount << "\n"; 61 | #endif 62 | } 63 | 64 | void ossimPlanetTexture2D::setImage(ossimPlanetImage* image) 65 | { 66 | if(image) 67 | { 68 | setId(image->tileId()); 69 | } 70 | 71 | osg::Texture2D::setImage(image); 72 | } 73 | 74 | void ossimPlanetTexture2D::setId(const ossimPlanetTerrainTileId& id) 75 | { 76 | theTileId = id; 77 | } 78 | 79 | const ossimPlanetTerrainTileId& ossimPlanetTexture2D::tileId()const 80 | { 81 | return theTileId; 82 | } 83 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetDatabasePager.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetDatabasePager_HEADER 2 | #define ossimPlanetDatabasePager_HEADER 3 | #include 4 | #include 5 | //#include 6 | #include 7 | 8 | class OSSIMPLANET_DLL ossimPlanetDatabasePager : public osgDB::DatabasePager 9 | { 10 | public: 11 | ossimPlanetDatabasePager(); 12 | virtual DatabasePager* clone() const { return new ossimPlanetDatabasePager(*this); } 13 | #if 0 14 | virtual bool isRunning() const; 15 | 16 | virtual void signalBeginFrame(const osg::FrameStamp* framestamp); 17 | virtual void signalEndFrame(); 18 | virtual void updateSceneGraph(const osg::FrameStamp& frameStamp); 19 | virtual void compileGLObjects(osg::State& state,double& availableTime); 20 | virtual void compileAllGLObjects(osg::State& state); 21 | 22 | #endif 23 | #if 0 24 | class Callback : public osg::Referenced 25 | { 26 | public: 27 | Callback(){} 28 | virtual void updateSceneGraph(){} 29 | virtual void noMoreWork(){} 30 | virtual void doingWork(){} 31 | }; 32 | typedef std::vector > CallbackListType; 33 | ossimPlanetDatabasePager(); 34 | virtual DatabasePager* clone() const { return new ossimPlanetDatabasePager(*this); } 35 | virtual ~ossimPlanetDatabasePager(); 36 | virtual void run(); 37 | virtual int cancel(); 38 | virtual void invalidateRequest(const std::string& requestString); 39 | virtual void requestNodeFile(const std::string& fileName,osg::Group* group, float priority, const osg::FrameStamp* framestamp); 40 | bool listsAreEmpty()const; 41 | 42 | void addCallback(osg::ref_ptr callback); 43 | void removeCallback(osg::ref_ptr callback); 44 | void removeRequest(osg::Group* group); 45 | void addToDeleteList(osg::Object* obj); 46 | void clearRequests(); 47 | virtual void updateSceneGraph(double currentFrameTime); 48 | 49 | class MyFindCompileableGLObjectsVisitor; 50 | struct MySortFileRequestFunctor; 51 | struct MyCompileOperation; 52 | friend struct MyCompileOperation; 53 | friend struct MySortFileRequestFunctor; 54 | friend class MyFindCompileableGLObjectsVisitor; 55 | #endif 56 | 57 | protected: 58 | #if 0 59 | void notifyDoingWork(); 60 | void notifyNoMoreWork(); 61 | void notifyUpdateSceneGraph(); 62 | std::recursive_mutex theCallbackListMutex; 63 | ossimPlanetDatabasePager::CallbackListType theCallbackList; 64 | // SceneNotificationCallbackListType theCallbackList; 65 | #endif 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetLayerRegistry.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | ossimPlanetLayerRegistry* ossimPlanetLayerRegistry::theInstance = 0; 5 | ossimPlanetLayerRegistry::ossimPlanetLayerRegistry() 6 | { 7 | theInstance = this; 8 | } 9 | 10 | ossimPlanetLayerRegistry::~ossimPlanetLayerRegistry() 11 | { 12 | theInstance = 0; 13 | } 14 | 15 | ossimPlanetLayerRegistry* ossimPlanetLayerRegistry::instance() 16 | { 17 | if(!theInstance) 18 | { 19 | theInstance = new ossimPlanetLayerRegistry; 20 | theInstance->registerFactory(ossimPlanetLayerFactory::instance()); 21 | } 22 | 23 | return theInstance; 24 | } 25 | 26 | void ossimPlanetLayerRegistry::finalize() 27 | { 28 | if(theInstance) 29 | { 30 | theFactoryList.clear(); 31 | 32 | delete theInstance; 33 | theInstance = 0; 34 | } 35 | } 36 | 37 | ossimPlanetLayer* ossimPlanetLayerRegistry::create(const ossimString& layerName)const 38 | { 39 | ossimPlanetLayer* result = 0; 40 | ossim_uint32 idx = 0; 41 | theFactoryListMutex.readLock(); 42 | for(idx = 0; ((idx < theFactoryList.size())&&(!result)); ++idx) 43 | { 44 | result = theFactoryList[idx]->create(layerName); 45 | } 46 | theFactoryListMutex.readUnlock(); 47 | 48 | return result; 49 | } 50 | 51 | void ossimPlanetLayerRegistry::registerFactory(ossimPlanetLayerFactoryBase* factory, 52 | bool insertFrontFlag) 53 | { 54 | if(!hasFactory(factory)) 55 | { 56 | theFactoryListMutex.writeLock(); 57 | if(!insertFrontFlag) 58 | { 59 | theFactoryList.push_back(factory); 60 | } 61 | else 62 | { 63 | theFactoryList.insert(theFactoryList.begin(), factory); 64 | } 65 | theFactoryListMutex.writeUnlock(); 66 | } 67 | } 68 | 69 | void ossimPlanetLayerRegistry::unregisterFactory(const ossimPlanetLayerFactoryBase* factory) 70 | { 71 | theFactoryListMutex.writeLock(); 72 | FactoryListType::iterator iter = std::find(theFactoryList.begin(), 73 | theFactoryList.end(), 74 | factory); 75 | if(iter != theFactoryList.end()) 76 | { 77 | theFactoryList.erase(iter); 78 | } 79 | theFactoryListMutex.writeUnlock(); 80 | } 81 | 82 | bool ossimPlanetLayerRegistry::hasFactory(const ossimPlanetLayerFactoryBase* factory)const 83 | { 84 | FactoryListType::const_iterator iter = std::find(theFactoryList.begin(), 85 | theFactoryList.end(), 86 | factory); 87 | 88 | return (iter!=theFactoryList.end()); 89 | } 90 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetGeocoder.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | static std::istream& geocoderskipws(std::istream& in) 5 | { 6 | int c = in.peek(); 7 | while((c == ' ') || 8 | (c == '\t') || 9 | (c == '\n')|| 10 | (c == '\r')) 11 | { 12 | in.ignore(1); 13 | c = in.peek(); 14 | } 15 | 16 | return in; 17 | } 18 | ossimPlanetGoecoder::ossimPlanetGeocoderLocation::ossimPlanetGeocoderLocation() 19 | { 20 | theMetaInformation = new ossimXmlNode; 21 | theMetaInformation->setTag("kml"); 22 | theNameNode = new ossimXmlNode; 23 | theNameNode->setTag("name"); 24 | theMetaInformation->addChildNode(theNameNode.get()); 25 | thePlacemarkNode = new ossimXmlNode; 26 | thePlacemarkNode->setTag("Placemark"); 27 | theMetaInformation->addChildNode(thePlacemarkNode.get()); 28 | theAddressNode = new ossimXmlNode; 29 | theAddressNode->setTag("Address"); 30 | thePointNode = new ossimXmlNode; 31 | theCoordinatesNode = new ossimXmlNode; 32 | theCoordinatesNode->setText("0.0, 0.0, 0.0"); 33 | thePointNode->addChildNode(theCoordinatesNode.get()); 34 | 35 | theMetaInformation->addChildNode(theNameNode.get()); 36 | theMetaInformation->addChildNode(thePlacemarkNode.get()); 37 | theMetaInformation->addChildNode(theAddressNode.get()); 38 | theMetaInformation->addChildNode(thePointNode.get()); 39 | } 40 | 41 | void ossimPlanetGoecoder::ossimPlanetGeocoderLocation::setLocation(const ossimGpt& location) 42 | { 43 | theCoordinatesNode->setText(ossimString::toString(location.latd())+ "," + 44 | ossimString::toString(location.lond())+ ", 0.0"); 45 | 46 | } 47 | 48 | ossimGpt ossimPlanetGoecoder::ossimPlanetGeocoderLocation::getLocation()const 49 | { 50 | ossimGpt result; 51 | std::istringstream in(theCoordinatesNode->getText()); 52 | 53 | char c; 54 | double lat, lon; 55 | 56 | in >> lat >> geocoderskipws >> c >> geocoderskipws >>lon; 57 | result.latd(lat); 58 | result.lond(lon); 59 | 60 | return result; 61 | } 62 | 63 | void ossimPlanetGoecoder::ossimPlanetGeocoderLocation::setName(const ossimString& name) 64 | { 65 | theNameNode->setText(name); 66 | } 67 | 68 | ossimString ossimPlanetGoecoder::ossimPlanetGeocoderLocation::getName()const 69 | { 70 | return theNameNode->getText(); 71 | } 72 | 73 | ossimString ossimPlanetGoecoder::ossimPlanetGeocoderLocation::getAddress()const 74 | { 75 | return theAddressNode->getText(); 76 | } 77 | 78 | void ossimPlanetGoecoder::ossimPlanetGeocoderLocation::setAddress(const ossimString& address) 79 | { 80 | theAddressNode->setText(address); 81 | } 82 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetGeocoder.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetGeocoder_HEADER 2 | #define ossimPlanetGeocoder_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class OSSIMPLANET_DLL ossimPlanetGoecoder : public osg::Referenced 12 | { 13 | public: 14 | class OSSIMPLANET_DLL ossimPlanetGeocoderLocation : public osg::Referenced 15 | { 16 | public: 17 | ossimPlanetGeocoderLocation(); 18 | 19 | void setLocation(const ossimGpt& location); 20 | ossimGpt getLocation()const; 21 | void setName(const ossimString& name); 22 | ossimString getName()const; 23 | void setAddress(const ossimString& address); 24 | ossimString getAddress()const; 25 | 26 | protected: 27 | ossimRefPtr theMetaInformation; // modeled after the GOOGLE KML 28 | ossimRefPtr theNameNode; 29 | ossimRefPtr thePlacemarkNode; 30 | ossimRefPtr theAddressNode; 31 | ossimRefPtr thePointNode; 32 | ossimRefPtr theCoordinatesNode; 33 | }; 34 | virtual void getLocationFromAddress(std::vector >& result, 35 | const ossimString& address, 36 | const ossimString& city, 37 | const ossimString& state, 38 | const ossimString& zip, 39 | const ossimString& /*country*/)const 40 | { 41 | ossimString location; 42 | if(!address.trim().empty()) 43 | { 44 | location += address; 45 | } 46 | 47 | if(!city.trim().empty()) 48 | { 49 | if(!location.empty()) 50 | { 51 | location += ","; 52 | } 53 | location += city; 54 | } 55 | 56 | if(!state.trim().empty()) 57 | { 58 | if(!location.empty()) 59 | { 60 | location += ","; 61 | } 62 | location += state; 63 | } 64 | 65 | if(!zip.trim().empty()) 66 | { 67 | if(!location.empty()) 68 | { 69 | location += ","; 70 | } 71 | location += zip; 72 | } 73 | 74 | getLocationFromAddress(result, location); 75 | 76 | } 77 | virtual void getLocationFromAddress(std::vector >& result, 78 | const ossimString& location)const=0; 79 | 80 | }; 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetTerrainTileId.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetTerrainTileId_HEADER 2 | #define ossimPlanetTerrainTileId_HEADER 3 | #include 4 | #include 5 | 6 | class OSSIMPLANET_DLL ossimPlanetTerrainTileId 7 | { 8 | public: 9 | friend std::ostream& operator <<(std::ostream& out, const ossimPlanetTerrainTileId& tileid) 10 | { 11 | return out << "<" << tileid.theFace <<", " << tileid.theLevel << ", " << tileid.theX << ", " << tileid.theY << ">"; 12 | } 13 | ossimPlanetTerrainTileId() 14 | :theFace(0), 15 | theLevel(0), 16 | theX(0), 17 | theY(0) 18 | { 19 | setId(0,0,0,0); 20 | } 21 | ossimPlanetTerrainTileId(ossim_uint32 face, ossim_uint32 level, ossim_uint64 x, ossim_uint64 y) 22 | { 23 | setId(face, level, x, y); 24 | } 25 | bool operator == (const ossimPlanetTerrainTileId& rhs) const 26 | { 27 | return (theLevel==rhs.theLevel) && (theX==rhs.theX) && (theY==rhs.theY) && (theFace == rhs.theFace); 28 | } 29 | 30 | bool operator != (const ossimPlanetTerrainTileId& rhs) const 31 | { 32 | return (theLevel!=rhs.theLevel) || (theX!=rhs.theX) || (theY!=rhs.theY) || (theFace != rhs.theFace); 33 | } 34 | 35 | bool operator < (const ossimPlanetTerrainTileId& rhs) const 36 | { 37 | if (theLevelrhs.theLevel) return false; 39 | if (theXrhs.theX) return false; 41 | if (theYrhs.theY) return false; 43 | return theFace 4 | #include 5 | #include 6 | #include 7 | 8 | class OSSIMPLANET_DLL ossimPlanetXmlAction : public ossimPlanetAction 9 | { 10 | public: 11 | ossimPlanetXmlAction(const ossimString& code = ossimString(), 12 | const ossimString& originatingFederate = defaultOrigin()); 13 | ossimPlanetXmlAction(ossimRefPtr node, 14 | const ossimString& originatingFederate = defaultOrigin()); 15 | ossimPlanetXmlAction(const ossimPlanetXmlAction& src) 16 | :ossimPlanetAction(src), 17 | theXmlNode(src.theXmlNode.valid()?(ossimXmlNode*)src.theXmlNode->dup():(ossimXmlNode*)0) 18 | { 19 | 20 | } 21 | virtual ossimPlanetAction* clone()const 22 | { 23 | return new ossimPlanetXmlAction(*this); 24 | } 25 | virtual ossimPlanetAction* cloneType()const 26 | { 27 | return new ossimPlanetXmlAction(); 28 | } 29 | virtual ossimPlanetXmlAction* toXmlAction() 30 | { 31 | return this; 32 | } 33 | virtual const ossimPlanetXmlAction* toXmlAction()const 34 | { 35 | return this; 36 | } 37 | virtual void setTarget(const ossimString& value); 38 | virtual void setCommand(const ossimString& value); 39 | 40 | /** 41 | * Will allow one to set the source code for the derived actions 42 | * 43 | */ 44 | virtual bool setSourceCode(const ossimString& code); 45 | ossimRefPtr xmlNode() 46 | { 47 | return theXmlNode; 48 | } 49 | const ossimRefPtr xmlNode()const 50 | { 51 | return theXmlNode; 52 | } 53 | void setXmlNode(ossimRefPtr code); 54 | 55 | /** 56 | * Utility method for accessing the attribute id of the Action. 57 | */ 58 | ossimString id()const; 59 | ossimString name()const; 60 | 61 | /** 62 | * Utility method to duplicte a child of the action and maintain the same action parameters 63 | */ 64 | osg::ref_ptr duplicateChildAndMaintainAction(ossim_uint32 childIdx)const; 65 | 66 | /** 67 | * Utility method to duplicate the child properties and promote them as the children of the Action. 68 | * This is typically used when doing a set Action on a node. The properties are promoted for the set actions 69 | * 70 | */ 71 | osg::ref_ptr duplicateChildPropertiesAndMaintainAction(ossim_uint32 childIdx)const; 72 | 73 | bool hasChildren()const; 74 | virtual void print(std::ostream& out)const; 75 | virtual void read(std::istream& in); 76 | 77 | protected: 78 | ossimRefPtr theXmlNode; 79 | }; 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /examples/ossimplanetinfo/ossimplanetinfo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #ifdef OSSIMPLANET_ENABLE_PREDATOR 6 | #include 7 | #include 8 | 9 | bool printPredatorInfo(const ossimFilename& file, std::ostream& out) 10 | { 11 | out << std::setprecision(20); 12 | bool result = false; 13 | ossimRefPtr video = new ossimPredatorVideo(); 14 | ossimRefPtr frameInfo; 15 | result = video->open(file); 16 | if(result) 17 | { 18 | // look at the first couple of seconds worth of video to find a klv stream 19 | // 20 | ossim_uint32 maxFramesToCheck = video->videoFrameRate()*2; 21 | bool foundInfo = false; 22 | ossim_uint32 frameCount=0; 23 | while((!foundInfo)&& 24 | (frameCount <= maxFramesToCheck)&& 25 | ((frameInfo = video->nextFrame()).valid())) 26 | { 27 | ++frameCount; 28 | ossimRefPtr klvTable = frameInfo->klvTable(); 29 | if(klvTable.valid()) 30 | { 31 | ossimGpt ulg, urg, lrg, llg; 32 | ossimString prefix = "video0.frame0."; 33 | foundInfo = klvTable->getCornerPoints(ulg, urg, lrg, llg); 34 | if(!foundInfo) 35 | { 36 | ossim_float64 lat, lon, elev; 37 | 38 | foundInfo = klvTable->getFrameCenter(lat, lon, elev); 39 | if(foundInfo) 40 | { 41 | ulg = ossimGpt(lat, lon, elev); 42 | urg = ulg; 43 | lrg = ulg; 44 | llg = ulg; 45 | } 46 | } 47 | if(foundInfo) 48 | { 49 | out << "video0.type: ossimPredatorVideo\n" 50 | << prefix << "ul_lat: " << ulg.latd() << "\n" 51 | << prefix << "ul_lon: " << ulg.lond() << "\n" 52 | << prefix << "ur_lat: " << urg.latd() << "\n" 53 | << prefix << "ur_lon: " << urg.lond() << "\n" 54 | << prefix << "lr_lat: " << lrg.latd() << "\n" 55 | << prefix << "lr_lon: " << lrg.lond() << "\n" 56 | << prefix << "ll_lat: " << llg.latd() << "\n" 57 | << prefix << "ll_lon: " << llg.lond() << "\n"; 58 | } 59 | } 60 | } 61 | } 62 | return result; 63 | } 64 | #endif 65 | 66 | 67 | bool printVideoInfo(const ossimFilename& file, std::ostream& out) 68 | { 69 | bool result = false; 70 | #ifdef OSSIMPLANET_ENABLE_PREDATOR 71 | result = printPredatorInfo(file, out); 72 | #endif 73 | 74 | return result; 75 | } 76 | 77 | int main(int argc, char* argv[]) 78 | { 79 | ossimInit::instance()->initialize(argc, argv); 80 | 81 | if(argc < 2) 82 | { 83 | std::cout << "Usage: " << argv[0] << " " << std::endl; 84 | return 0; 85 | } 86 | ossimFilename file(argv[1]); 87 | if(printVideoInfo(file, std::cout)) 88 | { 89 | return 0; 90 | } 91 | 92 | return 0; 93 | } 94 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetDestinationCommandAction.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetDestinationCommandAction_HEADER 2 | #define ossimPlanetDestinationCommandAction_HEADER 3 | #include 4 | #include 5 | 6 | class OSSIMPLANET_DLL ossimPlanetDestinationCommandAction : public ossimPlanetAction 7 | { 8 | public: 9 | ossimPlanetDestinationCommandAction(const ossimString& sourcecode = ossimString(), 10 | const ossimString& originatingFederate = defaultOrigin()); 11 | ossimPlanetDestinationCommandAction(const ossimPlanetDestinationCommandAction& src) 12 | :ossimPlanetAction(src), 13 | theTokens(src.theTokens), 14 | theArgCount(src.theArgCount) 15 | { 16 | } 17 | virtual ossimPlanetDestinationCommandAction* toDestinationCommandAction() 18 | { 19 | return this; 20 | } 21 | virtual const ossimPlanetDestinationCommandAction* toDestinationCommandAction()const 22 | { 23 | return this; 24 | } 25 | virtual ossimPlanetAction* clone()const 26 | { 27 | return new ossimPlanetDestinationCommandAction(*this); 28 | } 29 | virtual ossimPlanetAction* cloneType()const 30 | { 31 | return new ossimPlanetDestinationCommandAction(); 32 | } 33 | ossimString argListSourceCode() const; 34 | virtual bool setSourceCode(const ossimString& code); 35 | 36 | virtual void setTarget(const ossimString& targetPath) 37 | { 38 | ossimPlanetAction::setTarget(targetPath); 39 | if(theTokens.size()) 40 | { 41 | theTokens[0] = targetPath.string(); 42 | } 43 | } 44 | 45 | virtual void setCommand(const ossimString& value) 46 | { 47 | ossimPlanetAction::setCommand(value); 48 | if(theTokens.size()>1) 49 | { 50 | theTokens[1] = value.string(); 51 | } 52 | } 53 | unsigned int argCount() const 54 | { 55 | return theArgCount; 56 | } 57 | 58 | const std::string& arg(unsigned int i) const 59 | { 60 | assert(i >= 1 && i <= argCount()); 61 | return theTokens[i+1]; 62 | } 63 | void setTargetCommandArg(const ossimString& target, 64 | const ossimString& command, 65 | const ossimString& arg) 66 | { 67 | theArgCount = 1; 68 | theTokens.resize(3); 69 | theTokens[0] = target.string(); 70 | theTokens[1] = command.string(); 71 | theTokens[2] = arg.string(); 72 | } 73 | ossimString argListSource() const; 74 | // source code of the argument list 75 | virtual void print(std::ostream& out)const; 76 | virtual void read(std::istream& in); 77 | 78 | protected: 79 | std::vector theTokens; 80 | unsigned int theArgCount; 81 | 82 | static const char theWhitespace[]; 83 | // characters considered to be whitespace 84 | }; 85 | #endif 86 | -------------------------------------------------------------------------------- /include/ossimPlanet/ioapi.h: -------------------------------------------------------------------------------- 1 | /* ioapi.h -- IO base function header for compress/uncompress .zip 2 | files using zlib + zip or unzip API 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | */ 8 | 9 | #ifndef _ZLIBIOAPI_H 10 | #define _ZLIBIOAPI_H 11 | 12 | 13 | #define ZLIB_FILEFUNC_SEEK_CUR (1) 14 | #define ZLIB_FILEFUNC_SEEK_END (2) 15 | #define ZLIB_FILEFUNC_SEEK_SET (0) 16 | 17 | #define ZLIB_FILEFUNC_MODE_READ (1) 18 | #define ZLIB_FILEFUNC_MODE_WRITE (2) 19 | #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) 20 | 21 | #define ZLIB_FILEFUNC_MODE_EXISTING (4) 22 | #define ZLIB_FILEFUNC_MODE_CREATE (8) 23 | 24 | 25 | #ifndef ZCALLBACK 26 | 27 | #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) 28 | #define ZCALLBACK CALLBACK 29 | #else 30 | #define ZCALLBACK 31 | #endif 32 | #endif 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); 39 | typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 40 | typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); 41 | typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); 42 | typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); 43 | typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); 44 | typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); 45 | 46 | typedef struct zlib_filefunc_def_s 47 | { 48 | open_file_func zopen_file; 49 | read_file_func zread_file; 50 | write_file_func zwrite_file; 51 | tell_file_func ztell_file; 52 | seek_file_func zseek_file; 53 | close_file_func zclose_file; 54 | testerror_file_func zerror_file; 55 | voidpf opaque; 56 | } zlib_filefunc_def; 57 | 58 | 59 | 60 | void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 61 | 62 | #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size)) 63 | #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size)) 64 | #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream)) 65 | #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode)) 66 | #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream)) 67 | #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream)) 68 | 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetAnnotationLayer.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetAnnotationLayer_HEADER 2 | #define ossimPlanetAnnotationLayer_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | class OSSIMPLANET_DLL ossimPlanetAnnotationLayer : public ossimPlanetLayer 15 | { 16 | public: 17 | class Stager : public ossimPlanetOperation 18 | { 19 | public: 20 | Stager(ossimPlanetAnnotationLayerNode* node) 21 | :theNode(node) 22 | { 23 | 24 | } 25 | virtual void run() 26 | { 27 | if(theNode.valid()) 28 | { 29 | theNode->stage(); 30 | } 31 | } 32 | protected: 33 | osg::ref_ptr theNode; 34 | }; 35 | ossimPlanetAnnotationLayer(); 36 | virtual ~ossimPlanetAnnotationLayer(); 37 | virtual osg::Object* cloneType() const { return new ossimPlanetAnnotationLayer(); } 38 | virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=0; } 39 | virtual const char* className() const { return "ossimPlanetAnnotationLayer"; } 40 | virtual const char* libraryName() const { return "ossimPlanet"; } 41 | virtual void traverse(osg::NodeVisitor& nv); 42 | virtual void execute(const ossimPlanetAction& a); 43 | osg::ref_ptr defaultIconTexture() 44 | { 45 | return theDefaultIconTexture; 46 | } 47 | osg::ref_ptr defaultFont() 48 | { 49 | return theDefaultFont.get(); 50 | } 51 | const osg::ref_ptr defaultFont()const 52 | { 53 | return theDefaultFont.get(); 54 | } 55 | void removeByNameAndId(const ossimString& name, const ossimString& id); 56 | 57 | osg::ref_ptr stagingThreadQueue() 58 | { 59 | return theStagingThreadQueue; 60 | } 61 | osg::ref_ptr updateThreadQueue() 62 | { 63 | return theUpdateThreadQueue; 64 | } 65 | protected: 66 | virtual void nodeAdded(osg::Node* node); 67 | virtual void nodeRemoved(osg::Node* node); 68 | virtual void needsRemoving(osg::Node* node); 69 | osg::ref_ptr theDefaultFont; 70 | osg::ref_ptr theDefaultIconImage; 71 | osg::ref_ptr theDefaultIconTexture; 72 | mutable std::recursive_mutex theGraphMutex; 73 | 74 | 75 | mutable std::recursive_mutex theNodesToRemoveListMutex; 76 | NodeListType theNodesToRemoveList; 77 | 78 | osg::ref_ptr theStagingThreadQueue; 79 | osg::ref_ptr theUpdateThreadQueue; 80 | 81 | }; 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetFadeText.h: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 | * 3 | * This library is open source and may be redistributed and/or modified under 4 | * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 | * (at your option) any later version. The full license is in LICENSE file 6 | * included with this distribution, and on the openscenegraph.org website. 7 | * 8 | * This library is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * OpenSceneGraph Public License for more details. 12 | */ 13 | 14 | #ifndef ossimPlanetFadeText_HEADER 15 | #define ossimPlanetFadeText_HEADER 1 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | class OSSIMPLANET_DLL ossimPlanetFadeText : public osgText::Text 22 | { 23 | public: 24 | ossimPlanetFadeText(); 25 | ossimPlanetFadeText(const Text& text,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); 26 | 27 | META_Object(osgText, ossimPlanetFadeText) 28 | 29 | 30 | /** 31 | * Set the speed that the alpha value changes as the text is occluded or becomes visible. 32 | * 33 | */ 34 | void setFadeSpeed(float speed) { theFadeSpeed = speed; } 35 | float fadeSpeed()const{return theFadeSpeed;} 36 | void setVisibleFlag(bool visible){theVisibleFlag = visible;} 37 | bool visibleFlag()const{return theVisibleFlag;} 38 | float opacity()const{return theCurrentOpacity;} 39 | void setOpacity(float value){theCurrentOpacity = value;} 40 | void setClusterCullingCallback(osg::ref_ptr callback) 41 | { 42 | theClusterCull = callback; 43 | } 44 | osg::ref_ptr clusterCullingCallback() 45 | { 46 | return theClusterCull; 47 | } 48 | const osg::ref_ptr clusterCullingCallback()const 49 | { 50 | return theClusterCull; 51 | } 52 | /** Draw the text.*/ 53 | virtual void drawImplementation(osg::RenderInfo& renderInfo) const; 54 | 55 | protected: 56 | 57 | virtual ~ossimPlanetFadeText() {} 58 | 59 | void init(); 60 | 61 | struct FadeTextUpdateCallback; 62 | struct FadeTextCullCallback; 63 | friend struct FadeTextUpdateCallback; 64 | friend struct FadeTextCullCallback; 65 | 66 | float theFadeSpeed; 67 | float theCurrentOpacity; 68 | bool theVisibleFlag; 69 | ossim_uint32 theFrameNumber; 70 | osg::ref_ptr theClusterCull; 71 | 72 | osg::Vec4d theForegroundColor; 73 | osg::Vec4d theBackgroundColor; 74 | // mutable ViewBlendColourMap _viewBlendColourMap; 75 | }; 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetVisitors.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void ossimPlanetLayerNameIdSearchVisitor::apply(osg::Node& node) 6 | { 7 | ossimPlanetLayer* layer = dynamic_cast(&node); 8 | ossimPlanetNode* layerNode = dynamic_cast(&node); 9 | 10 | if(theId.empty() && theName.empty()) return; 11 | 12 | if(layer) 13 | { 14 | if(!theName.empty()&&!theId.empty()) 15 | { 16 | if((layer->name() == theName)&& 17 | (layer->id() == theId)) 18 | { 19 | theNode = &node; 20 | } 21 | } 22 | else if(!theName.empty()) 23 | { 24 | if(layer->name() == theName) 25 | { 26 | theNode = &node; 27 | } 28 | 29 | } 30 | else if(!theId.empty()) 31 | { 32 | if(layer->id() == theId) 33 | { 34 | theNode = &node; 35 | } 36 | } 37 | } 38 | else if(layerNode) 39 | { 40 | if(!theName.empty()&&!theId.empty()) 41 | { 42 | if((layerNode->name() == theName)&& 43 | (layerNode->id() == theId)) 44 | { 45 | theNode = &node; 46 | } 47 | } 48 | else if(!theName.empty()) 49 | { 50 | if(layerNode->name() == theName) 51 | { 52 | theNode = &node; 53 | } 54 | 55 | } 56 | else if(!theId.empty()) 57 | { 58 | if(layerNode->id() == theId) 59 | { 60 | theNode = &node; 61 | } 62 | } 63 | } 64 | if(theNode.valid()) return; 65 | traverse(node); 66 | }; 67 | 68 | ossimPlanetUpdateVisitor::ossimPlanetUpdateVisitor() 69 | :osgUtil::UpdateVisitor(), 70 | theRedrawFlag(false) 71 | { 72 | 73 | } 74 | 75 | void ossimPlanetUpdateVisitor::reset() 76 | { 77 | theRedrawFlag = false; 78 | } 79 | 80 | bool ossimPlanetUpdateVisitor::redrawFlag()const 81 | { 82 | return theRedrawFlag; 83 | } 84 | 85 | void ossimPlanetUpdateVisitor::apply(osg::Node& node) 86 | { 87 | ossimPlanetNode* n = dynamic_cast(&node); 88 | if(n) 89 | { 90 | if(n->redrawFlag()) 91 | { 92 | n->setRedrawFlag(false); 93 | theRedrawFlag = true; 94 | } 95 | } 96 | UpdateVisitor::apply(node); 97 | } 98 | 99 | void ossimPlanetUpdateVisitor::apply(osg::Group& node) 100 | { 101 | ossimPlanetNode* n = dynamic_cast(&node); 102 | if(n) 103 | { 104 | if(n->redrawFlag()) 105 | { 106 | n->setRedrawFlag(false); 107 | theRedrawFlag = true; 108 | } 109 | } 110 | UpdateVisitor::apply(node); 111 | } 112 | 113 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetLabelGeom.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetLabelGeom_HEADER 2 | #define ossimPlanetLabelGeom_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | class ossimPlanetLabelGeom : public osg::Node 13 | { 14 | public: 15 | enum ShowState 16 | { 17 | SHOW_NO_STATE = 0, 18 | SHOW_WHEN_FULL_RES = 1, // default 19 | SHOW_ALWAYS = 2 20 | }; 21 | class ossimPlanetLabelGeomUpdateCallback : public osg::NodeCallback 22 | { 23 | virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) 24 | { 25 | ossimPlanetLabelGeom* n = dynamic_cast(node); 26 | if(n) 27 | { 28 | n->traverse(*nv); 29 | } 30 | } 31 | }; 32 | ossimPlanetLabelGeom(const ossimString& label="", 33 | double characterSizeInObjectSpace=1.0/osg::WGS_84_RADIUS_EQUATOR); 34 | virtual ~ossimPlanetLabelGeom(); 35 | void setAlignment(osgText::Text::AlignmentType alignment); 36 | void setCharacterSizeInObjectSpace(double objectSize); 37 | osg::ref_ptr getLabel(); 38 | void setLabel(const ossimString& label); 39 | /** 40 | * Setting to 0 or negative says there is no max height. 41 | */ 42 | void setMaxHeightInPixels(double pixelHeight); 43 | /** 44 | * Setting to 0 or negative value says there is no minimum height. 45 | */ 46 | void setMinHeightInPixels(double pixelHeight); 47 | 48 | void setColor(float r, float g, float b, float a=1.0); 49 | void setEnableFlag(bool enableFlag); 50 | void setShowFlag(bool show); 51 | virtual void traverse(osg::NodeVisitor& nv); 52 | virtual osg::BoundingSphere computeBound() const; 53 | protected: 54 | /** 55 | * Specifies how the label should be shown. You can show it once it reaches full resolution of the pixel 56 | * identified by the . 57 | */ 58 | ossimPlanetLabelGeom::ShowState theShowState; 59 | mutable bool theShowFlag; 60 | mutable bool theUpdateTransformFlag; 61 | bool theEnableFlag; 62 | double theMaxHeightInPixels; 63 | double theMinHeightInPixels; 64 | 65 | /** 66 | * used to make sure the font is at desired size in pixel if the 67 | * max or min font heights are specified. 68 | */ 69 | osg::ref_ptr theTransform; 70 | osg::ref_ptr theBillboard; 71 | osg::ref_ptr theLabel; 72 | osg::Matrixd theMatrix; 73 | osg::Vec4f theColor; 74 | }; 75 | 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetPlaneGrid.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | ossim_uint32 ossimPlanetPlaneGrid::getNumberOfFaces()const 5 | { 6 | return 2;// east and west hemispheres 7 | } 8 | 9 | void ossimPlanetPlaneGrid::getPixelScale(double& dx, 10 | double& dy, 11 | ossimUnitType& pixelScaleUnits, 12 | ossim_uint32 level, 13 | ossim_uint64 /*row*/, 14 | ossim_uint64 /*col*/)const 15 | { 16 | dx = 180.0*(1.0/(1< 4 | #include 5 | #include 6 | 7 | class OSSIMPLANET_DLL ossimPlanetElevationDatabaseGroup : public ossimPlanetTextureLayerGroup 8 | { 9 | public: 10 | ossimPlanetElevationDatabaseGroup(); 11 | 12 | ossimPlanetElevationDatabaseGroup(const ossimPlanetElevationDatabaseGroup& src); 13 | virtual ossimPlanetTextureLayer* dup()const; 14 | virtual ossimPlanetTextureLayer* dupType()const; 15 | virtual osg::ref_ptr getTexture(ossim_uint32 width, 16 | ossim_uint32 height, 17 | const ossimPlanetTerrainTileId& tileId, 18 | const ossimPlanetGrid& theGrid, 19 | ossim_int32 padding=0); 20 | virtual osg::ref_ptr getTexture(ossim_uint32 level, 21 | ossim_uint64 row, 22 | ossim_uint64 col, 23 | const ossimPlanetGridUtility& utility); 24 | 25 | virtual bool replaceLayer(ossim_uint32 idx, 26 | osg::ref_ptr layer); 27 | 28 | virtual bool addTop(osg::ref_ptr layer); 29 | virtual bool addBeforeIdx(ossim_uint32 idx, osg::ref_ptr layer); 30 | virtual bool addBeforeLayer(const osg::ref_ptr beforeLayer, 31 | osg::ref_ptr layerToAdd); 32 | virtual bool addAfterIdx(ossim_int32 idx, osg::ref_ptr layer); 33 | virtual bool addAfterLayer(const osg::ref_ptr afterLayer, 34 | osg::ref_ptr layerToAdd); 35 | virtual bool addBottom(osg::ref_ptr layer); 36 | 37 | virtual void setGeoRefModel(osg::ref_ptr model); 38 | virtual void setFillNullWithGeoidOffsetFlag(bool flag); 39 | bool fillNullWithGeoidOffsetFlag()const 40 | { 41 | return theFillNullWithGeoidOffsetFlag; 42 | } 43 | 44 | protected: 45 | /** 46 | * 47 | * Merging elevation cells are done differently. We will override the base classes mergeImage. 48 | * 49 | */ 50 | virtual void mergeImage(ossimPlanetImage* result, 51 | const ossimPlanetImage* source)const; 52 | void setPixelStatus(ossimPlanetImage* image); 53 | 54 | osg::ref_ptr theGeoRefModel; 55 | bool theFillNullWithGeoidOffsetFlag; 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /include/ossimPlanet/netChat.h: -------------------------------------------------------------------------------- 1 | /* 2 | PLIB - A Suite of Portable Game Libraries 3 | Copyright (C) 1998,2002 Steve Baker 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | For further information visit http://plib.sourceforge.net 20 | 21 | $Id: netChat.h 1568 2002-09-02 06:05:49Z sjbaker $ 22 | */ 23 | 24 | /**** 25 | * NAME 26 | * netChat - network chat class 27 | * 28 | * DESCRIPTION 29 | * This class adds support for 'chat' style protocols - 30 | * where one side sends a 'command', and the other sends 31 | * a response (examples would be the common internet 32 | * protocols - smtp, nntp, ftp, etc..). 33 | * 34 | * The handle_buffer_read() method looks at the input 35 | * stream for the current 'terminator' (usually '\r\n' 36 | * for single-line responses, '\r\n.\r\n' for multi-line 37 | * output), calling found_terminator() on its receipt. 38 | * 39 | * EXAMPLE 40 | * Say you build an nntp client using this class. 41 | * At the start of the connection, you'll have 42 | * terminator set to '\r\n', in order to process 43 | * the single-line greeting. Just before issuing a 44 | * 'LIST' command you'll set it to '\r\n.\r\n'. 45 | * The output of the LIST command will be accumulated 46 | * (using your own 'collect_incoming_data' method) 47 | * up to the terminator, and then control will be 48 | * returned to you - by calling your found_terminator() 49 | * 50 | * AUTHORS 51 | * Sam Rushing - original version for Medusa 52 | * Dave McClurg - modified for use in PLIB 53 | * 54 | * CREATION DATE 55 | * Dec-2000 56 | * 57 | ****/ 58 | 59 | #ifndef NET_CHAT_H 60 | #define NET_CHAT_H 61 | 62 | #include "netBuffer.h" 63 | 64 | class netChat : public netBufferChannel 65 | { 66 | char* terminator; 67 | 68 | virtual void handleBufferRead (netBuffer& buffer) ; 69 | 70 | public: 71 | 72 | netChat () : terminator (0) {} 73 | 74 | void setTerminator (const char* t); 75 | const char* getTerminator (void); 76 | 77 | bool push (const char* s) 78 | { 79 | return bufferSend ( s, strlen(s) ) ; 80 | } 81 | 82 | virtual void collectIncomingData (const char* /* s */, int /* n */) {} 83 | virtual void foundTerminator (void) {} 84 | }; 85 | 86 | #endif // NET_CHAT_H 87 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetKmlPlacemarkNode.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetKmlPlacemarkNode_HEADER 2 | #define ossimPlanetKmlPlacemarkNode_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | class ossimPlanetKmlPlacemarkNode : public ossimPlanetKmlLayerNode 13 | { 14 | public: 15 | ossimPlanetKmlPlacemarkNode(ossimPlanetKmlLayer* layer = 0, 16 | ossimPlanetKmlObject* obj = 0); 17 | virtual void traverse(osg::NodeVisitor& nv); 18 | 19 | virtual bool init(); 20 | 21 | protected: 22 | class PlacemarkGeometryDraw : public osg::Drawable::DrawCallback 23 | { 24 | public: 25 | PlacemarkGeometryDraw() 26 | :theOpacity(1.0) 27 | { 28 | 29 | } 30 | virtual void drawImplementation(osg::RenderInfo& /*renderInfo*/, 31 | const osg::Drawable* /*drawable*/)const; 32 | public: 33 | float theOpacity; 34 | }; 35 | double convertHeight(const osg::Vec3d& kmlWorldPoint, 36 | ossimPlanetAltitudeMode altMode, 37 | ossimPlanetGeoRefModel* landModel)const; 38 | 39 | void convertPointsToLocalCoordinates(osg::Vec3Array* result, 40 | const ossimPlanetKmlGeometry::PointListType& pointList, 41 | const osg::Matrixd& worldToLocalTransform, 42 | ossimPlanetGeoRefModel* landModel, 43 | ossimPlanetAltitudeMode altMode, 44 | double& minHeight, 45 | double& maxHeight)const; 46 | 47 | void extrude(osg::ref_ptr result, 48 | osg::Vec3Array* verts, 49 | osg::Vec3Array* extrusionVerts, 50 | const std::vector >& extrusionGroups)const; 51 | 52 | 53 | 54 | double theNormalizationScale; 55 | osg::ref_ptr theKmlGeometries; 56 | osg::ref_ptr theKmlPickableGeometries; 57 | bool theCulledFlag; 58 | 59 | // we will shift the center of the bounds to the ground level 60 | // and use this for determining pixel coverage 61 | // 62 | ossim_float64 theRadius; 63 | osg::Vec3d theCenter; 64 | 65 | ossim_float32 theFadeAlpha; 66 | osg::ref_ptr theDraw; 67 | osg::ref_ptr theRegion; 68 | osg::ref_ptr theLod; 69 | }; 70 | 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetAnimatedPointModel.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetAnimatedPointModel_HEADER 2 | #define ossimPlanetAnimatedPointModel_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class OSSIMPLANET_DLL ossimPlanetAnimatedPointModel : public ossimPlanetAnnotationLayerNode 12 | { 13 | public: 14 | ossimPlanetAnimatedPointModel(); 15 | virtual ~ossimPlanetAnimatedPointModel(); 16 | void execute(const ossimPlanetAction& action); 17 | void setAnimationPath(ossimPlanetAnimationPath* path); 18 | void setAnimationPathColor(const osg::Vec4f& value); 19 | void setAnimationPathLineThickness(ossim_float32 value); 20 | void setShowPathFlag(bool flag); 21 | void setShowModelFlag(bool flag); 22 | void setPointModel(osg::Node* value); 23 | void setTimeScale(ossim_float64 scale); 24 | void setTimeOffset(ossim_float64 offset); 25 | virtual void traverse(osg::NodeVisitor& nv); 26 | virtual void stage(); 27 | 28 | osg::Node* pointModel(){return thePointModel.get();} 29 | const osg::Node* pointModel()const{return thePointModel.get();} 30 | ossimPlanetAnimationPath* animationPath(){return theAnimationPath.get();} 31 | const ossimPlanetAnimationPath* animationPath()const{return theAnimationPath.get();} 32 | 33 | protected: 34 | void updateCoordinates(); 35 | void updateColor(); 36 | class OSSIMPLANET_DLL PathCallback : public osg::AnimationPathCallback 37 | { 38 | public: 39 | PathCallback(); 40 | PathCallback(const PathCallback& apc, 41 | const osg::CopyOp& copyop); 42 | PathCallback(osg::AnimationPath* ap, 43 | double timeOffset=0.0, 44 | double timeMultiplier=1.0); 45 | virtual void operator()(osg::Node* node, osg::NodeVisitor* nv); 46 | }; 47 | std::mutex theUpdateCoordinatesMutex; 48 | std::mutex theUpdateColorMutex; 49 | bool theShowPathFlag; 50 | bool theShowModelFlag; 51 | osg::Vec4f theAnimationPathColor; 52 | ossim_float32 theAnimationPathLineThickness; 53 | osg::ref_ptr thePointModel; 54 | osg::ref_ptr theAnimationPath; 55 | 56 | // need drawing for the path 57 | // 58 | osg::ref_ptr thePathMatrixTransform; 59 | osg::ref_ptr thePathColor; 60 | osg::ref_ptr thePathVertices; 61 | osg::ref_ptr theLineWidth; 62 | osg::ref_ptr thePathGeode; 63 | osg::ref_ptr thePathGeometry; 64 | 65 | osg::ref_ptr theAnimationPathCallback; 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetLatLonHud.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetLatLonHud_HEADER 2 | #define ossimPlanetLatLonHud_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | class ossimPlanet; 16 | namespace osg 17 | { 18 | class LineWidth; 19 | } 20 | class OSSIMPLANET_EXPORT ossimPlanetLatLonHud : public ossimPlanetLayer 21 | { 22 | public: 23 | ossimPlanetLatLonHud(); 24 | virtual void traverse(osg::NodeVisitor& nv); 25 | osg::Vec4 getCrossHairColor()const; 26 | osg::Vec4 getTextColor()const; 27 | void setCrosshairColor(const osg::Vec4& color); 28 | void setTextColor(const osg::Vec4& color); 29 | void setFont(const ossimString& fontFile); 30 | void setLatDisplayString(const ossimString& latDisplayString); 31 | void setLonDisplayString(const ossimString& lonDisplayString); 32 | void setCharacterSize(float size); 33 | void setViewport(osg::ref_ptr viewport); 34 | void setAutoUpdateFlag(bool flag); 35 | void setCompassTexture(const ossimFilename& compass); 36 | // void setCompassTexture(const ossimFilename& ring, 37 | // const ossimFilename& interior); 38 | 39 | virtual void execute(const ossimPlanetAction& action); 40 | 41 | protected: 42 | void initialize(); 43 | void updatePosition(); 44 | osg::ref_ptr theCameraNode; 45 | /* osg::ref_ptr theProjection; */ 46 | osg::ref_ptr thePositionText; 47 | 48 | osg::ref_ptr theLookText; 49 | osg::ref_ptr theEyeText; 50 | osg::ref_ptr theRangeText; 51 | 52 | osg::ref_ptr theGeode; 53 | osg::ref_ptr theViewport; 54 | osg::ref_ptr theCrosshair; 55 | osg::Vec3d theLineOfSiteLatLon; 56 | osg::Vec3d theNadirLatLon; 57 | double theRange; 58 | double theAltitude; 59 | osg::Vec4 theTextColor; 60 | osg::Vec4 theShadowTextColor; 61 | osg::Vec4 theCrosshairColor; 62 | osg::ref_ptr theCrosshairLineWidth; 63 | bool theAutoUpdateFlag; 64 | mutable bool theFontChanged; 65 | float theCharacterSize; 66 | bool theCharacterSizeDirtyFlag; 67 | ossimString theFontName; 68 | osg::ref_ptr theFont; 69 | 70 | 71 | ossimString theLookLabel; 72 | ossimString theEyeLabel; 73 | ossimString theRangeLabel; 74 | ossimString theLookDisplayString; 75 | ossimString theEyeDisplayString; 76 | 77 | ossimString theLatDisplayString; 78 | ossimString theLonDisplayString; 79 | 80 | 81 | bool theInitializedFlag; 82 | mutable std::recursive_mutex theMutex; 83 | bool theViewportChangedFlag; 84 | osg::ref_ptr theCompass; 85 | }; 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetBillboardIcon.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetBillboardIcon_HEADER 2 | #define ossimPlanetBillboardIcon_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | class ossimPlanetBillboardIcon :public osg::Node 14 | { 15 | public: 16 | class ossimPlanetBillboardIconUpdateCallback : public osg::NodeCallback 17 | { 18 | virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) 19 | { 20 | ossimPlanetBillboardIcon* n = dynamic_cast(node); 21 | if(n) 22 | { 23 | n->traverse(*nv); 24 | } 25 | } 26 | }; 27 | /** 28 | * The normalization factor is used to scale the bill board into the units of 29 | * the scenegraph. This is done by the billboard transform. This transform is wrapped 30 | * with a fudge factor transform to make sure that the icon stays on top of the terrain 31 | */ 32 | ossimPlanetBillboardIcon(double objectGroundSize = 50000.0/OSSIMPLANET_WGS_84_RADIUS_EQUATOR); 33 | void setGroundObjectSize(double groundSize); 34 | void setIcon(osg::ref_ptr img); 35 | void setIcon(osg::ref_ptr img); 36 | osg::ref_ptr getGeom() 37 | { 38 | return theGeom.get(); 39 | } 40 | void setGeom(osg::ref_ptr geom); 41 | /** 42 | * This turns on auto scaling so that the full texture size is reached once 43 | * the gsd is approximately the passed in meters per pixel. 44 | */ 45 | virtual void traverse(osg::NodeVisitor& nv); 46 | virtual osg::BoundingSphere computeBound() const; 47 | bool isCulled()const; 48 | void setMinPixelSize(ossim_uint32 size) 49 | { 50 | theMinPixelSize = size; 51 | } 52 | void setMaxPixelSize(ossim_uint32 size) 53 | { 54 | theMaxPixelSize = size; 55 | } 56 | protected: 57 | osg::Billboard* theBillboard; 58 | osg::ref_ptr theGeom; 59 | osg::ref_ptr theBillboardTransform; 60 | osg::ref_ptr theFudgeFactorTransform; 61 | osg::ref_ptr theLabelTransform; 62 | osg::Matrixd theFudgeFactorMatrix; 63 | bool theNeedsUpdateFlag; 64 | bool theCulledFlag; 65 | ossim_uint32 theMinPixelSize; 66 | ossim_uint32 theMaxPixelSize; 67 | ossim_uint32 thePixelWidth; 68 | ossim_uint32 thePixelHeight; 69 | osg::Vec3d theTranslate; 70 | 71 | bool theScaleFactorChangedFlag; 72 | ossim_float64 theScaleFactor; 73 | }; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetServerThread.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetServerThread_HEADER 2 | #define ossimPlanetServerThread_HEADER 3 | #include 4 | #include "ossimPlanetExport.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | class OSSIMPLANET_DLL ossimPlanetServerThread : public osg::Referenced, 15 | public OpenThreads::Thread 16 | { 17 | public: 18 | ossimPlanetServerThread(ossim_uint32 maxQueueSize = 2048); 19 | virtual ~ossimPlanetServerThread(); 20 | virtual void run(); 21 | virtual int cancel(); 22 | 23 | void setQueueMessagesFlag(bool flag); 24 | bool getQueueMessagesFlag()const; 25 | /** 26 | * Adds a port listener. 27 | * 28 | * @param host The host ip address. Usually will be localhost or empty string 29 | * @param port The port number. 30 | * @param portType The port type can be udp or tcp listener 31 | */ 32 | osg::ref_ptr addServer(const ossimString& host, 33 | const ossimString& port, 34 | const ossimString& portType, 35 | char delimiter='\n'); 36 | 37 | osg::ref_ptr removeServer(ossim_uint32 idx); 38 | osg::ref_ptr removeServer(const ossimString& host, 39 | const ossimString& port); 40 | 41 | ossim_uint32 getNumberOfServers()const; 42 | 43 | bool setServer(ossim_uint32 idx, 44 | const ossimString& host, 45 | const ossimString& port, 46 | const ossimString& portType); 47 | 48 | ossimString getPort(ossim_uint32 idx)const; 49 | ossimString getServer(ossim_uint32 idx)const; 50 | ossimString getPortType(ossim_uint32 idx)const; 51 | 52 | bool nextMessage(ossimString& msg); 53 | 54 | void addMessageHandler(osg::ref_ptr messageHandler); 55 | void removeMessageHandler(osg::ref_ptr messageHandler); 56 | ossim_uint32 getNumberOfMessageHandlers()const; 57 | 58 | protected: 59 | int findMessageHandler(ossimPlanetServerMessageHandler* handler)const; 60 | 61 | mutable std::recursive_mutex theMessageQueueMutex; 62 | mutable std::recursive_mutex theChannelListMutex; 63 | mutable std::recursive_mutex theMessageHandlerMutex; 64 | ossim_uint32 thePollingRatePerSecond; 65 | ossim_uint32 theMaxQueueSize; 66 | std::queue theMessageQueue; 67 | std::vector > theChannelList; 68 | bool theDoneFlag; 69 | bool theStartedFlag; 70 | bool theQueueMessagesFlag; 71 | std::vector > theMessageHandlerList; 72 | }; 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetOssimElevationDatabase.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetDtedElevationDatabase_HEADER 2 | #define ossimPlanetDtedElevationDatabase_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | class OSSIMPLANET_DLL ossimPlanetOssimElevationDatabase : public ossimPlanetElevationDatabase 11 | { 12 | public: 13 | ossimPlanetOssimElevationDatabase(); 14 | ossimPlanetOssimElevationDatabase(const ossimPlanetOssimElevationDatabase& src); 15 | virtual ~ossimPlanetOssimElevationDatabase(); 16 | virtual ossimPlanetTextureLayer* dup()const; 17 | virtual ossimPlanetTextureLayer* dupType()const; 18 | virtual ossimPlanetTextureLayerStateCode updateExtents(); 19 | virtual void updateStats()const; 20 | virtual void resetStats()const; 21 | 22 | virtual ossimPlanetTextureLayerStateCode open(const std::string& location); 23 | virtual void setDatabase(ossimElevationDatabase* database) 24 | { 25 | m_database = database; 26 | m_cellDatabaseFlag = ((!dynamic_cast(database) && 27 | !dynamic_cast(database))&& 28 | ((dynamic_cast(database) != 0))); 29 | updateExtents(); 30 | } 31 | virtual bool hasTexture(ossim_uint32 width, 32 | ossim_uint32 height, 33 | const ossimPlanetTerrainTileId& tileId, 34 | const ossimPlanetGrid& grid); 35 | virtual osg::ref_ptr getTexture(ossim_uint32 width, 36 | ossim_uint32 height, 37 | const ossimPlanetTerrainTileId& tileId, 38 | const ossimPlanetGrid& grid, 39 | ossim_int32 padding=0); 40 | virtual osg::ref_ptr getTexture(ossim_uint32 /* level */, 41 | ossim_uint64 /* row */, 42 | ossim_uint64 /* col */, 43 | const ossimPlanetGridUtility& /* utility */) 44 | { 45 | return 0; 46 | } 47 | protected: 48 | virtual osg::ref_ptr getTextureCellDatabase(ossim_uint32 width, 49 | ossim_uint32 height, 50 | const ossimPlanetTerrainTileId& tileId, 51 | const ossimPlanetGrid& grid, 52 | ossim_int32 padding=0); 53 | bool m_cellDatabaseFlag; 54 | ossimRefPtr m_database; 55 | }; 56 | #endif 57 | -------------------------------------------------------------------------------- /include/ossimPlanet/netMonitor.h: -------------------------------------------------------------------------------- 1 | /* 2 | PLIB - A Suite of Portable Game Libraries 3 | Copyright (C) 1998,2002 Steve Baker 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | For further information visit http://plib.sourceforge.net 20 | 21 | $Id: netMonitor.h 1899 2004-03-21 17:41:07Z sjbaker $ 22 | */ 23 | 24 | /**** 25 | * NAME 26 | * netMonitor - network monitor server 27 | * 28 | * DESCRIPTION 29 | * netMonitor is a telnet command port with 30 | * password authorization. It can be paired 31 | * with and used to remotely admin another server. 32 | * 33 | * AUTHORS 34 | * Sam Rushing - original version for Medusa 35 | * Dave McClurg - modified for use in PLIB 36 | * 37 | * CREATION DATE 38 | * Dec-2000 39 | * 40 | ****/ 41 | 42 | #ifndef NET_MONITOR_H 43 | #define NET_MONITOR_H 44 | 45 | #include "netChat.h" 46 | 47 | 48 | class netMonitorServer : private netChannel 49 | { 50 | char* name ; 51 | char* password ; 52 | char* prompt ; 53 | void (*cmdfunc)(const char*) ; 54 | class netMonitorChannel* active ; 55 | 56 | friend class netMonitorChannel ; 57 | 58 | virtual bool writable (void) { return false ; } 59 | virtual void handleAccept (void) ; 60 | 61 | public: 62 | 63 | netMonitorServer( const char* _name, int port ) 64 | { 65 | name = ulStrDup(_name); 66 | password = ulStrDup("") ; 67 | prompt = ulStrDup(">>> "); 68 | cmdfunc = 0 ; 69 | active = 0 ; 70 | 71 | open () ; 72 | bind ("", port); 73 | listen (1); 74 | 75 | ulSetError(UL_DEBUG, "Monitor \"%s\" started on port %d",name,port); 76 | } 77 | 78 | ~netMonitorServer() 79 | { 80 | delete[] name ; 81 | delete[] password ; 82 | delete[] prompt ; 83 | } 84 | 85 | const char* getPassword () const { return password; } 86 | void setPassword ( const char* string ) 87 | { 88 | delete[] password ; 89 | password = ulStrDup ( string?string:"" ) ; 90 | } 91 | 92 | void setPrompt ( const char* string ) 93 | { 94 | delete[] prompt ; 95 | prompt = ulStrDup ( string?string:"" ) ; 96 | } 97 | 98 | void setCommandFunc ( void (*func)(const char*) ) 99 | { 100 | cmdfunc = func ; 101 | } 102 | 103 | bool push (const char* s) ; 104 | } ; 105 | 106 | #endif // NET_MONITOR_H 107 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetReentrantMutex.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetReentrantMutex_HEADER 2 | #define ossimPlanetReentrantMutex_HEADER 3 | #include 4 | #include 5 | 6 | /** 7 | * This is out of SVN for the nex 2.8.1 release of OSG. There was a bug in the lock and unlock 8 | * I will use this until the new 2.8.1 comes out. 9 | */ 10 | class ossimPlanetReentrantMutex : public std::mutex 11 | { 12 | public: 13 | 14 | ossimPlanetReentrantMutex(): 15 | _threadHoldingMutex(0), 16 | _lockCount(0) {} 17 | 18 | virtual ~ossimPlanetReentrantMutex() {} 19 | 20 | virtual int lock() 21 | { 22 | { 23 | std::lock_guard lock(_lockCountMutex); 24 | if (_threadHoldingMutex==OpenThreads::Thread::CurrentThread() && _lockCount>0) 25 | { 26 | ++_lockCount; 27 | return 0; 28 | } 29 | } 30 | 31 | int result = Mutex::lock(); 32 | if (result==0) 33 | { 34 | std::lock_guard lock(_lockCountMutex); 35 | 36 | _threadHoldingMutex = OpenThreads::Thread::CurrentThread(); 37 | _lockCount = 1; 38 | } 39 | return result; 40 | } 41 | 42 | 43 | virtual int unlock() 44 | { 45 | std::lock_guard lock(_lockCountMutex); 46 | #if 0 47 | if (_threadHoldingMutex==OpenThreads::Thread::CurrentThread() && _lockCount>0) 48 | { 49 | --_lockCount; 50 | if (_lockCount<=0) 51 | { 52 | _threadHoldingMutex = 0; 53 | return Mutex::unlock(); 54 | } 55 | } 56 | else 57 | { 58 | osg::notify(osg::NOTICE)<<"Error: ReentrantMutex::unlock() - unlocking from the wrong thread."<0) 62 | { 63 | --_lockCount; 64 | if (_lockCount<=0) 65 | { 66 | _threadHoldingMutex = 0; 67 | return Mutex::unlock(); 68 | } 69 | } 70 | #endif 71 | return 0; 72 | } 73 | 74 | 75 | virtual int trylock() 76 | { 77 | { 78 | std::lock_guard lock(_lockCountMutex); 79 | if (_threadHoldingMutex==OpenThreads::Thread::CurrentThread() && _lockCount>0) 80 | { 81 | ++_lockCount; 82 | return 0; 83 | } 84 | } 85 | 86 | int result = Mutex::trylock(); 87 | if (result==0) 88 | { 89 | std::lock_guard lock(_lockCountMutex); 90 | 91 | _threadHoldingMutex = OpenThreads::Thread::CurrentThread(); 92 | _lockCount = 1; 93 | } 94 | return result; 95 | } 96 | 97 | private: 98 | 99 | ossimPlanetReentrantMutex(const ossimPlanetReentrantMutex&):std::mutex() {} 100 | 101 | ossimPlanetReentrantMutex& operator =(const ossimPlanetReentrantMutex&) { return *(this); } 102 | 103 | OpenThreads::Thread* _threadHoldingMutex; 104 | 105 | std::mutex _lockCountMutex; 106 | unsigned int _lockCount; 107 | 108 | }; 109 | #endif 110 | -------------------------------------------------------------------------------- /include/ossimPlanet/sg_file.h: -------------------------------------------------------------------------------- 1 | /** \file sg_file.hxx 2 | * File I/O routines. 3 | */ 4 | 5 | // Written by Curtis Olson, started November 1999. 6 | // 7 | // Copyright (C) 1999 Curtis L. Olson - http://www.flightgear.org/~curt 8 | // 9 | // This program is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License as 11 | // published by the Free Software Foundation; either version 2 of the 12 | // License, or (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, but 15 | // WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | // General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 | // 23 | // $Id: sg_file.h 10524 2007-02-26 18:27:24Z gpotts $ 24 | 25 | 26 | #ifndef _SG_FILE_HXX 27 | #define _SG_FILE_HXX 28 | 29 | 30 | #ifndef __cplusplus 31 | # error This library requires C++ 32 | #endif 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include // for open(), read(), write(), close() 39 | #include // for open(), read(), write(), close() 40 | #include // for open(), read(), write(), close() 41 | #if !defined( _MSC_VER ) 42 | # include // for open(), read(), write(), close() 43 | #endif 44 | 45 | #include "iochannel.h" 46 | 47 | SG_USING_STD(string); 48 | 49 | 50 | /** 51 | * A file I/O class based on SGIOChannel. 52 | */ 53 | class SGFile : public SGIOChannel { 54 | 55 | string file_name; 56 | int fp; 57 | bool eof_flag; 58 | 59 | public: 60 | 61 | /** 62 | * Create an instance of SGFile. 63 | * When calling the constructor you need to provide a file 64 | * name. This file is not opened immediately, but instead will be 65 | * opened when the open() method is called. 66 | * @param file name of file to open 67 | */ 68 | SGFile( const string& file ); 69 | 70 | /** Destructor */ 71 | ~SGFile(); 72 | 73 | // open the file based on specified direction 74 | bool open( const SGProtocolDir dir ); 75 | 76 | // read a block of data of specified size 77 | int read( char *buf, int length ); 78 | 79 | // read a line of data, length is max size of input buffer 80 | int readline( char *buf, int length ); 81 | 82 | // write data to a file 83 | int write( const char *buf, const int length ); 84 | 85 | // write null terminated string to a file 86 | int writestring( const char *str ); 87 | 88 | // close file 89 | bool close(); 90 | 91 | /** @return the name of the file being manipulated. */ 92 | inline string get_file_name() const { return file_name; } 93 | 94 | /** @return true of eof conditions exists */ 95 | inline bool eof() const { return eof_flag; }; 96 | }; 97 | 98 | 99 | #endif // _SG_FILE_HXX 100 | 101 | 102 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetIoThread.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetIoThread_HEADER 2 | #define ossimPlanetIoThread_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | class OSSIMPLANET_DLL ossimPlanetIoThread : public OpenThreads::Thread, 14 | public osg::Referenced, 15 | public ossimPlanetActionReceiver 16 | { 17 | public: 18 | typedef std::vector > MessageHandlerListType; 19 | ossimPlanetIoThread(); 20 | void addIo(osg::ref_ptr io, 21 | bool autoStartFlag = true); 22 | virtual void execute(const ossimPlanetAction &a); 23 | osg::ref_ptr findIo(const ossimString& searchString); 24 | const osg::ref_ptr findIo(const ossimString& searchString)const; 25 | /** 26 | * broadcast to all outgoing sockets the passed in message 27 | */ 28 | void sendMessage(osg::ref_ptr message, bool forceSendFlag=false); 29 | 30 | /** 31 | * push message onto the named object 32 | */ 33 | bool sendMessage(const ossimString& searchName, 34 | osg::ref_ptr message, 35 | bool forceSendFlag=false); 36 | osg::ref_ptr removeIoGivenSearchString(const ossimString& searchString); 37 | osg::ref_ptr ioGivenSearchName(const ossimString& sarchString); 38 | bool removeIo(osg::ref_ptr io); 39 | virtual void run(); 40 | int cancel(); 41 | bool addMessageHandler(osg::ref_ptr handler); 42 | bool removeMessageHandler(osg::ref_ptr handler); 43 | bool removeMessageHandler(const ossimString& handlerName); 44 | ossim_uint32 ioCount()const; 45 | void clearIo(); 46 | bool startedFlag()const; 47 | void setStartedFlag(bool flag); 48 | bool doneFlag()const; 49 | void setDoneFlag(bool flag); 50 | virtual void setPauseFlag(bool flag, bool waitTilPaused=true); 51 | bool pauseFlag()const; 52 | bool startCalledFlag()const; 53 | void setStartCalledFlag(bool flag); 54 | virtual void start(); 55 | protected: 56 | void handleMessage(osg::ref_ptr msg); 57 | void delayedExecute(const ossimPlanetAction &a); 58 | void delayedXmlExecute(const ossimPlanetXmlAction &a); 59 | 60 | mutable std::recursive_mutex thePropertyMutex; 61 | mutable std::recursive_mutex theIoListMutex; 62 | std::vector > theIoList; 63 | mutable std::recursive_mutex theMessageHandlerListMutex; 64 | ossimPlanetIoThread::MessageHandlerListType theMessageHandlerList; 65 | bool theDoneFlag; 66 | bool theStartedFlag; 67 | 68 | bool theStartCalledFlag; 69 | bool thePauseFlag; 70 | mutable std::recursive_mutex theDelayedExecutionMutex; 71 | std::queue > theDelayedExecution; 72 | 73 | mutable std::recursive_mutex theLoopMutex; 74 | }; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetCompass.h: -------------------------------------------------------------------------------- 1 | 2 | /////////////////////////////////////////////////////////////////////////////// 3 | // 4 | // Copyright (c) 2007, Arizona State University 5 | // All rights reserved. 6 | // BSD License: http://www.opensource.org/licenses/bsd-license.html 7 | // Created by: Jeff Conner 8 | // 9 | /////////////////////////////////////////////////////////////////////////////// 10 | 11 | #ifndef ossimPlanetCompass_HEADER 12 | #define ossimPlanetCompass_HEADER 13 | 14 | #include 15 | #include 16 | #include "ossimPlanet/ossimPlanetExport.h" 17 | #include 18 | #include 19 | 20 | 21 | namespace osg { class MatrixTransform; class Geode; } 22 | 23 | 24 | class OSSIMPLANET_EXPORT ossimPlanetCompass : public osg::Node 25 | { 26 | public: 27 | ossimPlanetCompass( ); 28 | 29 | 30 | void setCompassTexture ( const ossimFilename& fn ); 31 | // void setInterior ( const ossimFilename& fn ); 32 | // void setCompassTexture(const ossimFilename& ring, 33 | // const ossimFilename& interior); 34 | /* osg::Node* compassNode ( ); */ 35 | virtual void traverse(osg::NodeVisitor& nv); 36 | 37 | bool isAnimating ( ); 38 | void setAnimation(bool state); 39 | 40 | float heading ( ); 41 | void setHeading ( float r ); 42 | void setHeadingRelativeToNorth(const osg::Vec2& north, const osg::Vec2& pos); 43 | 44 | float pitch ( ); 45 | void setPitch ( float p ); 46 | 47 | 48 | float roll ( ); 49 | void setRoll(float r); 50 | 51 | void setRotateByViewMatrix ( bool m ); 52 | 53 | const osg::Vec3& position ( ); 54 | void setPosition ( const osg::Vec3& p ); 55 | void setPositionByPercentage ( float width, float height ); 56 | 57 | float scale ( ); 58 | void setScale ( float s ); 59 | 60 | bool isVisible ( ); 61 | 62 | void buildCompass ( ); 63 | 64 | 65 | void updateCompass ( ); 66 | 67 | protected: 68 | 69 | virtual ~ossimPlanetCompass ( ); 70 | 71 | osg::Node* buildCompassObject ( const ossimFilename& location); 72 | osg::Group* initCompass ( ); 73 | 74 | void _showCompass ( ); 75 | void _hideCompass ( ); 76 | void _emptyCompass ( ); 77 | osg::Geode* buildTriangleFan ( const ossimFilename& tex, 78 | float zoff, 79 | unsigned int render_level, 80 | const osg::Vec3& n ); 81 | 82 | private: 83 | 84 | osg::Vec3 _pos; 85 | float _scale; 86 | ossimFilename theCompassFilename; 87 | // ossimFilename theRing; 88 | // ossimFilename theInterior; 89 | unsigned int _numslices; 90 | float _radius; 91 | osg::ref_ptr theCompassGroup; 92 | osg::ref_ptr theCompassObject; 93 | // osg::ref_ptr theCompassInteriorObject; 94 | 95 | bool _showOrHideCompass, _animating; 96 | bool _rotateByView; 97 | float _animationStart, _animationEnd, _animationStep; 98 | 99 | float _heading, _pitch, _roll; 100 | osg::ref_ptr< osg::Vec4Array > theCommonColorArray; 101 | }; 102 | 103 | #endif // ossimPlanetCompass_HEADER 104 | -------------------------------------------------------------------------------- /src/ossimPlanet/ulClock.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | PLIB - A Suite of Portable Game Libraries 3 | Copyright (C) 1998,2002 Steve Baker 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | For further information visit http://plib.sourceforge.net 20 | 21 | $Id: ulClock.cxx 1735 2002-12-01 18:21:48Z sjbaker $ 22 | */ 23 | 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef UL_CYGWIN 30 | typedef long long _int64; 31 | #define LARGEINTEGER _int64 32 | #endif 33 | 34 | #ifndef UL_WIN32 35 | # include 36 | #endif 37 | 38 | #include 39 | 40 | #ifdef UL_WIN32 41 | 42 | double ulClock::res ; 43 | int ulClock::perf_timer = -1; 44 | 45 | void ulClock::initPerformanceTimer () 46 | { 47 | if ( perf_timer == -1 ) 48 | { 49 | /* Use Performance Timer if it's available, mmtimer if not. */ 50 | 51 | __int64 frequency ; 52 | 53 | perf_timer = QueryPerformanceFrequency ( (LARGE_INTEGER *) & frequency ) ; 54 | 55 | if ( perf_timer ) 56 | { 57 | res = 1.0 / (double) frequency ; 58 | perf_timer = 1 ; 59 | } 60 | } 61 | } 62 | #endif 63 | 64 | double ulClock::getRawTime () const 65 | { 66 | #ifdef UL_WIN32 67 | 68 | /* Use Performance Timer if it's available, mmtimer if not. */ 69 | 70 | if ( perf_timer ) 71 | { 72 | __int64 t ; 73 | 74 | QueryPerformanceCounter ( (LARGE_INTEGER *) &t ) ; 75 | 76 | return res * (double) t ; 77 | } 78 | 79 | return (double) timeGetTime() * 0.001 ; 80 | 81 | #else 82 | timeval tv ; 83 | 84 | gettimeofday ( & tv, NULL ) ; 85 | 86 | return (double) tv.tv_sec + (double) tv.tv_usec / 1000000.0 ; 87 | #endif 88 | } 89 | 90 | 91 | void ulClock::update () 92 | { 93 | now = getRawTime() - start ; 94 | 95 | delta = now - last_time ; 96 | 97 | /* 98 | KLUDGE: If the frame rate drops below ~5Hz, then 99 | control will be very difficult. It's 100 | actually easier to give up and slow 101 | down the action. max_delta defaults to 102 | 200ms for that reason. 103 | 104 | KLUDGE: If update is called very rapidly, then 105 | delta can be zero which causes some 106 | programs to div0. So we'll clamp to 107 | a millionth of a second. 108 | */ 109 | 110 | if ( delta > max_delta ) delta = max_delta ; 111 | if ( delta <= 0.0 ) delta = 0.0000001 ; 112 | 113 | last_time = now ; 114 | } 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /src/ossimPlanet/ulList.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | PLIB - A Suite of Portable Game Libraries 3 | Copyright (C) 1998,2002 Steve Baker 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | For further information visit http://plib.sourceforge.net 20 | 21 | $Id: ulList.cxx 1732 2002-11-30 00:41:50Z sjbaker $ 22 | */ 23 | 24 | 25 | #include 26 | 27 | 28 | ulList::ulList ( int init ) 29 | { 30 | total = 0 ; 31 | next = 0 ; 32 | entity_list = new void * [ limit = (init <= 0) ? 1 : init ] ; 33 | } 34 | 35 | 36 | ulList::~ulList (void) 37 | { 38 | removeAllEntities () ; 39 | delete [] entity_list ; 40 | } 41 | 42 | 43 | void ulList::addEntity ( void *entity ) 44 | { 45 | sizeChk () ; 46 | entity_list [ total++ ] = entity ; 47 | } 48 | 49 | 50 | void ulList::addEntityBefore ( int i, void *entity ) 51 | { 52 | sizeChk () ; 53 | memmove ( &entity_list[i+1], &entity_list[i], sizeof(void *) * (total-i) ) ; 54 | entity_list [ i ] = entity ; 55 | total++ ; 56 | } 57 | 58 | 59 | void ulList::sizeChk (void) 60 | { 61 | /* Room for one more Entity? */ 62 | 63 | if ( total >= limit ) 64 | { 65 | limit += limit ; 66 | void **nlist = new void * [ limit ] ; 67 | memmove ( nlist, entity_list, sizeof(void *) * total ) ; 68 | delete [] entity_list ; 69 | entity_list = nlist ; 70 | } 71 | } 72 | 73 | 74 | int ulList::searchForEntity ( void *entity ) const 75 | { 76 | for ( unsigned int i = 0 ; i < total ; i++ ) 77 | if ( entity_list [ i ] == entity ) 78 | return (int) i ; 79 | 80 | return -1 ; 81 | } 82 | 83 | void ulList::removeAllEntities () 84 | { 85 | while ( total > 0 ) 86 | removeEntity ( (unsigned int) 0 ) ; 87 | } 88 | 89 | void ulList::removeEntity ( unsigned int n ) 90 | { 91 | memmove ( &(entity_list[n]), &(entity_list[n+1]), 92 | sizeof(void *) * (total-n-1) ) ; 93 | total-- ; 94 | 95 | if ( next >= n ) 96 | next-- ; 97 | } 98 | 99 | 100 | 101 | void ulList::replaceEntity ( unsigned int n, void *new_entity ) 102 | { 103 | if ( n >= 0 ) 104 | entity_list [ n ] = new_entity; 105 | else 106 | addEntity ( new_entity ) ; 107 | } 108 | 109 | 110 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetDestinationCommandAction.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | const char ossimPlanetDestinationCommandAction::theWhitespace[] = " \t"; 5 | 6 | ossimPlanetDestinationCommandAction::ossimPlanetDestinationCommandAction(const ossimString& code, 7 | const ossimString& originatingFederate) 8 | :ossimPlanetAction(originatingFederate) 9 | { 10 | setSourceCode(code); 11 | } 12 | 13 | ossimString ossimPlanetDestinationCommandAction::argListSource() const 14 | { 15 | int start = -1; 16 | 17 | if (theCommand != "#") 18 | { 19 | start = theSourceCode.find_first_not_of(theWhitespace, 0); // eat leading whitespace 20 | int end = theSourceCode.find_first_of(theWhitespace, start); 21 | start = theSourceCode.find_first_not_of(theWhitespace, end); // eat target 22 | end = theSourceCode.find_first_of(theWhitespace, start); 23 | start = theSourceCode.find_first_not_of(theWhitespace, end); // eat command 24 | 25 | } 26 | return (start > 0) ? ossimString(theSourceCode.substr(start, theSourceCode.length() - start)) : 27 | ossimString(); 28 | } 29 | 30 | bool ossimPlanetDestinationCommandAction::setSourceCode(const ossimString& newSourcecode) 31 | { 32 | bool result = true; 33 | theSourceCode = newSourcecode; 34 | 35 | int start = theSourceCode.find_first_not_of(theWhitespace, 0); 36 | bool isComment = start < 0 || theSourceCode[(size_t)start] == '#'; 37 | 38 | if (isComment) 39 | { 40 | theTokens.clear(); 41 | theTokens.push_back(":"); 42 | theTokens.push_back("#"); 43 | } 44 | else 45 | { 46 | bool unbalancedBraces; 47 | ossim::lexQuotedTokens(theSourceCode, start, theWhitespace, "{}", theTokens, unbalancedBraces); 48 | if (unbalancedBraces || theTokens.size() == 1) 49 | { 50 | theTokens.clear(); 51 | theTokens.push_back(":"); 52 | theTokens.push_back("#syntaxerror"); 53 | result = false; 54 | } 55 | } 56 | theArgCount = 0; 57 | if(theTokens.size() > 2) 58 | { 59 | theArgCount = theTokens.size()-2; 60 | } 61 | 62 | setTarget(theTokens[0]); 63 | setCommand(theTokens[1]); 64 | 65 | return result; 66 | } 67 | 68 | void ossimPlanetDestinationCommandAction::print(std::ostream& s)const 69 | { 70 | const char* pre[] = {"", "{"}; 71 | const char* postToken[] = {" ", "", "} ", "}" }; 72 | ossim_uint32 i; 73 | for (i = 0; i < theTokens.size(); i++) 74 | { 75 | ossim_int32 needsQuoting = theTokens[i].empty() || (int)theTokens[i].find_first_of(theWhitespace, 0) != -1; 76 | ossim_int32 lastToken = i == theTokens.size() - 1; 77 | s << pre[needsQuoting] << theTokens[i] << postToken[2*needsQuoting + lastToken]; 78 | } 79 | } 80 | 81 | void ossimPlanetDestinationCommandAction::read(std::istream& s) 82 | { 83 | ossimString buffer; 84 | buffer.reserve(1000); 85 | 86 | // read arbitrary length line from s into buffer. 87 | char c; 88 | for (s.get(c); s.gcount() == 1 && c != '\n' && !s.eof(); s.get(c)) 89 | buffer.append(1, c); 90 | 91 | // init the ossimPlanetAction 92 | if (s || s.eof()) 93 | { 94 | setSourceCode(buffer); 95 | } 96 | } 97 | 98 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetElevationDatabase.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | osg::ref_ptr ossimPlanetElevationDatabase::getTexture(const ossimPlanetTerrainTileId& tileId, 4 | osg::ref_ptr theGrid) 5 | { 6 | return 0; 7 | } 8 | 9 | void ossimPlanetElevationDatabase::mergeDataObjects(ossimRefPtr destData, 10 | ossimRefPtr srcData) 11 | { 12 | if(destData.valid()&&srcData.valid()&& 13 | destData->getBuf()&&srcData->getBuf()) 14 | { 15 | if((destData->getScalarType() == OSSIM_FLOAT)&& 16 | (destData->getWidth()==srcData->getWidth())&& 17 | (destData->getHeight()==srcData->getHeight())) 18 | { 19 | ossim_float32* destBuf = (ossim_float32*)destData->getBuf(); 20 | ossim_float32 destNp = (ossim_float32)destData->getNullPix(0); 21 | ossim_uint32 idx = 0; 22 | ossim_uint32 area = destData->getWidth()*destData->getHeight(); 23 | 24 | switch(srcData->getScalarType()) 25 | { 26 | case OSSIM_UINT16: 27 | case OSSIM_USHORT11: 28 | { 29 | ossim_uint16* srcBuf = (ossim_uint16*)srcData->getBuf(); 30 | ossim_uint16 srcNp = (ossim_uint16)srcData->getNullPix(0); 31 | 32 | for(;idx < area; ++idx) 33 | { 34 | if(*destBuf == destNp) 35 | { 36 | if(*srcBuf != srcNp) 37 | { 38 | *destBuf = (ossim_float32)*srcBuf; 39 | } 40 | } 41 | ++destBuf; 42 | ++srcBuf; 43 | } 44 | break; 45 | } 46 | case OSSIM_SINT16: 47 | { 48 | ossim_sint16* srcBuf = (ossim_sint16*)srcData->getBuf(); 49 | ossim_sint16 srcNp = (ossim_sint16)srcData->getNullPix(0); 50 | 51 | for(;idx < area; ++idx) 52 | { 53 | if(*destBuf == destNp) 54 | { 55 | if(*srcBuf != srcNp) 56 | { 57 | *destBuf = (ossim_float32)*srcBuf; 58 | } 59 | } 60 | ++destBuf; 61 | ++srcBuf; 62 | } 63 | break; 64 | } 65 | case OSSIM_FLOAT32: 66 | { 67 | ossim_float32* srcBuf = (ossim_float32*)srcData->getBuf(); 68 | ossim_float32 srcNp = (ossim_float32)srcData->getNullPix(0); 69 | 70 | for(;idx < area; ++idx) 71 | { 72 | if(*destBuf == destNp) 73 | { 74 | if(*srcBuf != srcNp) 75 | { 76 | *destBuf = *srcBuf; 77 | } 78 | } 79 | ++destBuf; 80 | ++srcBuf; 81 | } 82 | break; 83 | } 84 | default: 85 | { 86 | break; 87 | // not supported 88 | } 89 | } 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetCallback.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetCallback_HEADER 2 | #define ossimPlanetCallback_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | class OSSIMPLANET_DLL ossimPlanetCallback : public osg::Referenced 9 | { 10 | public: 11 | ossimPlanetCallback() 12 | :theEnableFlag(true) 13 | {} 14 | void setEnableFlag(bool flag) 15 | { 16 | std::lock_guard lock(theCallbackMutex); 17 | theEnableFlag = flag; 18 | } 19 | bool enableFlag()const 20 | { 21 | std::lock_guard lock(theCallbackMutex); 22 | return theEnableFlag; 23 | } 24 | protected: 25 | mutable std::recursive_mutex theCallbackMutex; 26 | bool theEnableFlag; 27 | }; 28 | 29 | template 30 | class ossimPlanetCallbackListInterface 31 | { 32 | public: 33 | typedef std::vector > CallbackListType; 34 | ossimPlanetCallbackListInterface() 35 | :theBlockCallbacksFlag(false) 36 | { 37 | 38 | } 39 | virtual ~ ossimPlanetCallbackListInterface(){} 40 | virtual void addCallback(T* callback) 41 | { 42 | std::lock_guard lock(theCallbackListMutex); 43 | if(!hasCallbackNoMutex(callback)) 44 | { 45 | theCallbackList.push_back(callback); 46 | } 47 | } 48 | virtual void addCallback(osg::ref_ptr callback) 49 | { 50 | addCallback(callback.get()); 51 | } 52 | virtual void removeCallback(T* callback); 53 | virtual void removeCallback(osg::ref_ptr callback) 54 | { 55 | removeCallback(callback.get()); 56 | } 57 | virtual void blockCallbacks(bool flag) 58 | { 59 | std::lock_guard lock(theCallbackListMutex); 60 | theBlockCallbacksFlag = flag; 61 | } 62 | bool hasCallback(const T* callback)const; 63 | protected: 64 | bool hasCallbackNoMutex(const T* callback)const; 65 | 66 | mutable std::recursive_mutex theCallbackListMutex; 67 | CallbackListType theCallbackList; 68 | bool theBlockCallbacksFlag; 69 | 70 | }; 71 | template 72 | void ossimPlanetCallbackListInterface::removeCallback(T* callback) 73 | { 74 | std::lock_guard lock(theCallbackListMutex); 75 | unsigned int idx; 76 | for(idx = 0; idx < theCallbackList.size(); ++idx) 77 | { 78 | if(theCallbackList[idx] == callback) 79 | { 80 | theCallbackList.erase(theCallbackList.begin() + idx); 81 | break; 82 | } 83 | } 84 | } 85 | 86 | template 87 | bool ossimPlanetCallbackListInterface::hasCallback(const T* callback)const 88 | { 89 | std::lock_guard lock(theCallbackListMutex); 90 | return hasCallbackNoMutex(callback); 91 | } 92 | 93 | template 94 | bool ossimPlanetCallbackListInterface::hasCallbackNoMutex(const T* callback)const 95 | { 96 | unsigned int idx; 97 | for(idx = 0; idx < theCallbackList.size(); ++idx) 98 | { 99 | if(theCallbackList[idx] == callback) 100 | { 101 | return true; 102 | } 103 | } 104 | 105 | return false; 106 | } 107 | 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /src/ossimPlanet/ossimPlanetTextureLayerRegistry.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | ossimPlanetTextureLayerRegistry* ossimPlanetTextureLayerRegistry::theInstance = 0; 9 | 10 | ossimPlanetTextureLayerRegistry::ossimPlanetTextureLayerRegistry() 11 | { 12 | theInstance = this; 13 | destroyingFlag = true; 14 | } 15 | 16 | ossimPlanetTextureLayerRegistry::~ossimPlanetTextureLayerRegistry() 17 | { 18 | destroyingFlag = true; 19 | 20 | ossim_uint32 idx = 0; 21 | 22 | for(idx = 0; idx < theFactoryList.size(); ++idx) 23 | { 24 | delete theFactoryList[idx]; 25 | theFactoryList[idx] = 0; 26 | } 27 | 28 | theInstance = 0; 29 | 30 | } 31 | 32 | ossimPlanetTextureLayerRegistry* ossimPlanetTextureLayerRegistry::instance() 33 | { 34 | if(!theInstance) 35 | { 36 | theInstance = new ossimPlanetTextureLayerRegistry; 37 | theInstance->registerFactory(ossimPlanetStandardTextureLayerFactory::instance()); 38 | } 39 | 40 | return theInstance; 41 | } 42 | 43 | void ossimPlanetTextureLayerRegistry::registerFactory(ossimPlanetTextureLayerFactory* factory) 44 | { 45 | theFactoryListMutex.writeLock(); 46 | if(!containsFactory(factory)) 47 | { 48 | theFactoryList.push_back(factory); 49 | } 50 | theFactoryListMutex.writeUnlock(); 51 | } 52 | 53 | void ossimPlanetTextureLayerRegistry::registerFactoryToFront(ossimPlanetTextureLayerFactory* factory) 54 | { 55 | theFactoryListMutex.writeLock(); 56 | if(!containsFactory(factory)) 57 | { 58 | theFactoryList.insert(theFactoryList.begin(), factory); 59 | } 60 | theFactoryListMutex.writeUnlock(); 61 | } 62 | 63 | void ossimPlanetTextureLayerRegistry::unregisterFactory(ossimPlanetTextureLayerFactory* factory) 64 | { 65 | if(destroyingFlag) return; 66 | theFactoryListMutex.writeLock(); 67 | 68 | std::vector::iterator iter = std::find(theFactoryList.begin(), 69 | theFactoryList.end(), 70 | factory); 71 | 72 | if(iter != theFactoryList.end()) 73 | { 74 | theFactoryList.erase(iter); 75 | } 76 | theFactoryListMutex.writeUnlock(); 77 | } 78 | 79 | osg::ref_ptr ossimPlanetTextureLayerRegistry::createLayer(const ossimString& name, bool openAllEntriesFlag)const 80 | { 81 | ossim_uint32 idx=0; 82 | osg::ref_ptr result; 83 | theFactoryListMutex.readLock(); 84 | for(idx = 0; ((idx < theFactoryList.size())&&(!result.valid()));++idx) 85 | { 86 | result = theFactoryList[idx]->createLayer(name, openAllEntriesFlag); 87 | } 88 | theFactoryListMutex.readUnlock(); 89 | return result; 90 | } 91 | 92 | bool ossimPlanetTextureLayerRegistry::containsFactory(ossimPlanetTextureLayerFactory* factory)const 93 | { 94 | ossim_uint32 idx = 0; 95 | 96 | for(idx = 0; idx < theFactoryList.size(); ++idx) 97 | { 98 | if(theFactoryList[idx] == factory) 99 | { 100 | return true; 101 | } 102 | } 103 | 104 | return false; 105 | } 106 | -------------------------------------------------------------------------------- /include/ossimPlanet/ossimPlanetSrtmElevationDatabase.h: -------------------------------------------------------------------------------- 1 | #ifndef ossimPlanetSrtmElevationDatabase_HEADER 2 | #define ossimPlanetSrtmElevationDatabase_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | class OSSIMPLANET_DLL ossimPlanetSrtmElevationDatabase : public ossimPlanetElevationDatabase 11 | { 12 | public: 13 | ossimPlanetSrtmElevationDatabase(); 14 | ossimPlanetSrtmElevationDatabase(const ossimPlanetSrtmElevationDatabase& src); 15 | virtual ~ossimPlanetSrtmElevationDatabase(); 16 | virtual ossimPlanetTextureLayer* dup()const; 17 | virtual ossimPlanetTextureLayer* dupType()const; 18 | virtual ossimPlanetTextureLayerStateCode updateExtents(); 19 | virtual void updateStats()const; 20 | virtual void resetStats()const; 21 | virtual ossimPlanetTextureLayerStateCode open(const std::string& location); 22 | virtual bool hasTexture(ossim_uint32 width, 23 | ossim_uint32 height, 24 | const ossimPlanetTerrainTileId& tileId, 25 | const ossimPlanetGrid& grid); 26 | virtual osg::ref_ptr getTexture(ossim_uint32 width, 27 | ossim_uint32 height, 28 | const ossimPlanetTerrainTileId& tileId, 29 | const ossimPlanetGrid& theGrid, 30 | ossim_int32 padding=0); 31 | virtual osg::ref_ptr getTexture(ossim_uint32 level, 32 | ossim_uint64 row, 33 | ossim_uint64 col, 34 | const ossimPlanetGridUtility& utility); 35 | 36 | protected: 37 | class SrtmInfo : public osg::Referenced 38 | { 39 | public: 40 | double theMinLat, theMinLon, theMaxLat, theMaxLon; 41 | std::string theFilename; 42 | ossimRefPtr theSrtmHandler; 43 | osg::Timer_t theTimeStamp; 44 | }; 45 | typedef std::map > SrtmFilePointerList; 46 | 47 | 48 | osg::ref_ptr getInfo(const std::string& srtmName); 49 | void shrinkFilePointers(); 50 | ossimFilename buildFilename(double lat, double lon)const; 51 | osg::ref_ptr findSrtmInfo(const std::string& srtmName); 52 | 53 | std::string theLocation; 54 | mutable bool theOpenFlag; 55 | ossim_uint32 theMaxOpenFiles; 56 | ossim_uint32 theMinOpenFiles; 57 | SrtmFilePointerList theFilePointers; 58 | /* ossimRefPtr theProjection; */ 59 | /* ossimRefPtr theRenderer; */ 60 | /* ossimRefPtr theMosaic; */ 61 | /* ossim_float32 theNullHeightValue; */ 62 | 63 | }; 64 | 65 | #endif 66 | --------------------------------------------------------------------------------