├── BrowserClient ├── BrowserClient.cpp ├── CMakeLists.txt ├── CefHelper ├── CefHelper.cpp ├── ExecuteCallback ├── FileExecuteCallback ├── FileExecuteCallback.cpp ├── GDALLayer ├── GDALLayer.cpp ├── GDALResourceHandler ├── GDALResourceHandler.cpp ├── JsonArguments ├── JsonArguments.cpp ├── KeyboardEventAdapter ├── KeyboardEventAdapter.cpp ├── MapExecuteCallback ├── MapExecuteCallback.cpp ├── MapExtensions ├── MapExtensions.cpp ├── NativeEventHandlerWin ├── NativeEventHandlerWin.cpp ├── OECefApp ├── PackagerExtensions ├── PackagerExtensions.cpp ├── README.md ├── RenderProcessHandler ├── RenderProcessHandler.cpp ├── applications ├── demo_cef │ ├── css │ │ └── style.css │ ├── img │ │ ├── cube.gif │ │ └── logo.png │ ├── index.html │ ├── js │ │ └── jquery-2.1.0.min.js │ ├── main.cpp │ ├── openstreetmap.earth │ └── readymap.earth ├── osgearth_cef │ └── main.cpp ├── packager │ ├── css │ │ ├── bootstrap.css │ │ └── packager.css │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ ├── img │ │ ├── logo.png │ │ ├── pelican-2in-300dpi.png │ │ └── thumb.jpg │ ├── index.html │ └── js │ │ ├── bootstrap.js │ │ ├── jquery-2.1.0.min.js │ │ └── packager.js └── packager2 │ ├── css │ └── style.css │ ├── data │ ├── world.dbf │ ├── world.prj │ ├── world.shp │ ├── world.shx │ └── world.tif │ ├── ext │ ├── Proj4Leaflet │ │ ├── proj4-compressed.js │ │ └── proj4leaflet.js │ ├── font-awesome │ │ ├── HELP-US-OUT.txt │ │ ├── css │ │ │ ├── font-awesome.css │ │ │ └── font-awesome.min.css │ │ ├── fonts │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ └── fontawesome-webfont.woff2 │ │ ├── less │ │ │ ├── animated.less │ │ │ ├── bordered-pulled.less │ │ │ ├── core.less │ │ │ ├── fixed-width.less │ │ │ ├── font-awesome.less │ │ │ ├── icons.less │ │ │ ├── larger.less │ │ │ ├── list.less │ │ │ ├── mixins.less │ │ │ ├── path.less │ │ │ ├── rotated-flipped.less │ │ │ ├── stacked.less │ │ │ └── variables.less │ │ └── scss │ │ │ ├── _animated.scss │ │ │ ├── _bordered-pulled.scss │ │ │ ├── _core.scss │ │ │ ├── _fixed-width.scss │ │ │ ├── _icons.scss │ │ │ ├── _larger.scss │ │ │ ├── _list.scss │ │ │ ├── _mixins.scss │ │ │ ├── _path.scss │ │ │ ├── _rotated-flipped.scss │ │ │ ├── _stacked.scss │ │ │ ├── _variables.scss │ │ │ └── font-awesome.scss │ └── leaflet │ │ ├── images │ │ ├── layers-2x.png │ │ ├── layers.png │ │ ├── marker-icon-2x.png │ │ ├── marker-icon.png │ │ └── marker-shadow.png │ │ ├── leaflet-src.js │ │ ├── leaflet.css │ │ └── leaflet.js │ ├── img │ ├── favicon.ico │ └── pelican.png │ ├── index.html │ ├── js │ └── jquery-2.1.0.min.js │ └── sass │ ├── .sass-cache │ └── ea83ec22b13391b3d67a1056797e02b35f48f74a │ │ └── style.scssc │ └── style.scss ├── cmake_modules ├── FindCEF.cmake ├── FindGDAL.cmake ├── FindOSG.cmake └── FindOSGEARTH.cmake └── js └── osgearth.js /BrowserClient: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_BrowserClient 2 | #define OSGEARTH_CEF_BrowserClient 1 3 | 4 | #include "include/cef_client.h" 5 | #include "include/cef_render_handler.h" 6 | #include "include/wrapper/cef_message_router.h" 7 | 8 | #include "ExecuteCallback" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace osgEarth { namespace Cef 15 | { 16 | 17 | // forward declarations 18 | class MapExecuteCallback; 19 | 20 | #ifdef WIN32 21 | class NativeEventHandlerWin; 22 | #endif 23 | 24 | 25 | // for manual render handler 26 | class BrowserClient : public CefClient, public CefRenderHandler, public CefRequestHandler, public CefLifeSpanHandler, public CefMessageRouterBrowserSide::Handler, public CefDisplayHandler 27 | { 28 | public: 29 | BrowserClient(osgViewer::CompositeViewer* viewer, const std::string& url, int width, int height); 30 | ~BrowserClient(); 31 | 32 | osgViewer::View* getMapView(const std::string& name); 33 | osgEarth::MapNode* getMapNode(const std::string& name); 34 | 35 | osgViewer::CompositeViewer* getViewer() { return _viewer.get(); } 36 | 37 | CefBrowser* getBrowser() { return _browser.get(); } 38 | 39 | osg::Image* getImage() { return _image.get(); } 40 | 41 | void setSize(unsigned int width, unsigned int height); 42 | 43 | void addExecuteCallback( ExecuteCallback* callback ); 44 | 45 | bool getInFocus() { return _inFocus; } 46 | void setInFocus(bool focus) { _inFocus = focus; } 47 | 48 | 49 | // CefClient methods 50 | public: 51 | virtual CefRefPtr GetRenderHandler() { return this; } 52 | virtual CefRefPtr GetLifeSpanHandler() { return this; } 53 | virtual CefRefPtr GetDisplayHandler() { return this; } 54 | 55 | virtual bool OnProcessMessageReceived(CefRefPtr browser, 56 | CefProcessId source_process, 57 | CefRefPtr message); 58 | 59 | 60 | // CefRenderHandler methods 61 | public: 62 | 63 | 64 | bool GetRootScreenRect(CefRefPtr browser, CefRect& rect); 65 | bool GetViewRect(CefRefPtr browser, CefRect &rect); 66 | bool GetScreenPoint(CefRefPtr browser, int viewX, int viewY, int& screenX, int& screenY); 67 | //bool GetScreenInfo(CefRefPtr browser, CefScreenInfo& screen_info); 68 | void OnPopupShow(CefRefPtr browser, bool show); 69 | void OnPopupSize(CefRefPtr browser, const CefRect& rect); 70 | void OnPaint(CefRefPtr browser, PaintElementType type, const RectList &dirtyRects, const void *buffer, int width, int height); 71 | void OnCursorChange( CefRefPtr browser, CefCursorHandle cursor, CursorType type, const CefCursorInfo& custom_cursor_info ); 72 | 73 | 74 | // CefRequestHandler methods 75 | public: 76 | virtual bool OnBeforeBrowse(CefRefPtr browser, 77 | CefRefPtr frame, 78 | CefRefPtr request, 79 | bool is_redirect) OVERRIDE; 80 | 81 | virtual void OnRenderProcessTerminated(CefRefPtr browser, TerminationStatus status) OVERRIDE; 82 | 83 | 84 | // CefLifeSpanHandler methods 85 | public: 86 | virtual bool OnBeforePopup(CefRefPtr browser, 87 | CefRefPtr frame, 88 | const CefString& target_url, 89 | const CefString& target_frame_name, 90 | const CefPopupFeatures& popupFeatures, 91 | CefWindowInfo& windowInfo, 92 | CefRefPtr& client, 93 | CefBrowserSettings& settings, 94 | bool* no_javascript_access) OVERRIDE; 95 | virtual void OnAfterCreated(CefRefPtr browser) OVERRIDE; 96 | virtual bool DoClose(CefRefPtr browser) OVERRIDE; 97 | virtual void OnBeforeClose(CefRefPtr browser) OVERRIDE; 98 | 99 | 100 | // CefMessageRouterBrowserSide::Handler methods 101 | public: 102 | virtual bool OnQuery(CefRefPtr browser, 103 | CefRefPtr frame, 104 | int64 query_id, 105 | const CefString& request, 106 | bool persistent, 107 | CefRefPtr callback) OVERRIDE; 108 | 109 | virtual void OnQueryCanceled(CefRefPtr browser, 110 | CefRefPtr frame, 111 | int64 query_id) OVERRIDE; 112 | 113 | 114 | // CefDisplayHandler methods 115 | public: 116 | void OnTitleChange(CefRefPtr browser, 117 | const CefString& title) OVERRIDE; 118 | 119 | void OnFaviconURLChange(CefRefPtr browser, 120 | const std::vector& icon_urls) OVERRIDE; 121 | 122 | 123 | protected: 124 | friend class MapExecuteCallback; 125 | 126 | void initBrowser(const std::string& url); 127 | void setupMainView(unsigned int width, unsigned int height); 128 | void setupRTTCamera(); 129 | 130 | void addMapView(const std::string& id, osgViewer::View* mapView); 131 | 132 | //CefRefPtr _renderHandler; 133 | CefRefPtr _browser; 134 | CefRefPtr _messageRouter; 135 | 136 | typedef std::vector MessageHandlerSet; 137 | 138 | osg::ref_ptr _viewer; 139 | osg::ref_ptr _mainView; 140 | std::map> _mapViews; 141 | std::map> _mapNodes; 142 | 143 | osg::ref_ptr _mainEventHandler; 144 | 145 | #ifdef WIN32 146 | NativeEventHandlerWin* _nativeEventHandler; 147 | #endif 148 | 149 | typedef std::vector< osg::ref_ptr > ExecuteCallbacks; 150 | ExecuteCallbacks _callbacks; 151 | 152 | unsigned int _width; 153 | unsigned int _height; 154 | osg::ref_ptr _image; 155 | osg::ref_ptr _imageGeode; 156 | osg::ref_ptr _popupImage; 157 | osg::ref_ptr _popupVerts; 158 | osg::ref_ptr _popupNode; 159 | osg::ref_ptr _popupGeom; 160 | bool _inFocus; 161 | 162 | osg::ref_ptr _rttImage; 163 | osg::ref_ptr _rttCamera; 164 | 165 | IMPLEMENT_REFCOUNTING(BrowserClient); 166 | }; 167 | 168 | } } 169 | 170 | #endif -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required (VERSION 2.8) 3 | project (osgearthCef) 4 | 5 | SET_PROPERTY( GLOBAL PROPERTY USE_FOLDERS ON ) 6 | SET_PROPERTY( GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake Targets" ) 7 | 8 | set (${PROJECT_NAME}_VERSION_MAJOR 1) 9 | set (${PROJECT_NAME}_VERSION_MINOR 0) 10 | set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/;${CMAKE_MODULE_PATH}") 11 | 12 | # base setup 13 | SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows") 14 | SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows") 15 | 16 | # binary output 17 | if(WIN32) 18 | if(CMAKE_CL_64) 19 | message(STATUS "64 bit compiler detected.") 20 | set(OUTPUT_BINDIR ${CMAKE_CURRENT_SOURCE_DIR}/bin/x64) 21 | else() 22 | set(OUTPUT_BINDIR ${CMAKE_CURRENT_SOURCE_DIR}/bin/x86) 23 | message(STATUS "WIN32 bin dir: ${OUTPUT_BINDIR}") 24 | endif() 25 | endif() 26 | 27 | # Library output 28 | 29 | if(WIN32) 30 | SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib) 31 | MAKE_DIRECTORY(${OUTPUT_LIBDIR}) 32 | 33 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_BINDIR}) 34 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR}) 35 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR}) 36 | 37 | FOREACH(CONF ${CMAKE_CONFIGURATION_TYPES}) 38 | STRING(TOUPPER "${CONF}" CONF) 39 | STRING(TOLOWER "${CONF}" CONFL) 40 | SET("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_LIBDIR}") 41 | SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_BINDIR}/${CONFL}") 42 | IF(WIN32) 43 | SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_BINDIR}/${CONFL}") 44 | ELSE() 45 | SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_LIBDIR}") 46 | ENDIF() 47 | ENDFOREACH() 48 | 49 | LINK_DIRECTORIES( ${LINK_DIRECTORIES} ${OUTPUT_LIBDIR} ) 50 | endif() 51 | 52 | # --- OSG / osgEarth 53 | 54 | if(WIN32) 55 | 56 | # configure sdk's 57 | find_path(SDK_DIR NAMES create_lib.py PATHS c:/sdk NO_DEFAULT_PATH) 58 | 59 | 60 | find_path(CEF_ROOT_DIR NAMES include/cef_version.h PATHS ${SDK_DIR}/cef/3.1547 NO_DEFAULT_PATH) 61 | 62 | if(CMAKE_CL_64) 63 | set(LIBRARY_PATH_SUFFIXES win/64/release/lib win/64/debug/lib) 64 | else() 65 | set(LIBRARY_PATH_SUFFIXES win/32/release/lib win/32/debug/lib) 66 | endif() 67 | set(INCLUDE_PATH_SUFFIXES /inc/) 68 | set(CMAKE_CONFIGURATION_TYPES Debug Release) 69 | set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING 70 | "Reset the configurations to what we need" 71 | FORCE) 72 | endif() 73 | 74 | 75 | make_directory(${OUTPUT_BINDIR}) 76 | 77 | #-------------------------------------------------------------------------------- 78 | # source files 79 | 80 | set(APP_SRCS 81 | BrowserClient.cpp 82 | CefHelper.cpp 83 | FileExecuteCallback.cpp 84 | JsonArguments.cpp 85 | KeyboardEventAdapter.cpp 86 | MapExecuteCallback.cpp 87 | MapExtensions.cpp 88 | RenderProcessHandler.cpp 89 | ) 90 | 91 | #-------------------------------------------------------------------------------- 92 | # header files 93 | 94 | set(APP_HDRS 95 | BrowserClient 96 | CefHelper 97 | ExecuteCallback 98 | FileExecuteCallback 99 | JsonArguments 100 | KeyboardEventAdapter 101 | MapExecuteCallback 102 | MapExtensions 103 | OECefApp 104 | RenderProcessHandler 105 | ) 106 | 107 | #-------------------------------------------------------------------------------- 108 | # platform specfic files 109 | 110 | if(WIN32) 111 | 112 | set (APP_SRCS ${APP_SRCS} NativeEventHandlerWin.cpp) 113 | set (APP_HDRS ${APP_HDRS} NativeEventHandlerWin) 114 | 115 | endif() 116 | 117 | 118 | find_package(OSG COMPONENTS osg osgViewer ) 119 | include_directories(${OSG_INCLUDE_DIRS} ) 120 | find_package(OSGEARTH REQUIRED) 121 | include_directories(${OSGEARTH_INCLUDE_DIRS} ) 122 | find_package(CEF REQUIRED) 123 | include_directories(${CEF_INCLUDE_DIR} ) 124 | 125 | message(STATUS "OSG found: ${OSG_FOUND} includes: ${OSG_INCLUDE_DIRS} libraries: ${OSG_LIBRARIES_DIR}") 126 | message(STATUS "OSGEARTH found: ${OSGEARTH_FOUND} includes: ${OSGEARTH_INCLUDE_DIRS} libraries: ${OSGEARTH_LIBRARY} / ${OSGEARTH_LIBRARY_DEBUG}") 127 | 128 | #-------------------------------------------------------------------------------- 129 | 130 | set(TARGET_SRC 131 | ${APP_SRCS} 132 | ${APP_HDRS} 133 | ) 134 | 135 | # setup target 136 | 137 | add_library( 138 | ${PROJECT_NAME} 139 | ${TARGET_SRC} 140 | ${TARGET_H} 141 | ) 142 | 143 | set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_OUTPUT_NAME "${PROJECT_NAME}${CMAKE_DEBUG_POSTFIX}") 144 | set_target_properties(${PROJECT_NAME} PROPERTIES RELEASE_OUTPUT_NAME "${PROJECT_NAME}${CMAKE_RELEASE_POSTFIX}") 145 | 146 | 147 | 148 | # Separate project for test app 149 | add_executable( "osgearth_cef" applications/osgearth_cef/main.cpp ) 150 | add_executable( "demo_cef" applications/demo_cef/main.cpp ) 151 | 152 | set(EXT_LIBS 153 | OSGUTIL 154 | OSGDB 155 | OSGGA 156 | OSG 157 | OSGFX 158 | OSGSIM 159 | OSGMANIPULATOR 160 | OSGTERRAIN 161 | OSGTEXT 162 | OSGVIEWER 163 | OSGEARTH 164 | OSGEARTHANNOTATION 165 | OSGEARTHFEATURES 166 | OSGEARTHSYMBOLOGY 167 | OSGEARTHUTIL 168 | OPENTHREADS 169 | ) 170 | 171 | foreach(ext_lib ${EXT_LIBS}) 172 | STRING(TOUPPER "${ext_lib}" ext_lib_upper) 173 | 174 | target_link_libraries( "osgearth_cef" optimized "${${ext_lib_upper}_LIBRARY}" debug "${${ext_lib_upper}_LIBRARY_DEBUG}") 175 | target_link_libraries( "demo_cef" optimized "${${ext_lib_upper}_LIBRARY}" debug "${${ext_lib_upper}_LIBRARY_DEBUG}") 176 | 177 | endforeach() 178 | 179 | set(CEF_LIBS 180 | CEF 181 | CEF_WRAPPER 182 | ) 183 | # CEF libs uses _LIBRARY_RELEASE not _LIBRARY as a postfix 184 | foreach(cef_lib ${CEF_LIBS}) 185 | STRING(TOUPPER "${cef_lib}" cef_lib_upper) 186 | 187 | target_link_libraries( ${PROJECT_NAME} optimized "${${cef_lib_upper}_LIBRARY_RELEASE}" debug "${${cef_lib_upper}_LIBRARY_DEBUG}") 188 | target_link_libraries( "demo_cef" optimized "${${cef_lib_upper}_LIBRARY_RELEASE}" debug "${${cef_lib_upper}_LIBRARY_DEBUG}") 189 | 190 | endforeach() 191 | 192 | 193 | target_link_libraries( "osgearth_cef" optimized "${PROJECT_NAME}" ) 194 | target_link_libraries( "demo_cef" optimized "${PROJECT_NAME}" ) 195 | 196 | 197 | include_directories(${PROJECT_SOURCE_DIR} ) 198 | 199 | 200 | # this supports WIN32, MACOSX 201 | #install(TARGETS ${PROJECT_NAME} 202 | # BUNDLE DESTINATION . COMPONENT Runtime 203 | # RUNTIME DESTINATION bin COMPONENT Runtime 204 | #) 205 | 206 | 207 | 208 | -------------------------------------------------------------------------------- /CefHelper: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_CEFHELPER 2 | #define OSGEARTH_CEF_CEFHELPER 1 3 | 4 | #include "BrowserClient" 5 | 6 | #include 7 | 8 | namespace osgEarth { namespace Cef 9 | { 10 | 11 | class CefHelper 12 | { 13 | public: 14 | CefRefPtr load(osg::ArgumentParser& args, const std::string& htmlFile=""); 15 | 16 | int run(osg::ArgumentParser& args, const std::string& htmlFile=""); 17 | 18 | std::string usage() const; 19 | }; 20 | 21 | } } 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /CefHelper.cpp: -------------------------------------------------------------------------------- 1 | #include "CefHelper" 2 | #include "ExecuteCallback" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "include/cef_app.h" 12 | 13 | #include "OECefApp" 14 | #include "BrowserClient" 15 | 16 | using namespace osgEarth::Cef; 17 | 18 | 19 | #define LC "[CefHelper] " 20 | 21 | CefRefPtr CefHelper::load(osg::ArgumentParser& args, const std::string& htmlFile) 22 | { 23 | // Initialize CEF 24 | CefMainArgs cef_args; 25 | CefRefPtr cef_app = new OECefApp(); 26 | 27 | int exitCode = CefExecuteProcess(cef_args, cef_app, 0L); 28 | if (exitCode >= 0) 29 | { 30 | return 0L; 31 | } 32 | 33 | { 34 | CefSettings settings; 35 | 36 | if (getenv("CEF_RESOURCES_DIR") != 0) 37 | CefString(&settings.resources_dir_path) = getenv("CEF_RESOURCES_DIR"); 38 | 39 | if (getenv("CEF_LOCALES_DIR") != 0) 40 | CefString(&settings.locales_dir_path) = getenv("CEF_LOCALES_DIR"); 41 | 42 | settings.windowless_rendering_enabled = true; 43 | 44 | bool result = CefInitialize(cef_args, settings, cef_app, 0L); 45 | if (!result) 46 | { 47 | OE_WARN << LC << "CefInitialize failed." << std::endl; 48 | return 0L; 49 | } 50 | } 51 | 52 | 53 | // Read in the html file if needed 54 | std::string url = ""; 55 | if (htmlFile.length() > 0) 56 | { 57 | url = htmlFile; 58 | } 59 | else 60 | { 61 | if (!args.read("--url", url)) 62 | { 63 | for( int i=0; i viewer = new osgViewer::CompositeViewer(args); 91 | viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded); 92 | 93 | // prevents "ESC" from killing the application 94 | viewer->setKeyEventSetsDone( 0 ); 95 | viewer->setQuitEventSetsDone( false ); 96 | 97 | 98 | // Create the BrowserClient 99 | CefRefPtr browserClient = new BrowserClient(viewer.get(), fullPath, 1024, 768); 100 | 101 | 102 | return browserClient; 103 | } 104 | 105 | int CefHelper::run(osg::ArgumentParser& args, const std::string& htmlFile) 106 | { 107 | // Call load to initialize CEF and create the BrowserClient 108 | CefRefPtr browserClient = load(args, htmlFile); 109 | 110 | // Start main loop 111 | if (browserClient) 112 | { 113 | while (!browserClient->getViewer()->done()) 114 | { 115 | browserClient->getViewer()->frame(); 116 | CefDoMessageLoopWork(); 117 | } 118 | } 119 | 120 | // Shutdown the CEF processes 121 | CefShutdown(); 122 | 123 | return 0; 124 | } 125 | 126 | -------------------------------------------------------------------------------- /ExecuteCallback: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_EXECUTECALLBACK 2 | #define OSGEARTH_CEF_EXECUTECALLBACK 1 3 | 4 | 5 | #include "JsonArguments" 6 | 7 | #include "include/wrapper/cef_message_router.h" 8 | 9 | 10 | namespace osgEarth { namespace Cef 11 | { 12 | 13 | class ExecuteCallback : public osg::Referenced 14 | { 15 | public: 16 | 17 | struct ReturnVal : public osg::Referenced 18 | { 19 | ReturnVal() : value(""), errorCode(0), isAsync(false) { } 20 | ReturnVal(bool async) : value(""), errorCode(0), isAsync(async) { } 21 | ReturnVal(const std::string& val, int errCode=0) : value(val), errorCode(errCode), isAsync(false) { } 22 | 23 | std::string value; 24 | int errorCode; 25 | bool isAsync; 26 | }; 27 | 28 | // called when a command is received from the javascript object 29 | virtual ReturnVal* execute(int64 query_id, const std::string& command, const JsonArguments &args, bool persistent, CefRefPtr callback) { return 0L; } 30 | 31 | // called when a command is canceled 32 | virtual bool cancel(int64 query_id) { return false; } 33 | }; 34 | 35 | } } 36 | 37 | #endif -------------------------------------------------------------------------------- /FileExecuteCallback: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_FILEEXECUTECALLBACK 2 | #define OSGEARTH_CEF_FILEEXECUTECALLBACK 1 3 | 4 | #include "ExecuteCallback" 5 | #include "BrowserClient" 6 | 7 | #include 8 | #include 9 | 10 | namespace osgEarth { namespace Cef 11 | { 12 | 13 | class FileExecuteCallback : public ExecuteCallback 14 | { 15 | public: 16 | FileExecuteCallback(BrowserClient* client) : _client(client) { } 17 | ReturnVal* execute( int64 queryId, const std::string& command, const JsonArguments &args, bool persistent, CefRefPtr callback ); 18 | 19 | private: 20 | CefRefPtr _client; 21 | }; 22 | 23 | } } 24 | 25 | #endif // OSGEARTH_CEF_FILEEXECUTECALLBACK -------------------------------------------------------------------------------- /FileExecuteCallback.cpp: -------------------------------------------------------------------------------- 1 | #include "FileExecuteCallback" 2 | #include "ExecuteCallback" 3 | #include "BrowserClient" 4 | 5 | using namespace osgEarth::Cef; 6 | 7 | #define LC "[FileExecuteCallback] " 8 | 9 | namespace 10 | { 11 | class LocalFileDialogCallback : public CefRunFileDialogCallback 12 | { 13 | public: 14 | LocalFileDialogCallback(CefRefPtr callback) : _browserCallback(callback) { } 15 | 16 | void OnFileDialogDismissed(int selected_accept_filter, const std::vector& file_paths) 17 | { 18 | if (_browserCallback) 19 | { 20 | if (file_paths.size() == 0) 21 | { 22 | _browserCallback->Failure(-1, ""); 23 | } 24 | else 25 | { 26 | std::string s = ""; 27 | for (int i=0; i < file_paths.size(); i++) 28 | s.append(file_paths[i].ToString() + (i < file_paths.size() - 1 ? "," : "")); 29 | 30 | _browserCallback->Success(s); 31 | } 32 | } 33 | } 34 | 35 | protected: 36 | 37 | CefRefPtr _browserCallback; 38 | 39 | IMPLEMENT_REFCOUNTING(LocalFileDialogCallback); 40 | DISALLOW_COPY_AND_ASSIGN(LocalFileDialogCallback); 41 | }; 42 | } 43 | 44 | 45 | ExecuteCallback::ReturnVal* FileExecuteCallback::execute( int64 query_id, const std::string& command, const JsonArguments &args, bool persistent, CefRefPtr callback ) 46 | { 47 | if (command == "_OE_open_file_dialog" || command == "_OE_open_multifile_dialog" || command == "_OE_open_folder_dialog") 48 | { 49 | bool multiple = command == "_OE_open_multifile_dialog"; 50 | bool folder = command == "_OE_open_folder_dialog"; 51 | 52 | CefString path = args["path"]; 53 | 54 | std::vector filters; 55 | std::string filterString = args["filters"]; 56 | 57 | while (filterString.length() > 0) 58 | { 59 | std::string::size_type pos = filterString.find_first_of(", "); 60 | if (pos == std::string::npos) 61 | { 62 | filters.push_back(filterString); 63 | filterString = ""; 64 | } 65 | else 66 | { 67 | if (pos > 0) 68 | { 69 | filters.push_back(filterString.substr(0, pos)); 70 | } 71 | 72 | filterString = filterString.substr(pos + 1); 73 | } 74 | } 75 | 76 | _client->getBrowser()->GetHost()->RunFileDialog( 77 | (multiple ? CefBrowserHost::FileDialogMode::FILE_DIALOG_OPEN_MULTIPLE : folder ? CefBrowserHost::FileDialogMode::FILE_DIALOG_OPEN_FOLDER : CefBrowserHost::FileDialogMode::FILE_DIALOG_OPEN), 78 | "", // title 79 | path, // default_file_path 80 | filters, // accept_filters 81 | 0, // selected_accept_filter 82 | new LocalFileDialogCallback(callback)); 83 | 84 | return new ReturnVal(true); 85 | } 86 | 87 | return 0L; 88 | } 89 | 90 | -------------------------------------------------------------------------------- /GDALLayer: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_GDAL_LAYER 2 | #define OSGEARTH_CEF_GDAL_LAYER 1 3 | 4 | 5 | #include "include/cef_v8.h" 6 | 7 | 8 | namespace osgEarth { namespace Cef 9 | { 10 | class GDALV8Handler : public CefV8Handler { 11 | public: 12 | GDALV8Handler(); 13 | 14 | virtual bool Execute(const CefString& name, 15 | CefRefPtr object, 16 | const CefV8ValueList& arguments, 17 | CefRefPtr& retval, 18 | CefString& exception) OVERRIDE; 19 | 20 | // Provide the reference counting implementation for this class. 21 | IMPLEMENT_REFCOUNTING(GDALV8Handler); 22 | }; 23 | 24 | struct GDALAPI 25 | { 26 | static void AddGDALExtensions(CefRefPtr global); 27 | }; 28 | } } 29 | 30 | #endif -------------------------------------------------------------------------------- /GDALLayer.cpp: -------------------------------------------------------------------------------- 1 | #include "GDALLayer" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | using namespace osgEarth::Cef; 13 | 14 | 15 | class GDALUserData : public CefBase 16 | { 17 | public: 18 | GDALUserData(GDALDataset* ds) 19 | : _ds(ds) 20 | { 21 | } 22 | 23 | GDALDataset* _ds; 24 | 25 | IMPLEMENT_REFCOUNTING(GDALUserData); 26 | }; 27 | 28 | 29 | 30 | 31 | GDALV8Handler::GDALV8Handler() 32 | { 33 | } 34 | 35 | bool GDALV8Handler::Execute(const CefString& name, 36 | CefRefPtr object, 37 | const CefV8ValueList& arguments, 38 | CefRefPtr& retval, 39 | CefString& exception) 40 | { 41 | if (name == "GDALOpen") 42 | { 43 | // Open the dataset. 44 | std::string filename = arguments[0]->GetStringValue().ToString(); 45 | GDALDataset* ds = (GDALDataset*)GDALOpen(filename.c_str(), GA_ReadOnly ); 46 | if (!ds) 47 | { 48 | // If we can't open the dataset, just return NULL. 49 | retval = CefV8Value::CreateNull(); 50 | return true; 51 | } 52 | 53 | // Create an object and populate it with info about the dataset. 54 | retval = CefV8Value::CreateObject(0); 55 | 56 | // The size of the image 57 | CefRefPtr< CefV8Value> size = CefV8Value::CreateArray(2); 58 | size->SetValue(0, CefV8Value::CreateInt(ds->GetRasterXSize() ) ); 59 | size->SetValue(1, CefV8Value::CreateInt(ds->GetRasterYSize() ) ); 60 | retval->SetValue("size", size, V8_PROPERTY_ATTRIBUTE_NONE); 61 | 62 | // The SRS 63 | retval->SetValue("projection", CefV8Value::CreateString(ds->GetProjectionRef()), V8_PROPERTY_ATTRIBUTE_NONE ); 64 | 65 | // The GeoTransform info 66 | //double adfGeoTransform[6]; 67 | //if( ds->GetGeoTransform( adfGeoTransform ) == CE_None ) 68 | //{ 69 | // CefRefPtr< CefV8Value> origin = CefV8Value::CreateArray(2); 70 | // origin->SetValue(0, CefV8Value::CreateDouble(adfGeoTransform[0] ) ); 71 | // origin->SetValue(1, CefV8Value::CreateDouble(adfGeoTransform[3] ) ); 72 | // retval->SetValue("origin", origin, V8_PROPERTY_ATTRIBUTE_NONE); 73 | 74 | // CefRefPtr< CefV8Value> pixel = CefV8Value::CreateArray(2); 75 | // pixel->SetValue(0, CefV8Value::CreateDouble(adfGeoTransform[1] ) ); 76 | // pixel->SetValue(1, CefV8Value::CreateDouble(adfGeoTransform[5] ) ); 77 | // retval->SetValue("pixelsize", pixel, V8_PROPERTY_ATTRIBUTE_NONE); 78 | //} 79 | 80 | // The lat/lon bounds 81 | double adfGeoTransform[6]; 82 | if( ds->GetGeoTransform( adfGeoTransform ) == CE_None ) 83 | { 84 | double width = ds->GetRasterXSize(); 85 | double height = ds->GetRasterYSize(); 86 | double minX = adfGeoTransform[0]; 87 | double minY = adfGeoTransform[3] + width * adfGeoTransform[4] + height * adfGeoTransform[5]; 88 | double maxX = adfGeoTransform[0] + width * adfGeoTransform[1] + height * adfGeoTransform[2]; 89 | double maxY = adfGeoTransform[3]; 90 | 91 | const osgEarth::SpatialReference* srsIn = osgEarth::SpatialReference::get(ds->GetProjectionRef()); 92 | const SpatialReference* srsOut = SpatialReference::get("epsg:4326"); 93 | 94 | osgEarth::GeoPoint minIn(srsIn, minX, minY); 95 | osgEarth::GeoPoint maxIn(srsIn, maxX, maxY); 96 | 97 | osgEarth::GeoPoint minOut = minIn.transform(srsOut); 98 | osgEarth::GeoPoint maxOut = maxIn.transform(srsOut); 99 | 100 | retval->SetValue("minLat", CefV8Value::CreateDouble(minOut.y()), V8_PROPERTY_ATTRIBUTE_NONE); 101 | retval->SetValue("minLon", CefV8Value::CreateDouble(minOut.x()), V8_PROPERTY_ATTRIBUTE_NONE); 102 | retval->SetValue("maxLat", CefV8Value::CreateDouble(maxOut.y()), V8_PROPERTY_ATTRIBUTE_NONE); 103 | retval->SetValue("maxLon", CefV8Value::CreateDouble(maxOut.x()), V8_PROPERTY_ATTRIBUTE_NONE); 104 | } 105 | 106 | // The band count 107 | retval->SetValue("bands", CefV8Value::CreateInt(ds->GetRasterCount()), V8_PROPERTY_ATTRIBUTE_NONE); 108 | 109 | // Close the dataset. 110 | GDALClose( ds ); 111 | return true; 112 | } 113 | return false; 114 | } 115 | 116 | namespace 117 | { 118 | std::string code = 119 | "var gdal = {};" 120 | "(function() {" 121 | " gdal.open = function(filename) {" 122 | " native function GDALOpen();" 123 | " return GDALOpen(filename);" 124 | " };" 125 | "})();"; 126 | } 127 | 128 | 129 | void GDALAPI::AddGDALExtensions(CefRefPtr global) 130 | { 131 | // set up GDAL and OGR. 132 | OGRRegisterAll(); 133 | GDALAllRegister(); 134 | 135 | CefRefPtr< GDALV8Handler > handler = new GDALV8Handler(); 136 | CefRegisterExtension("gdal", code, handler); 137 | } 138 | -------------------------------------------------------------------------------- /GDALResourceHandler: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_GDAL_RESOURCE_HANDLER 2 | #define OSGEARTH_CEF_GDAL_RESOURCE_HANDLER 1 3 | 4 | #include "include/cef_resource_handler.h" 5 | #include "include/cef_scheme.h" 6 | 7 | #include 8 | 9 | namespace osgEarth { namespace Cef 10 | { 11 | 12 | // Implements a resource handler for previewing GDAL files 13 | // You can specify a url of the type gdal://gdal/path/to/file.tif and this will return a jpeg preview of the image. 14 | class GDALResourceHandler : public CefResourceHandler { 15 | public: 16 | GDALResourceHandler(); 17 | 18 | virtual bool ProcessRequest(CefRefPtr request, CefRefPtr callback) OVERRIDE; 19 | 20 | virtual void GetResponseHeaders(CefRefPtr response, int64& response_length, CefString& redirectUrl) OVERRIDE; 21 | 22 | virtual void Cancel() OVERRIDE; 23 | 24 | virtual bool ReadResponse(void* data_out, int bytes_to_read, int& bytes_read, CefRefPtr callback) OVERRIDE; 25 | 26 | private: 27 | IMPLEMENT_REFCOUNTING(GDALResourceHandler); 28 | 29 | osg::ref_ptr< osg::Image> _image; 30 | int _readOffset; 31 | std::string _data; 32 | }; 33 | 34 | 35 | 36 | class GDALHandlerFactory : public CefSchemeHandlerFactory 37 | { 38 | public: 39 | virtual CefRefPtr Create(CefRefPtr browser, 40 | CefRefPtr frame, 41 | const CefString& scheme_name, 42 | CefRefPtr request) 43 | OVERRIDE; 44 | 45 | IMPLEMENT_REFCOUNTING(GDALHandlerFactory); 46 | }; 47 | 48 | } } 49 | 50 | #endif -------------------------------------------------------------------------------- /GDALResourceHandler.cpp: -------------------------------------------------------------------------------- 1 | #include "GDALResourceHandler" 2 | #include 3 | 4 | using namespace osgEarth::Cef; 5 | 6 | GDALResourceHandler::GDALResourceHandler(): 7 | _readOffset(0) 8 | { 9 | } 10 | 11 | bool GDALResourceHandler::ProcessRequest(CefRefPtr request, 12 | CefRefPtr callback) 13 | { 14 | // Evaluate |request| to determine proper handling... 15 | // Execute |callback| once header information is available. 16 | // Return true to handle the request. 17 | std::string filename = request->GetURL().ToString().substr(12); 18 | _image = osgDB::readImageFile(filename + ".gdal"); 19 | 20 | osgDB::ReaderWriter* rw = osgDB::Registry::instance()->getReaderWriterForExtension("jpg"); 21 | std::stringstream out; 22 | rw->writeImage(*_image.get(), out); 23 | _data = out.str(); 24 | 25 | // Call the callback Contiue method, this should be called from a background thread once the image is actually loaded. 26 | callback->Continue(); 27 | return true; 28 | } 29 | 30 | void GDALResourceHandler::GetResponseHeaders(CefRefPtr response, 31 | int64& response_length, 32 | CefString& redirectUrl) 33 | { 34 | // Populate the response headers. 35 | response->SetMimeType("image/jpeg"); 36 | response->SetStatus(200); 37 | 38 | // Specify the resulting response length. 39 | response_length = _data.size(); 40 | } 41 | 42 | void GDALResourceHandler::Cancel(){ 43 | // Cancel the response... 44 | } 45 | 46 | bool GDALResourceHandler::ReadResponse(void* data_out, 47 | int bytes_to_read, 48 | int& bytes_read, 49 | CefRefPtr callback) 50 | { 51 | // Read up to |bytes_to_read| data into |data_out| and set |bytes_read|. 52 | // If data isn't immediately available set bytes_read=0 and execute 53 | // |callback| asynchronously. 54 | // Return true to continue the request or false to complete the request. 55 | bool hasData = false; 56 | int dataLength = _data.size(); 57 | unsigned int bytes_remaining = dataLength - _readOffset; 58 | if (_readOffset < dataLength) 59 | { 60 | unsigned int numToRead = min(bytes_to_read, bytes_remaining); 61 | memcpy(data_out, 62 | _data.c_str() + _readOffset, 63 | numToRead); 64 | bytes_read = numToRead; 65 | _readOffset += numToRead; 66 | hasData = true; 67 | } 68 | else 69 | { 70 | bytes_read = 0; 71 | } 72 | 73 | return hasData; 74 | } 75 | 76 | /*************************************************************/ 77 | 78 | CefRefPtr GDALHandlerFactory::Create(CefRefPtr browser, 79 | CefRefPtr frame, 80 | const CefString& scheme_name, 81 | CefRefPtr request) 82 | { 83 | // Return a new resource handler instance to handle the request. 84 | return new GDALResourceHandler(); 85 | } -------------------------------------------------------------------------------- /JsonArguments: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_JSONARGUMENTS 2 | #define OSGEARTH_CEF_JSONARGUMENTS 1 3 | 4 | #include 5 | 6 | namespace osgEarth { namespace Cef 7 | { 8 | 9 | class JsonArguments 10 | { 11 | public: 12 | JsonArguments( const std::string& json_string ); 13 | std::string operator [] ( const std::string& key ) const; 14 | 15 | private: 16 | osgEarth::Json::Value _obj; 17 | }; 18 | 19 | } } 20 | 21 | #endif -------------------------------------------------------------------------------- /JsonArguments.cpp: -------------------------------------------------------------------------------- 1 | #include "JsonArguments" 2 | 3 | using namespace osgEarth::Cef; 4 | 5 | 6 | JsonArguments::JsonArguments( const std::string& json_string ) 7 | { 8 | osgEarth::Json::Reader reader; 9 | if ( !reader.parse( json_string, _obj ) ) 10 | { 11 | OE_WARN << "JSON PARSING ERROR in: " << json_string << std::endl; 12 | } 13 | else 14 | { 15 | OE_DEBUG << "Parsed: " << json_string << std::endl; 16 | } 17 | } 18 | 19 | std::string JsonArguments::operator [] ( const std::string& key ) const 20 | { 21 | osgEarth::Json::Value value = _obj.get( key, osgEarth::Json::Value() ); 22 | 23 | if ( value.isNull() ) 24 | { 25 | return ""; 26 | } 27 | else if ( value.isConvertibleTo(osgEarth::Json::stringValue) ) 28 | { 29 | return value.asString(); 30 | } 31 | else 32 | { 33 | osgEarth::Json::FastWriter writer; 34 | return writer.write( value ); 35 | } 36 | } -------------------------------------------------------------------------------- /KeyboardEventAdapter: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_KEYBOARDEVENTADAPTER 2 | #define OSGEARTH_CEF_KEYBOARDEVENTADAPTER 1 3 | 4 | #include 5 | 6 | namespace osgEarth { namespace Cef 7 | { 8 | 9 | class KeyboardEventAdapter 10 | { 11 | public: 12 | 13 | KeyboardEventAdapter(); 14 | 15 | int remapKey(int key); 16 | unsigned int getCefModifiers(int modKeyMask); 17 | bool confirmCharKey(int key); 18 | 19 | protected: 20 | 21 | typedef std::map KeyMap; 22 | KeyMap _keymap; 23 | }; 24 | 25 | } } 26 | 27 | #endif -------------------------------------------------------------------------------- /MapExecuteCallback: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_MAPEXECUTECALLBACK 2 | #define OSGEARTH_CEF_MAPEXECUTECALLBACK 1 3 | 4 | #include "ExecuteCallback" 5 | #include "BrowserClient" 6 | 7 | #include 8 | #include 9 | 10 | namespace osgEarth { namespace Cef 11 | { 12 | 13 | class MapExecuteCallback : public ExecuteCallback 14 | { 15 | public: 16 | MapExecuteCallback(BrowserClient* client) : _client(client) { } 17 | ReturnVal* execute( int64 queryId, const std::string& command, const JsonArguments &args, bool persistent, CefRefPtr callback ); 18 | 19 | private: 20 | void ParseMapNode(osgEarth::MapNode* mapNode, osgViewer::View* view, osg::Group* root); 21 | 22 | CefRefPtr _client; 23 | 24 | struct MapQueryCallback: public osgEarth::MapCallback 25 | { 26 | std::string mapId; 27 | CefRefPtr callback; 28 | 29 | MapQueryCallback(const std::string& map_id, CefRefPtr queryCallback): mapId(map_id), callback(queryCallback) { } 30 | 31 | void onMapModelChanged( const osgEarth::MapModelChange& change ); 32 | }; 33 | 34 | std::map< int64, osg::ref_ptr > _mapCallbacks; 35 | }; 36 | 37 | } } 38 | 39 | #endif -------------------------------------------------------------------------------- /MapExecuteCallback.cpp: -------------------------------------------------------------------------------- 1 | #include "MapExecuteCallback" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | using namespace osgEarth::Cef; 12 | using namespace osgEarth::Util; 13 | 14 | 15 | #define LC "[MapExecuteCallback] " 16 | 17 | void MapExecuteCallback::ParseMapNode(osgEarth::MapNode* mapNode, osgViewer::View* view, osg::Group* root) 18 | { 19 | const Config& externals = mapNode->externalConfig(); 20 | const Config& skyConf = externals.child("sky"); 21 | const Config& oceanConf = externals.child("ocean"); 22 | const Config& annoConf = externals.child("annotations"); 23 | 24 | // Sky in the map node externals: 25 | if ( !skyConf.empty() ) 26 | { 27 | SkyOptions options(skyConf); 28 | if ( options.getDriver().empty() ) 29 | { 30 | if ( mapNode->getMapSRS()->isGeographic() ) 31 | options.setDriver("simple"); 32 | else 33 | options.setDriver("gl"); 34 | } 35 | 36 | SkyNode* sky = SkyNode::create(options, mapNode); 37 | if ( sky ) 38 | { 39 | sky->attach( view, 0 ); 40 | sky->setDateTime( DateTime() ); 41 | osgEarth::insertGroup(sky, mapNode); 42 | } 43 | } 44 | 45 | // Ocean in the map node externals: 46 | if ( !oceanConf.empty() ) 47 | { 48 | OceanNode* ocean = OceanNode::create(OceanOptions(oceanConf), mapNode); 49 | if ( ocean ) 50 | { 51 | root->addChild( ocean ); 52 | 53 | //Control* c = OceanControlFactory().create(ocean); 54 | //if ( c ) 55 | // mainContainer->addControl(c); 56 | } 57 | } 58 | 59 | // Annotations in the map node externals: 60 | if ( !annoConf.empty() ) 61 | { 62 | osg::Group* annotations = 0L; 63 | osgEarth::Annotation::AnnotationRegistry::instance()->create( mapNode, annoConf, 0L, annotations ); //TODO: pass dbOptions along 64 | if ( annotations ) 65 | { 66 | root->addChild( annotations ); 67 | } 68 | } 69 | } 70 | 71 | ExecuteCallback::ReturnVal* MapExecuteCallback::execute( int64 query_id, const std::string& command, const JsonArguments &args, bool persistent, CefRefPtr callback ) 72 | { 73 | if (command == "_OE_create_map") 74 | { 75 | std::string id = args["id"]; 76 | if (id.empty()) 77 | return new ReturnVal("Error creating map: no id specified.", -1); 78 | 79 | if (_client->_mapViews.find(id) != _client->_mapViews.end()) 80 | return new ReturnVal("Error creating map: duplicate id specified.", -1); 81 | 82 | int x = osgEarth::as(args["x"], 0); 83 | int y = osgEarth::as(args["y"], 0); 84 | int width = osgEarth::as(args["width"], 0); 85 | int height = osgEarth::as(args["height"], 0); 86 | 87 | if (width <= 0 || height <= 0) 88 | return new ReturnVal("Error creating map: width and height must be > 0.", -1); 89 | 90 | OE_DEBUG << LC << "createMap(" << id << "): at " << x << ", " << y << " size " << width << " x " << height << std::endl; 91 | 92 | osgViewer::View* mapView = new osgViewer::View(); 93 | mapView->getCamera()->setGraphicsContext(_client->_viewer->getView(0)->getCamera()->getGraphicsContext()); 94 | mapView->getCamera()->setNearFarRatio(0.00002); 95 | mapView->getCamera()->setViewport( x, y, width, height); 96 | mapView->getCamera()->setRenderOrder(osg::Camera::PRE_RENDER); 97 | mapView->setCameraManipulator( new osgEarth::Util::EarthManipulator() ); 98 | mapView->getCamera()->setProjectionMatrixAsPerspective(30.0, double(width) / double(height), 1.0, 1000.0); 99 | 100 | _client->addMapView(id, mapView); 101 | 102 | osg::Group* root = new osg::Group(); 103 | 104 | // Install a canvas for any UI controls we plan to create: 105 | //osgEarth::Util::Controls::ControlCanvas* canvas = osgEarth::Util::Controls::ControlCanvas::getOrCreate(mapView); 106 | //root->addChild(canvas); 107 | 108 | std::string mapFile = args["file"]; 109 | if (!mapFile.empty()) 110 | { 111 | osg::Node* node = osgDB::readNodeFile(mapFile); 112 | if (node) 113 | { 114 | root->addChild(node); 115 | 116 | osgEarth::MapNode* mapNode = osgEarth::MapNode::findMapNode(node); 117 | _client->_mapNodes[id] = mapNode; 118 | 119 | ParseMapNode(mapNode, mapView, root); 120 | } 121 | else 122 | { 123 | _client->_mapNodes[id] = 0L; 124 | OE_WARN << LC << "Could not load map file: " << mapFile << std::endl; 125 | } 126 | } 127 | else 128 | { 129 | _client->_mapNodes[id] = 0L; 130 | } 131 | 132 | mapView->setSceneData(root); 133 | 134 | return new ReturnVal(); 135 | } 136 | else if (command == "_OE_set_map") 137 | { 138 | std::string id = args["id"]; 139 | if (id.empty()) 140 | return new ReturnVal("Error setting map: no id specified.", -1); 141 | 142 | osg::ref_ptr mapView = _client->getMapView(id); 143 | if (!mapView.valid()) 144 | return new ReturnVal("Error setting map: specified id \"" + id + "\" not found.", -1); 145 | 146 | int x = osgEarth::as(args["x"], 0); 147 | int y = osgEarth::as(args["y"], 0); 148 | int width = osgEarth::as(args["width"], 0); 149 | int height = osgEarth::as(args["height"], 0); 150 | 151 | if (width <= 0 || height <= 0) 152 | return new ReturnVal("Error setting map: width and height must be > 0.", -1); 153 | 154 | OE_DEBUG << LC << "setMap(" << id << "): at " << x << ", " << y << " size " << width << " x " << height << std::endl; 155 | 156 | mapView->getCamera()->setViewport( x, y, width, height); 157 | mapView->getCamera()->setProjectionMatrixAsPerspective(30.0, double(width) / double(height), 1.0, 1000.0); 158 | 159 | //manually update ControlCanvas (needed because of event ordering) 160 | osgEarth::Util::Controls::ControlCanvas* cs = osgEarth::Util::Controls::ControlCanvas::get(mapView); 161 | cs->setProjectionMatrix(osg::Matrix::ortho2D( 0, width-1, 0, height-1 ) ); 162 | 163 | ControlContext cx; 164 | cx._view = mapView.get(); 165 | cx._vp = new osg::Viewport( 0, 0, width, height ); 166 | 167 | osg::View* view = mapView.get(); 168 | osg::GraphicsContext* gc = view->getCamera()->getGraphicsContext(); 169 | if ( !gc && view->getNumSlaves() > 0 ) 170 | gc = view->getSlave(0)._camera->getGraphicsContext(); 171 | 172 | if ( gc ) 173 | cx._viewContextID = gc->getState()->getContextID(); 174 | else 175 | cx._viewContextID = ~0u; 176 | 177 | cs->setControlContext( cx ); 178 | 179 | 180 | return new ReturnVal(); 181 | } 182 | else if (command == "_OE_map_load_file") 183 | { 184 | std::string id = args["id"]; 185 | if (id.empty()) 186 | return new ReturnVal("Map load error: no id specified.", -1); 187 | 188 | osg::ref_ptr mapView = _client->getMapView(id); 189 | if (!mapView.valid()) 190 | return new ReturnVal("Map load error: id not found.", -1); 191 | 192 | std::string url = args["url"]; 193 | if (url.empty()) 194 | return new ReturnVal("Map load error: no url specified.", -1); 195 | 196 | // Find and clear root node 197 | osg::Group* root = dynamic_cast(mapView->getSceneData()); 198 | if (root) 199 | { 200 | root->removeChildren(0, root->getNumChildren()); 201 | } 202 | else 203 | { 204 | root = new osg::Group(); 205 | mapView->setSceneData(root); 206 | } 207 | 208 | //TODO: cleanup old mapnode? 209 | _client->_mapNodes[id] = 0L; 210 | 211 | osg::Node* node = osgDB::readNodeFile(url); 212 | if (node) 213 | { 214 | root->addChild(node); 215 | osgEarth::MapNode* mapNode = osgEarth::MapNode::findMapNode(node); 216 | _client->_mapNodes[id] = mapNode; 217 | 218 | mapView->setCameraManipulator( new osgEarth::Util::EarthManipulator() ); 219 | 220 | ParseMapNode(mapNode, mapView, root); 221 | } 222 | else 223 | { 224 | OE_DEBUG << LC << "Could not load map file: " << url << std::endl; 225 | return new ReturnVal("Map load error: could not load map file: " + url, -1); 226 | } 227 | 228 | return new ReturnVal(); 229 | } 230 | else if (command == "_OE_map_home") 231 | { 232 | std::string id = args["id"]; 233 | if (id.empty()) 234 | return new ReturnVal("Map error: no id specified.", -1); 235 | 236 | osg::ref_ptr mapView = _client->getMapView(id); 237 | if (!mapView.valid()) 238 | return new ReturnVal("Map error: id not found.", -1); 239 | 240 | mapView->getCameraManipulator()->home(0.0); 241 | 242 | return new ReturnVal(); 243 | } 244 | else if (command == "_OE_get_image_layers") 245 | { 246 | std::string id = args["id"]; 247 | if (id.empty()) 248 | return new ReturnVal("Map error: no id specified.", -1); 249 | 250 | osg::ref_ptr mapNode = _client->getMapNode(id); 251 | if (!mapNode.valid()) 252 | return new ReturnVal("Map error: id not found.", -1); 253 | 254 | osgEarth::ImageLayerVector layers; 255 | mapNode->getMap()->getImageLayers(layers); 256 | 257 | std::stringstream output; 258 | output << "{\"layers\": ["; 259 | for (osgEarth::ImageLayerVector::const_iterator it = layers.begin(); it != layers.end(); ++it) 260 | { 261 | if (it != layers.begin()) 262 | output << ","; 263 | 264 | output << "{\"id\": " << (*it)->getUID() << ", \"name\": \"" << (*it)->getName() << "\"}"; 265 | } 266 | output << "]}"; 267 | 268 | return new ReturnVal(output.str()); 269 | } 270 | else if (command == "_OE_get_elevation_layers") 271 | { 272 | std::string id = args["id"]; 273 | if (id.empty()) 274 | return new ReturnVal("Map error: no id specified.", -1); 275 | 276 | osg::ref_ptr mapNode = _client->getMapNode(id); 277 | if (!mapNode.valid()) 278 | return new ReturnVal("Map error: id not found.", -1); 279 | 280 | osgEarth::ElevationLayerVector layers; 281 | mapNode->getMap()->getElevationLayers(layers); 282 | 283 | std::stringstream output; 284 | output << "{\"layers\": ["; 285 | for (osgEarth::ElevationLayerVector::const_iterator it = layers.begin(); it != layers.end(); ++it) 286 | { 287 | if (it != layers.begin()) 288 | output << ","; 289 | 290 | output << "{\"id\": " << (*it)->getUID() << ", \"name\": \"" << (*it)->getName() << "\"}"; 291 | } 292 | output << "]}"; 293 | 294 | return new ReturnVal(output.str()); 295 | } 296 | else if (command == "_OE_get_model_layers") 297 | { 298 | std::string id = args["id"]; 299 | if (id.empty()) 300 | return new ReturnVal("Map error: no id specified.", -1); 301 | 302 | osg::ref_ptr mapNode = _client->getMapNode(id); 303 | if (!mapNode.valid()) 304 | return new ReturnVal("Map error: id not found.", -1); 305 | 306 | osgEarth::ModelLayerVector layers; 307 | mapNode->getMap()->getModelLayers(layers); 308 | 309 | std::stringstream output; 310 | output << "{\"layers\": ["; 311 | for (osgEarth::ModelLayerVector::const_iterator it = layers.begin(); it != layers.end(); ++it) 312 | { 313 | if (it != layers.begin()) 314 | output << ","; 315 | 316 | output << "{\"id\": " << (*it)->getUID() << ", \"name\": \"" << (*it)->getName() << "\"}"; 317 | } 318 | output << "]}"; 319 | 320 | return new ReturnVal(output.str()); 321 | } 322 | else if (command == "_OE_add_map_listener") 323 | { 324 | std::string id = args["id"]; 325 | if (id.empty()) 326 | return new ReturnVal("Map error: no id specified.", -1); 327 | 328 | osg::ref_ptr mapNode = _client->getMapNode(id); 329 | if (!mapNode.valid()) 330 | return new ReturnVal("Map error: id not found.", -1); 331 | 332 | if (!persistent || !callback) 333 | return new ReturnVal("Map listener callback missing or not persistent.", -1); 334 | 335 | osg::ref_ptr cb = new MapQueryCallback(id, callback); 336 | mapNode->getMap()->addMapCallback(cb); 337 | _mapCallbacks[query_id] = cb; 338 | 339 | return new ReturnVal(); 340 | } 341 | 342 | return 0L; 343 | } 344 | 345 | void MapExecuteCallback::MapQueryCallback::onMapModelChanged( const osgEarth::MapModelChange& change ) 346 | { 347 | std::string eventName = ""; 348 | osgEarth::Json::Value eventData; 349 | 350 | switch( change.getAction() ) 351 | { 352 | case osgEarth::MapModelChange::ADD_ELEVATION_LAYER: 353 | eventName = "elevationlayeradded"; 354 | eventData["id"] = change.getLayer()->getUID(); 355 | eventData["index"] = change.getFirstIndex(); 356 | break; 357 | case osgEarth::MapModelChange::ADD_IMAGE_LAYER: 358 | eventName = "imagelayeradded"; 359 | eventData["id"] = change.getLayer()->getUID(); 360 | eventData["index"] = change.getFirstIndex(); 361 | break; 362 | case osgEarth::MapModelChange::ADD_MASK_LAYER: 363 | eventName = "masklayeradded"; 364 | eventData["id"] = change.getMaskLayer()->getUID(); 365 | case osgEarth::MapModelChange::ADD_MODEL_LAYER: 366 | eventName = "modellayeradded"; 367 | eventData["id"] = change.getModelLayer()->getUID(); 368 | break; 369 | case osgEarth::MapModelChange::REMOVE_ELEVATION_LAYER: 370 | eventName = "elevationlayerremoved"; 371 | eventData["id"] = change.getLayer()->getUID(); 372 | eventData["index"] = change.getFirstIndex(); 373 | break; 374 | case osgEarth::MapModelChange::REMOVE_IMAGE_LAYER: 375 | eventName = "imagelayerremoved"; 376 | eventData["id"] = change.getLayer()->getUID(); 377 | eventData["index"] = change.getFirstIndex(); 378 | break; 379 | case osgEarth::MapModelChange::REMOVE_MASK_LAYER: 380 | eventName = "masklayerremoved"; 381 | eventData["id"] = change.getMaskLayer()->getUID(); 382 | break; 383 | case osgEarth::MapModelChange::REMOVE_MODEL_LAYER: 384 | eventName = "modellayerremoved"; 385 | eventData["id"] = change.getModelLayer()->getUID(); 386 | break; 387 | onModelLayerRemoved( change.getModelLayer() ); break; 388 | case osgEarth::MapModelChange::MOVE_ELEVATION_LAYER: 389 | eventName = "elevationlayermoved"; 390 | eventData["id"] = change.getLayer()->getUID(); 391 | eventData["old_index"] = change.getFirstIndex(); 392 | eventData["new_index"] = change.getSecondIndex(); 393 | break; 394 | case osgEarth::MapModelChange::MOVE_IMAGE_LAYER: 395 | eventName = "imagelayermoved"; 396 | eventData["id"] = change.getLayer()->getUID(); 397 | eventData["old_index"] = change.getFirstIndex(); 398 | eventData["new_index"] = change.getSecondIndex(); 399 | break; 400 | case osgEarth::MapModelChange::MOVE_MODEL_LAYER: 401 | eventName = "modellayermoved"; 402 | eventData["id"] = change.getModelLayer()->getUID(); 403 | eventData["old_index"] = change.getFirstIndex(); 404 | eventData["new_index"] = change.getSecondIndex(); 405 | break; 406 | } 407 | 408 | if (eventName.length() > 0) 409 | { 410 | eventData["eventName"] = eventName; 411 | eventData["mapId"] = mapId; 412 | osgEarth::Json::FastWriter writer; 413 | std::string data = writer.write(eventData); 414 | 415 | callback->Success(data); 416 | } 417 | } -------------------------------------------------------------------------------- /MapExtensions: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_MAP_EXTENSIONS 2 | #define OSGEARTH_CEF_MAP_EXTENSIONS 1 3 | 4 | 5 | #include "include/cef_v8.h" 6 | 7 | 8 | namespace osgEarth { namespace Cef 9 | { 10 | class MapV8Handler : public CefV8Handler { 11 | public: 12 | MapV8Handler(); 13 | 14 | virtual bool Execute(const CefString& name, 15 | CefRefPtr object, 16 | const CefV8ValueList& arguments, 17 | CefRefPtr& retval, 18 | CefString& exception) OVERRIDE; 19 | 20 | // Provide the reference counting implementation for this class. 21 | IMPLEMENT_REFCOUNTING(MapV8Handler); 22 | }; 23 | 24 | struct MapAPI 25 | { 26 | static void AddExtensions(CefRefPtr global); 27 | }; 28 | } } 29 | 30 | #endif -------------------------------------------------------------------------------- /MapExtensions.cpp: -------------------------------------------------------------------------------- 1 | #include "MapExtensions" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace osgEarth::Cef; 8 | using namespace osgEarth; 9 | 10 | 11 | MapV8Handler::MapV8Handler() 12 | { 13 | } 14 | 15 | bool MapV8Handler::Execute(const CefString& name, 16 | CefRefPtr object, 17 | const CefV8ValueList& arguments, 18 | CefRefPtr& retval, 19 | CefString& exception) 20 | { 21 | if (name == "ScreenCapture") 22 | { 23 | CefRefPtr< CefV8Value > opt = arguments[0]; 24 | 25 | std::string filename = "screen.png"; 26 | if (opt->HasValue("filename")) 27 | filename = opt->GetValue("filename")->GetStringValue().ToString(); 28 | 29 | int width = -1; 30 | int height = -1; 31 | 32 | std::string mapId = ""; 33 | if (opt->HasValue("id")) 34 | { 35 | mapId = opt->GetValue("id")->GetStringValue().ToString(); 36 | 37 | if (opt->HasValue("width")) 38 | width = opt->GetValue("width")->GetIntValue(); 39 | 40 | if (opt->HasValue("height")) 41 | height = opt->GetValue("height")->GetIntValue(); 42 | } 43 | 44 | CefRefPtr browser = CefV8Context::GetCurrentContext()->GetBrowser(); 45 | 46 | CefRefPtr message = CefProcessMessage::Create("capture_screen"); 47 | 48 | CefRefPtr args = message->GetArgumentList(); 49 | 50 | if (mapId.size() > 0) 51 | { 52 | if (width > 0 && height > 0) 53 | { 54 | args->SetSize(4); 55 | args->SetInt(2, width); 56 | args->SetInt(3, height); 57 | } 58 | else 59 | { 60 | args->SetSize(2); 61 | } 62 | 63 | args->SetString(0, filename.c_str()); 64 | args->SetString(1, mapId.c_str()); 65 | } 66 | else 67 | { 68 | args->SetSize(1); 69 | args->SetString(0, filename.c_str()); 70 | } 71 | 72 | browser->SendProcessMessage(PID_BROWSER, message); 73 | 74 | return true; 75 | } 76 | return false; 77 | } 78 | 79 | namespace 80 | { 81 | std::string code = 82 | "var osgearth;" 83 | "if (!osgearth) {" 84 | " osgearth = {};" 85 | "}" 86 | "(function() {" 87 | " osgearth.captureScreen = function(options) {" 88 | " native function ScreenCapture();" 89 | " return ScreenCapture(options);" 90 | " };" 91 | "})();"; 92 | } 93 | 94 | 95 | void MapAPI::AddExtensions(CefRefPtr global) 96 | { 97 | CefRefPtr< MapV8Handler > handler = new MapV8Handler(); 98 | CefRegisterExtension("map", code, handler); 99 | } 100 | -------------------------------------------------------------------------------- /NativeEventHandlerWin: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_NATIVEEVENTHANDLERWIN 2 | #define OSGEARTH_CEF_NATIVEEVENTHANDLERWIN 1 3 | 4 | #include "BrowserClient" 5 | 6 | #include 7 | 8 | namespace osgEarth { namespace Cef 9 | { 10 | 11 | class NativeEventHandlerWin 12 | { 13 | public: 14 | 15 | NativeEventHandlerWin(HWND hWnd, BrowserClient* browserClient, CefBrowser* browser); 16 | 17 | private: 18 | 19 | static int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam); 20 | static int GetCefMouseModifiers(WPARAM wparam); 21 | static bool isKeyDown(WPARAM wparam); 22 | 23 | static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 24 | 25 | CefRefPtr _browserClient; 26 | CefRefPtr _browser; 27 | WNDPROC _oldWndProc; 28 | }; 29 | 30 | } } 31 | 32 | #endif // OSGEARTH_CEF_NATIVEEVENTHANDLERWIN -------------------------------------------------------------------------------- /NativeEventHandlerWin.cpp: -------------------------------------------------------------------------------- 1 | #include "NativeEventHandlerWin" 2 | 3 | #include "include/internal/cef_types.h" 4 | 5 | 6 | using namespace osgEarth; 7 | using namespace osgEarth::Cef; 8 | 9 | 10 | #define LC "[NativeEventHandlerWin] " 11 | 12 | 13 | NativeEventHandlerWin::NativeEventHandlerWin(HWND hWnd, BrowserClient* browserClient, CefBrowser* browser) 14 | : _browserClient(browserClient), _browser(browser), _oldWndProc(0L) 15 | { 16 | _oldWndProc = (WNDPROC)SetWindowLongPtr( hWnd, GWLP_WNDPROC, reinterpret_cast(&NativeEventHandlerWin::WndProc) ); 17 | 18 | if (!_oldWndProc) 19 | OE_WARN << LC << "Error registering WNDPROC handler" << std::endl; 20 | 21 | SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast(this)); 22 | } 23 | 24 | int NativeEventHandlerWin::GetCefMouseModifiers(WPARAM wparam) 25 | { 26 | int modifiers = 0; 27 | if (wparam & MK_CONTROL) 28 | modifiers |= EVENTFLAG_CONTROL_DOWN; 29 | if (wparam & MK_SHIFT) 30 | modifiers |= EVENTFLAG_SHIFT_DOWN; 31 | if (isKeyDown(VK_MENU)) 32 | modifiers |= EVENTFLAG_ALT_DOWN; 33 | if (wparam & MK_LBUTTON) 34 | modifiers |= EVENTFLAG_LEFT_MOUSE_BUTTON; 35 | if (wparam & MK_MBUTTON) 36 | modifiers |= EVENTFLAG_MIDDLE_MOUSE_BUTTON; 37 | if (wparam & MK_RBUTTON) 38 | modifiers |= EVENTFLAG_RIGHT_MOUSE_BUTTON; 39 | 40 | // Low bit set from GetKeyState indicates "toggled". 41 | if (::GetKeyState(VK_NUMLOCK) & 1) 42 | modifiers |= EVENTFLAG_NUM_LOCK_ON; 43 | if (::GetKeyState(VK_CAPITAL) & 1) 44 | modifiers |= EVENTFLAG_CAPS_LOCK_ON; 45 | return modifiers; 46 | } 47 | 48 | int NativeEventHandlerWin::GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam) 49 | { 50 | int modifiers = 0; 51 | if (isKeyDown(VK_SHIFT)) 52 | modifiers |= EVENTFLAG_SHIFT_DOWN; 53 | if (isKeyDown(VK_CONTROL)) 54 | modifiers |= EVENTFLAG_CONTROL_DOWN; 55 | if (isKeyDown(VK_MENU)) 56 | modifiers |= EVENTFLAG_ALT_DOWN; 57 | 58 | // Low bit set from GetKeyState indicates "toggled". 59 | if (::GetKeyState(VK_NUMLOCK) & 1) 60 | modifiers |= EVENTFLAG_NUM_LOCK_ON; 61 | if (::GetKeyState(VK_CAPITAL) & 1) 62 | modifiers |= EVENTFLAG_CAPS_LOCK_ON; 63 | 64 | switch (wparam) { 65 | case VK_RETURN: 66 | if ((lparam >> 16) & KF_EXTENDED) 67 | modifiers |= EVENTFLAG_IS_KEY_PAD; 68 | break; 69 | case VK_INSERT: 70 | case VK_DELETE: 71 | case VK_HOME: 72 | case VK_END: 73 | case VK_PRIOR: 74 | case VK_NEXT: 75 | case VK_UP: 76 | case VK_DOWN: 77 | case VK_LEFT: 78 | case VK_RIGHT: 79 | if (!((lparam >> 16) & KF_EXTENDED)) 80 | modifiers |= EVENTFLAG_IS_KEY_PAD; 81 | break; 82 | case VK_NUMLOCK: 83 | case VK_NUMPAD0: 84 | case VK_NUMPAD1: 85 | case VK_NUMPAD2: 86 | case VK_NUMPAD3: 87 | case VK_NUMPAD4: 88 | case VK_NUMPAD5: 89 | case VK_NUMPAD6: 90 | case VK_NUMPAD7: 91 | case VK_NUMPAD8: 92 | case VK_NUMPAD9: 93 | case VK_DIVIDE: 94 | case VK_MULTIPLY: 95 | case VK_SUBTRACT: 96 | case VK_ADD: 97 | case VK_DECIMAL: 98 | case VK_CLEAR: 99 | modifiers |= EVENTFLAG_IS_KEY_PAD; 100 | break; 101 | case VK_SHIFT: 102 | if (isKeyDown(VK_LSHIFT)) 103 | modifiers |= EVENTFLAG_IS_LEFT; 104 | else if (isKeyDown(VK_RSHIFT)) 105 | modifiers |= EVENTFLAG_IS_RIGHT; 106 | break; 107 | case VK_CONTROL: 108 | if (isKeyDown(VK_LCONTROL)) 109 | modifiers |= EVENTFLAG_IS_LEFT; 110 | else if (isKeyDown(VK_RCONTROL)) 111 | modifiers |= EVENTFLAG_IS_RIGHT; 112 | break; 113 | case VK_MENU: 114 | if (isKeyDown(VK_LMENU)) 115 | modifiers |= EVENTFLAG_IS_LEFT; 116 | else if (isKeyDown(VK_RMENU)) 117 | modifiers |= EVENTFLAG_IS_RIGHT; 118 | break; 119 | case VK_LWIN: 120 | modifiers |= EVENTFLAG_IS_LEFT; 121 | break; 122 | case VK_RWIN: 123 | modifiers |= EVENTFLAG_IS_RIGHT; 124 | break; 125 | } 126 | return modifiers; 127 | } 128 | 129 | bool NativeEventHandlerWin::isKeyDown(WPARAM wparam) 130 | { 131 | return (GetKeyState(wparam) & 0x8000) != 0; 132 | } 133 | 134 | LRESULT CALLBACK NativeEventHandlerWin::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 135 | { 136 | NativeEventHandlerWin* handler = reinterpret_cast(GetWindowLongPtr(hWnd, GWLP_USERDATA)); 137 | 138 | 139 | if (handler && handler->_browserClient && handler->_browserClient->getInFocus()) 140 | { 141 | switch (message) 142 | { 143 | case WM_SYSCHAR: 144 | case WM_SYSKEYDOWN: 145 | case WM_SYSKEYUP: 146 | case WM_KEYDOWN: 147 | case WM_KEYUP: 148 | case WM_CHAR: 149 | { 150 | CefKeyEvent event; 151 | event.windows_key_code = wParam; 152 | event.native_key_code = lParam; 153 | event.is_system_key = message == WM_SYSCHAR || 154 | message == WM_SYSKEYDOWN || 155 | message == WM_SYSKEYUP; 156 | 157 | if (message == WM_KEYDOWN || message == WM_SYSKEYDOWN) 158 | event.type = KEYEVENT_RAWKEYDOWN; 159 | else if (message == WM_KEYUP || message == WM_SYSKEYUP) 160 | event.type = KEYEVENT_KEYUP; 161 | else 162 | event.type = KEYEVENT_CHAR; 163 | event.modifiers = GetCefKeyboardModifiers(wParam, lParam); 164 | 165 | if (handler && handler->_browser /*&& handler->_browserClient->getInFocus()*/) 166 | handler->_browser->GetHost()->SendKeyEvent(event); 167 | 168 | break; 169 | } 170 | } 171 | } 172 | 173 | return CallWindowProc(handler->_oldWndProc, hWnd, message, wParam, lParam); 174 | } 175 | -------------------------------------------------------------------------------- /OECefApp: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_OECEFAPP 2 | #define OSGEARTH_CEF_OECEFAPP 1 3 | 4 | #include "include/cef_app.h" 5 | 6 | #include "RenderProcessHandler" 7 | 8 | namespace osgEarth { namespace Cef 9 | { 10 | 11 | class OECefApp : public CefApp 12 | { 13 | public: 14 | OECefApp() { _renderProcHandler = new RenderProcessHandler(); } 15 | 16 | public: 17 | CefRefPtr GetRenderProcessHandler() { return _renderProcHandler; } 18 | 19 | private: 20 | CefRefPtr _renderProcHandler; 21 | 22 | IMPLEMENT_REFCOUNTING(OECefApp); 23 | }; 24 | 25 | } } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /PackagerExtensions: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_PACKAGER_EXTENSIONS 2 | #define OSGEARTH_CEF_PACKAGER_EXTENSIONS 1 3 | 4 | 5 | #include "include/cef_v8.h" 6 | 7 | 8 | namespace osgEarth { namespace Cef 9 | { 10 | class PackagerV8Handler : public CefV8Handler { 11 | public: 12 | PackagerV8Handler(); 13 | 14 | virtual bool Execute(const CefString& name, 15 | CefRefPtr object, 16 | const CefV8ValueList& arguments, 17 | CefRefPtr& retval, 18 | CefString& exception) OVERRIDE; 19 | 20 | // Provide the reference counting implementation for this class. 21 | IMPLEMENT_REFCOUNTING(PackagerV8Handler); 22 | }; 23 | 24 | struct PackagerAPI 25 | { 26 | static void AddExtensions(CefRefPtr global); 27 | }; 28 | } } 29 | 30 | #endif -------------------------------------------------------------------------------- /PackagerExtensions.cpp: -------------------------------------------------------------------------------- 1 | #include "PackagerExtensions" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | using namespace osgEarth::Cef; 13 | using namespace osgEarth; 14 | using namespace osgEarth::Util; 15 | using namespace osgEarth::Drivers; 16 | 17 | 18 | class RunCallbackTask: public CefTask 19 | { 20 | public: 21 | CefRefPtr< CefV8Value > _callback; 22 | CefRefPtr< CefV8Context > _context; 23 | double _current; 24 | double _total; 25 | int _currentStage; 26 | int _totalStages; 27 | std::string _msg; 28 | 29 | RunCallbackTask(CefRefPtr< CefV8Context > context, 30 | CefRefPtr< CefV8Value > callback, 31 | double current, 32 | double total, 33 | unsigned currentStage, 34 | unsigned totalStages, 35 | const std::string& msg 36 | ): 37 | _context(context), 38 | _callback(callback), 39 | _current( current ), 40 | _total( total ), 41 | _currentStage( currentStage ), 42 | _totalStages( totalStages ), 43 | _msg( msg ) 44 | { 45 | } 46 | 47 | virtual void Execute() OVERRIDE 48 | { 49 | CefV8ValueList args; 50 | args.push_back(CefV8Value::CreateDouble(_current)); 51 | args.push_back(CefV8Value::CreateDouble(_total)); 52 | args.push_back(CefV8Value::CreateInt(_currentStage)); 53 | args.push_back(CefV8Value::CreateInt(_totalStages)); 54 | args.push_back(CefV8Value::CreateString(_msg)); 55 | _callback->ExecuteFunctionWithContext(_context, 0, args); 56 | } 57 | 58 | // Provide the reference counting implementation for this class. 59 | IMPLEMENT_REFCOUNTING(RunCallbackTask); 60 | }; 61 | 62 | 63 | 64 | class V8ProgressCallback : public ProgressCallback 65 | { 66 | public: 67 | 68 | V8ProgressCallback(CefRefPtr< CefV8Context > context, 69 | CefRefPtr< CefV8Value > callback, 70 | CefRefPtr< CefTaskRunner > taskRunner): 71 | _context( context ), 72 | _callback( callback ), 73 | _taskRunner( taskRunner ) 74 | { 75 | } 76 | 77 | virtual bool reportProgress( 78 | double current, 79 | double total, 80 | unsigned currentStage, 81 | unsigned totalStages, 82 | const std::string& msg ) 83 | { 84 | _taskRunner->PostTask( new RunCallbackTask( _context, _callback, current, total, currentStage, totalStages, msg ) ); 85 | return false; 86 | } 87 | 88 | CefRefPtr< CefV8Context > _context; 89 | CefRefPtr< CefV8Value > _callback; 90 | CefRefPtr< CefTaskRunner > _taskRunner; 91 | }; 92 | 93 | /** 94 | * User data for a package task 95 | */ 96 | class PackagerUserData : public CefBase, public OpenThreads::Thread 97 | { 98 | public: 99 | PackagerUserData(CefRefPtr< CefV8Value > opt ) 100 | { 101 | // Get the list of filenames to process 102 | std::vector< std::string > filenames; 103 | if (opt->HasValue("filenames")) { 104 | CefRefPtr< CefV8Value > v8filenames = opt->GetValue("filenames"); 105 | for (int i = 0; i < v8filenames->GetArrayLength(); i++) 106 | { 107 | std::string filename = v8filenames->GetValue(i)->GetStringValue().ToString(); 108 | filenames.push_back( filename ); 109 | } 110 | } 111 | 112 | 113 | osg::ref_ptr< TileVisitor > visitor; 114 | 115 | int cores = 0; 116 | if (opt->HasValue("cores")) 117 | { 118 | cores = opt->GetValue("cores")->GetIntValue(); 119 | } 120 | 121 | cores = max(1, cores); 122 | 123 | if (cores > 1) 124 | { 125 | MultithreadedTileVisitor* v = new MultithreadedTileVisitor(); 126 | v->setNumThreads(cores); 127 | visitor = v; 128 | } 129 | else 130 | { 131 | visitor = new TileVisitor(); 132 | } 133 | 134 | packager.setVisitor( visitor ); 135 | 136 | 137 | std::string extension; 138 | // Get the extension 139 | if (opt->HasValue("extension")) 140 | { 141 | extension = opt->GetValue("extension")->GetStringValue().ToString(); 142 | } 143 | 144 | // Setup the write options so that it will compress elevation using lzw 145 | osg::ref_ptr< osgDB::Options > options = new osgDB::Options("tiff_compression=lzw"); 146 | packager.setWriteOptions( options.get() ); 147 | 148 | bool elevation = false; 149 | if (extension == "tif16") 150 | { 151 | elevation = true; 152 | packager.setExtension("tif"); 153 | packager.setElevationPixelDepth(16); 154 | } 155 | else if (extension == "tif32") 156 | { 157 | elevation = true; 158 | packager.setExtension("tif"); 159 | packager.setElevationPixelDepth(32); 160 | } 161 | else 162 | { 163 | packager.setExtension( extension ); 164 | } 165 | 166 | // Get the min level 167 | if (opt->HasValue("min_level")) 168 | { 169 | visitor->setMinLevel( opt->GetValue("min_level")->GetIntValue() ); 170 | } 171 | 172 | // Get the max level 173 | if (opt->HasValue("max_level")) 174 | { 175 | visitor->setMaxLevel( opt->GetValue("max_level")->GetIntValue() ); 176 | } 177 | 178 | 179 | // Get the extents 180 | double minLon = -180.0; 181 | double minLat = -90.0; 182 | double maxLon = 180.0; 183 | double maxLat = 90.0; 184 | 185 | if (opt->HasValue("extents")) 186 | { 187 | CefRefPtr< CefV8Value > extents = opt->GetValue("extents"); 188 | minLon = extents->GetValue(0)->GetIntValue(); 189 | minLat = extents->GetValue(1)->GetIntValue(); 190 | maxLon = extents->GetValue(2)->GetIntValue(); 191 | maxLat = extents->GetValue(3)->GetIntValue(); 192 | } 193 | 194 | visitor->addExtent(GeoExtent(SpatialReference::create("epsg:4326"), minLon, minLat, maxLon, maxLat)); 195 | 196 | 197 | 198 | std::string destination = "tiles"; 199 | if ( opt->HasValue("destination")) 200 | { 201 | destination = opt->GetValue("destination")->GetStringValue().ToString(); 202 | } 203 | packager.setDestination( destination ); 204 | 205 | packager.setApplyAlphaMask(true); 206 | 207 | // create a folder for the output 208 | osgDB::makeDirectory( destination ); 209 | 210 | 211 | std::string output; 212 | if (opt->HasValue("output")) 213 | { 214 | output = opt->GetValue("output")->GetStringValue().ToString(); 215 | if (output == "mbtiles") 216 | { 217 | Config outConf; 218 | outConf.set("driver", "mbtiles"); 219 | outConf.set("format", packager.getExtension()); 220 | outConf.set("filename", osgDB::concatPaths(destination, "package.db")); 221 | 222 | // set the output profile. 223 | osg::ref_ptr outputProfile = osgEarth::Profile::create( 224 | "epsg:4326", 225 | -180, -90, 180, 90, 226 | "", 227 | 2, 1 ); 228 | ProfileOptions profileOptions = outputProfile->toProfileOptions(); 229 | outConf.add("profile", profileOptions.getConfig()); 230 | 231 | TileSourceOptions outOptions(outConf); 232 | osg::ref_ptr output = TileSourceFactory::create(outOptions); 233 | if ( output.valid() ) 234 | { 235 | TileSource::Status outputStatus = output->open( 236 | TileSource::MODE_WRITE | TileSource::MODE_CREATE ); 237 | 238 | if ( !outputStatus.isError() ) 239 | { 240 | packager.setTileSource(output); 241 | } 242 | else 243 | { 244 | OE_WARN << "Failed to initialize output TileSource: " << outputStatus.message() << std::endl; 245 | } 246 | } 247 | else 248 | { 249 | OE_WARN << "Failed to create output TileSource" << std::endl; 250 | } 251 | } 252 | } 253 | 254 | 255 | CompositeTileSourceOptions compositeOpt; 256 | 257 | for (unsigned int i = 0; i < filenames.size(); i++) 258 | { 259 | GDALOptions layerOpt; 260 | layerOpt.url() = filenames[i]; 261 | 262 | if (elevation) 263 | { 264 | compositeOpt.add(ElevationLayerOptions(filenames[i], layerOpt)); 265 | } 266 | else 267 | { 268 | compositeOpt.add(ImageLayerOptions(filenames[i], layerOpt)); 269 | } 270 | } 271 | 272 | if (elevation) 273 | { 274 | _layer = new osgEarth::ElevationLayer( ElevationLayerOptions("layer", compositeOpt) ); 275 | } 276 | else 277 | { 278 | _layer = new osgEarth::ImageLayer( ImageLayerOptions("layer", compositeOpt) ); 279 | } 280 | 281 | _map = new Map(); 282 | 283 | _context = CefV8Context::GetCurrentContext(); 284 | _taskRunner = CefTaskRunner::GetForCurrentThread(); 285 | 286 | 287 | if (opt->HasValue("progress")) { 288 | _progress = new V8ProgressCallback(_context, 289 | opt->GetValue("progress"), 290 | _taskRunner); 291 | visitor->setProgressCallback( _progress.get() ); 292 | } 293 | 294 | if (opt->HasValue("complete")) { 295 | _completeCallback = opt->GetValue("complete"); 296 | } 297 | } 298 | 299 | bool getDone() { return _done;} 300 | void setDone( bool done) { _done = done; } 301 | 302 | virtual void run() 303 | { 304 | packager.run( _layer, _map ); 305 | if (_completeCallback) 306 | { 307 | _taskRunner->PostTask( new RunCallbackTask( _context, _completeCallback, 0, 0, 0, 0, "")); 308 | } 309 | 310 | _progress = 0L; 311 | } 312 | 313 | void cancelPackager() 314 | { 315 | if (_progress.valid()) 316 | _progress->cancel(); 317 | } 318 | 319 | volatile bool _done; 320 | 321 | TMSPackager packager; 322 | osg::ref_ptr< V8ProgressCallback > _progress; 323 | 324 | osg::ref_ptr< TerrainLayer > _layer; 325 | osg::ref_ptr< Map > _map; 326 | 327 | CefRefPtr< CefV8Context > _context; 328 | CefRefPtr< CefV8Value > _completeCallback; 329 | CefRefPtr< CefTaskRunner > _taskRunner; 330 | 331 | 332 | 333 | 334 | IMPLEMENT_REFCOUNTING(PackagerUserData); 335 | }; 336 | 337 | 338 | PackagerV8Handler::PackagerV8Handler() 339 | { 340 | } 341 | 342 | bool PackagerV8Handler::Execute(const CefString& name, 343 | CefRefPtr object, 344 | const CefV8ValueList& arguments, 345 | CefRefPtr& retval, 346 | CefString& exception) 347 | { 348 | if (name == "Package") 349 | { 350 | CefRefPtr< CefV8Value > opt = arguments[0]; 351 | 352 | CefRefPtr< PackagerUserData > userData = new PackagerUserData( opt ); 353 | 354 | userData->startThread(); 355 | 356 | retval = CefV8Value::CreateObject(0); 357 | retval->SetUserData(userData); 358 | 359 | //CefRefPtr progressHandler = new ProgressHandler(); 360 | //retval->SetValue("cancel", CefV8Value::CreateFunction("cancel", progressHandler), V8_PROPERTY_ATTRIBUTE_NONE); 361 | return true; 362 | } 363 | else if (name == "CancelPackage") 364 | { 365 | CefRefPtr< CefV8Value > opt = arguments[0]; 366 | CefRefPtr< PackagerUserData > userData = dynamic_cast< PackagerUserData* >(opt->GetUserData().get()); 367 | if (userData.get()) 368 | { 369 | if (!userData->getDone()) 370 | { 371 | userData->cancelPackager(); 372 | } 373 | 374 | return true; 375 | } 376 | 377 | return true; 378 | 379 | } 380 | else if (name == "Estimate") 381 | { 382 | CefRefPtr< CefV8Value > opt = arguments[0]; 383 | 384 | CacheEstimator est; 385 | if (opt->HasValue("min_level")) 386 | { 387 | est.setMinLevel( opt->GetValue("min_level")->GetIntValue() ); 388 | } 389 | 390 | if (opt->HasValue("max_level")) 391 | { 392 | est.setMaxLevel( opt->GetValue("max_level")->GetIntValue() ); 393 | } 394 | 395 | double minLon = -180.0; 396 | double minLat = -90.0; 397 | double maxLon = 180.0; 398 | double maxLat = 90.0; 399 | 400 | if (opt->HasValue("extents")) 401 | { 402 | CefRefPtr< CefV8Value > extents = opt->GetValue("extents"); 403 | minLon = extents->GetValue(0)->GetIntValue(); 404 | minLat = extents->GetValue(1)->GetIntValue(); 405 | maxLon = extents->GetValue(2)->GetIntValue(); 406 | maxLat = extents->GetValue(3)->GetIntValue(); 407 | } 408 | 409 | est.addExtent(GeoExtent(osgEarth::SpatialReference::create("epsg:4326"), minLon, minLat, maxLon, maxLat)); 410 | 411 | retval = CefV8Value::CreateObject(0); 412 | retval->SetValue("tiles", CefV8Value::CreateUInt(est.getNumTiles()), V8_PROPERTY_ATTRIBUTE_NONE); 413 | retval->SetValue("size", CefV8Value::CreateDouble(est.getSizeInMB()), V8_PROPERTY_ATTRIBUTE_NONE); 414 | retval->SetValue("seconds", CefV8Value::CreateDouble(est.getTotalTimeInSeconds()), V8_PROPERTY_ATTRIBUTE_NONE); 415 | return true; 416 | } 417 | return false; 418 | } 419 | 420 | namespace 421 | { 422 | std::string code = 423 | "var osgearth;" 424 | "if (!osgearth) {" 425 | " osgearth = {};" 426 | "}" 427 | "(function() {" 428 | " osgearth.package = function(options) {" 429 | " native function Package();" 430 | " return Package(options);" 431 | " };" 432 | " osgearth.estimate = function(options) {" 433 | " native function Estimate();" 434 | " return Estimate(options);" 435 | " };" 436 | " osgearth.cancelPackage = function(options) {" 437 | " native function CancelPackage();" 438 | " return CancelPackage(options);" 439 | " };" 440 | "})();"; 441 | } 442 | 443 | 444 | void PackagerAPI::AddExtensions(CefRefPtr global) 445 | { 446 | CefRefPtr< PackagerV8Handler > handler = new PackagerV8Handler(); 447 | CefRegisterExtension("packager", code, handler); 448 | } 449 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | osgearth-cef 2 | ============ 3 | 4 | osgEarth / Chromium Embedded Framework (CEF) integration 5 | Copyright 2008-2014 Pelican Mapping 6 | 7 | http://osgearth.org 8 | git://github.com/pelicanmapping/osgearth-cef 9 | 10 | osgearthCef is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published by 12 | the Free Software Foundation; either version 2 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU Lesser General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with this program. If not, see 22 | -------------------------------------------------------------------------------- /RenderProcessHandler: -------------------------------------------------------------------------------- 1 | #ifndef OSGEARTH_CEF_OECEFRENDERPROCESSHANDLER 2 | #define OSGEARTH_CEF_OECEFRENDERPROCESSHANDLER 1 3 | 4 | #include "include/cef_app.h" 5 | #include "include/wrapper/cef_message_router.h" 6 | 7 | namespace osgEarth { namespace Cef 8 | { 9 | 10 | class RenderProcessHandler : public CefRenderProcessHandler//, public CefV8Handler 11 | { 12 | public: 13 | RenderProcessHandler(); 14 | 15 | // CefRenderProcessHandler methods 16 | virtual void OnWebKitInitialized() override; 17 | 18 | virtual void OnContextCreated( 19 | CefRefPtr browser, 20 | CefRefPtr frame, 21 | CefRefPtr context) override; 22 | 23 | virtual void OnContextReleased(CefRefPtr browser, 24 | CefRefPtr frame, 25 | CefRefPtr context) override; 26 | 27 | virtual bool OnProcessMessageReceived(CefRefPtr browser, 28 | CefProcessId source_process, 29 | CefRefPtr message) override; 30 | 31 | 32 | // CefV8Handler methods 33 | //virtual bool Execute( 34 | // const CefString& name, 35 | // CefRefPtr object, 36 | // const CefV8ValueList& arguments, 37 | // CefRefPtr& retval, 38 | // CefString& exception 39 | //); 40 | 41 | private: 42 | //void SetListValue(CefRefPtr list, int index, CefRefPtr value); 43 | //void SetList(CefRefPtr source, CefRefPtr target); 44 | 45 | CefRefPtr _messageRouter; 46 | 47 | IMPLEMENT_REFCOUNTING(RenderProcessHandler); 48 | }; 49 | 50 | } } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /RenderProcessHandler.cpp: -------------------------------------------------------------------------------- 1 | #include "RenderProcessHandler" 2 | #include "MapExtensions" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | using namespace osgEarth::Cef; 14 | 15 | 16 | #define LC "[RenderProcessHandler] " 17 | 18 | 19 | RenderProcessHandler::RenderProcessHandler() 20 | { 21 | //nop 22 | } 23 | 24 | void RenderProcessHandler::OnWebKitInitialized() 25 | { 26 | // Create the renderer-side router for query handling. 27 | CefMessageRouterConfig config; 28 | _messageRouter = CefMessageRouterRendererSide::Create(config); 29 | 30 | MapAPI::AddExtensions(0); 31 | } 32 | 33 | void RenderProcessHandler::OnContextCreated(CefRefPtr browser, CefRefPtr frame, CefRefPtr context) 34 | { 35 | _messageRouter->OnContextCreated(browser, frame, context); 36 | 37 | CefRefPtr global = context->GetGlobal(); 38 | 39 | // Create a basic osgearth object in the context if one does not already exist (via the inclusion of our osgearth.js library) 40 | //if (!global->HasValue("osgearth")) 41 | //{ 42 | // //OE_WARN << LC << "osgearth value not found, creating default object." << std::endl; 43 | 44 | // CefRefPtr osgearthObj = CefV8Value::CreateObject(0); 45 | 46 | // CefRefPtr createMap = CefV8Value::CreateFunction("createMap", this); 47 | // osgearthObj->SetValue("createMap", createMap, V8_PROPERTY_ATTRIBUTE_READONLY); 48 | 49 | // CefRefPtr setMap = CefV8Value::CreateFunction("setMap", this); 50 | // osgearthObj->SetValue("setMap", setMap, V8_PROPERTY_ATTRIBUTE_READONLY); 51 | 52 | // CefRefPtr execute = CefV8Value::CreateFunction("execute", this); 53 | // osgearthObj->SetValue("execute", execute, V8_PROPERTY_ATTRIBUTE_READONLY); 54 | 55 | // global->SetValue("osgearth", osgearthObj, V8_PROPERTY_ATTRIBUTE_READONLY); 56 | //} 57 | } 58 | 59 | void RenderProcessHandler::OnContextReleased(CefRefPtr browser, CefRefPtr frame, CefRefPtr context) 60 | { 61 | _messageRouter->OnContextReleased(browser, frame, context); 62 | } 63 | 64 | bool RenderProcessHandler::OnProcessMessageReceived(CefRefPtr browser, CefProcessId source_process, CefRefPtr message) 65 | { 66 | return _messageRouter->OnProcessMessageReceived(browser, source_process, message); 67 | } 68 | 69 | //bool RenderProcessHandler::Execute(const CefString& name, CefRefPtr object, const CefV8ValueList& arguments, CefRefPtr& retval, CefString& exception) 70 | //{ 71 | // // Create an inter-process message and fill it's arguments list 72 | // CefRefPtr message = CefProcessMessage::Create(name); 73 | // 74 | // CefRefPtr messageArgs = message->GetArgumentList(); 75 | // for (unsigned int i = 0; i < arguments.size(); i++) 76 | // SetListValue(messageArgs, i, arguments[i]); 77 | // 78 | // 79 | // // Send the message to the browser 80 | // CefRefPtr browser = CefV8Context::GetCurrentContext()->GetBrowser(); 81 | // if (!browser.get()) 82 | // return false; 83 | // 84 | // browser->SendProcessMessage(PID_BROWSER, message); 85 | // 86 | // 87 | // return true; 88 | //} 89 | 90 | //void RenderProcessHandler::SetListValue(CefRefPtr list, int index, CefRefPtr value) 91 | //{ 92 | // if (value->IsArray()) { 93 | // CefRefPtr new_list = CefListValue::Create(); 94 | // SetList(value, new_list); 95 | // list->SetList(index, new_list); 96 | // } else if (value->IsString()) { 97 | // list->SetString(index, value->GetStringValue()); 98 | // } else if (value->IsBool()) { 99 | // list->SetBool(index, value->GetBoolValue()); 100 | // } else if (value->IsInt()) { 101 | // list->SetInt(index, value->GetIntValue()); 102 | // } else if (value->IsDouble()) { 103 | // list->SetDouble(index, value->GetDoubleValue()); 104 | // } 105 | //} 106 | // 107 | //void RenderProcessHandler::SetList(CefRefPtr source, CefRefPtr target) 108 | //{ 109 | // if (!source->IsArray()) 110 | // return; 111 | // 112 | // int arg_length = source->GetArrayLength(); 113 | // if (arg_length == 0) 114 | // return; 115 | // 116 | // // Start with null types in all spaces. 117 | // target->SetSize(arg_length); 118 | // 119 | // for (int i = 0; i < arg_length; ++i) 120 | // SetListValue(target, i, source->GetValue(i)); 121 | //} 122 | -------------------------------------------------------------------------------- /applications/demo_cef/css/style.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | background-color: transparent; 3 | color: #333; 4 | padding: 0px; 5 | margin: 0px; 6 | position: absolute; 7 | left: 0px; 8 | right: 0px; 9 | top: 0px; 10 | bottom: 0px; 11 | min-height: 500px; 12 | min-width: 500px; 13 | font-family: 'Arial', sans-serif; 14 | } 15 | 16 | #top_bar { 17 | position: absolute; 18 | top: 0px; 19 | left: 0px; 20 | right: 0px; 21 | height: 34px; 22 | background-color: #666; 23 | color: #fff; 24 | text-align: center; 25 | } 26 | 27 | #left_bar { 28 | position: absolute; 29 | top: 34px; 30 | bottom: 20px; 31 | left: 0px; 32 | width: 200px; 33 | padding: 10px; 34 | box-sizing: border-box; 35 | background-color: #ccc; 36 | } 37 | 38 | #left_bar h2 { 39 | font-size: 16px; 40 | color: #006; 41 | } 42 | 43 | #left_bar .layer-box { 44 | background-color: #fff; 45 | margin: 0px 10px; 46 | padding: 5px; 47 | font-size: 12px; 48 | height: 100px; 49 | overflow: auto; 50 | } 51 | 52 | #left_bar .layer-name { 53 | padding: 5px; 54 | } 55 | 56 | #left_bar .layer-name:hover { 57 | background-color: #ddf; 58 | } 59 | 60 | #map_1 { 61 | position: absolute; 62 | top: 34px; 63 | bottom: 20px; 64 | left: 200px; 65 | right: 200px; 66 | } 67 | 68 | #right_bar { 69 | position: absolute; 70 | top:34px; 71 | bottom: 20px; 72 | right: 0px; 73 | width: 200px; 74 | box-sizing: border-box; 75 | background-color: #ccc; 76 | padding: 10px; 77 | } 78 | 79 | #bottom_bar { 80 | height: 20px; 81 | position: absolute; 82 | bottom: 0px; 83 | left: 0px; 84 | right: 0px; 85 | background-color: #666; 86 | color: #fff; 87 | text-align: center; 88 | font-size: 12px; 89 | padding-top: 4px; 90 | } 91 | 92 | #hover_div { 93 | background-color: rgba(255, 255, 255, 0.6); 94 | color: #fff; 95 | font-size: 14px; 96 | position: absolute; 97 | top: 84px; 98 | left: 250px; 99 | padding: 30px; 100 | border: 2px solid #fff; 101 | text-align: center; 102 | } 103 | 104 | #test_controls { 105 | text-align: center; 106 | } 107 | #test_controls input { 108 | width: 180px; 109 | display: block; 110 | margin-bottom: 10px; 111 | } 112 | 113 | #test_controls select { 114 | width: 180px; 115 | display: block; 116 | margin-bottom: 10px; 117 | } 118 | 119 | #test_scrollbox { 120 | width: 180px; 121 | height: 150px; 122 | overflow: auto; 123 | background-color: #fff; 124 | border 1px solid #333; 125 | } 126 | 127 | /* button style */ 128 | .cool-button { 129 | -moz-box-shadow:inset 0px 1px 0px 0px #a4e271; 130 | -webkit-box-shadow:inset 0px 1px 0px 0px #a4e271; 131 | box-shadow:inset 0px 1px 0px 0px #a4e271; 132 | background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #89c403), color-stop(1, #77a809)); 133 | background:-moz-linear-gradient(top, #89c403 5%, #77a809 100%); 134 | background:-webkit-linear-gradient(top, #89c403 5%, #77a809 100%); 135 | background:-o-linear-gradient(top, #89c403 5%, #77a809 100%); 136 | background:-ms-linear-gradient(top, #89c403 5%, #77a809 100%); 137 | background:linear-gradient(to bottom, #89c403 5%, #77a809 100%); 138 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#89c403', endColorstr='#77a809',GradientType=0); 139 | background-color:#89c403; 140 | -moz-border-radius:6px; 141 | -webkit-border-radius:6px; 142 | border-radius:6px; 143 | border:1px solid #74b807; 144 | display:inline-block; 145 | cursor:pointer; 146 | color:#ffffff; 147 | font-family:Arial; 148 | font-size:15px; 149 | font-weight:bold; 150 | padding:6px 24px; 151 | text-decoration:none; 152 | text-shadow:0px 1px 0px #528009; 153 | } 154 | .cool-button:hover { 155 | background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #77a809), color-stop(1, #89c403)); 156 | background:-moz-linear-gradient(top, #77a809 5%, #89c403 100%); 157 | background:-webkit-linear-gradient(top, #77a809 5%, #89c403 100%); 158 | background:-o-linear-gradient(top, #77a809 5%, #89c403 100%); 159 | background:-ms-linear-gradient(top, #77a809 5%, #89c403 100%); 160 | background:linear-gradient(to bottom, #77a809 5%, #89c403 100%); 161 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77a809', endColorstr='#89c403',GradientType=0); 162 | background-color:#77a809; 163 | } 164 | .cool-button:active { 165 | position:relative; 166 | top:1px; 167 | } 168 | -------------------------------------------------------------------------------- /applications/demo_cef/img/cube.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/demo_cef/img/cube.gif -------------------------------------------------------------------------------- /applications/demo_cef/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/demo_cef/img/logo.png -------------------------------------------------------------------------------- /applications/demo_cef/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | CEF Test 7 | 8 | 9 | 10 | 11 | 12 | 13 | 134 | 135 | 136 | 137 | 138 | 139 |
140 | 141 |
142 |
143 |
144 |
145 |

Elevation Layers

146 |
147 |

Image Layers

148 |
149 |

Model Layers

150 |
151 |
152 |
153 | 154 |
155 |
156 | 157 | 158 | 159 | 160 | 161 | 162 | 168 | 169 |
170 |
00
171 |
01
172 |
02
173 |
03
174 |
04
175 |
05
176 |
06
177 |
07
178 |
08
179 |
09
180 |
10
181 |
11
182 |
12
183 |
13
184 |
14
185 |
15
186 |
16
187 |
17
188 |
18
189 |
19
190 |
20
191 |
21
192 |
193 |
194 |
195 |
osgEarth CEF demo
196 | 197 |
198 | 199 |

This cube is spinning!

200 | 201 |
202 | 203 | 204 | 205 | 206 | -------------------------------------------------------------------------------- /applications/demo_cef/main.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- */ 2 | /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph 3 | * Copyright 2008-2013 Pelican Mapping 4 | * http://osgearth.org 5 | * 6 | * osgEarth is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include "include/cef_app.h" 32 | 33 | #include "CefHelper" 34 | #include "BrowserClient" 35 | 36 | 37 | #define LC "[osgearth_cef] " 38 | 39 | 40 | using namespace osgEarth::Cef; 41 | using namespace osgEarth::Util::Controls; 42 | 43 | namespace 44 | { 45 | struct MyExecCallback : public ExecuteCallback 46 | { 47 | CefRefPtr _client; 48 | 49 | MyExecCallback(BrowserClient* client) : _client(client) { } 50 | 51 | ExecuteCallback::ReturnVal* execute( int64 query_id, const std::string& command, const JsonArguments &args, bool persistent, CefRefPtr callback ) 52 | { 53 | if (command == "says") 54 | { 55 | std::string animal = args["animal"]; 56 | std::string sound = args["sound"]; 57 | 58 | return new ExecuteCallback::ReturnVal("The " + animal + " says " + sound); 59 | } 60 | else if (command == "addTestLayer") 61 | { 62 | std::string id = args["id"]; 63 | 64 | osgEarth::Drivers::TMSOptions tms; 65 | tms.url() = "http://readymap.org/readymap/tiles/1.0.0/76/"; 66 | osgEarth::ImageLayer* layer = new osgEarth::ImageLayer( "Test Layer", tms ); 67 | 68 | osg::ref_ptr mapNode= _client->getMapNode(id); 69 | if (mapNode.valid()) 70 | { 71 | mapNode->getMap()->addImageLayer(layer); 72 | } 73 | else 74 | { 75 | return new ExecuteCallback::ReturnVal("Failed to load layer, map node not found.", -1); 76 | } 77 | 78 | return new ExecuteCallback::ReturnVal(); 79 | } 80 | 81 | OE_WARN << LC << "Execute: " << command << std::endl; 82 | return 0L; 83 | } 84 | }; 85 | 86 | 87 | struct MyClickHandler : public ControlEventHandler 88 | { 89 | void onClick( Control* control, const osg::Vec2f& pos, int mouseButtonMask ) 90 | { 91 | OE_NOTICE << "You clicked at (" << pos.x() << ", " << pos.y() << ") within the control." 92 | << std::endl; 93 | } 94 | }; 95 | } 96 | 97 | 98 | 99 | 100 | 101 | int main(int argc, char** argv) 102 | { 103 | osg::ArgumentParser arguments(&argc,argv); 104 | 105 | // Call load to initialize CEF and create the BrowserClient 106 | CefRefPtr browserClient = CefHelper().load(arguments); 107 | 108 | // Start main loop 109 | if (browserClient) 110 | { 111 | //TEST 112 | browserClient->addExecuteCallback(new MyExecCallback(browserClient.get())); 113 | 114 | bool init = false; 115 | while (!browserClient->getViewer()->done()) 116 | { 117 | browserClient->getViewer()->frame(); 118 | CefDoMessageLoopWork(); 119 | 120 | // Demo: 121 | // Once initialized, add a control to the default canvas 122 | if (!init) 123 | { 124 | // Have to wait until view is created 125 | osg::ref_ptr view = browserClient->getMapView("map1"); 126 | if (view.valid()) 127 | { 128 | // Get the default ControlCanvas 129 | ControlCanvas* cs = ControlCanvas::get( view.get() ); 130 | 131 | HBox* box = new HBox(); 132 | box->setBorderColor( 1, 1, 1, 1 ); 133 | box->setBackColor( .6,.5,.4,0.5 ); 134 | box->setMargin( 40 ); 135 | box->setPadding( 10 ); 136 | box->setHorizAlign( Control::ALIGN_LEFT ); 137 | box->setVertAlign( Control::ALIGN_BOTTOM ); 138 | 139 | // Add a text label: 140 | LabelControl* label = new LabelControl( "osgEarth Controls" ); 141 | label->setFont( osgEarth::Registry::instance()->getDefaultFont() ); 142 | label->setFontSize( 24.0f ); 143 | label->setHorizAlign( Control::ALIGN_LEFT ); 144 | label->setMargin( 5 ); 145 | box->addControl( label ); 146 | 147 | label = new LabelControl("Hover Me"); 148 | label->setMargin( 10 ); 149 | label->setBackColor( 1,1,1,0.4 ); 150 | box->addControl( label ); 151 | label->setActiveColor(1,.3,.3,1); 152 | label->addEventHandler( new MyClickHandler ); 153 | 154 | // Add some checkboxes 155 | HBox* c4 = new HBox(); 156 | c4->setChildSpacing( 5 ); 157 | { 158 | c4->addControl( new CheckBoxControl( true ) ); 159 | c4->addControl( new LabelControl( "Checkbox" ) ); 160 | } 161 | box->addControl( c4 ); 162 | 163 | cs->addControl(box); 164 | 165 | init = true; 166 | } 167 | } 168 | } 169 | } 170 | 171 | // Shutdown the CEF processes 172 | CefShutdown(); 173 | 174 | return 0; 175 | } 176 | 177 | -------------------------------------------------------------------------------- /applications/demo_cef/openstreetmap.earth: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | http://[abc].tile.openstreetmap.org/{z}/{x}/{y}.png 11 | spherical-mercator 12 | 13 | 14 | 15 | 16 | false 17 | 18 | 8 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /applications/demo_cef/readymap.earth: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | http://readymap.org/readymap/tiles/1.0.0/7/ 22 | 23 | 24 | 25 | http://readymap.org/readymap/tiles/1.0.0/9/ 26 | 27 | 28 | -------------------------------------------------------------------------------- /applications/osgearth_cef/main.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- */ 2 | /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph 3 | * Copyright 2008-2013 Pelican Mapping 4 | * http://osgearth.org 5 | * 6 | * osgEarth is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "CefHelper" 25 | 26 | 27 | #define LC "[osgearth_cef] " 28 | 29 | 30 | using namespace osgEarth::Cef; 31 | 32 | 33 | int main(int argc, char** argv) 34 | { 35 | osg::ArgumentParser arguments(&argc,argv); 36 | 37 | return CefHelper().run(arguments); 38 | } 39 | -------------------------------------------------------------------------------- /applications/packager/css/packager.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager/css/packager.css -------------------------------------------------------------------------------- /applications/packager/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /applications/packager/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /applications/packager/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /applications/packager/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /applications/packager/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager/img/logo.png -------------------------------------------------------------------------------- /applications/packager/img/pelican-2in-300dpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager/img/pelican-2in-300dpi.png -------------------------------------------------------------------------------- /applications/packager/img/thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager/img/thumb.jpg -------------------------------------------------------------------------------- /applications/packager/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Pelican Map Slicer 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 86 | 87 | 405 | 406 | 407 | 408 | 409 | 410 |
411 |
412 | 413 |
414 | 415 |
416 |

Select files to tile

417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 |
FilenameBandsDimensions
434 | 435 | 438 |
439 | 440 | 465 | 466 | 523 | 524 | 537 | 538 |
539 | 540 | 541 | 542 | -------------------------------------------------------------------------------- /applications/packager/js/packager.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager/js/packager.js -------------------------------------------------------------------------------- /applications/packager2/css/style.css: -------------------------------------------------------------------------------- 1 | .pushright { 2 | float: right; } 3 | 4 | html, body { 5 | background-color: #607D8B; 6 | color: #212121; 7 | padding: 0px; 8 | margin: 0px; 9 | position: absolute; 10 | left: 0px; 11 | right: 0px; 12 | top: 0px; 13 | bottom: 0px; 14 | min-height: 500px; 15 | min-width: 500px; 16 | font-family: Verdana, Geneva, sans-serif; 17 | overflow: hidden; } 18 | 19 | #leftbar { 20 | position: absolute; 21 | top: 0px; 22 | bottom: 25px; 23 | left: 0px; 24 | width: 400px; 25 | background-color: #607D8B; } 26 | 27 | #leftbar_buttons { 28 | position: absolute; 29 | top: 0px; 30 | left: 10px; 31 | right: 10px; 32 | height: 0px; 33 | line-height: 0px; 34 | text-align: center; 35 | /*border-bottom: 1px solid #fff;*/ } 36 | 37 | #data_header { 38 | position: absolute; 39 | top: 10px; 40 | left: 10px; 41 | right: 10px; } 42 | 43 | #data_header .fa-plus { 44 | font-size: 22px; 45 | vertical-align: middle; 46 | cursor: pointer; } 47 | 48 | .box-header { 49 | height: 36px; 50 | line-height: 36px; 51 | font-size: 16px; 52 | padding: 0px 10px; 53 | color: #fff; 54 | background-color: #455A64; 55 | border-radius: 2px 2px 0px 0px; } 56 | 57 | .layer-box { 58 | background-color: #FFFFFF; 59 | padding: 5px; 60 | font-size: 14px; 61 | overflow: auto; 62 | border-radius: 0px 0px 2px 2px; 63 | box-sizing: border-box; } 64 | 65 | #data_sources { 66 | position: absolute; 67 | top: 46px; 68 | left: 10px; 69 | right: 10px; 70 | bottom: 280px; } 71 | 72 | .file-row { 73 | height: 22px; 74 | line-height: 22px; 75 | font-size: 14px; 76 | cursor: pointer; 77 | white-space: nowrap; } 78 | 79 | .file-row.selected { 80 | background-color: #607D8B; 81 | color: #FFFFFF; } 82 | 83 | .file-row:hover { 84 | background-color: #E0E9ED; 85 | color: #212121; } 86 | 87 | .file-row .fa-remove, #out_cancel .fa-remove { 88 | font-size: 18px; 89 | vertical-align: middle; 90 | color: #F45D4C; } 91 | 92 | .file-row .fa-remove:hover, #out_cancel .fa-remove:hover { 93 | color: #FBC2BC; } 94 | 95 | #props_header { 96 | position: absolute; 97 | bottom: 234px; 98 | left: 10px; 99 | right: 10px; } 100 | 101 | #data_props { 102 | position: absolute; 103 | left: 10px; 104 | right: 10px; 105 | bottom: 10px; 106 | height: 224px; 107 | font-size: 12px; } 108 | 109 | #left_bar .layer-name { 110 | padding: 5px; } 111 | 112 | #left_bar .layer-name:hover { 113 | background-color: #ddd; } 114 | 115 | #map { 116 | position: absolute; 117 | top: 10px; 118 | bottom: 305px; 119 | left: 400px; 120 | right: 10px; } 121 | 122 | #logo_div { 123 | /*background-color: rgba(255, 255, 255, 0.5); 124 | color: #fff; 125 | font-size: 10px;*/ 126 | position: absolute; 127 | right: 10px; 128 | bottom: 315px; 129 | padding: 2px; 130 | /*border: 1px solid rgba(255, 255, 255, 0.6);*/ } 131 | 132 | #footer { 133 | position: absolute; 134 | left: 0px; 135 | right: 0px; 136 | bottom: 0px; 137 | height: 25px; 138 | box-sizing: border-box; 139 | padding-right: 10px; 140 | background-color: #455A64; 141 | color: #fff; 142 | text-align: right; 143 | line-height: 25px; 144 | font-size: 14px; } 145 | 146 | #footer .error-msg { 147 | background-color: #F45D4C; 148 | padding: 1px 4px; } 149 | 150 | #bottombar { 151 | position: absolute; 152 | left: 400px; 153 | right: 0px; 154 | bottom: 25px; 155 | height: 280px; 156 | background-color: #607D8B; } 157 | 158 | #output_header { 159 | position: absolute; 160 | top: 10px; 161 | left: 0px; 162 | right: 180px; } 163 | 164 | #output_props { 165 | position: absolute; 166 | top: 46px; 167 | left: 0px; 168 | right: 180px; 169 | bottom: 10px; 170 | overflow: visible; 171 | z-index: 99; } 172 | 173 | .flat-button { 174 | border: 0 none; 175 | border-radius: 2px; 176 | color: #fff; 177 | background-color: #455A64; 178 | cursor: pointer; 179 | font-size: 16px; 180 | font-weight: bold; 181 | line-height: 20px; 182 | padding: 10px; 183 | box-sizing: border-box; 184 | text-align: center; 185 | /*transition: all 0.05s ease 0s; 186 | -moz-transition: all 0.05s ease 0s; 187 | -webkit-transition: all 0.05s ease 0s;*/ } 188 | 189 | .flat-button:hover { 190 | background-color: #009688; } 191 | 192 | #destination_button.flat-button { 193 | line-height: 14px; 194 | font-size: 14px; 195 | padding: 4px 12px; } 196 | 197 | #extents_button.flat-button { 198 | line-height: 14px; 199 | font-size: 14px; 200 | padding: 4px 8px; } 201 | 202 | /* 203 | #load_button { 204 | width: 100%; 205 | line-height: $buttonbox-size - 40px; 206 | background-color: #6792AB; 207 | } 208 | #load_button:hover { 209 | background-color: #073E5B; 210 | } 211 | */ 212 | /*#output_props > div { 213 | line-height: 40px; 214 | height: 40px; 215 | font-size: 14px; 216 | }*/ 217 | #output_props input[type="text"] { 218 | width: 60px; } 219 | 220 | #destination_box { 221 | padding: 15px 0px 0px 10px; } 222 | 223 | #out_button { 224 | position: absolute; 225 | top: 10px; 226 | bottom: 10px; 227 | right: 10px; 228 | width: 160px; 229 | padding-top: 110px; } 230 | 231 | #out_button .fa { 232 | font-size: 30px; } 233 | 234 | .table { 235 | display: table; 236 | width: 100%; } 237 | 238 | #destination_table.table { 239 | width: 50%; 240 | min-width: 400px; } 241 | 242 | .table-row { 243 | display: table-row; 244 | padding: 10px; } 245 | 246 | .table-cell { 247 | display: table-cell; 248 | padding: 15px 10px 0px; 249 | width: 25%; } 250 | 251 | .table-cell.short { 252 | width: 1px; } 253 | 254 | .table-cell.long { 255 | width: 100%; } 256 | 257 | .table-cell span { 258 | margin-top: 6px; } 259 | 260 | #output_props .table-cell.long input[type="text"] { 261 | width: 100%; } 262 | 263 | .extent-input.inerror, .zoom-input.inerror, #output_destination.inerror { 264 | background-color: #F45D4C; } 265 | 266 | .accent-mark { 267 | color: #009688; } 268 | 269 | .nowrap { 270 | white-space: nowrap; } 271 | 272 | #destination_button.flat-button { 273 | line-height: 14px; 274 | font-size: 14px; 275 | padding: 4px 12px; } 276 | 277 | .tooltipped .tooltip { 278 | z-index: 100; 279 | display: none; } 280 | 281 | .tooltipped:hover .tooltip { 282 | display: inline; 283 | float: right; 284 | background-color: #FFFFFF; 285 | color: #212121; 286 | font-size: 14px; 287 | padding: 0px 10px; 288 | border: 1px solid #212121; 289 | position: absolute; 290 | border-radius: 2px; } 291 | 292 | #format_trigger .tooltip { 293 | width: 360px; 294 | margin-top: -60px; 295 | margin-left: -150px; 296 | padding: 0px 10px; } 297 | 298 | #out_progress { 299 | position: absolute; 300 | top: 0; 301 | bottom: 0; 302 | left: 0; 303 | right: 0; 304 | background-color: #B6B6B6; 305 | cursor: default; 306 | line-height: 280px; 307 | display: none; } 308 | 309 | #out_cancel { 310 | position: absolute; 311 | top: 0; 312 | right: 0; 313 | padding: 4px; 314 | cursor: pointer; 315 | line-height: 24px; 316 | z-index: 11; } 317 | 318 | #out_cancel .fa-remove { 319 | font-size: 24px; } 320 | 321 | #out_textwrap { 322 | position: absolute; 323 | left: 0; 324 | right: 0; 325 | bottom: 0; 326 | top: 0; 327 | z-index: 10; } 328 | 329 | #out_progressbar { 330 | position: absolute; 331 | left: 0; 332 | right: 0; 333 | bottom: 0; 334 | height: 0%; 335 | background-color: #00FF00; 336 | z-index: 5; } 337 | 338 | .leaflet-container { 339 | background: #000; } 340 | 341 | /*# sourceMappingURL=style.css.map */ 342 | -------------------------------------------------------------------------------- /applications/packager2/data/world.dbf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/data/world.dbf -------------------------------------------------------------------------------- /applications/packager2/data/world.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["Geographic Coordinate System",DATUM["WGS84",SPHEROID["WGS84",6378137,298.257223560493]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]] 2 | -------------------------------------------------------------------------------- /applications/packager2/data/world.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/data/world.shp -------------------------------------------------------------------------------- /applications/packager2/data/world.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/data/world.shx -------------------------------------------------------------------------------- /applications/packager2/data/world.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/data/world.tif -------------------------------------------------------------------------------- /applications/packager2/ext/Proj4Leaflet/proj4leaflet.js: -------------------------------------------------------------------------------- 1 | (function (factory) { 2 | var L, proj4; 3 | if (typeof define === 'function' && define.amd) { 4 | // AMD 5 | define(['leaflet', 'proj4'], factory); 6 | } else if (typeof module === 'object' && typeof module.exports === "object") { 7 | // Node/CommonJS 8 | L = require('leaflet'); 9 | proj4 = require('proj4'); 10 | module.exports = factory(L, proj4); 11 | } else { 12 | // Browser globals 13 | if (typeof window.L === 'undefined' || typeof window.proj4 === 'undefined') 14 | throw 'Leaflet and proj4 must be loaded first'; 15 | factory(window.L, window.proj4); 16 | } 17 | }(function (L, proj4) { 18 | 19 | L.Proj = {}; 20 | 21 | L.Proj._isProj4Obj = function(a) { 22 | return (typeof a.inverse !== 'undefined' && 23 | typeof a.forward !== 'undefined'); 24 | }; 25 | 26 | L.Proj.ScaleDependantTransformation = function(scaleTransforms) { 27 | this.scaleTransforms = scaleTransforms; 28 | }; 29 | 30 | L.Proj.ScaleDependantTransformation.prototype.transform = function(point, scale) { 31 | return this.scaleTransforms[scale].transform(point, scale); 32 | }; 33 | 34 | L.Proj.ScaleDependantTransformation.prototype.untransform = function(point, scale) { 35 | return this.scaleTransforms[scale].untransform(point, scale); 36 | }; 37 | 38 | L.Proj.Projection = L.Class.extend({ 39 | initialize: function(a, def) { 40 | if (L.Proj._isProj4Obj(a)) { 41 | this._proj = a; 42 | } else { 43 | var code = a; 44 | if (def) { 45 | proj4.defs(code, def); 46 | } else if (proj4.defs[code] === undefined) { 47 | var urn = code.split(':'); 48 | if (urn.length > 3) { 49 | code = urn[urn.length - 3] + ':' + urn[urn.length - 1]; 50 | } 51 | if (proj4.defs[code] === undefined) { 52 | throw 'No projection definition for code ' + code; 53 | } 54 | } 55 | this._proj = proj4(code); 56 | } 57 | }, 58 | 59 | project: function (latlng) { 60 | var point = this._proj.forward([latlng.lng, latlng.lat]); 61 | return new L.Point(point[0], point[1]); 62 | }, 63 | 64 | unproject: function (point, unbounded) { 65 | var point2 = this._proj.inverse([point.x, point.y]); 66 | return new L.LatLng(point2[1], point2[0], unbounded); 67 | } 68 | }); 69 | 70 | L.Proj.CRS = L.Class.extend({ 71 | includes: L.CRS, 72 | 73 | options: { 74 | transformation: new L.Transformation(1, 0, -1, 0) 75 | }, 76 | 77 | initialize: function(a, b, c) { 78 | var code, proj, def, options; 79 | 80 | if (L.Proj._isProj4Obj(a)) { 81 | proj = a; 82 | code = proj.srsCode; 83 | options = b || {}; 84 | 85 | this.projection = new L.Proj.Projection(proj); 86 | } else { 87 | code = a; 88 | def = b; 89 | options = c || {}; 90 | this.projection = new L.Proj.Projection(code, def); 91 | } 92 | 93 | L.Util.setOptions(this, options); 94 | this.code = code; 95 | this.transformation = this.options.transformation; 96 | 97 | if (this.options.origin) { 98 | this.transformation = 99 | new L.Transformation(1, -this.options.origin[0], 100 | -1, this.options.origin[1]); 101 | } 102 | 103 | if (this.options.scales) { 104 | this._scales = this.options.scales; 105 | } else if (this.options.resolutions) { 106 | this._scales = []; 107 | for (var i = this.options.resolutions.length - 1; i >= 0; i--) { 108 | if (this.options.resolutions[i]) { 109 | this._scales[i] = 1 / this.options.resolutions[i]; 110 | } 111 | } 112 | } 113 | }, 114 | 115 | scale: function(zoom) { 116 | var iZoom = Math.floor(zoom), 117 | baseScale, 118 | nextScale, 119 | scaleDiff, 120 | zDiff; 121 | if (zoom === iZoom) { 122 | return this._scales[zoom]; 123 | } else { 124 | // Non-integer zoom, interpolate 125 | baseScale = this._scales[iZoom]; 126 | nextScale = this._scales[iZoom + 1]; 127 | scaleDiff = nextScale - baseScale; 128 | zDiff = (zoom - iZoom); 129 | return baseScale + scaleDiff * zDiff; 130 | } 131 | }, 132 | 133 | getSize: function(zoom) { 134 | var b = this.options.bounds, 135 | s, 136 | min, 137 | max; 138 | 139 | if (b) { 140 | s = this.scale(zoom); 141 | min = this.transformation.transform(b.min, s); 142 | max = this.transformation.transform(b.max, s); 143 | return L.point(Math.abs(max.x - min.x), Math.abs(max.y - min.y)); 144 | } else { 145 | // Backwards compatibility with Leaflet < 0.7 146 | s = 256 * Math.pow(2, zoom); 147 | return L.point(s, s); 148 | } 149 | } 150 | }); 151 | 152 | L.Proj.CRS.TMS = L.Proj.CRS.extend({ 153 | options: { 154 | tileSize: 256 155 | }, 156 | 157 | initialize: function(a, b, c, d) { 158 | var code, 159 | def, 160 | proj, 161 | projectedBounds, 162 | options; 163 | 164 | if (L.Proj._isProj4Obj(a)) { 165 | proj = a; 166 | projectedBounds = b; 167 | options = c || {}; 168 | options.origin = [projectedBounds[0], projectedBounds[3]]; 169 | L.Proj.CRS.prototype.initialize.call(this, proj, options); 170 | } else { 171 | code = a; 172 | def = b; 173 | projectedBounds = c; 174 | options = d || {}; 175 | options.origin = [projectedBounds[0], projectedBounds[3]]; 176 | L.Proj.CRS.prototype.initialize.call(this, code, def, options); 177 | } 178 | 179 | this.projectedBounds = projectedBounds; 180 | 181 | this._sizes = this._calculateSizes(); 182 | }, 183 | 184 | _calculateSizes: function() { 185 | var sizes = [], 186 | crsBounds = this.projectedBounds, 187 | projectedTileSize, 188 | i, 189 | x, 190 | y; 191 | for (i = this._scales.length - 1; i >= 0; i--) { 192 | if (this._scales[i]) { 193 | projectedTileSize = this.options.tileSize / this._scales[i]; 194 | // to prevent very small rounding errors from causing us to round up, 195 | // cut any decimals after 3rd before rounding up. 196 | x = Math.ceil(parseFloat((crsBounds[2] - crsBounds[0]) / projectedTileSize).toPrecision(3)) * 197 | projectedTileSize * this._scales[i]; 198 | y = Math.ceil(parseFloat((crsBounds[3] - crsBounds[1]) / projectedTileSize).toPrecision(3)) * 199 | projectedTileSize * this._scales[i]; 200 | sizes[i] = L.point(x, y); 201 | } 202 | } 203 | 204 | return sizes; 205 | }, 206 | 207 | getSize: function(zoom) { 208 | return this._sizes[zoom]; 209 | } 210 | }); 211 | 212 | L.Proj.TileLayer = {}; 213 | 214 | // Note: deprecated and not necessary since 0.7, will be removed 215 | L.Proj.TileLayer.TMS = L.TileLayer.extend({ 216 | options: { 217 | continuousWorld: true 218 | }, 219 | 220 | initialize: function(urlTemplate, crs, options) { 221 | var boundsMatchesGrid = true, 222 | scaleTransforms, 223 | upperY, 224 | crsBounds, 225 | i; 226 | 227 | if (!(crs instanceof L.Proj.CRS.TMS)) { 228 | throw 'CRS is not L.Proj.CRS.TMS.'; 229 | } 230 | 231 | L.TileLayer.prototype.initialize.call(this, urlTemplate, options); 232 | // Enabling tms will cause Leaflet to also try to do TMS, which will 233 | // break (at least prior to 0.7.0). Actively disable it, to prevent 234 | // well-meaning users from shooting themselves in the foot. 235 | this.options.tms = false; 236 | this.crs = crs; 237 | crsBounds = this.crs.projectedBounds; 238 | 239 | // Verify grid alignment 240 | for (i = this.options.minZoom; i < this.options.maxZoom && boundsMatchesGrid; i++) { 241 | var gridHeight = (crsBounds[3] - crsBounds[1]) / 242 | this._projectedTileSize(i); 243 | boundsMatchesGrid = Math.abs(gridHeight - Math.round(gridHeight)) > 1e-3; 244 | } 245 | 246 | if (!boundsMatchesGrid) { 247 | scaleTransforms = {}; 248 | for (i = this.options.minZoom; i < this.options.maxZoom; i++) { 249 | upperY = crsBounds[1] + Math.ceil((crsBounds[3] - crsBounds[1]) / 250 | this._projectedTileSize(i)) * this._projectedTileSize(i); 251 | scaleTransforms[this.crs.scale(i)] = new L.Transformation(1, -crsBounds[0], -1, upperY); 252 | } 253 | 254 | this.crs = new L.Proj.CRS.TMS(this.crs.projection._proj, crsBounds, this.crs.options); 255 | this.crs.transformation = new L.Proj.ScaleDependantTransformation(scaleTransforms); 256 | } 257 | }, 258 | 259 | getTileUrl: function(tilePoint) { 260 | var zoom = this._map.getZoom(), 261 | gridHeight = Math.ceil( 262 | (this.crs.projectedBounds[3] - this.crs.projectedBounds[1]) / 263 | this._projectedTileSize(zoom)); 264 | 265 | return L.Util.template(this._url, L.Util.extend({ 266 | s: this._getSubdomain(tilePoint), 267 | z: this._getZoomForUrl(), 268 | x: tilePoint.x, 269 | y: gridHeight - tilePoint.y - 1 270 | }, this.options)); 271 | }, 272 | 273 | _projectedTileSize: function(zoom) { 274 | return (this.options.tileSize / this.crs.scale(zoom)); 275 | } 276 | }); 277 | 278 | L.Proj.GeoJSON = L.GeoJSON.extend({ 279 | initialize: function(geojson, options) { 280 | this._callLevel = 0; 281 | L.GeoJSON.prototype.initialize.call(this, null, options); 282 | if (geojson) { 283 | this.addData(geojson); 284 | } 285 | }, 286 | 287 | addData: function(geojson) { 288 | var crs; 289 | 290 | if (geojson) { 291 | if (geojson.crs && geojson.crs.type === 'name') { 292 | crs = new L.Proj.CRS(geojson.crs.properties.name); 293 | } else if (geojson.crs && geojson.crs.type) { 294 | crs = new L.Proj.CRS(geojson.crs.type + ':' + geojson.crs.properties.code); 295 | } 296 | 297 | if (crs !== undefined) { 298 | this.options.coordsToLatLng = function(coords) { 299 | var point = L.point(coords[0], coords[1]); 300 | return crs.projection.unproject(point); 301 | }; 302 | } 303 | } 304 | 305 | // Base class' addData might call us recursively, but 306 | // CRS shouldn't be cleared in that case, since CRS applies 307 | // to the whole GeoJSON, inluding sub-features. 308 | this._callLevel++; 309 | try { 310 | L.GeoJSON.prototype.addData.call(this, geojson); 311 | } finally { 312 | this._callLevel--; 313 | if (this._callLevel === 0) { 314 | delete this.options.coordsToLatLng; 315 | } 316 | } 317 | } 318 | }); 319 | 320 | L.Proj.geoJson = function(geojson, options) { 321 | return new L.Proj.GeoJSON(geojson, options); 322 | }; 323 | 324 | L.Proj.ImageOverlay = L.ImageOverlay.extend({ 325 | initialize: function(url, bounds, options) { 326 | L.ImageOverlay.prototype.initialize.call(this, url, null, options); 327 | this._projBounds = bounds; 328 | }, 329 | 330 | /* Danger ahead: overriding internal methods in Leaflet. 331 | I've decided to do this rather than making a copy of L.ImageOverlay 332 | and making very tiny modifications to it. Future will tell if this 333 | was wise or not. */ 334 | _animateZoom: function (e) { 335 | var northwest = L.point(this._projBounds.min.x, this._projBounds.max.y), 336 | southeast = L.point(this._projBounds.max.x, this._projBounds.min.y), 337 | topLeft = this._projectedToNewLayerPoint(northwest, e.zoom, e.center), 338 | size = this._projectedToNewLayerPoint(southeast, e.zoom, e.center).subtract(topLeft), 339 | origin = topLeft.add(size._multiplyBy((1 - 1 / e.scale) / 2)); 340 | 341 | this._image.style[L.DomUtil.TRANSFORM] = 342 | L.DomUtil.getTranslateString(origin) + ' scale(' + this._map.getZoomScale(e.zoom) + ') '; 343 | }, 344 | 345 | _reset: function() { 346 | var zoom = this._map.getZoom(), 347 | pixelOrigin = this._map.getPixelOrigin(), 348 | bounds = L.bounds(this._transform(this._projBounds.min, zoom)._subtract(pixelOrigin), 349 | this._transform(this._projBounds.max, zoom)._subtract(pixelOrigin)), 350 | size = bounds.getSize(), 351 | image = this._image; 352 | 353 | L.DomUtil.setPosition(image, bounds.min); 354 | image.style.width = size.x + 'px'; 355 | image.style.height = size.y + 'px'; 356 | }, 357 | 358 | _projectedToNewLayerPoint: function (point, newZoom, newCenter) { 359 | var topLeft = this._map._getNewTopLeftPoint(newCenter, newZoom).add(this._map._getMapPanePos()); 360 | return this._transform(point, newZoom)._subtract(topLeft); 361 | }, 362 | 363 | _transform: function(p, zoom) { 364 | var crs = this._map.options.crs, 365 | transformation = crs.transformation, 366 | scale = crs.scale(zoom); 367 | return transformation.transform(p, scale); 368 | } 369 | }); 370 | 371 | L.Proj.imageOverlay = function(url, bounds, options) { 372 | return new L.Proj.ImageOverlay(url, bounds, options); 373 | }; 374 | 375 | if (typeof L.CRS !== 'undefined') { 376 | // This is left here for backwards compatibility 377 | L.CRS.proj4js = (function () { 378 | return function (code, def, transformation, options) { 379 | options = options || {}; 380 | if (transformation) { 381 | options.transformation = transformation; 382 | } 383 | 384 | return new L.Proj.CRS(code, def, options); 385 | }; 386 | }()); 387 | } 388 | 389 | return L.Proj; 390 | })); 391 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/HELP-US-OUT.txt: -------------------------------------------------------------------------------- 1 | I hope you love Font Awesome. If you've found it useful, please do me a favor and check out my latest project, 2 | Fonticons (https://fonticons.com). It makes it easy to put the perfect icons on your website. Choose from our awesome, 3 | comprehensive icon sets or copy and paste your own. 4 | 5 | Please. Check it out. 6 | 7 | -Dave Gandy 8 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/ext/font-awesome/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/ext/font-awesome/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/ext/font-awesome/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/ext/font-awesome/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/ext/font-awesome/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/less/animated.less: -------------------------------------------------------------------------------- 1 | // Animated Icons 2 | // -------------------------- 3 | 4 | .@{fa-css-prefix}-spin { 5 | -webkit-animation: fa-spin 2s infinite linear; 6 | animation: fa-spin 2s infinite linear; 7 | } 8 | 9 | .@{fa-css-prefix}-pulse { 10 | -webkit-animation: fa-spin 1s infinite steps(8); 11 | animation: fa-spin 1s infinite steps(8); 12 | } 13 | 14 | @-webkit-keyframes fa-spin { 15 | 0% { 16 | -webkit-transform: rotate(0deg); 17 | transform: rotate(0deg); 18 | } 19 | 100% { 20 | -webkit-transform: rotate(359deg); 21 | transform: rotate(359deg); 22 | } 23 | } 24 | 25 | @keyframes fa-spin { 26 | 0% { 27 | -webkit-transform: rotate(0deg); 28 | transform: rotate(0deg); 29 | } 30 | 100% { 31 | -webkit-transform: rotate(359deg); 32 | transform: rotate(359deg); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/less/bordered-pulled.less: -------------------------------------------------------------------------------- 1 | // Bordered & Pulled 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-border { 5 | padding: .2em .25em .15em; 6 | border: solid .08em @fa-border-color; 7 | border-radius: .1em; 8 | } 9 | 10 | .@{fa-css-prefix}-pull-left { float: left; } 11 | .@{fa-css-prefix}-pull-right { float: right; } 12 | 13 | .@{fa-css-prefix} { 14 | &.@{fa-css-prefix}-pull-left { margin-right: .3em; } 15 | &.@{fa-css-prefix}-pull-right { margin-left: .3em; } 16 | } 17 | 18 | /* Deprecated as of 4.4.0 */ 19 | .pull-right { float: right; } 20 | .pull-left { float: left; } 21 | 22 | .@{fa-css-prefix} { 23 | &.pull-left { margin-right: .3em; } 24 | &.pull-right { margin-left: .3em; } 25 | } 26 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/less/core.less: -------------------------------------------------------------------------------- 1 | // Base Class Definition 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix} { 5 | display: inline-block; 6 | font: normal normal normal @fa-font-size-base/@fa-line-height-base FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/less/fixed-width.less: -------------------------------------------------------------------------------- 1 | // Fixed Width Icons 2 | // ------------------------- 3 | .@{fa-css-prefix}-fw { 4 | width: (18em / 14); 5 | text-align: center; 6 | } 7 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/less/font-awesome.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome 4.5.0 by @davegandy - http://fontawesome.io - @fontawesome 3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) 4 | */ 5 | 6 | @import "variables.less"; 7 | @import "mixins.less"; 8 | @import "path.less"; 9 | @import "core.less"; 10 | @import "larger.less"; 11 | @import "fixed-width.less"; 12 | @import "list.less"; 13 | @import "bordered-pulled.less"; 14 | @import "animated.less"; 15 | @import "rotated-flipped.less"; 16 | @import "stacked.less"; 17 | @import "icons.less"; 18 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/less/larger.less: -------------------------------------------------------------------------------- 1 | // Icon Sizes 2 | // ------------------------- 3 | 4 | /* makes the font 33% larger relative to the icon container */ 5 | .@{fa-css-prefix}-lg { 6 | font-size: (4em / 3); 7 | line-height: (3em / 4); 8 | vertical-align: -15%; 9 | } 10 | .@{fa-css-prefix}-2x { font-size: 2em; } 11 | .@{fa-css-prefix}-3x { font-size: 3em; } 12 | .@{fa-css-prefix}-4x { font-size: 4em; } 13 | .@{fa-css-prefix}-5x { font-size: 5em; } 14 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/less/list.less: -------------------------------------------------------------------------------- 1 | // List Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-ul { 5 | padding-left: 0; 6 | margin-left: @fa-li-width; 7 | list-style-type: none; 8 | > li { position: relative; } 9 | } 10 | .@{fa-css-prefix}-li { 11 | position: absolute; 12 | left: -@fa-li-width; 13 | width: @fa-li-width; 14 | top: (2em / 14); 15 | text-align: center; 16 | &.@{fa-css-prefix}-lg { 17 | left: (-@fa-li-width + (4em / 14)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/less/mixins.less: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------- 3 | 4 | .fa-icon() { 5 | display: inline-block; 6 | font: normal normal normal @fa-font-size-base/@fa-line-height-base FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | 12 | } 13 | 14 | .fa-icon-rotate(@degrees, @rotation) { 15 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation); 16 | -webkit-transform: rotate(@degrees); 17 | -ms-transform: rotate(@degrees); 18 | transform: rotate(@degrees); 19 | } 20 | 21 | .fa-icon-flip(@horiz, @vert, @rotation) { 22 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation, mirror=1); 23 | -webkit-transform: scale(@horiz, @vert); 24 | -ms-transform: scale(@horiz, @vert); 25 | transform: scale(@horiz, @vert); 26 | } 27 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/less/path.less: -------------------------------------------------------------------------------- 1 | /* FONT PATH 2 | * -------------------------- */ 3 | 4 | @font-face { 5 | font-family: 'FontAwesome'; 6 | src: url('@{fa-font-path}/fontawesome-webfont.eot?v=@{fa-version}'); 7 | src: url('@{fa-font-path}/fontawesome-webfont.eot?#iefix&v=@{fa-version}') format('embedded-opentype'), 8 | url('@{fa-font-path}/fontawesome-webfont.woff2?v=@{fa-version}') format('woff2'), 9 | url('@{fa-font-path}/fontawesome-webfont.woff?v=@{fa-version}') format('woff'), 10 | url('@{fa-font-path}/fontawesome-webfont.ttf?v=@{fa-version}') format('truetype'), 11 | url('@{fa-font-path}/fontawesome-webfont.svg?v=@{fa-version}#fontawesomeregular') format('svg'); 12 | // src: url('@{fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/less/rotated-flipped.less: -------------------------------------------------------------------------------- 1 | // Rotated & Flipped Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-rotate-90 { .fa-icon-rotate(90deg, 1); } 5 | .@{fa-css-prefix}-rotate-180 { .fa-icon-rotate(180deg, 2); } 6 | .@{fa-css-prefix}-rotate-270 { .fa-icon-rotate(270deg, 3); } 7 | 8 | .@{fa-css-prefix}-flip-horizontal { .fa-icon-flip(-1, 1, 0); } 9 | .@{fa-css-prefix}-flip-vertical { .fa-icon-flip(1, -1, 2); } 10 | 11 | // Hook for IE8-9 12 | // ------------------------- 13 | 14 | :root .@{fa-css-prefix}-rotate-90, 15 | :root .@{fa-css-prefix}-rotate-180, 16 | :root .@{fa-css-prefix}-rotate-270, 17 | :root .@{fa-css-prefix}-flip-horizontal, 18 | :root .@{fa-css-prefix}-flip-vertical { 19 | filter: none; 20 | } 21 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/less/stacked.less: -------------------------------------------------------------------------------- 1 | // Stacked Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-stack { 5 | position: relative; 6 | display: inline-block; 7 | width: 2em; 8 | height: 2em; 9 | line-height: 2em; 10 | vertical-align: middle; 11 | } 12 | .@{fa-css-prefix}-stack-1x, .@{fa-css-prefix}-stack-2x { 13 | position: absolute; 14 | left: 0; 15 | width: 100%; 16 | text-align: center; 17 | } 18 | .@{fa-css-prefix}-stack-1x { line-height: inherit; } 19 | .@{fa-css-prefix}-stack-2x { font-size: 2em; } 20 | .@{fa-css-prefix}-inverse { color: @fa-inverse; } 21 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/scss/_animated.scss: -------------------------------------------------------------------------------- 1 | // Spinning Icons 2 | // -------------------------- 3 | 4 | .#{$fa-css-prefix}-spin { 5 | -webkit-animation: fa-spin 2s infinite linear; 6 | animation: fa-spin 2s infinite linear; 7 | } 8 | 9 | .#{$fa-css-prefix}-pulse { 10 | -webkit-animation: fa-spin 1s infinite steps(8); 11 | animation: fa-spin 1s infinite steps(8); 12 | } 13 | 14 | @-webkit-keyframes fa-spin { 15 | 0% { 16 | -webkit-transform: rotate(0deg); 17 | transform: rotate(0deg); 18 | } 19 | 100% { 20 | -webkit-transform: rotate(359deg); 21 | transform: rotate(359deg); 22 | } 23 | } 24 | 25 | @keyframes fa-spin { 26 | 0% { 27 | -webkit-transform: rotate(0deg); 28 | transform: rotate(0deg); 29 | } 30 | 100% { 31 | -webkit-transform: rotate(359deg); 32 | transform: rotate(359deg); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/scss/_bordered-pulled.scss: -------------------------------------------------------------------------------- 1 | // Bordered & Pulled 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-border { 5 | padding: .2em .25em .15em; 6 | border: solid .08em $fa-border-color; 7 | border-radius: .1em; 8 | } 9 | 10 | .#{$fa-css-prefix}-pull-left { float: left; } 11 | .#{$fa-css-prefix}-pull-right { float: right; } 12 | 13 | .#{$fa-css-prefix} { 14 | &.#{$fa-css-prefix}-pull-left { margin-right: .3em; } 15 | &.#{$fa-css-prefix}-pull-right { margin-left: .3em; } 16 | } 17 | 18 | /* Deprecated as of 4.4.0 */ 19 | .pull-right { float: right; } 20 | .pull-left { float: left; } 21 | 22 | .#{$fa-css-prefix} { 23 | &.pull-left { margin-right: .3em; } 24 | &.pull-right { margin-left: .3em; } 25 | } 26 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/scss/_core.scss: -------------------------------------------------------------------------------- 1 | // Base Class Definition 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix} { 5 | display: inline-block; 6 | font: normal normal normal #{$fa-font-size-base}/#{$fa-line-height-base} FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/scss/_fixed-width.scss: -------------------------------------------------------------------------------- 1 | // Fixed Width Icons 2 | // ------------------------- 3 | .#{$fa-css-prefix}-fw { 4 | width: (18em / 14); 5 | text-align: center; 6 | } 7 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/scss/_larger.scss: -------------------------------------------------------------------------------- 1 | // Icon Sizes 2 | // ------------------------- 3 | 4 | /* makes the font 33% larger relative to the icon container */ 5 | .#{$fa-css-prefix}-lg { 6 | font-size: (4em / 3); 7 | line-height: (3em / 4); 8 | vertical-align: -15%; 9 | } 10 | .#{$fa-css-prefix}-2x { font-size: 2em; } 11 | .#{$fa-css-prefix}-3x { font-size: 3em; } 12 | .#{$fa-css-prefix}-4x { font-size: 4em; } 13 | .#{$fa-css-prefix}-5x { font-size: 5em; } 14 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/scss/_list.scss: -------------------------------------------------------------------------------- 1 | // List Icons 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-ul { 5 | padding-left: 0; 6 | margin-left: $fa-li-width; 7 | list-style-type: none; 8 | > li { position: relative; } 9 | } 10 | .#{$fa-css-prefix}-li { 11 | position: absolute; 12 | left: -$fa-li-width; 13 | width: $fa-li-width; 14 | top: (2em / 14); 15 | text-align: center; 16 | &.#{$fa-css-prefix}-lg { 17 | left: -$fa-li-width + (4em / 14); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/scss/_mixins.scss: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------- 3 | 4 | @mixin fa-icon() { 5 | display: inline-block; 6 | font: normal normal normal #{$fa-font-size-base}/#{$fa-line-height-base} FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | 12 | } 13 | 14 | @mixin fa-icon-rotate($degrees, $rotation) { 15 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation}); 16 | -webkit-transform: rotate($degrees); 17 | -ms-transform: rotate($degrees); 18 | transform: rotate($degrees); 19 | } 20 | 21 | @mixin fa-icon-flip($horiz, $vert, $rotation) { 22 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation}); 23 | -webkit-transform: scale($horiz, $vert); 24 | -ms-transform: scale($horiz, $vert); 25 | transform: scale($horiz, $vert); 26 | } 27 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/scss/_path.scss: -------------------------------------------------------------------------------- 1 | /* FONT PATH 2 | * -------------------------- */ 3 | 4 | @font-face { 5 | font-family: 'FontAwesome'; 6 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?v=#{$fa-version}'); 7 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?#iefix&v=#{$fa-version}') format('embedded-opentype'), 8 | url('#{$fa-font-path}/fontawesome-webfont.woff2?v=#{$fa-version}') format('woff2'), 9 | url('#{$fa-font-path}/fontawesome-webfont.woff?v=#{$fa-version}') format('woff'), 10 | url('#{$fa-font-path}/fontawesome-webfont.ttf?v=#{$fa-version}') format('truetype'), 11 | url('#{$fa-font-path}/fontawesome-webfont.svg?v=#{$fa-version}#fontawesomeregular') format('svg'); 12 | // src: url('#{$fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/scss/_rotated-flipped.scss: -------------------------------------------------------------------------------- 1 | // Rotated & Flipped Icons 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-rotate-90 { @include fa-icon-rotate(90deg, 1); } 5 | .#{$fa-css-prefix}-rotate-180 { @include fa-icon-rotate(180deg, 2); } 6 | .#{$fa-css-prefix}-rotate-270 { @include fa-icon-rotate(270deg, 3); } 7 | 8 | .#{$fa-css-prefix}-flip-horizontal { @include fa-icon-flip(-1, 1, 0); } 9 | .#{$fa-css-prefix}-flip-vertical { @include fa-icon-flip(1, -1, 2); } 10 | 11 | // Hook for IE8-9 12 | // ------------------------- 13 | 14 | :root .#{$fa-css-prefix}-rotate-90, 15 | :root .#{$fa-css-prefix}-rotate-180, 16 | :root .#{$fa-css-prefix}-rotate-270, 17 | :root .#{$fa-css-prefix}-flip-horizontal, 18 | :root .#{$fa-css-prefix}-flip-vertical { 19 | filter: none; 20 | } 21 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/scss/_stacked.scss: -------------------------------------------------------------------------------- 1 | // Stacked Icons 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-stack { 5 | position: relative; 6 | display: inline-block; 7 | width: 2em; 8 | height: 2em; 9 | line-height: 2em; 10 | vertical-align: middle; 11 | } 12 | .#{$fa-css-prefix}-stack-1x, .#{$fa-css-prefix}-stack-2x { 13 | position: absolute; 14 | left: 0; 15 | width: 100%; 16 | text-align: center; 17 | } 18 | .#{$fa-css-prefix}-stack-1x { line-height: inherit; } 19 | .#{$fa-css-prefix}-stack-2x { font-size: 2em; } 20 | .#{$fa-css-prefix}-inverse { color: $fa-inverse; } 21 | -------------------------------------------------------------------------------- /applications/packager2/ext/font-awesome/scss/font-awesome.scss: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome 4.5.0 by @davegandy - http://fontawesome.io - @fontawesome 3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) 4 | */ 5 | 6 | @import "variables"; 7 | @import "mixins"; 8 | @import "path"; 9 | @import "core"; 10 | @import "larger"; 11 | @import "fixed-width"; 12 | @import "list"; 13 | @import "bordered-pulled"; 14 | @import "animated"; 15 | @import "rotated-flipped"; 16 | @import "stacked"; 17 | @import "icons"; 18 | -------------------------------------------------------------------------------- /applications/packager2/ext/leaflet/images/layers-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/ext/leaflet/images/layers-2x.png -------------------------------------------------------------------------------- /applications/packager2/ext/leaflet/images/layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/ext/leaflet/images/layers.png -------------------------------------------------------------------------------- /applications/packager2/ext/leaflet/images/marker-icon-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/ext/leaflet/images/marker-icon-2x.png -------------------------------------------------------------------------------- /applications/packager2/ext/leaflet/images/marker-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/ext/leaflet/images/marker-icon.png -------------------------------------------------------------------------------- /applications/packager2/ext/leaflet/images/marker-shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/ext/leaflet/images/marker-shadow.png -------------------------------------------------------------------------------- /applications/packager2/ext/leaflet/leaflet.css: -------------------------------------------------------------------------------- 1 | /* required styles */ 2 | 3 | .leaflet-map-pane, 4 | .leaflet-tile, 5 | .leaflet-marker-icon, 6 | .leaflet-marker-shadow, 7 | .leaflet-tile-pane, 8 | .leaflet-tile-container, 9 | .leaflet-overlay-pane, 10 | .leaflet-shadow-pane, 11 | .leaflet-marker-pane, 12 | .leaflet-popup-pane, 13 | .leaflet-overlay-pane svg, 14 | .leaflet-zoom-box, 15 | .leaflet-image-layer, 16 | .leaflet-layer { 17 | position: absolute; 18 | left: 0; 19 | top: 0; 20 | } 21 | .leaflet-container { 22 | overflow: hidden; 23 | -ms-touch-action: none; 24 | touch-action: none; 25 | } 26 | .leaflet-tile, 27 | .leaflet-marker-icon, 28 | .leaflet-marker-shadow { 29 | -webkit-user-select: none; 30 | -moz-user-select: none; 31 | user-select: none; 32 | -webkit-user-drag: none; 33 | } 34 | .leaflet-marker-icon, 35 | .leaflet-marker-shadow { 36 | display: block; 37 | } 38 | /* map is broken in FF if you have max-width: 100% on tiles */ 39 | .leaflet-container img { 40 | max-width: none !important; 41 | } 42 | /* stupid Android 2 doesn't understand "max-width: none" properly */ 43 | .leaflet-container img.leaflet-image-layer { 44 | max-width: 15000px !important; 45 | } 46 | .leaflet-tile { 47 | filter: inherit; 48 | visibility: hidden; 49 | } 50 | .leaflet-tile-loaded { 51 | visibility: inherit; 52 | } 53 | .leaflet-zoom-box { 54 | width: 0; 55 | height: 0; 56 | } 57 | /* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */ 58 | .leaflet-overlay-pane svg { 59 | -moz-user-select: none; 60 | } 61 | 62 | .leaflet-tile-pane { z-index: 2; } 63 | .leaflet-objects-pane { z-index: 3; } 64 | .leaflet-overlay-pane { z-index: 4; } 65 | .leaflet-shadow-pane { z-index: 5; } 66 | .leaflet-marker-pane { z-index: 6; } 67 | .leaflet-popup-pane { z-index: 7; } 68 | 69 | .leaflet-vml-shape { 70 | width: 1px; 71 | height: 1px; 72 | } 73 | .lvml { 74 | behavior: url(#default#VML); 75 | display: inline-block; 76 | position: absolute; 77 | } 78 | 79 | 80 | /* control positioning */ 81 | 82 | .leaflet-control { 83 | position: relative; 84 | z-index: 7; 85 | pointer-events: auto; 86 | } 87 | .leaflet-top, 88 | .leaflet-bottom { 89 | position: absolute; 90 | z-index: 1000; 91 | pointer-events: none; 92 | } 93 | .leaflet-top { 94 | top: 0; 95 | } 96 | .leaflet-right { 97 | right: 0; 98 | } 99 | .leaflet-bottom { 100 | bottom: 0; 101 | } 102 | .leaflet-left { 103 | left: 0; 104 | } 105 | .leaflet-control { 106 | float: left; 107 | clear: both; 108 | } 109 | .leaflet-right .leaflet-control { 110 | float: right; 111 | } 112 | .leaflet-top .leaflet-control { 113 | margin-top: 10px; 114 | } 115 | .leaflet-bottom .leaflet-control { 116 | margin-bottom: 10px; 117 | } 118 | .leaflet-left .leaflet-control { 119 | margin-left: 10px; 120 | } 121 | .leaflet-right .leaflet-control { 122 | margin-right: 10px; 123 | } 124 | 125 | 126 | /* zoom and fade animations */ 127 | 128 | .leaflet-fade-anim .leaflet-tile, 129 | .leaflet-fade-anim .leaflet-popup { 130 | opacity: 0; 131 | -webkit-transition: opacity 0.2s linear; 132 | -moz-transition: opacity 0.2s linear; 133 | -o-transition: opacity 0.2s linear; 134 | transition: opacity 0.2s linear; 135 | } 136 | .leaflet-fade-anim .leaflet-tile-loaded, 137 | .leaflet-fade-anim .leaflet-map-pane .leaflet-popup { 138 | opacity: 1; 139 | } 140 | 141 | .leaflet-zoom-anim .leaflet-zoom-animated { 142 | -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1); 143 | -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1); 144 | -o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1); 145 | transition: transform 0.25s cubic-bezier(0,0,0.25,1); 146 | } 147 | .leaflet-zoom-anim .leaflet-tile, 148 | .leaflet-pan-anim .leaflet-tile, 149 | .leaflet-touching .leaflet-zoom-animated { 150 | -webkit-transition: none; 151 | -moz-transition: none; 152 | -o-transition: none; 153 | transition: none; 154 | } 155 | 156 | .leaflet-zoom-anim .leaflet-zoom-hide { 157 | visibility: hidden; 158 | } 159 | 160 | 161 | /* cursors */ 162 | 163 | .leaflet-clickable { 164 | cursor: pointer; 165 | } 166 | .leaflet-container { 167 | cursor: -webkit-grab; 168 | cursor: -moz-grab; 169 | } 170 | .leaflet-popup-pane, 171 | .leaflet-control { 172 | cursor: auto; 173 | } 174 | .leaflet-dragging .leaflet-container, 175 | .leaflet-dragging .leaflet-clickable { 176 | cursor: move; 177 | cursor: -webkit-grabbing; 178 | cursor: -moz-grabbing; 179 | } 180 | 181 | 182 | /* visual tweaks */ 183 | 184 | .leaflet-container { 185 | background: #ddd; 186 | outline: 0; 187 | } 188 | .leaflet-container a { 189 | color: #0078A8; 190 | } 191 | .leaflet-container a.leaflet-active { 192 | outline: 2px solid orange; 193 | } 194 | .leaflet-zoom-box { 195 | border: 2px dotted #38f; 196 | background: rgba(255,255,255,0.5); 197 | } 198 | 199 | 200 | /* general typography */ 201 | .leaflet-container { 202 | font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; 203 | } 204 | 205 | 206 | /* general toolbar styles */ 207 | 208 | .leaflet-bar { 209 | box-shadow: 0 1px 5px rgba(0,0,0,0.65); 210 | border-radius: 4px; 211 | } 212 | .leaflet-bar a, 213 | .leaflet-bar a:hover { 214 | background-color: #fff; 215 | border-bottom: 1px solid #ccc; 216 | width: 26px; 217 | height: 26px; 218 | line-height: 26px; 219 | display: block; 220 | text-align: center; 221 | text-decoration: none; 222 | color: black; 223 | } 224 | .leaflet-bar a, 225 | .leaflet-control-layers-toggle { 226 | background-position: 50% 50%; 227 | background-repeat: no-repeat; 228 | display: block; 229 | } 230 | .leaflet-bar a:hover { 231 | background-color: #f4f4f4; 232 | } 233 | .leaflet-bar a:first-child { 234 | border-top-left-radius: 4px; 235 | border-top-right-radius: 4px; 236 | } 237 | .leaflet-bar a:last-child { 238 | border-bottom-left-radius: 4px; 239 | border-bottom-right-radius: 4px; 240 | border-bottom: none; 241 | } 242 | .leaflet-bar a.leaflet-disabled { 243 | cursor: default; 244 | background-color: #f4f4f4; 245 | color: #bbb; 246 | } 247 | 248 | .leaflet-touch .leaflet-bar a { 249 | width: 30px; 250 | height: 30px; 251 | line-height: 30px; 252 | } 253 | 254 | 255 | /* zoom control */ 256 | 257 | .leaflet-control-zoom-in, 258 | .leaflet-control-zoom-out { 259 | font: bold 18px 'Lucida Console', Monaco, monospace; 260 | text-indent: 1px; 261 | } 262 | .leaflet-control-zoom-out { 263 | font-size: 20px; 264 | } 265 | 266 | .leaflet-touch .leaflet-control-zoom-in { 267 | font-size: 22px; 268 | } 269 | .leaflet-touch .leaflet-control-zoom-out { 270 | font-size: 24px; 271 | } 272 | 273 | 274 | /* layers control */ 275 | 276 | .leaflet-control-layers { 277 | box-shadow: 0 1px 5px rgba(0,0,0,0.4); 278 | background: #fff; 279 | border-radius: 5px; 280 | } 281 | .leaflet-control-layers-toggle { 282 | background-image: url(images/layers.png); 283 | width: 36px; 284 | height: 36px; 285 | } 286 | .leaflet-retina .leaflet-control-layers-toggle { 287 | background-image: url(images/layers-2x.png); 288 | background-size: 26px 26px; 289 | } 290 | .leaflet-touch .leaflet-control-layers-toggle { 291 | width: 44px; 292 | height: 44px; 293 | } 294 | .leaflet-control-layers .leaflet-control-layers-list, 295 | .leaflet-control-layers-expanded .leaflet-control-layers-toggle { 296 | display: none; 297 | } 298 | .leaflet-control-layers-expanded .leaflet-control-layers-list { 299 | display: block; 300 | position: relative; 301 | } 302 | .leaflet-control-layers-expanded { 303 | padding: 6px 10px 6px 6px; 304 | color: #333; 305 | background: #fff; 306 | } 307 | .leaflet-control-layers-selector { 308 | margin-top: 2px; 309 | position: relative; 310 | top: 1px; 311 | } 312 | .leaflet-control-layers label { 313 | display: block; 314 | } 315 | .leaflet-control-layers-separator { 316 | height: 0; 317 | border-top: 1px solid #ddd; 318 | margin: 5px -10px 5px -6px; 319 | } 320 | 321 | 322 | /* attribution and scale controls */ 323 | 324 | .leaflet-container .leaflet-control-attribution { 325 | background: #fff; 326 | background: rgba(255, 255, 255, 0.7); 327 | margin: 0; 328 | } 329 | .leaflet-control-attribution, 330 | .leaflet-control-scale-line { 331 | padding: 0 5px; 332 | color: #333; 333 | } 334 | .leaflet-control-attribution a { 335 | text-decoration: none; 336 | } 337 | .leaflet-control-attribution a:hover { 338 | text-decoration: underline; 339 | } 340 | .leaflet-container .leaflet-control-attribution, 341 | .leaflet-container .leaflet-control-scale { 342 | font-size: 11px; 343 | } 344 | .leaflet-left .leaflet-control-scale { 345 | margin-left: 5px; 346 | } 347 | .leaflet-bottom .leaflet-control-scale { 348 | margin-bottom: 5px; 349 | } 350 | .leaflet-control-scale-line { 351 | border: 2px solid #777; 352 | border-top: none; 353 | line-height: 1.1; 354 | padding: 2px 5px 1px; 355 | font-size: 11px; 356 | white-space: nowrap; 357 | overflow: hidden; 358 | -moz-box-sizing: content-box; 359 | box-sizing: content-box; 360 | 361 | background: #fff; 362 | background: rgba(255, 255, 255, 0.5); 363 | } 364 | .leaflet-control-scale-line:not(:first-child) { 365 | border-top: 2px solid #777; 366 | border-bottom: none; 367 | margin-top: -2px; 368 | } 369 | .leaflet-control-scale-line:not(:first-child):not(:last-child) { 370 | border-bottom: 2px solid #777; 371 | } 372 | 373 | .leaflet-touch .leaflet-control-attribution, 374 | .leaflet-touch .leaflet-control-layers, 375 | .leaflet-touch .leaflet-bar { 376 | box-shadow: none; 377 | } 378 | .leaflet-touch .leaflet-control-layers, 379 | .leaflet-touch .leaflet-bar { 380 | border: 2px solid rgba(0,0,0,0.2); 381 | background-clip: padding-box; 382 | } 383 | 384 | 385 | /* popup */ 386 | 387 | .leaflet-popup { 388 | position: absolute; 389 | text-align: center; 390 | } 391 | .leaflet-popup-content-wrapper { 392 | padding: 1px; 393 | text-align: left; 394 | border-radius: 12px; 395 | } 396 | .leaflet-popup-content { 397 | margin: 13px 19px; 398 | line-height: 1.4; 399 | } 400 | .leaflet-popup-content p { 401 | margin: 18px 0; 402 | } 403 | .leaflet-popup-tip-container { 404 | margin: 0 auto; 405 | width: 40px; 406 | height: 20px; 407 | position: relative; 408 | overflow: hidden; 409 | } 410 | .leaflet-popup-tip { 411 | width: 17px; 412 | height: 17px; 413 | padding: 1px; 414 | 415 | margin: -10px auto 0; 416 | 417 | -webkit-transform: rotate(45deg); 418 | -moz-transform: rotate(45deg); 419 | -ms-transform: rotate(45deg); 420 | -o-transform: rotate(45deg); 421 | transform: rotate(45deg); 422 | } 423 | .leaflet-popup-content-wrapper, 424 | .leaflet-popup-tip { 425 | background: white; 426 | 427 | box-shadow: 0 3px 14px rgba(0,0,0,0.4); 428 | } 429 | .leaflet-container a.leaflet-popup-close-button { 430 | position: absolute; 431 | top: 0; 432 | right: 0; 433 | padding: 4px 4px 0 0; 434 | text-align: center; 435 | width: 18px; 436 | height: 14px; 437 | font: 16px/14px Tahoma, Verdana, sans-serif; 438 | color: #c3c3c3; 439 | text-decoration: none; 440 | font-weight: bold; 441 | background: transparent; 442 | } 443 | .leaflet-container a.leaflet-popup-close-button:hover { 444 | color: #999; 445 | } 446 | .leaflet-popup-scrolled { 447 | overflow: auto; 448 | border-bottom: 1px solid #ddd; 449 | border-top: 1px solid #ddd; 450 | } 451 | 452 | .leaflet-oldie .leaflet-popup-content-wrapper { 453 | zoom: 1; 454 | } 455 | .leaflet-oldie .leaflet-popup-tip { 456 | width: 24px; 457 | margin: 0 auto; 458 | 459 | -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)"; 460 | filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678); 461 | } 462 | .leaflet-oldie .leaflet-popup-tip-container { 463 | margin-top: -1px; 464 | } 465 | 466 | .leaflet-oldie .leaflet-control-zoom, 467 | .leaflet-oldie .leaflet-control-layers, 468 | .leaflet-oldie .leaflet-popup-content-wrapper, 469 | .leaflet-oldie .leaflet-popup-tip { 470 | border: 1px solid #999; 471 | } 472 | 473 | 474 | /* div icon */ 475 | 476 | .leaflet-div-icon { 477 | background: #fff; 478 | border: 1px solid #666; 479 | } 480 | -------------------------------------------------------------------------------- /applications/packager2/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/img/favicon.ico -------------------------------------------------------------------------------- /applications/packager2/img/pelican.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/img/pelican.png -------------------------------------------------------------------------------- /applications/packager2/sass/.sass-cache/ea83ec22b13391b3d67a1056797e02b35f48f74a/style.scssc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelicanmapping/osgearth-cef/bfae894729934afdcd1a21931c2dc9ac058e4c18/applications/packager2/sass/.sass-cache/ea83ec22b13391b3d67a1056797e02b35f48f74a/style.scssc -------------------------------------------------------------------------------- /applications/packager2/sass/style.scss: -------------------------------------------------------------------------------- 1 | $leftbar-size: 400px; 2 | $bottombar-size: 280px; 3 | $footer-size: 25px; 4 | $boxheader-size: 36px; 5 | $buttonbox-size: 0px; 6 | $default-margin: 10px; 7 | $bottom-box-top: $bottombar-size - $boxheader-size - $default-margin; 8 | $btnout-size: 160px; 9 | 10 | $content-bg: #607D8B; 11 | $box-bg: #FFFFFF; 12 | $header-bg: #455A64; 13 | $hover-bg: #E0E9ED; 14 | $highlight-bg: #607D8B; 15 | $accent-bg: #009688; 16 | $popup-bg: #FFFFFF; 17 | $font-color: #212121; 18 | $error-color: #F45D4C; 19 | 20 | .pushright { 21 | float: right; 22 | } 23 | 24 | 25 | html, body { 26 | background-color: $content-bg; 27 | color: $font-color; 28 | padding: 0px; 29 | margin: 0px; 30 | position: absolute; 31 | left: 0px; 32 | right: 0px; 33 | top: 0px; 34 | bottom: 0px; 35 | min-height: 500px; 36 | min-width: 500px; 37 | font-family: Verdana, Geneva, sans-serif; 38 | overflow: hidden; 39 | } 40 | 41 | #leftbar { 42 | position: absolute; 43 | top: 0px; 44 | bottom: $footer-size; 45 | left: 0px; 46 | width: $leftbar-size; 47 | background-color: $content-bg; 48 | } 49 | 50 | #leftbar_buttons { 51 | position: absolute; 52 | top: 0px; 53 | left: $default-margin; 54 | right: $default-margin; 55 | height: $buttonbox-size; 56 | line-height: $buttonbox-size; 57 | text-align: center; 58 | /*border-bottom: 1px solid #fff;*/ 59 | } 60 | 61 | #data_header { 62 | position: absolute; 63 | top: $buttonbox-size + $default-margin; 64 | left: $default-margin; 65 | right: $default-margin; 66 | } 67 | 68 | #data_header .fa-plus { 69 | font-size: 22px; 70 | vertical-align: middle; 71 | cursor: pointer; 72 | } 73 | 74 | .box-header { 75 | height: 36px; 76 | line-height: 36px; 77 | font-size: 16px; 78 | padding: 0px 10px; 79 | color: #fff; 80 | background-color: $header-bg; 81 | border-radius: 2px 2px 0px 0px; 82 | } 83 | 84 | .layer-box { 85 | background-color: $box-bg; 86 | padding: 5px; 87 | font-size: 14px; 88 | overflow: auto; 89 | border-radius: 0px 0px 2px 2px; 90 | box-sizing: border-box; 91 | } 92 | 93 | #data_sources { 94 | position: absolute; 95 | top: $default-margin + $buttonbox-size + $boxheader-size; 96 | left: $default-margin; 97 | right: $default-margin; 98 | bottom: $bottombar-size 99 | } 100 | 101 | .file-row { 102 | height: 22px; 103 | line-height: 22px; 104 | font-size: 14px; 105 | cursor: pointer; 106 | white-space: nowrap; 107 | } 108 | .file-row.selected { 109 | background-color: $highlight-bg; 110 | color: $box-bg; 111 | } 112 | .file-row:hover { 113 | background-color: $hover-bg; 114 | color: $font-color; 115 | } 116 | 117 | .file-row .fa-remove, #out_cancel .fa-remove { 118 | font-size: 18px; 119 | vertical-align: middle; 120 | color: $error-color; 121 | } 122 | .file-row .fa-remove:hover, #out_cancel .fa-remove:hover { 123 | color: #FBC2BC; 124 | } 125 | 126 | #props_header { 127 | position: absolute; 128 | bottom: $bottom-box-top; 129 | left: $default-margin; 130 | right: $default-margin; 131 | } 132 | 133 | #data_props { 134 | position: absolute; 135 | left: $default-margin; 136 | right: $default-margin; 137 | bottom: $default-margin; 138 | height: $bottom-box-top - $default-margin; 139 | font-size: 12px; 140 | } 141 | 142 | 143 | #left_bar .layer-name { 144 | padding: 5px; 145 | } 146 | #left_bar .layer-name:hover { 147 | background-color: #ddd; 148 | } 149 | 150 | #map { 151 | position: absolute; 152 | top: $default-margin; 153 | bottom: $bottombar-size + $footer-size; 154 | left: $leftbar-size; 155 | right: $default-margin; 156 | } 157 | 158 | #logo_div { 159 | /*background-color: rgba(255, 255, 255, 0.5); 160 | color: #fff; 161 | font-size: 10px;*/ 162 | position: absolute; 163 | right: $default-margin; 164 | bottom: $bottombar-size + $default-margin + $footer-size; 165 | padding: 2px; 166 | /*border: 1px solid rgba(255, 255, 255, 0.6);*/ 167 | } 168 | 169 | #footer { 170 | position: absolute; 171 | left: 0px; 172 | right: 0px; 173 | bottom: 0px; 174 | height: $footer-size; 175 | box-sizing: border-box; 176 | padding-right: $default-margin; 177 | background-color: $header-bg; 178 | color: #fff; 179 | text-align: right; 180 | line-height: $footer-size; 181 | font-size: 14px; 182 | } 183 | 184 | #footer .error-msg { 185 | background-color: $error-color; 186 | padding: 1px 4px; 187 | } 188 | 189 | #bottombar { 190 | position: absolute; 191 | left: $leftbar-size; 192 | right: 0px; 193 | bottom: $footer-size; 194 | height: $bottombar-size; 195 | background-color: $content-bg; 196 | } 197 | 198 | #output_header { 199 | position: absolute; 200 | top: $default-margin; 201 | left: 0px; 202 | right: $default-margin + $btnout-size + $default-margin; 203 | } 204 | 205 | #output_props { 206 | position: absolute; 207 | top: $default-margin + $boxheader-size; 208 | left: 0px; 209 | right: $default-margin + $btnout-size + $default-margin; 210 | bottom: $default-margin; 211 | overflow: visible; 212 | z-index: 99; 213 | } 214 | 215 | 216 | .flat-button { 217 | border: 0 none; 218 | border-radius: 2px; 219 | color: #fff; 220 | background-color: $header-bg; 221 | cursor: pointer; 222 | font-size: 16px; 223 | font-weight: bold; 224 | line-height: 20px; 225 | padding: 10px; 226 | box-sizing: border-box; 227 | text-align: center; 228 | /*transition: all 0.05s ease 0s; 229 | -moz-transition: all 0.05s ease 0s; 230 | -webkit-transition: all 0.05s ease 0s;*/ 231 | } 232 | .flat-button:hover { 233 | background-color: $accent-bg; 234 | } 235 | 236 | #destination_button.flat-button { 237 | line-height: 14px; 238 | font-size:14px; 239 | padding: 4px 12px; 240 | } 241 | 242 | #extents_button.flat-button { 243 | line-height: 14px; 244 | font-size:14px; 245 | padding: 4px 8px; 246 | } 247 | 248 | /* 249 | #load_button { 250 | width: 100%; 251 | line-height: $buttonbox-size - 40px; 252 | background-color: #6792AB; 253 | } 254 | #load_button:hover { 255 | background-color: #073E5B; 256 | } 257 | */ 258 | 259 | /*#output_props > div { 260 | line-height: 40px; 261 | height: 40px; 262 | font-size: 14px; 263 | }*/ 264 | #output_props input[type="text"] { 265 | width: 60px; 266 | } 267 | 268 | 269 | 270 | #destination_box { 271 | padding: 15px 0px 0px 10px; 272 | } 273 | 274 | #out_button { 275 | position: absolute; 276 | top: $default-margin; 277 | bottom: $default-margin; 278 | right: $default-margin; 279 | width: $btnout-size; 280 | padding-top: ($bottombar-size - (2.0 * $default-margin) - 40px) / 2.0; 281 | } 282 | 283 | #out_button .fa { 284 | font-size: 30px; 285 | } 286 | 287 | .table { 288 | display: table; 289 | width: 100%; 290 | } 291 | 292 | #destination_table.table { 293 | width: 50%; 294 | min-width: 400px; 295 | } 296 | 297 | .table-row { 298 | display: table-row; 299 | padding: 10px; 300 | } 301 | 302 | .table-cell { 303 | display: table-cell; 304 | padding: 15px 10px 0px; 305 | width: 25%; 306 | } 307 | .table-cell.short { 308 | width: 1px; 309 | } 310 | .table-cell.long { 311 | width: 100%; 312 | } 313 | 314 | .table-cell span { 315 | margin-top: 6px; 316 | } 317 | 318 | #output_props .table-cell.long input[type="text"] { 319 | width: 100%; 320 | } 321 | 322 | .extent-input.inerror, .zoom-input.inerror, #output_destination.inerror { 323 | background-color: $error-color; 324 | } 325 | 326 | .accent-mark { 327 | color: $accent-bg; 328 | } 329 | 330 | .nowrap { 331 | white-space: nowrap; 332 | } 333 | 334 | #destination_button.flat-button { 335 | line-height: 14px; 336 | font-size:14px; 337 | padding: 4px 12px; 338 | } 339 | 340 | .tooltipped .tooltip { 341 | z-index: 100; 342 | display: none; 343 | } 344 | 345 | .tooltipped:hover .tooltip { 346 | display: inline; 347 | float: right; 348 | background-color: $popup-bg; 349 | color: $font-color; 350 | font-size: 14px; 351 | padding: 0px 10px; 352 | border: 1px solid $font-color; 353 | position: absolute; 354 | border-radius: 2px; 355 | } 356 | 357 | #format_trigger .tooltip { 358 | width: 360px; 359 | margin-top: -60px; 360 | margin-left: -150px; 361 | padding: 0px 10px; 362 | } 363 | 364 | #out_progress { 365 | position: absolute; 366 | top: 0; 367 | bottom: 0; 368 | left: 0; 369 | right: 0; 370 | background-color: #B6B6B6; 371 | cursor: default; 372 | line-height: $bottombar-size; 373 | display: none; 374 | } 375 | 376 | #out_cancel { 377 | position: absolute; 378 | top: 0; 379 | right: 0; 380 | padding: 4px; 381 | cursor: pointer; 382 | line-height: 24px; 383 | z-index: 11; 384 | } 385 | #out_cancel .fa-remove { 386 | font-size: 24px; 387 | } 388 | 389 | #out_textwrap { 390 | position: absolute; 391 | left: 0; 392 | right: 0; 393 | bottom: 0; 394 | top: 0; 395 | z-index: 10; 396 | } 397 | 398 | #out_progressbar { 399 | position: absolute; 400 | left: 0; 401 | right: 0; 402 | bottom: 0; 403 | height: 0%; 404 | background-color: #00FF00; 405 | z-index: 5; 406 | } 407 | 408 | 409 | .leaflet-container { 410 | background: #000; 411 | } -------------------------------------------------------------------------------- /cmake_modules/FindCEF.cmake: -------------------------------------------------------------------------------- 1 | # Borrowed from: Steven Lamerton 2 | # Find module for the Chromium Embedded Framework 3 | 4 | include(SelectLibraryConfigurations) 5 | include(FindPackageHandleStandardArgs) 6 | 7 | set(CEF_ROOT_DIR "" CACHE PATH "CEF root directory") 8 | 9 | find_path(CEF_INCLUDE_DIR "include/cef_version.h" 10 | HINTS ${CEF_ROOT_DIR}) 11 | 12 | # Find the dll_wrapper 13 | find_library(CEF_WRAPPER_LIBRARY_RELEASE NAMES libcef_dll_wrapper 14 | HINTS "${CEF_ROOT_DIR}" 15 | PATH_SUFFIXES "win/32/release/lib" ${LIBRARY_PATH_SUFFIXES} 16 | ) 17 | 18 | 19 | find_library(CEF_WRAPPER_LIBRARY_DEBUG NAMES libcef_dll_wrapper 20 | HINTS "${CEF_ROOT_DIR}" 21 | PATH_SUFFIXES "win/32/debug/lib" ${LIBRARY_PATH_SUFFIXES} 22 | ) 23 | select_library_configurations(CEF_WRAPPER) 24 | 25 | # Find the cef_sandbox 26 | 27 | find_library(CEF_SANDBOX_LIBRARY_RELEASE NAMES cef_sandbox 28 | HINTS "${CEF_ROOT_DIR}" 29 | PATH_SUFFIXES "win/32/release/lib" ${LIBRARY_PATH_SUFFIXES} 30 | ) 31 | 32 | find_library(CEF_SANDBOX_LIBRARY_DEBUG NAMES cef_sandbox 33 | HINTS "${CEF_ROOT_DIR}" 34 | PATH_SUFFIXES "win/32/debug/lib" ${LIBRARY_PATH_SUFFIXES} 35 | ) 36 | select_library_configurations(CEF_SANDBOX) 37 | 38 | # Find the library itself 39 | find_library(CEF_LIBRARY_RELEASE NAMES libcef 40 | HINTS "${CEF_ROOT_DIR}" 41 | PATH_SUFFIXES "win/32/release/lib" ${LIBRARY_PATH_SUFFIXES} 42 | ) 43 | find_library(CEF_LIBRARY_DEBUG NAMES libcef 44 | HINTS "${CEF_ROOT_DIR}" 45 | PATH_SUFFIXES "win/32/debug/lib" ${LIBRARY_PATH_SUFFIXES} 46 | ) 47 | select_library_configurations(CEF) 48 | 49 | include(FindPackageHandleStandardArgs) 50 | 51 | find_package_handle_standard_args(CEF DEFAULT_MSG 52 | CEF_INCLUDE_DIR) 53 | 54 | mark_as_advanced(CEF_INCLUDE_DIR) -------------------------------------------------------------------------------- /cmake_modules/FindGDAL.cmake: -------------------------------------------------------------------------------- 1 | # Locate gdal 2 | # This module defines 3 | # GDAL_LIBRARY 4 | # GDAL_FOUND, if false, do not try to link to gdal 5 | # GDAL_INCLUDE_DIR, where to find the headers 6 | # 7 | # $GDALDIR is an environment variable that would 8 | # correspond to the ./configure --prefix=$GDAL_DIR 9 | # used in building gdal. 10 | # 11 | # Created by Eric Wing. I'm not a gdal user, but OpenSceneGraph uses it 12 | # for osgTerrain so I whipped this module together for completeness. 13 | # I actually don't know the conventions or where files are typically 14 | # placed in distros. 15 | # Any real gdal users are encouraged to correct this (but please don't 16 | # break the OS X framework stuff when doing so which is what usually seems 17 | # to happen). 18 | 19 | # This makes the presumption that you are include gdal.h like 20 | # #include "gdal.h" 21 | 22 | FIND_PATH(GDAL_INCLUDE_DIR gdal.h 23 | $ENV{GDAL_DIR} 24 | NO_DEFAULT_PATH 25 | PATH_SUFFIXES include 26 | ) 27 | 28 | FIND_PATH(GDAL_INCLUDE_DIR gdal.h 29 | PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. 30 | NO_DEFAULT_PATH 31 | PATH_SUFFIXES include 32 | ) 33 | 34 | FIND_PATH(GDAL_INCLUDE_DIR gdal.h 35 | PATHS 36 | ~/Library/Frameworks/gdal.framework/Headers 37 | /Library/Frameworks/gdal.framework/Headers 38 | /usr/local/include/gdal 39 | /usr/local/include/GDAL 40 | /usr/local/include 41 | /usr/include/gdal 42 | /usr/include/GDAL 43 | /usr/include 44 | /sw/include/gdal 45 | /sw/include/GDAL 46 | /sw/include # Fink 47 | /opt/local/include/gdal 48 | /opt/local/include/GDAL 49 | /opt/local/include # DarwinPorts 50 | /opt/csw/include/gdal 51 | /opt/csw/include/GDAL 52 | /opt/csw/include # Blastwave 53 | /opt/include/gdal 54 | /opt/include/GDAL 55 | /opt/include 56 | c:/Program Files/FWTools2.1.0/include 57 | ) 58 | 59 | FIND_LIBRARY(GDAL_LIBRARY 60 | NAMES gdal gdal_i gdal1.8.0 gdal1.7.0 gdal1.6.0 gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL 61 | PATHS 62 | c:/Program Files/FWTools2.1.0/lib 63 | $ENV{GDAL_DIR} 64 | NO_DEFAULT_PATH 65 | PATH_SUFFIXES lib64 lib 66 | ) 67 | FIND_LIBRARY(GDAL_LIBRARY 68 | NAMES gdal gdal_i gdal1.8.0 gdal1.7.0 gdal1.6.0 gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL 69 | PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. 70 | c:/Program Files/FWTools2.1.0/lib 71 | NO_DEFAULT_PATH 72 | PATH_SUFFIXES lib64 lib 73 | ) 74 | FIND_LIBRARY(GDAL_LIBRARY 75 | NAMES gdal gdal_i gdal1.8.0 gdal1.7.0 gdal1.6.0 gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL 76 | PATHS 77 | ~/Library/Frameworks 78 | /Library/Frameworks 79 | /usr/local 80 | /usr 81 | /sw 82 | /opt/local 83 | /opt/csw 84 | /opt 85 | /usr/freeware 86 | [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;GDAL_ROOT]/lib 87 | PATH_SUFFIXES lib64 lib 88 | ) 89 | 90 | SET(GDAL_FOUND "NO") 91 | IF(GDAL_LIBRARY AND GDAL_INCLUDE_DIR) 92 | SET(GDAL_FOUND "YES") 93 | ENDIF(GDAL_LIBRARY AND GDAL_INCLUDE_DIR) 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /cmake_modules/FindOSG.cmake: -------------------------------------------------------------------------------- 1 | # This module defines 2 | 3 | # OSG_LIBRARY 4 | # OSG_FOUND, if false, do not try to link to osg 5 | # OSG_INCLUDE_DIRS, where to find the headers 6 | # OSG_INCLUDE_DIR, where to find the source headers 7 | # OSG_GEN_INCLUDE_DIR, where to find the generated headers 8 | 9 | # to use this module, set variables to point to the osg build 10 | # directory, and source directory, respectively 11 | # OSGDIR or OSG_SOURCE_DIR: osg source directory, typically OpenSceneGraph 12 | # OSG_DIR or OSG_BUILD_DIR: osg build directory, place in which you've 13 | # built osg via cmake 14 | 15 | # Header files are presumed to be included like 16 | # #include 17 | # #include 18 | 19 | ###### headers ###### 20 | 21 | SET(OSG_DIR "" CACHE PATH "Set to base OpenSceneGraph install path") 22 | 23 | MACRO( FIND_OSG_INCLUDE THIS_OSG_INCLUDE_DIR THIS_OSG_INCLUDE_FILE ) 24 | 25 | FIND_PATH( ${THIS_OSG_INCLUDE_DIR} ${THIS_OSG_INCLUDE_FILE} 26 | PATHS 27 | ${OSG_DIR} 28 | $ENV{OSG_SOURCE_DIR} 29 | $ENV{OSGDIR} 30 | $ENV{OSG_DIR} 31 | /usr/local/ 32 | /usr/ 33 | /sw/ # Fink 34 | /opt/local/ # DarwinPorts 35 | /opt/csw/ # Blastwave 36 | /opt/ 37 | [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/ 38 | ~/Library/Frameworks 39 | /Library/Frameworks 40 | PATH_SUFFIXES 41 | /include/ 42 | ) 43 | 44 | ENDMACRO( FIND_OSG_INCLUDE THIS_OSG_INCLUDE_DIR THIS_OSG_INCLUDE_FILE ) 45 | 46 | FIND_OSG_INCLUDE( OSG_GEN_INCLUDE_DIR osg/Config ) 47 | FIND_OSG_INCLUDE( OSG_INCLUDE_DIR osg/Node ) 48 | 49 | ###### libraries ###### 50 | 51 | MACRO( FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME ) 52 | 53 | FIND_LIBRARY(${MYLIBRARY} 54 | NAMES 55 | ${MYLIBRARYNAME} 56 | PATHS 57 | ${OSG_DIR} 58 | $ENV{OSG_BUILD_DIR} 59 | $ENV{OSG_DIR} 60 | $ENV{OSGDIR} 61 | $ENV{OSG_ROOT} 62 | ~/Library/Frameworks 63 | /Library/Frameworks 64 | /usr/local 65 | /usr 66 | /sw 67 | /opt/local 68 | /opt/csw 69 | /opt 70 | [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib 71 | /usr/freeware 72 | PATH_SUFFIXES 73 | /lib/ 74 | /lib64/ 75 | /build/lib/ 76 | /build/lib64/ 77 | /Build/lib/ 78 | /Build/lib64/ 79 | ) 80 | 81 | ENDMACRO(FIND_OSG_LIBRARY LIBRARY LIBRARYNAME) 82 | 83 | FIND_OSG_LIBRARY( OSG_LIBRARY osg ) 84 | FIND_OSG_LIBRARY( OSG_LIBRARY_DEBUG osgd) 85 | 86 | FIND_OSG_LIBRARY( OSGUTIL_LIBRARY osgUtil ) 87 | FIND_OSG_LIBRARY( OSGUTIL_LIBRARY_DEBUG osgUtild) 88 | 89 | FIND_OSG_LIBRARY( OSGDB_LIBRARY osgDB ) 90 | FIND_OSG_LIBRARY( OSGDB_LIBRARY_DEBUG osgDBd) 91 | 92 | FIND_OSG_LIBRARY( OSGTEXT_LIBRARY osgText ) 93 | FIND_OSG_LIBRARY( OSGTEXT_LIBRARY_DEBUG osgTextd ) 94 | 95 | FIND_OSG_LIBRARY( OSGTERRAIN_LIBRARY osgTerrain ) 96 | FIND_OSG_LIBRARY( OSGTERRAIN_LIBRARY_DEBUG osgTerraind ) 97 | 98 | FIND_OSG_LIBRARY( OSGFX_LIBRARY osgFX ) 99 | FIND_OSG_LIBRARY( OSGFX_LIBRARY_DEBUG osgFXd ) 100 | 101 | FIND_OSG_LIBRARY( OSGSIM_LIBRARY osgSim ) 102 | FIND_OSG_LIBRARY( OSGSIM_LIBRARY_DEBUG osgSimd ) 103 | 104 | FIND_OSG_LIBRARY( OSGVIEWER_LIBRARY osgViewer ) 105 | FIND_OSG_LIBRARY( OSGVIEWER_LIBRARY_DEBUG osgViewerd ) 106 | 107 | FIND_OSG_LIBRARY( OSGGA_LIBRARY osgGA ) 108 | FIND_OSG_LIBRARY( OSGGA_LIBRARY_DEBUG osgGAd ) 109 | 110 | FIND_OSG_LIBRARY( OSGWIDGET_LIBRARY osgWidget ) 111 | FIND_OSG_LIBRARY( OSGWIDGET_LIBRARY_DEBUG osgWidgetd ) 112 | 113 | FIND_OSG_LIBRARY( OSGSHADOW_LIBRARY osgShadow ) 114 | FIND_OSG_LIBRARY( OSGSHADOW_LIBRARY_DEBUG osgShadowd ) 115 | 116 | FIND_OSG_LIBRARY( OSGMANIPULATOR_LIBRARY osgManipulator ) 117 | FIND_OSG_LIBRARY( OSGMANIPULATOR_LIBRARY_DEBUG osgManipulatord ) 118 | 119 | FIND_OSG_LIBRARY( OSGPARTICLE_LIBRARY osgParticle ) 120 | FIND_OSG_LIBRARY( OSGPARTICLE_LIBRARY_DEBUG osgParticled ) 121 | 122 | FIND_OSG_LIBRARY( OSGQT_LIBRARY osgQt ) 123 | FIND_OSG_LIBRARY( OSGQT_LIBRARY_DEBUG osgQtd ) 124 | 125 | FIND_OSG_LIBRARY( OPENTHREADS_LIBRARY OpenThreads ) 126 | FIND_OSG_LIBRARY( OPENTHREADS_LIBRARY_DEBUG OpenThreadsd ) 127 | 128 | SET( OSG_FOUND "NO" ) 129 | IF( OSG_LIBRARY AND OSG_INCLUDE_DIR ) 130 | SET( OSG_FOUND "YES" ) 131 | SET( OSG_INCLUDE_DIRS ${OSG_INCLUDE_DIR} ${OSG_GEN_INCLUDE_DIR} ) 132 | GET_FILENAME_COMPONENT( OSG_LIBRARIES_DIR ${OSG_LIBRARY} PATH ) 133 | ENDIF( OSG_LIBRARY AND OSG_INCLUDE_DIR ) 134 | 135 | 136 | -------------------------------------------------------------------------------- /cmake_modules/FindOSGEARTH.cmake: -------------------------------------------------------------------------------- 1 | 2 | if(APPLE) 3 | SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a) 4 | endif() 5 | 6 | ###### headers ###### 7 | 8 | macro( find_osgearth_include THIS_OSGEARTH_INCLUDE_DIR THIS_OSGEARTH_INCLUDE_FILE ) 9 | 10 | FIND_PATH( ${THIS_OSGEARTH_INCLUDE_DIR} ${THIS_OSGEARTH_INCLUDE_FILE} 11 | PATHS 12 | ${OSGEARTH_DIR} 13 | /usr/local/ 14 | [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSGEARTH_ROOT]/ 15 | ~/Library/Frameworks 16 | /Library/Frameworks 17 | NO_DEFAULT_PATH 18 | PATH_SUFFIXES 19 | ${INCLUDE_PATH_SUFFIXES} 20 | osx/i64/include 21 | ) 22 | 23 | endmacro() 24 | 25 | #find_osgearth_include( OSGEARTH_GEN_INCLUDE_DIR osgEarth/Common ) 26 | find_osgearth_include( OSGEARTH_INCLUDE_DIR osgEarth/TileSource ) 27 | 28 | ###### libraries ###### 29 | 30 | macro( find_osgearth_library MYLIBRARY MYLIBRARYNAME ) 31 | 32 | FIND_LIBRARY(${MYLIBRARY} 33 | NAMES 34 | ${MYLIBRARYNAME} 35 | PATHS 36 | ${OSGEARTH_DIR} 37 | ${OSGEARTH_DIR}/../release 38 | ${OSGEARTH_DIR}/../debug 39 | ~/Library/Frameworks 40 | /Library/Frameworks 41 | /usr/local 42 | /opt/local 43 | [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSGEARTH_ROOT]/lib 44 | PATH_SUFFIXES 45 | ${LIBRARY_PATH_SUFFIXES} 46 | ) 47 | 48 | endmacro() 49 | 50 | if(WIN32) 51 | find_osgearth_library( OSGEARTH_LIBRARY osgEarth ) 52 | find_osgearth_library( OSGEARTH_LIBRARY_DEBUG osgEarthd) 53 | 54 | find_osgearth_library( OSGEARTHUTIL_LIBRARY osgEarthUtil ) 55 | find_osgearth_library( OSGEARTHUTIL_LIBRARY_DEBUG osgEarthUtild) 56 | 57 | find_osgearth_library( OSGEARTHFEATURES_LIBRARY osgEarthFeatures ) 58 | find_osgearth_library( OSGEARTHFEATURES_LIBRARY_DEBUG osgEarthFeaturesd) 59 | 60 | find_osgearth_library( OSGEARTHSYMBOLOGY_LIBRARY osgEarthSymbology ) 61 | find_osgearth_library( OSGEARTHSYMBOLOGY_LIBRARY_DEBUG osgEarthSymbologyd ) 62 | 63 | find_osgearth_library( OSGEARTHANNOTATION_LIBRARY osgEarthAnnotation ) 64 | find_osgearth_library( OSGEARTHANNOTATION_LIBRARY_DEBUG osgEarthAnnotationd ) 65 | endif() 66 | 67 | 68 | set( OSGEARTH_FOUND "NO" ) 69 | if(OSGEARTH_LIBRARY OR OSGEARTH_LIBRARY_DEBUG) 70 | if( OSGEARTH_INCLUDE_DIR ) 71 | set( OSGEARTH_FOUND "YES" ) 72 | # set( OSGEARTH_INCLUDE_DIRS ${OSGEARTH_INCLUDE_DIR} ${OSGEARTH_GEN_INCLUDE_DIR} ) 73 | set( OSGEARTH_INCLUDE_DIRS ${OSGEARTH_INCLUDE_DIR} ) 74 | get_filename_component( OSGEARTH_LIBRARIES_DIR ${OSGEARTH_LIBRARY} PATH ) 75 | endif() 76 | endif() 77 | -------------------------------------------------------------------------------- /js/osgearth.js: -------------------------------------------------------------------------------- 1 | /* ***************************** 2 | * oeutil 3 | * *****************************/ 4 | 5 | (function() { 6 | 7 | // create global oeutil object 8 | this.oeutil = function() { 9 | } 10 | 11 | this.oeutil.extend = function(target, source) { 12 | target = target || {}; 13 | for (var prop in source) { 14 | if (typeof source[prop] === 'object') { 15 | target[prop] = extend(target[prop], source[prop]); 16 | } else { 17 | target[prop] = source[prop]; 18 | } 19 | } 20 | return target; 21 | } 22 | 23 | })(); 24 | 25 | 26 | 27 | /* ***************************** 28 | * osgearth 29 | * *****************************/ 30 | 31 | (function() { 32 | 33 | // private function 34 | function doQuery(request, options) { 35 | var query = { 36 | request: JSON.stringify(request), 37 | persistent: false, 38 | onSuccess: function(response) { }, 39 | onFailure: function(error_code, error_message) { alert("Query error(" + error_code + "): " + error_message); } 40 | }; 41 | oeutil.extend(query, options); 42 | 43 | return window.cefQuery(query); 44 | } 45 | 46 | if (!osgearth) { 47 | osgearth = {}; 48 | } 49 | 50 | this.osgearth.createMap = function(id, x, y, width, height, earthfile, options) { 51 | this.execute("_OE_create_map", { id: id, x: x, y: y, width: width, height: height, file: earthfile }, options); 52 | } 53 | 54 | 55 | this.osgearth.setMap = function(id, x, y, width, height, options) { 56 | this.execute("_OE_set_map", { id: id, x: x, y: y, width: width, height: height }, options); 57 | } 58 | 59 | 60 | this.osgearth.execute = function(command, args, options) { 61 | var request = oeutil.extend({command: command}, args); 62 | return doQuery(request, options); 63 | } 64 | 65 | 66 | this.osgearth.openFileDialog = function(options, multiple, extensions) { 67 | if (multiple === true) { 68 | this.execute("_OE_open_multifile_dialog", { filters: extensions }, options); 69 | } 70 | else { 71 | this.execute("_OE_open_file_dialog", { filters: extensions }, options); 72 | } 73 | } 74 | 75 | this.osgearth.openFolderDialog = function(options) { 76 | this.execute("_OE_open_folder_dialog", { }, options); 77 | } 78 | 79 | })(); 80 | 81 | 82 | /* ***************************** 83 | * Map 84 | * *****************************/ 85 | 86 | function Map(id, x, y, width, height, earthfile, options) { 87 | this._id = id; 88 | osgearth.createMap(id, x, y, width, height, earthfile, options); 89 | } 90 | 91 | Map.prototype._id; 92 | 93 | Map.prototype.loadFile = function(earthfile, options) { 94 | osgearth.execute("_OE_map_load_file", { id: this._id, url: earthfile }, options); 95 | } 96 | 97 | Map.prototype.resize = function(x, y, width, height, options) { 98 | osgearth.setMap(this._id, x, y, width, height, options); 99 | } 100 | 101 | Map.prototype.home = function(options) { 102 | osgearth.execute("_OE_map_home", { id: this._id }, options); 103 | } 104 | 105 | Map.prototype.getImageLayers = function(options) { 106 | osgearth.execute("_OE_get_image_layers", { id: this._id }, options); 107 | } 108 | 109 | Map.prototype.getElevationLayers = function(options) { 110 | osgearth.execute("_OE_get_elevation_layers", { id: this._id }, options); 111 | } 112 | 113 | Map.prototype.getModelLayers = function(options) { 114 | osgearth.execute("_OE_get_model_layers", { id: this._id }, options); 115 | } 116 | 117 | Map.prototype.addModelListener = function(listener) { 118 | osgearth.execute("_OE_add_map_listener", { id: this._id }, { persistent: true, onSuccess: function(response) { listener(response); } }); 119 | } 120 | --------------------------------------------------------------------------------