├── resources ├── gdal │ └── data │ │ ├── epsg.wkt │ │ ├── default.rsc │ │ ├── gdalicon.png │ │ ├── seed_2d.dgn │ │ ├── seed_3d.dgn │ │ ├── s57expectedinput.csv │ │ ├── gcs.override.csv │ │ ├── vertcs.override.csv │ │ ├── jpfgdgml_RdASL.gfs │ │ ├── jpfgdgml_SBBdry.gfs │ │ ├── ozi_ellips.csv │ │ ├── jpfgdgml_SBAPt.gfs │ │ ├── jpfgdgml_AdmBdry.gfs │ │ ├── jpfgdgml_CommBdry.gfs │ │ ├── jpfgdgml_LeveeEdge.gfs │ │ ├── jpfgdgml_RdMgtBdry.gfs │ │ ├── jpfgdgml_RvrMgtBdry.gfs │ │ ├── pcs.override.csv │ │ ├── jpfgdgml_WA.gfs │ │ ├── jpfgdgml_WL.gfs │ │ ├── jpfgdgml_BldA.gfs │ │ ├── jpfgdgml_BldL.gfs │ │ ├── jpfgdgml_Cntr.gfs │ │ ├── jpfgdgml_ElevPt.gfs │ │ ├── jpfgdgml_WStrA.gfs │ │ ├── jpfgdgml_RailCL.gfs │ │ ├── jpfgdgml_SBArea.gfs │ │ ├── jpfgdgml_WStrL.gfs │ │ ├── jpfgdgml_Cstline.gfs │ │ ├── jpfgdgml_RdArea.gfs │ │ ├── gt_ellips.csv │ │ ├── jpfgdgml_AdmPt.gfs │ │ ├── jpfgdgml_CommPt.gfs │ │ ├── jpfgdgml_AdmArea.gfs │ │ ├── jpfgdgml_RdEdg.gfs │ │ ├── jpfgdgml_RdCompt.gfs │ │ ├── jpfgdgml_RdSgmtA.gfs │ │ ├── inspire_cp_CadastralBoundary.gfs │ │ ├── prime_meridian.csv │ │ ├── inspire_cp_BasicPropertyUnit.gfs │ │ ├── inspire_cp_CadastralParcel.gfs │ │ ├── jpfgdgml_GCP.gfs │ │ ├── ruian_vf_st_uvoh_v1.gfs │ │ ├── vdv452.xsd │ │ └── pci_ellips.txt └── proj │ └── data │ ├── proj.db │ ├── GL27 │ ├── proj.ini │ ├── CH │ ├── ITRF2000 │ └── ITRF2014 ├── .gitignore ├── Plugins ├── CMakeLists.txt └── fbx │ ├── CMakeLists.txt │ ├── fbxRCamera.cpp │ ├── WriterCompareTriangle.h │ ├── ReaderWriterFBX.h │ ├── fbxReader.h │ └── fbxMaterialToOsgStateSet.h ├── include ├── spdlog │ ├── fmt │ │ ├── bundled │ │ │ ├── locale.h │ │ │ └── fmt.license.rst │ │ ├── xchar.h │ │ ├── chrono.h │ │ ├── ostr.h │ │ ├── ranges.h │ │ ├── compile.h │ │ └── fmt.h │ ├── details │ │ ├── windows_include.h │ │ ├── console_globals.h │ │ ├── synchronous_factory.h │ │ ├── log_msg_buffer.h │ │ ├── null_mutex.h │ │ ├── log_msg-inl.h │ │ ├── log_msg.h │ │ ├── periodic_worker.h │ │ ├── backtracer.h │ │ ├── periodic_worker-inl.h │ │ ├── log_msg_buffer-inl.h │ │ ├── file_helper.h │ │ ├── backtracer-inl.h │ │ ├── udp_client.h │ │ └── udp_client-windows.h │ ├── version.h │ ├── fwd.h │ ├── formatter.h │ ├── sinks │ │ ├── sink-inl.h │ │ ├── sink.h │ │ ├── basic_file_sink-inl.h │ │ ├── stdout_color_sinks-inl.h │ │ ├── null_sink.h │ │ ├── msvc_sink.h │ │ ├── ostream_sink.h │ │ ├── base_sink.h │ │ ├── stdout_color_sinks.h │ │ ├── base_sink-inl.h │ │ ├── basic_file_sink.h │ │ ├── udp_sink.h │ │ ├── tcp_sink.h │ │ ├── ringbuffer_sink.h │ │ ├── stdout_sinks.h │ │ ├── dist_sink.h │ │ ├── rotating_file_sink.h │ │ ├── wincolor_sink.h │ │ ├── dup_filter_sink.h │ │ └── mongo_sink.h │ ├── cfg │ │ ├── helpers.h │ │ ├── env.h │ │ ├── argv.h │ │ └── helpers-inl.h │ ├── stopwatch.h │ ├── common-inl.h │ ├── async_logger.h │ ├── async_logger-inl.h │ └── spdlog-inl.h └── cgt │ ├── config.h │ ├── config.h.in │ ├── cgtcommon.h │ ├── cgtexception.h │ ├── cgtvisitor.h │ ├── cgttransform.h │ ├── cgtexport.h │ ├── cgtmodel.h │ ├── cgtproj.h │ └── cgtcore.h ├── cgt ├── cgtcommon.cpp ├── CMakeLists.txt ├── cgttransform.cpp ├── cgtvisitor.cpp ├── cgtmodel.cpp └── main.cpp ├── LICENSE ├── CMakeLists.txt └── README.md /resources/gdal/data/epsg.wkt: -------------------------------------------------------------------------------- 1 | include esri_extra.wkt 2 | include cubewerx_extra.wkt 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | cmake-build* 2 | .idea 3 | .vscode 4 | binary 5 | CMakeSettings.json 6 | include/cgt/config.h -------------------------------------------------------------------------------- /resources/proj/data/proj.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scially/cgt/HEAD/resources/proj/data/proj.db -------------------------------------------------------------------------------- /resources/gdal/data/default.rsc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scially/cgt/HEAD/resources/gdal/data/default.rsc -------------------------------------------------------------------------------- /resources/gdal/data/gdalicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scially/cgt/HEAD/resources/gdal/data/gdalicon.png -------------------------------------------------------------------------------- /resources/gdal/data/seed_2d.dgn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scially/cgt/HEAD/resources/gdal/data/seed_2d.dgn -------------------------------------------------------------------------------- /resources/gdal/data/seed_3d.dgn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scially/cgt/HEAD/resources/gdal/data/seed_3d.dgn -------------------------------------------------------------------------------- /resources/gdal/data/s57expectedinput.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scially/cgt/HEAD/resources/gdal/data/s57expectedinput.csv -------------------------------------------------------------------------------- /Plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | if(FBX_FOUND) 4 | include_directories(${FBX_INCLUDE_DIR}) 5 | add_subdirectory(fbx) 6 | endif() -------------------------------------------------------------------------------- /include/spdlog/fmt/bundled/locale.h: -------------------------------------------------------------------------------- 1 | #include "xchar.h" 2 | #warning fmt/locale.h is deprecated, include fmt/format.h or fmt/xchar.h instead 3 | -------------------------------------------------------------------------------- /include/cgt/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | constexpr uint32_t CGT_VERSION_MAJOR = 2; 6 | constexpr uint32_t CGT_VERSION_MINOR = 4; 7 | constexpr const char *CGT_VERSION = "2.4"; 8 | -------------------------------------------------------------------------------- /include/spdlog/details/windows_include.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef NOMINMAX 4 | # define NOMINMAX // prevent windows redefining min/max 5 | #endif 6 | 7 | #ifndef WIN32_LEAN_AND_MEAN 8 | # define WIN32_LEAN_AND_MEAN 9 | #endif 10 | 11 | #include 12 | -------------------------------------------------------------------------------- /include/cgt/config.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | constexpr uint32_t CGT_VERSION_MAJOR = @CGT_VERSION_MAJOR@; 6 | constexpr uint32_t CGT_VERSION_MINOR = @CGT_VERSION_MINOR@; 7 | constexpr const char* CGT_VERSION = "@CGT_VERSION_MAJOR@.@CGT_VERSION_MINOR@"; 8 | -------------------------------------------------------------------------------- /include/spdlog/version.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #define SPDLOG_VER_MAJOR 1 7 | #define SPDLOG_VER_MINOR 10 8 | #define SPDLOG_VER_PATCH 0 9 | 10 | #define SPDLOG_VERSION (SPDLOG_VER_MAJOR * 10000 + SPDLOG_VER_MINOR * 100 + SPDLOG_VER_PATCH) 11 | -------------------------------------------------------------------------------- /include/spdlog/fwd.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | namespace spdlog { 7 | class logger; 8 | class formatter; 9 | 10 | namespace sinks { 11 | class sink; 12 | } 13 | 14 | namespace level { 15 | enum level_enum : int; 16 | } 17 | 18 | } // namespace spdlog 19 | -------------------------------------------------------------------------------- /include/cgt/cgtcommon.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by adminstrator on 2022/9/28. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #if defined(_WIN32) 10 | #define U8TEXT(s) osgDB::convertStringFromCurrentCodePageToUTF8(s) 11 | 12 | #if defined(CGTEXPORT) 13 | #define CGTLIBRARY __declspec(dllexport) 14 | #else 15 | #define CGTLIBRARY __declspec(dllimport) 16 | #endif 17 | #else 18 | #define U8TEXT(s) s 19 | #define CGTLIBRAR 20 | #endif 21 | 22 | 23 | namespace scially { 24 | std::string get_process_filepath(); 25 | } -------------------------------------------------------------------------------- /resources/gdal/data/gcs.override.csv: -------------------------------------------------------------------------------- 1 | "COORD_REF_SYS_CODE","COORD_REF_SYS_NAME","DATUM_CODE","DATUM_NAME","GREENWICH_DATUM","UOM_CODE","ELLIPSOID_CODE","PRIME_MERIDIAN_CODE","SHOW_CRS","DEPRECATED","COORD_SYS_CODE","COORD_OP_CODE","COORD_OP_CODE_MULTI","COORD_OP_METHOD_CODE","DX","DY","DZ","RX","RY","RZ","DS" 2 | # 3 | # NOTICE: The master version of this file is in the libgeotiff subversion at: 4 | # 5 | # https://svn.osgeo.org/metacrs/geotiff/trunk/libgeotiff/csv/gcs.override.csv 6 | # 7 | # Do *not* change other copies without upstreaming the results to libgeotiff. 8 | -------------------------------------------------------------------------------- /include/spdlog/formatter.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | namespace spdlog { 10 | 11 | class formatter 12 | { 13 | public: 14 | virtual ~formatter() = default; 15 | virtual void format(const details::log_msg &msg, memory_buf_t &dest) = 0; 16 | virtual std::unique_ptr clone() const = 0; 17 | }; 18 | } // namespace spdlog 19 | -------------------------------------------------------------------------------- /include/cgt/cgtexception.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | namespace scially { 9 | 10 | class CGTLIBRARY cgt_exception : public std::runtime_error { 11 | public: 12 | cgt_exception(const std::string &err) 13 | : err(err), 14 | std::runtime_error(err.data()) { 15 | 16 | } 17 | 18 | virtual const char *what() const noexcept override { 19 | return err.c_str(); 20 | } 21 | 22 | private: 23 | std::string err; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /include/spdlog/fmt/xchar.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // include bundled or external copy of fmtlib's xchar support 9 | // 10 | 11 | #if !defined(SPDLOG_USE_STD_FORMAT) 12 | # if !defined(SPDLOG_FMT_EXTERNAL) 13 | # ifdef SPDLOG_HEADER_ONLY 14 | # ifndef FMT_HEADER_ONLY 15 | # define FMT_HEADER_ONLY 16 | # endif 17 | # endif 18 | # include 19 | # else 20 | # include 21 | # endif 22 | #endif 23 | -------------------------------------------------------------------------------- /include/spdlog/fmt/chrono.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // include bundled or external copy of fmtlib's chrono support 9 | // 10 | 11 | #if !defined(SPDLOG_USE_STD_FORMAT) 12 | # if !defined(SPDLOG_FMT_EXTERNAL) 13 | # ifdef SPDLOG_HEADER_ONLY 14 | # ifndef FMT_HEADER_ONLY 15 | # define FMT_HEADER_ONLY 16 | # endif 17 | # endif 18 | # include 19 | # else 20 | # include 21 | # endif 22 | #endif 23 | -------------------------------------------------------------------------------- /include/spdlog/fmt/ostr.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // include bundled or external copy of fmtlib's ostream support 9 | // 10 | 11 | #if !defined(SPDLOG_USE_STD_FORMAT) 12 | # if !defined(SPDLOG_FMT_EXTERNAL) 13 | # ifdef SPDLOG_HEADER_ONLY 14 | # ifndef FMT_HEADER_ONLY 15 | # define FMT_HEADER_ONLY 16 | # endif 17 | # endif 18 | # include 19 | # else 20 | # include 21 | # endif 22 | #endif 23 | -------------------------------------------------------------------------------- /include/spdlog/fmt/ranges.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // include bundled or external copy of fmtlib's ranges support 9 | // 10 | 11 | #if !defined(SPDLOG_USE_STD_FORMAT) 12 | # if !defined(SPDLOG_FMT_EXTERNAL) 13 | # ifdef SPDLOG_HEADER_ONLY 14 | # ifndef FMT_HEADER_ONLY 15 | # define FMT_HEADER_ONLY 16 | # endif 17 | # endif 18 | # include 19 | # else 20 | # include 21 | # endif 22 | #endif 23 | -------------------------------------------------------------------------------- /include/spdlog/fmt/compile.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // include bundled or external copy of fmtlib's compile-time support 9 | // 10 | 11 | #if !defined(SPDLOG_USE_STD_FORMAT) 12 | # if !defined(SPDLOG_FMT_EXTERNAL) 13 | # ifdef SPDLOG_HEADER_ONLY 14 | # ifndef FMT_HEADER_ONLY 15 | # define FMT_HEADER_ONLY 16 | # endif 17 | # endif 18 | # include 19 | # else 20 | # include 21 | # endif 22 | #endif 23 | -------------------------------------------------------------------------------- /cgt/cgtcommon.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by adminstrator on 2022/9/28. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | #if defined(_WIN32) 9 | 10 | #include 11 | 12 | #else 13 | #include 14 | #endif 15 | 16 | namespace scially { 17 | namespace fs = std::filesystem; 18 | 19 | std::string get_process_filepath() { 20 | #if defined(_WIN32) 21 | char path[MAX_PATH]; 22 | ::GetModuleFileName(nullptr, path, MAX_PATH); 23 | return path; 24 | #else 25 | char path[1024]; 26 | size_t pathNameSize = readlink("/proc/self/exe", pathName, pathNameCapacity - 1); 27 | pathName[pathNameSize] = '\0'; 28 | return pathNameSize; 29 | #endif 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /cgt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file( 2 | ${PROJECT_SOURCE_DIR}/include/cgt/config.h.in 3 | ${PROJECT_SOURCE_DIR}/include/cgt/config.h) 4 | 5 | add_library(cgtcore SHARED 6 | "cgtcore.cpp" 7 | "cgtmodel.cpp" 8 | "tinyxml2.cpp" 9 | "cgtproj.cpp" 10 | "cgtvisitor.cpp" 11 | "cgttransform.cpp" 12 | "cgtexport.cpp" 13 | "cgtcommon.cpp") 14 | target_link_libraries(cgtcore 15 | ${GDAL_LIBRARIES} 16 | ${OPENSCENEGRAPH_LIBRARIES}) 17 | target_compile_definitions(cgtcore 18 | PRIVATE CGTEXPORT) 19 | 20 | add_executable(cgt 21 | "main.cpp") 22 | target_link_libraries(cgt cgtcore) 23 | 24 | 25 | add_custom_command(TARGET cgt 26 | POST_BUILD 27 | COMMAND ${CMAKE_COMMAND} -E copy_directory "${PROJECT_SOURCE_DIR}/resources" "${EXECUTABLE_OUTPUT_PATH}" 28 | VERBATIM 29 | ) -------------------------------------------------------------------------------- /include/spdlog/details/console_globals.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | namespace spdlog { 10 | namespace details { 11 | 12 | struct console_mutex 13 | { 14 | using mutex_t = std::mutex; 15 | static mutex_t &mutex() 16 | { 17 | static mutex_t s_mutex; 18 | return s_mutex; 19 | } 20 | }; 21 | 22 | struct console_nullmutex 23 | { 24 | using mutex_t = null_mutex; 25 | static mutex_t &mutex() 26 | { 27 | static mutex_t s_mutex; 28 | return s_mutex; 29 | } 30 | }; 31 | } // namespace details 32 | } // namespace spdlog 33 | -------------------------------------------------------------------------------- /include/cgt/cgtvisitor.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by adminstrator on 2022/9/19. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace scially { 11 | class CGTLIBRARY geom_visitor : public osg::NodeVisitor { 12 | public: 13 | geom_visitor(const std::string base_path, const vec3_transform &algorithm) 14 | : base_path_(base_path), algorithm_(algorithm) { 15 | setTraversalMode(TRAVERSE_ALL_CHILDREN); 16 | } 17 | 18 | virtual ~geom_visitor() {} 19 | 20 | virtual void apply(osg::Geode &geode) override; 21 | 22 | virtual void apply(osg::PagedLOD &lod) override; 23 | 24 | private: 25 | vec3_transform algorithm_; 26 | std::string base_path_; 27 | }; 28 | 29 | } -------------------------------------------------------------------------------- /include/cgt/cgttransform.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by adminstrator on 2022/9/19. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace scially { 10 | class CGTLIBRARY osg_transform : public osg_base { 11 | public: 12 | osg_transform(const std::string &source_dir, const std::string &target_dir) 13 | : osg_base(source_dir, target_dir) { 14 | } 15 | 16 | virtual bool root_process(cgt_proj &proj, const std::string &tile_path) override { 17 | return true; 18 | } 19 | 20 | virtual bool tile_process(cgt_proj &proj, const std::string &tile_path) override; 21 | 22 | virtual bool end_process() override { 23 | target_metadata_.write(target_dir_ + "/metadata.xml"); 24 | return true; 25 | } 26 | }; 27 | } -------------------------------------------------------------------------------- /resources/proj/data/GL27: -------------------------------------------------------------------------------- 1 | # SCCSID @(#)GL27 1.1 93/08/25 GIE REL 2 | # Great Lakes Grids 3 | +lastupdate=1993-08-25 4 | # Lake Erie, Ontario and St. Lawrence River. 5 | proj=omerc ellps=clrk66 k_0=0.9999 6 | lonc=78d00'W lat_0=44d00'N alpha=55d40' 7 | x_0=-3950000 y_0=-3430000 8 | no_defs <> 9 | # Lake Huron 10 | proj=omerc ellps=clrk66 k_0=0.9999 11 | lonc=82d00'W lat_0=43d00'N alpha=350d37' 12 | x_0=1200000 y_0=-3500000 13 | no_defs <> 14 | # Lake Michigan 15 | proj=omerc ellps=clrk66 k_0=0.9999 16 | lonc=87d00'W lat_0=44d00'N alpha=15d00' 17 | x_0=-1000000 y_0=-4300000 18 | no_defs <> 19 | # Lake Superior, Lake of the Woods 20 | proj=omerc ellps=clrk66 k_0=0.9999 21 | lonc=88d50'0.256"W lat_0=47d12'21.554"N alpha=285d41'42.593" 22 | x_0=9000000 y_0=-1600000 23 | no_defs <> 24 | -------------------------------------------------------------------------------- /include/spdlog/sinks/sink-inl.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #ifndef SPDLOG_HEADER_ONLY 7 | # include 8 | #endif 9 | 10 | #include 11 | 12 | SPDLOG_INLINE bool spdlog::sinks::sink::should_log(spdlog::level::level_enum msg_level) const 13 | { 14 | return msg_level >= level_.load(std::memory_order_relaxed); 15 | } 16 | 17 | SPDLOG_INLINE void spdlog::sinks::sink::set_level(level::level_enum log_level) 18 | { 19 | level_.store(log_level, std::memory_order_relaxed); 20 | } 21 | 22 | SPDLOG_INLINE spdlog::level::level_enum spdlog::sinks::sink::level() const 23 | { 24 | return static_cast(level_.load(std::memory_order_relaxed)); 25 | } 26 | -------------------------------------------------------------------------------- /include/spdlog/cfg/helpers.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | namespace spdlog { 10 | namespace cfg { 11 | namespace helpers { 12 | // 13 | // Init levels from given string 14 | // 15 | // Examples: 16 | // 17 | // set global level to debug: "debug" 18 | // turn off all logging except for logger1: "off,logger1=debug" 19 | // turn off all logging except for logger1 and logger2: "off,logger1=debug,logger2=info" 20 | // 21 | SPDLOG_API void load_levels(const std::string &txt); 22 | } // namespace helpers 23 | 24 | } // namespace cfg 25 | } // namespace spdlog 26 | 27 | #ifdef SPDLOG_HEADER_ONLY 28 | # include "helpers-inl.h" 29 | #endif // SPDLOG_HEADER_ONLY 30 | -------------------------------------------------------------------------------- /include/spdlog/details/synchronous_factory.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include "registry.h" 7 | 8 | namespace spdlog { 9 | 10 | // Default logger factory- creates synchronous loggers 11 | class logger; 12 | 13 | struct synchronous_factory 14 | { 15 | template 16 | static std::shared_ptr create(std::string logger_name, SinkArgs &&... args) 17 | { 18 | auto sink = std::make_shared(std::forward(args)...); 19 | auto new_logger = std::make_shared(std::move(logger_name), std::move(sink)); 20 | details::registry::instance().initialize_logger(new_logger); 21 | return new_logger; 22 | } 23 | }; 24 | } // namespace spdlog 25 | -------------------------------------------------------------------------------- /cgt/cgttransform.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by adminstrator on 2022/9/19. 3 | // 4 | 5 | #include 6 | 7 | #include 8 | 9 | namespace scially { 10 | namespace fs = std::filesystem; 11 | 12 | bool osg_transform::tile_process(scially::cgt_proj &proj, const std::string &tile_path) { 13 | std::string root_name = get_root_name(tile_path); 14 | std::string data_name = get_data_name(tile_path); 15 | 16 | node_operator tile_processor; 17 | tile_processor.read(tile_path); 18 | std::string base_path = (fs::path(target_dir_) / root_name).string(); 19 | tile_processor.apply(base_path, [&proj](osg::Vec3 vert) { 20 | return proj.transfrom(vert); 21 | }); 22 | 23 | std::string out_dir = (fs::path(target_dir_) / data_name / root_name).string(); 24 | tile_processor.write(out_dir); 25 | return true; 26 | } 27 | } -------------------------------------------------------------------------------- /include/spdlog/fmt/fmt.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016-2018 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // 9 | // Include a bundled header-only copy of fmtlib or an external one. 10 | // By default spdlog include its own copy. 11 | // 12 | 13 | #if defined(SPDLOG_USE_STD_FORMAT) // SPDLOG_USE_STD_FORMAT is defined - use std::format 14 | # include 15 | #elif !defined(SPDLOG_FMT_EXTERNAL) 16 | # if !defined(SPDLOG_COMPILED_LIB) && !defined(FMT_HEADER_ONLY) 17 | # define FMT_HEADER_ONLY 18 | # endif 19 | # ifndef FMT_USE_WINDOWS_H 20 | # define FMT_USE_WINDOWS_H 0 21 | # endif 22 | // enable the 'n' flag in for backward compatibility with fmt 6.x 23 | # define FMT_DEPRECATED_N_SPECIFIER 24 | # include 25 | # include 26 | #else // SPDLOG_FMT_EXTERNAL is defined - use external fmtlib 27 | # include 28 | # include 29 | #endif 30 | -------------------------------------------------------------------------------- /include/spdlog/sinks/sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | namespace spdlog { 10 | 11 | namespace sinks { 12 | class SPDLOG_API sink 13 | { 14 | public: 15 | virtual ~sink() = default; 16 | virtual void log(const details::log_msg &msg) = 0; 17 | virtual void flush() = 0; 18 | virtual void set_pattern(const std::string &pattern) = 0; 19 | virtual void set_formatter(std::unique_ptr sink_formatter) = 0; 20 | 21 | void set_level(level::level_enum log_level); 22 | level::level_enum level() const; 23 | bool should_log(level::level_enum msg_level) const; 24 | 25 | protected: 26 | // sink log level - default is all 27 | level_t level_{level::trace}; 28 | }; 29 | 30 | } // namespace sinks 31 | } // namespace spdlog 32 | 33 | #ifdef SPDLOG_HEADER_ONLY 34 | # include "sink-inl.h" 35 | #endif 36 | -------------------------------------------------------------------------------- /include/spdlog/details/log_msg_buffer.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace spdlog { 9 | namespace details { 10 | 11 | // Extend log_msg with internal buffer to store its payload. 12 | // This is needed since log_msg holds string_views that points to stack data. 13 | 14 | class SPDLOG_API log_msg_buffer : public log_msg 15 | { 16 | memory_buf_t buffer; 17 | void update_string_views(); 18 | 19 | public: 20 | log_msg_buffer() = default; 21 | explicit log_msg_buffer(const log_msg &orig_msg); 22 | log_msg_buffer(const log_msg_buffer &other); 23 | log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT; 24 | log_msg_buffer &operator=(const log_msg_buffer &other); 25 | log_msg_buffer &operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT; 26 | }; 27 | 28 | } // namespace details 29 | } // namespace spdlog 30 | 31 | #ifdef SPDLOG_HEADER_ONLY 32 | # include "log_msg_buffer-inl.h" 33 | #endif 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 cgt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /cgt/cgtvisitor.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by adminstrator on 2022/9/19. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace scially { 9 | void geom_visitor::apply(osg::Geode& geode) { 10 | for(uint32_t i = 0 ; i < geode.getNumDrawables(); i ++){ 11 | osg::Geometry* geom= dynamic_cast(geode.getDrawable(i)); 12 | if(geom == nullptr){ 13 | continue; 14 | } 15 | osg::Vec3Array *vertex = dynamic_cast(geom->getVertexArray()); 16 | if(vertex == nullptr){ 17 | continue; 18 | } 19 | for (size_t i = 0; i < vertex->size(); i++) { 20 | osg::Vec3 vert = algorithm_((*vertex)[i]); 21 | vertex->at(i) = vert; 22 | } 23 | geom->dirtyBound(); 24 | } 25 | traverse(geode); 26 | } 27 | 28 | void geom_visitor::apply(osg::PagedLOD& lod) { 29 | osg::Vec3 vert = algorithm_(lod.getCenter()); 30 | lod.setCenter(vert); 31 | lod.setDatabasePath(base_path_); 32 | traverse(lod); 33 | } 34 | } -------------------------------------------------------------------------------- /include/spdlog/cfg/env.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | #include 6 | #include 7 | #include 8 | 9 | // 10 | // Init levels and patterns from env variables SPDLOG_LEVEL 11 | // Inspired from Rust's "env_logger" crate (https://crates.io/crates/env_logger). 12 | // Note - fallback to "info" level on unrecognized levels 13 | // 14 | // Examples: 15 | // 16 | // set global level to debug: 17 | // export SPDLOG_LEVEL=debug 18 | // 19 | // turn off all logging except for logger1: 20 | // export SPDLOG_LEVEL="*=off,logger1=debug" 21 | // 22 | 23 | // turn off all logging except for logger1 and logger2: 24 | // export SPDLOG_LEVEL="off,logger1=debug,logger2=info" 25 | 26 | namespace spdlog { 27 | namespace cfg { 28 | inline void load_env_levels() 29 | { 30 | auto env_val = details::os::getenv("SPDLOG_LEVEL"); 31 | if (!env_val.empty()) 32 | { 33 | helpers::load_levels(env_val); 34 | } 35 | } 36 | 37 | } // namespace cfg 38 | } // namespace spdlog 39 | -------------------------------------------------------------------------------- /resources/proj/data/proj.ini: -------------------------------------------------------------------------------- 1 | [general] 2 | ; Lines starting by ; are commented lines. 3 | ; 4 | 5 | ; Network capabilities disabled by default. 6 | ; Can be overridden with the PROJ_NETWORK=ON environment variable. 7 | ; network = on 8 | 9 | ; Can be overridden with the PROJ_NETWORK_ENDPOINT environment variable. 10 | cdn_endpoint = https://cdn.proj.org 11 | 12 | cache_enabled = on 13 | 14 | cache_size_MB = 300 15 | 16 | cache_ttl_sec = 86400 17 | 18 | ; Filename of the Certificate Authority (CA) bundle. 19 | ; Can be overriden with the PROJ_CURL_CA_BUNDLE / CURL_CA_BUNDLE environment variable. 20 | ; (added in PROJ 9.0) 21 | ; ca_bundle_path = /path/to/cabundle.pem 22 | 23 | ; Transverse Mercator (and UTM) default algorithm: auto, evenden_snyder or poder_engsager 24 | ; * evenden_snyder is the fastest, but less accurate far from central meridian 25 | ; * poder_engsager is slower, but more accurate far from central meridian 26 | ; * default will auto-select between the two above depending on the coordinate 27 | ; to transform and will use evenden_snyder if the error in doing so is below 28 | ; 0.1 mm (for an ellipsoid of the size of Earth) 29 | tmerc_default_algo = poder_engsager 30 | -------------------------------------------------------------------------------- /resources/gdal/data/vertcs.override.csv: -------------------------------------------------------------------------------- 1 | "COORD_REF_SYS_CODE","COORD_REF_SYS_NAME","DATUM_CODE","DATUM_NAME","UOM_CODE","SHOW_CRS","DEPRECATED","COORD_SYS_CODE","COORD_OP_METHOD_CODE_1","PARM_1_1" 2 | # 3 | # NOTICE: The master version of this file is in the libgeotiff subversion at: 4 | # 5 | # https://svn.osgeo.org/metacrs/geotiff/trunk/libgeotiff/csv/vertcs.override.csv 6 | # 7 | # Do *not* change other copies without upstreaming the results to libgeotiff. 8 | # 9 | # Use the Geoid 2003 files to translated from NAVD88 to WGS84 (approx. NAD83) 10 | # 11 | # 12 | # Updated to default to Geoid12A (11/27/12) hobu 13 | # http://lists.osgeo.org/pipermail/metacrs/2012-November/000649.html 14 | 5703,NAVD88 height,5103,North American Vertical Datum 1988,9001,1,0,6499,9665,"g2012a_conus.gtx,g2012a_alaska.gtx,g2012a_guam.gtx,g2012a_hawaii.gtx,g2012a_puertorico.gtx,g2012a_samoa.gtx" 15 | # 16 | # 17 | # Use the EGM 96 geoid grid for translation from EGM96 to WGS84. 18 | # 19 | 5773,EGM96 geoid height,5171,EGM96 geoid,9001,1,0,6499,9665,egm96_15.gtx 20 | # 21 | # Use the EGM 2008 geoid grid for translation from EGM08 to WGS84. 22 | # 23 | 3855,EGM2008 geoid height,1027,EGM2008 geoid,9001,1,0,6499,9665,egm08_25.gtx 24 | -------------------------------------------------------------------------------- /include/cgt/cgtexport.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by adminstrator on 2022/9/19. 3 | // 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace scially { 14 | class CGTLIBRARY osg_export : public osg_base { 15 | public: 16 | osg_export(const std::string &source_dir, const std::string &target_dir) 17 | : osg_base(source_dir, target_dir) { 18 | 19 | } 20 | 21 | void set_extent(const std::string &shp); 22 | 23 | void set_copy(bool copy) { is_copy_ = copy; } 24 | 25 | virtual bool root_process(cgt_proj &proj, const std::string &tile_path) override; 26 | 27 | virtual bool tile_process(cgt_proj &proj, const std::string &tile_path) override; 28 | 29 | virtual bool end_process() override; 30 | 31 | virtual ~osg_export() {} 32 | 33 | private: 34 | bool is_intersect(const osg::Node &node); 35 | 36 | std::string shpfile_; 37 | std::unique_ptr geometry_; 38 | std::unique_ptr proj_; 39 | std::vector tiles; 40 | bool is_copy_ = true; 41 | }; 42 | } -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | project(CGT VERSION 2.4) 3 | 4 | set(CMAKE_CXX_STANDARD 17) 5 | set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR}/cmake") 6 | set(CMAKE_DEBUG_POSTFIX d) 7 | 8 | include_directories("include") 9 | 10 | if(MSVC) 11 | add_definitions(-DNOMINMAX) 12 | set(EXECUTABLE_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/binary/windows") 13 | set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/binary/windows") 14 | else() 15 | set(EXECUTABLE_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/binary/linux") 16 | set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/binary/linux") 17 | endif() 18 | 19 | if(CMAKE_BUILD_TYPE MATCHES Debug) 20 | set(EXECUTABLE_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}/debug") 21 | set(LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH}/debug") 22 | else() 23 | set(EXECUTABLE_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}/release") 24 | set(LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH}/release") 25 | endif() 26 | 27 | find_package(OpenSceneGraph 28 | REQUIRED COMPONENTS 29 | osgDB 30 | osgAnimation 31 | osgUtil) 32 | 33 | include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}) 34 | 35 | find_package(GDAL REQUIRED) 36 | include_directories(${GDAL_INCLUDE_DIRS}) 37 | add_subdirectory(cgt) -------------------------------------------------------------------------------- /include/spdlog/details/null_mutex.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | // null, no cost dummy "mutex" and dummy "atomic" int 9 | 10 | namespace spdlog { 11 | namespace details { 12 | struct null_mutex 13 | { 14 | void lock() const {} 15 | void unlock() const {} 16 | bool try_lock() const 17 | { 18 | return true; 19 | } 20 | }; 21 | 22 | struct null_atomic_int 23 | { 24 | int value; 25 | null_atomic_int() = default; 26 | 27 | explicit null_atomic_int(int new_value) 28 | : value(new_value) 29 | {} 30 | 31 | int load(std::memory_order = std::memory_order_relaxed) const 32 | { 33 | return value; 34 | } 35 | 36 | void store(int new_value, std::memory_order = std::memory_order_relaxed) 37 | { 38 | value = new_value; 39 | } 40 | 41 | int exchange(int new_value, std::memory_order = std::memory_order_relaxed) 42 | { 43 | std::swap(new_value, value); 44 | return new_value; // return value before the call 45 | } 46 | }; 47 | 48 | } // namespace details 49 | } // namespace spdlog 50 | -------------------------------------------------------------------------------- /resources/proj/data/CH: -------------------------------------------------------------------------------- 1 | # This init file provides definitions for CH1903 and CH1903/LV03 2 | # projections using the distortion grids developed by Swisstopo. 3 | # See: https://shop.swisstopo.admin.ch/en/products/geo_software/GIS_info 4 | # 5 | # You'll need to download the grids separately and put in a directory 6 | # scanned by libproj. Directories may be added to the scan list through 7 | # the PROJ_LIB environment variable 8 | # 9 | # Note that an independent effort was made to derive an usable grid 10 | # from the CH1903->CH1903+ grid initially available from the Swisstopo 11 | # website. You can read about this other effort here: 12 | # http://lists.maptools.org/pipermail/proj/2012-February/006093.html 13 | # It may be of interest because the latter was by some reported as being 14 | # more accurate than the former: 15 | # http://lists.maptools.org/pipermail/proj/2012-February/006119.html 16 | # 17 | # This init file uses the official one 18 | # 19 | +origin=Swisstopo +lastupdate=2012-02-27 20 | # CH1903/LV03 21 | <1903_LV03> +proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +units=m +nadgrids=CHENyx06_ETRS.gsb +no_defs 22 | # CH1903 23 | <1903> +proj=longlat +ellps=bessel +nadgrids=CHENyx06_ETRS.gsb +no_defs <> 24 | -------------------------------------------------------------------------------- /include/cgt/cgtmodel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace scially { 12 | CGTLIBRARY std::vector split(const std::string &str, const std::string &delimiters); 13 | 14 | class CGTLIBRARY osg_modeldata { 15 | public: 16 | void load(const std::string &srs, const std::string &srs_origin); 17 | 18 | void load_from_dir(const std::string &input); 19 | 20 | void load_from_file(const std::string &input); 21 | 22 | void write(const std::string &output); 23 | 24 | std::string srs() const noexcept { return srs_; } 25 | 26 | void set_srs(const std::string &srs) noexcept { srs_ = srs; } 27 | osg::Vec3 origin() const noexcept { return origin_; } 28 | void set_origin(osg::Vec3 origin) noexcept { origin_ = origin;} 29 | 30 | bool is_valid() const noexcept { return !srs_.empty(); } 31 | 32 | private: 33 | osg::Vec3 parse_origin(const std::string& srs_origin) const noexcept; 34 | 35 | // GZ2000 => EPSG:0 36 | // ENU: lat, lnt, h => topocentric 37 | std::string srs_; 38 | osg::Vec3 origin_; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /include/spdlog/details/log_msg-inl.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #ifndef SPDLOG_HEADER_ONLY 7 | # include 8 | #endif 9 | 10 | #include 11 | 12 | namespace spdlog { 13 | namespace details { 14 | 15 | SPDLOG_INLINE log_msg::log_msg(spdlog::log_clock::time_point log_time, spdlog::source_loc loc, string_view_t a_logger_name, 16 | spdlog::level::level_enum lvl, spdlog::string_view_t msg) 17 | : logger_name(a_logger_name) 18 | , level(lvl) 19 | , time(log_time) 20 | #ifndef SPDLOG_NO_THREAD_ID 21 | , thread_id(os::thread_id()) 22 | #endif 23 | , source(loc) 24 | , payload(msg) 25 | {} 26 | 27 | SPDLOG_INLINE log_msg::log_msg( 28 | spdlog::source_loc loc, string_view_t a_logger_name, spdlog::level::level_enum lvl, spdlog::string_view_t msg) 29 | : log_msg(os::now(), loc, a_logger_name, lvl, msg) 30 | {} 31 | 32 | SPDLOG_INLINE log_msg::log_msg(string_view_t a_logger_name, spdlog::level::level_enum lvl, spdlog::string_view_t msg) 33 | : log_msg(os::now(), source_loc{}, a_logger_name, lvl, msg) 34 | {} 35 | 36 | } // namespace details 37 | } // namespace spdlog 38 | -------------------------------------------------------------------------------- /include/spdlog/sinks/basic_file_sink-inl.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #ifndef SPDLOG_HEADER_ONLY 7 | # include 8 | #endif 9 | 10 | #include 11 | #include 12 | 13 | namespace spdlog { 14 | namespace sinks { 15 | 16 | template 17 | SPDLOG_INLINE basic_file_sink::basic_file_sink(const filename_t &filename, bool truncate, const file_event_handlers &event_handlers) 18 | : file_helper_{event_handlers} 19 | { 20 | file_helper_.open(filename, truncate); 21 | } 22 | 23 | template 24 | SPDLOG_INLINE const filename_t &basic_file_sink::filename() const 25 | { 26 | return file_helper_.filename(); 27 | } 28 | 29 | template 30 | SPDLOG_INLINE void basic_file_sink::sink_it_(const details::log_msg &msg) 31 | { 32 | memory_buf_t formatted; 33 | base_sink::formatter_->format(msg, formatted); 34 | file_helper_.write(formatted); 35 | } 36 | 37 | template 38 | SPDLOG_INLINE void basic_file_sink::flush_() 39 | { 40 | file_helper_.flush(); 41 | } 42 | 43 | } // namespace sinks 44 | } // namespace spdlog 45 | -------------------------------------------------------------------------------- /include/spdlog/details/log_msg.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | namespace spdlog { 10 | namespace details { 11 | struct SPDLOG_API log_msg 12 | { 13 | log_msg() = default; 14 | log_msg(log_clock::time_point log_time, source_loc loc, string_view_t logger_name, level::level_enum lvl, string_view_t msg); 15 | log_msg(source_loc loc, string_view_t logger_name, level::level_enum lvl, string_view_t msg); 16 | log_msg(string_view_t logger_name, level::level_enum lvl, string_view_t msg); 17 | log_msg(const log_msg &other) = default; 18 | log_msg &operator=(const log_msg &other) = default; 19 | 20 | string_view_t logger_name; 21 | level::level_enum level{level::off}; 22 | log_clock::time_point time; 23 | size_t thread_id{0}; 24 | 25 | // wrapping the formatted text with color (updated by pattern_formatter). 26 | mutable size_t color_range_start{0}; 27 | mutable size_t color_range_end{0}; 28 | 29 | source_loc source; 30 | string_view_t payload; 31 | }; 32 | } // namespace details 33 | } // namespace spdlog 34 | 35 | #ifdef SPDLOG_HEADER_ONLY 36 | # include "log_msg-inl.h" 37 | #endif 38 | -------------------------------------------------------------------------------- /include/spdlog/details/periodic_worker.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | // periodic worker thread - periodically executes the given callback function. 7 | // 8 | // RAII over the owned thread: 9 | // creates the thread on construction. 10 | // stops and joins the thread on destruction (if the thread is executing a callback, wait for it to finish first). 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | namespace spdlog { 18 | namespace details { 19 | 20 | class SPDLOG_API periodic_worker 21 | { 22 | public: 23 | periodic_worker(const std::function &callback_fun, std::chrono::seconds interval); 24 | periodic_worker(const periodic_worker &) = delete; 25 | periodic_worker &operator=(const periodic_worker &) = delete; 26 | // stop the worker thread and join it 27 | ~periodic_worker(); 28 | 29 | private: 30 | bool active_; 31 | std::thread worker_thread_; 32 | std::mutex mutex_; 33 | std::condition_variable cv_; 34 | }; 35 | } // namespace details 36 | } // namespace spdlog 37 | 38 | #ifdef SPDLOG_HEADER_ONLY 39 | # include "periodic_worker-inl.h" 40 | #endif 41 | -------------------------------------------------------------------------------- /include/spdlog/details/backtracer.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | // Store log messages in circular buffer. 14 | // Useful for storing debug data in case of error/warning happens. 15 | 16 | namespace spdlog { 17 | namespace details { 18 | class SPDLOG_API backtracer 19 | { 20 | mutable std::mutex mutex_; 21 | std::atomic enabled_{false}; 22 | circular_q messages_; 23 | 24 | public: 25 | backtracer() = default; 26 | backtracer(const backtracer &other); 27 | 28 | backtracer(backtracer &&other) SPDLOG_NOEXCEPT; 29 | backtracer &operator=(backtracer other); 30 | 31 | void enable(size_t size); 32 | void disable(); 33 | bool enabled() const; 34 | void push_back(const log_msg &msg); 35 | 36 | // pop all items in the q and apply the given fun on each of them. 37 | void foreach_pop(std::function fun); 38 | }; 39 | 40 | } // namespace details 41 | } // namespace spdlog 42 | 43 | #ifdef SPDLOG_HEADER_ONLY 44 | # include "backtracer-inl.h" 45 | #endif 46 | -------------------------------------------------------------------------------- /include/spdlog/sinks/stdout_color_sinks-inl.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #ifndef SPDLOG_HEADER_ONLY 7 | # include 8 | #endif 9 | 10 | #include 11 | #include 12 | 13 | namespace spdlog { 14 | 15 | template 16 | SPDLOG_INLINE std::shared_ptr stdout_color_mt(const std::string &logger_name, color_mode mode) 17 | { 18 | return Factory::template create(logger_name, mode); 19 | } 20 | 21 | template 22 | SPDLOG_INLINE std::shared_ptr stdout_color_st(const std::string &logger_name, color_mode mode) 23 | { 24 | return Factory::template create(logger_name, mode); 25 | } 26 | 27 | template 28 | SPDLOG_INLINE std::shared_ptr stderr_color_mt(const std::string &logger_name, color_mode mode) 29 | { 30 | return Factory::template create(logger_name, mode); 31 | } 32 | 33 | template 34 | SPDLOG_INLINE std::shared_ptr stderr_color_st(const std::string &logger_name, color_mode mode) 35 | { 36 | return Factory::template create(logger_name, mode); 37 | } 38 | } // namespace spdlog 39 | -------------------------------------------------------------------------------- /include/spdlog/cfg/argv.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | #include 6 | #include 7 | 8 | // 9 | // Init log levels using each argv entry that starts with "SPDLOG_LEVEL=" 10 | // 11 | // set all loggers to debug level: 12 | // example.exe "SPDLOG_LEVEL=debug" 13 | 14 | // set logger1 to trace level 15 | // example.exe "SPDLOG_LEVEL=logger1=trace" 16 | 17 | // turn off all logging except for logger1 and logger2: 18 | // example.exe "SPDLOG_LEVEL=off,logger1=debug,logger2=info" 19 | 20 | namespace spdlog { 21 | namespace cfg { 22 | 23 | // search for SPDLOG_LEVEL= in the args and use it to init the levels 24 | inline void load_argv_levels(int argc, const char **argv) 25 | { 26 | const std::string spdlog_level_prefix = "SPDLOG_LEVEL="; 27 | for (int i = 1; i < argc; i++) 28 | { 29 | std::string arg = argv[i]; 30 | if (arg.find(spdlog_level_prefix) == 0) 31 | { 32 | auto levels_string = arg.substr(spdlog_level_prefix.size()); 33 | helpers::load_levels(levels_string); 34 | } 35 | } 36 | } 37 | 38 | inline void load_argv_levels(int argc, char **argv) 39 | { 40 | load_argv_levels(argc, const_cast(argv)); 41 | } 42 | 43 | } // namespace cfg 44 | } // namespace spdlog 45 | -------------------------------------------------------------------------------- /include/spdlog/sinks/null_sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace spdlog { 13 | namespace sinks { 14 | 15 | template 16 | class null_sink : public base_sink 17 | { 18 | protected: 19 | void sink_it_(const details::log_msg &) override {} 20 | void flush_() override {} 21 | }; 22 | 23 | using null_sink_mt = null_sink; 24 | using null_sink_st = null_sink; 25 | 26 | } // namespace sinks 27 | 28 | template 29 | inline std::shared_ptr null_logger_mt(const std::string &logger_name) 30 | { 31 | auto null_logger = Factory::template create(logger_name); 32 | null_logger->set_level(level::off); 33 | return null_logger; 34 | } 35 | 36 | template 37 | inline std::shared_ptr null_logger_st(const std::string &logger_name) 38 | { 39 | auto null_logger = Factory::template create(logger_name); 40 | null_logger->set_level(level::off); 41 | return null_logger; 42 | } 43 | 44 | } // namespace spdlog 45 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_RdASL.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | RdASL 4 | RdASL 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_SBBdry.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | SBBdry 4 | SBBdry 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /include/spdlog/details/periodic_worker-inl.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #ifndef SPDLOG_HEADER_ONLY 7 | # include 8 | #endif 9 | 10 | namespace spdlog { 11 | namespace details { 12 | 13 | SPDLOG_INLINE periodic_worker::periodic_worker(const std::function &callback_fun, std::chrono::seconds interval) 14 | { 15 | active_ = (interval > std::chrono::seconds::zero()); 16 | if (!active_) 17 | { 18 | return; 19 | } 20 | 21 | worker_thread_ = std::thread([this, callback_fun, interval]() { 22 | for (;;) 23 | { 24 | std::unique_lock lock(this->mutex_); 25 | if (this->cv_.wait_for(lock, interval, [this] { return !this->active_; })) 26 | { 27 | return; // active_ == false, so exit this thread 28 | } 29 | callback_fun(); 30 | } 31 | }); 32 | } 33 | 34 | // stop the worker thread and join it 35 | SPDLOG_INLINE periodic_worker::~periodic_worker() 36 | { 37 | if (worker_thread_.joinable()) 38 | { 39 | { 40 | std::lock_guard lock(mutex_); 41 | active_ = false; 42 | } 43 | cv_.notify_one(); 44 | worker_thread_.join(); 45 | } 46 | } 47 | 48 | } // namespace details 49 | } // namespace spdlog 50 | -------------------------------------------------------------------------------- /include/spdlog/sinks/msvc_sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2016 Alexander Dalshov. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #if defined(_WIN32) 7 | 8 | # include 9 | # include 10 | 11 | # include 12 | # include 13 | 14 | // Avoid including windows.h (https://stackoverflow.com/a/30741042) 15 | extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char *lpOutputString); 16 | 17 | namespace spdlog { 18 | namespace sinks { 19 | /* 20 | * MSVC sink (logging using OutputDebugStringA) 21 | */ 22 | template 23 | class msvc_sink : public base_sink 24 | { 25 | public: 26 | msvc_sink() = default; 27 | 28 | protected: 29 | void sink_it_(const details::log_msg &msg) override 30 | { 31 | memory_buf_t formatted; 32 | base_sink::formatter_->format(msg, formatted); 33 | # ifdef SPDLOG_USE_STD_FORMAT 34 | OutputDebugStringA(formatted.c_str()); 35 | # else 36 | OutputDebugStringA(fmt::to_string(formatted).c_str()); 37 | # endif 38 | } 39 | 40 | void flush_() override {} 41 | }; 42 | 43 | using msvc_sink_mt = msvc_sink; 44 | using msvc_sink_st = msvc_sink; 45 | 46 | using windebug_sink_mt = msvc_sink_mt; 47 | using windebug_sink_st = msvc_sink_st; 48 | 49 | } // namespace sinks 50 | } // namespace spdlog 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/spdlog/sinks/ostream_sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | namespace spdlog { 13 | namespace sinks { 14 | template 15 | class ostream_sink final : public base_sink 16 | { 17 | public: 18 | explicit ostream_sink(std::ostream &os, bool force_flush = false) 19 | : ostream_(os) 20 | , force_flush_(force_flush) 21 | {} 22 | ostream_sink(const ostream_sink &) = delete; 23 | ostream_sink &operator=(const ostream_sink &) = delete; 24 | 25 | protected: 26 | void sink_it_(const details::log_msg &msg) override 27 | { 28 | memory_buf_t formatted; 29 | base_sink::formatter_->format(msg, formatted); 30 | ostream_.write(formatted.data(), static_cast(formatted.size())); 31 | if (force_flush_) 32 | { 33 | ostream_.flush(); 34 | } 35 | } 36 | 37 | void flush_() override 38 | { 39 | ostream_.flush(); 40 | } 41 | 42 | std::ostream &ostream_; 43 | bool force_flush_; 44 | }; 45 | 46 | using ostream_sink_mt = ostream_sink; 47 | using ostream_sink_st = ostream_sink; 48 | 49 | } // namespace sinks 50 | } // namespace spdlog 51 | -------------------------------------------------------------------------------- /resources/gdal/data/ozi_ellips.csv: -------------------------------------------------------------------------------- 1 | ELLIPSOID_CODE,NAME,A,INVF 2 | # 3 | # Note : We have permission from Des Newman on behalf of OziExplorer to use this list. 4 | # See : http://trac.osgeo.org/gdal/ticket/3929#comment:2 5 | # 6 | 0,Airy 1830,6377563.396,299.3249646 7 | 1,Modified Airy,6377340.189,299.3249646 8 | 2,Australian National,6378160.0,298.25 9 | 3,Bessel 1841,6377397.155,299.1528128 10 | 4,Clarke 1866,6378206.4,294.9786982 11 | 5,Clarke 1880,6378249.145,293.465 12 | 6,Everest (India 1830),6377276.345,300.8017 13 | 7,Everest (1948),6377304.063,300.8017 14 | 8,Modified Fischer 1960,6378155.0,298.3 15 | 9,Everest (Pakistan),6377309.613,300.8017 16 | 10,Indonesian 1974,6378160.0,298.247 17 | 11,GRS 80,6378137.0,298.257222101 18 | 12,Helmert 1906,6378200.0,298.3 19 | 13,Hough 1960,6378270.0,297.0 20 | 14,International 1924,6378388.0,297.0 21 | 15,Krassovsky 1940,6378245.0,298.3 22 | 16,South American 1969,6378160.0,298.25 23 | 17,Everest (Malaysia 1969),6377295.664,300.8017 24 | 18,Everest (Sabah Sarawak),6377298.556,300.8017 25 | 19,WGS 72,6378135.0,298.26 26 | 20,WGS 84,6378137.0,298.257223563 27 | 21,Bessel 1841 (Namibia),6377483.865,299.1528128 28 | 22,Everest (India 1956),6377301.243,300.8017 29 | 23,Clarke 1880 Palestine,6378300.789,293.466 30 | 24,Clarke 1880 IGN,6378249.2,293.466021 31 | 25,Hayford 1909,6378388.0,296.959263 32 | 26,Clarke 1858,6378350.87,294.26 33 | 27,Bessel 1841 (Norway),6377492.0176,299.1528 34 | 28,Plessis 1817 (France),6376523.0,308.6409971 35 | 29,Hayford 1924,6378388.0,297.0 36 | -------------------------------------------------------------------------------- /include/spdlog/fmt/bundled/fmt.license.rst: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - present, Victor Zverovich 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | --- Optional exception to the license --- 23 | 24 | As an exception, if, as a result of your compiling your source code, portions 25 | of this Software are embedded into a machine-executable object form of such 26 | source code, you may redistribute such embedded portions in such object form 27 | without including the above copyright and permission notices. 28 | -------------------------------------------------------------------------------- /Plugins/fbx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${FBX_INCLUDE_DIR}) 2 | 3 | SET(TARGET_SRC 4 | fbxRAnimation.cpp 5 | fbxRCamera.cpp 6 | fbxRLight.cpp 7 | fbxRMesh.cpp 8 | fbxRNode.cpp 9 | ReaderWriterFBX.cpp 10 | WriterCompareTriangle.cpp 11 | WriterNodeVisitor.cpp 12 | fbxMaterialToOsgStateSet.cpp 13 | ) 14 | 15 | SET(TARGET_H 16 | fbxMaterialToOsgStateSet.h 17 | fbxReader.h 18 | ReaderWriterFBX.h 19 | WriterCompareTriangle.h 20 | WriterNodeVisitor.h 21 | ) 22 | 23 | IF(CMAKE_COMPILER_IS_GNUCXX) 24 | 25 | SET(CMAKE_CXX_FLAGS "-w") 26 | 27 | ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") 28 | 29 | REMOVE_CXX_FLAG(-pedantic) 30 | REMOVE_CXX_FLAG(-Wall) 31 | REMOVE_CXX_FLAG(-Wunused) 32 | REMOVE_CXX_FLAG(-Wextra) 33 | 34 | ENDIF() 35 | 36 | SET(TARGET_LIBRARIES_VARS FBX_LIBRARY) 37 | IF(WIN32) 38 | OPTION(FBX_SHARED OFF) 39 | IF(FBX_SHARED) 40 | ADD_DEFINITIONS(-DFBXSDK_SHARED) 41 | ENDIF(FBX_SHARED) 42 | SET(TARGET_EXTERNAL_LIBRARIES wininet) 43 | ENDIF(WIN32) 44 | 45 | add_library(osgdb_fbx MODULE ${TARGET_H} ${TARGET_SRC}) 46 | IF(CMAKE_BUILD_TYPE STREQUAL "Debug") 47 | target_link_libraries(osgdb_fbx 48 | ${FBX_LIBRARY_DEBUG} 49 | ${FBX_XML2_LIBRARY_DEBUG} 50 | ${FBX_ZLIB_LIBRARY_DEBUG} 51 | ${OPENSCENEGRAPH_LIBRARIES}) 52 | ELSEIF(CMAKE_BUILD_TYPE STREQUAL "Release") 53 | target_link_libraries(osgdb_fbx 54 | ${FBX_LIBRARY} 55 | ${FBX_XML2_LIBRARY} 56 | ${FBX_ZLIB_LIBRARY} 57 | ${OPENSCENEGRAPH_LIBRARIES}) 58 | ENDIF() 59 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_SBAPt.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | SBAPt 4 | SBAPt 5 | urn:ogc:def:crs:EPSG::6668 6 | pos 7 | Point 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | sbaNo 45 | sbaNo 46 | String 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_AdmBdry.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | AdmBdry 4 | AdmBdry 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_CommBdry.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | CommBdry 4 | CommBdry 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_LeveeEdge.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | LeveeEdge 4 | LeveeEdge 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | name 45 | name 46 | String 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_RdMgtBdry.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | RdMgtBdry 4 | RdMgtBdry 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | name 45 | name 46 | String 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_RvrMgtBdry.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | RvrMgtBdry 4 | RvrMgtBdry 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | name 45 | name 46 | String 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /resources/gdal/data/pcs.override.csv: -------------------------------------------------------------------------------- 1 | "COORD_REF_SYS_CODE","COORD_REF_SYS_NAME","UOM_CODE","SOURCE_GEOGCRS_CODE","COORD_OP_CODE","COORD_OP_METHOD_CODE","SHOW_CRS","DEPRECATED","COORD_SYS_CODE","PARAMETER_CODE_1","PARAMETER_VALUE_1","PARAMETER_UOM_1","PARAMETER_CODE_2","PARAMETER_VALUE_2","PARAMETER_UOM_2","PARAMETER_CODE_3","PARAMETER_VALUE_3","PARAMETER_UOM_3","PARAMETER_CODE_4","PARAMETER_VALUE_4","PARAMETER_UOM_4","PARAMETER_CODE_5","PARAMETER_VALUE_5","PARAMETER_UOM_5","PARAMETER_CODE_6","PARAMETER_VALUE_6","PARAMETER_UOM_6","PARAMETER_CODE_7","PARAMETER_VALUE_7","PARAMETER_UOM_7","DX","DY","DZ","RX","RY","RZ","DS" 2 | # 3 | # NOTICE: The master version of this file is in the libgeotiff subversion at: 4 | # 5 | # https://svn.osgeo.org/metacrs/geotiff/trunk/libgeotiff/csv/pcs.override.csv 6 | # 7 | # Do *not* change other copies without upstreaming the results to libgeotiff. 8 | # 9 | # 10 | # 11 | # Adjust central meridian to be relative to prime meridian. 12 | # 13 | 26591,"Monte Mario (Rome) / Italy zone 1",9001,4806,18121,9807,1,1,4499,8801,0,9102,8802,-3.45233333333333,9102,8805,0.9996,9201,8806,1500000,9001,8807,0,9001,,,,,,,,,,,,, 14 | 26592,"Monte Mario (Rome) / Italy zone 2",9001,4806,18122,9807,1,1,4499,8801,0,9102,8802,2.54766666666666,9102,8805,0.9996,9201,8806,2520000,9001,8807,0,9001,,,,,,,,,,,,, 15 | # 16 | # 26799 is deprecated, because of the error in the false northing. However, 17 | # we "fix" the original to reduce problems folks would otherwise encounter. 18 | # 19 | 26799,"NAD27 / California zone VII",9003,4267,10408,9802,1,0,4497,8821,34.08,9110,8822,-118.2,9110,8823,34.25,9110,8824,33.52,9110,8826,4186692.58,9003,8827,4160926.74,9003,,,,,,,,,, 20 | -------------------------------------------------------------------------------- /Plugins/fbx/fbxRCamera.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #if defined(_MSC_VER) 7 | #pragma warning( disable : 4505 ) 8 | #pragma warning( default : 4996 ) 9 | #endif 10 | #include 11 | 12 | #include "fbxReader.h" 13 | 14 | osgDB::ReaderWriter::ReadResult OsgFbxReader::readFbxCamera(FbxNode* pNode) 15 | { 16 | const FbxCamera* fbxCamera = FbxCast(pNode->GetNodeAttribute()); 17 | 18 | if (!fbxCamera) 19 | { 20 | return osgDB::ReaderWriter::ReadResult::ERROR_IN_READING_FILE; 21 | } 22 | 23 | osg::CameraView* osgCameraView = new osg::CameraView; 24 | 25 | if (fbxCamera->FieldOfView.IsValid()) 26 | { 27 | osgCameraView->setFieldOfView(fbxCamera->FieldOfView.Get()); 28 | } 29 | 30 | if (fbxCamera->FocalLength.IsValid()) 31 | { 32 | osgCameraView->setFocalLength(fbxCamera->FocalLength.Get()); 33 | } 34 | 35 | if (fbxCamera->ApertureMode.IsValid()) 36 | { 37 | switch (fbxCamera->ApertureMode.Get()) 38 | { 39 | case FbxCamera::eHorizontal: 40 | osgCameraView->setFieldOfViewMode(osg::CameraView::HORIZONTAL); 41 | break; 42 | case FbxCamera::eVertical: 43 | osgCameraView->setFieldOfViewMode(osg::CameraView::VERTICAL); 44 | break; 45 | case FbxCamera::eHorizAndVert: 46 | case FbxCamera::eFocalLength: 47 | default: 48 | OSG_WARN << "readFbxCamera: Unsupported Camera aperture mode." << std::endl; 49 | break; 50 | } 51 | } 52 | 53 | return osgDB::ReaderWriter::ReadResult(osgCameraView); 54 | } 55 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_WA.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | WA 4 | WA 5 | urn:ogc:def:crs:EPSG::6668 6 | area 7 | Polygon 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_WL.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | WL 4 | WL 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_BldA.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | BldA 4 | BldA 5 | urn:ogc:def:crs:EPSG::6668 6 | area 7 | Polygon 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_BldL.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | BldL 4 | BldL 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_Cntr.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | Cntr 4 | Cntr 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | alti 50 | alti 51 | Real 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_ElevPt.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ElevPt 4 | ElevPt 5 | urn:ogc:def:crs:EPSG::6668 6 | pos 7 | Point 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | alti 50 | alti 51 | Real 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_WStrA.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | WStrA 4 | WStrA 5 | urn:ogc:def:crs:EPSG::6668 6 | area 7 | Polygon 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_RailCL.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | RailCL 4 | RailCL 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_SBArea.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | SBArea 4 | SBArea 5 | urn:ogc:def:crs:EPSG::6668 6 | area 7 | Polygon 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | sbaNo 50 | sbaNo 51 | String 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_WStrL.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | WStrL 4 | WStrL 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_Cstline.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | Cstline 4 | Cstline 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_RdArea.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | RdArea 4 | RdArea 5 | urn:ogc:def:crs:EPSG::6668 6 | area 7 | Polygon 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | name 45 | name 46 | String 47 | 48 | 49 | admOffice 50 | admOffice 51 | String 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Plugins/fbx/WriterCompareTriangle.h: -------------------------------------------------------------------------------- 1 | #ifndef _3DS_WRITER_COMPARE_TRIANGLE_HEADER__ 2 | #define _3DS_WRITER_COMPARE_TRIANGLE_HEADER__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | struct Triangle 9 | { 10 | unsigned int t1; 11 | unsigned int t2; 12 | unsigned int t3; 13 | unsigned int material; 14 | }; 15 | 16 | class WriterCompareTriangle { 17 | public: 18 | WriterCompareTriangle(const osg::Geode& geode, 19 | unsigned int nbVertices); 20 | 21 | bool operator()(const std::pair& t1, 22 | const std::pair& t2) const; 23 | private: 24 | void // This function prevents the scene being cut into too many boxes 25 | setMaxMin(unsigned int& nbVerticesX, 26 | unsigned int& nbVerticesY, 27 | unsigned int& nbVerticesZ) const; 28 | 29 | /** 30 | * Cut the scene in different box to sort. 31 | * \param nbVertices is the number of vertices in mesh. 32 | * \param sceneBox contain the size of the scene. 33 | */ 34 | void 35 | cutscene(int nbVertices, 36 | const osg::BoundingBox& sceneBox); 37 | 38 | /** 39 | * Find in which box those points are. 40 | * \return the place of the box in the vector. 41 | * \sa See cutScene() about the definition of the boxes for faces sorting. 42 | */ 43 | int inWhichBox(const osg::Vec3::value_type x, 44 | const osg::Vec3::value_type y, 45 | const osg::Vec3::value_type z) const; 46 | 47 | const osg::Geode& geode; 48 | std::vector boxList; 49 | }; 50 | 51 | #endif // _3DS_WRITER_COMPARE_TRIANGLE_HEADER__ 52 | -------------------------------------------------------------------------------- /include/spdlog/sinks/base_sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | // 6 | // base sink templated over a mutex (either dummy or real) 7 | // concrete implementation should override the sink_it_() and flush_() methods. 8 | // locking is taken care of in this class - no locking needed by the 9 | // implementers.. 10 | // 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | namespace spdlog { 17 | namespace sinks { 18 | template 19 | class SPDLOG_API base_sink : public sink 20 | { 21 | public: 22 | base_sink(); 23 | explicit base_sink(std::unique_ptr formatter); 24 | ~base_sink() override = default; 25 | 26 | base_sink(const base_sink &) = delete; 27 | base_sink(base_sink &&) = delete; 28 | 29 | base_sink &operator=(const base_sink &) = delete; 30 | base_sink &operator=(base_sink &&) = delete; 31 | 32 | void log(const details::log_msg &msg) final; 33 | void flush() final; 34 | void set_pattern(const std::string &pattern) final; 35 | void set_formatter(std::unique_ptr sink_formatter) final; 36 | 37 | protected: 38 | // sink formatter 39 | std::unique_ptr formatter_; 40 | Mutex mutex_; 41 | 42 | virtual void sink_it_(const details::log_msg &msg) = 0; 43 | virtual void flush_() = 0; 44 | virtual void set_pattern_(const std::string &pattern); 45 | virtual void set_formatter_(std::unique_ptr sink_formatter); 46 | }; 47 | } // namespace sinks 48 | } // namespace spdlog 49 | 50 | #ifdef SPDLOG_HEADER_ONLY 51 | # include "base_sink-inl.h" 52 | #endif 53 | -------------------------------------------------------------------------------- /resources/gdal/data/gt_ellips.csv: -------------------------------------------------------------------------------- 1 | NAME,CODE,A,B,RF 2 | Airy 1830 ,AA,6377563.396,6356256.9090,299.324964600 3 | Modified Airy ,AM,6377340.189,6356034.4480,299.324964600 4 | Australian National ,AN,6378160.000,6356774.7190,298.250000000 5 | Bessel 1841(Namibia) ,BN,6377483.865,6356165.3830,299.152812800 6 | Bessel 1841 ,BR,6377397.155,6356078.9630,299.152812800 7 | Clarke 1866 ,CC,6378206.400,6356583.8000,294.978698200 8 | Clarke 1880 ,CD,6378249.145,6356514.8700,293.465000000 9 | Everest (India 1830) ,EA,6377276.345,6356075.4130,300.801700000 10 | Everest (E. Malasia, Brunei) ,EB,6377298.556,6356097.5500,300.801700000 11 | Everest 1956 (India) ,EC,6377301.243,6356100.2280,300.801700000 12 | Everest 1969 (West Malasia) ,ED,6377295.664,6356094.6680,300.801700000 13 | Everest 1948(W.Mals. & Sing.) ,EE,6377304.063,6356103.0390,300.801700000 14 | Everest (Pakistan) ,EF,6377309.613,6356109.5710,300.801700000 15 | Mod. Fischer 1960(South Asia) ,FA,6378155.000,6356773.3200,298.300000000 16 | Helmert 1906 ,HE,6378200.000,6356818.1700,298.300000000 17 | Hough 1960 ,HO,6378270.000,6356794.3430,297.000000000 18 | Indonesian 1974 ,ID,6378160.000,6356774.5040,298.247000000 19 | International 1924 ,IN,6378388.000,6356911.9460,297.000000000 20 | Krassovsky 1940 ,KA,6378245.000,6356863.0190,298.300000000 21 | GRS 80 ,RF,6378137.000,6356752.3141,298.257222101 22 | South American 1969 ,SA,6378160.000,6356774.7190,298.250000000 23 | WGS 72 ,WD,6378135.000,6356750.5200,298.260000000 24 | WGS 84 ,WE,6378137.000,6356752.3142,298.257223563 25 | -------------------------------------------------------------------------------- /include/spdlog/sinks/stdout_color_sinks.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #ifdef _WIN32 7 | # include 8 | #else 9 | # include 10 | #endif 11 | 12 | #include 13 | 14 | namespace spdlog { 15 | namespace sinks { 16 | #ifdef _WIN32 17 | using stdout_color_sink_mt = wincolor_stdout_sink_mt; 18 | using stdout_color_sink_st = wincolor_stdout_sink_st; 19 | using stderr_color_sink_mt = wincolor_stderr_sink_mt; 20 | using stderr_color_sink_st = wincolor_stderr_sink_st; 21 | #else 22 | using stdout_color_sink_mt = ansicolor_stdout_sink_mt; 23 | using stdout_color_sink_st = ansicolor_stdout_sink_st; 24 | using stderr_color_sink_mt = ansicolor_stderr_sink_mt; 25 | using stderr_color_sink_st = ansicolor_stderr_sink_st; 26 | #endif 27 | } // namespace sinks 28 | 29 | template 30 | std::shared_ptr stdout_color_mt(const std::string &logger_name, color_mode mode = color_mode::automatic); 31 | 32 | template 33 | std::shared_ptr stdout_color_st(const std::string &logger_name, color_mode mode = color_mode::automatic); 34 | 35 | template 36 | std::shared_ptr stderr_color_mt(const std::string &logger_name, color_mode mode = color_mode::automatic); 37 | 38 | template 39 | std::shared_ptr stderr_color_st(const std::string &logger_name, color_mode mode = color_mode::automatic); 40 | 41 | } // namespace spdlog 42 | 43 | #ifdef SPDLOG_HEADER_ONLY 44 | # include "stdout_color_sinks-inl.h" 45 | #endif 46 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_AdmPt.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | AdmPt 4 | AdmPt 5 | urn:ogc:def:crs:EPSG::6668 6 | pos 7 | Point 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | admCode 55 | admCode 56 | String 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_CommPt.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | CommPt 4 | CommPt 5 | urn:ogc:def:crs:EPSG::6668 6 | pos 7 | Point 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | admCode 55 | admCode 56 | String 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_AdmArea.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | AdmArea 4 | AdmArea 5 | urn:ogc:def:crs:EPSG::6668 6 | area 7 | Polygon 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | admCode 55 | admCode 56 | String 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_RdEdg.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | RdEdg 4 | RdEdg 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | admOffice 55 | admOffice 56 | String 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_RdCompt.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | RdCompt 4 | RdCompt 5 | urn:ogc:def:crs:EPSG::6668 6 | loc 7 | LineString 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | admOffice 55 | admOffice 56 | String 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_RdSgmtA.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | RdSgmtA 4 | RdSgmtA 5 | urn:ogc:def:crs:EPSG::6668 6 | area 7 | Polygon 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | type 45 | type 46 | String 47 | 48 | 49 | name 50 | name 51 | String 52 | 53 | 54 | admOffice 55 | admOffice 56 | String 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /include/spdlog/details/log_msg_buffer-inl.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #ifndef SPDLOG_HEADER_ONLY 7 | # include 8 | #endif 9 | 10 | namespace spdlog { 11 | namespace details { 12 | 13 | SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg &orig_msg) 14 | : log_msg{orig_msg} 15 | { 16 | buffer.append(logger_name.begin(), logger_name.end()); 17 | buffer.append(payload.begin(), payload.end()); 18 | update_string_views(); 19 | } 20 | 21 | SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg_buffer &other) 22 | : log_msg{other} 23 | { 24 | buffer.append(logger_name.begin(), logger_name.end()); 25 | buffer.append(payload.begin(), payload.end()); 26 | update_string_views(); 27 | } 28 | 29 | SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT : log_msg{other}, buffer{std::move(other.buffer)} 30 | { 31 | update_string_views(); 32 | } 33 | 34 | SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(const log_msg_buffer &other) 35 | { 36 | log_msg::operator=(other); 37 | buffer.clear(); 38 | buffer.append(other.buffer.data(), other.buffer.data() + other.buffer.size()); 39 | update_string_views(); 40 | return *this; 41 | } 42 | 43 | SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT 44 | { 45 | log_msg::operator=(other); 46 | buffer = std::move(other.buffer); 47 | update_string_views(); 48 | return *this; 49 | } 50 | 51 | SPDLOG_INLINE void log_msg_buffer::update_string_views() 52 | { 53 | logger_name = string_view_t{buffer.data(), logger_name.size()}; 54 | payload = string_view_t{buffer.data() + logger_name.size(), payload.size()}; 55 | } 56 | 57 | } // namespace details 58 | } // namespace spdlog 59 | -------------------------------------------------------------------------------- /resources/gdal/data/inspire_cp_CadastralBoundary.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | CadastralBoundary 4 | CadastralBoundary 5 | 6 | geometry 7 | LineString 8 | 9 | 10 | beginLifespanVersion 11 | beginLifespanVersion 12 | String 13 | 14 | 15 | endLifespanVersion 16 | endLifespanVersion 17 | String 18 | 19 | 20 | 21 | 22 | estimatedAccuracy 23 | estimatedAccuracy 24 | Real 25 | 26 | 27 | estimatedAccuracy_uom 28 | estimatedAccuracy@uom 29 | String 30 | 31 | 32 | 33 | inspireId_localId 34 | inspireId|Identifier|localId 35 | String 36 | 37 | 38 | inspireId_namespace 39 | inspireId|Identifier|namespace 40 | String 41 | 42 | 43 | 44 | validFrom 45 | validFrom 46 | String 47 | 48 | 49 | validTo 50 | validTo 51 | String 52 | 53 | 54 | 55 | parcel_href 56 | parcel@href 57 | StringList 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /resources/gdal/data/prime_meridian.csv: -------------------------------------------------------------------------------- 1 | prime_meridian_code,prime_meridian_name,greenwich_longitude,uom_code,remarks,information_source,data_source,revision_date,change_id,deprecated 2 | 8901,Greenwich,0,9102,The international reference meridian as defined first by the 1884 International Meridian Conference and later by the Bureau International de l'Heure (BIH) and then the International Earth Rotation Service (IERS).,OGP,IOGP,2016/12/15,1996.290 2016.045,0 3 | 8902,Lisbon,-9.0754862,9110,,"Instituto Geografico e Cadastral; Lisbon",OGP,2014/06/27,1996.290 2014.040,0 4 | 8903,Paris,2.5969213,9105,"Value adopted by IGN (Paris) in 1936. Equivalent to 2°20'14.025"". Preferred by EPSG to earlier value of 2°20'13.95"" (2.596898 grads) used by RGS London.","Institut Geographique National (IGN); Paris",OGP,2008/06/24,2008.045,0 5 | 8904,Bogota,-74.04513,9110,,"Instituto Geografico ""Augustin Cadazzi"" (IGAC); Bogota",OGP,2014/06/27,1996.290 2014.040,0 6 | 8905,Madrid,-3.411658,9110,,,OGP,2014/06/27,1996.290 2014.040,0 7 | 8906,Rome,12.27084,9110,,,OGP,1995/06/02,1996.290,0 8 | 8907,Bern,7.26225,9110,"1895 value. Newer value of 7°26'22.335"" determined in 1938.",Bundesamt für Landestopographie,OGP,2008/06/24,1996.290 2008.045,0 9 | 8908,Jakarta,106.482779,9110,,,OGP,1995/06/02,1996.290,0 10 | 8909,Ferro,-17.4,9110,Used in Austria and former Czechoslovakia.,,OGP,2014/06/27,1996.290 2014.040,0 11 | 8910,Brussels,4.220471,9110,,,OGP,1995/06/02,1996.290,0 12 | 8911,Stockholm,18.03298,9110,,,OGP,1995/06/02,1996.290,0 13 | 8912,Athens,23.4258815,9110,Used in Greece for older mapping based on Hatt projection.,"Topography Department; National Technical University of Athens.",OGP,1997/06/16,,0 14 | 8913,Oslo,10.43225,9110,Formerly known as Kristiania or Christiania.,Statens Kartverk - Geodesidivisjonen,OGP,1999/10/20,,0 15 | 8914,Paris RGS,2.201395,9110,Value replaced by IGN (France) in 1936 - see code 8903. Equivalent to 2.596898 grads.,"Royal Geographic Society, London",OGP,2007/11/01,,0 16 | -------------------------------------------------------------------------------- /include/cgt/cgtproj.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by adminstrator on 2022/9/6. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | namespace scially { 20 | class CGTLIBRARY gdal_init { 21 | public: 22 | gdal_init(); 23 | 24 | private: 25 | std::string gdal_data_; 26 | std::string proj_data_; 27 | }; 28 | 29 | class CGTLIBRARY cgt_proj { 30 | public: 31 | cgt_proj(const osg_modeldata &source_modeldata, const osg_modeldata &target_modeldata); 32 | 33 | osg::Vec3 transfrom(osg::Vec3 vert) const; 34 | 35 | void transform(OGRGeometry *geom) const; 36 | 37 | private: 38 | OGRSpatialReference import(const std::string &srs) const; 39 | 40 | void crs_to_proj(const std::string &source_crs, 41 | std::string &proj_crs, osg::Vec3 &topcenteric, bool &is_topcenteric) const noexcept; 42 | osg::Vec3 pj_transorm(osg::Vec3 vert, bool forward = true) const; 43 | osg::Vec3 pj_transorm(double x, double y, double z, bool forward = true) const; 44 | 45 | osg_modeldata source_metadata_; 46 | osg_modeldata target_metadata_; 47 | 48 | std::function transformer_; 49 | OGRSpatialReference source_srs_; 50 | OGRSpatialReference target_srs_; 51 | osg::Matrixd source_local_to_world_; 52 | osg::Matrixd target_world_to_local_; 53 | osg::EllipsoidModel ellipsoid_; 54 | 55 | bool source_srs_is_topcenteric_ = false; 56 | bool target_srs_is_topcenteric_ = false; 57 | osg::Vec3 source_topcenteric_; 58 | osg::Vec3 target_topcenteric_; 59 | std::unique_ptr transform_srs_; 60 | }; 61 | } -------------------------------------------------------------------------------- /include/spdlog/stopwatch.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | // Stopwatch support for spdlog (using std::chrono::steady_clock). 9 | // Displays elapsed seconds since construction as double. 10 | // 11 | // Usage: 12 | // 13 | // spdlog::stopwatch sw; 14 | // ... 15 | // spdlog::debug("Elapsed: {} seconds", sw); => "Elapsed 0.005116733 seconds" 16 | // spdlog::info("Elapsed: {:.6} seconds", sw); => "Elapsed 0.005163 seconds" 17 | // 18 | // 19 | // If other units are needed (e.g. millis instead of double), include "fmt/chrono.h" and use "duration_cast<..>(sw.elapsed())": 20 | // 21 | // #include 22 | //.. 23 | // using std::chrono::duration_cast; 24 | // using std::chrono::milliseconds; 25 | // spdlog::info("Elapsed {}", duration_cast(sw.elapsed())); => "Elapsed 5ms" 26 | 27 | namespace spdlog { 28 | class stopwatch 29 | { 30 | using clock = std::chrono::steady_clock; 31 | std::chrono::time_point start_tp_; 32 | 33 | public: 34 | stopwatch() 35 | : start_tp_{clock::now()} 36 | {} 37 | 38 | std::chrono::duration elapsed() const 39 | { 40 | return std::chrono::duration(clock::now() - start_tp_); 41 | } 42 | 43 | void reset() 44 | { 45 | start_tp_ = clock::now(); 46 | } 47 | }; 48 | } // namespace spdlog 49 | 50 | // Support for fmt formatting (e.g. "{:012.9}" or just "{}") 51 | namespace 52 | #ifdef SPDLOG_USE_STD_FORMAT 53 | std 54 | #else 55 | fmt 56 | #endif 57 | { 58 | 59 | template<> 60 | struct formatter : formatter 61 | { 62 | template 63 | auto format(const spdlog::stopwatch &sw, FormatContext &ctx) -> decltype(ctx.out()) 64 | { 65 | return formatter::format(sw.elapsed().count(), ctx); 66 | } 67 | }; 68 | } // namespace std 69 | -------------------------------------------------------------------------------- /resources/gdal/data/inspire_cp_BasicPropertyUnit.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | BasicPropertyUnit 4 | BasicPropertyUnit 5 | None 6 | 7 | inspireId_localId 8 | inspireId|Identifier|localId 9 | String 10 | 11 | 12 | inspireId_namespace 13 | inspireId|Identifier|namespace 14 | String 15 | 16 | 17 | nationalCadastralReference 18 | nationalCadastralReference 19 | String 20 | 21 | 22 | areaValue 23 | areaValue 24 | Real 25 | 26 | 27 | areaValue_uom 28 | areaValue@uom 29 | String 30 | 31 | 32 | validFrom 33 | validFrom 34 | String 35 | 36 | 37 | validTo 38 | validTo 39 | String 40 | 41 | 42 | beginLifespanVersion 43 | beginLifespanVersion 44 | String 45 | 46 | 47 | endLifespanVersion 48 | endLifespanVersion 49 | String 50 | 51 | 52 | administrativeUnit_href 53 | administrativeUnit@href 54 | String 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /include/spdlog/details/file_helper.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | namespace spdlog { 10 | namespace details { 11 | 12 | // Helper class for file sinks. 13 | // When failing to open a file, retry several times(5) with a delay interval(10 ms). 14 | // Throw spdlog_ex exception on errors. 15 | 16 | class SPDLOG_API file_helper 17 | { 18 | public: 19 | file_helper() = default; 20 | explicit file_helper(const file_event_handlers &event_handlers); 21 | 22 | file_helper(const file_helper &) = delete; 23 | file_helper &operator=(const file_helper &) = delete; 24 | ~file_helper(); 25 | 26 | void open(const filename_t &fname, bool truncate = false); 27 | void reopen(bool truncate); 28 | void flush(); 29 | void close(); 30 | void write(const memory_buf_t &buf); 31 | size_t size() const; 32 | const filename_t &filename() const; 33 | 34 | // 35 | // return file path and its extension: 36 | // 37 | // "mylog.txt" => ("mylog", ".txt") 38 | // "mylog" => ("mylog", "") 39 | // "mylog." => ("mylog.", "") 40 | // "/dir1/dir2/mylog.txt" => ("/dir1/dir2/mylog", ".txt") 41 | // 42 | // the starting dot in filenames is ignored (hidden files): 43 | // 44 | // ".mylog" => (".mylog". "") 45 | // "my_folder/.mylog" => ("my_folder/.mylog", "") 46 | // "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt") 47 | static std::tuple split_by_extension(const filename_t &fname); 48 | 49 | private: 50 | const int open_tries_ = 5; 51 | const unsigned int open_interval_ = 10; 52 | std::FILE *fd_{nullptr}; 53 | filename_t filename_; 54 | file_event_handlers event_handlers_; 55 | }; 56 | } // namespace details 57 | } // namespace spdlog 58 | 59 | #ifdef SPDLOG_HEADER_ONLY 60 | # include "file_helper-inl.h" 61 | #endif 62 | -------------------------------------------------------------------------------- /include/spdlog/sinks/base_sink-inl.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #ifndef SPDLOG_HEADER_ONLY 7 | # include 8 | #endif 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | template 16 | SPDLOG_INLINE spdlog::sinks::base_sink::base_sink() 17 | : formatter_{details::make_unique()} 18 | {} 19 | 20 | template 21 | SPDLOG_INLINE spdlog::sinks::base_sink::base_sink(std::unique_ptr formatter) 22 | : formatter_{std::move(formatter)} 23 | {} 24 | 25 | template 26 | void SPDLOG_INLINE spdlog::sinks::base_sink::log(const details::log_msg &msg) 27 | { 28 | std::lock_guard lock(mutex_); 29 | sink_it_(msg); 30 | } 31 | 32 | template 33 | void SPDLOG_INLINE spdlog::sinks::base_sink::flush() 34 | { 35 | std::lock_guard lock(mutex_); 36 | flush_(); 37 | } 38 | 39 | template 40 | void SPDLOG_INLINE spdlog::sinks::base_sink::set_pattern(const std::string &pattern) 41 | { 42 | std::lock_guard lock(mutex_); 43 | set_pattern_(pattern); 44 | } 45 | 46 | template 47 | void SPDLOG_INLINE spdlog::sinks::base_sink::set_formatter(std::unique_ptr sink_formatter) 48 | { 49 | std::lock_guard lock(mutex_); 50 | set_formatter_(std::move(sink_formatter)); 51 | } 52 | 53 | template 54 | void SPDLOG_INLINE spdlog::sinks::base_sink::set_pattern_(const std::string &pattern) 55 | { 56 | set_formatter_(details::make_unique(pattern)); 57 | } 58 | 59 | template 60 | void SPDLOG_INLINE spdlog::sinks::base_sink::set_formatter_(std::unique_ptr sink_formatter) 61 | { 62 | formatter_ = std::move(sink_formatter); 63 | } 64 | -------------------------------------------------------------------------------- /include/spdlog/sinks/basic_file_sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | namespace spdlog { 15 | namespace sinks { 16 | /* 17 | * Trivial file sink with single file as target 18 | */ 19 | template 20 | class basic_file_sink final : public base_sink 21 | { 22 | public: 23 | explicit basic_file_sink(const filename_t &filename, bool truncate = false, const file_event_handlers &event_handlers = {}); 24 | const filename_t &filename() const; 25 | 26 | protected: 27 | void sink_it_(const details::log_msg &msg) override; 28 | void flush_() override; 29 | 30 | private: 31 | details::file_helper file_helper_; 32 | }; 33 | 34 | using basic_file_sink_mt = basic_file_sink; 35 | using basic_file_sink_st = basic_file_sink; 36 | 37 | } // namespace sinks 38 | 39 | // 40 | // factory functions 41 | // 42 | template 43 | inline std::shared_ptr basic_logger_mt( 44 | const std::string &logger_name, const filename_t &filename, bool truncate = false, const file_event_handlers &event_handlers = {}) 45 | { 46 | return Factory::template create(logger_name, filename, truncate, event_handlers); 47 | } 48 | 49 | template 50 | inline std::shared_ptr basic_logger_st( 51 | const std::string &logger_name, const filename_t &filename, bool truncate = false, const file_event_handlers &event_handlers = {}) 52 | { 53 | return Factory::template create(logger_name, filename, truncate, event_handlers); 54 | } 55 | 56 | } // namespace spdlog 57 | 58 | #ifdef SPDLOG_HEADER_ONLY 59 | # include "basic_file_sink-inl.h" 60 | #endif 61 | -------------------------------------------------------------------------------- /include/cgt/cgtcore.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by adminstrator on 2022/6/1. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | namespace scially { 21 | using vec3_transform = std::function; 22 | 23 | class CGTLIBRARY node_operator { 24 | public: 25 | void read(const std::string &path); 26 | 27 | void write(const std::string &dir); 28 | 29 | void apply(const std::string &base_path, const vec3_transform &); 30 | 31 | private: 32 | osg::ref_ptr node_; 33 | std::string node_name_; 34 | }; 35 | 36 | class CGTLIBRARY osg_base { 37 | public: 38 | static constexpr double DOUBLE_EPS = 1e-5; 39 | 40 | osg_base(const std::string &source_dir, const std::string &target_dir) : 41 | source_dir_(source_dir), target_dir_(target_dir) { 42 | 43 | } 44 | 45 | virtual ~osg_base() {} 46 | 47 | static std::string get_root_name(const std::string &tile_path); 48 | 49 | static std::string get_data_name(const std::string &tile_path); 50 | 51 | void set_source_metadata(const osg_modeldata &modeldata) { source_metadata_ = modeldata; } 52 | 53 | void set_target_metadata(const osg_modeldata &modeldata) { target_metadata_ = modeldata; } 54 | 55 | void run(uint32_t max_thread = 0); 56 | 57 | virtual bool root_process(cgt_proj &proj, const std::string &tile_path) = 0; 58 | 59 | virtual bool tile_process(cgt_proj &proj, const std::string &tile_path) = 0; 60 | 61 | virtual bool end_process() { return true; } 62 | 63 | protected: 64 | osg::BoundingBox detect_target_metadata(); 65 | 66 | protected: 67 | std::string source_dir_; 68 | std::string target_dir_; 69 | osg_modeldata source_metadata_; 70 | osg_modeldata target_metadata_; 71 | }; 72 | } 73 | -------------------------------------------------------------------------------- /include/spdlog/sinks/udp_sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #ifdef _WIN32 10 | # include 11 | #else 12 | # include 13 | #endif 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | // Simple udp client sink 21 | // Sends formatted log via udp 22 | 23 | namespace spdlog { 24 | namespace sinks { 25 | 26 | struct udp_sink_config 27 | { 28 | std::string server_host; 29 | uint16_t server_port; 30 | 31 | udp_sink_config(std::string host, uint16_t port) 32 | : server_host{std::move(host)} 33 | , server_port{port} 34 | {} 35 | }; 36 | 37 | template 38 | class udp_sink : public spdlog::sinks::base_sink 39 | { 40 | public: 41 | // host can be hostname or ip address 42 | explicit udp_sink(udp_sink_config sink_config) 43 | : client_{sink_config.server_host, sink_config.server_port} 44 | {} 45 | 46 | ~udp_sink() override = default; 47 | 48 | protected: 49 | void sink_it_(const spdlog::details::log_msg &msg) override 50 | { 51 | spdlog::memory_buf_t formatted; 52 | spdlog::sinks::base_sink::formatter_->format(msg, formatted); 53 | client_.send(formatted.data(), formatted.size()); 54 | } 55 | 56 | void flush_() override {} 57 | details::udp_client client_; 58 | }; 59 | 60 | using udp_sink_mt = udp_sink; 61 | using udp_sink_st = udp_sink; 62 | 63 | } // namespace sinks 64 | 65 | // 66 | // factory functions 67 | // 68 | template 69 | inline std::shared_ptr udp_logger_mt(const std::string &logger_name, sinks::udp_sink_config skin_config) 70 | { 71 | return Factory::template create(logger_name, skin_config); 72 | } 73 | 74 | } // namespace spdlog 75 | -------------------------------------------------------------------------------- /resources/proj/data/ITRF2000: -------------------------------------------------------------------------------- 1 | # ITRF2000 params are in cm/year, PJ_helmert uses m/year 2 | +version=1.0.0 +origin=ftp://itrf.ensg.ign.fr/pub/itrf/ITRF.TP +lastupdate=2017-07-25 3 | 4 | # ITRF2000 -> ITRF2005 is only defined the opposite way, so we flip the sign on all 5 | # parameters to get the opposite transformation. Parameters from http://itrf.ign.fr/ITRF_solutions/2005/tp_05-00.php 6 | +proj=helmert +x=-0.0001 +y=0.0008 +z=0.0058 +s=-0.0004 +dx=0.0002 +dy=-0.0001 +dz=0.0018 +ds=-0.00008 +t_epoch=2000.0 +convention=position_vector 7 | 8 | +proj=helmert +x=0.0067 +y=0.0061 +z=-0.0185 +s=0.00155 +dy=-0.0006 +dz=-0.0014 +ds=0.00001 +drz=0.00002 +t_epoch=1997.0 +convention=position_vector 9 | 10 | +proj=helmert +x=0.0067 +y=0.0061 +z=-0.0185 +s=0.00155 +dy=-0.0006 +dz=-0.0014 +ds=0.00001 +drz=0.00002 +t_epoch=1997.0 +convention=position_vector 11 | 12 | +proj=helmert +x=0.0067 +y=0.0061 +z=-0.0185 +s=0.00155 +dy=-0.0006 +dz=-0.0014 +ds=0.00001 +drz=0.00002 +t_epoch=1997.0 +convention=position_vector 13 | 14 | +proj=helmert +x=0.0127 +y=0.0065 +z=-0.0209 +s=0.00195 +rx=-0.00039 +ry=0.00080 +rz=-0.00114 +dx=-0.0029 +dy=-0.0002 +dz=-0.0006 +ds=0.00001 +drx=-0.00011 +dry=-0.00019 +drz=0.00007 +t_epoch=1988.0 +convention=position_vector 15 | 16 | +proj=helmert +x=0.0147 +y=0.0135 +z=-0.0139 +s=0.00075 +rz=-0.00018 +dy=-0.0006 +dz=-0.0014 +ds=0.00001 +drz=0.00002 +t_epoch=1988.0 +convention=position_vector 17 | 18 | +proj=helmert +x=0.0267 +y=0.0275 +z=-0.0199 +s=0.00215 +rz=-0.00018 +dy=-0.0006 +dz=-0.0014 +ds=0.00001 +drz=0.00002 +t_epoch=1988.0 +convention=position_vector 19 | 20 | +proj=helmert +x=0.0247 +y=0.0235 +z=-0.0359 +s=0.00245 +rz=-0.00018 +dy=-0.0006 +dz=-0.0014 +ds=0.00001 +drz=0.00002 +t_epoch=1988.0 +convention=position_vector 21 | 22 | +proj=helmert +x=0.0297 +y=0.0475 +z=-0.0739 +s=0.00585 +rz=-0.00018 +dy=-0.0006 +dz=-0.0014 +ds=0.00001 +drz=0.00002 +t_epoch=1988.0 +convention=position_vector 23 | 24 | +proj=helmert +x=0.0247 +y=0.0115 +z=-0.0979 +s=0.00895 +rx=0.0001 +rz=-0.00018 +dy=-0.0006 +dz=-0.0014 +ds=0.00001 +drz=0.00002 +t_epoch=1988.0 +convention=position_vector 25 | -------------------------------------------------------------------------------- /Plugins/fbx/ReaderWriterFBX.h: -------------------------------------------------------------------------------- 1 | #ifndef READERWRITERFBX_H 2 | #define READERWRITERFBX_H 3 | 4 | #include 5 | #include 6 | 7 | 8 | /////////////////////////////////////////////////////////////////////////// 9 | // OSG reader plugin for the ".fbx" format. 10 | // See http://www.autodesk.com/fbx 11 | // This plugin requires the FBX SDK version 2013.3 or 2014.1 or later 12 | 13 | #if FBXSDK_VERSION_MAJOR < 2013 || (FBXSDK_VERSION_MAJOR == 2013 && FBXSDK_VERSION_MINOR < 3) 14 | #error Wrong FBX SDK version 15 | #endif 16 | 17 | class ReaderWriterFBX : public osgDB::ReaderWriter 18 | { 19 | public: 20 | ReaderWriterFBX() 21 | { 22 | supportsExtension("fbx", "FBX format"); 23 | supportsOption("Embedded", "(Write option) Embed textures in FBX file"); 24 | supportsOption("UseFbxRoot", "(Read/write option) If the source OSG root node is a simple group with no stateset, the writer will put its children directly under the FBX root, and vice-versa for reading"); 25 | supportsOption("LightmapTextures", "(Read option) Interpret texture maps as overriding the lighting. 3D Studio Max may export files that should be interpreted in this way."); 26 | supportsOption("TessellatePolygons", "(Read option) Tessellate mesh polygons. If the model contains concave polygons this may be necessary, however tessellating can be very slow and may erroneously produce triangle shards."); 27 | } 28 | 29 | const char* className() const { return "FBX reader/writer"; } 30 | 31 | virtual ReadResult readObject(const std::string& filename, const Options* options) const 32 | { 33 | return readNode(filename, options); 34 | } 35 | 36 | virtual WriteResult writeObject(const osg::Node& node, const std::string& filename, const Options* options) const 37 | { 38 | return writeNode(node, filename, options); 39 | } 40 | 41 | virtual ReadResult readNode(const std::string& filename, const Options*) const; 42 | virtual WriteResult writeNode(const osg::Node&, const std::string& filename, const Options*) const; 43 | }; 44 | 45 | /////////////////////////////////////////////////////////////////////////// 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /include/spdlog/details/backtracer-inl.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #ifndef SPDLOG_HEADER_ONLY 7 | # include 8 | #endif 9 | namespace spdlog { 10 | namespace details { 11 | SPDLOG_INLINE backtracer::backtracer(const backtracer &other) 12 | { 13 | std::lock_guard lock(other.mutex_); 14 | enabled_ = other.enabled(); 15 | messages_ = other.messages_; 16 | } 17 | 18 | SPDLOG_INLINE backtracer::backtracer(backtracer &&other) SPDLOG_NOEXCEPT 19 | { 20 | std::lock_guard lock(other.mutex_); 21 | enabled_ = other.enabled(); 22 | messages_ = std::move(other.messages_); 23 | } 24 | 25 | SPDLOG_INLINE backtracer &backtracer::operator=(backtracer other) 26 | { 27 | std::lock_guard lock(mutex_); 28 | enabled_ = other.enabled(); 29 | messages_ = std::move(other.messages_); 30 | return *this; 31 | } 32 | 33 | SPDLOG_INLINE void backtracer::enable(size_t size) 34 | { 35 | std::lock_guard lock{mutex_}; 36 | enabled_.store(true, std::memory_order_relaxed); 37 | messages_ = circular_q{size}; 38 | } 39 | 40 | SPDLOG_INLINE void backtracer::disable() 41 | { 42 | std::lock_guard lock{mutex_}; 43 | enabled_.store(false, std::memory_order_relaxed); 44 | } 45 | 46 | SPDLOG_INLINE bool backtracer::enabled() const 47 | { 48 | return enabled_.load(std::memory_order_relaxed); 49 | } 50 | 51 | SPDLOG_INLINE void backtracer::push_back(const log_msg &msg) 52 | { 53 | std::lock_guard lock{mutex_}; 54 | messages_.push_back(log_msg_buffer{msg}); 55 | } 56 | 57 | // pop all items in the q and apply the given fun on each of them. 58 | SPDLOG_INLINE void backtracer::foreach_pop(std::function fun) 59 | { 60 | std::lock_guard lock{mutex_}; 61 | while (!messages_.empty()) 62 | { 63 | auto &front_msg = messages_.front(); 64 | fun(front_msg); 65 | messages_.pop_front(); 66 | } 67 | } 68 | } // namespace details 69 | } // namespace spdlog 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 简介 2 | 倾斜常用工具集 3 | 1. 支持投影坐标系以及WGS84之间坐标转换。 4 | 2. 支持根据矢量范围线导出对应瓦片。 5 | 3. 6 | 百度网盘下载地址: [https://pan.baidu.com/s/1wfpVE4SuvUKW-ceSdaLDdA?pwd=7np4](https://pan.baidu.com/s/1wfpVE4SuvUKW-ceSdaLDdA?pwd=7np4) 7 | 8 | # 用法说明 9 | 10 | ## 命令行参数说明 11 | ### 基本命令 12 | ```sh 13 | Usage: cgt [OPTIONS] SUBCOMMAND 14 | 15 | Options: 16 | -h,--help Print this help message and exit 17 | -v,--version Display program version information and exit 18 | -i,--in TEXT:DIR REQUIRED osg Data path 19 | -o,--out TEXT:DIR REQUIRED output location 20 | --source-srs TEXT source srs 21 | --source-origin TEXT source srs origin (default: 0,0,0) 22 | -t,--thread UINT thread 23 | 24 | Subcommands: 25 | transform coordinate transform 26 | export export osgb data 27 | 28 | 如果没有设置source-srs,source-origin选项,cgt默认会在输入根目录下寻找metadata.xml,支持中文路径 29 | ``` 30 | ### transform 31 | ```shell 32 | cgt [options] transform 33 | Options: 34 | --target-srs TEXT REQUIRED target srs 35 | --target-origin TEXT target srs origin(default: 0,0,0) 36 | ``` 37 | 38 | ### export 39 | 40 | ```shell 41 | cgt [options] export 42 | Options: 43 | --shapefile TEXT:FILE REQUIRED export extent 44 | -c,--copy BOOLEAN copy tile(default: true) 45 | 默认会在范围线的Tile拷贝的out路径下,通过设置 -c false 取消拷贝,只输出符合要求的瓦片名 46 | ``` 47 | ## 示例命令 48 | 49 | ```sh 50 | # 坐标转换 51 | cgt.exe -i {DATA} -o ${OUT_DIR} transform --target-srs EPSG:4547 --target-origin 435924,2390062,0 52 | # 导出倾斜 53 | cgt.exe -i {DATA} -o ${OUT_DIR} export --shapefile {shp, geojson} 54 | ``` 55 | 56 | # 数据要求及说明 57 | 58 | ### 倾斜摄影数据 59 | 60 | 倾斜摄影数据仅支持 smart3d 格式的 osgb 组织方式: 61 | 62 | - 根目录下可以有多个Data文件夹,比如Data1,Data2等 63 | - 最多有一个metadata.xml文件,且必须放在根目录下 64 | - 每个瓦片目录下,必须有个和目录名同名的 osgb 文件,否则无法识别根节点; 65 | 正确的目录结构示意: 66 | 67 | ``` 68 | - Your-data-folder 69 | ├ metadata.xml 70 | └ Data/Tile_000_000/Tile_000_000.osgb 71 | └ Data2/Tile_000_000/Tile_000_000.osgb 72 | ``` 73 | 74 | # How To Build 75 | 1. Windows下建议使用Vcpkg来管理C++依赖,Ubuntu等Linux操作系统可直接使用apt,yum安装。 76 | 2. 版本说明: 77 | 1. GCC >= 8.0 OR MSVC 2019以上 78 | 2. GDAL >= 3.0 79 | 3. OSG >= 3.2 80 | 3. Visual Studio 选择CMakeLists.txt,导入工程,编译后,会自动将GDAL_DATA和PROJ_LIB拷贝到执行目录下 81 | 4. 将OSGPlugins-${Version}文件夹复制到编译目录下 -------------------------------------------------------------------------------- /include/spdlog/common-inl.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #ifndef SPDLOG_HEADER_ONLY 7 | # include 8 | #endif 9 | 10 | #include 11 | #include 12 | 13 | namespace spdlog { 14 | namespace level { 15 | 16 | #if __cplusplus >= 201703L 17 | constexpr 18 | #endif 19 | static string_view_t level_string_views[] SPDLOG_LEVEL_NAMES; 20 | 21 | static const char *short_level_names[] SPDLOG_SHORT_LEVEL_NAMES; 22 | 23 | SPDLOG_INLINE const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT 24 | { 25 | return level_string_views[l]; 26 | } 27 | 28 | SPDLOG_INLINE const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT 29 | { 30 | return short_level_names[l]; 31 | } 32 | 33 | SPDLOG_INLINE spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT 34 | { 35 | auto it = std::find(std::begin(level_string_views), std::end(level_string_views), name); 36 | if (it != std::end(level_string_views)) 37 | return static_cast(it - std::begin(level_string_views)); 38 | 39 | // check also for "warn" and "err" before giving up.. 40 | if (name == "warn") 41 | { 42 | return level::warn; 43 | } 44 | if (name == "err") 45 | { 46 | return level::err; 47 | } 48 | return level::off; 49 | } 50 | } // namespace level 51 | 52 | SPDLOG_INLINE spdlog_ex::spdlog_ex(std::string msg) 53 | : msg_(std::move(msg)) 54 | {} 55 | 56 | SPDLOG_INLINE spdlog_ex::spdlog_ex(const std::string &msg, int last_errno) 57 | { 58 | #ifdef SPDLOG_USE_STD_FORMAT 59 | msg_ = std::system_error(std::error_code(last_errno, std::generic_category()), msg).what(); 60 | #else 61 | memory_buf_t outbuf; 62 | fmt::format_system_error(outbuf, last_errno, msg.c_str()); 63 | msg_ = fmt::to_string(outbuf); 64 | #endif 65 | } 66 | 67 | SPDLOG_INLINE const char *spdlog_ex::what() const SPDLOG_NOEXCEPT 68 | { 69 | return msg_.c_str(); 70 | } 71 | 72 | SPDLOG_INLINE void throw_spdlog_ex(const std::string &msg, int last_errno) 73 | { 74 | SPDLOG_THROW(spdlog_ex(msg, last_errno)); 75 | } 76 | 77 | SPDLOG_INLINE void throw_spdlog_ex(std::string msg) 78 | { 79 | SPDLOG_THROW(spdlog_ex(std::move(msg))); 80 | } 81 | 82 | } // namespace spdlog 83 | -------------------------------------------------------------------------------- /include/spdlog/sinks/tcp_sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #ifdef _WIN32 10 | # include 11 | #else 12 | # include 13 | #endif 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #pragma once 21 | 22 | // Simple tcp client sink 23 | // Connects to remote address and send the formatted log. 24 | // Will attempt to reconnect if connection drops. 25 | // If more complicated behaviour is needed (i.e get responses), you can inherit it and override the sink_it_ method. 26 | 27 | namespace spdlog { 28 | namespace sinks { 29 | 30 | struct tcp_sink_config 31 | { 32 | std::string server_host; 33 | int server_port; 34 | bool lazy_connect = false; // if true connect on first log call instead of on construction 35 | 36 | tcp_sink_config(std::string host, int port) 37 | : server_host{std::move(host)} 38 | , server_port{port} 39 | {} 40 | }; 41 | 42 | template 43 | class tcp_sink : public spdlog::sinks::base_sink 44 | { 45 | public: 46 | // connect to tcp host/port or throw if failed 47 | // host can be hostname or ip address 48 | 49 | explicit tcp_sink(tcp_sink_config sink_config) 50 | : config_{std::move(sink_config)} 51 | { 52 | if (!config_.lazy_connect) 53 | { 54 | this->client_.connect(config_.server_host, config_.server_port); 55 | } 56 | } 57 | 58 | ~tcp_sink() override = default; 59 | 60 | protected: 61 | void sink_it_(const spdlog::details::log_msg &msg) override 62 | { 63 | spdlog::memory_buf_t formatted; 64 | spdlog::sinks::base_sink::formatter_->format(msg, formatted); 65 | if (!client_.is_connected()) 66 | { 67 | client_.connect(config_.server_host, config_.server_port); 68 | } 69 | client_.send(formatted.data(), formatted.size()); 70 | } 71 | 72 | void flush_() override {} 73 | tcp_sink_config config_; 74 | details::tcp_client client_; 75 | }; 76 | 77 | using tcp_sink_mt = tcp_sink; 78 | using tcp_sink_st = tcp_sink; 79 | 80 | } // namespace sinks 81 | } // namespace spdlog 82 | -------------------------------------------------------------------------------- /include/spdlog/sinks/ringbuffer_sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include "spdlog/sinks/base_sink.h" 7 | #include "spdlog/details/circular_q.h" 8 | #include "spdlog/details/log_msg_buffer.h" 9 | #include "spdlog/details/null_mutex.h" 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace spdlog { 16 | namespace sinks { 17 | /* 18 | * Ring buffer sink 19 | */ 20 | template 21 | class ringbuffer_sink final : public base_sink 22 | { 23 | public: 24 | explicit ringbuffer_sink(size_t n_items) 25 | : q_{n_items} 26 | {} 27 | 28 | std::vector last_raw(size_t lim = 0) 29 | { 30 | std::lock_guard lock(base_sink::mutex_); 31 | auto items_available = q_.size(); 32 | auto n_items = lim > 0 ? (std::min)(lim, items_available) : items_available; 33 | std::vector ret; 34 | ret.reserve(n_items); 35 | for (size_t i = (items_available - n_items); i < items_available; i++) 36 | { 37 | ret.push_back(q_.at(i)); 38 | } 39 | return ret; 40 | } 41 | 42 | std::vector last_formatted(size_t lim = 0) 43 | { 44 | std::lock_guard lock(base_sink::mutex_); 45 | auto items_available = q_.size(); 46 | auto n_items = lim > 0 ? (std::min)(lim, items_available) : items_available; 47 | std::vector ret; 48 | ret.reserve(n_items); 49 | for (size_t i = (items_available - n_items); i < items_available; i++) 50 | { 51 | memory_buf_t formatted; 52 | base_sink::formatter_->format(q_.at(i), formatted); 53 | #ifdef SPDLOG_USE_STD_FORMAT 54 | ret.push_back(std::move(formatted)); 55 | #else 56 | ret.push_back(fmt::to_string(formatted)); 57 | #endif 58 | } 59 | return ret; 60 | } 61 | 62 | protected: 63 | void sink_it_(const details::log_msg &msg) override 64 | { 65 | q_.push_back(details::log_msg_buffer{msg}); 66 | } 67 | void flush_() override {} 68 | 69 | private: 70 | details::circular_q q_; 71 | }; 72 | 73 | using ringbuffer_sink_mt = ringbuffer_sink; 74 | using ringbuffer_sink_st = ringbuffer_sink; 75 | 76 | } // namespace sinks 77 | 78 | } // namespace spdlog 79 | -------------------------------------------------------------------------------- /include/spdlog/async_logger.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | // Fast asynchronous logger. 7 | // Uses pre allocated queue. 8 | // Creates a single back thread to pop messages from the queue and log them. 9 | // 10 | // Upon each log write the logger: 11 | // 1. Checks if its log level is enough to log the message 12 | // 2. Push a new copy of the message to a queue (or block the caller until 13 | // space is available in the queue) 14 | // Upon destruction, logs all remaining messages in the queue before 15 | // destructing.. 16 | 17 | #include 18 | 19 | namespace spdlog { 20 | 21 | // Async overflow policy - block by default. 22 | enum class async_overflow_policy 23 | { 24 | block, // Block until message can be enqueued 25 | overrun_oldest // Discard oldest message in the queue if full when trying to 26 | // add new item. 27 | }; 28 | 29 | namespace details { 30 | class thread_pool; 31 | } 32 | 33 | class SPDLOG_API async_logger final : public std::enable_shared_from_this, public logger 34 | { 35 | friend class details::thread_pool; 36 | 37 | public: 38 | template 39 | async_logger(std::string logger_name, It begin, It end, std::weak_ptr tp, 40 | async_overflow_policy overflow_policy = async_overflow_policy::block) 41 | : logger(std::move(logger_name), begin, end) 42 | , thread_pool_(std::move(tp)) 43 | , overflow_policy_(overflow_policy) 44 | {} 45 | 46 | async_logger(std::string logger_name, sinks_init_list sinks_list, std::weak_ptr tp, 47 | async_overflow_policy overflow_policy = async_overflow_policy::block); 48 | 49 | async_logger(std::string logger_name, sink_ptr single_sink, std::weak_ptr tp, 50 | async_overflow_policy overflow_policy = async_overflow_policy::block); 51 | 52 | std::shared_ptr clone(std::string new_name) override; 53 | 54 | protected: 55 | void sink_it_(const details::log_msg &msg) override; 56 | void flush_() override; 57 | void backend_sink_it_(const details::log_msg &incoming_log_msg); 58 | void backend_flush_(); 59 | 60 | private: 61 | std::weak_ptr thread_pool_; 62 | async_overflow_policy overflow_policy_; 63 | }; 64 | } // namespace spdlog 65 | 66 | #ifdef SPDLOG_HEADER_ONLY 67 | # include "async_logger-inl.h" 68 | #endif 69 | -------------------------------------------------------------------------------- /include/spdlog/details/udp_client.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | // Helper RAII over unix udp client socket. 7 | // Will throw on construction if the socket creation failed. 8 | 9 | #ifdef _WIN32 10 | # error "include udp_client-windows.h instead" 11 | #endif 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | namespace spdlog { 26 | namespace details { 27 | 28 | class udp_client 29 | { 30 | static constexpr int TX_BUFFER_SIZE = 1024 * 10; 31 | int socket_ = -1; 32 | struct sockaddr_in sockAddr_; 33 | 34 | void cleanup_() 35 | { 36 | if (socket_ != -1) 37 | { 38 | ::close(socket_); 39 | socket_ = -1; 40 | } 41 | } 42 | 43 | public: 44 | udp_client(const std::string &host, uint16_t port) 45 | { 46 | socket_ = ::socket(PF_INET, SOCK_DGRAM, 0); 47 | if (socket_ < 0) 48 | { 49 | throw_spdlog_ex("error: Create Socket Failed!"); 50 | } 51 | 52 | int option_value = TX_BUFFER_SIZE; 53 | if (::setsockopt(socket_, SOL_SOCKET, SO_SNDBUF, reinterpret_cast(&option_value), sizeof(option_value)) < 0) 54 | { 55 | cleanup_(); 56 | throw_spdlog_ex("error: setsockopt(SO_SNDBUF) Failed!"); 57 | } 58 | 59 | sockAddr_.sin_family = AF_INET; 60 | sockAddr_.sin_port = htons(port); 61 | 62 | if (::inet_aton(host.c_str(), &sockAddr_.sin_addr) == 0) 63 | { 64 | cleanup_(); 65 | throw_spdlog_ex("error: Invalid address!"); 66 | } 67 | 68 | ::memset(sockAddr_.sin_zero, 0x00, sizeof(sockAddr_.sin_zero)); 69 | } 70 | 71 | ~udp_client() 72 | { 73 | cleanup_(); 74 | } 75 | 76 | int fd() const 77 | { 78 | return socket_; 79 | } 80 | 81 | // Send exactly n_bytes of the given data. 82 | // On error close the connection and throw. 83 | void send(const char *data, size_t n_bytes) 84 | { 85 | ssize_t toslen = 0; 86 | socklen_t tolen = sizeof(struct sockaddr); 87 | if ((toslen = ::sendto(socket_, data, n_bytes, 0, (struct sockaddr *)&sockAddr_, tolen)) == -1) 88 | { 89 | throw_spdlog_ex("sendto(2) failed", errno); 90 | } 91 | } 92 | }; 93 | } // namespace details 94 | } // namespace spdlog 95 | -------------------------------------------------------------------------------- /include/spdlog/sinks/stdout_sinks.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #ifdef _WIN32 12 | # include 13 | #endif 14 | 15 | namespace spdlog { 16 | 17 | namespace sinks { 18 | 19 | template 20 | class stdout_sink_base : public sink 21 | { 22 | public: 23 | using mutex_t = typename ConsoleMutex::mutex_t; 24 | explicit stdout_sink_base(FILE *file); 25 | ~stdout_sink_base() override = default; 26 | 27 | stdout_sink_base(const stdout_sink_base &other) = delete; 28 | stdout_sink_base(stdout_sink_base &&other) = delete; 29 | 30 | stdout_sink_base &operator=(const stdout_sink_base &other) = delete; 31 | stdout_sink_base &operator=(stdout_sink_base &&other) = delete; 32 | 33 | void log(const details::log_msg &msg) override; 34 | void flush() override; 35 | void set_pattern(const std::string &pattern) override; 36 | 37 | void set_formatter(std::unique_ptr sink_formatter) override; 38 | 39 | protected: 40 | mutex_t &mutex_; 41 | FILE *file_; 42 | std::unique_ptr formatter_; 43 | #ifdef _WIN32 44 | HANDLE handle_; 45 | #endif // WIN32 46 | }; 47 | 48 | template 49 | class stdout_sink : public stdout_sink_base 50 | { 51 | public: 52 | stdout_sink(); 53 | }; 54 | 55 | template 56 | class stderr_sink : public stdout_sink_base 57 | { 58 | public: 59 | stderr_sink(); 60 | }; 61 | 62 | using stdout_sink_mt = stdout_sink; 63 | using stdout_sink_st = stdout_sink; 64 | 65 | using stderr_sink_mt = stderr_sink; 66 | using stderr_sink_st = stderr_sink; 67 | 68 | } // namespace sinks 69 | 70 | // factory methods 71 | template 72 | std::shared_ptr stdout_logger_mt(const std::string &logger_name); 73 | 74 | template 75 | std::shared_ptr stdout_logger_st(const std::string &logger_name); 76 | 77 | template 78 | std::shared_ptr stderr_logger_mt(const std::string &logger_name); 79 | 80 | template 81 | std::shared_ptr stderr_logger_st(const std::string &logger_name); 82 | 83 | } // namespace spdlog 84 | 85 | #ifdef SPDLOG_HEADER_ONLY 86 | # include "stdout_sinks-inl.h" 87 | #endif 88 | -------------------------------------------------------------------------------- /resources/gdal/data/inspire_cp_CadastralParcel.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | CadastralParcel 4 | CadastralParcel 5 | 6 | geometry 7 | geometry 8 | MultiPolygon 9 | 10 | 11 | referencePoint 12 | referencePoint 13 | Point 14 | 15 | 16 | areaValue 17 | areaValue 18 | Real 19 | 20 | 21 | areaValue_uom 22 | areaValue@uom 23 | String 24 | 25 | 26 | beginLifespanVersion 27 | beginLifespanVersion 28 | String 29 | 30 | 31 | endLifespanVersion 32 | endLifespanVersion 33 | String 34 | 35 | 36 | inspireId_localId 37 | inspireId|Identifier|localId 38 | String 39 | 40 | 41 | inspireId_namespace 42 | inspireId|Identifier|namespace 43 | String 44 | 45 | 46 | label 47 | label 48 | String 49 | 50 | 51 | nationalCadastralReference 52 | nationalCadastralReference 53 | String 54 | 55 | 56 | validFrom 57 | validFrom 58 | String 59 | 60 | 61 | validTo 62 | validTo 63 | String 64 | 65 | 66 | basicPropertyUnit_href 67 | basicPropertyUnit@href 68 | StringList 69 | 70 | 71 | administrativeUnit_href 72 | administrativeUnit@href 73 | String 74 | 75 | 76 | zoning_href 77 | zoning@href 78 | String 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /include/spdlog/sinks/dist_sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include "base_sink.h" 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | // Distribution sink (mux). Stores a vector of sinks which get called when log 17 | // is called 18 | 19 | namespace spdlog { 20 | namespace sinks { 21 | 22 | template 23 | class dist_sink : public base_sink 24 | { 25 | public: 26 | dist_sink() = default; 27 | explicit dist_sink(std::vector> sinks) 28 | : sinks_(sinks) 29 | {} 30 | 31 | dist_sink(const dist_sink &) = delete; 32 | dist_sink &operator=(const dist_sink &) = delete; 33 | 34 | void add_sink(std::shared_ptr sink) 35 | { 36 | std::lock_guard lock(base_sink::mutex_); 37 | sinks_.push_back(sink); 38 | } 39 | 40 | void remove_sink(std::shared_ptr sink) 41 | { 42 | std::lock_guard lock(base_sink::mutex_); 43 | sinks_.erase(std::remove(sinks_.begin(), sinks_.end(), sink), sinks_.end()); 44 | } 45 | 46 | void set_sinks(std::vector> sinks) 47 | { 48 | std::lock_guard lock(base_sink::mutex_); 49 | sinks_ = std::move(sinks); 50 | } 51 | 52 | std::vector> &sinks() 53 | { 54 | return sinks_; 55 | } 56 | 57 | protected: 58 | void sink_it_(const details::log_msg &msg) override 59 | { 60 | for (auto &sink : sinks_) 61 | { 62 | if (sink->should_log(msg.level)) 63 | { 64 | sink->log(msg); 65 | } 66 | } 67 | } 68 | 69 | void flush_() override 70 | { 71 | for (auto &sink : sinks_) 72 | { 73 | sink->flush(); 74 | } 75 | } 76 | 77 | void set_pattern_(const std::string &pattern) override 78 | { 79 | set_formatter_(details::make_unique(pattern)); 80 | } 81 | 82 | void set_formatter_(std::unique_ptr sink_formatter) override 83 | { 84 | base_sink::formatter_ = std::move(sink_formatter); 85 | for (auto &sink : sinks_) 86 | { 87 | sink->set_formatter(base_sink::formatter_->clone()); 88 | } 89 | } 90 | std::vector> sinks_; 91 | }; 92 | 93 | using dist_sink_mt = dist_sink; 94 | using dist_sink_st = dist_sink; 95 | 96 | } // namespace sinks 97 | } // namespace spdlog 98 | -------------------------------------------------------------------------------- /Plugins/fbx/fbxReader.h: -------------------------------------------------------------------------------- 1 | #ifndef FBXRANIMATION_H 2 | #define FBXRANIMATION_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "fbxMaterialToOsgStateSet.h" 8 | 9 | namespace osgAnimation 10 | { 11 | class AnimationManagerBase; 12 | class RigGeometry; 13 | class Skeleton; 14 | } 15 | 16 | typedef std::map< osg::Matrix, std::set > BindMatrixGeometryMap; 17 | typedef std::map< FbxNode* , BindMatrixGeometryMap > BindMatrixMap; 18 | 19 | class OsgFbxReader 20 | { 21 | public: 22 | FbxManager& pSdkManager; 23 | FbxScene& fbxScene; 24 | osg::ref_ptr pAnimationManager; 25 | FbxMaterialToOsgStateSet& fbxMaterialToOsgStateSet; 26 | std::map nodeMap; 27 | BindMatrixMap boneBindMatrices; 28 | const std::set& fbxSkeletons; 29 | std::map skeletonMap; 30 | const osgDB::Options& options; 31 | bool lightmapTextures, tessellatePolygons; 32 | 33 | enum AuthoringTool 34 | { 35 | UNKNOWN, 36 | OPENSCENEGRAPH, 37 | AUTODESK_3DSTUDIO_MAX 38 | } authoringTool; 39 | 40 | OsgFbxReader( 41 | FbxManager& pSdkManager1, 42 | FbxScene& fbxScene1, 43 | FbxMaterialToOsgStateSet& fbxMaterialToOsgStateSet1, 44 | const std::set& fbxSkeletons1, 45 | const osgDB::Options& options1, 46 | AuthoringTool authoringTool1, 47 | bool lightmapTextures1, 48 | bool tessellatePolygons1) 49 | : pSdkManager(pSdkManager1), 50 | fbxScene(fbxScene1), 51 | fbxMaterialToOsgStateSet(fbxMaterialToOsgStateSet1), 52 | fbxSkeletons(fbxSkeletons1), 53 | options(options1), 54 | lightmapTextures(lightmapTextures1), 55 | tessellatePolygons(tessellatePolygons1), 56 | authoringTool(authoringTool1) 57 | {} 58 | 59 | osgDB::ReaderWriter::ReadResult readFbxNode( 60 | FbxNode*, bool& bIsBone, int& nLightCount); 61 | 62 | std::string readFbxAnimation( 63 | FbxNode*, const char* targetName); 64 | 65 | osgDB::ReaderWriter::ReadResult readFbxCamera( 66 | FbxNode* pNode); 67 | 68 | osgDB::ReaderWriter::ReadResult readFbxLight( 69 | FbxNode* pNode, int& nLightCount); 70 | 71 | osgDB::ReaderWriter::ReadResult readMesh( 72 | FbxNode* pNode, FbxMesh* fbxMesh, 73 | std::vector& stateSetList, 74 | const char* szName); 75 | 76 | osgDB::ReaderWriter::ReadResult readFbxMesh( 77 | FbxNode* pNode, 78 | std::vector&); 79 | }; 80 | 81 | osgAnimation::Skeleton* getSkeleton(FbxNode*, 82 | const std::set& fbxSkeletons, 83 | std::map&); 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /include/spdlog/async_logger-inl.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #ifndef SPDLOG_HEADER_ONLY 7 | # include 8 | #endif 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | SPDLOG_INLINE spdlog::async_logger::async_logger( 17 | std::string logger_name, sinks_init_list sinks_list, std::weak_ptr tp, async_overflow_policy overflow_policy) 18 | : async_logger(std::move(logger_name), sinks_list.begin(), sinks_list.end(), std::move(tp), overflow_policy) 19 | {} 20 | 21 | SPDLOG_INLINE spdlog::async_logger::async_logger( 22 | std::string logger_name, sink_ptr single_sink, std::weak_ptr tp, async_overflow_policy overflow_policy) 23 | : async_logger(std::move(logger_name), {std::move(single_sink)}, std::move(tp), overflow_policy) 24 | {} 25 | 26 | // send the log message to the thread pool 27 | SPDLOG_INLINE void spdlog::async_logger::sink_it_(const details::log_msg &msg) 28 | { 29 | if (auto pool_ptr = thread_pool_.lock()) 30 | { 31 | pool_ptr->post_log(shared_from_this(), msg, overflow_policy_); 32 | } 33 | else 34 | { 35 | throw_spdlog_ex("async log: thread pool doesn't exist anymore"); 36 | } 37 | } 38 | 39 | // send flush request to the thread pool 40 | SPDLOG_INLINE void spdlog::async_logger::flush_() 41 | { 42 | if (auto pool_ptr = thread_pool_.lock()) 43 | { 44 | pool_ptr->post_flush(shared_from_this(), overflow_policy_); 45 | } 46 | else 47 | { 48 | throw_spdlog_ex("async flush: thread pool doesn't exist anymore"); 49 | } 50 | } 51 | 52 | // 53 | // backend functions - called from the thread pool to do the actual job 54 | // 55 | SPDLOG_INLINE void spdlog::async_logger::backend_sink_it_(const details::log_msg &msg) 56 | { 57 | for (auto &sink : sinks_) 58 | { 59 | if (sink->should_log(msg.level)) 60 | { 61 | SPDLOG_TRY 62 | { 63 | sink->log(msg); 64 | } 65 | SPDLOG_LOGGER_CATCH(msg.source) 66 | } 67 | } 68 | 69 | if (should_flush_(msg)) 70 | { 71 | backend_flush_(); 72 | } 73 | } 74 | 75 | SPDLOG_INLINE void spdlog::async_logger::backend_flush_() 76 | { 77 | for (auto &sink : sinks_) 78 | { 79 | SPDLOG_TRY 80 | { 81 | sink->flush(); 82 | } 83 | SPDLOG_LOGGER_CATCH(source_loc()) 84 | } 85 | } 86 | 87 | SPDLOG_INLINE std::shared_ptr spdlog::async_logger::clone(std::string new_name) 88 | { 89 | auto cloned = std::make_shared(*this); 90 | cloned->name_ = std::move(new_name); 91 | return cloned; 92 | } 93 | -------------------------------------------------------------------------------- /resources/gdal/data/jpfgdgml_GCP.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | GCP 4 | GCP 5 | urn:ogc:def:crs:EPSG::6668 6 | pos 7 | Point 8 | 9 | fid 10 | fid 11 | String 12 | 13 | 14 | lfSpanFr 15 | lfSpanFr|timePosition 16 | String 17 | 18 | 19 | lfSpanTo 20 | lfSpanTo|timePosition 21 | String 22 | 23 | 24 | devDate 25 | devDate|timePosition 26 | String 27 | 28 | 29 | orgGILvl 30 | orgGILvl 31 | String 32 | 33 | 34 | orgMDId 35 | orgMDId 36 | String 37 | 38 | 39 | vis 40 | vis 41 | String 42 | 43 | 44 | advNo 45 | advNo 46 | String 47 | 48 | 49 | orgName 50 | orgName 51 | String 52 | 53 | 54 | type 55 | type 56 | String 57 | 58 | 59 | gcpClass 60 | gcpClass 61 | String 62 | 63 | 64 | gcpCode 65 | gcpCode 66 | String 67 | 68 | 69 | name 70 | name 71 | String 72 | 73 | 74 | B 75 | B 76 | Real 77 | 78 | 79 | L 80 | L 81 | Real 82 | 83 | 84 | alti 85 | alti 86 | Real 87 | 88 | 89 | altiAcc 90 | altiAcc 91 | Integer 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /resources/gdal/data/ruian_vf_st_uvoh_v1.gfs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | VolebniOkrsek 5 | Data|VolebniOkrsek|VO 6 | urn:ogc:def:crs:EPSG::5514 7 | 8 | 9 | DefinicniBod 10 | Geometrie|DefinicniBod 11 | Point 12 | 13 | 14 | 15 | OriginalniHranice 16 | Geometrie|OriginalniHranice 17 | MultiPolygon 18 | 19 | 20 | 21 | Kod 22 | Kod 23 | Integer 24 | 25 | 26 | 27 | Cislo 28 | Cislo 29 | Integer 30 | 31 | 32 | 33 | Nespravny 34 | Nespravny 35 | String 36 | 5 37 | 38 | 39 | 40 | ObecKod 41 | Obec|Kod 42 | Integer 43 | 44 | 45 | 46 | MomcKod 47 | Momc|Kod 48 | Integer 49 | 50 | 51 | 52 | Poznamka 53 | Poznamka 54 | String 55 | 60 56 | 57 | 58 | 59 | PlatiOd 60 | PlatiOd 61 | String 62 | 19 63 | 64 | 65 | 66 | PlatiDo 67 | PlatiDo 68 | String 69 | 19 70 | 71 | 72 | 73 | IdTransakce 74 | IdTransakce 75 | Integer 76 | Integer64 77 | 78 | 79 | 80 | GlobalniIdNavrhuZmeny 81 | GlobalniIdNavrhuZmeny 82 | Integer 83 | Integer64 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /include/spdlog/sinks/rotating_file_sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace spdlog { 16 | namespace sinks { 17 | 18 | // 19 | // Rotating file sink based on size 20 | // 21 | template 22 | class rotating_file_sink final : public base_sink 23 | { 24 | public: 25 | rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files, bool rotate_on_open = false, 26 | const file_event_handlers &event_handlers = {}); 27 | static filename_t calc_filename(const filename_t &filename, std::size_t index); 28 | filename_t filename(); 29 | 30 | protected: 31 | void sink_it_(const details::log_msg &msg) override; 32 | void flush_() override; 33 | 34 | private: 35 | // Rotate files: 36 | // log.txt -> log.1.txt 37 | // log.1.txt -> log.2.txt 38 | // log.2.txt -> log.3.txt 39 | // log.3.txt -> delete 40 | void rotate_(); 41 | 42 | // delete the target if exists, and rename the src file to target 43 | // return true on success, false otherwise. 44 | bool rename_file_(const filename_t &src_filename, const filename_t &target_filename); 45 | 46 | filename_t base_filename_; 47 | std::size_t max_size_; 48 | std::size_t max_files_; 49 | std::size_t current_size_; 50 | details::file_helper file_helper_; 51 | }; 52 | 53 | using rotating_file_sink_mt = rotating_file_sink; 54 | using rotating_file_sink_st = rotating_file_sink; 55 | 56 | } // namespace sinks 57 | 58 | // 59 | // factory functions 60 | // 61 | 62 | template 63 | inline std::shared_ptr rotating_logger_mt(const std::string &logger_name, const filename_t &filename, size_t max_file_size, 64 | size_t max_files, bool rotate_on_open = false, const file_event_handlers &event_handlers = {}) 65 | { 66 | return Factory::template create( 67 | logger_name, filename, max_file_size, max_files, rotate_on_open, event_handlers); 68 | } 69 | 70 | template 71 | inline std::shared_ptr rotating_logger_st(const std::string &logger_name, const filename_t &filename, size_t max_file_size, 72 | size_t max_files, bool rotate_on_open = false, const file_event_handlers &event_handlers = {}) 73 | { 74 | return Factory::template create( 75 | logger_name, filename, max_file_size, max_files, rotate_on_open, event_handlers); 76 | } 77 | } // namespace spdlog 78 | 79 | #ifdef SPDLOG_HEADER_ONLY 80 | # include "rotating_file_sink-inl.h" 81 | #endif 82 | -------------------------------------------------------------------------------- /include/spdlog/sinks/wincolor_sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace spdlog { 18 | namespace sinks { 19 | /* 20 | * Windows color console sink. Uses WriteConsoleA to write to the console with 21 | * colors 22 | */ 23 | template 24 | class wincolor_sink : public sink 25 | { 26 | public: 27 | wincolor_sink(void *out_handle, color_mode mode); 28 | ~wincolor_sink() override; 29 | 30 | wincolor_sink(const wincolor_sink &other) = delete; 31 | wincolor_sink &operator=(const wincolor_sink &other) = delete; 32 | 33 | // change the color for the given level 34 | void set_color(level::level_enum level, std::uint16_t color); 35 | void log(const details::log_msg &msg) final override; 36 | void flush() final override; 37 | void set_pattern(const std::string &pattern) override final; 38 | void set_formatter(std::unique_ptr sink_formatter) override final; 39 | void set_color_mode(color_mode mode); 40 | 41 | protected: 42 | using mutex_t = typename ConsoleMutex::mutex_t; 43 | void *out_handle_; 44 | mutex_t &mutex_; 45 | bool should_do_colors_; 46 | std::unique_ptr formatter_; 47 | std::array colors_; 48 | 49 | // set foreground color and return the orig console attributes (for resetting later) 50 | std::uint16_t set_foreground_color_(std::uint16_t attribs); 51 | 52 | // print a range of formatted message to console 53 | void print_range_(const memory_buf_t &formatted, size_t start, size_t end); 54 | 55 | // in case we are redirected to file (not in console mode) 56 | void write_to_file_(const memory_buf_t &formatted); 57 | 58 | void set_color_mode_impl(color_mode mode); 59 | }; 60 | 61 | template 62 | class wincolor_stdout_sink : public wincolor_sink 63 | { 64 | public: 65 | explicit wincolor_stdout_sink(color_mode mode = color_mode::automatic); 66 | }; 67 | 68 | template 69 | class wincolor_stderr_sink : public wincolor_sink 70 | { 71 | public: 72 | explicit wincolor_stderr_sink(color_mode mode = color_mode::automatic); 73 | }; 74 | 75 | using wincolor_stdout_sink_mt = wincolor_stdout_sink; 76 | using wincolor_stdout_sink_st = wincolor_stdout_sink; 77 | 78 | using wincolor_stderr_sink_mt = wincolor_stderr_sink; 79 | using wincolor_stderr_sink_st = wincolor_stderr_sink; 80 | } // namespace sinks 81 | } // namespace spdlog 82 | 83 | #ifdef SPDLOG_HEADER_ONLY 84 | # include "wincolor_sink-inl.h" 85 | #endif 86 | -------------------------------------------------------------------------------- /resources/gdal/data/vdv452.xsd: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /include/spdlog/sinks/dup_filter_sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #include "dist_sink.h" 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | // Duplicate message removal sink. 16 | // Skip the message if previous one is identical and less than "max_skip_duration" have passed 17 | // 18 | // Example: 19 | // 20 | // #include 21 | // 22 | // int main() { 23 | // auto dup_filter = std::make_shared(std::chrono::seconds(5)); 24 | // dup_filter->add_sink(std::make_shared()); 25 | // spdlog::logger l("logger", dup_filter); 26 | // l.info("Hello"); 27 | // l.info("Hello"); 28 | // l.info("Hello"); 29 | // l.info("Different Hello"); 30 | // } 31 | // 32 | // Will produce: 33 | // [2019-06-25 17:50:56.511] [logger] [info] Hello 34 | // [2019-06-25 17:50:56.512] [logger] [info] Skipped 3 duplicate messages.. 35 | // [2019-06-25 17:50:56.512] [logger] [info] Different Hello 36 | 37 | namespace spdlog { 38 | namespace sinks { 39 | template 40 | class dup_filter_sink : public dist_sink 41 | { 42 | public: 43 | template 44 | explicit dup_filter_sink(std::chrono::duration max_skip_duration) 45 | : max_skip_duration_{max_skip_duration} 46 | {} 47 | 48 | protected: 49 | std::chrono::microseconds max_skip_duration_; 50 | log_clock::time_point last_msg_time_; 51 | std::string last_msg_payload_; 52 | size_t skip_counter_ = 0; 53 | 54 | void sink_it_(const details::log_msg &msg) override 55 | { 56 | bool filtered = filter_(msg); 57 | if (!filtered) 58 | { 59 | skip_counter_ += 1; 60 | return; 61 | } 62 | 63 | // log the "skipped.." message 64 | if (skip_counter_ > 0) 65 | { 66 | char buf[64]; 67 | auto msg_size = ::snprintf(buf, sizeof(buf), "Skipped %u duplicate messages..", static_cast(skip_counter_)); 68 | if (msg_size > 0 && static_cast(msg_size) < sizeof(buf)) 69 | { 70 | details::log_msg skipped_msg{msg.logger_name, level::info, string_view_t{buf, static_cast(msg_size)}}; 71 | dist_sink::sink_it_(skipped_msg); 72 | } 73 | } 74 | 75 | // log current message 76 | dist_sink::sink_it_(msg); 77 | last_msg_time_ = msg.time; 78 | skip_counter_ = 0; 79 | last_msg_payload_.assign(msg.payload.data(), msg.payload.data() + msg.payload.size()); 80 | } 81 | 82 | // return whether the log msg should be displayed (true) or skipped (false) 83 | bool filter_(const details::log_msg &msg) 84 | { 85 | auto filter_duration = msg.time - last_msg_time_; 86 | return (filter_duration > max_skip_duration_) || (msg.payload != last_msg_payload_); 87 | } 88 | }; 89 | 90 | using dup_filter_sink_mt = dup_filter_sink; 91 | using dup_filter_sink_st = dup_filter_sink; 92 | 93 | } // namespace sinks 94 | } // namespace spdlog 95 | -------------------------------------------------------------------------------- /cgt/cgtmodel.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace scially { 13 | namespace fs = std::filesystem; 14 | 15 | std::vector split(const std::string& str, const std::string& delimiters) { 16 | std::vector tokens; 17 | 18 | size_t last_pos = str.find_first_not_of(delimiters, 0); 19 | size_t pos = str.find_first_of(delimiters, last_pos); 20 | while (std::string::npos != pos || std::string::npos != last_pos) { 21 | tokens.emplace_back(str.substr(last_pos, pos - last_pos)); 22 | last_pos = str.find_first_not_of(delimiters, pos); 23 | pos = str.find_first_of(delimiters, last_pos); 24 | } 25 | 26 | return tokens; 27 | } 28 | 29 | void osg_modeldata::load(const std::string &srs, const std::string &srs_origin) { 30 | srs_ = srs; 31 | origin_ = parse_origin(srs_origin); 32 | } 33 | 34 | void osg_modeldata::load_from_dir(const std::string &input) { 35 | std::string metadata_location = (fs::path(input) / "metadata.xml").string(); 36 | load_from_file(metadata_location); 37 | } 38 | 39 | void osg_modeldata::load_from_file(const std::string &input) { 40 | tinyxml2::XMLDocument doc; 41 | tinyxml2::XMLError err = doc.LoadFile(input.c_str()); 42 | if (err != tinyxml2::XML_SUCCESS) { 43 | throw cgt_exception("could not parse metadata.xml!"); 44 | } 45 | 46 | tinyxml2::XMLElement *root = doc.RootElement(); 47 | 48 | if (strcmp(root->Name(), "ModelMetadata")) { 49 | throw cgt_exception("could not find ModelMetaData node in metadata.xml"); 50 | } 51 | 52 | tinyxml2::XMLElement *srs_element = root->FirstChildElement("SRS"); 53 | tinyxml2::XMLElement *srs_origin_element = root->FirstChildElement("SRSOrigin"); 54 | const std::string srs = srs_element->GetText(); 55 | const std::string srs_origin = srs_origin_element == nullptr ? "0,0,0": srs_origin_element->GetText(); 56 | load(srs, srs_origin); 57 | } 58 | 59 | void osg_modeldata::write(const std::string &output){ 60 | tinyxml2::XMLDocument doc; 61 | doc.Parse(""); 62 | tinyxml2::XMLElement *root = doc.NewElement("ModelMetadata"); 63 | doc.InsertEndChild(root); 64 | 65 | tinyxml2::XMLElement *srs = doc.NewElement("SRS"); 66 | srs->SetText(srs_.c_str()); 67 | root->InsertFirstChild(srs); 68 | 69 | tinyxml2::XMLElement *srs_origin = doc.NewElement("SRSOrigin"); 70 | const std::string xyz_format = std::to_string(origin_.x()) 71 | + "," + std::to_string(origin_.y()) 72 | + "," + std::to_string(origin_.z()); 73 | srs_origin->SetText(xyz_format.c_str()); 74 | 75 | root->InsertEndChild(srs_origin); 76 | doc.SaveFile(output.c_str()); 77 | } 78 | 79 | osg::Vec3 osg_modeldata::parse_origin(const std::string& srs_origin) const noexcept{ 80 | std::vector srs_split = split(srs_origin, ","); 81 | std::vector xyz = {0 ,0, 0}; 82 | std::transform(srs_split.begin(), srs_split.end(), xyz.begin(), [](const auto& str) { 83 | return std::atof(str.c_str()); 84 | }); 85 | 86 | return osg::Vec3(xyz[0], xyz[1], xyz[2]); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /resources/proj/data/ITRF2014: -------------------------------------------------------------------------------- 1 | # ITRF2014 params are in mm/year, PJ_helmert uses m/year 2 | +version=1.0.0 +origin=http://itrf.ign.fr/doc_ITRF/Transfo-ITRF2014_ITRFs.txt +lastupdate=2017-07-26 3 | 4 | +proj=helmert +x=0.0016 +y=0.0019 +z=0.0024 +s=-0.00002 +dz=-0.0001 +ds=0.00003 +t_epoch=2010.0 +convention=position_vector 5 | 6 | +proj=helmert +x=0.0026 +y=0.001 +z=-0.0023 +s=0.00092 +dx=0.0003 +dz=-0.0001 +ds=0.00003 +t_epoch=2010.0 +convention=position_vector 7 | 8 | +proj=helmert +x=0.0007 +y=0.0012 +z=-0.0261 +s=0.00212 +dx=0.0001 +dy=0.0001 +dz=-0.0019 +ds=0.00011 +t_epoch=2010.0 +convention=position_vector 9 | 10 | +proj=helmert +x=0.0074 +y=-0.0005 +z=-0.0628 +d=0.0038 +rz=0.00026 +dx0.0001 +dy=-0.0005 +dz=-0.0033 +ds=0.00012 +drz=0.00002 +t_epoch=2010.0 +convention=position_vector 11 | 12 | +proj=helmert +x=0.0074 +y=-0.0005 +z=-0.0628 +s=0.0038 +rz=0.00026 +dx=0.0001 +dy=-0.0005 +dz=-0.0033 +ds=0.00012 +t_epoch=2010.0 +convention=position_vector 13 | 14 | +proj=helmert +x=0.0074 +y=-0.0005 +z=-0.0628 +s=0.0038 +rz=0.00026 +dx=0.0001 +dy=-0.0005 +dz=-0.0033 +ds=0.00012 +t_epoch=2010.0 +convention=position_vector 15 | 16 | +proj=helmert +x=-0.0504 +y=0.0033 +z=-0.0602 +s=0.00429 +rx=-0.00281 +ry=-0.00338 +rz=0.0004 +dx=-0.0028 +dy=-0.0001 +dz=-0.0025 +ds=0.00012 +drx=-0.00011 +dry=-0.00019 +drz=0.00007 +t_epoch=2010.0 +convention=position_vector 17 | 18 | +proj=helmert +x=0.0154 +y=0.0015 +z=-0.0708 +s=0.00309 +rz=0.00026 +dx=0.0001 +dy=-0.0005 +dz=-0.0033 +ds=0.00012 +drz=0.00002 +t_epoch=2010.0 +convention=position_vector 19 | 20 | +proj=helmert +x=0.0274 +y=0.0155 +z=-0.0768 +s=0.00449 +rz=0.00026 +dx=0.0001 +dy=-0.0005 +dz=-0.0033 +ds=0.00012 +drz=0.00002 +t_epoch=2010.0 +convention=position_vector 21 | 22 | +proj=helmert +x=0.0254 +y=0.0115 +z=-0.0928 +s=0.00479 +rz=0.00026 +dx=0.0001 +dy=-0.0005 +dz=-0.0033 +ds=0.00012 +drz=0.00002 +t_epoch=2010.0 +convention=position_vector 23 | 24 | +proj=helmert +x=0.0304 +y=0.0355 +z=-0.1308 +s=0.00819 +rz=0.00026 +dx=0.0001 +dy=-0.0005 +dz=-0.0033 +ds=0.00012 +drz=0.00002 +t_epoch=2010.0 +convention=position_vector 25 | 26 | +proj=helmert +x=0.0254 +y=-0.0005 +z=-0.1548 +s=0.01129 +rx=0.0001 +rz= +dx=0.00026 +dy=0.0001 +dx=-0.0005 +dz=-0.0033 +ds=0.00012 +drz=0.00002 +t_epoch=2010.0 +convention=position_vector 27 | 28 | # ITRF2014 Plate Motion Model parameters 29 | # 30 | # As described in 31 | # 32 | # Z. Altamimi et al, 2017, ITRF2014 plate motion model, 33 | # doi: 10.1093/gji/ggx136 34 | 35 | +proj=helmert +drx=-0.000248 +dry=-0.000324 +drz=0.000675 +convention=position_vector 36 | 37 | +proj=helmert +drx=0.001154 +dry=-0.000136 +drz=0.001444 +convention=position_vector 38 | 39 | +proj=helmert +drx=0.001510 +dry=0.001182 +drz=0.001215 +convention=position_vector 40 | 41 | +proj=helmert +drx=-0.000085 +dry=-0.000531 +drz=0.000770 +convention=position_vector 42 | 43 | +proj=helmert +drx=0.001154 +dry=-0.000005 +drz=0.001454 +convention=position_vector 44 | 45 | +proj=helmert +drx=-0.000333 +dry=-0.001544 +drz=0.001623 +convention=position_vector 46 | 47 | +proj=helmert +drx=0.000024 +dry=-0.000694 +drz=-0.000063 +convention=position_vector 48 | 49 | +proj=helmert +drx=0.000099 +dry=-0.000614 +drz=0.000733 +convention=position_vector 50 | 51 | +proj=helmert +drx=-0.000409 +dry=0.001047 +drz=-0.002169 +convention=position_vector 52 | 53 | +proj=helmert +drx=-0.000270 +dry=-0.000301 +drz=-0.000140 +convention=position_vector 54 | 55 | +proj=helmert +drx=-0.000121 +dry=-0.000794 +drz=0.000884 +convention=position_vector 56 | -------------------------------------------------------------------------------- /resources/gdal/data/pci_ellips.txt: -------------------------------------------------------------------------------- 1 | ! 2 | ! By email on December 2nd, 2010: 3 | ! 4 | ! I, Louis Burry, on behalf of PCI Geomatics agree to allow the ellips.txt 5 | ! and datum.txt file to be distributed under the GDAL open source license. 6 | ! 7 | ! Louis Burry 8 | ! VP Technology & Delivery 9 | ! PCI Geomatics 10 | ! 11 | ! 12 | ! NOTE: The range of "E908" to "E998" is set aside for 13 | ! the use of local customer development. 14 | ! 15 | "E009","Airy 1830",6377563.396,6356256.91 16 | "E011","Modified Airy",6377340.189,6356034.448 17 | "E910","ATS77",6378135.0,6356750.304922 18 | "E014","Australian National 1965",6378160.,6356774.719 19 | "E002","Bessel 1841",6377397.155,6356078.96284 20 | "E900","Bessel 1841 (Namibia)",6377483.865,6356165.382966 21 | "E333","Bessel 1841 (Japan By Law)",6377397.155,6356078.963 22 | "E000","Clarke 1866",6378206.4,6356583.8 23 | "E001","Clarke 1880 (RGS)",6378249.145,6356514.86955 24 | "E202","Clarke 1880 (IGN, France)",6378249.2,6356515.0 25 | "E006","Everest (India 1830)",6377276.3452,6356075.4133 26 | "E010","Everest (W. Malaysia and Singapore 1948)",6377304.063,6356103.039 27 | "E901","Everest (India 1956)",6377301.243,6356100.228368 28 | "E902","Everest (W. Malaysia 1969)",6377295.664,6356094.667915 29 | "E903","Everest (E. Malaysia and Brunei)",6377298.556,6356097.550301 30 | "E201","Everest (Pakistan)",6377309.613,6356108.570542 31 | "E017","Fischer 1960",6378166.,6356784.283666 32 | "E013","Modified Fischer 1960",6378155.,6356773.3205 33 | "E018","Fischer 1968",6378150.,6356768.337303 34 | "E008","GRS 1980",6378137.,6356752.31414 35 | "E904","Helmert 1906",6378200.,6356818.169628 36 | "E016","Hough 1960",6378270.,6356794.343479 37 | "E200","Indonesian 1974",6378160.,6356774.504086 38 | "E004","International 1924",6378388.,6356911.94613 39 | "E203","IUGG 67",6378160.,6356774.516090714 40 | "E015","Krassovsky 1940",6378245.,6356863.0188 41 | "E700","MODIS (Sphere from WGS84)",6371007.181,6371007.181 42 | "E003","New International 1967",6378157.5,6356772.2 43 | "E019","Normal Sphere",6370997.,6370997. 44 | "E905","SGS 85",6378136.,6356751.301569 45 | "E907","South American 1969",6378160.,6356774.719 46 | "E906","WGS 60",6378165.,6356783.286959 47 | "E007","WGS 66",6378145.,6356759.769356 48 | "E005","WGS 72",6378135.,6356750.519915 49 | "E012","WGS 84",6378137.,6356752.314245 50 | "E600","D-PAF (Orbits)",6378144.0,6356759.0 51 | "E601","Test Data Set 1",6378144.0,6356759.0 52 | "E602","Test Data Set 2",6377397.2,6356079.0 53 | "E204","War Office",6378300.583,6356752.270 54 | "E205","Clarke 1880 Arc",6378249.145,6356514.966 55 | "E206","Bessel Modified",6377492.018,6356173.5087 56 | "E207","Clarke 1858",6378293.639,6356617.98149 57 | "E208","Clarke 1880",6378249.138,6356514.95942 58 | "E209","Everest (1937 Adjustment)",6377276.345,6356075.413 59 | "E210","Everest (1962 Definition)",6377301.243,6356100.23 60 | "E211","Everest Modified",6377304.063,6356103.039 61 | "E212","Modified Everest 1969",6377295.664,6356094.668 62 | "E213","Everest (1967 Definition)",6377298.556,6356097.550 63 | "E214","Clarke 1880 (Benoit)",6378300.79,6356566.43 64 | "E215","Clarke 1880 (SGA)",6378249.2,6356515.0 65 | "E216","Everest (1975 Definition)",6377299.151,6356098.1451 66 | "E217","GEM 10C",6378137,6356752.31414 67 | "E218","OSU 86F",6378136.2,6356751.516672 68 | "E219","OSU 91A",6378136.3,6356751.6163367 69 | "E220","Sphere",6371000,6371000 70 | "E221","Struve 1860",6378297,6356655.847 71 | "E222","Walbeck",6376896,6355834.847 72 | "E223","Plessis 1817",6376523,6355862.933 73 | "E224","Xian 1980",6378140.0,6356755.288 74 | "E225","EMEP Sphere",6370000,6370000 75 | "E226","Everest (India and Nepal)",6377301.243,6356100.228368 76 | "E899","GRS 1967 Modified",6378160.,6356774.719195306 77 | -------------------------------------------------------------------------------- /cgt/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | int main(int argc, char *argv[]) { 9 | static scially::gdal_init gdal_init_; 10 | 11 | CLI::App app{"cgt(by hwang@126.com)"}; 12 | std::string in_location; 13 | std::string out_location; 14 | std::string target_srs; 15 | std::string source_srs; 16 | std::string source_srs_origin = "0,0,0"; 17 | std::string target_srs_origin = "0,0,0"; 18 | std::string shapefile; 19 | bool is_copy = true; 20 | uint32_t thread = 0; 21 | 22 | app.set_version_flag("-v,--version", CGT_VERSION); 23 | auto transform_app = app.add_subcommand("transform", "coordinate transform"); 24 | auto export_app = app.add_subcommand("export", "export osgb data"); 25 | app.require_subcommand(); 26 | 27 | app 28 | .add_option("-i,--in", in_location, "osg Data path") 29 | ->check(CLI::ExistingDirectory) 30 | ->required(true); 31 | app 32 | .add_option("-o,--out", out_location, "output location") 33 | ->required(true); 34 | app 35 | .add_option("--source-srs", source_srs, "source srs") 36 | ->required(false); 37 | app 38 | .add_option("--source-origin", source_srs_origin, "source srs origin (default: 0,0,0)") 39 | ->required(false); 40 | app 41 | .add_option("-t,--thread", thread, "thread") 42 | ->required(false); 43 | 44 | transform_app 45 | ->add_option("--target-srs", target_srs, "target srs") 46 | ->required(true); 47 | transform_app 48 | ->add_option("--target-origin", target_srs_origin, "target srs origin(default: 0,0,0)") 49 | ->required(false); 50 | export_app 51 | ->add_option("-s,--shapefile", shapefile, "export extent") 52 | ->check(CLI::ExistingFile) 53 | ->required(true); 54 | export_app 55 | ->add_option("-c,--copy", is_copy, "copy tile(default: true)") 56 | ->required(false); 57 | 58 | CLI11_PARSE(app, argc, argv); 59 | 60 | scially::osg_modeldata source_modeldata; 61 | if (source_srs.empty()) { 62 | try { 63 | source_modeldata.load_from_dir(in_location); 64 | } catch (scially::cgt_exception &e) { 65 | spdlog::error(e.what()); 66 | return -1; 67 | } 68 | } else { 69 | source_modeldata.load(source_srs, source_srs_origin); 70 | } 71 | 72 | if(transform_app->parsed()) { 73 | scially::osg_modeldata target_modeldata; 74 | target_modeldata.load(target_srs, target_srs_origin); 75 | 76 | scially::osg_transform transform(in_location, out_location); 77 | transform.set_source_metadata(source_modeldata); 78 | transform.set_target_metadata(target_modeldata); 79 | try { 80 | transform.run(thread); 81 | } catch (scially::cgt_exception &e) { 82 | spdlog::error(e.what()); 83 | return -1; 84 | } 85 | return 0; 86 | } 87 | 88 | if(export_app->parsed()) { 89 | scially::osg_export osg_export(in_location, out_location); 90 | osg_export.set_source_metadata(source_modeldata); 91 | try { 92 | osg_export.set_extent(shapefile); 93 | osg_export.run(thread); 94 | } catch (scially::cgt_exception &e) { 95 | spdlog::error(e.what()); 96 | return -1; 97 | } 98 | return 0; 99 | } 100 | 101 | return -1; 102 | } 103 | -------------------------------------------------------------------------------- /include/spdlog/details/udp_client-windows.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | // Helper RAII over winsock udp client socket. 7 | // Will throw on construction if socket creation failed. 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #pragma comment(lib, "Ws2_32.lib") 19 | #pragma comment(lib, "Mswsock.lib") 20 | #pragma comment(lib, "AdvApi32.lib") 21 | 22 | namespace spdlog { 23 | namespace details { 24 | class udp_client 25 | { 26 | static constexpr int TX_BUFFER_SIZE = 1024 * 10; 27 | SOCKET socket_ = INVALID_SOCKET; 28 | sockaddr_in addr_ = {0}; 29 | 30 | static void init_winsock_() 31 | { 32 | WSADATA wsaData; 33 | auto rv = ::WSAStartup(MAKEWORD(2, 2), &wsaData); 34 | if (rv != 0) 35 | { 36 | throw_winsock_error_("WSAStartup failed", ::WSAGetLastError()); 37 | } 38 | } 39 | 40 | static void throw_winsock_error_(const std::string &msg, int last_error) 41 | { 42 | char buf[512]; 43 | ::FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, last_error, 44 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, (sizeof(buf) / sizeof(char)), NULL); 45 | 46 | throw_spdlog_ex(fmt_lib::format("udp_sink - {}: {}", msg, buf)); 47 | } 48 | 49 | void cleanup_() 50 | { 51 | if (socket_ != INVALID_SOCKET) 52 | { 53 | ::closesocket(socket_); 54 | } 55 | socket_ = INVALID_SOCKET; 56 | ::WSACleanup(); 57 | } 58 | 59 | public: 60 | udp_client(const std::string &host, uint16_t port) 61 | { 62 | init_winsock_(); 63 | 64 | addr_.sin_family = PF_INET; 65 | addr_.sin_port = htons(port); 66 | addr_.sin_addr.s_addr = INADDR_ANY; 67 | if (InetPtonA(PF_INET, host.c_str(), &addr_.sin_addr.s_addr) != 1) 68 | { 69 | int last_error = ::WSAGetLastError(); 70 | ::WSACleanup(); 71 | throw_winsock_error_("error: Invalid address!", last_error); 72 | } 73 | 74 | socket_ = ::socket(PF_INET, SOCK_DGRAM, 0); 75 | if (socket_ == INVALID_SOCKET) 76 | { 77 | int last_error = ::WSAGetLastError(); 78 | ::WSACleanup(); 79 | throw_winsock_error_("error: Create Socket failed", last_error); 80 | } 81 | 82 | int option_value = TX_BUFFER_SIZE; 83 | if (::setsockopt(socket_, SOL_SOCKET, SO_SNDBUF, reinterpret_cast(&option_value), sizeof(option_value)) < 0) 84 | { 85 | int last_error = ::WSAGetLastError(); 86 | cleanup_(); 87 | throw_winsock_error_("error: setsockopt(SO_SNDBUF) Failed!", last_error); 88 | } 89 | } 90 | 91 | ~udp_client() 92 | { 93 | cleanup_(); 94 | } 95 | 96 | SOCKET fd() const 97 | { 98 | return socket_; 99 | } 100 | 101 | void send(const char *data, size_t n_bytes) 102 | { 103 | socklen_t tolen = sizeof(struct sockaddr); 104 | if (::sendto(socket_, data, static_cast(n_bytes), 0, (struct sockaddr *)&addr_, tolen) == -1) 105 | { 106 | throw_spdlog_ex("sendto(2) failed", errno); 107 | } 108 | } 109 | }; 110 | } // namespace details 111 | } // namespace spdlog 112 | -------------------------------------------------------------------------------- /Plugins/fbx/fbxMaterialToOsgStateSet.h: -------------------------------------------------------------------------------- 1 | #ifndef FBXMATERIALTOOSGSTATESET_H 2 | #define FBXMATERIALTOOSGSTATESET_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #if defined(_MSC_VER) 12 | #pragma warning( disable : 4505 ) 13 | #pragma warning( default : 4996 ) 14 | #endif 15 | #include 16 | 17 | //The only things we need to create a new StateSet are texture and materials. So we store that in a pair. 18 | //We Don't store directly in stateSet because getOrCreateStateSet function set some parameters. 19 | 20 | struct TextureDetails : public osg::Referenced 21 | { 22 | TextureDetails(); 23 | 24 | bool valid() const { return texture.valid(); } 25 | 26 | bool transparent() const; 27 | 28 | void assignTextureIfRequired(osg::StateSet* stateSet, unsigned int unit); 29 | void assignTexMatIfRequired(osg::StateSet* stateSet, unsigned int unit); 30 | 31 | std::string channel; 32 | osg::ref_ptr texture; 33 | double factor; 34 | osg::Vec2d scale; 35 | }; 36 | 37 | struct StateSetContent 38 | { 39 | StateSetContent() 40 | { 41 | } 42 | 43 | // texture units (eventually used for each texture map)... 44 | enum TextureUnit 45 | { 46 | DIFFUSE_TEXTURE_UNIT = 0, 47 | OPACITY_TEXTURE_UNIT, 48 | REFLECTION_TEXTURE_UNIT, 49 | EMISSIVE_TEXTURE_UNIT, 50 | AMBIENT_TEXTURE_UNIT, 51 | NORMAL_TEXTURE_UNIT, 52 | SPECULAR_TEXTURE_UNIT, 53 | SHININESS_TEXTURE_UNIT 54 | // more texture units here... 55 | }; 56 | 57 | 58 | 59 | osg::ref_ptr material; 60 | 61 | osg::ref_ptr diffuse; 62 | osg::ref_ptr opacity; 63 | osg::ref_ptr reflection; 64 | osg::ref_ptr emissive; 65 | osg::ref_ptr ambient; 66 | osg::ref_ptr normalMap; 67 | osg::ref_ptr specular; 68 | osg::ref_ptr shininess; 69 | }; 70 | 71 | //We use the pointers set by the importer to not duplicate materials and textures. 72 | typedef std::map FbxMaterialMap; 73 | 74 | //This map is used to not load the same image more than 1 time. 75 | typedef std::map ImageMap; 76 | 77 | class FbxMaterialToOsgStateSet 78 | { 79 | public: 80 | //Convert a FbxSurfaceMaterial to a osgMaterial and an osgTexture. 81 | StateSetContent convert(const FbxSurfaceMaterial* pFbxMat); 82 | 83 | //dir is the directory where fbx is stored (for relative path). 84 | FbxMaterialToOsgStateSet(const std::string& dir, const osgDB::Options* options, bool lightmapTextures) : 85 | _options(options), 86 | _dir(dir), 87 | _lightmapTextures(lightmapTextures){} 88 | 89 | void checkInvertTransparency(); 90 | 91 | private: 92 | //Convert a texture fbx to an osg texture. 93 | osg::ref_ptr fbxTextureToOsgTexture(const FbxFileTexture* pOsgTex); 94 | 95 | FbxFileTexture* selectFbxFileTexture(const FbxProperty& lProperty); 96 | 97 | TextureDetails* selectTextureDetails(const FbxProperty& lProperty); 98 | 99 | FbxMaterialMap _fbxMaterialMap; 100 | ImageMap _imageMap; 101 | const osgDB::Options* _options; 102 | const std::string _dir; 103 | bool _lightmapTextures; 104 | }; 105 | 106 | 107 | #endif //FBXMATERIALTOOSGSTATESET_H 108 | -------------------------------------------------------------------------------- /include/spdlog/spdlog-inl.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #ifndef SPDLOG_HEADER_ONLY 7 | # include 8 | #endif 9 | 10 | #include 11 | #include 12 | 13 | namespace spdlog { 14 | 15 | SPDLOG_INLINE void initialize_logger(std::shared_ptr logger) 16 | { 17 | details::registry::instance().initialize_logger(std::move(logger)); 18 | } 19 | 20 | SPDLOG_INLINE std::shared_ptr get(const std::string &name) 21 | { 22 | return details::registry::instance().get(name); 23 | } 24 | 25 | SPDLOG_INLINE void set_formatter(std::unique_ptr formatter) 26 | { 27 | details::registry::instance().set_formatter(std::move(formatter)); 28 | } 29 | 30 | SPDLOG_INLINE void set_pattern(std::string pattern, pattern_time_type time_type) 31 | { 32 | set_formatter(std::unique_ptr(new pattern_formatter(std::move(pattern), time_type))); 33 | } 34 | 35 | SPDLOG_INLINE void enable_backtrace(size_t n_messages) 36 | { 37 | details::registry::instance().enable_backtrace(n_messages); 38 | } 39 | 40 | SPDLOG_INLINE void disable_backtrace() 41 | { 42 | details::registry::instance().disable_backtrace(); 43 | } 44 | 45 | SPDLOG_INLINE void dump_backtrace() 46 | { 47 | default_logger_raw()->dump_backtrace(); 48 | } 49 | 50 | SPDLOG_INLINE level::level_enum get_level() 51 | { 52 | return default_logger_raw()->level(); 53 | } 54 | 55 | SPDLOG_INLINE bool should_log(level::level_enum log_level) 56 | { 57 | return default_logger_raw()->should_log(log_level); 58 | } 59 | 60 | SPDLOG_INLINE void set_level(level::level_enum log_level) 61 | { 62 | details::registry::instance().set_level(log_level); 63 | } 64 | 65 | SPDLOG_INLINE void flush_on(level::level_enum log_level) 66 | { 67 | details::registry::instance().flush_on(log_level); 68 | } 69 | 70 | SPDLOG_INLINE void flush_every(std::chrono::seconds interval) 71 | { 72 | details::registry::instance().flush_every(interval); 73 | } 74 | 75 | SPDLOG_INLINE void set_error_handler(void (*handler)(const std::string &msg)) 76 | { 77 | details::registry::instance().set_error_handler(handler); 78 | } 79 | 80 | SPDLOG_INLINE void register_logger(std::shared_ptr logger) 81 | { 82 | details::registry::instance().register_logger(std::move(logger)); 83 | } 84 | 85 | SPDLOG_INLINE void apply_all(const std::function)> &fun) 86 | { 87 | details::registry::instance().apply_all(fun); 88 | } 89 | 90 | SPDLOG_INLINE void drop(const std::string &name) 91 | { 92 | details::registry::instance().drop(name); 93 | } 94 | 95 | SPDLOG_INLINE void drop_all() 96 | { 97 | details::registry::instance().drop_all(); 98 | } 99 | 100 | SPDLOG_INLINE void shutdown() 101 | { 102 | details::registry::instance().shutdown(); 103 | } 104 | 105 | SPDLOG_INLINE void set_automatic_registration(bool automatic_registration) 106 | { 107 | details::registry::instance().set_automatic_registration(automatic_registration); 108 | } 109 | 110 | SPDLOG_INLINE std::shared_ptr default_logger() 111 | { 112 | return details::registry::instance().default_logger(); 113 | } 114 | 115 | SPDLOG_INLINE spdlog::logger *default_logger_raw() 116 | { 117 | return details::registry::instance().get_default_raw(); 118 | } 119 | 120 | SPDLOG_INLINE void set_default_logger(std::shared_ptr default_logger) 121 | { 122 | details::registry::instance().set_default_logger(std::move(default_logger)); 123 | } 124 | 125 | } // namespace spdlog 126 | -------------------------------------------------------------------------------- /include/spdlog/sinks/mongo_sink.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | // 7 | // Custom sink for mongodb 8 | // Building and using requires mongocxx library. 9 | // For building mongocxx library check the url below 10 | // http://mongocxx.org/mongocxx-v3/installation/ 11 | // 12 | 13 | #include "spdlog/common.h" 14 | #include "spdlog/details/log_msg.h" 15 | #include "spdlog/sinks/base_sink.h" 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace spdlog { 27 | namespace sinks { 28 | template 29 | class mongo_sink : public base_sink 30 | { 31 | public: 32 | mongo_sink(const std::string &db_name, const std::string &collection_name, const std::string &uri = "mongodb://localhost:27017") 33 | { 34 | try 35 | { 36 | client_ = spdlog::details::make_unique(mongocxx::uri{uri}); 37 | db_name_ = db_name; 38 | coll_name_ = collection_name; 39 | } 40 | catch (const std::exception) 41 | { 42 | throw spdlog_ex("Error opening database"); 43 | } 44 | } 45 | 46 | ~mongo_sink() 47 | { 48 | flush_(); 49 | } 50 | 51 | protected: 52 | void sink_it_(const details::log_msg &msg) override 53 | { 54 | using bsoncxx::builder::stream::document; 55 | using bsoncxx::builder::stream::finalize; 56 | 57 | if (client_ != nullptr) 58 | { 59 | auto doc = document{} << "timestamp" << bsoncxx::types::b_date(msg.time) << "level" << level::to_string_view(msg.level).data() 60 | << "message" << std::string(msg.payload.begin(), msg.payload.end()) << "logger_name" 61 | << std::string(msg.logger_name.begin(), msg.logger_name.end()) << "thread_id" 62 | << static_cast(msg.thread_id) << finalize; 63 | client_->database(db_name_).collection(coll_name_).insert_one(doc.view()); 64 | } 65 | } 66 | 67 | void flush_() override {} 68 | 69 | private: 70 | static mongocxx::instance instance_; 71 | std::string db_name_; 72 | std::string coll_name_; 73 | std::unique_ptr client_ = nullptr; 74 | }; 75 | template<> 76 | mongocxx::instance mongo_sink::instance_{}; 77 | 78 | #include "spdlog/details/null_mutex.h" 79 | #include 80 | using mongo_sink_mt = mongo_sink; 81 | using mongo_sink_st = mongo_sink; 82 | 83 | } // namespace sinks 84 | 85 | template 86 | inline std::shared_ptr mongo_logger_mt(const std::string &logger_name, const std::string &db_name, 87 | const std::string &collection_name, const std::string &uri = "mongodb://localhost:27017") 88 | { 89 | return Factory::template create(logger_name, db_name, collection_name, uri); 90 | } 91 | 92 | template 93 | inline std::shared_ptr mongo_logger_st(const std::string &logger_name, const std::string &db_name, 94 | const std::string &collection_name, const std::string &uri = "mongodb://localhost:27017") 95 | { 96 | return Factory::template create(logger_name, db_name, collection_name, uri); 97 | } 98 | 99 | } // namespace spdlog 100 | -------------------------------------------------------------------------------- /include/spdlog/cfg/helpers-inl.h: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 3 | 4 | #pragma once 5 | 6 | #ifndef SPDLOG_HEADER_ONLY 7 | # include 8 | #endif 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | namespace spdlog { 20 | namespace cfg { 21 | namespace helpers { 22 | 23 | // inplace convert to lowercase 24 | inline std::string &to_lower_(std::string &str) 25 | { 26 | std::transform( 27 | str.begin(), str.end(), str.begin(), [](char ch) { return static_cast((ch >= 'A' && ch <= 'Z') ? ch + ('a' - 'A') : ch); }); 28 | return str; 29 | } 30 | 31 | // inplace trim spaces 32 | inline std::string &trim_(std::string &str) 33 | { 34 | const char *spaces = " \n\r\t"; 35 | str.erase(str.find_last_not_of(spaces) + 1); 36 | str.erase(0, str.find_first_not_of(spaces)); 37 | return str; 38 | } 39 | 40 | // return (name,value) trimmed pair from given "name=value" string. 41 | // return empty string on missing parts 42 | // "key=val" => ("key", "val") 43 | // " key = val " => ("key", "val") 44 | // "key=" => ("key", "") 45 | // "val" => ("", "val") 46 | 47 | inline std::pair extract_kv_(char sep, const std::string &str) 48 | { 49 | auto n = str.find(sep); 50 | std::string k, v; 51 | if (n == std::string::npos) 52 | { 53 | v = str; 54 | } 55 | else 56 | { 57 | k = str.substr(0, n); 58 | v = str.substr(n + 1); 59 | } 60 | return std::make_pair(trim_(k), trim_(v)); 61 | } 62 | 63 | // return vector of key/value pairs from sequence of "K1=V1,K2=V2,.." 64 | // "a=AAA,b=BBB,c=CCC,.." => {("a","AAA"),("b","BBB"),("c", "CCC"),...} 65 | inline std::unordered_map extract_key_vals_(const std::string &str) 66 | { 67 | std::string token; 68 | std::istringstream token_stream(str); 69 | std::unordered_map rv{}; 70 | while (std::getline(token_stream, token, ',')) 71 | { 72 | if (token.empty()) 73 | { 74 | continue; 75 | } 76 | auto kv = extract_kv_('=', token); 77 | rv[kv.first] = kv.second; 78 | } 79 | return rv; 80 | } 81 | 82 | SPDLOG_INLINE void load_levels(const std::string &input) 83 | { 84 | if (input.empty() || input.size() > 512) 85 | { 86 | return; 87 | } 88 | 89 | auto key_vals = extract_key_vals_(input); 90 | std::unordered_map levels; 91 | level::level_enum global_level = level::info; 92 | bool global_level_found = false; 93 | 94 | for (auto &name_level : key_vals) 95 | { 96 | auto &logger_name = name_level.first; 97 | auto level_name = to_lower_(name_level.second); 98 | auto level = level::from_str(level_name); 99 | // ignore unrecognized level names 100 | if (level == level::off && level_name != "off") 101 | { 102 | continue; 103 | } 104 | if (logger_name.empty()) // no logger name indicate global level 105 | { 106 | global_level_found = true; 107 | global_level = level; 108 | } 109 | else 110 | { 111 | levels[logger_name] = level; 112 | } 113 | } 114 | 115 | details::registry::instance().set_levels(std::move(levels), global_level_found ? &global_level : nullptr); 116 | } 117 | 118 | } // namespace helpers 119 | } // namespace cfg 120 | } // namespace spdlog 121 | --------------------------------------------------------------------------------