### Install Targets: rtkconv (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/winapp/rtkconv/CMakeLists.txt This CMake 'install' command defines how the 'rtkconv' target should be installed. It specifies that the runtime executable should be placed in the 'bin' directory, and libraries/archives in the 'lib' directory relative to the installation prefix. ```cmake install(TARGETS rtkconv RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) ``` -------------------------------- ### Install rtknavi_qt Executable and Desktop Entry (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/qtapp/rtknavi_qt/CMakeLists.txt This CMake code defines installation rules for the 'rtknavi_qt' executable and its associated desktop entry and icon. The executable is installed to the 'bin' directory. On Unix-like systems, a .desktop file and an icon are installed to standard user application directories. ```cmake install(TARGETS rtknavi_qt RUNTIME DESTINATION bin) if (UNIX) install(FILES rtknavi_qt.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) install(FILES ../icon/rtknavi.png DESTINATION ${XDG_APPS_PIXMAPS_DIR}) endif() ``` -------------------------------- ### Install rtkpost Target (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/winapp/rtkpost/CMakeLists.txt Defines installation rules for the 'rtkpost' target using CMake. This specifies where the runtime executables, static libraries, and dynamic libraries should be placed on the system after installation. ```cmake install(TARGETS rtkpost RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) ``` -------------------------------- ### Install RTKNavi Target (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/winapp/rtknavi/CMakeLists.txt Defines the installation rules for the RTKNavi target. This CMake command specifies that the runtime binary should be placed in 'bin', and libraries/archives in 'lib' when the project is installed. ```cmake install(TARGETS rtknavi RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) ``` -------------------------------- ### Install Executable Target (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/winapp/rtkplot/CMakeLists.txt Defines installation rules for the 'rtkplot' target. It specifies that the runtime executable should be placed in the 'bin' directory, and both static and dynamic libraries (if any were generated) should go into the 'lib' directory. ```cmake install(TARGETS rtkplot RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) ``` -------------------------------- ### Install srctblbrows_qt Executable and Desktop Files Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/qtapp/srctblbrows_qt/CMakeLists.txt Installs the 'srctblbrows_qt' executable to the bin directory. On Unix-like systems, it also installs a desktop entry file and an icon, making the application discoverable in desktop environments. ```cmake install(TARGETS srctblbrows_qt RUNTIME DESTINATION bin) if (UNIX) install(FILES srctblbrows_qt.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) install(FILES ../icon/srctblbrows.png DESTINATION ${XDG_APPS_PIXMAPS_DIR}) endif() ``` -------------------------------- ### CMake: Add Executable and Link Libraries for rtklaunch_qt Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/qtapp/rtklaunch_qt/CMakeLists.txt Defines the 'rtklaunch_qt' executable, lists its source and UI files, and links necessary libraries including 'rtklib' and Qt modules. It also sets properties for Windows and macOS executables and specifies runtime installation. ```cmake add_executable(rtklaunch_qt launchmain.cpp main.cpp launchoptdlg.cpp launchmain.ui launchoptdlg.ui ../appcmn_qt/appcmn_qt.qrc ../icon/resources.qrc ) if(QT_VERSION GREATER_EQUAL 6.5) qt_add_translations(rtklaunch_qt SOURCE_TARGETS rtklaunch_qt INCLUDE_DIRECTORIES . ..appcmn_qt ) endif() target_link_libraries(rtklaunch_qt PRIVATE rtklib Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets) set_target_properties(rtklaunch_qt PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON ) install(TARGETS rtklaunch_qt RUNTIME DESTINATION bin) if (UNIX) install(FILES rtklaunch_qt.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) install(FILES ../icon/rtklaunch.png DESTINATION ${XDG_APPS_PIXMAPS_DIR}) endif() ``` -------------------------------- ### Initialize Google Earth Plugin and Options Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/qtapp/rtkplot_qt/rtklib_ge.htm Initializes the Google Earth plugin instance and configures various viewer options such as camera speed, atmosphere visibility, and mouse navigation. It also sets up initial placemarks and track lines, and starts a periodic update interval. ```javascript var ge = null; var mark1,mark2,track1,track2,points,altmode; var mark_icon1="http://maps.google.com/mapfiles/kml/paddle/ylw-circle.png"; var mark_icon2="http://maps.google.com/mapfiles/kml/paddle/red-circle.png"; var mark_icon3="http://maps.google.com/mapfiles/kml/paddle/wht-circle.png"; function init() { google.earth.createInstance("map3d",initCallback,failureCallback); } function initCallback(instance) { ge = instance; var opt = ge.getOptions(); opt.setFlyToSpeed(ge.SPEED_TELEPORT); opt.setAtmosphereVisibility(false); opt.setMouseNavigationEnabled(true); opt.setBuildingSelectionEnabled(false); opt.setAutoGroundLevelViewEnabled(false); mark1 = GenMark('1',mark_icon1); mark2 = GenMark('2',mark_icon2); track1 = GenLine('track1','cc00ffff'); track2 = GenLine('track2','cc0044ff'); points = new Array(); altmode = ge.ALTITUDE_CLAMP_TO_GROUND; ge.getWindow().setVisibility(true); document.getElementById('state').value='1'; setInterval("UpdateState()",250); } function failureCallback(errcode) { document.write('

Google Earth Plugin load error

'); document.getElementById('state').value='-1'; } ``` -------------------------------- ### Link Libraries: rtkconv (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/winapp/rtkconv/CMakeLists.txt This CMake command 'target_link_libraries' links the 'rtkconv.res' resource file as a private dependency to the 'rtkconv' target. Resource files often contain application icons, dialog templates, or other UI elements. ```cmake target_link_libraries(rtkconv PRIVATE rtkconv.res) ``` -------------------------------- ### Configure and Execute RTKLIB Post-Processing (C) Source: https://context7.com/rtklibexplorer/rtklib/llms.txt This C code snippet demonstrates the setup and execution of RTKLIB's batch post-processing. It configures processing and solution options, specifies input and output files, and calls the `postpos` function. Dependencies include the RTKLIB library (`rtklib.h`). Input consists of RINEX observation files, navigation files, and optional precise products. Output is a solution file (e.g., .pos). ```c #include "rtklib.h" int main() { prcopt_t prcopt = prcopt_default; solopt_t solopt = solopt_default; filopt_t filopt = {0}; const char *infiles[MAXINFILE]; char outfile[1024]; gtime_t ts = {0}, te = {0}; /* process all data */ double ti = 0.0; /* time interval (0=all) */ double tu = 0.0; /* time unit for progress (0=all) */ int nfiles = 0; int ret; /* Configure processing options for static RTK */ prcopt.mode = PMODE_STATIC; /* static positioning */ prcopt.soltype = 2; /* combined forward/backward */ prcopt.nf = 2; /* L1+L2 */ prcopt.navsys = SYS_GPS | SYS_GLO; /* GPS + GLONASS */ prcopt.elmin = 15.0 * D2R; /* 15° elevation mask */ prcopt.modear = ARMODE_FIX_AND_HOLD; /* fix and hold AR */ prcopt.glomodear = 1; /* GLONASS AR */ prcopt.thresar[0] = 3.0; /* ratio test threshold */ prcopt.ionoopt = IONOOPT_BRDC; /* broadcast iono */ prcopt.tropopt = TROPOPT_SAAS; /* Saastamoinen tropo */ prcopt.dynamics = 0; /* static */ prcopt.tidecorr = 1; /* solid earth tide */ /* Solution output options */ solopt.posf = SOLF_LLH; /* lat/lon/height */ solopt.times = TIMES_GPST; /* GPS time */ solopt.timef = 1; /* yyyy/mm/dd hh:mm:ss.ss */ solopt.degf = 0; /* degrees in decimal */ solopt.outhead = 1; /* output header */ solopt.outopt = 1; /* output processing options */ solopt.outvel = 0; /* no velocity output */ solopt.datum = 0; /* WGS84 */ solopt.height = 0; /* ellipsoidal height */ solopt.sstat = 5; /* full solution statistics */ /* File options - precise products */ strcpy(filopt.satantp, "igs14.atx"); /* satellite antenna PCV */ strcpy(filopt.rcvantp, "igs14.atx"); /* receiver antenna PCV */ strcpy(filopt.stapos, ""); /* station positions */ strcpy(filopt.geoid, "egm2008.grd"); /* geoid model */ strcpy(filopt.dcb, "CAS0MGXRAP.DCB"); /* code biases */ /* Input files */ infiles[nfiles++] = "rover_static.obs"; /* rover RINEX obs */ infiles[nfiles++] = "base_static.obs"; /* base RINEX obs */ infiles[nfiles++] = "brdc_daily.nav"; /* broadcast nav */ infiles[nfiles++] = "brdc_daily.gnav"; /* GLONASS nav */ /* Optional: Add precise products for higher accuracy */ /* infiles[nfiles++] = "igs21544.sp3"; /* precise orbits */ /* infiles[nfiles++] = "igs21544.clk"; /* precise clocks */ /* infiles[nfiles++] = "igsg2150.i"; /* ionosphere TEC */ /* Output file */ strcpy(outfile, "solution_static.pos"); /* Set time window (optional) */ /* ts = epoch2time((double[]){2024, 1, 15, 0, 0, 0}); /* te = epoch2time((double[]){2024, 1, 15, 6, 0, 0}); /* ti = 30.0; /* process at 30s intervals */ printf("Post-processing configuration:\n"); printf(" Mode: %s\n", prcopt.mode == PMODE_STATIC ? "Static" : "Kinematic"); printf(" Solution: %s\n", prcopt.soltype == 0 ? "Forward" : prcopt.soltype == 1 ? "Backward" : "Combined"); printf(" Frequencies: %d\n", prcopt.nf); printf(" Elevation mask: %.1f°\n", prcopt.elmin * R2D); printf(" Input files: %d\n", nfiles); printf("\nProcessing...\n"); /* Execute post-processing */ ret = postpos(ts, te, ti, tu, &prcopt, &solopt, &filopt, infiles, nfiles, outfile, "", ""); if (ret == 0) { printf("\nPost-processing completed successfully!\n"); printf("Output file: %s\n", outfile); /* Parse output file to get statistics */ FILE *fp = fopen(outfile, "r"); if (fp) { char line[1024]; int nfix = 0, nfloat = 0, nsingle = 0, total = 0; while (fgets(line, sizeof(line), fp)) { if (line[0] == '%' || line[0] == '\n') continue; /* Parse solution quality (column 6 in standard output) */ int q; if (sscanf(line, "%*s %*s %*s %*s %*s %d", &q) == 1) { total++; if (q == 1) nfix++; else if (q == 2) nfloat++; else if (q == 5) nsingle++; } } fclose(fp); if (total > 0) { printf("\nSolution Statistics:\n"); ``` -------------------------------- ### Add Executable: rtkconv (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/winapp/rtkconv/CMakeLists.txt This snippet defines the 'rtkconv' executable using CMake's 'add_executable' command. It lists all the C++ source files required to build the executable, including files from the main directory and the '../appcmn' subdirectory. The 'WIN32' flag indicates it's a Windows-specific executable. ```cmake add_executable(rtkconv WIN32 codeopt.cpp convmain.cpp convopt.cpp rtkconv.cpp startdlg.cpp ../appcmn/aboutdlg.cpp ../appcmn/confdlg.cpp ../appcmn/freqdlg.cpp ../appcmn/glofcndlg.cpp ../appcmn/keydlg.cpp ../appcmn/timedlg.cpp ../appcmn/viewer.cpp ../appcmn/vieweropt.cpp ) ``` -------------------------------- ### Set Include Directories: rtkconv (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/winapp/rtkconv/CMakeLists.txt This CMake command 'target_include_directories' specifies that the current directory '.' should be added as a private include directory for the 'rtkconv' target. This allows the compiler to find header files located in the same directory as the source files. ```cmake target_include_directories(rtkconv PRIVATE .) ``` -------------------------------- ### RTKLIB: rnx2rtkp Command-Line Example Source: https://context7.com/rtklibexplorer/rtklib/llms.txt This snippet demonstrates the command-line usage of the rnx2rtkp application for static post-processing of GNSS data. It specifies configuration options such as the configuration file, processing mode, elevation mask, frequencies, satellite systems, solution type, and output file. ```bash rnx2rtkp -k config.conf -p 3 -m 15 -f 2 -sys GR -v 2 \ -o solution_static.pos \ rover_static.obs base_static.obs brdc_daily.nav ``` -------------------------------- ### CMake: Configure Qt GUI Application Build Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/qtapp/CMakeLists.txt This snippet sets up the build environment for Qt GUI applications within the RTKLIB Explorer project. It defines output paths for executables and installs directories, includes necessary source directories, and finds required and optional Qt components. It also enables automatic build system generation for Qt-specific features like moc, rcc, and uic. ```cmake set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) set(XDG_APPS_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/applications") set(XDG_APPS_PIXMAPS_DIR "${CMAKE_INSTALL_DATAROOTDIR}/icons/") include_directories( ${PROJECT_SOURCE_DIR}/src appcmn_qt widgets_qt ) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) message(STATUS "Qt: Using Qt Version ${QT_VERSION_MAJOR}") find_package(Qt${QT_VERSION_MAJOR} NO_MODULE REQUIRED COMPONENTS Gui Widgets Concurrent Xml SerialPort) find_package( Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS WebEngineWidgets WebKitWidgets LinguistTools ) if((${Qt5WebEngineWidgets_FOUND}) OR (${Qt6WebEngineWidgets_FOUND})) message(STATUS "Qt: Found optional QtWebEngine") add_definitions(-DQWEBENGINE) else() if((${Qt5WebKitWidgets_FOUND}) OR (${Qt6WebKitWidgets_FOUND})) message(STATUS "Qt: Found optional QtWebKit") add_definitions(-DQWEBKIT) endif() endif() set(CMAKE_AUTOMOC TRUE) set(CMAKE_AUTORCC TRUE) set(CMAKE_AUTOUIC TRUE) ``` -------------------------------- ### CMake: Project Setup and Library Definition Source: https://github.com/rtklibexplorer/rtklib/blob/main/src/CMakeLists.txt Configures project-wide settings, source directories, and defines the main RTKLIB shared library. It includes conditional definitions for Windows DLLs and standard C version. ```cmake include_directories(.) set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) if(WIN32) add_definitions(-DWIN_DLL) else() add_definitions(-DDLL) endif() aux_source_directory(. DIR_SRCS_RTKLIB) set(DIR_SRCS_RTKLIB_RCV ${DIR_SRCS_RTKLIB_RCV} rcv/binex.c rcv/crescent.c rcv/javad.c rcv/novatel.c rcv/nvs.c rcv/rt17.c rcv/septentrio.c rcv/skytraq.c rcv/swiftnav.c rcv/ublox.c rcv/unicore.c ) list(APPEND DIR_SRCS ${DIR_SRCS_RTKLIB} ${DIR_SRCS_RTKLIB_RCV}) add_library(rtklib SHARED ${DIR_SRCS} rtklib.h) set_property(TARGET rtklib PROPERTY C_STANDARD 99) ``` -------------------------------- ### Set Target Type: rtkconv (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/winapp/rtkconv/CMakeLists.txt This CMake command 'set_embt_target' is used to configure the build target for 'rtkconv' specifically for an embedded system with VCL (Visual Component Library) support. This is typically used in embedded development environments. ```cmake set_embt_target(rtkconv VCL) ``` -------------------------------- ### str2str: Serial to NTRIP Client Output (Test) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/consapp/CMakeLists.txt This example configures str2str to read from a serial port and stream data to an NTRIP caster. It requires authentication credentials and a command file. ```bash #add_test(NAME str2str_test3 COMMAND str2str -in serial://${STR2STR_DEVICE} -out ntrips://:sesam@localhost:8000/BUCU0 -c ../../../data/oem4_raw_10hz.cmd -t 5) ``` -------------------------------- ### RTKLIB: rnx2rtkp C Code Example (Output) Source: https://context7.com/rtklibexplorer/rtklib/llms.txt This C code snippet illustrates how the rnx2rtkp application might print post-processing results to standard output. It shows the total number of epochs processed and the count and percentage of fixed, float, and single solutions. ```c printf(" Total epochs: %d\n", total); printf(" Fixed: %d (%.1f%%)\n", nfix, 100.0*nfix/total); printf(" Float: %d (%.1f%%)\n", nfloat, 100.0*nfloat/total); printf(" Single: %d (%.1f%%)\n", nsingle, 100.0*nsingle/total); ``` -------------------------------- ### RTKLIB API Modification Example (C) Source: https://github.com/rtklibexplorer/rtklib/blob/main/doc/relnote_2.4.2.htm This snippet shows an example of a modified API function in RTKLIB version 2.4.2, specifically `obs2code()`. The documentation indicates that this function, along with others like `code2obs()`, `antmodel()`, `readrnx()`, `readrnxt()`, `readsp3()`, `eci2ecef()`, and `sunmoonpos()`, have undergone modifications. ```c // Example of a modified function signature (actual modification not shown in release notes) // original function signature might be different char* obs2code(obs_t *obs, int *sp); // Other modified functions listed: // code2obs() // antmodel() // readrnx() // readrnxt() // readsp3() // eci2ecef() // sunmoonpos() ``` -------------------------------- ### str2str: GPS File to Specific RTCM3 Conversion (Test) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/consapp/CMakeLists.txt This example focuses on converting a GPS file to RTCM3 format, specifically extracting only the 1097 message with a 10-second interval. ```bash #add_test(NAME str2str_test5 COMMAND str2str -in ../oem6_20121107.gps nov -out oem6_20121107_gal.rtcm3 rtcm3 -msg "1097(10)") ``` -------------------------------- ### Configure Include Directories and Libraries (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/winapp/rtkpost/CMakeLists.txt Sets up include directories and links libraries for the 'rtkpost' target. 'target_include_directories' adds the current directory to the include path, while 'target_link_libraries' links the 'rtkpost.res' resource file. ```cmake target_include_directories(rtkpost PRIVATE .) target_link_libraries(rtkpost PRIVATE rtkpost.res) ``` -------------------------------- ### str2str: Serial to File Output (Test) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/consapp/CMakeLists.txt This example demonstrates using str2str to read data from a serial port and write it to a file. This is useful for logging or debugging serial data streams. ```bash #add_test(NAME str2str_test1 COMMAND str2str -in serial://${STR2STR_DEVICE} -out file://test1.out -t 2) ``` -------------------------------- ### Google Earth Initialization (JavaScript) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/qtapp/rtkplot_qt/rtklib_ge.htm Loads the Google Earth plugin and sets up a callback function for initialization. This is a standard pattern for integrating Google Earth into a web page. ```javascript google.load("earth","1"); google.setOnLoadCallback(init); ``` -------------------------------- ### Add Executable and Link Libraries (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/qtapp/rtkget_qt/CMakeLists.txt Defines the 'rtkget_qt' executable, lists its source files (C++ and UI), specifies Qt translations if the version is 6.5 or greater, and links necessary libraries like 'rtklib' and Qt modules. It also sets target properties for Windows and macOS executables. ```cmake add_executable(rtkget_qt main.cpp getmain.cpp getoptdlg.cpp getmain.ui getoptdlg.ui ../appcmn_qt/staoptdlg.cpp ../appcmn_qt/aboutdlg.cpp ../appcmn_qt/keydlg.cpp ../appcmn_qt/viewer.cpp ../appcmn_qt/vieweropt.cpp ../appcmn_qt/helper.cpp ../appcmn_qt/timedlg.cpp ../appcmn_qt/staoptdlg.ui ../appcmn_qt/aboutdlg.ui ../appcmn_qt/keydlg.ui ../appcmn_qt/viewer.ui ../appcmn_qt/vieweropt.ui ../appcmn_qt/timedlg.ui ../appcmn_qt/appcmn_qt.qrc ../icon/resources.qrc ) if(QT_VERSION GREATER_EQUAL 6.5) qt_add_translations(rtkget_qt SOURCE_TARGETS rtkget_qt INCLUDE_DIRECTORIES . ..appcmn_qt ) endif() target_link_libraries(rtkget_qt PRIVATE rtklib Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets) set_target_properties(rtkget_qt PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON ) install(TARGETS rtkget_qt RUNTIME DESTINATION bin) if (UNIX) install(FILES rtkget_qt.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) install(FILES ../icon/rtkget.png DESTINATION ${XDG_APPS_PIXMAPS_DIR}) endif() ``` -------------------------------- ### Set Target Properties for rtknavi_qt (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/qtapp/rtknavi_qt/CMakeLists.txt These CMake commands set platform-specific properties for the 'rtknavi_qt' target. WIN32_EXECUTABLE ON ensures it runs as a standalone executable on Windows, and MACOSX_BUNDLE ON creates an application bundle on macOS. ```cmake set_target_properties(rtknavi_qt PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON ) ``` -------------------------------- ### Define RTKNavi Executable (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/winapp/rtknavi/CMakeLists.txt Configures the RTKNavi executable by listing its source files. This CMake command specifies all the C++ files required to build the RTKNavi application, including those in the main directory and the '../appcmn' subdirectory. ```cmake add_executable(rtknavi WIN32 instrdlg.cpp logstrdlg.cpp mapdlg.cpp markdlg.cpp mondlg.cpp navimain.cpp naviopt.cpp outstrdlg.cpp rcvoptdlg.cpp rtknavi.cpp ../appcmn/aboutdlg.cpp ../appcmn/cmdoptdlg.cpp ../appcmn/confdlg.cpp ../appcmn/fileoptdlg.cpp ../appcmn/freqdlg.cpp ../appcmn/ftpoptdlg.cpp ../appcmn/graph.cpp ../appcmn/keydlg.cpp ../appcmn/mntpoptdlg.cpp ../appcmn/refdlg.cpp ../appcmn/serioptdlg.cpp ../appcmn/tcpoptdlg.cpp ../appcmn/viewer.cpp ../appcmn/vieweropt.cpp ) ``` -------------------------------- ### Define rtknavi_qt Executable (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/qtapp/rtknavi_qt/CMakeLists.txt This CMake command defines the 'rtknavi_qt' executable and lists all its source files, including C++ files, UI files, and Qt resource files. It also includes files from other subdirectories like 'appcmn_qt' and 'widgets_qt'. ```cmake add_executable(rtknavi_qt main.cpp mondlg.cpp instrdlg.cpp logstrdlg.cpp navimain.cpp outstrdlg.cpp rcvoptdlg.cpp #mapdlg.cpp markdlg.cpp instrdlg.ui logstrdlg.ui navimain.ui outstrdlg.ui rcvoptdlg.ui mondlg.ui #mapdlg.ui markdlg.ui ../appcmn_qt/aboutdlg.cpp ../appcmn_qt/cmdoptdlg.cpp ../appcmn_qt/fileoptdlg.cpp ../appcmn_qt/ftpoptdlg.cpp ../appcmn_qt/keydlg.cpp ../appcmn_qt/labelstretcher.cpp ../appcmn_qt/maskoptdlg.cpp ../appcmn_qt/refdlg.cpp ../appcmn_qt/serioptdlg.cpp ../appcmn_qt/mntpoptdlg.cpp ../appcmn_qt/tcpoptdlg.cpp ../appcmn_qt/viewer.cpp ../appcmn_qt/vieweropt.cpp ../appcmn_qt/freqdlg.cpp ../appcmn_qt/helper.cpp ../appcmn_qt/graph.cpp #../appcmn_qt/pntdlg.cpp ../appcmn_qt/navi_post_opt.cpp ../widgets_qt/doubleunitvalidator.cpp ../widgets_qt/intunitvalidator.cpp ../widgets_qt/scientificspinbox.cpp ../widgets_qt/excludedsatellitevalidator.cpp ../appcmn_qt/navi_post_opt.ui ../appcmn_qt/aboutdlg.ui ../appcmn_qt/cmdoptdlg.ui ../appcmn_qt/fileoptdlg.ui ../appcmn_qt/ftpoptdlg.ui ../appcmn_qt/keydlg.ui ../appcmn_qt/maskoptdlg.ui ../appcmn_qt/refdlg.ui ../appcmn_qt/serioptdlg.ui ../appcmn_qt/viewer.ui ../appcmn_qt/vieweropt.ui ../appcmn_qt/tcpoptdlg.ui ../appcmn_qt/mntpoptdlg.ui #../appcmn_qt/pntdlg.ui ../appcmn_qt/freqdlg.ui ../appcmn_qt/appcmn_qt.qrc ../icon/resources.qrc ) ``` -------------------------------- ### RTKCONV RINEX 3 Compliance (C) Source: https://github.com/rtklibexplorer/rtklib/blob/main/doc/relnote_2.4.2.htm This code example illustrates the implementation of full RINEX 3 compliance within the RTKCONV utility. This includes support for multiple codes within a single frequency, which is a key feature of the RINEX 3 standard, enabling more flexible and accurate data handling. ```c // Feature: Full RINEX 3 compliance in RTKCONV // Support for multiple codes in a frequency: // Assuming a data structure for observations: // typedef struct { // double L1, L2, ...; // Carrier phase measurements // double P1, P2, ...; // Pseudorange measurements // char code1[20], code2[20]; // Codes for L1, L2 // } observation_t; // Function to write RINEX 3 file: // void write_rinex_3(FILE *fp, observation_t obs) { // // Write header compatible with RINEX 3.0x // fprintf(fp, "%% <#SVs>\n"); // // ... (other header fields) // // Write observation data, handling multiple codes per frequency // fprintf(fp, " %c%c%c %s %02d %02d %02d %02d %02d %010.7f %04d %02d\n", // obs.sat[0], obs.sys[0], obs.code1[0], obs.time.tag, ...); // if (strlen(obs.code2) > 0) { // fprintf(fp, " %c%c%c %s %02d %02d %02d %02d %02d %010.7f %04d %02d\n", // obs.sat[0], obs.sys[0], obs.code2[0], obs.time.tag, ...); // } // // ... (repeat for other satellites and frequencies) // } ``` -------------------------------- ### Add Marker to Map Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/winapp/rtkplot/rtkplot_gm.htm Adds a new marker to the Google Map at a specified latitude and longitude with a given title and message for the info window. It assigns different icons based on the marker title ('SOL2' gets a red icon). Includes an event listener for click events to open an info window. ```javascript function AddMark(lat,lon,title,msg) { var pos = new google.maps.LatLng(lat,lon); var opt = {map: map, position: pos, title: title, icon: icon0}; var mark = new google.maps.Marker(opt); if (title == "SOL2") mark.setIcon(icon1); google.maps.event.addListener(mark,'click',function(event) { if (info) { info.close(); } info = new google.maps.InfoWindow({content: msg}); info.open(mark.getMap(),mark); }); marks.push(mark); } ``` -------------------------------- ### Initialize Google Map with Options Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/qtapp/rtkplot_qt/rtklib_gm.htm Initializes a new Google Map instance with specified options like center, zoom level, and map type. It requires a 'map' div element in the HTML and the Google Maps API to be loaded. Sets the initial state of the map. ```javascript var map = null; var marks = []; var markh = null; var markz = 0; var info = null; var icon0="http://maps.google.co.jp/mapfiles/ms/icons/red-dot.png"; var icon1="http://maps.google.co.jp/mapfiles/ms/icons/yellow-dot.png"; function init() { var opt = { center: new google.maps.LatLng(0,0), zoom: 2, minZoom: 2, streetViewControl: false, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map"), opt); document.getElementById('state').value='1'; } ``` -------------------------------- ### Add Executable and Source Files for srctblbrows_qt Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/qtapp/srctblbrows_qt/CMakeLists.txt Defines the 'srctblbrows_qt' executable and lists its C++ source files, UI files, and resource files. This is a standard CMake command to compile and link a target executable. ```cmake add_executable(srctblbrows_qt browsmain.cpp srctblbrows.cpp browsmain.ui ../appcmn_qt/staoptdlg.cpp ../appcmn_qt/mapview.cpp ../appcmn_qt/mapviewopt.cpp ../appcmn_qt/aboutdlg.cpp ../appcmn_qt/helper.cpp ../appcmn_qt/mntpoptdlg.cpp ../appcmn_qt/viewer.cpp ../appcmn_qt/vieweropt.cpp ../appcmn_qt/staoptdlg.ui ../appcmn_qt/mapview.ui ../appcmn_qt/mapviewopt.ui ../appcmn_qt/aboutdlg.ui ../appcmn_qt/mntpoptdlg.ui ../appcmn_qt/viewer.ui ../appcmn_qt/vieweropt.ui ../appcmn_qt/appcmn_qt.qrc ../icon/resources.qrc ) ``` -------------------------------- ### Coordinate Transformations (ECEF, Geodetic, ENU) - C Source: https://context7.com/rtklibexplorer/rtklib/llms.txt Demonstrates coordinate transformations between ECEF, geodetic (latitude, longitude, height), and local ENU (East-North-Up) frames using RTKLIB functions. It includes examples for direct conversion, baseline vector calculation, and covariance matrix transformation. Requires the 'rtklib.h' header. ```c #include "rtklib.h" #include int main() { /* Example 1: ECEF to Geodetic (WGS84) */ double ecef[3] = {3855263.234, 452639.478, 5048884.532}; /* meters */ double llh[3]; ecef2pos(ecef, llh); printf("ECEF to Geodetic Conversion:\n"); printf(" ECEF: X=%.3f Y=%.3f Z=%.3f (m)\n", ecef[0], ecef[1], ecef[2]); printf(" Geodetic: Lat=%.9f° Lon=%.9f° Height=%.3f m\n", llh[0]*R2D, llh[1]*R2D, llh[2]); /* Convert back to verify */ double ecef2[3]; pos2ecef(llh, ecef2); printf(" Verification: dX=%.3e dY=%.3e dZ=%.3e (m)\n", ecef2[0]-ecef[0], ecef2[1]-ecef[1], ecef2[2]-ecef[2]); printf("\n"); /* Example 2: ECEF to Local ENU frame */ double base_ecef[3] = {3855263.234, 452639.478, 5048884.532}; double rover_ecef[3] = {3855268.145, 452644.521, 5048889.876}; double base_llh[3], enu[3]; ecef2pos(base_ecef, base_llh); /* Compute baseline vector from base to rover */ double dx[3]; for (int i = 0; i < 3; i++) dx[i] = rover_ecef[i] - base_ecef[i]; /* Transform to ENU at base position */ ecef2enu(base_llh, dx, enu); printf("Baseline Vector:\n"); printf(" ECEF: dX=%.3f dY=%.3f dZ=%.3f (m)\n", dx[0], dx[1], dx[2]); printf(" ENU: E=%.3f N=%.3f U=%.3f (m)\n", enu[0], enu[1], enu[2]); printf(" Horizontal: %.3f m Vertical: %.3f m\n", sqrt(enu[0]*enu[0] + enu[1]*enu[1]), enu[2]); /* Azimuth and elevation */ double azimuth = atan2(enu[0], enu[1]); double elevation = atan2(enu[2], sqrt(enu[0]*enu[0] + enu[1]*enu[1])); printf(" Azimuth: %.2f° Elevation: %.2f°\n", azimuth*R2D, elevation*R2D); printf("\n"); /* Example 3: Covariance transformation */ double Q_ecef[9] = { /* Covariance matrix in ECEF (m²) */ 0.01, 0.002, 0.001, 0.002, 0.01, 0.002, 0.001, 0.002, 0.02 }; double Q_enu[9]; /* Transform covariance from ECEF to ENU */ covenu(base_llh, Q_ecef, Q_enu); printf("Covariance Transformation:\n"); printf(" ECEF StdDev: X=%.3f Y=%.3f Z=%.3f (m)\n", sqrt(Q_ecef[0]), sqrt(Q_ecef[4]), sqrt(Q_ecef[8])); printf(" ENU StdDev: E=%.3f N=%.3f U=%.3f (m)\n", sqrt(Q_enu[0]), sqrt(Q_enu[4]), sqrt(Q_enu[8])); printf(" Horizontal error (CEP): %.3f m\n", 0.59 * (sqrt(Q_enu[0]) + sqrt(Q_enu[4]))); printf("\n"); /* Example 4: DMS (Degrees-Minutes-Seconds) conversion */ double lat_deg = 51.123456789; double lon_deg = -114.987654321; double lat_dms[3], lon_dms[3]; deg2dms(lat_deg, lat_dms, 5); deg2dms(lon_deg, lon_dms, 5); printf("DMS Conversion:\n"); printf(" Latitude: %.9f° = %d° %d' %.5f" %c\n", lat_deg, (int)lat_dms[0], (int)lat_dms[1], lat_dms[2], lat_deg >= 0 ? 'N' : 'S'); printf(" Longitude: %.9f° = %d° %d' %.5f" %c\n", lon_deg, abs((int)lon_dms[0]), (int)lon_dms[1], lon_dms[2], lon_deg >= 0 ? 'E' : 'W'); /* Convert back */ double lat_verify = dms2deg(lat_dms); printf(" Verification error: %.3e°\n", lat_verify - lat_deg); return 0; } ``` -------------------------------- ### CMake: Define Executable Targets and Link Libraries Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/consapp/CMakeLists.txt This snippet defines the creation of executable targets (rnx2rtkp, convbin, pos2kml) using C source files and links them against the 'rtklib' library. It also specifies the installation directory for the executables. Conditional linking for Windows-specific libraries (wsock32, ws2_32, winmm) is included for certain executables. ```cmake include_directories(${PROJECT_SOURCE_DIR}/src) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) add_executable(rnx2rtkp rnx2rtkp/rnx2rtkp.c) target_link_libraries(rnx2rtkp rtklib) install(TARGETS rnx2rtkp RUNTIME DESTINATION bin) add_executable(convbin convbin/convbin.c) target_link_libraries(convbin rtklib) install(TARGETS convbin RUNTIME DESTINATION bin) add_executable(pos2kml pos2kml/pos2kml.c) target_link_libraries(pos2kml rtklib) install(TARGETS pos2kml RUNTIME DESTINATION bin) # add executables only supported on unix-like systems if (UNIX) add_executable(rtkrcv rtkrcv/rtkrcv.c rtkrcv/vt.c) target_link_libraries(rtkrcv rtklib) install(TARGETS rtkrcv RUNTIME DESTINATION bin) add_executable(str2str str2str/str2str.c) target_link_libraries(str2str rtklib) install(TARGETS str2str RUNTIME DESTINATION bin) endif() # add additional libraries to compile on windows if(WIN32) target_link_libraries(rnx2rtkp wsock32 ws2_32 winmm) target_link_libraries(convbin wsock32 ws2_32 winmm) target_link_libraries(pos2kml wsock32 ws2_32 winmm) endif() ``` -------------------------------- ### Initialize and Manage Google Map Instance Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/qtapp/appcmn_qt/rtklib_gm.htm Initializes a Google Map instance with specified center and zoom levels. It also provides functions to set the map's center, zoom in/out, clear all markers, and add new markers with click event listeners for info windows. Markers can be updated by position or visibility. ```javascript var map = null; var marks = []; var markh = null; var markz = 0; var info = null; var icon0 = "qrc:/image/marker_yellow.png"; var icon1 = "qrc:/image/marker_red.png"; async function init() { //@ts-ignore const { Map } = await google.maps.importLibrary("maps"); map = new Map(document.getElementById("map"), { center: { lat: 0, lng: 0 }, zoom: 12, }); document.getElementById('state').value = '1'; } function SetView(lat, lon, zoom) { if (map == null) return; map.setCenter(new google.maps.LatLng(lat, lon)); map.setZoom(zoom); } function SetCent(lat, lon) { if (map == null) return; map.setCenter(new google.maps.LatLng(lat, lon)); } function ZoomIn() { if (map == null) return; map.setZoom(map.getZoom() + 1); } function ZoomOut() { if (map == null) return; map.setZoom(map.getZoom() - 1); } function ClearMark(lat, lon, title) { for (var i in marks) { marks[i].setMap(null); } marks.length = 0; markh = null; } function AddMark(lat, lon, title, msg) { var pos = new google.maps.LatLng(lat, lon); var opt = { map: map, position: pos, title: title, icon: icon0 }; var mark = new google.maps.Marker(opt); if (title == "SOL2") mark.setIcon(icon1); google.maps.event.addListener(mark, 'click', function(event) { if (info) { info.close(); } info = new google.maps.InfoWindow({ content: msg }); info.open(mark.getMap(), mark); }); marks.push(mark); } function PosMark(lat, lon, title) { for (var i in marks) { if (marks[i].title == title) { marks[i].setPosition(new google.maps.LatLng(lat, lon)); break; } } } function ShowMark(title) { for (var i in marks) { if (marks[i].title == title) { marks[i].setVisible(true); break; } } } function HideMark(title) { for (var i in marks) { if (marks[i].title == title) { marks[i].setVisible(false); break; } } } ``` -------------------------------- ### rtkrcv: Receiver-Based Positioning Test Configurations Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/consapp/CMakeLists.txt These CMake directives define test cases for the 'rtkrcv' tool, which is used for receiver-based real-time kinematic positioning. The commented-out examples illustrate how to specify processing options such as time, mode, and configuration file paths. These tests are intended to verify the functionality of the rtkrcv tool under different operational scenarios. ```cmake set(RTKRCV_TEST_CONF_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rtkrcv/conf/) #add_test(NAME rtkrcv_test1 COMMAND rtkrcv -t 4 -m 52001 -t 4) #add_test(NAME rtkrcv_test2 COMMAND rtkrcv -p 2105 -m 52001) #add_test(NAME rtkrcv_test3 COMMAND rtkrcv -o ${RTKRCV_TEST_CONF_DIR}rtk.conf) ``` -------------------------------- ### Add rtkpost Executable (CMake) Source: https://github.com/rtklibexplorer/rtklib/blob/main/app/winapp/rtkpost/CMakeLists.txt Defines the 'rtkpost' executable using CMake, listing all its source files. This command identifies the primary source files for the application and any supporting files from common application directories. ```cmake add_executable(rtkpost WIN32 kmzconv.cpp postmain.cpp postopt.cpp rtkpost.cpp ../appcmn/aboutdlg.cpp ../appcmn/confdlg.cpp ../appcmn/freqdlg.cpp ../appcmn/keydlg.cpp ../appcmn/maskoptdlg.cpp ../appcmn/refdlg.cpp ../appcmn/timedlg.cpp ../appcmn/viewer.cpp ../appcmn/vieweropt.cpp ) ```