### Run the wxWidgets Example Source: https://github.com/boostorg/geometry/blob/develop/example/with_external_libs/wxwidgets/README.md Execute the built example application, providing a WKT file as a command-line argument. This example visualizes geographic data using Boost.Geometry and wxWidgets. ```bash ./wx_widgets_world_mapper ../../../data/world.wkt ``` -------------------------------- ### Build the wxWidgets Example with CMake Source: https://github.com/boostorg/geometry/blob/develop/example/with_external_libs/wxwidgets/README.md Instructions for building the example application that uses wxWidgets and Boost.Geometry. Navigate to the example directory and use CMake to configure and build the project. ```bash cd example/with_external_libs/wxwidgets mkdir my_build_folder cd my_build_folder cmake .. cmake --build . ``` -------------------------------- ### Project Setup and Qt Package Finding Source: https://github.com/boostorg/geometry/blob/develop/example/with_external_libs/qt/CMakeLists.txt Configures the CMake project and finds the required Qt6 components. Ensure Qt6 is installed and discoverable by CMake. ```cmake cmake_minimum_required(VERSION 3.16) project(qt_world_mapper LANGUAGES CXX) find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets) qt_standard_project_setup() ``` -------------------------------- ### Building the Qt Example with CMake and Ninja Source: https://github.com/boostorg/geometry/blob/develop/example/with_external_libs/qt/README.md This command sequence demonstrates the standard CMake workflow for building the Boost.Geometry Qt example using the Ninja generator. ```bash cd example/with_external_libs/qt mkdir my_build_folder cd my_build_folder cmake .. -G Ninja ninja ``` -------------------------------- ### Add Adapted Geometries Examples Source: https://github.com/boostorg/geometry/blob/develop/doc/src/examples/geometries/adapted/CMakeLists.txt Iterates through a list of container types and adds corresponding examples using the boost_geometry_add_example macro. ```cmake foreach(item IN ITEMS boost_array boost_fusion boost_tuple c_array std_array ) boost_geometry_add_example("geometries_adapted" ${item}) endforeach() ``` -------------------------------- ### Build and Install wxWidgets with CMake Source: https://github.com/boostorg/geometry/blob/develop/example/with_external_libs/wxwidgets/README.md Follow these steps to clone, build, and install wxWidgets using CMake. Ensure submodules are retrieved. This process makes wxWidgets discoverable for other projects. ```bash cd ~ git clone --recurse-submodules git@github.com:wxWidgets/wxWidgets.git cd wxWidgets mkdir my_build_folder cd my_build_folder cmake .. cmake --build . sudo cmake --build . --target install ``` -------------------------------- ### Clone Boost Repository and Setup Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial Initial steps to clone the Boost repository, checkout the develop branch, and bootstrap the build system. This is required before working with Boost.Geometry. ```bash git clone --recursive https://github.com/boostorg/boost.git cd boost git checkout develop . bootstrap.sh ``` -------------------------------- ### Running the Qt World Mapper Example Source: https://github.com/boostorg/geometry/blob/develop/example/with_external_libs/qt/README.md Execute the compiled Qt world mapper application, providing a path to a WKT file containing polygon data as a command-line argument. ```bash ././qt_world_mapper.app/Contents/MacOS/qt_world_mapper ../../../data/world.wkt ``` -------------------------------- ### Add Boost.Geometry Adapted Range Examples Source: https://github.com/boostorg/geometry/blob/develop/doc/src/examples/geometries/adapted/boost_range/CMakeLists.txt This CMakeLists.txt snippet iterates through a list of adapted range types and adds corresponding examples using the boost_geometry_add_example macro. ```cmake foreach(item IN ITEMS filtered reversed sliced strided # uniqued Fails to compile, also commented in Jamfile ) boost_geometry_add_example("geometries_adapted_range" ${item}) endforeach() ``` -------------------------------- ### Create Executable and Link Libraries Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/support_status/CMakeLists.txt Builds the support_status executable and links it against the Boost.Geometry library. Requires Boost.Geometry to be installed or available in the build environment. ```cmake add_executable(${PROJECT_NAME} support_status.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE Boost::geometry) ``` -------------------------------- ### Print XML Document with RapidXml Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Examples of printing an XML document to standard output or a string using the print function or the stream insertion operator. ```cpp using namespace rapidxml; xml_document<> doc; // character type defaults to char // ... some code to fill the document // Print to stream using operator << std::cout << doc; ``` ```cpp // Print to stream using print function, specifying printing flags print(std::cout, doc, 0); // 0 means default printing flags ``` ```cpp // Print to string using output iterator std::string s; print(std::back_inserter(s), doc, 0); ``` ```cpp // Print to memory buffer using output iterator char buffer[4096]; // You are responsible for making the buffer large enough! char *end = print(buffer, doc, 0); // end contains pointer to character after last printed character *end = 0; // Add string terminator after XML ``` -------------------------------- ### Add Boost.Range Subdirectory Source: https://github.com/boostorg/geometry/blob/develop/doc/src/examples/geometries/adapted/CMakeLists.txt Includes the Boost.Range subdirectory, likely for examples related to range adaptors in Boost.Geometry. ```cmake add_subdirectory(boost_range) ``` -------------------------------- ### Executable Definition and Linking Source: https://github.com/boostorg/geometry/blob/develop/example/with_external_libs/qt/CMakeLists.txt Defines the main executable for the Qt World Mapper application and links it with necessary Qt6 modules. This setup is standard for Qt projects using CMake. ```cmake qt_add_executable(${PROJECT_NAME} qt_world_mapper.cpp qt_world_mapper.hpp ) set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE ) target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets ) ``` -------------------------------- ### Check Git Branch Verbosity Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial Verify you are on the develop branch before starting new work. The output shows tracking information. ```bash git branch -vv ``` -------------------------------- ### Add Boost.Geometry Example CMake Function Source: https://github.com/boostorg/geometry/blob/develop/doc/src/examples/CMakeLists.txt Defines a CMake function to add an executable for a Boost.Geometry example. It links against the Boost::geometry library, sets include directories, and specifies C++14 as the minimum standard. ```cmake function(boost_geometry_add_example prefix item) set(example_name "boost_geometry_example_${prefix}_${item}") add_executable(${example_name} ${item}.cpp) # Add a dependency to Boost.Geometry target_link_libraries(${example_name} PRIVATE Boost::geometry ) # Include the main Geometry test folder and the current folder target_include_directories(${example_name} PRIVATE .) # To compile with C++14 target_compile_features(${example_name} PRIVATE cxx_std_14) endfunction() foreach(item IN ITEMS quick_start ) boost_geometry_add_example("example" ${item}) endforeach() add_subdirectory(algorithms) add_subdirectory(arithmetic) add_subdirectory(core) add_subdirectory(geometries) add_subdirectory(io) add_subdirectory(strategies) add_subdirectory(views) ``` -------------------------------- ### Add Unit Tests for Boost.Geometry Algorithms Source: https://github.com/boostorg/geometry/blob/develop/test/algorithms/detail/CMakeLists.txt This CMake code iterates through a list of algorithm names and adds a unit test for each using the `boost_geometry_add_unit_test` macro. This is typically used in a CMakeLists.txt file to automate the testing setup for different algorithm modules. ```cmake add_subdirectory(sections) foreach(item IN ITEMS calculate_point_order approximately_equals partition tupled_output visit ) boost_geometry_add_unit_test("algorithms" ${item}) endforeach() ``` -------------------------------- ### Navigate to Boost.Geometry Documentation Directory Source: https://github.com/boostorg/geometry/wiki/Generating-and-Improving-Documentation Change the current directory to the Boost.Geometry documentation source folder to prepare for building. ```bash cd libs/geometry/doc ``` -------------------------------- ### Build Boost.Geometry HTML Documentation Source: https://github.com/boostorg/geometry/wiki/Generating-and-Improving-Documentation Execute the b2 build command to generate HTML documentation. This process involves Python scripts, Doxygen, and doxygen_xml2qbk. Ensure Boost root and its bin directory are in your PATH. ```bash b2 ``` -------------------------------- ### Constructor Initialization List Formatting Source: https://github.com/boostorg/geometry/wiki/Guidelines-for-Developers For constructors, member/base initialization lists should be on the same line if small (1-2 members), or one member/base per line with a leading comma on the left. ```c++ struct T { T(int a, int b) : m_a(a) , m_b(b) {} int m_a; int m_b; }; ``` -------------------------------- ### Build Boost Headers Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial Optionally build the full content of the Boost headers directory. This can be skipped as headers will be linked on demand. ```bash .\b2 headers ``` -------------------------------- ### Compile doxygen_xml2qbk Tool Source: https://github.com/boostorg/geometry/wiki/Generating-and-Improving-Documentation Compile the doxygen_xml2qbk tool shipped with Boost.Geometry. Ensure this tool is accessible in your PATH. ```bash ./b2 libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk ``` -------------------------------- ### xml_base::name Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Retrieves a pointer to the name of the node. The name might not be null-terminated if the rapidxml::parse_no_string_terminators option was used during parsing. Use name_size() to get the length. ```APIDOC ## xml_base::name ### Description Gets name of the node. Interpretation of name depends on type of node. Note that name will not be zero-terminated if [rapidxml::parse_no_string_terminators](#namespacerapidxml_9cae3801e70437cbc410c24bf6be691c_19cae3801e70437cbc410c24bf6be691c) option was selected during parse. Use [name_size()](#classrapidxml_1_1xml__base_0dae694c8f7e4d89f1003e2f3a15a43c_10dae694c8f7e4d89f1003e2f3a15a43c) function to determine length of the name. ### Returns Name of node, or empty string if node has no name. ``` -------------------------------- ### xml_attribute::where Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Gets a pointer to the character data where an error occurred during XML parsing. The character type 'Ch' should match the xml_document's character type. ```APIDOC ## xml_attribute::where ### Description Gets pointer to character data where error happened. Ch should be the same as char type of [xml_document](#classrapidxml_1_1xml__document) that produced the error. ### Returns Pointer to location within the parsed string where error occured. ``` -------------------------------- ### Run Boost.Geometry Tests Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial Execute the tests for the Boost.Geometry library. Assumes the Boost directory has been added to the system's PATH. ```bash b2 test ``` -------------------------------- ### xml_attribute::next_attribute Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Gets the next attribute node. Optionally, it can search for an attribute with a specific name, with control over case sensitivity. The name string does not need to be null-terminated if its size is provided. ```APIDOC ## xml_attribute::next_attribute ### Description Gets next attribute, optionally matching attribute name. ### Parameters #### name Name of attribute to find, or 0 to return next attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero #### name_size Size of name, in characters, or 0 to have size calculated automatically from string #### case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters ### Returns Pointer to found attribute, or 0 if not found. ``` -------------------------------- ### Create and Modify XML Node with RapidXml Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Creates a simple HTML link element and appends it to the document. For dynamic string values, allocate them from the document's memory pool to manage lifetime. ```cpp xml_document<> doc; xml_node<> *node = doc.allocate_node(node_element, "a", "Google"); doc.append_node(node); xml_attribute<> *attr = doc.allocate_attribute("href", "google.com"); node->append_attribute(attr); ``` ```cpp xml_document<> doc; char *node_name = doc.allocate_string(name); // Allocate string and copy name into it xml_node<> *node = doc.allocate_node(node_element, node_name); // Set node name to node_name ``` -------------------------------- ### Configure CMake Project and Executable Source: https://github.com/boostorg/geometry/blob/develop/example/with_external_libs/wxwidgets/CMakeLists.txt Sets up the minimum CMake version, project name, and defines the executable target with its source file. It also specifies the C++ standard to be used. ```cmake cmake_minimum_required(VERSION 3.8...3.20) project(wx_widgets_world_mapper) add_executable(${PROJECT_NAME} wxwidgets_world_mapper.cpp) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_14) ``` -------------------------------- ### xml_attribute::previous_attribute Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Gets the previous attribute node. Optionally, it can search for an attribute with a specific name, with control over case sensitivity. The name string does not need to be null-terminated if its size is provided. ```APIDOC ## xml_attribute::previous_attribute ### Description Gets previous attribute, optionally matching attribute name. ### Parameters #### name Name of attribute to find, or 0 to return previous attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero #### name_size Size of name, in characters, or 0 to have size calculated automatically from string #### case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters ### Returns Pointer to found attribute, or 0 if not found. ``` -------------------------------- ### Navigate to Geometry Module Directory Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial Change directory to the Boost.Geometry module within the Boost project structure. This is a prerequisite for adding remotes. ```bash cd ../boost/libs/geometry ``` -------------------------------- ### rapidxml::parse_error_handler Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html A user-defined function called when parsing errors occur and exceptions are disabled (i.e., `RAPIDXML_NO_EXCEPTIONS` is defined). This function must not return; if it does, the behavior is undefined. A simple example implementation is provided. ```APIDOC ## rapidxml::parse_error_handler ### Description When exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function is called to notify user about the error. It must be defined by the user. This function cannot return. If it does, the results are undefined. A very simple definition might look like that: void rapidxml::parse_error_handler(const char *what, void *where) { std::cout << "Parse error: " << what << "\n"; std::abort(); } ### Synopsis `void rapidxml::parse_error_handler(const char *what, void *where);` ### Parameters what Human readable description of the error. where Pointer to character data where error was detected. ``` -------------------------------- ### xml_base::value() const Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Retrieves the value of an XML node. The interpretation of the value depends on the node's type. If the `parse_no_string_terminators` option was used during parsing, the value might not be zero-terminated. Use `value_size()` to get the length. ```APIDOC ## function xml_base::value ### Synopsis `Ch* value() const;` ### Description Gets value of node. Interpretation of value depends on type of node. Note that value will not be zero-terminated if [rapidxml::parse_no_string_terminators](#namespacerapidxml_9cae3801e70437cbc410c24bf6be691c_19cae3801e70437cbc410c24bf6be691c) option was selected during parse. Use [value_size()](#classrapidxml_1_1xml__base_aed5ae791b7164c1ee5e649198cbb3db_1aed5ae791b7164c1ee5e649198cbb3db) function to determine length of the value. ### Returns Value of node, or empty string if node has no value. ``` -------------------------------- ### Configure Include Directories for Robustness Test Source: https://github.com/boostorg/geometry/blob/develop/test/robustness/convex_hull/CMakeLists.txt Sets the include directories for the 'boost_geometry_robustness_random_multi_points' target. It includes the local robustness test directory and the current project directory. ```cmake target_include_directories(boost_geometry_robustness_random_multi_points PRIVATE "${PROJECT_SOURCE_DIR}/test/robustness" .) ``` -------------------------------- ### Create and Checkout New Local Branch Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial Create a new local branch for your feature or bugfix and switch to it. This is the first step in isolating your changes. ```bash git branch feature/example git checkout feature/example ``` -------------------------------- ### View Git Remotes Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial List all configured remote repositories for the current Git repository. Used to check existing remotes before adding a new one. ```bash git remote -v ``` -------------------------------- ### Link wxWidgets Libraries Source: https://github.com/boostorg/geometry/blob/develop/example/with_external_libs/wxwidgets/CMakeLists.txt Finds and links the wxWidgets libraries to the executable. This assumes wxWidgets can be found by CMake, typically in /usr/local. The 'core' and 'base' components are required. ```cmake # Link the wxWidgets libraries to our executable # Assuming it can be found by CMake in /usr/local find_package(wxWidgets 3.3 COMPONENTS core base REQUIRED CONFIG) target_link_libraries(${PROJECT_NAME} wxWidgets::wxWidgets) ``` -------------------------------- ### CMake Project Configuration Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/support_status/CMakeLists.txt Sets the minimum required CMake version and defines the project name and languages. Ensure your CMake version is compatible. ```cmake cmake_minimum_required(VERSION 3.8...3.20) project(support_status LANGUAGES CXX) ``` -------------------------------- ### Include Directories Configuration Source: https://github.com/boostorg/geometry/blob/develop/example/with_external_libs/qt/CMakeLists.txt Specifies the include directories for the project. This ensures that header files from Boost.Geometry and other project sources are found during compilation. ```cmake target_include_directories(${PROJECT_NAME} PRIVATE .. ../../../../.. ) ``` -------------------------------- ### xml_base::xml_base Constructor Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Constructs an xml_base object. ```APIDOC ## xml_base::xml_base ### Description Constructs an empty attribute with the specified type. Consider using [memory_pool](#classrapidxml_1_1memory__pool) of appropriate [xml_document](#classrapidxml_1_1xml__document) if allocating attributes manually. ``` -------------------------------- ### View Git Log Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial Inspect commit history to understand the project's commit message conventions. Use this to format your own commit messages correctly. ```bash git log ``` -------------------------------- ### Link Boost.Geometry Libraries and Set Include Directories Source: https://github.com/boostorg/geometry/blob/develop/example/with_external_libs/wxwidgets/CMakeLists.txt Links the Boost.Geometry library and sets the include directories for the executable. It assumes Boost.Geometry is located relative to the current directory. Alternative methods for finding Boost are also commented out. ```cmake # Link the Boost.Geometry library to our executable # By default, it is assumed to be relative to this directory. target_include_directories(${PROJECT_NAME} PRIVATE .. ../../../../..) # If this does not work, or you build from elsewhere # First set BOOST_ROOT # Then use find_package(Boost) # Then use target_link_libraries(${PROJECT_NAME} Boost::geometry) ``` -------------------------------- ### Add Unit Tests for Closest Points Algorithms (CMake) Source: https://github.com/boostorg/geometry/blob/develop/test/algorithms/closest_points/CMakeLists.txt This CMake script iterates through a list of predefined test cases and adds them as unit tests for the closest points algorithms. Ensure the `boost_geometry_add_unit_test` macro is available in your CMake environment. ```cmake foreach(item IN ITEMS ar_ar l_ar l_l pl_ar pl_l pl_pl ) boost_geometry_add_unit_test("algorithms_closest_points" ${item}) endforeach() ``` -------------------------------- ### Add Unit Tests for Convex Hull Algorithms Source: https://github.com/boostorg/geometry/blob/develop/test/algorithms/convex_hull/CMakeLists.txt This CMake script iterates through a list of convex hull algorithm variants and adds corresponding unit tests using the boost_geometry_add_unit_test macro. Ensure the list of items matches the available algorithms. ```cmake foreach(item IN ITEMS convex_hull convex_hull_multi convex_hull_robust convex_hull_sph_geo ) boost_geometry_add_unit_test("algorithms" ${item}) endforeach() ``` -------------------------------- ### Add Unit Tests for Boost.Geometry Algorithms Source: https://github.com/boostorg/geometry/blob/develop/test/algorithms/length/CMakeLists.txt This CMake script iterates through a list of algorithm names and adds corresponding unit tests using the `boost_geometry_add_unit_test` macro. It's used for setting up the testing framework for different algorithm implementations. ```cmake foreach(item IN ITEMS length length_multi length_sph length_geo ) boost_geometry_add_unit_test("algorithms" ${item}) endforeach() ``` -------------------------------- ### Include Guard for Header Files Source: https://github.com/boostorg/geometry/wiki/Guidelines-for-Developers All header files must include a standard include guard to prevent multiple inclusions. The guard macro should be based on the header's path and filename. ```c++ #ifndef BOOST_GEOMETRY____HPP #define BOOST_GEOMETRY____HPP ... #endif // BOOST_GEOMETRY____HPP ``` -------------------------------- ### Parse XML String with RapidXml Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Parses a zero-terminated string into an XML document object. Ensure the RapidXml namespace is in scope or qualify names. ```cpp using namespace rapidxml; xml_document<> doc; // character type defaults to char doc.parse<0>(text); // 0 means default parse flags ``` -------------------------------- ### rapidxml::print Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Prints an XML node to a specified output stream with customizable flags. ```APIDOC ## rapidxml::print ### Description Prints XML to given output stream. ### Synopsis `std::basic_ostream& rapidxml::print(std::basic_ostream< Ch > &out, const xml_node< Ch > &node, int flags=0);` ### Parameters * **out** - Output stream to print to. * **node** - Node to be printed. Pass xml_document to print entire document. * **flags** - Flags controlling how XML is printed. ### Returns Output stream. ``` -------------------------------- ### Add Boost.Geometry Utility Unit Tests Source: https://github.com/boostorg/geometry/blob/develop/test/util/CMakeLists.txt This CMake script iterates through a list of Boost.Geometry utility components and adds a unit test for each using the `boost_geometry_add_unit_test` macro. ```cmake foreach(item IN ITEMS algorithm calculation_type for_each_coordinate math_abs math_divide math_equals math_sqrt math_normalize_spheroidal promote_integral range rational select_most_precise tuples write_dsv ) boost_geometry_add_unit_test("util" ${item}) endforeach() ``` -------------------------------- ### Iterating Over a Range with a Functor Source: https://github.com/boostorg/geometry/wiki/Guidelines-for-Developers Demonstrates the use of `boost::begin`, `boost::end`, and `boost::range_iterator` for iterating through a range and applying a functor to each element. The iterator variable `it` is used for local scope. ```C++ template static inline void apply(Range& range, Functor& f) { for (typename boost::range_iterator::type it = boost::begin(range); it != boost::end(range); ++it) { f(*it); } } ``` -------------------------------- ### rapidxml::operator<< Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Prints formatted XML to an output stream using default printing flags. ```APIDOC ## function operator<< ### Description Prints formatted XML to given output stream. Uses default printing flags. Use [print()](#namespacerapidxml_b94d570fc4c4ab2423813cd0243326b1_1b94d570fc4c4ab2423813cd0243326b1) function to customize printing process. ### Synopsis `std::basic_ostream& rapidxml::operator<<(std::basic_ostream< Ch > &out, const xml_node< Ch > &node);` ### Parameters * **out** - Output stream to print to. * **node** - Node to be printed. ### Returns Output stream. ``` -------------------------------- ### Geometry Algorithm Dispatching Structure Source: https://github.com/boostorg/geometry/wiki/Guidelines-for-Developers Illustrates the typical structure for geometry algorithms, involving a public-facing `apply` function that dispatches to a specialized struct within the `dispatch` namespace. This structure allows for compile-time specialization based on geometry types. ```C++ namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace foo { template struct foo_point { // template parameters here static inline int apply(Point const& p) { // do something here return 1; } }; }} // namespace detail::foo #endif // DOXYGEN_NO_DETAIL #ifndef DOXYGEN_NO_DISPATCH namespace dispatch { template < Geometry, Tag = typename geometry::tag::type > struct foo { }; // Specialization for POINT ... } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH template inline int foo(Point const& point) { // Checking if the geometry type fulfils the concept should be done // as early as possible, so in the first entry point concept::check(); return dispatch::foo::apply(point); } }} // namespace boost::geometry ``` -------------------------------- ### Add Boost.Geometry Unit Tests Source: https://github.com/boostorg/geometry/blob/develop/index/test/CMakeLists.txt Iterates through a list of items and adds a unit test for each using the boost_geometry_add_unit_test macro. ```cmake foreach(item IN ITEMS minmax_heap ) boost_geometry_add_unit_test("index" ${item}) endforeach() ``` -------------------------------- ### Set C++ Standard Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/support_status/CMakeLists.txt Specifies that the project requires C++14 support. Ensure your compiler supports C++14. ```cmake target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_14) ``` -------------------------------- ### Add Unit Tests for Boost.Geometry Algorithms Source: https://github.com/boostorg/geometry/blob/develop/test/algorithms/touches/CMakeLists.txt This CMake code snippet iterates through a list of algorithm names and adds a unit test for each using the 'boost_geometry_add_unit_test' macro. It's used to set up the testing framework for different algorithms. ```cmake foreach(item IN ITEMS touches touches_box touches_gc touches_multi touches_self touches_sph ) boost_geometry_add_unit_test("algorithms" ${item}) endforeach() ``` -------------------------------- ### Run Tests with Custom Compiler Flags Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial Run Boost.Geometry tests while passing specific compiler flags, such as -Wall for increased warning levels. This helps catch potential issues. ```bash b2 test cxxflags="-Wall" ``` -------------------------------- ### Update Boost.Geometry Develop Branch Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial Navigate to the Boost.Geometry library directory, checkout its develop branch, and pull the latest changes. This ensures you are working with the most recent version. ```bash cd libs/geometry git checkout develop git branch -vv git pull ``` -------------------------------- ### Clone User's Geometry Fork Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial Clone your personal fork of the Boost.Geometry repository and checkout the develop branch. This is an optional step to verify your fork. ```bash git clone git@github.com:username/geometry geometry git checkout develop git branch -vv git pull ``` -------------------------------- ### Add Unit Tests for Perimeter Algorithms Source: https://github.com/boostorg/geometry/blob/develop/test/algorithms/perimeter/CMakeLists.txt This CMake code snippet iterates through a list of perimeter-related algorithm names and adds a unit test for each using the `boost_geometry_add_unit_test` macro. It's used to set up the testing framework for different perimeter calculation variations. ```cmake foreach(item IN ITEMS perimeter perimeter_base perimeter_multi perimeter_geo perimeter_sph ) boost_geometry_add_unit_test("algorithms" ${item}) endforeach() ``` -------------------------------- ### Access DOM Tree Elements in RapidXml Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Demonstrates accessing node names, values, and attributes within an XML document using RapidXml's DOM interface. ```cpp cout << "Name of my first node is: " << doc.first_node()->name() << "\n"; xml_node<> *node = doc.first_node("foobar"); cout << "Node foobar has value " << node->value() << "\n"; for (xml_attribute<> *attr = node->first_attribute(); attr; attr = attr->next_attribute()) { cout << "Node foobar has attribute " << attr->name() << " "; cout << "with value " << attr->value() << "\n"; } ``` -------------------------------- ### Add Boost.Geometry Unit Tests Source: https://github.com/boostorg/geometry/blob/develop/test/cs_undefined/CMakeLists.txt Adds unit tests for Boost.Geometry. Iterates through a list of test items and adds them using the `boost_geometry_add_unit_test` macro. ```cmake foreach(item IN ITEMS distance envelope_expand index is measure other relops1 relops2 ) boost_geometry_add_unit_test("cs_undefined" ${item}) endforeach() ``` ```cmake boost_geometry_add_unit_test("cs_undefined" setops1 "not_run") ``` ```cmake boost_geometry_add_unit_test("cs_undefined" setops2 "not_run") ``` -------------------------------- ### Add Boost.Geometry Unit Tests Source: https://github.com/boostorg/geometry/blob/develop/test/algorithms/area/CMakeLists.txt Configures unit tests for Boost.Geometry algorithms. This macro is used to add tests for different algorithm modules. ```cmake foreach(item IN ITEMS area area_box_sg area_multi ) boost_geometry_add_unit_test("algorithms" ${item}) endforeach() ``` -------------------------------- ### RapidXml Namespace Functions and Enums Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Core functions and enumerations within the rapidxml namespace. ```APIDOC ## rapidxml namespace ### Description Contains core functionalities and types for the RapidXml library. ### Contents - `enum node_type` - `function parse_error_handler(const char *what, void *where)` - `function print(OutIt out, const xml_node< Ch > &node, int flags=0)` - `function print(std::basic_ostream< Ch > &out, const xml_node< Ch > &node, int flags=0)` - `function operator<<(std::basic_ostream< Ch > &out, const xml_node< Ch > &node)` ``` -------------------------------- ### Add Unit Tests for Custom Geometries Source: https://github.com/boostorg/geometry/blob/develop/test/geometries/custom_non_copiable/CMakeLists.txt This CMake script iterates through a list of custom geometry types and adds unit tests for each using the `boost_geometry_add_unit_test` macro. Ensure the `geometries_cnc` test suite and the specified geometry items are correctly defined. ```cmake foreach(item IN ITEMS custom_ring custom_polygon custom_multi_polygon custom_linestring custom_multi_linestring custom_different_geometries ) boost_geometry_add_unit_test("geometries_cnc" ${item}) endforeach() ``` -------------------------------- ### Add Unit Tests for Formulas Source: https://github.com/boostorg/geometry/blob/develop/test/formulas/CMakeLists.txt Iterates through a list of formula test cases and adds them as unit tests using the boost_geometry_add_unit_test macro. This is a standard way to manage test suites in CMake. ```cmake foreach(item IN ITEMS inverse inverse_short_distance direct_accuracy direct_meridian intersection vertex_longitude ) boost_geometry_add_unit_test("formulas" ${item}) endforeach() ``` -------------------------------- ### Add Unit Tests for Union Algorithms (CMake) Source: https://github.com/boostorg/geometry/blob/develop/test/algorithms/set_operations/union/CMakeLists.txt Generates unit tests for various union operations. This is typically used in CMake build scripts to ensure comprehensive testing of the union algorithm with different geometric types. ```cmake foreach(item IN ITEMS union union_multi union_other_types ) boost_geometry_add_unit_test("algorithms" ${item}) target_compile_definitions(${BOOST_GEOMETRY_UNIT_TEST_NAME} PRIVATE BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) endforeach() ``` ```cmake foreach(item IN ITEMS union_aa_geo union_aa_sph union_gc union_linear_linear union_pl_pl union_issues union_tupled ) boost_geometry_add_unit_test("algorithms" ${item}) endforeach() ``` -------------------------------- ### List All Git Branches Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial Check the names of existing remote branches to avoid naming conflicts. This command lists all branches, local and remote. ```bash git branch -a ``` -------------------------------- ### Add New Git Remote Repository Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial Add a new remote repository to your local Git configuration, typically pointing to your personal fork of the project. Replace 'username' with your GitHub username. ```bash git remote add my_fork git@github.com:username/geometry ``` -------------------------------- ### xml_node::prepend_node Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Prepends a new child node to the current node, making it the first child. ```APIDOC ## xml_node::prepend_node ### Description Prepends a new child node. The prepended child becomes the first child, and all existing children are moved one position back. ### Parameters #### Path Parameters - **child** (xml_node< Ch > *) - Required - Node to prepend. ``` -------------------------------- ### Add Boost.Geometry Subdirectories Source: https://github.com/boostorg/geometry/blob/develop/index/test/CMakeLists.txt Includes subdirectories for additional Boost.Geometry modules, such as algorithms and rtree. ```cmake add_subdirectory(algorithms) add_subdirectory(rtree) ``` -------------------------------- ### Push New Branch to Remote Fork Source: https://github.com/boostorg/geometry/wiki/Contribution-Tutorial Push your newly created local branch to your remote fork. The -u flag sets up upstream tracking, simplifying future pushes. ```bash git push -u my_fork feature/example ``` -------------------------------- ### rapidxml::print Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Prints an XML node or the entire document to a specified output iterator. Flags can be used to control the printing format. ```APIDOC ## rapidxml::print ### Description Prints XML to given output iterator. ### Synopsis `OutIt rapidxml::print(OutIt out, const xml_node< Ch > &node, int flags=0);` ### Parameters out Output iterator to print to. node Node to be printed. Pass xml_document to print entire document. flags Flags controlling how XML is printed. ### Returns Output iterator pointing to position immediately after last character of printed text. ``` -------------------------------- ### Reference and Pointer Formatting Source: https://github.com/boostorg/geometry/wiki/Guidelines-for-Developers References and pointers should be formatted to emphasize the type, not the syntax. This applies to const references, pointers, and const pointers. ```c++ T const& t; T* t; T* const t; T const* t; T const* const t; ``` -------------------------------- ### Add Robustness Tests with CMake Source: https://github.com/boostorg/geometry/blob/develop/test/robustness/overlay/areal_areal/CMakeLists.txt Configures CMake to add robustness tests for Boost.Geometry. Use this macro to include specific test cases listed in the ITEMS variable. ```cmake foreach(item IN ITEMS general_intersection_precision interior_triangles intersection_pies intersection_stars intersects random_bitset_grids random_ellipses_stars recursive_polygons star_comb #ticket_9081 ) boost_geometry_add_robustness_test(${item}) endforeach() ``` -------------------------------- ### xml_base::parent() const Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Retrieves a pointer to the parent node of the current node. Returns `nullptr` if the node does not have a parent. ```APIDOC ## function xml_base::parent ### Synopsis `xml_node* parent() const;` ### Description Gets node parent. ### Returns Pointer to parent node, or 0 if there is no parent. ``` -------------------------------- ### Define Boost.Geometry Robustness Test Executable Source: https://github.com/boostorg/geometry/blob/develop/test/robustness/CMakeLists.txt Defines a CMake function to add a robustness test executable. It links against Boost.Geometry, CRC, and program_options libraries, and sets include directories for tests. Use this function for each robustness test case. ```cmake function(boost_geometry_add_robustness_test item) set(robustness_test_name "boost_geometry_robustness_${item}") add_executable(${robustness_test_name} ${item}.cpp) # Add a dependency to Boost.Geometry target_link_libraries(${robustness_test_name} PRIVATE Boost::geometry) # Link to additional libraries required for testing. target_link_libraries(${robustness_test_name} PRIVATE Boost::crc Boost::program_options) # Include the main Geometry test folder and the current folder, # and the robustness test folder target_include_directories(${robustness_test_name} PRIVATE "${PROJECT_SOURCE_DIR}/test/robustness" "${PROJECT_SOURCE_DIR}/test" "${PROJECT_SOURCE_DIR}/index/test" .) # To compile with C++14 target_compile_features(${robustness_test_name} PRIVATE cxx_std_14) # Add a dependency to the global robustness tests target add_dependencies(robustness_tests ${robustness_test_name}) endfunction() if (NOT TARGET robustness_tests) add_custom_target(robustness_tests) endif() add_subdirectory(convex_hull) add_subdirectory(overlay) #add_subdirectory(within) ``` -------------------------------- ### rapidxml::xml_base Source: https://github.com/boostorg/geometry/blob/develop/doc/src/docutils/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html Base class for XML nodes and attributes. ```APIDOC ## Class: rapidxml::xml_base ### Description Base class for XML nodes and attributes. ### Methods - **xml_base()**: Constructor. - **name() const**: Returns the name of the node/attribute. - **name_size() const**: Returns the size of the name. ``` -------------------------------- ### Add Conditional Unit Tests for Formulas (Excluding Apple) Source: https://github.com/boostorg/geometry/blob/develop/test/formulas/CMakeLists.txt Adds specific formula unit tests that are known to have variable results on Apple platforms (Darwin/arm64 using clang). These tests are only included when the NOT APPLE condition is true. ```cmake if (NOT APPLE) # The results of these tests vary considerably on Apple/Darwin/arm64 using clang foreach(item IN ITEMS inverse_karney direct ) boost_geometry_add_unit_test("formulas" ${item}) endforeach() endif() ``` -------------------------------- ### CMake Configuration for Older Qt Versions Source: https://github.com/boostorg/geometry/blob/develop/example/with_external_libs/qt/README.md Use these CMake settings when working with older Qt versions, such as QT6.2.4 on Ubuntu 22, to enable necessary features like automatic meta-object, UI, and resource compilation. ```cmake set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) ```