Merge branch 'develop'

This commit is contained in:
Vissarion Fisikopoulos 2024-10-29 15:18:12 +02:00
commit 2221c7bdc1
559 changed files with 4859 additions and 8126 deletions

104
.github/workflows/cmake.yml vendored Normal file
View File

@ -0,0 +1,104 @@
##############################################################################
# GitHub Actions Workflow for Boost.Geometry to build tests with cmake
#
# Copyright (c) 2024 Oracle and/or its affiliates.
# Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
##############################################################################
name: cmake
on: [push]
jobs:
##############################################################################
clang:
name: ${{ matrix.b2_toolset }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
b2_toolset: [
clang-14
]
include:
- b2_toolset: clang-14
b2_cxxstd: 14,17,2a
version: "14"
os: ubuntu-22.04
steps:
- name: Set up environment
id: setenv
run: |
if [[ "$GITHUB_REF" == *master ]]; then
echo "BOOST_BRANCH=master" >> $GITHUB_ENV
else
echo "BOOST_BRANCH=develop" >> $GITHUB_ENV
fi
echo "BOOST_SELF=$(basename $GITHUB_WORKSPACE)" >> $GITHUB_ENV
echo "BOOST_ROOT=$GITHUB_WORKSPACE/boost-root" >> $GITHUB_ENV
echo "boost_self=$(basename $GITHUB_WORKSPACE)" >> "$GITHUB_OUTPUT"
echo "boost_root=$GITHUB_WORKSPACE/boost-root" >> "$GITHUB_OUTPUT"
- name: Clone boostorg/boost
run: |
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git $BOOST_ROOT
cd $BOOST_ROOT
git submodule update -q --init libs/headers
git submodule update -q --init tools/boost_install
git submodule update -q --init tools/boostdep
git submodule update -q --init tools/build
mkdir -p libs/$BOOST_SELF
- uses: actions/checkout@v2
with:
path: ${{ steps.setenv.outputs.boost_root }}/libs/${{ steps.setenv.outputs.boost_self }}
- name: Run tools/boostdep/depinst/depinst.py
run: |
cd $BOOST_ROOT
python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools $BOOST_SELF
- name: Bootstrap boostorg/boost
run: |
gcc --version
cd $BOOST_ROOT
./bootstrap.sh --with-toolset=gcc
./b2 headers
test -f /usr/local/bin/b2 && rm -rf /usr/local/bin/b2
test -f /usr/local/bin/bjam && rm -rf /usr/local/bin/bjam
sudo cp $BOOST_ROOT/b2 /usr/local/bin/
ls -l /usr/local/bin/b2
b2 -v
- name: Set up clang toolset in ~/user-config.jam
run: |
export CXX_NAME=clang++-${{ matrix.version }}
echo ${CXX_NAME}
echo "# $HOME/user-config.jam" > $HOME/user-config.jam
echo "using clang : : $(which clang++-${{ matrix.version }}) ;" > ${HOME}/user-config.jam
test -f $HOME/user-config.jam && cat $HOME/user-config.jam
- name: Build tests with cmake (c++17)
run: |
cd $BOOST_ROOT/libs/geometry
mkdir __build
cd __build
cmake -DCMAKE_CXX_STANDARD=17 -DBUILD_TESTING=ON ..
cmake --build . --target tests
- name: Build tests with cmake
run: |
cd $BOOST_ROOT/libs/geometry/__build
rm -rf *
cmake -DBUILD_TESTING=ON ..
cmake --build . --target tests
- name: Run tests
run: |
cd $BOOST_ROOT/libs/geometry/__build
ctest --output-on-failure --no-tests=error

View File

@ -4,6 +4,10 @@
# Copyright (c) 2020 Mateusz Loskot <mateusz@loskot.net>
# Copyright (c) 2020 Adam Wulkiewicz, Lodz, Poland
#
# This file was modified by Oracle on 2024.
# Modifications copyright (c) 2024 Oracle and/or its affiliates.
# Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
@ -84,22 +88,13 @@ jobs:
echo "using xsltproc ;" >> $HOME/user-config.jam
test -f $HOME/user-config.jam && cat $HOME/user-config.jam
- name: Install libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk
run: |
cd $BOOST_ROOT
$BOOST_ROOT/b2 variant=release libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk
test -f /usr/local/bin/doxygen_xml2qbk && rm -rf /usr/local/bin/doxygen_xml2qbk
sudo cp $BOOST_ROOT/dist/bin/doxygen_xml2qbk /usr/local/bin/
ls -l /usr/local/bin/b2
doxygen_xml2qbk --version
- name: Build libs/geometry/doc/src/examples
- name: Build examples
run: |
cd $BOOST_ROOT
$BOOST_ROOT/b2 libs/geometry/doc/src/examples
- name: Run libs/geometry/doc/make_qbk.py
- name: Build documentation
run: |
cd $BOOST_ROOT
cd libs/geometry/doc
python ./make_qbk.py
$BOOST_ROOT/b2

2
.gitignore vendored
View File

@ -16,3 +16,5 @@ stdcerr
# JetBrains
/.idea
!build.jam

View File

@ -24,6 +24,7 @@ target_link_libraries(boost_geometry
Boost::concept_check
Boost::config
Boost::core
Boost::crc
Boost::function_types
Boost::iterator
Boost::lexical_cast
@ -32,6 +33,7 @@ target_link_libraries(boost_geometry
Boost::mpl
Boost::multiprecision
Boost::numeric_conversion
Boost::program_options
Boost::qvm
Boost::range
Boost::rational
@ -100,9 +102,11 @@ if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
config
algorithm
any
crc
lexical_cast
math
multiprecision
program_options
qvm
rational
serialization
@ -123,7 +127,8 @@ if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
endif()
enable_testing()
add_subdirectory(test)
add_subdirectory(test EXCLUDE_FROM_ALL)
add_subdirectory(index/test EXCLUDE_FROM_ALL)
endif()

26
Jamfile
View File

@ -1,26 +0,0 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
# Copyright (c) 2007-2013 Barend Gehrels, Amsterdam, the Netherlands.
# Copyright (c) 2008-2013 Bruno Lalande, Paris, France.
# Copyright (c) 2009-2022 Mateusz Loskot, London, UK.
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import ../../config/checks/config : requires ;
project boost-geometry
:
requirements
[ requires
cxx14_constexpr
cxx14_return_type_deduction
]
<toolset>msvc:<asynch-exceptions>on
;
build-project test ;
build-project example ;
build-project doc/src/examples ;
build-project index ;

63
build.jam Normal file
View File

@ -0,0 +1,63 @@
# Copyright René Ferdinand Rivera Morell 2024
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
require-b2 5.2 ;
import-search /boost/config/checks ;
import config : requires ;
constant boost_dependencies :
/boost/algorithm//boost_algorithm
/boost/any//boost_any
/boost/array//boost_array
/boost/assert//boost_assert
/boost/concept_check//boost_concept_check
/boost/config//boost_config
/boost/container//boost_container
/boost/core//boost_core
/boost/endian//boost_endian
/boost/function_types//boost_function_types
/boost/fusion//boost_fusion
/boost/integer//boost_integer
/boost/iterator//boost_iterator
/boost/lexical_cast//boost_lexical_cast
/boost/math//boost_math_tr1
/boost/mpl//boost_mpl
/boost/multiprecision//boost_multiprecision
/boost/numeric_conversion//boost_numeric_conversion
/boost/polygon//boost_polygon
/boost/predef//boost_predef
/boost/qvm//boost_qvm
/boost/range//boost_range
/boost/rational//boost_rational
/boost/serialization//boost_serialization
/boost/static_assert//boost_static_assert
/boost/thread//boost_thread
/boost/throw_exception//boost_throw_exception
/boost/tokenizer//boost_tokenizer
/boost/tuple//boost_tuple
/boost/type_traits//boost_type_traits
/boost/variant//boost_variant
/boost/variant2//boost_variant2 ;
project /boost/geometry
: common-requirements
<include>include
: requirements
[ requires
cxx14_constexpr
cxx14_return_type_deduction
]
<toolset>msvc:<asynch-exceptions>on
;
explicit
[ alias boost_geometry : : : : <library>$(boost_dependencies) ]
[ alias all : boost_geometry test example doc/src/examples index extensions ]
;
call-if : boost-library geometry
;

View File

@ -11,8 +11,9 @@
project geometry/doc ;
# Auto-index, experimental. Commented otherwise does not build without.
#using auto-index ;
#using auto-index ;
using quickbook ;
using python ;
path-constant here : . ;
path-constant images_location : html ;
@ -23,13 +24,14 @@ testing.make-test run-pyd :
:
<pythonpath>$(here)
<dependency>src/docutils/tools/doxygen_xml2qbk//doxygen_xml2qbk
<dependency>doxy/Doxyfile
<testing.arg>"--release-build --doxygen-xml2qbk"
<testing.input-file>src/docutils/tools/doxygen_xml2qbk//doxygen_xml2qbk
:
make_qbk ;
explicit make_qbk ;
boostbook geometry
boostbook geometry
: geometry.qbk
: <dependency>Jamfile
<dependency>quickref.xml
@ -47,7 +49,7 @@ boostbook geometry
<xsl:param>boost.root=../../../..
<quickbook-define>enable_index
<include>$(here)
<format>pdf:<xsl:param>img.src.path=$(images_location)/
<format>pdf:<xsl:param>img.src.path=$(images_location)/
<dependency>make_qbk
;

View File

@ -68,7 +68,7 @@ struct access<std::array<T, D>, Index> {
* [link geometry.reference.adapted.boost_fusion Boost.Fusion]
* [link geometry.reference.adapted.boost_polygon Boost.Polygon]
* [link geometry.reference.adapted.boost_tuple Boost.Tuple]
* other point types, adapted e.g. using one of the [link geometry.reference.adapted registration macro's]
* other point types, adapted e.g. using one of the [link geometry.reference.adapted.register registration macro's]
[endsect]

22
doc/debug_clean_doc.sh Executable file
View File

@ -0,0 +1,22 @@
# ===========================================================================
# Copyright (c) 2024-2024 Barend Gehrels, Amsterdam, the Netherlands.
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# ============================================================================
# Removes all generated output
b2 clean
rm -f index/generated/*.qbk
rm -f generated/*.qbk
rm -f generated/*.xml
rm -Rf html/geometry
rm -Rf doxy/doxygen_output/xml
rm -Rf doxy/doxygen_output/html_by_doxygen
rm -Rf index/xml
rm -Rf index/html_by_doxygen
git ls-files --others

153
doc/debug_make_doc.sh Executable file
View File

@ -0,0 +1,153 @@
# ===========================================================================
# Copyright (c) 2024-2024 Barend Gehrels, Amsterdam, the Netherlands. #
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# ============================================================================
# Makes the documentation without calling b2, to be able to do it in steps
# and debug the individual steps.
#
# The following software must be in your path:
# - doxygen
# - xsltproc
# - python3
# - doxygen_xml2qbk (provided by Boost.Geometry)
# - quickbook (should be made, it is referred to in a relative path)
#
# Execute the script from .../boost/libs/geometry/doc
echo "=== Generating documentation for Boost.Geometry"
base=`pwd`
boost_root=`realpath ${base}/../../..`
# Set the DocBook (and dtd and boost dtd, less relevant) versions.
# 1.75.2 is the one setup within Boost for ages.
# It reports as debug message: "Computing chunks..."
# But it currently gives the error message
# "The called template 'id.attribute' was not found."
# For all libraries (not only Boost.Geometry)
# 1.79.1 works and gives correct documentation
# It does not output any extra debug message
# 1.79.2 (with namespaces, on mac) gives empty content for sub-toc pages for Boost.Geometry
# It reports as debug message: "Note: namesp. add : added namespace before processing Geometry"
# 1.79.2 ("nons", no namespace) works and gives correct documentation
# It can be downloaded from https://www.linuxfromscratch.org/blfs/view/stable/pst/docbook-xsl.html
# Set the values with 4.2 / 1.75.2 - used by setup_boostbook.sh
docbook_dtd_version=4.2
docbook_xsl_version=1.75.2
docbook_dtd=${boost_root}/tools/boostbook/docbook-dtd-${docbook_dtd_version}
docbook_xsl=${boost_root}/tools/boostbook/docbook-xsl-${docbook_xsl_version}
# OVERRIDE the values with 4.5 / 1.79.1 - used by boostorg/release-tools/blob/develop/build_docs
docbook_dtd_version=4.5
docbook_xsl_version=1.79.1
docbook_dtd=~/data/docbook/docbook-dtd-${docbook_dtd_version}
docbook_xsl=~/data/docbook/docbook-xsl-${docbook_xsl_version}
# UNCOMMENT the values with 4.5 / 1.79.2 - for future usage, note the "nons", which is essential
# docbook_xsl_version=1.79.2
# docbook_xsl=~/data/docbook/docbook-xsl-nons-${docbook_xsl_version}
# Set other values of dtd, css, style sheets
boostbook_dtd=${boost_root}/tools/boostbook/dtd
file_css=${boost_root}/doc/src/boostbook.css
xsl_docbook=${boost_root}/tools/boostbook/xsl/docbook.xsl
xsl_html=${boost_root}/tools/boostbook/xsl/html.xsl
# Set the folder where to generate boostbook/docbook and some filenames
folder_generated=generated
file_boostbook=${folder_generated}/geometry.boostbook.xml
file_docbook=${folder_generated}/geometry.docbook.xml
# === step 1 ===
echo "=== Running Doxygen"
cd doxy
doxygen Doxyfile
cd ..
# === step 2 ===
# Note that doxygen_xml2qbk should be in your path!
echo "=== From Doxygen XML to QuickBook"
python3 make_qbk.py --skip_doxygen
# === step 3 ===
echo "=== From QuickBook to BoostBook"
${boost_root}/dist/bin/quickbook -I"${boost_root}" -I"." -D"enable_index" \
--output-file=${file_boostbook} geometry.qbk
# === step 4 ===
# To avoid using b2 and user-config.jam, the catalog has to be written locally
filename_catalog=${folder_generated}/catalog.xml
echo "=== Write ${filename_catalog} for xstlproc with ${docbook_xsl}"
cat <<EOF >${filename_catalog}
<?xml version="1.0"?>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI uriStartString="http://www.boost.org/tools/boostbook/dtd/" rewritePrefix="file:///${boostbook_dtd}/"/>
<rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/${docbook_dtd_version}/" rewritePrefix="file:///${docbook_dtd}/"/>
<rewriteURI uriStartString="http://docbook.sourceforge.net/release/xsl/current/" rewritePrefix="file:///${docbook_xsl}/"/>
</catalog>
EOF
# It is necessary to publish its location in an environment variable
export XML_CATALOG_FILES=${filename_catalog}
# Set parameters shared for Boostbook -> Docbook -> HTML
params="--xinclude"
params="${params} --stringparam boost.defaults Boost"
# Set boost.root (here, it should be relative, and go one above boost root itself)
params="${params} --stringparam boost.root ../../../.."
echo "=== From BoostBook to DocBook"
xsltproc ${params} --path ${folder_generated} -o ${file_docbook} ${xsl_docbook} ${file_boostbook}
# === step 5 ===
# These parameters define behaviour for DocBook.
# See also https://www.sagehill.net/docbookxsl/TOCcontrol.html
# The parameters values should correspond with the values in Jamfile.
# Their values are currently valid for docbook-xsl-1.75.2 (the version included in Boost).
# However, the sections.xsl file currently included boost do not work for 1.75.2
# If this is encountered, remove the part "<xsl:call-template name="id.attribute">"
# Their values are currently also valid for version 1.79.1
# But for version 1.79.2 is used, the chunking is broken.
chunk_section_depth=4
chunk_first_sections=1
toc_section_depth=3
toc_max_depth=2
generate_section_toc_level=4
params="${params} --stringparam chunk.section.depth ${chunk_section_depth}"
params="${params} --stringparam chunk.first.sections ${chunk_first_sections}"
params="${params} --stringparam toc.max.depth ${toc_max_depth}"
params="${params} --stringparam toc.section.depth ${toc_section_depth}"
params="${params} --stringparam generate.section.toc.level ${generate_section_toc_level}"
echo "=== From DocBook to html"
xsltproc ${params} --path ${folder_generated} -o "html/" ${xsl_html} ${file_docbook}
echo "=== Resulting html, generated with:"
cat html/index.html| grep -w -e generator
echo "=== Resulting contents of generated 'adapted.html', there should be sections"
cat html/geometry/reference/adapted.html | grep section

View File

@ -5,19 +5,19 @@
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "Boost.Geometry (aka GGL)"
PROJECT_NUMBER =
PROJECT_NUMBER =
OUTPUT_DIRECTORY = ./doxygen_output
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = c:/_svn/boost/trunk/boost/geometry \
c:/_svn/boost/trunk/libs/geometry/doc/doxygen_input/pages
STRIP_FROM_INC_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
QT_AUTOBRIEF = NO
@ -26,7 +26,7 @@ INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
# The aliases are shortcuts for Doxygen documentation.
# The aliases are shortcuts for Doxygen documentation.
# Within Boost.Geometry they are used in the top section, so for both
# Doxygen documentation and QuickBook documentation.
# They avoid repetations and make the documentation more structured.
@ -39,6 +39,8 @@ TAB_SIZE = 8
# \return* for various return cases
ALIASES = qbk{1}="\xmlonly <qbk>\1</qbk> \endxmlonly" \
qbk{2}="\xmlonly <qbk.\1>\2</qbk.\1> \endxmlonly" \
wkt="WKT" \
well_known_text="Well-Known Text" \
brief_calc{1}="Calculates the \1 of a geometry" \
brief_calc2{1}="Calculate the \1 of two geometries" \
brief_calc2{2}="Calculate the \1 \2 two geometries" \
@ -99,11 +101,13 @@ ALIASES = qbk{1}="\xmlonly <qbk>\1</qbk> \endxmlonly" \
details_calc{1}="The free function \1 calculates the \1 of a geometry" \
details_calc2{2}="The free function \1 calculates the \2 of two geometries" \
details_calc2{1}="The free function \1 calculates the \1 of two geometries" \
details_free_function{3}="The free function [^\1] calculates the \2 \3 two geometries" \
details_check12{2}="The free function \1 checks if the first geometry \2 the second geometry" \
details_macro{2}="The macro \1 registers a \2 such that it is recognized by Boost.Geometry and that Boost.Geometry functionality can used with the specified type." \
details_macro_const="The const version registers only read access to the fields, the point type is therefore read-only" \
details_macro_getset="The get/set version registers get and set methods separately and can be used for classes with protected member variables and get/set methods to change coordinates" \
details_macro_const="The const version registers only read access to the fields, the point type is therefore read-only." \
details_macro_getset="The get/set version registers get and set methods separately and can be used for classes with protected member variables and get/set methods to change coordinates." \
details_macro_templated{2}="The type must have one template parameter, which should be a \2 type, and should not be specified. Boost.Geometry takes care of inserting the template parameter. Hence all types of this templated \1 are registered, regardless of their point type." \
details_macro_lola="For geographic coordinate systems, be sure to specify first longitude and then latitude, to be able to use the strategies included in the library." \
details_default_strategy="It uses the default strategy, based on the coordinate system of the geometry." \
details_strategy_reasons="Reasons to specify a strategy include: use another coordinate system for calculations; construct the strategy beforehand (e.g. with the radius of the Earth); select a strategy when there are more than one available for a calculation." \
details_return{1}="This version with the return_ prefix returns the \1, and a template parameter must therefore be specified in the call." \
@ -124,6 +128,8 @@ ALIASES = qbk{1}="\xmlonly <qbk>\1</qbk> \endxmlonly" \
macro_x="first (usually x)" \
macro_y="second (usually y)" \
macro_z="third (usually z)" \
macro_x_lon="first (usually x, or longitude)" \
macro_y_lat="second (usually y, or latitude)" \
p_l_or_c="Point, LineString or Polygon"
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
@ -161,10 +167,10 @@ GENERATE_TODOLIST = NO
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = NO
FILE_VERSION_FILTER =
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
@ -174,7 +180,7 @@ WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
@ -227,7 +233,6 @@ INPUT = . .. ../../../../boost/geometry/core \
../../../../boost/geometry/strategy/spherical \
../../../../boost/geometry/util \
../../../../boost/geometry/views \
./doxygen_input/pages \
./doxygen_input/groups
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.hpp
@ -239,19 +244,19 @@ EXCLUDE = ../../../../boost/geometry/util/builder.hpp \
../../../../boost/geometry/util/distance_sort.hpp \
./doxygen_extension_examples.hpp
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH = . .. ../../example ../../example/with_external_libs \
doxygen_input/sourcecode \
../../../../boost/geometry/geometries \
../../../../boost/geometry/strategies \
../../../../boost/geometry/strategies/cartesian \
../../../../boost/geometry/algorithms
EXAMPLE_PATTERNS =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH = doxygen_input/images
INPUT_FILTER =
FILTER_PATTERNS =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
@ -268,23 +273,25 @@ VERBATIM_HEADERS = NO
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
COLS_IN_ALPHA_INDEX = 3
IGNORE_PREFIX =
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
# This is only for debug purposes. For the final documentation, XML output is
# converted to QuickBook and then to BoostBook and DocBook and html
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html_by_doxygen
HTML_FILE_EXTENSION = .html
HTML_HEADER = doxygen_input/ggl_doxygen_header.html
HTML_FOOTER = doxygen_input/ggl_doxygen_footer.html
HTML_STYLESHEET =
HTML_STYLESHEET =
GENERATE_HTMLHELP = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Generated documentation, by Doxygen"
DOCSET_BUNDLE_ID = org.doxygen.Project
HTML_DYNAMIC_SECTIONS = NO
CHM_FILE =
HHC_LOCATION =
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
@ -311,14 +318,14 @@ GENERATE_PERLMOD = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = BOOST_CONCEPT_REQUIRES(x) \
BOOST_CONCEPT_ASSERT(x) \
BOOST_STATIC_ASSERT(x) \
@ -331,12 +338,12 @@ PREDEFINED = BOOST_CONCEPT_REQUIRES(x) \
DOXYGEN_NO_STRATEGY_SPECIALIZATIONS \
DOXYGEN_NO_SPECIALIZATIONS \
DOXYGEN_INVOKED
EXPAND_AS_DEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

View File

@ -1,33 +0,0 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# ===========================================================================
# Copyright (c) 2010 Barend Gehrels, Amsterdam, the Netherlands.
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)9
# ============================================================================
import sys
args = sys.argv[1:]
if len(args) != 1:
raise SystemExit("Usage: doxygen_enhance <html filename>")
# 1) set variable for doxygen_contents to be posted
file_in = open(args[0], 'r')
doxygen_contents = file_in.read()
doxygen_contents = doxygen_contents.replace('<span>Modules</span>', '<span>Function overview</span>')
doxygen_contents = doxygen_contents.replace('<span>Related&nbsp;Pages</span>', '<span>Main pages</span>')
doxygen_contents = doxygen_contents.replace('<span>Main&nbsp;Page</span>', '<span>Introduction</span>')
doxygen_contents = doxygen_contents.replace('<li><a href="namespaces.html"><span>Namespaces</span></a></li>', '')
doxygen_contents = doxygen_contents.replace('<h1>Modules</h1>Here is a list of all modules:<ul>', '<h1>Function overview</h1>Here is a list of all functions:<ul>')
doxygen_contents = doxygen_contents.replace('<h1>Related Pages</h1>Here is a list of all related documentation pages:<ul>', '<h1>Main pages</h1>The following pages give backgrounds on Boost.Geometry:<ul>')
file_out = file (args[0], 'w')
file_out.write(doxygen_contents)
file_out.close()

View File

@ -1,214 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef _DOXYGEN_SETS_HPP
#define _DOXYGEN_SETS_HPP
//---------------------------------------------------------------------------------------------------
/*!
\page sets Spatial set-theoretic operations (union, intersection, difference)
\section sets_par1 Introduction
The GGL implementation of the algorithms intersection, union, difference and symmetric difference is based on set theory (a.o. http://en.wikipedia.org/wiki/Set_(mathematics)).
This theory is applied for spatial sets.
Intersection and union are so-called set-theoretic operations. Those operations
work on sets, and geometries (especially
polygons and multi-polygons) can be seen as sets, sets of points.
The first section will repeat a small, relevant part of the algebra of sets, also describing the notation used in this page. The next section will extend this algebra of sets for spatial sets (polygons).
\section sets_par2 Algebra of sets in a spatial context
- A &#8745; B : the intersection of two sets A and B is the set that contains all elements of A that also belong to B (aka AND)
- A &#8746; B : the union of two sets A and B is the set that contains all elements that belong to A or B (aka OR)
- A<small><sup>c</sup></small> : the complement of set A is the set of elements which do not belong to A
- A \ B : the difference of two sets A and B is the set of elements which belong to A but not to B
- A &#8710; B : the symmetric difference of two sets A and B is the set of elements which belong to either A or to B, but not to A and B (aka XOR)
(Source of most definitions: http://en.wikipedia.org/wiki/Algebra_of_sets)
There are several laws on sets and we will not discuss them all here. The most important for this page are:
- B \ A = A<small><sup>c</sup></small> &#8745; B and, vice versa, A \ B = B<small><sup>c</sup></small> &#8745; A
- A &#8710; B = (B \ A) &#8746; (A \ B) (http://www.tutorvista.com/content/math/number-theory/sets/operations-sets.php)
\section sets_par3 Polygons
Polygons are sets of points, and, therefore polygons follow all definitions and laws for sets. For pragmatic reasons and implementations in computer programs, polygons have an orientation, clockwise or counter clockwise. Orientation is not part of most set theory descriptions, but is an important aspect for the appliance of sets to polygon operations.
If a polygon is (arbitrarily) defined as having its vertices in clockwise direction:
- then its interior lies on the right side of the edges [http://gandraxa.com/draw_orthogonal_polygons.aspx]
- and its exterior lies, therefore, on the left side of the edges
This definition is important for the spatial interpretation sets.
- If set A describes the interior of a polygon, then A<small><sup>c</sup></small>, its complement, describes the exterior of a polygon.
- Stated differently, set A is a polygon, all points belonging to A are inside the polygon. Its complement, A<small><sup>c</sup></small>, contains all points not belonging to A.
- If A is a polygon with its vertices oriented clockwise, A<small><sup>c</sup></small> is a polygon with the same vertices, but in reverse order, so counter clockwise. Both sets have their points belonging to them at the right side of their edges
\image html set_a_ac.png
The last observation is helpful in calculating the difference and the symmetric difference:
- the difference B \ A is defined above by the law B \ A = A<small><sup>c</sup></small> &#8745; B.
In polygon terms it is therefore the intersection of the "reverse of A" with B.
To calculate it, it is enough to have polygon A input in reverse order, and intersect this with polygon B
- the symmetric difference A &#8710; B is defined above by the law (B \ A) &#8746; (A \ B), which leads to
(A<small><sup>c</sup></small> &#8745; B) &#8746; (B<small><sup>c</sup></small> &#8745; A).
To calculate the symmetric difference, it is enough to have polygon A input in reverse order,
intersect this with polygon B, store the result; then have polygon B input in reverse order,
intersect this with polygon A, add this to the result and this is the symmetric difference.
The combination of both sub-results does not have to be intersected as it is only touching
on vertices and do not have overlaps.
\section sets_par4 Implementation of intersection and union
All spatial set-theoretic operations are implemented in shared code. There is hardly any difference in code
between the calculation of an intersection or a union. The only difference is that at each intersection point,
for an intersection the right turn should be taken. For union the left turn should be taken.
\image html set_int_right_union_left.png
This is implemented as such in GGL. The turn to be taken is a variable.
There is an alternative to calculate union as well:
- the union A &#8746; B equals to the complement of the intersection of the complements of the inputs,
(A<small><sup>c</sup></small> &#8745; B<small><sup>c</sup></small>)<small><sup>c</sup></small> (De Morgan law,
http://en.wikipedia.org/wiki/Algebra_of_sets#Some_additional_laws_for_complements)
There is an additional difference in the handling of disjoint holes (holes which are not intersected). This is also
implemented in the same generic way (the implementation will still be tweaked a little to have it even more generic).
For a counter clockwise polygon, the behaviour is the reverse: for intersection take the left path, for union
take the right path. This is a trivial thing to implement, but it still has to be done (as the orientation was introduced
in a later phase in GGL).
\section sets_par5 Iterating forward or reverse
As explained above, for a difference, the vertices of the first polygon should be iterated by a forward iterator, but
the vertices of the second polygon should be iterated by a reverse iterator (or vice versa). This (trivial) implementation
still has to be done. It will <b>not</b> be implemented by creating a copy, reversing it, and presenting it as input to the
set operation (as outlined above). That is easy and will work but has a performance penalty. Instead a reversible iterator will used,
extended from Boost.Range iterators, and decorating a Boost.Range iterator at the same time, which can travel forward or backward.
It is currently named \b reversible_view and usage looks like:
\code
template <int Direction, typename Range>
void walk(Range const & range)
{
typedef reversible_view<Range, Direction> view_type;
view_type view(range);
typename boost::range_const_iterator<view_type>::type it;
for (it = boost::begin(view); it != boost::end(view); ++it)
{
// do something
}
}
walk<1>(range); // forward
walk<-1>(range); // backward
\endcode
\section sets_par6 Characteristics of the intersection algorithm
The algorithm is a modern variant of the graph traversal algorithm, after Weiler-Atherton
(http://en.wikipedia.org/wiki/Weiler-Atherton_clipping_algorithm).
It has the following characteristics (part of these points are deviations from Weiler-Atherton)
- No copy is necessary (the original Weiler-Atherton, and its descendants, insert intersections in (linked) lists,
which require to make first copies of both input geometries).
- All turning points (which are intersection points with side/turn information) are unaware of the context, so we have (and need) no information about
if, before the intersection point, a segment was inside or outside of the other geometry
- It can do intersections, unions, symmetric differences, differences
- It can handle polygons with holes, non-convex polygons, polygons-with-polygons, polygons-with-boxes (clip), rings, multi-polygons
- It can handle one polygon at the time (resolve self-intersections), two polygons (the normal use case), or more polygons (applicable
for intersections and unions)
- It can handle clockwise and counter-clockwise geometries
\section sets_par7 Outline of the intersection algorithm
The actual implementation consists of the next phases.
\b 1 the input geometries are indexed (if necessary). Currently we use monotonic sections for the index. It is done
by the algorithm \b sectionalize. Sections are created is done on the fly, so no preparation is required before (though this would improve
performance - it is possible that there will be an alternative variant where prepared sections or other indexes are part of the input).
For box-polygon this phase is not necessary and skipped. Sectionalizing is done in linear time.
\b 2, intersection points are calculated. Segments of polygon A are compared with segments of polygon B. Segment intersection is only
done for segments in overlapping sections. Intersection points are not inserted into the original polygon or in a copy. A linked list is therefore not necessary.
This phase is called \b get_intersection_points. This function can currently be used for one or two input geometries, for self-intersection
or for intersection.
Because found intersections are provided with intersection-information, including a reference to their source, it is possible (but currently not
implemented) to have more than two geometry inputs.
The complexity of getting the intersections is (much) less than quadratic (n*m) because of the monotonic sections. The exact complexity depends on
the number of sections, of how the input polygons look like. In a worst case scenario, there are only two monotonic sections per polygon and both
overlap. The complexity is then quadratic. However, the sectionalize algorithm has a maximum number of segments per section, so for large polygons
there are always more monotonic sections and in those cases they do not overlap by the definition of "monotonic".
For boxes, the complexity is linear time.
To give another idea of how sections and indexes work:
For a test processing 3918 polygons (but not processing those of which envelopes do not overlap):
- brute force (O(n<small><sup>2</sup></small>)): 11856331 combinations
- monotonic sections: 213732 combinations (55 times less)
- a spatial index: 34877 combinations (1/6 of using monotonic sections)
So there can still be gained some performance by another index. However the current spatial index implementation (in an extension,
not in Formal Review) will still be revisited, so it is currently not used.
<i>In "normal" cases 84% of the time is spent on finding intersection points. These divisions in %'s refers to the performance test described elsewhere</i>
One piece of information per intersection points is if it is \b trivial. It is trivial if the intersection is not located at segment end points.
\b 3, the found intersection points are merged (\b merge_intersection_points), and some intersections can be deleted (e.g. in case of
collinearities). This merge process consists of sorting the intersection points in X (major) and Y (minor) direction, and merging intersections with a common location together. Intersections with common
locations do occur as soon as segments are collinear or meet at their end points.
This phase is skipped if all intersection points are trivial.
<i>About 6% is spent on merging.</i>
\b 4, some turns need to be adapted. If segments intersect in their interiors, this is never necessary. However, if segments intersect on their
end points, it is sometimes necessary to change "side" information to "turn" information. This phase is called \b adapt_turns.
The image below gives one example when adapting turns is necessary. There is side information, both segments have sides \b left and \b right, there
is also \b collinear.
However, for an intersection no turn should be taken at all, so no right turn. For a union, both polygons have to be travelled.
In this case the side information is adapted to turn information, both turns will be \b left. This phase is skipped if all intersection points are trivial.
\image html set_adapt_turns.png
\b 5, the merged intersection points are enriched (\b enrich_intersection_points) with information about a.o. the next intersection point (travel information).
<i>About 3% is spent on enrichment.</i>
\b 6, polygons are traversed (\b traverse) using the intersection points, enriched with travel information. The input polygons are traversed and
at all intersection poitns a direction is taken, left for union, right for intersection point (for counter clockwise polygons this is the other way
round). In some cases separate rings are produced. In some cases new holes are formed.
<i>About 6% is spent on traversal.</i>
\b 7, the created rings are assembled (\b assemble) into polygon(s) with exterior rings and interior rings. Even if there are no intersection points found, this process can be important to find containment and coverage.
<i>Timing of this phase is not yet available, as the comparison program work on rings.</i>
*/
#endif // _DOXYGEN_SETS_HPP

View File

@ -1,79 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef _DOXYGEN_STRATEGY_RATIONALE_HPP
#define _DOXYGEN_STRATEGY_RATIONALE_HPP
//---------------------------------------------------------------------------------------------------
/*!
\page strategy Strategy rationale
\section strpar1 Purpose of strategies
A strategy is (Wikipedia, http://en.wikipedia.org/wiki/Strategy_pattern) a software design pattern whereby algorithms can be selected at runtime. According to Wikipedia, it is also known as the Policy pattern. In the C++ template contexts, policies are usually meant as selecting functionality at compile time. so it is reasonable to state that a strategy can also be used at compile-time
Within GGL the term policy is used (sparsely), but in a broader, or in another context. The term Strategy is used specificly for a computation method targeted to a specific coordinate system
GGL-Strategies do have the following purposes:
- for each coordinate system, a default strategy is selected by compile time, using the coordinate system tag. This is effectively tag dispatching.
- users can override the default choice by using the overloaded function, which has a strategy as an extra parameter, and take another strategy
- users can override the default choice by using the overloaded function, to use the default strategy, but constructed with specific parameters
- users can override the default choice by using the overloaded function, to use the default strategy (which can be a templated structure), with other template parameters then the default ones
- users can override the default choice by using the overloaded function, to use the default strategy (which can be a templated structure), with other template parameters then the default ones, with the specific purpose as to select another calculation type (e.g. GMP or another big number type)
All this happens at compile-time.
For example (this is also explained in the design rationale) the distance functionality. The default distance strategy for point-point is Pythagoras (for cartesian coordinate systems) or Haversine (for spherical) or Andoyer (for geographic). Haversine works on the unit sphere, radius 1. Library users can use the distance function, specifying haversine strategy constructed with a radius of 2. Or they can use the distance function, specifying the more precise Vincenty strategy (for geographic coordinate systems, but that might not even be checked there). Specifying strategies is useful, even if not point-point distance is to be calculated, but e.g. point-polygon distance. In the end it will call the elementary specified functionality. Note that, for this example, the point-segment distance strategy is also "elementary". Note also that it can have an optional template parameter defining the underlying point-point-distance-strategy.
\section strpar2 Properties of strategies
Because strategies can be constructed outside the calling function, they can be specified as an optional parameter (implemented as an overloaded function), and not as only a template-parameter. Furthermore, strategies might be used several times, in several function calls. Therefore they are declared as const reference parameter, they should be stateless (besides construction information).
The strategy needs to access construction information (member variables), its calculation method is therefore usually not a static method but a non-static const method. It can then access member variables, while still being const, non-mutable, stateless, being able to be called across several function calls.
If often has to keep some calculation information (state), so it should (for some algorithms) declare a state_type. In those cases, that state_type is instantiated before first call and specified in each call.
The calculation method is always called \b apply (as convention in GGL) and gets the most elementary information as a parameter: a point, a segment, a range. It depends on the algorithm and, sometimes, on the source geometry passed. That should actually be the case as least as possible
In most cases, there is an additional method \b result which returns the calculated result. That result-method is a also non-static const method, and the state is passed.
Note that the methods might be non-static const, but they might also be static. That is not checked by the concept-checker.
A strategy for a specific algorithm has a concept. The distance-strategy should follow the distance-strategy-concept. The point-in-polygon strategy should follow the point-in-polygon-strategy-concept. Those concepts are not modelled as traits classes (contrary to the geometries). The reason for this is that it seems not necessary to use legacy classes as concepts, without modification. A wrapper can be built. So the strategies should have a method \b apply and should define some types.
Which types, and which additional methods (often a method \b result), is dependant on the algorithm / type of strategy.
Strategies are checked by a strategy-concept-checker. For this checker (and sometimes for checking alone), they should define some types. Because if no types are defined, the methods cannot be checked at compile time... The strategy-concept-checkers are thus implemented per algorithm and they use the Boost Concept Check Library for checking.
So as explained above, the essence of the design is:
- function determines default-strategy, or is called with specified strategy
- function calls dispatch (dispatching is done on geometry_tag)
- dispatch calls implementation (in namespace detail), which can be shared for different geometry types and for single/multi
- implementation calls strategy (if applicable), with the smallest common (geometric) element applicable for all calculation method, the common denominator
\section strpar3 Alternative designs
Some calculations (strategies) might need to take the whole geometry, instead of working on point-per-point or segment-per-segment base. This would bypass the dispatch functionality. Because all strategies would take the whole geometry, it is not necessary to dispatch per geometry type. In fact this dispatching on geometry-type is moved to the strategy_traits class (which are specialized per coordinate system in the current design). So in this alternative design, the strategy traits class specializes on both geometry-tag and coordinate-system-tag, to select the default strategy.
For the default strategy, this move from "dispatch" to another dispatch called "strategy_XXX" (XXX is the algorithm) might make sense. However, if library users would call the overloaded function and specify a strategy, the only thing what would happen is that that specified strategy is called. So, for example:
\code
template <typename G1, typename G2, typename S>
bool within(G1 const& g1, G2 const& g2, S& const strategy)
{
return strategy.apply(g1, g2);
}
\endcode
The library user could call just this strategy.apply(..) method directly. If more strategies are provided by the library or its extensions,
it would still make sense: the user can still call \b within and does not have to call the \b apply method of the strategy.
The convex hull strategy currently works on a whole geometry. However, it is possible that it will be reshaped to work per range (the algorithm
internally works per range), plus a mechanism to pass ranges multiple times (it currently is two-pass).
*/
#endif // _DOXYGEN_STRATEGY_RATIONALE_HPP

View File

@ -1,137 +0,0 @@
// Boost.Geometry (aka Boost.Geometry, Generic Geometry Library)
//
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef _DOXYGEN_ROBUSTNESS_HPP
#define _DOXYGEN_ROBUSTNESS_HPP
/---------------------------------------------------------------------------------------------------
/*!
\page robustness Boost.Geometry and Robustness
\section robustness_par1 Introduction
Floating point coordinates have limited precision. Geometry algorithms have to take this into account.
If differences between points are very small, it may lead to false result of a mathematical calculation performed on such points, what in turn, may cause algorithm result as inadequate to actual geometric situation. For example, a point which is located left from a segment, but \b very close to it, can be reported on that segment or right from it. Also if differences are a little larger, artifacts can be shown in geometric algorithms.
See for more backgrounds e.g.:
- <a href="http://www.mpi-inf.mpg.de/~kettner/pub/nonrobust_cgta_06.pdf">Classroom Examples of Robustness Problems in Geometric Computations</a>
- <a href="http://groups.csail.mit.edu/graphics/classes/6.838/S98/meetings/m12/pred/m12.html">Robust Predicates and Degeneracy</a>
Boost.Geometry is aware of these issues and provides several approaches to minimize the problems, or avoid them completely using
- <a href="http://en.wikipedia.org/wiki/GNU_Multi-Precision_Library">GMP</a>
- <a href="http://en.wikipedia.org/wiki/Class_Library_for_Numbers">CLN</a>
\section robustness_par2 Example
An example. Consider the elongated triangle and box below.
\image html robust_triangle_box.png
The left edge of the triangle has a length of about the precision of the floating point grid. It is not possible to do this intersection correctly, using floating point. No library (using floating point) can do that, by nature of float point numerical representation. It is not possible to express the four different coordinates in the resulting intersected polygon. Theoretically distinct points will be assigned to the very same location.
Also if the left edge is longer than that, or using double coordinates, those effects will be there. And of course not only in triangles, but any spiky feature in a polygon can result in non representable coordinates or zero-length edges.
\section robustness_par3 Coordinate types
All geometry types provided by Boost.Geometry, and types by the user, do have a coordinate type. For example
\code
boost::geometry::point_xy<float> p1;
boost::geometry::point_xy<double> p2;
boost::geometry::point_xy<long double> p3;
\endcode
describes three points with different coordinate types,
a 32 bits <a href="http://en.wikipedia.org/wiki/Single_precision">float</a>,
a 64 bits <a href="http://en.wikipedia.org/wiki/Double_precision_floating-point_format">double</a>,
a <a href="http://en.wikipedia.org/wiki/Long_double">long double</a>, not standardized by IEEE and is on some machines 96 bits (using a MSVC compiler it is a synonym for a double).
By default, algorithms select the coordinate type of the input geometries. If there are two input geometries, and they have different coordinate types, the coordinate type with the most precision is selected. This is done by the meta-function \b select_most_precise.
Boost.Geometry supports also high precision arithmetic types, by adaption. For example from Boost.Multiprecision.
\section robustness_par4 Calculation types
If high precision arithmetic types are used as shown above, coordinates are stored in these points. That is not always necessary. Therefore, Boost.Geometry provides a second approach. It is possible to specify that only the calculation is done in high precision. This is done by specifying a strategy. For example, in area:
Example:
The code below shows the calculation of the area. Points are stored in double; calculation is done using \b GMP
\code
{
using point_type = bg::model::point<default_test_type, 2, bg::cs::cartesian> ;
boost::geometry::model::ring<point_type> ring;
ring.push_back(boost::geometry::make<point_type>(0.0, 0.0));
ring.push_back(boost::geometry::make<point_type>(0.0, 0.0012));
ring.push_back(boost::geometry::make<point_type>(1234567.89012345, 0.0));
ring.push_back(ring.front());
using mp = boost::multiprecision::cpp_bin_float_100;
auto area = boost::geometry::area(ring, boost::geometry::strategies::area::cartesian<mp>());
std::cout << area << std::endl;
}
\endcode
Above shows how this is used to use Boost.Multiprecision with double coordinates. Exactly the same mechanism works (of course) also to do calculation in double, where coordinates are stored in float.
\section robustness_par5 Strategies
In the previous section was shown that strategies have an optional template parameter \b CalculationType so enhance precision. However, the design of Boost.Geometry also allows that the user can implement a strategy himself. In that case he can implement the necessary predicates, or use the necessary floating point types, or even go to integer and back. Whatever he prefers.
\section robustness_par6 Examples
We show here some things which can occur in challenging domains.
The image below is drawn in PowerPoint to predict what would happen at an intersection of two triangles using float coordinates in the range 1e-45.
\image html robust_float.png
If we perform the intersection using Boost.Geometry, we get the effect that is presented on the pictures below, using float (left) and using double (right).
\image html robust_triangles.png
This shows how double can solve issues which might be present in float. However, there are also cases which cannot be solved by double or long double. And there are also cases which give more deviations than just a move of the intersection points.
We investigated this and created an artificial case. In this case, there are two stars, they are the same but one of them is rotated over an interval of about 1e-44. When those stars are intersected, the current Boost.Geometry implementation using float, double or long double will give some artifacts.
Those artifacts are caused by taking the wrong paths on points where distances are zero (because they cannot be expressed in the used coordinate systems).
If using \b GMP or \b CLN, the intersection is correct.
\image html robust_stars.png
Note again, these things happen in differences of about 1e-45. We can investigate if they can be reduced or sometimes even solved. However, they belong to the floating point approach, which is not exact.
For many users, this all is not relevant. Using double they will be able to do all operations without any problems or artefacts. They can occur in real life, where differences are very small, or very large. Those users can use \b GMP to use Boost.Geometry without any problem.
\section robustness_par7 Future work
There are several methods to avoid instability and we don't know them all, some of them might be applicable to our algorithms. Therefore is stated that Boost.Geometry is "not checked on 100% robustness". As pointed out in the discussions on the Boost mailing list in spring '09 (a.o. <i>"The dependent concept should explicitely require unlimited precision since the library specifically uses it to *guarantee* robustness. [...] Users should be left with no choice but to pick some external component fulfilling the unlimited precision requirement"</i>), it seems that it is not possible to solve all these issues using any FP number, that it is necessary to use a library as GMP or CLN for this guarantee.
Therefore we decided to go for supporting high precision numeric types first, and they are currently supported in most algorithms (a.o. area, length, perimeter, distance, centroid, intersection, union). However, we certainly are willing to take other measures as well.
\section robustness_par8 Summary
Boost.Geometry approach to support high precision:
- library users can use points with float, double, or long double coordinates (the default)
- for higher numerical robustness: users can call algorithms using another calculation type (e.g. \b GMP or \b CLN, ...)
- for higher numerical robustness: users can use points with \b GMP or \b CLN coordinates
- users can implement their own implementation and provide this as a strategy, the Boost.Geometry design allows this
- other measures can be implemented, described as future work.
*/
#endif // _DOXYGEN_ROBUSTNESS_HPP

View File

@ -1,235 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef _DOXYGEN_EXAMPLES_HPP
#define _DOXYGEN_EXAMPLES_HPP
/*!
\example 01_point_example.cpp
In most cases the documentation gives small examples of how to use the algorithms or classes.
The point example is a slightly larger example giving an idea of how to use different
algorithms from the library, related to points. It shows
- the usage of include files
- how to declare points, using different coordinate types
- how to construct points, specifying coordinates, initializing to zero or to infinite
- how to compare points to each other
- how points can be streamed as OGC text
- calculating the distance from point to point
*/
//---------------------------------------------------------------------------------------------------
/*!
\example 02_linestring_example.cpp
The linestring example shows how linestrings can be declared and used and shows some more algorithms.
One of the important concepts of the Generic Geometry Library is that it is totally built upon the standard
library, using the standard containers such as std::vector.
A linestring is, as explained elsewhere in this documentation, not much more than a vector of points.
Most algorithms run on linestrings, but can also run on any iterator pair. And all algorithms
on std::vector can be used on geometry::linestring.
The sample shows this, shows some algorithms:
- geometry::envelope
- geometry::length
- geometry::distance
- geometry::simplify
- geometry::for_each
- geometry::intersection
This documentation illustrates the simplify algorithm and the intersection algorithm with some pictures.
The simplify algorithm simplifies a linestring. Simplification means that the less important points
are removed from the line and that the points that are most important for the shape of a line are
kept. Simplification is done using the well known Douglas Peucker algorithm. The library user can
specify the distance or tolerance, which indicates how much the linestring should be simplified.
The image below shows the original and simplified linestring:
\image html simplify_linestring.png
The blue line is the original linestring; the red line is the simplified line which has one point less.
In geographical applications simplification can reduce a linestring to its basic form containing only
10% of its original points.
The intersection algorithm intersects two geometries which each other, delivering a third geometry.
In the case of the example a linestring is intersected with a box. Intersection with a box is often
called a clip. The image below illustrates the intersection.
\image html clip_linestring.png
The yellow line is intersected with the blue box.
The intersection result, painted in red, contains three linestrings.
*/
//---------------------------------------------------------------------------------------------------
/*!
\example 03_polygon_example.cpp
The polygon example shows some examples of what can be done with polygons in the Generic Geometry Library:
* the outer ring and the inner rings
* how to calculate the area of a polygon
* how to get the centroid, and how to get an often more interesting label point
* how to correct the polygon such that it is clockwise and closed
* within: the well-known point in polygon algorithm
* how to use polygons which use another container, or which use different containers for points and for inner rings
* how polygons can be intersected, or clipped, using a clipping box
The illustrations below show the usage of the within algorithm and the intersection algorithm.
The within algorithm results in true if a point lies completly within a polygon. If it lies exactly
on a border it is not considered as within and if it is inside a hole it is also not within the
polygon. This is illustrated below, where only the point in the middle is within the polygon.
\image html within_polygon.png
The clipping algorithm, called intersection, is illustrated below:
\image html clip_polygon.png
The yellow polygon, containing a hole, is clipped with the blue rectangle, resulting in a
multi_polygon of three polygons, drawn in red. The hole is vanished.
include polygon_example.cpp
*/
//---------------------------------------------------------------------------------------------------
/*!
\example 06_a_transformation_example.cpp
This sample demonstrates the usage of transformations in the Generic Geometry Library.
Behind the screens this is done using with the uBLAS matrix/vector library.
\example 06_b_transformation_example.cpp
*/
//---------------------------------------------------------------------------------------------------
/*!
\example 07_a_graph_route_example.cpp
The graph route example shows how GGL can be combined with Boost.Graph. The sample does the following things:
- it reads roads (included in the distribution, stored on disk in the form of a text file containing geometries and names)
- it reads cities
- it creates a graph from the roads
- it connects each city to the nearest vertex in the graph
- it calculates the shortest route between each pair of cities
- it outputs the distance over the road, and also of the air
- it creates an SVG image with the roads, the cities, and the first calculated route
Note that this example is useful, but it is only an example. It could be built in many different ways.
For example:
- the roads/cities could be read from a database using SOCI, or from a shapefile using shapelib
- it could support oneway roads and roads on different levels (disconnected bridges)
- it currently uses tuples but that could be anything
- etc
The SVG looks like:
\image html 07_graph_route_example_svg.png
The output screen looks like:
\image html 07_graph_route_example_text.png
\example 07_b_graph_route_example.cpp
*/
//---------------------------------------------------------------------------------------------------
/*!
\example c01_custom_point_example.cpp
This sample demonstrates that custom points can be made as well. This sample contains many points, derived
from boost::tuple, created from scratch, read only points, legacy points, etc.
*/
//---------------------------------------------------------------------------------------------------
/*!
\example c02_custom_box_example.cpp
Besides custom points, custom boxes are possible as shown in this example.
*/
//---------------------------------------------------------------------------------------------------
/*
\example c03_custom_linestring_example.cpp
GPS tracks are shown in this example: a custom linestring with GPS points
*/
//---------------------------------------------------------------------------------------------------
/*!
\example c04_a_custom_triangle_example.cpp
The \b custom triangle \b example goes even further and implements a custom ring, where the area calculation
algorithm is optimized for a triangle
*/
//---------------------------------------------------------------------------------------------------
/*!
\example c04_b_custom_triangle_example.cpp
This second custom triangle example shows an alternative implementation for a custom shape, showing a
partial specialization for the area calculation.
*/
//---------------------------------------------------------------------------------------------------
/*!
\example c05_custom_point_pointer_example.cpp
This example shows how GGL can be used to adapt a pointer-to-a-point, used e.g. in a linestring
*/
//---------------------------------------------------------------------------------------------------
/*!
\example c06_custom_polygon_example.cpp
Showing a custom polygon (asked on the list during Formal Review)
*/
//---------------------------------------------------------------------------------------------------
/*!
\example x01_qt_example.cpp
This sample demonstrates that by usage of concepts, external geometries can be handled
by GGL, just calling by a one-line registration macro. In this case for the Qt Widget Library.
The example, code shown below, results in this window-output:
\image html x01_qt_example_output.png
*/
//---------------------------------------------------------------------------------------------------
/*!
\example x03_a_soci_example.cpp
First example showing how to get spatial data from a database using SOCI and put them into GGL
*/
//---------------------------------------------------------------------------------------------------
/*!
\example x03_b_soci_example.cpp
Second example showing how to get polygons from a database using SOCI and put them into GGL, using WKT.
*/
//---------------------------------------------------------------------------------------------------
/*
\example x03_c_soci_example.cpp
Example showing how to get polygons from PostGIS using SOCI and use them in GGL through WKB
*/
//---------------------------------------------------------------------------------------------------
/*
\example x03_d_soci_example.cpp
Example showing how to get polygons from PostGIS using SOCI and use them in GGL through WKB
*/
#endif // _DOXYGEN_EXAMPLES_HPP

View File

@ -1,105 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef _DOXYGEN_MAINPAGE_HPP
#define _DOXYGEN_MAINPAGE_HPP
// -> introduction.qbk
// -> quickstart.qbk
/*!
\mainpage Boost.Geometry
\section header Boost.Geometry (aka GGL, Generic Geometry Library)
<em>
Copyright &copy; 1995-2012 <b>Barend Gehrels</b>, Geodan, Amsterdam, the Netherlands.\n
Copyright &copy; 2008-2012 <b>Bruno Lalande</b>, Paris, France.\n
Copyright &copy; 2010-2012 <b>Mateusz Loskot</b>, Cadcorp, London, UK.\n
Distributed under the Boost Software License, Version 1.0.\n
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</em>
\section intro Introduction
Boost.Geometry, formally accepted by Boost, defines concepts "concepts" for geometries and
implements some algorithms on such geometries. Before acceptance by Boost it was known as GGL
(Generic Geometry Library) and this documentation still contains that name on various places.
Boost.Geometry contains a dimension-agnostic, coordinate-system-agnostic and
scalable kernel, based on concepts, meta-functions and tag- dispatching. On top
of that kernel, algorithms are built: area, length, perimeter, centroid, convex
hull, intersection (clipping), within (point in polygon), distance, envelope
(bounding box), simplify, transform, convert, and more. The library is also
designed to support high precision arithmetic numbers, such as GMP.
Boost.Geometry contains instantiable geometry classes, but library users can also use their own. Using registration macros or traits classes their geometries can be adapted to fulfil the Boost.Geometry Concepts.
Boost.Geometry might be used in all domains where geometry plays a role: mapping and GIS, gaming, computer graphics and widgets, robotics, astronomy... The core is designed to be as generic as possible and support those domains. However, for now the development has been mostly GIS-oriented.
Boost.Geometry supports the extension model, the same way as GIL also applies it. An extension is (mostly) something more specific to domains like mentioned above.
The library follows existing conventions:
- conventions from boost
- conventions from the std library
- conventions and names from one of the OGC standards on Geometry
The library can be downloaded from the Boost Sandbox,
go to the \ref download "Download page" for more information.
A (recently started) Wiki is here: http://trac.osgeo.org/ggl/wiki
\section quickstart Quick start
It is not possible to show the whole library at a glance. A few very small examples are shown below.
It should be possible to use a very small part of the library,
for example only the distance between two points.
\dontinclude doxygen_2.cpp
\skip example_for_main_page()
\skipline int a
\until endl;
Other often used algorithms are point-in-polygon:
\skipline ring_2d
\until endl;
or area:
\skip area
\until endl;
It is possible, by the nature of a template library, to mix the point types declared above:
\skip double d2
\until endl;
The pieces above generate this output:
\image html output_main.png
It is also possible to use non-Cartesian points.
For example: points on a sphere. When then an algorithm such as distance
is used the library "inspects" that it is handling spherical
points and calculates the distance over the sphere, instead of applying the Pythagorean theorem.
Finally an example from a totally different domain: developing window-based applications, for example
using QtWidgets. We check if two rectangles overlap and if so,
move the second one to another place:
\skip QRect
\until }
More examples are on the page \b Examples
*/
#endif // _DOXYGEN_MAINPAGE_HPP

View File

@ -1,433 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef _DOXYGEN_PAGES_HPP
#define _DOXYGEN_PAGES_HPP
//---------------------------------------------------------------------------------------------------
/*!
\page compat Relation to Boost and std libraries
\section boost_compat Boost
The GGL makes use of the following Boost Libraries:
- Boost Range
- Boost Type Traits (e.g. remove_const)
- Boost Concept Check Library
- Boost Numeric Conversion (cast, bounds)
- Boost MPL
- Boost Static Assert
- Boost Iterator
- Boost Smart Pointer (shared_ptr, in the extensions spatial index and projections)
- Boost uBLAS
- Adapted geometries:
- Boost Array
- Boost Tuple
- IO and parsing
- Boost Tokenizer
- Boost Conversion (lexical cast)
- Boost String Algo
- Testing
- Boost Test
- Boost Timer
- Examples
- Boost Graph Library
Many of these are used a lot inside the library.
The \b Boost.Range library is used everywhere
to declare iterators and to walk through standard containers or custom ranges.
The \b Boost \b Concept \b Check \b Library is used to check concepts, for geometries as well
as for strategies.
Tranformations are implemented using \b Boost uBLAS
\b MPL is used for a.o. reverse dispatching
Finally, the library can perfectly be used together with the \b Boost \b Graph \b Library, as shown in example 7.
\section std_compat std:: library
The GGL makes substantial use of the std library, and is designed to be compatible with it.
- provided geometries (linestring, ring, polygon, multi-s) make default use of std::vector (but that is configurable)
- std sorting, unique copies, maps can make use of provided functors in compare "compare".
- internally, there are vector's, deque's, there is sorting, many things are implemented using the std library
*/
//---------------------------------------------------------------------------------------------------
/*!
\page compiling Compiling
\section compiling_intro Compiling Boost.Geometry
Boost.Geometry is a Header Only library. So just including the headerfiles is enough
to use the algorithms. Nothing has to be linked.
Boost.Geometry is only dependant on (header only) Boost libraries. Download the Boost
Library Collection from www.boost.org, adapt the include path to include Boost.
\section platforms Platforms
The library currently compiles successfully on the following platforms:
- MS Visual Studio 2008 (Express Edition)
- MS Visual Studio 2005 (Express Edition)
- gcc version 3.4
- gcc version 4 (tested are 4.1, 4.2, 4.4)
For Visual Studio, the examples contains some project files (for 2005). However, because the library
is header only, it will be no problem to integrate it in your own project files.
The test and example folders contain also Jam-files for bjam / boost-build
For gcc, the flag -Wno-long-long can be used (surpressing warnings originating from Boost)
\section convenient_includes Convenient includes
This section concentrates on how to include GGL.
The most convenient headerfile including all algorithms and strategies is geometry.hpp:
- \#include <boost/geometry/geometry.hpp> It is recommended to include this file.
Alternatively, it is possible to include GGL headerfiles separately. However, this is inconvenient as files might
be renamed or moved occasionaly.
An often used headerfile is geometries.hpp:
- \#include <boost/geometry/geometries/geometries.hpp> This includes all default geometries: point, linestring,
polygon, linear_ring, box. It is not included in the "geometry.hpp" headerfile because
users are allowed to use their own geometries. However, for library users who want to use the provided
geometries it is most useful.
For users using only Cartesian points, with floating point coordinates (double), in 2D or 3D, you can use instead:
- \#include <boost/geometry/geometries/cartesian2d.hpp> This includes all 2D Cartesian geometries: point_2d, linestring_2d,
etc. Using this headerfile the library seems to be a non-template library, so it is convenient for users that
are not so into the template world.
\section advanced_includes Advanced includes
This section is for users who have their own geometries and want to use algorithms from the Boost.Geometry.
If you want to use your own points it makes sense to use the registration macro's:
- \#include <boost/geometry/geometries/register/point.hpp> macro's for point registration
- \#include <boost/geometry/geometries/register/box.hpp> macro's for box registration
\section extension_includes Extensions
The GGL is currently (since 0.5) split into the kernel and several extensions. As this split is relatively new,
there are not yet umbrella-include files, but most things below will do:
If you want to use the \b geographic coordinate system:
- the tag is already included in the kernel
- \#include <boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp> for Andoyer distance calculations
- \#include <boost/geometry/extensions/gis/geographic/strategies/vincenty.hpp> for Vincenty distance calculations
If you want to use the \b projections:
- \#include <boost/geometry/extensions/gis/projections/parameters.hpp>
- \#include <boost/geometry/extensions/gis/projections/projection.hpp>
- \#include <boost/geometry/extensions/gis/projections/factory.hpp>
If you want to use the \b circle (n-sphere)
- \#include <boost/geometry/extensions/nsphere/...> <i>Several headerfiles, there is not yet a common include</i>
\section performance Performance finetuning
The enumeration below is not exhaustive but can contain hints to improve the performance
- For Microsoft, set the define _SECURE_SCL=0
- For Microsoft, set the define _HAS_ITERATOR_DEBUGGING=0
- our measurements indicate that MSVC 2005 generates faster code than MSVC 2008
- Using StlPort results in significant faster code than Microsoft's standard library
- Of course turn on compiler optimizations, compile in release mode
\section intellisense Intellisense issues
Microsoft Visual Studio (Express) 2005 and 2008 can hang typing in a bracket or angle bracket.
This is not directly related to GGL, but caused by heavy templated libraries such as Boost and GGL.
If this is inconvenient, intellisense can easily be turned off:
<i>(...) disabling Intellisense in VC++.
There is a file called feacp.dll in &lt;VS8INSTALL&gt;/VC/vcpackages folder.
Renaming this file will disable Intellisense feature.</i>
Source: http://blogs.msdn.com/yash/archive/2007/09/19/intellisense-issues-in-visual-c-2005.aspx
*/
//---------------------------------------------------------------------------------------------------
/*!
\page performance Performance
The performance has been tested for some algorithms, concluding that Boost.Geometry is highly comparative
(http://trac.osgeo.org/ggl/wiki/Performance).
\section performance-notes Performance notes
In the page about compiling the library there are some hints provided which might improve the performance.
Furthermore it is important to realize that if you're about to do calculations with two geometries, for
example a point-in-polygon or an intersection, it is very useful to first calculate and store all bounding
boxes (envelopes), and then before doing a point-in-polygon check if the point is in the bounding box. Checking if a
point is within a box is of course much faster than visiting all vertices of a polygon.
The storage of bounding boxes is, on purpose, not done within the library because it would break the possibility
to use standard vectors of points for linestrings or rings. The library might get a traits system in the future
where geometries might tell their boundaries to the algorithms, this however would be an optional system.
*/
//---------------------------------------------------------------------------------------------------
/*!
\page DSV DSV (Delimiter Separated Values)
DSV is a text representation of a geometry, explained here: http://en.wikipedia.org/wiki/Delimiter-separated_values .
DSV can represent a point, a linestring, a polygon, or multi versions of those.
It is currently just a utility in the library, used in samples and tests, to get some textual output
of a geometry.
*/
// BSG 24-12-2010: re-added to silence Doxygen warnings:
/*!
\page WKT WKT (Well-Known Text)
WKT is a textual representation of a geometry, explained here: http://en.wikipedia.org/wiki/Well-known_text
WKT can represent a point, a linestring, a polygon, or multi versions of those.
It is currently just a utility in the library, used in samples and tests, to get some textual output
of a geometry.
*/
//---------------------------------------------------------------------------------------------------
/*!
\page OGC OGC (Open Geospatial Consortium)
OGC is the Open Geospatial Consortium, the standardization committee
on Geospatial Interoperability and GIS (Geographical Information Systems).
OGC geometries are used in many environments and databases.
The Generic Geometry Library uses OGC conventions
for algorithms and for geometry type names. Note that though OGC is concentrating on GIS,
the conventions followed here are 'geometry only', the so-called 'simple features'
(simple in the sense that polygons are not allowed to have self-intersections).
OGC specifies a library based on inheritance, as opposed to this library, which is a generic template based library
where data classes are separated from the algorithms.
Therefore this library is not an OGC implementation in the strict sense.
\section Classes
OGC defines the following geometry classes,
which are implemented as concepts (and as geometries) in the Generic Geometry Library:
- \ref boost::geometry::model::point "point": a point. The point defined here is dimensionally agnostic.
Library users does not have to use this point, they might also use their own points as long as it meets the concepts.
- \ref boost::geometry::model::linestring "linestring": Sequence of point values with linear interpolation
between points. Note that library users does not have to use this type. Algorithms works on iterators, so
all algorithms also accept iterators on a vector (or other container) of points.
- \ref boost::geometry::model::ring "linear_ring": Sequence of point values with linear interpolation
between points, which is closed and not self-intersecting
- \ref boost::geometry::model::polygon "polygon": Plane figure, consisting of an outer ring and zero or more
inner rings. So basically a polygon which might have holes.
<em>Note that this definition is different from several other polygon definitions and libraries,
where polygons are not allowed to have holes. These polygons are comparable to the linear_ring above</em>
And multi-geometries:
- \ref boost::geometry::model::multi_point "multi_point": collection of points
- \ref boost::geometry::model::multi_linestring "multi_linestring": collection of linestrings
- \ref boost::geometry::model::multi_polygon "multi_polygon": collection of polygons
The naming of these classes is used in:
- WKT (Well-Known Text)
- KML (Google Maps)
- GML
- many GIS/geometry libraries
and in many databases:
- Oracle Spatial
- SQL Server 2008
- PostGreSQL
- MySQL
- MonetDB
Besides this the Generic Geometry Library provides the following additional classes:
- \ref boost::geometry::model::box "box": Box, used for selections and for envelopes (bounding boxes)
- \ref boost::geometry::model::segment "segment": Segment, helper class, used for e.g. intersections
Finally geometry types can be added as extensions. This is e.g. done with an
"n-sphere" meaning "circle" and "sphere". Circle is convenient for selections.
\section Differences
The Generic Geometry Library does not implement the OGC Simple Feature interface exactly and completely.
There are many differences. Below the most important differences are listed.
- In OGC all operations are class methods. The Generic Geometry Library is a template library and defines the algorithms
as generic functions.
- In OGC a point is defined by an x-coordinate value, a y-coordinate value and possibly a z-coordinate value
and a measured value. In the Generic Geometry Library the basic point defines coordinates in a neutral way,
so there is no x, no y.
- In OGC all geometries have additional members, such as SRID (spatial reference system id) or isMeasured. These
properties are not defined in the Generic Geometry Library. Library users can implement them, if necessary,
in derived classes.
- In OGC the envelope returns a geometry, in the Generic Geometry Library it returns a box
- The OGC algorithm asText is named "wkt"
- Union and intersection are currently named "X_inserter" to indicate that they
insert there produced geometries (if any) as an OutputIterator
More information on OGC can be found on their website, http://www.opengeospatial.org
and on Wikipedia http://en.wikipedia.org/wiki/Open_Geospatial_Consortium
*/
//---------------------------------------------------------------------------------------------------
/*!
\page status Status, previews and formal review
\section introduction Introduction
Boost.Geometry is accepted by Boost (http://permalink.gmane.org/gmane.comp.lib.boost.announce/246)
after formal review (http://permalink.gmane.org/gmane.comp.lib.boost.announce/239)
The first preview was a template 2D geometry library providing its own geometries and algorithms working on
those geometries. Those geometries are still provided but not essential anymore.
The second preview didn't asume points with .x() and .y() anymore. It provided strategies,
operating on specific point types. So point_xy (cartesian points) were
handled different from point_ll (latlong points). That is still the case (now using a coordinate system meta-function)
The third preview introducted the point concept, library users could use their own points with the algorithms
provided by the library.
The fourth preview implemented concepts for all geometries. Besides that tag dispatching was
introduced internally. All algorithms were made generic.
The Formal Review continued with the design of the fourth preview, made it more consistent
(apply everywhere, all implementation within struct's, structs used as building blocks for
multi-implementations, etc). Things were made more conform Boost standards (template parameters,
no tabs, etc).
\section changes4 Changes since preview 3
- there are now typedefs for the more common geometries, such as point_2d or ring_ll_deg
- all geometries are optional, everything is working with concepts
- the convex hull algorithm has been added and can be calculated for linestrings (ranges, point sequences), polygons
- map projections (92 !) have been added, they are converted to C++ template classes from PROJ4
- transformations have been added, to go from one coordinate system to another
- conversions have been added, to go from one geometry type to another (e.g. BOX to POLYGON)
- edit functionality have been added, to edit coordinate values or to add points
- parsing of latitude longitude coordinate values have been added
- the "selected" algorithm have been added
- many examples have been added
- many tests have been added
\b Breaking \b changes
Because the library was in preview, and it still is, there are some major changes which might influence library user's
code. Although there are many changes internally, the changes for users should be relatively small:
- all algorithms accepting linestrings are now modified to get the linestring itself. In the previous version
.begin(), end() had to be specified, This is not necessary anymore, because the Boost Range Library is used
internally, and tag dispatching is used to distinguish different geometries
- the "grow" utility is now splitted into buffer (growing a box with a value was in fact a buffer) and a expand.
- there was a generic "get" function with a const ref and a non const ref. This is splitted into "get" and "set"
- there might be more changes, please contact if anything is unclear
\section changes5 Changes since preview 4
There are the following changes:
- implementation of spatial set relations (intersection, union)
- implementation of some spatial boolean relations (disjoint, equal, intersects, overlaps)
- move of GIS-specific code to extension/gis
- move of map projections to extensions/gis/projections
- implementation of SVG in extensions/SVG
- review of all code, conform Boost code guidelines, no tabs, template parameters, etc.
- other small changes.
\b Breaking \b changes
- there is now distinction between functions using an output iterator, and functions
resulting in modifying geometries. Functions using an output iterator are called _inserter,
so convex_hull_inserter inserts points (the hull) into something.
- many headerfiles are moved and/or renamed
- strategies now define a method \b apply, in previous versions this was \b operator()
<i>this only influences your code if you've made strategies yourself</i>
- ...
\section changes6 Changes since formal review
- namespace changes
- intersection: fixed Access Violoation which could occur at wrongly oriented input
- intersection: fixed omitting outer polygon if it was equal
- intersection: performance improvement, non quadratic behaviour on monotonic sections
- intersection: now supporting GMP and CLN number types
(there are still some comparisons causing implicit casts to double, which will be removed)
- intersection: support of input consisting of pointer-types
- small other changes (strategies transform and intersection do now have apply instead of operator() and relate)
If people are interested in helping with the library, be it by coding, by testing, by commenting or otherwise, they
are very welcome.
\section history History
Geodan started in 1995 with a Geographic Library, called geolib or also GGL (Geodan Geographic Library).
Since then hundreds of projects have
been done using this geolib, and the geolib have been extended to fit the needs of its users. Geolib
can be used in different environments: in Windows applications, as a DLL (ggl32.dll), in
Web Map Servers (SclMapServer), Web Feature Servers or more specific programs.
In 2007-2009 the Geometry part has been revised and completely templatized.
From 2008 Bruno Lalande, already a Boost contributor, joined and helped
to make the library more generic and to define clear concepts.
It was later now called Generic Geometry Library (GGL).
From 2009 Mateusz Loskot, an active member of Geospatial Open Source communities,
joined and helped with reviewing code, guidelines, WKB, iterators, and the Wiki and ticket system (http://trac.osgeo.org/ggl)
The library is now called Boost.Geometry (formerly: Generic Geometry Library, abbreviated to GGL).
Boost.Geometry is Open Source and is accepted by Boost libraries.
*/
//---------------------------------------------------------------------------------------------------
/*!
\page download Download Boost.Geometry
The library can be downloaded from Boost SVN. There is anonymous SVN access.
The command
<tt>svn co https://svn.boost.org/svn/boost/sandbox/geometry geometry</tt>
will download the library to your machine.
The library can also be downloaded from Geodan SVN. <i>This will be moved to osgeo SVN</i>
*/
#endif // _DOXYGEN_PAGES_HPP

View File

@ -1,238 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef _DOXYGEN_ARTICLE2009_HPP
#define _DOXYGEN_ARTICLE2009_HPP
//---------------------------------------------------------------------------------------------------
/*!
\page art09 A Generic Geometry Library (web-copy of article for BoostCon'09)
Authors:
- Barend Gehrels
- Bruno Lalande
This page is a web-version of the article <b>A Generic Geometry Library</b>, for BoostCon'09.
<i>Note: this article is written December 2008, it is not updated (besides the namespace). There might be some things out of date. But most things are still as described here, be it that the Geographic stuff is moved to an extension.</i>
\section art09_abstract Abstract
The Generic Geometry Library (GGL) is a library for geometry and geography. It is based on templates and static polymorphism. It is agnostic in coordinate space, coordinate system, and dimensions. The library is non intrusive and uses concepts for geometries for its algorithms. Developers can either use the provided geometries or define or use their own geometry types and specializations. Essential algorithms such as distance calculations, area calculations, point in polygon calculations are available. A geometry library like described would be a valuable addition to the Boost Library Collection.
\section art09_intro Introduction
The Boost Library Collection currently still does not have any geometry library. In the past years several discussions and previews have been published on the Boost Mailing Lists. There is certainly interest for a library handling geometry within the Boost community; it would be valuable if geometry algorithms are available for the Boost users. Such algorithms are for instance: the distance between two points, the area of a polygon, or determining if a point is in a polygon.
Geometry is used in many disciplines and there are many approaches possible. Depending on their interest programmers feel other needs. Developers creating games will need other geometries, other algorithms, other dimensions and coordinate representations than developers creating CAD, geographic applications, astronomic or control software for robotics. Besides that, programmers have their personal flavors.
It is a major challenge to develop a consistent library containing every aspect of geometry, on which everyone agrees.
This article describes one attempt of a geometry library. The Generic Geometry Library (GGL) developed and restyled in 2008 has been presented, at the time of writing, as a preview three times. With the feedback from the Boost community the library is enhanced and extended, it has been changed a lot and the library is better than it was before. It is still in preview phase and not yet reviewed nor accepted. There are other candidate libraries for geometry as well. This paper describes the characteristics and basic principles of the Generic Geometry Library.
The Generic Geometry Library has been initiated by Geodan. Geodan is a company for Geographic Information Systems. Bruno Lalande, who has contributed to Boost libraries before, joined the team of developers.
\section art09_concepts Geometry Concepts
A geometry library should define geometry concepts and should implement algorithms working with those concepts. The library can then handle any geometry type modeled according to the concept.
The task of selecting geometries and giving them proper names can already be a challenge and a subject for much discussion. The Wikipedia list of geometric shapes contains more than 30 different polygons, furthermore a dozen of triangles, rectangles, squares, kites, trapezoids, circles, ellipses, three dimensional shapes as polyhedrons, spheres. The list is probably never ending.
The Generic Geometry Library is not attempting to create concepts for all these shapes. Instead, it models four concepts of basic geometries:
- a point
- a sequence of points (a linestring)
- a point sequence which is closed (a (linear) ring)
- a polygon (an outer ring which can optionally contain inner rings, also called donuts or holes)
With those four concepts, all two dimensional shapes composed of straight line segments (triangles, rectangular and polygonal, etc.) can be built. How to handle curved geometries in two dimensions is not yet worked out. An equivalent system might be used where segments between three points are marked as curved.
The Generic Geometry Library defines concepts and provides default implementations of these concepts. Besides these predefined types, other types can be handled as well. Any point type that defines the required properties, at compile-time, and thus satisfies the point concept requirements can be used.
The linear ring and the linestring concepts follow Boost Range Library concepts. Ranges are used to iterate through sequences of points. Therefore algorithms as length or area also work on a std::vector of points. The names of these concepts and of the provided geometries are consistent with the naming system of the OGC, described below. The names are also used for tags related to the tag dispatching mechanism, which is used internally to distinguish geometry types.
For convenience three other concepts are defined:
- a box: to be able to select things, for spatial indexing, and to keep track of boundaries of geometries
- an n-sphere: circle or sphere, to be able to select things
- a segment: a part of line bounded by two points, to calculate e.g. distances and intersections
Besides defining custom types, library users can make specializations of algorithms for their geometry types and in such way implement support for, for example, triangles. This will be worked out below.
The Boost Concept Check Library (BCCL) is used internally to check if the developer's input follows the concepts expected by the library.
\section art09_dim Dimensions
The Generic Geometry Library is basically agnostic in its dimensions. A point is templatized by the number of dimensions, by coordinate type (integer, float, double, GMP), and by the coordinate system.
Examples:
- point<double, 2, cartesian>: a point in two dimensions
- point<double, 3, cartesian>: a point in three dimensions
- polygon< point<double, 2, spherical<radian> > >: a spherical polygon, measured in radians
Although points of any dimensions can be created, most algorithms are currently not prepared to handle all possible dimensions. Most algorithms that are provided handle points in Cartesian, Geographic or Spherical coordinate systems.
A template parameter defining how to handle calculations in algorithms using big number types might be added in the future.
\section art09_cs Coordinate systems
A generic library handling geometry should be neutral in its coordinate space. In geography, points can be specified using X and Y (and Z), but also using Latitude and Longitude (and Height). In other disciplines there might be need for other names, for example: red, green and blue (defining colors in a color cube), or right ascension and declination (in astronomy).
The concepts of the Generic Geometry Library use therefore neutral names (get and set) for accessing and modifying coordinates. Example, setting a point to (3,2):
\code
boost::geometry::point<double, 2, cartesian> a;
boost::geometry::set<0>(a, 3);
boost::geometry::set<1>(a, 2);
\endcode
Or, alternatively:
\code
boost::geometry::assign(a, 3, 2);
\endcode
These calls are generic. Library users might also choose to use or define more context targeted methods as a.x() and a.y() for setting and getting coordinates, or non default constructors. This as long as they also provide the specializations needed to enable the library to play with points the way shown above.
The Generic Geometry Library provides a generic transform algorithm which can transform geometries from one coordinate system to another.
\section art09_types Types And Strategies
Algorithms depend on coordinate system. Let's take, for example, the distance calculation between two points. For points in a Cartesian coordinate space the simple and well known Pythagorean theorem applies. For points in the geographic coordinate system (latitude longitude, also known as latlong, lola or ll) the distance can be calculated using the haversine formula (it is possible to select other formulas as well, which is described below).
The Generic Geometry Library provides a tag dispatching system which selects strategies based on coordinate system. So distances and areas for spherical coordinates are internally calculated differently then distances and areas for Cartesian coordinates. This is, by default, not visible for the library user, it is an automatic tag dispatching system.
The tag dispatching system is also used to distinguish geometry types internally. So the generic distance algorithm can get two points (in any coordinate system) as input, but also a point and a linestring, a point and a polygon, et cetera.
Example showing different strategies for different coordinate systems:
\code
boost::geometry::point_xy<double> a(1,1), b(3,4);
std::cout << boost::geometry::distance(a, b);
typedef boost::geometry::point_ll<> LL;
LL A, B;
// initialize lat-long coordinates
// e.g., Amsterdam and Barcelona
// ...
std::cout << boost::geometry::distance(A, B);
\endcode
This example uses two different point types. In the first part the Pythagorean theorem is used to calculate the distance between point a and point b. In the second part the distance along the sphere of earth is used (as the crow flies). Note that the non default constructor shown in the first line is not part of the concept; it is part of the implementation (so part of the example above).
As described, distance is calculated using strategies for different coordinate systems. The distance algorithm selects automatically right specialization belonging to the geometry type, and then it selects the strategy belonging to the coordinate system. This strategy is then used for calculation.
Algorithms in the Generic Geometry Library also have an overload where the strategy can be specified by the library user. This is useful for, for example, calculating distance along the earth (or along any sphere). There are several methods for that calculation, using internally either a fast or a precise algorithm. The library user can select such a strategy or can implement his or her own strategy. For example, to use the exact Vincenty geodetic calculation (provided by the library):
\code
std::cout << distance(A, B,
strategy::distance::vincenty<LL>())
<< std::endl;
\endcode
Algorithms as simplification (removing non important points from point sequences such that shape is preserved) use, internally, distance calculations. The same mechanism is used there. Therefore simplification works for Cartesian polygons the same as for polygons with geographical coordinates. It is exactly the same implementation.
\section art09_specializations Specializations
Besides strategies, library users have also other options for customization. For example: the Generic Geometry Library itself does not support triangles. Instead it supports polygons (which might contain holes) and linear rings. However, if the library user wants to use triangles directly, he can implement his own type. Let's work this example out. A triangle can be represented by three coordinate pairs. The library user can make a triangle of his own points (in this case: custom_point), using e.g. a boost::array.
\code
struct triangle : public boost::array<custom_point, 3>
{};
\endcode
The user then has to indicate that this geometry is handled as a linear ring. He therefore has to provide a specialization of the tag metafunction, defining a type for the tag dispatching mechanism. This should reside in the namespace ggl:
\code
namespace ggl
{
template <>
struct tag<triangle>
{
typedef ring_tag type;
};
}
\endcode
As soon as this is done, the library will automatically select the ring specializations for all triangle algorithms. Because the Generic Geometry Library handles a ring as being a range, the user does not have to provide anything more. The Boost Range library concepts are used internally for all iterations.
So the area of the user's custom-points-triangle will be calculated correctly, using internally an iterator which walks through the point coordinates.
But wait, for triangle that is not as efficient as possible! No problem, the developer can, if desired, implement a specialization for the area function:
\code
template<>
double area<triangle>(const triangle& t)
{
return 0.5 * (
(t[1].x() - t[0].x()) * (t[2].y() - t[0].y())
- (t[2].x() - t[0].x()) * (t[1].y() - t[0].y())
);
}
\endcode
Now this specialization will be used to calculate the area of the developer's triangles, while for other algorithms (centroid, within, intersection, et cetera) the generic ring versions still being used.
The Generic Geometry Library also provides a second way to specialize. Within the dispatch namespace, structs are available for all operations. They can be partially specialized such that, for example, a triangle templatized by point type will be handled correctly by the library.
\section art09_conventions Names And Conventions
All geometry types and algorithms are named following the specifications of the Open Geospatial Consortium (OGC). The naming system of the OGC is carefully thought-out and has been agreed upon by a broad community. Additional algorithms and geometry types are named as much as possible using the same conventions and systematics.
OGC conventions, geometry types and spatial operations are widely used, a.o. in spatial databases, such as PostGreSQL, MySQL, Oracle, and SQL Server.
The OGC defines the following algorithms:
- Basic algorithms: dimension, envelope, as_text, as_binary, is_simple, is_empty
- Query algorithms: equals, disjoint, intersects, touches, crosses, within, contains, overlaps, relate, locate_along, locate_between
- Analysis algorithms: distance, buffer, convex_hull, intersection, union, difference, sym_difference
- Geometry type dependant algorithms: area, length, centroid, point_on_surface
All algorithms are planned to be implemented. Besides this there are some other algorithms provided or planned:
- Simplify, densify, disperse, spline, triangulate
- Coordinate system conversions: transform
The last one, transform, transforms geometries from any coordinate system to any other coordinate system. For example from radian to degree, but also from spherical to a 3D X,Y,Z coordinate system, or calling a map projection.
Textual representations of geometries (Well-Known Text or WKT) are also provided by the library, as well as the parsing of them.
The OGC also defines geometry types containing a collection of geometries, which are planned to be supported:
- multi_point
- multi_linestring
- multi_polygon
The Generic Geometry Library is not OGC compliant in the strict sense. It sometimes deviates from the specifications to enable genericity. It uses Boost Range concepts for the linestring geometry type. The library user can therefore use any standard container or Range compatible type as a linestring (a sequence of points). And the output of intersections is, for example, modeled as an output iterator instead of a multi_polygon or a multi_linestring.
\section art09_index Spatial Indexes
In geometry or GIS, spatial indexes can be used to search geometries or to enhance or speed up determination of geometry relationships. In 2008, a student, within the framework of the Google Summer of Code, has worked out a first version of a spatial indexing library which uses the Generic Geometry Library. This will be worked out and extended in the future.
The Priority R-Tree, an R-Tree having optimal performance for any query window, will be available for fast searches within a set of geometries.
\section art09_proj Map Projections
The Generic Geometry Library can be used as a generic library for Geographic Information Systems (GIS). It therefore contains map projections. Map projections are algorithms to map the spherical earth to a flat piece of paper. There are many ways to do this. The USGS has implemented over the years 92 projection algorithms, collected in an often used PROJ4 package, written in C. This package is recently fitted into the Generic Geometry Library by converting it to a set of C++ templates.
The projection collection contains both static as dynamic polymorphism. It is possible to instantiate a projection declaring the wished projection itself, for example:
\code
typedef boost::geometry::point_ll<double, geographic<> > LL;
typedef boost::geometry::point_xy<double> XY;
projection::merc_ellipsoid<LL, XY> prj(
"+ellps=WGS84 +lon_0=11.6E");
// Define Amsterdam / Barcelona
LL amsterdam, barcelona;
// Initialize A'dam / B'ona
...
XY ma, mb; // Declare points
// and project (from latlong to XY)
if (prj.forward(amsterdam, ma)
&& prj.forward(barcelona, mb))
{ ... }
\endcode
This will use static polymorphism. Note that the initialization string is conform PROJ4, but it is also possible to initialize projections with e.g. a std::map.
Static polymorphism is also used if the already mentioned transform algorithm provided by the library is used, a generic algorithm for transforming or projecting geometries:
\code
// declare type UTM zone 30, Cartesian
// using EPSG 2040
typedef boost::geometry::point_xy<double, epsg<2040> > UTM;
// Assign Amsterdam / Barcelona in UTM
...
// call generic transformation
boost::geometry::transform (amsterdam, ma);
boost::geometry::transform (barcelona, mb);
\endcode
EPSG has defined the accepted standard coding for map projections, worldwide, and an EPSG code can be used as a template parameter in the provided EPSG Cartesian coordinate system.
Besides specific instantiation, any projection can also be instantiated using a factory:
\code
projection::factory<LL, XY> fac;
boost::shared_ptr<projection::projection<LL, XY> > prj(fac.create_new(parameters));
\endcode
The projection instance can now be any projection, created by the factory according to its parameters (which should contain the name of the projection). The instantiated projection-base-class derived class contains virtual methods for forward and inverse projection, but is still also modeled using template parameters for its point types.
\section art09_conclusions Conclusions
The Generic Geometry Library as described and published in preview is an extensive generic template geometry library containing many algorithms. It can be used for simple algorithms such as distance calculation but it can also be used in larger contexts such as GIS or Web Mapping applications. It is an Open Source library following the Boost Software License. The Boost Community would profit from a geometry library as described in this article.
*/
#endif // _DOXYGEN_ARTICLE2009_HPP

View File

@ -1,17 +0,0 @@
:: ===========================================================================
:: Copyright (c) 2010 Barend Gehrels, Amsterdam, the Netherlands.
::
:: Use, modification and distribution is subject to the Boost Software License,
:: Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
:: http://www.boost.org/LICENSE_1_0.txt)9
:: ============================================================================
@echo off
doxygen
cd doxygen_output\html
for %%f in (*.html) do ..\..\doxygen_enhance.py %%f
cd ..\..

View File

@ -14,7 +14,7 @@
[library Geometry
[quickbook 1.5]
[authors [Gehrels, Barend], [Lalande, Bruno], [Loskot, Mateusz], [Wulkiewicz, Adam], [Karavelas, Menelaos], [Fisikopoulos, Vissarion]]
[copyright 2009-2021 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam Wulkiewicz, Oracle and/or its affiliates]
[copyright 2009-2024 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam Wulkiewicz, Oracle and/or its affiliates]
[purpose Documentation of Boost.Geometry library]
[license
Distributed under the Boost Software License, Version 1.0.

View File

@ -3,9 +3,10 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 1. Geometry</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Chapter 1. Geometry">
<link rel="next" href="geometry/introduction.html" title="Introduction">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@ -40,8 +41,8 @@
<div><div class="author"><h3 class="author">
<span class="firstname">Vissarion</span> <span class="surname">Fisikopoulos</span>
</h3></div></div>
<div><p class="copyright">Copyright © 2009-2022 Barend Gehrels,
Bruno Lalande, Mateusz Loskot, Adam Wulkiewicz, Oracle and/or its affiliates</p></div>
<div><p class="copyright">Copyright © 2009-2024 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam
Wulkiewicz, Oracle and/or its affiliates</p></div>
<div><div class="legalnotice">
<a name="geometry.legal"></a><p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
@ -51,7 +52,7 @@
</div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl class="toc">
<dl>
<dt><span class="section"><a href="geometry/introduction.html">Introduction</a></span></dt>
<dt><span class="section"><a href="geometry/compilation.html">Compilation</a></span></dt>
<dt><span class="section"><a href="geometry/design.html">Design Rationale</a></span></dt>
@ -102,12 +103,12 @@
</div>
<h3>
<a name="geometry.h0"></a>
<span class="phrase"><a name="geometry.contributions"></a></span><a class="link" href="index.html#geometry.contributions">Contributions</a>
<span><a name="geometry.contributions"></a></span><a class="link" href="index.html#geometry.contributions">Contributions</a>
</h3>
<p>
Boost.Geometry contains contributions by:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Akira Takahashi (adaption of Boost.Fusion)
</li>
@ -148,10 +149,7 @@
</li>
</ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: December 01, 2022 at 10:37:09 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<div class="copyright-footer"></div>
<hr>
<div class="spirit-nav"><a accesskey="n" href="geometry/introduction.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
</body>

View File

@ -173,6 +173,8 @@ COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
# This is only for debug purposes. For the final documentation, XML output is
# converted to QuickBook and then to BoostBook and DocBook and html
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html_by_doxygen

View File

@ -10,12 +10,29 @@
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)9
# http://www.boost.org/LICENSE_1_0.txt)
# ============================================================================
import os, sys, shutil
cmd = "doxygen_xml2qbk"
# Resolves the path to an executable and returns an absolute path to it
def resolve_executable(orig_path):
resolved_path = shutil.which(orig_path)
if resolved_path is None:
raise Exception("%s is not found or not executable" % orig_path)
return os.path.abspath(resolved_path)
if 'DOXYGEN_XML2QBK' in os.environ:
doxygen_xml2qbk_cmd = os.environ['DOXYGEN_XML2QBK']
elif '--doxygen-xml2qbk' in sys.argv:
doxygen_xml2qbk_cmd = sys.argv[sys.argv.index('--doxygen-xml2qbk')+1]
else:
doxygen_xml2qbk_cmd = 'doxygen_xml2qbk'
doxygen_xml2qbk_cmd = resolve_executable(doxygen_xml2qbk_cmd)
os.environ['DOXYGEN_XML2QBK'] = doxygen_xml2qbk_cmd
doxygen_xml2qbk_cmd = '"' + doxygen_xml2qbk_cmd + '"'
cmd = doxygen_xml2qbk_cmd
cmd = cmd + " --xml xml/%s.xml"
cmd = cmd + " --start_include boost/"
cmd = cmd + " --output_style alt"

View File

@ -59,8 +59,7 @@ __boost_geometry__ was accepted by Boost at November 28, 2009
([@http://permalink.gmane.org/gmane.comp.lib.boost.announce/246 review report]).
There is a __boost_geometry__ [@http://lists.boost.org/mailman/listinfo.cgi/geometry
mailing list]. The mailing list and its messages are also accessible from
[@http://boost-geometry.203548.n3.nabble.com/ Nabble] as Boost Geometry. Also on
mailing list]. Also on
the [@http://lists.boost.org/mailman/listinfo.cgi/boost
Boost Developers list] and on the [@http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost Users list] __boost_geometry__ is discussed.

View File

@ -20,10 +20,21 @@ script_dir = os.path.dirname(__file__)
os.chdir(os.path.abspath(script_dir))
print("Boost.Geometry is making .qbk files in %s" % os.getcwd())
# Resolves the path to an executable and returns an absolute path to it
def resolve_executable(orig_path):
resolved_path = shutil.which(orig_path)
if resolved_path is None:
raise Exception("%s is not found or not executable" % orig_path)
return os.path.abspath(resolved_path)
# Resolve paths to executables early so that commands are executable from arbitrary locations
if 'DOXYGEN' in os.environ:
doxygen_cmd = os.environ['DOXYGEN']
else:
doxygen_cmd = 'doxygen'
doxygen_cmd = resolve_executable(doxygen_cmd)
os.environ['DOXYGEN'] = doxygen_cmd
doxygen_cmd = '"' + doxygen_cmd + '"'
if 'DOXYGEN_XML2QBK' in os.environ:
doxygen_xml2qbk_cmd = os.environ['DOXYGEN_XML2QBK']
@ -31,8 +42,9 @@ elif '--doxygen-xml2qbk' in sys.argv:
doxygen_xml2qbk_cmd = sys.argv[sys.argv.index('--doxygen-xml2qbk')+1]
else:
doxygen_xml2qbk_cmd = 'doxygen_xml2qbk'
os.environ['PATH'] = os.environ['PATH']+os.pathsep+os.path.dirname(doxygen_xml2qbk_cmd)
doxygen_xml2qbk_cmd = os.path.basename(doxygen_xml2qbk_cmd)
doxygen_xml2qbk_cmd = resolve_executable(doxygen_xml2qbk_cmd)
os.environ['DOXYGEN_XML2QBK'] = doxygen_xml2qbk_cmd
doxygen_xml2qbk_cmd = '"' + doxygen_xml2qbk_cmd + '"'
cmd = doxygen_xml2qbk_cmd
cmd = cmd + " --xml doxy/doxygen_output/xml/%s.xml"
@ -44,7 +56,12 @@ cmd = cmd + " --copyright src/copyright_block.qbk"
cmd = cmd + " --output_member_variables false"
cmd = cmd + " > generated/%s.qbk"
def print_verbose(s):
if "--verbose" in sys.argv:
print("`make_qbk.py` -- " + s)
def run_command(command):
print_verbose("Running %s" % command)
if os.system(command) != 0:
raise Exception("Error running %s" % command)
@ -55,6 +72,7 @@ def remove_all_files(dir_relpath):
shutil.rmtree(dir_abspath, ignore_errors=True)
def call_doxygen():
print_verbose("Calling doxygen...")
os.chdir("doxy")
remove_all_files("doxygen_output/xml/")
run_command(doxygen_cmd)
@ -86,14 +104,13 @@ def strategy_to_quickbook(section):
ns = section[:p]
strategy = section[p+2:]
run_command(cmd % ("classboost_1_1geometry_1_1strategy_1_1"
+ ns.replace("_", "__") + "_1_1" + strategy.replace("_", "__"),
+ ns.replace("_", "__") + "_1_1" + strategy.replace("_", "__"),
ns + "_" + strategy))
def cs_to_quickbook(section):
run_command(cmd % ("structboost_1_1geometry_1_1cs_1_1" + section.replace("_", "__"), section))
call_doxygen()
# MAIN PROGRAM
algorithms = ["append", "assign", "make", "clear"
, "area", "azimuth", "buffer", "centroid", "closest_points", "convert"
@ -110,7 +127,7 @@ arithmetic = ["cross_product"]
access_functions = ["get", "set", "exterior_ring", "interior_rings"
, "num_points", "num_interior_rings", "num_geometries"]
coordinate_systems = ["cartesian", "geographic", "polar", "spherical", "spherical_equatorial"]
core = ["closure", "coordinate_system", "coordinate_type", "cs_tag"
@ -153,18 +170,20 @@ strategies = ["area::cartesian", "area::spherical", "area::geographic"
, "transform::translate_transformer", "transform::matrix_transformer"
, "within::winding", "within::franklin", "within::crossings_multiply"
]
views = ["box_view", "segment_view"
, "closeable_view", "reversible_view", "identity_view"]
if "--skip_doxygen" not in sys.argv:
call_doxygen()
for i in algorithms:
group_to_quickbook(i)
for i in access_functions:
group_to_quickbook(i)
for i in coordinate_systems:
cs_to_quickbook(i)
@ -179,7 +198,7 @@ for i in iterators:
for i in models:
model_to_quickbook(i)
for i in srs:
srs_class_to_quickbook(i)
@ -188,7 +207,6 @@ for i in strategies:
for i in views:
struct_to_quickbook(i)
model_to_quickbook2("d2_1_1point__xy", "point_xy")
model_to_quickbook2("d3_1_1point__xyz", "point_xyz")
@ -205,9 +223,10 @@ class_to_quickbook2("de9im_1_1matrix", "de9im_matrix")
class_to_quickbook2("de9im_1_1mask", "de9im_mask")
class_to_quickbook2("de9im_1_1static__mask", "de9im_static_mask")
os.chdir("index")
exec(compile(open("make_qbk.py", "rb").read(), "make_qbk.py", 'exec'))
os.chdir("..")
if "--skip_index" not in sys.argv:
os.chdir("index")
exec(compile(open("make_qbk.py", "rb").read(), "make_qbk.py", 'exec'))
os.chdir("..")
# Clean up generated intermediate files
if "--release-build" in sys.argv:
@ -217,5 +236,5 @@ if "--release-build" in sys.argv:
remove_all_files("index/html_by_doxygen/")
# Use either bjam or b2 or ../../../b2 (the last should be done on Release branch)
if "--release-build" not in sys.argv:
if "--release-build" not in sys.argv and "--skip_doxygen" not in sys.argv:
run_command("b2")

View File

@ -437,7 +437,7 @@
<simplelist type="vert" columns="1">
<member><link linkend="geometry.reference.algorithms.length">length</link></member>
</simplelist>
<bridgehead renderas="sect3">line_interpolate</bridgehead>
<bridgehead renderas="sect3">Line Interpolate</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="geometry.reference.algorithms.line_interpolate">line_interpolate</link></member>
</simplelist>
@ -599,7 +599,7 @@
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Line interpolate point</bridgehead>
<bridgehead renderas="sect3">Line Interpolate</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="geometry.reference.strategies.strategy_line_interpolate_cartesian">strategy::line_interpolate::cartesian</link></member>
<member><link linkend="geometry.reference.strategies.strategy_line_interpolate_geographic">strategy::line_interpolate::geographic</link></member>
@ -723,7 +723,7 @@
<simplelist type="vert" columns="1">
<member><link linkend="geometry.reference.io.wkt.read_wkt">read_wkt</link></member>
<member><link linkend="geometry.reference.io.wkt.wkt">wkt</link></member>
<member><link linkend="geometry.reference.io.wkt.to_wkt">to_wkt</link></member>
<member><link linkend="geometry.reference.io.wkt.to_wkt_1">to_wkt</link></member>
<member><link linkend="geometry.reference.io.wkt.from_wkt">from_wkt</link></member>
</simplelist>
</entry>
@ -862,7 +862,7 @@
<member><link linkend="geometry.reference.spatial_indexes.group__predicates.overlaps_geometry_const___">overlaps(Geometry const &amp;)</link></member>
<member><link linkend="geometry.reference.spatial_indexes.group__predicates.within_geometry_const___">within(Geometry const &amp;)</link></member>
<member><link linkend="geometry.reference.spatial_indexes.group__predicates.satisfies_unarypredicate_const___">satisfies(UnaryPredicate const &amp;)</link></member>
<member><link linkend="geometry.reference.spatial_indexes.group__predicates.nearest_geometry_const____unsigned_">nearest(Geometry const &amp;, unsigned)</link></member>
<member><link linkend="geometry.reference.spatial_indexes.group__predicates.nearest_geometry_const____std__size_t_">nearest(Geometry const &amp;, unsigned)</link></member>
</simplelist>
</entry>
<!--entry valign="top">

View File

@ -1,22 +0,0 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
Use, modification and distribution is subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
=============================================================================/]
[include reference/algorithms/difference_behavior.qbk]
[include reference/algorithms/geometry_rules.qbk]
[heading Example]
[difference_inserter] [difference_inserter_output]
[heading See also]
* [link geometry.reference.algorithms.sym_difference.sym_difference_inserter_3 sym_difference_inserter (symmetric difference)]
* [link geometry.reference.algorithms.intersection.intersection_inserter_3 intersection_inserter]
* [link geometry.reference.algorithms.union.union_inserter_3 union_inserter]

View File

@ -11,8 +11,17 @@
[def __this_function__ discrete_frechet_distance]
[heading Behavior]
The algorithm calculate discrete frechet distance between two geometries.
[heading_conformance_no_ogc [^__this_function__]]
[note PostGIS contains an algorithm ST_FrechetDistance with similar functionality.
See the [@https://postgis.net/docs/ST_FrechetDistance.html PostGIS documentation].
]
[heading Supported geometries]
[table
[[Geometries][Status]]
[[Linestring-Linestring][ [$img/ok.png] ]]
]
[note The units of the distance depends on strategy. In order to change the
default behavior a user has to create a strategy and pass it explicitly into

View File

@ -11,8 +11,20 @@
[def __this_function__ discrete_hausdorff_distance]
[heading Behavior]
The algorithm calculate discrete hausdorff distance between two geometries.
[heading_conformance_no_ogc [^__this_function__]]
[note PostGIS contains an algorithm ST_HausdorffDistance with similar functionality.
See the [@https://postgis.net/docs/ST_HausdorffDistance.html PostGIS documentation].
]
[heading Supported geometries]
[table
[[Geometries][Status]]
[[Linestring-Linestring][ [$img/ok.png] ]]
[[MultiPoint-MultiPoint][ [$img/ok.png] ]]
[[Point-MultiPoint][ [$img/ok.png] ]]
[[MultiLineString-MultiLinestring][ [$img/ok.png] ]]
]
[note The units of the distance depends on strategy. In order to change the
default behavior a user has to create a strategy and pass it explicitly into

View File

@ -18,6 +18,7 @@ is reserved for future usage, which will then have an indication of the used tex
[from_wkt]
[heading See also]
* [@http://en.wikipedia.org/wiki/Well-known_text Well-known text specification]
* [link geometry.reference.io.wkt.wkt WKT streaming manipulator]
* [link geometry.reference.io.wkt.read_wkt Read WKT]
* [link geometry.reference.io.wkt.to_wkt To WKT]
* [link geometry.reference.io.wkt.to_wkt_1 To WKT]

View File

@ -14,11 +14,11 @@ Other libraries refer to this functionality as [*ST_GeomFromText] or [*STGeomFro
That is not done here because Boost.Geometry support more text formats. The name GeomFromText
is reserved for future usage, which will then have an indication of the used text format.
[heading Example]
[read_wkt]
[heading See also]
* [@http://en.wikipedia.org/wiki/Well-known_text Well-known text specification]
* [link geometry.reference.io.wkt.from_wkt From WKT]
* [link geometry.reference.io.wkt.to_wkt To WKT]
* [link geometry.reference.io.wkt.to_wkt_1 To WKT]
* [link geometry.reference.io.wkt.wkt WKT streaming manipulator]

View File

@ -20,6 +20,8 @@ also supports other textformats (svg, dsv)]
[to_wkt_output]
[heading See also]
* [@http://en.wikipedia.org/wiki/Well-known_text Well-known text specification]
* [link geometry.reference.io.wkt.to_wkt_2_with_significant_digits Overload with significant digits]
* [link geometry.reference.io.wkt.read_wkt Read WKT]
* [link geometry.reference.io.wkt.from_wkt From WKT]
* [link geometry.reference.io.wkt.wkt WKT streaming manipulator]

View File

@ -19,6 +19,7 @@ also supports other textformats (svg, dsv)]
[wkt_output]
[heading See also]
* [@http://en.wikipedia.org/wiki/Well-known_text Well-known text specification]
* [link geometry.reference.io.wkt.read_wkt Read WKT]
* [link geometry.reference.io.wkt.from_wkt From WKT]
* [link geometry.reference.io.wkt.from_wkt To WKT]

View File

@ -0,0 +1,34 @@
# Boost.Geometry
#
# Copyright (c) 2024-2024 Barend Gehrels, Amsterdam, the Netherlands.
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
cmake_minimum_required(VERSION 3.8...3.20)
project(doxygen_xml2qbk LANGUAGES CXX)
# Find Boost. The actual version is not relevant. It should find it somewhere. If not, set BOOST_ROOT
find_package(Boost 1.81.0 REQUIRED COMPONENTS program_options)
add_executable(${PROJECT_NAME}
doxygen_xml2qbk.cpp
)
target_compile_features(${PROJECT_NAME}
PUBLIC
cxx_std_14)
# From Boost it uses program_options
target_link_libraries(${PROJECT_NAME}
PRIVATE
Boost::program_options
)
# RapidXML is included in the source tree
target_include_directories(${PROJECT_NAME}
PRIVATE
.
contrib/rapidxml-1.13
)

View File

@ -26,7 +26,7 @@ project doxygen_xml2qbk
: requirements
<include>.
<include>$(RAPIDXML)
<library>../../../../../../program_options/build//boost_program_options
<library>/boost/program_options//boost_program_options
<link>static
;

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioPropertySheet
ProjectType="Visual C++"
Version="8.00"
Name="boost"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="$(BOOST_ROOT);..\..\.."
PreprocessorDefinitions="_SCL_SECURE_NO_WARNINGS"
/>
<Tool
Name="VCLinkerTool"
AdditionalLibraryDirectories="$(BOOST_ROOT)\lib"
/>
<UserMacro
Name="BOOST_ROOT"
Value="../../../../../../.."
/>
</VisualStudioPropertySheet>

View File

@ -1,4 +1,4 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Doxygen XML to Quickbook Converter
//
// Copyright (c) 2010-2013 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioPropertySheet
ProjectType="Visual C++"
Version="8.00"
Name="deployment_path"
>
<UserMacro
Name="DEPLOYMENT_PATH"
Value="c:\software"
PerformEnvironmentSet="true"
/>
</VisualStudioPropertySheet>

View File

@ -1,4 +1,4 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Doxygen XML to Quickbook Converter
//
// Copyright (c) 2010-2013 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.

View File

@ -1,6 +1,6 @@
// doxml2qbk (developed in the context of Boost.Geometry documentation)
// Doxygen XML to Quickbook Converter
//
// Copyright (c) 2010-2013 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2010-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2020.
@ -22,7 +22,6 @@
// using /xmlonly
// currently this is the element <qbk.example> which will make a reference
// to an example.
// - currently still in draft
#include <iostream>
#include <fstream>

View File

@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doxygen_xml2qbk", "doxygen_xml2qbk.vcproj", "{81BDA0FD-D3BC-4693-A389-D3ABFAD19214}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{81BDA0FD-D3BC-4693-A389-D3ABFAD19214}.Debug|Win32.ActiveCfg = Debug|Win32
{81BDA0FD-D3BC-4693-A389-D3ABFAD19214}.Debug|Win32.Build.0 = Debug|Win32
{81BDA0FD-D3BC-4693-A389-D3ABFAD19214}.Release|Win32.ActiveCfg = Release|Win32
{81BDA0FD-D3BC-4693-A389-D3ABFAD19214}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,226 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="doxygen_xml2qbk"
ProjectGUID="{81BDA0FD-D3BC-4693-A389-D3ABFAD19214}"
RootNamespace="doxygen_xml2qbk"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
InheritedPropertySheets=".\boost.vsprops;.\deployment_path.vsprops"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;contrib/rapidxml-1.13"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;BOOST_ALL_NO_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine=""
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
InheritedPropertySheets=".\boost.vsprops;.\deployment_path.vsprops"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;contrib/rapidxml-1.13"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;BOOST_ALL_NO_LIB"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy $(OutDir)\doxygen_xml2qbk.exe $(DEPLOYMENT_PATH)"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="program options"
>
<File
RelativePath="..\..\..\..\..\..\program_options\src\cmdline.cpp"
>
</File>
<File
RelativePath="..\..\..\..\..\..\program_options\src\config_file.cpp"
>
</File>
<File
RelativePath="..\..\..\..\..\..\program_options\src\convert.cpp"
>
</File>
<File
RelativePath="..\..\..\..\..\..\program_options\src\options_description.cpp"
>
</File>
<File
RelativePath="..\..\..\..\..\..\program_options\src\parsers.cpp"
>
</File>
<File
RelativePath="..\..\..\..\..\..\program_options\src\positional_options.cpp"
>
</File>
<File
RelativePath="..\..\..\..\..\..\program_options\src\split.cpp"
>
</File>
<File
RelativePath="..\..\..\..\..\..\program_options\src\utf8_codecvt_facet.cpp"
>
</File>
<File
RelativePath="..\..\..\..\..\..\program_options\src\value_semantic.cpp"
>
</File>
<File
RelativePath="..\..\..\..\..\..\program_options\src\variables_map.cpp"
>
</File>
</Filter>
<File
RelativePath=".\doxygen_xml2qbk.cpp"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Doxygen XML to Quickbook Converter
//
// Copyright (c) 2010-2013 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2010-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -358,6 +358,7 @@ static void copy_parameters_properties(Parameters const& source, Parameters& tar
template <typename Element>
static void parse_element(rapidxml::xml_node<>* node, configuration const& config, std::string const& parent, Element& el)
{
bool parse_sub_nodes = true;
if (node != NULL)
{
std::string name = node->name();
@ -390,23 +391,6 @@ static void parse_element(rapidxml::xml_node<>* node, configuration const& confi
el.location = loc;
el.line = atol(get_attribute(node, "line").c_str());
}
else if (full == ".detaileddescription.para.qbk")
{
el.qbk_markup.push_back(markup(node->value()));
}
else if (full == ".detaileddescription.para.qbk.after.synopsis")
{
el.qbk_markup.push_back(markup(markup_after, markup_synopsis, node->value()));
}
else if (full == ".detaileddescription.para.qbk.before.synopsis")
{
el.qbk_markup.push_back(markup(markup_before, markup_synopsis, node->value()));
}
else if (full == ".detaileddescription.para.qbk.distinguish")
{
el.additional_description = node->value();
boost::trim(el.additional_description);
}
else if (full == ".templateparamlist")
{
parse_parameter_list(node->first_node(), config, el.template_parameters);
@ -458,9 +442,58 @@ static void parse_element(rapidxml::xml_node<>* node, configuration const& confi
parse_parameter(node->first_node(), config, p);
el.parameters.push_back(p);
}
else if (boost::contains(full, ".qbk."))
{
if (boost::ends_with(full, ".distinguish"))
{
// To distinguish betweeen function overloads
// Marked in the source code as, for example:
// \qbk{distinguish,with strategy}
// \qbk{distinguish, 2 coordinate values}
el.additional_description = node->value();
boost::trim(el.additional_description);
parse_sub_nodes = false;
}
else if (boost::ends_with(full, ".synopsis"))
{
// To place the extra quickbook section before or after the synopsis.
// Marked in the source code as, for example:
// \qbk{before.synopsis
if (boost::contains(full, ".before."))
{
el.qbk_markup.push_back(markup(markup_before, markup_synopsis, node->value()));
parse_sub_nodes = false;
}
else if (boost::contains(full, ".after."))
{
el.qbk_markup.push_back(markup(markup_after, markup_synopsis, node->value()));
parse_sub_nodes = false;
}
else
{
std::cerr << "WARNING: Skipping: " << full << " with " << node->value() << std::endl;
}
}
else
{
// To make a quickbook section
// Marked in the source code as, for example:
// \qbk{[include reference/algorithms/area.qbk]}
// \qbk{heading Example}
// \qbk{heading See also}
// \qbk{
// [include reference/algorithms/area.qbk]
// [heading Available Strategies]
// \* [link geometry.reference.strategies.strategy_area_cartesian Cartesian]
// ...
el.qbk_markup.push_back(markup(node->value()));
}
}
parse_element(node->first_node(), config, full, el);
if (parse_sub_nodes)
{
parse_element(node->first_node(), config, full, el);
}
parse_element(node->next_sibling(), config, parent, el);
}
}

View File

@ -1,4 +1,4 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Doxygen XML to Quickbook Converter
//
// Copyright (c) 2010-2013 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.

View File

@ -1,13 +0,0 @@
# xml=../../../../doxy/doxygen_output/xml/classboost_1_1geometry_1_1model_1_1d2_1_1point__xy.xml
# xml=../../../../doxy/doxygen_output/xml/classboost_1_1geometry_1_1model_1_1polygon.xml
# xml=../../../../doxy/doxygen_output/xml/group__area.xml
# xml=../../../../doxy/doxygen_output/xml/classboost_1_1geometry_1_1strategy_1_1distance_1_1pythagoras.xml
# xml=../../../../doxy/doxygen_output/xml/group__get.xml
xml=../../../../doxy/doxygen_output/xml/structboost_1_1geometry_1_1closeable__view.xml
start_include=boost/geometry/
convenience_header_path=../../../../../../../boost/geometry/
convenience_headers=geometry.hpp,geometries/geometries.hpp
skip_namespace=boost::geometry::

View File

@ -1,4 +1,4 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Doxygen XML to Quickbook Converter
//
// Copyright (c) 2010-2013 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.

View File

@ -1,4 +1,4 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Doxygen XML to Quickbook Converter
//
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2012-2015 Adam Wulkiewicz, Lodz, Poland.

View File

@ -1,4 +1,4 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Doxygen XML to Quickbook Converter
//
// Copyright (c) 2010-2013 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.

View File

@ -1,4 +1,4 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Doxygen XML to Quickbook Converter
// doxygen_xml2qbk Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.

View File

@ -1,4 +1,4 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Doxygen XML to Quickbook Converter
// doxygen_xml2qbk Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.

View File

@ -1,4 +1,4 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Doxygen XML to Quickbook Converter
// doxygen_xml2qbk Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.

View File

@ -1,19 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fruit", "fruit.vcproj", "{CCC26650-0FD5-4DD9-8B76-43DC2B8B0870}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CCC26650-0FD5-4DD9-8B76-43DC2B8B0870}.Debug|Win32.ActiveCfg = Debug|Win32
{CCC26650-0FD5-4DD9-8B76-43DC2B8B0870}.Debug|Win32.Build.0 = Debug|Win32
{CCC26650-0FD5-4DD9-8B76-43DC2B8B0870}.Release|Win32.ActiveCfg = Release|Win32
{CCC26650-0FD5-4DD9-8B76-43DC2B8B0870}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,176 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="fruit"
ProjectGUID="{CCC26650-0FD5-4DD9-8B76-43DC2B8B0870}"
RootNamespace="fruit"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\fruit.cpp"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,41 @@
# Boost.Geometry
# Copyright (c) 2024 Barend Gehrels, Amsterdam, the Netherlands.
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
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)

View File

@ -10,11 +10,12 @@
project boost-geometry-doc-src-example
: # requirements
: requirements
<library>/boost/geometry//boost_geometry
;
exe quick_start : quick_start.cpp ;
build-project algorithms ;
build-project core ;
build-project geometries ;

View File

@ -0,0 +1,92 @@
# Boost.Geometry
# Copyright (c) 2024 Barend Gehrels, Amsterdam, the Netherlands.
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
foreach(item IN ITEMS
append
area
area_with_strategy
assign
assign_2d_point
assign_3d_point
assign_inverse
assign_points
buffer_with_strategies
centroid
clear
closest_points
closest_points_strategy
comparable_distance
convert
convex_hull
correct
densify
densify_strategy
discrete_frechet_distance
discrete_frechet_distance_strategy
discrete_hausdorff_distance
discrete_hausdorff_distance_strategy
difference
distance
envelope
equals
expand
for_each_point
for_each_point_const
for_each_segment_const
intersection_ls_ls_point
intersection_segment
intersects_linestring
is_simple
is_valid
is_valid_failure
is_valid_message
length
length_with_strategy
line_interpolate
line_interpolate_strategy
make_2d_point
make_3d_point
make_inverse
num_geometries
num_interior_rings
num_points
num_segments
return_envelope
relate
relation
reverse
simplify
sym_difference
transform
transform_with_strategy
union
unique
within
# Entries not present in Jamfile
# Some of them are used in the documentation, but not all of them.
assign_box_corners # uses detail, not used in documentation
assign_point_from_index # uses detail, not used in documentation
assign_point_to_index # uses detail, not used in documentation
azimuth
azimuth_strategy
covered_by
crosses
disjoint
intersection_poly_poly
intersects_segment
is_empty
make_with_range # uses detail, not used in documentation
overlaps
perimeter
simplify_insert # uses detail, not used in documentation
touches_one_geometry
touches_two_geometries
)
boost_geometry_add_example("algorithms" ${item})
endforeach()

View File

@ -17,7 +17,9 @@
project boost-geometry-doc-example-algorithms
: # requirements
: requirements
<library>/boost/assign//boost_assign
<library>/boost/foreach//boost_foreach
;
exe append : append.cpp ;

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -16,32 +16,30 @@
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/assign.hpp> /*< At the end to avoid conflicts with Boost.QVM >*/
BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
int main()
{
using boost::assign::tuple_list_of;
using boost::make_tuple;
using boost::geometry::append;
typedef boost::geometry::model::polygon<boost::tuple<int, int> > polygon;
using vector = std::vector<boost::tuple<int, int>>;
using polygon = boost::geometry::model::polygon<boost::tuple<int, int>>;
polygon poly;
// Append a range
append(poly, tuple_list_of(0, 0)(0, 10)(11, 11)(10, 0)); /*< tuple_list_of delivers a range and can therefore be used in boost::geometry::append >*/
append(poly, vector{{0, 0}, {0, 10}, {11, 11}, {10, 0}}); /*< vector models a range and can therefore be used in boost::geometry::append >*/
// Append a point (in this case the closing point)
append(poly, make_tuple(0, 0));
append(poly, boost::make_tuple(0, 0));
// Create an interior ring (append does not do this automatically)
boost::geometry::interior_rings(poly).resize(1);
// Append a range to the interior ring
append(poly, tuple_list_of(2, 2)(2, 5)(6, 6)(5, 2), 0); /*< The last parameter ring_index 0 denotes the first interior ring >*/
append(poly, vector{{2, 2}, {2, 5}, {6, 6}, {5, 2}}, 0); /*< The last parameter ring_index 0 denotes the first interior ring >*/
// Append a point to the first interior ring
append(poly, make_tuple(2, 2), 0);
append(poly, boost::make_tuple(2, 2), 0);
std::cout << boost::geometry::dsv(poly) << std::endl;

View File

@ -21,13 +21,13 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/
int main()
{
// Calculate the area of a cartesian polygon
bg::model::polygon<bg::model::d2::point_xy<double> > poly;
bg::model::polygon<bg::model::d2::point_xy<double>> poly;
bg::read_wkt("POLYGON((0 0,0 7,4 2,2 0,0 0))", poly);
double area = bg::area(poly);
std::cout << "Area: " << area << std::endl;
// Calculate the area of a spherical equatorial polygon
bg::model::polygon<bg::model::point<float, 2, bg::cs::spherical_equatorial<bg::degree> > > sph_poly;
bg::model::polygon<bg::model::point<float, 2, bg::cs::spherical_equatorial<bg::degree>>> sph_poly;
bg::read_wkt("POLYGON((0 0,0 45,45 0,0 0))", sph_poly);
area = bg::area(sph_poly);
std::cout << "Area: " << area << std::endl;

View File

@ -25,7 +25,7 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/
int main()
{
// Create spherical polygon
bg::model::polygon<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > > sph_poly;
bg::model::polygon<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree>>> sph_poly;
bg::read_wkt("POLYGON((0 0,0 1,1 0,0 0))", sph_poly);
// Create spherical strategy with mean Earth radius in meters
@ -36,7 +36,7 @@ int main()
std::cout << "Area: " << area << std::endl;
// Create geographic polygon
bg::model::polygon<bg::model::point<double, 2, bg::cs::geographic<bg::degree> > > geo_poly;
bg::model::polygon<bg::model::point<double, 2, bg::cs::geographic<bg::degree>>> geo_poly;
bg::read_wkt("POLYGON((0 0,0 1,1 0,0 0))", geo_poly);
// Create geographic strategy with WGS84 spheroid

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -22,9 +22,9 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point;
typedef boost::geometry::model::box<point> box;
typedef boost::geometry::model::polygon<point> polygon;
using point = boost::geometry::model::d2::point_xy<double>;
using box = boost::geometry::model::box<point>;
using polygon = boost::geometry::model::polygon<point>;
point p1;
box b;

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -20,14 +20,14 @@ using namespace boost::geometry;
int main()
{
typedef model::d2::point_xy<double> point;
typedef model::box<point> box;
using point = model::d2::point_xy<double>;
using box = model::box<point>;
box b;
assign_values(b, 2, 2, 5, 5);
point ll, lr, ul, ur;
assign_box_corners(b, ll, lr, ul, ur);
detail::assign_box_corners(b, ll, lr, ul, ur);
std::cout << "box: " << dsv(b) << std::endl << std::endl;

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -20,8 +20,8 @@ using namespace boost::geometry;
int main()
{
typedef model::point<float, 3, cs::cartesian> point;
typedef model::box<point> box;
using point = model::point<float, 3, cs::cartesian>;
using box = model::box<point>;
box all;
assign_inverse(all);

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -20,15 +20,15 @@ using namespace boost::geometry;
int main()
{
typedef model::d2::point_xy<double> point;
typedef model::segment<point> segment;
using point = model::d2::point_xy<double>;
using segment = model::segment<point>;
segment s;
assign_values(s, 1, 1, 2, 2);
point first, second;
assign_point_from_index<0>(s, first);
assign_point_from_index<1>(s, second);
detail::assign_point_from_index<0>(s, first);
detail::assign_point_from_index<1>(s, second);
std::cout
<< "segment: " << dsv(s) << std::endl
<< "first: " << dsv(first) << std::endl

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -20,14 +20,14 @@ using namespace boost::geometry;
int main()
{
typedef model::d2::point_xy<int> point;
typedef model::box<point> box;
using point = model::d2::point_xy<int>;
using box = model::box<point>;
point lower_left(0, 0), upper_right(2, 2);
box b;
assign_point_to_index<0>(lower_left, b);
assign_point_to_index<1>(upper_right, b);
detail::assign_point_to_index<0>(lower_left, b);
detail::assign_point_to_index<1>(upper_right, b);
std::cout << "box: " << dsv(b) << std::endl;
return 0;

View File

@ -1,14 +1,14 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//[assign_points
//` Shows usage of Boost.Geometry's assign, Boost.Assign, and Boost.Range to assign ranges of a linestring
//` Shows usage of Boost.Geometry's assign, and Boost.Range to assign ranges of a linestring
#include <iostream>
@ -16,7 +16,6 @@
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/assign.hpp>
#include <boost/geometry/geometries/adapted/boost_range/filtered.hpp>
BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
@ -41,14 +40,12 @@ private :
int main()
{
using namespace boost::assign;
typedef boost::geometry::model::linestring<boost::tuple<int, int> > ls;
using ls = boost::geometry::model::linestring<boost::tuple<int, int>>;
ls line1, line2, line3;
line1 = tuple_list_of(0, 0)(2, 3)(4, 0)(6, 3)(8, 0)(10, 3)(12, 0); /*< tuple_list_of is part of Boost.Assign and can be used for Boost.Geometry if points are tuples >*/
boost::geometry::assign_points(line2, tuple_list_of(0, 0)(2, 2)(4, 0)(6, 2)(8, 0)); /*< tuple_list_of delivers a range and can therefore be used in boost::geometry::assign >*/
line1 = {{0, 0}, {2, 3}, {4, 0}, {6, 3}, {8, 0}, {10, 3}, {12, 0}};
boost::geometry::assign_points(line2, ls({{0, 0}, {2, 2}, {4, 0}, {6, 2}, {8, 0}}));
boost::geometry::assign_points(line3, line1 | boost::adaptors::filtered(x_between<int>(4, 8))); /*< Boost.Range adaptors can also be used in boost::geometry::assign >*/
std::cout << "line 1: " << boost::geometry::dsv(line1) << std::endl;

View File

@ -18,7 +18,7 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
point_type p1(0, 0);
point_type p2(1, 1);

View File

@ -19,7 +19,7 @@
int main()
{
namespace bg = boost::geometry;
typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > point_type;
using point_type = bg::model::point<double, 2, bg::cs::geographic<bg::degree>>;
point_type p1(0, 0);
point_type p2(1, 1);

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2013, 2014 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013, 2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -17,9 +17,9 @@
int main()
{
typedef double coordinate_type;
typedef boost::geometry::model::d2::point_xy<coordinate_type> point;
typedef boost::geometry::model::polygon<point> polygon;
using coordinate_type = double;
using point = boost::geometry::model::d2::point_xy<coordinate_type>;
using polygon = boost::geometry::model::polygon<point>;
// Declare strategies
const double buffer_distance = 1.0;

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -20,8 +20,8 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
polygon_type poly;
boost::geometry::read_wkt(

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -19,28 +19,21 @@
BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
#include <boost/assign.hpp>
int main()
{
using boost::assign::tuple_list_of;
using point = boost::tuple<float, float>;
using polygon = boost::geometry::model::polygon<point>;
using ring = boost::geometry::model::ring<point>;
typedef boost::tuple<float, float> point;
typedef boost::geometry::model::polygon<point> polygon;
typedef boost::geometry::model::ring<point> ring;
polygon poly;
// Fill the polygon (using its own methods + Boost.Assign)
poly.outer() = tuple_list_of(0, 0)(0, 9)(10, 10)(0, 0);
poly.inners().push_back(tuple_list_of(1, 2)(4, 6)(2, 8)(1, 2));
// Create a square as exterior ring, with a triangle as interior ring
polygon poly{{{0, 0}, {0, 10}, {10, 10}, {10, 0}, {0, 0}}, {{{1, 2}, {8, 2}, {4, 6}, {1, 2}}}};
std::cout << boost::geometry::dsv(poly) << std::endl;
boost::geometry::clear(poly);
std::cout << boost::geometry::dsv(poly) << std::endl;
// Create a ring using Boost.Assign
ring r = tuple_list_of(0, 0)(0, 9)(8, 8)(0, 0);
// Create a triangle
ring r{{0, 0}, {0, 9}, {8, 8}, {0, 0}};
std::cout << boost::geometry::dsv(r) << std::endl;
boost::geometry::clear(r);
@ -56,7 +49,7 @@ int main()
/*`
Output:
[pre
(((0, 0), (0, 10), (11, 11), (0, 0)), ((0, 0), (0, 10), (11, 11), (0, 0)))
(((0, 0), (0, 10), (10, 10), (10, 0), (0, 0)), ((1, 2), (8, 2), (4, 6), (1, 2)))
(())
((0, 0), (0, 9), (8, 8), (0, 0))
()

View File

@ -23,10 +23,10 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
typedef boost::geometry::model::linestring<point_type> linestring_type;
typedef boost::geometry::model::multi_point<point_type> multi_point_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
using linestring_type = boost::geometry::model::linestring<point_type>;
using multi_point_type = boost::geometry::model::multi_point<point_type>;
point_type p(4.3,1.9);
point_type p0(0,0);

View File

@ -21,14 +21,14 @@
int main()
{
typedef boost::geometry::model::d2::point_xy
using point_type = boost::geometry::model::d2::point_xy
<
double,
boost::geometry::cs::geographic<boost::geometry::degree>
> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
typedef boost::geometry::model::linestring<point_type> linestring_type;
typedef boost::geometry::model::multi_point<point_type> multi_point_type;
>;
using polygon_type = boost::geometry::model::polygon<point_type>;
using linestring_type = boost::geometry::model::linestring<point_type>;
using multi_point_type = boost::geometry::model::multi_point<point_type>;
point_type p(4.3,1.9);
polygon_type poly;

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -16,11 +16,10 @@
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/numeric/conversion/bounds.hpp>
#include <boost/foreach.hpp>
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
point_type p(1.4, 2.6);
@ -35,7 +34,7 @@ int main()
point_type min_p;
double min_d = boost::numeric::bounds<double>::highest();
BOOST_FOREACH(point_type const& pv, v)
for (point_type const& pv : v)
{
double d = boost::geometry::comparable_distance(p, pv);
if (d < min_d)

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -22,9 +22,9 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point;
typedef boost::geometry::model::box<point> box;
typedef boost::geometry::model::polygon<point> polygon;
using point = boost::geometry::model::d2::point_xy<double>;
using box = boost::geometry::model::box<point>;
using polygon = boost::geometry::model::polygon<point>;
point p1(1, 1);
box bx = boost::geometry::make<box>(1, 1, 2, 2);

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -21,8 +21,8 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
/*<-*/ #include "create_svg_two.hpp" /*->*/
int main()
{
typedef boost::tuple<double, double> point;
typedef boost::geometry::model::polygon<point> polygon;
using point = boost::tuple<double, double>;
using polygon = boost::geometry::model::polygon<point>;
polygon poly;
boost::geometry::read_wkt("polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0"

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -18,38 +18,37 @@
BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
#include <boost/assign.hpp>
int main()
{
using boost::assign::tuple_list_of;
typedef boost::geometry::model::polygon
using clockwise_closed_polygon = boost::geometry::model::polygon
<
boost::tuple<int, int>
> clockwise_closed_polygon;
>;
clockwise_closed_polygon cwcp;
// Fill it counterclockwise (so wrongly), forgetting the closing point
boost::geometry::exterior_ring(cwcp) = tuple_list_of(0, 0)(10, 10)(0, 9);
boost::geometry::exterior_ring(cwcp) = {{0, 0}, {10, 10}, {0, 9}};
// Add a counterclockwise closed inner ring (this is correct)
boost::geometry::interior_rings(cwcp).push_back(tuple_list_of(1, 2)(4, 6)(2, 8)(1, 2));
boost::geometry::interior_rings(cwcp).push_back({{1, 2}, {4, 6}, {2, 8}, {1, 2}});
// Its area should be negative (because of wrong orientation)
// and wrong (because of omitted closing point)
double area_before = boost::geometry::area(cwcp);
const auto area_before = boost::geometry::area(cwcp);
const auto count_before = boost::geometry::num_points(cwcp);
// Correct it!
boost::geometry::correct(cwcp);
// Check its new area
double area_after = boost::geometry::area(cwcp);
const auto area_after = boost::geometry::area(cwcp);
const auto count_after = boost::geometry::num_points(cwcp);
// And output it
std::cout << boost::geometry::dsv(cwcp) << std::endl;
std::cout << area_before << " -> " << area_after << std::endl;
std::cout << count_before << " -> " << count_after << std::endl;
return 0;
}
@ -63,6 +62,7 @@ Output:
[pre
(((0, 0), (0, 9), (10, 10), (0, 0)), ((1, 2), (4, 6), (2, 8), (1, 2)))
-7 -> 38
7 -> 8
]
*/
//]

View File

@ -21,22 +21,22 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/
int main()
{
// Checks if the first geometry is inside or on border the second geometry.
bg::model::polygon<bg::model::d2::point_xy<double> > poly1;
bg::model::polygon<bg::model::d2::point_xy<double>> poly1;
bg::read_wkt("POLYGON((0 2,0 3,2 4,1 2,0 2))", poly1);
bg::model::polygon<bg::model::d2::point_xy<double> > poly2;
bg::model::polygon<bg::model::d2::point_xy<double>> poly2;
bg::read_wkt("POLYGON((0 4,3 4,2 2,0 1,0 4))", poly2);
bool check_covered = bg::covered_by(poly1, poly2);
if (check_covered) {
std::cout << "Covered: Yes" << std::endl;
std::cout << "Covered: Yes" << std::endl;
} else {
std::cout << "Covered: No" << std::endl;
}
bg::model::polygon<bg::model::d2::point_xy<double> > poly3;
bg::model::polygon<bg::model::d2::point_xy<double>> poly3;
bg::read_wkt("POLYGON((-1 -1,-3 -4,-7 -7,-4 -3,-1 -1))", poly3);
check_covered = bg::covered_by(poly1, poly3);
if (check_covered) {
std::cout << "Covered: Yes" << std::endl;
std::cout << "Covered: Yes" << std::endl;
} else {
std::cout << "Covered: No" << std::endl;
}

View File

@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2011-2014 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014.
// Modifications copyright (c) 2014, Oracle and/or its affiliates.
@ -29,7 +29,7 @@ void create_svg(std::string const& filename, Geometry const& g)
#if defined(HAVE_SVG)
std::cout << std::endl << "[$img/algorithms/" << boost::replace_all_copy(filename, ".svg", ".png") << "]" << std::endl << std::endl;
typedef typename boost::geometry::point_type<Geometry>::type point_type;
using point_type = typename boost::geometry::point_type<Geometry>::type;
std::ofstream svg(filename.c_str());
boost::geometry::svg_mapper<point_type> mapper(svg, 400, 400);

View File

@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -13,7 +13,6 @@
#include <fstream>
#include <boost/foreach.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/algorithm/string.hpp>
@ -27,7 +26,7 @@ void create_svg(std::string const& filename, Geometry const& a, Geometry const&
#if defined(HAVE_SVG)
std::cout << std::endl << "[$img/algorithms/" << boost::replace_all_copy(filename, ".svg", ".png") << "]" << std::endl << std::endl;
typedef typename boost::geometry::point_type<Geometry>::type point_type;
using point_type = typename boost::geometry::point_type<Geometry>::type;
std::ofstream svg(filename.c_str());
boost::geometry::svg_mapper<point_type> mapper(svg, 400, 400);
@ -37,7 +36,7 @@ void create_svg(std::string const& filename, Geometry const& a, Geometry const&
mapper.map(a, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:2");
mapper.map(b, "fill-opacity:0.3;fill:rgb(51,51,153);stroke:rgb(51,51,153);stroke-width:2");
int i = 0;
BOOST_FOREACH(typename boost::range_value<Range>::type const& g, range)
for (typename boost::range_value<Range>::type const& g : range)
{
mapper.map(g, "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
std::ostringstream out;

View File

@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -24,7 +24,7 @@ void create_svg(std::string const& filename, Geometry1 const& a, Geometry2 const
#if defined(HAVE_SVG)
std::cout << std::endl << "[$img/algorithms/" << boost::replace_all_copy(filename, ".svg", ".png") << "]" << std::endl << std::endl;
typedef typename boost::geometry::point_type<Geometry1>::type point_type;
using point_type = typename boost::geometry::point_type<Geometry1>::type;
std::ofstream svg(filename.c_str());
boost::geometry::svg_mapper<point_type> mapper(svg, 400, 400);

View File

@ -21,23 +21,23 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/
int main()
{
// Checks if the two geometries (here, a polygon and a linestring) crosses or not.
bg::model::polygon<bg::model::d2::point_xy<double> > poly;
bg::model::polygon<bg::model::d2::point_xy<double>> poly;
bg::read_wkt("POLYGON((0 0,0 3,3 3,3 0,0 0))", poly);
bg::model::linestring<bg::model::d2::point_xy<double> > line1;
bg::model::linestring<bg::model::d2::point_xy<double>> line1;
bg::read_wkt("LINESTRING(1 1,2 2,4 4)", line1);
bool check_crosses = bg::crosses(poly, line1);
if (check_crosses) {
std::cout << "Crosses: Yes" << std::endl;
std::cout << "Crosses: Yes" << std::endl;
} else {
std::cout << "Crosses: No" << std::endl;
}
// Edge case: linestring just touches the polygon but doesn't crosses it.
bg::model::linestring<bg::model::d2::point_xy<double> > line2;
bg::model::linestring<bg::model::d2::point_xy<double>> line2;
bg::read_wkt("LINESTRING(1 1,1 2,1 3)", line2);
check_crosses = bg::crosses(poly, line2);
if (check_crosses) {
std::cout << "Crosses: Yes" << std::endl;
std::cout << "Crosses: Yes" << std::endl;
} else {
std::cout << "Crosses: No" << std::endl;
}

View File

@ -19,8 +19,8 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
polygon_type poly;
boost::geometry::read_wkt(

View File

@ -20,8 +20,8 @@
int main()
{
namespace bg = boost::geometry;
typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > point_type;
typedef bg::model::linestring<point_type> linestring_type;
using point_type = bg::model::point<double, 2, bg::cs::geographic<bg::degree>>;
using linestring_type = bg::model::linestring<point_type>;
linestring_type ls;
bg::read_wkt("LINESTRING(0 0,1 1)", ls);

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -16,13 +16,11 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/foreach.hpp>
/*<-*/ #include "create_svg_overlay.hpp" /*->*/
int main()
{
typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > polygon;
using polygon = boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>>;
polygon green, blue;
@ -38,7 +36,7 @@ int main()
int i = 0;
std::cout << "green - blue:" << std::endl;
BOOST_FOREACH(polygon const& p, output)
for (polygon const& p : output)
{
std::cout << i++ << ": " << boost::geometry::area(p) << std::endl;
}
@ -49,7 +47,7 @@ int main()
i = 0;
std::cout << "blue - green:" << std::endl;
BOOST_FOREACH(polygon const& p, output)
for (polygon const& p : output)
{
std::cout << i++ << ": " << boost::geometry::area(p) << std::endl;
}

View File

@ -1,87 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//[difference_inserter
//` Shows how the difference_inserter function can be used
#include <iostream>
#include <vector>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/foreach.hpp>
/*<-*/ #include "create_svg_overlay.hpp" /*->*/
int main()
{
typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > polygon;
polygon green, blue;
boost::geometry::read_wkt(
"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)"
"(4.0 2.0, 4.2 1.4, 4.8 1.9, 4.4 2.2, 4.0 2.0))", green);
boost::geometry::read_wkt(
"POLYGON((4.0 -0.5 , 3.5 1.0 , 2.0 1.5 , 3.5 2.0 , 4.0 3.5 , 4.5 2.0 , 6.0 1.5 , 4.5 1.0 , 4.0 -0.5))", blue);
std::vector<polygon> output;
// Note that this sample simulates the symmetric difference,
// which is also available as a separate algorithm.
// It chains the output iterator returned by the function to the second instance.
boost::geometry::difference_inserter<polygon>
(
green, blue,
boost::geometry::difference_inserter<polygon>
(
blue, green,
std::back_inserter(output)
)
);
int i = 0;
std::cout << "(blue \ green) u (green \ blue):" << std::endl;
BOOST_FOREACH(polygon const& p, output)
{
std::cout << i++ << ": " << boost::geometry::area(p) << std::endl;
}
/*<-*/ create_svg("difference_inserter.svg", green, blue, output); /*->*/
return 0;
}
//]
//[difference_inserter_output
/*`
Output:
[pre
(blue \\ green) u (green \\ blue):
0: 0.525154
1: 0.015
2: 0.181136
3: 0.128798
4: 0.340083
5: 0.307778
6: 0.02375
7: 0.542951
8: 0.0149697
9: 0.226855
10: 0.839424
[$img/algorithms/sym_difference.png]
]
*/
//]

View File

@ -17,8 +17,8 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::linestring<point_type> linestring_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using linestring_type = boost::geometry::model::linestring<point_type>;
linestring_type ls1, ls2;
boost::geometry::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", ls1);

View File

@ -18,8 +18,8 @@
int main()
{
namespace bg = boost::geometry;
typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > point_type;
typedef bg::model::linestring<point_type> linestring_type;
using point_type = bg::model::point<double, 2, bg::cs::geographic<bg::degree>>;
using linestring_type = bg::model::linestring<point_type>;
linestring_type ls1, ls2;
bg::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", ls1);

View File

@ -17,8 +17,8 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::linestring<point_type> linestring_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using linestring_type = boost::geometry::model::linestring<point_type>;
linestring_type ls1, ls2;
boost::geometry::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", ls1);

View File

@ -18,8 +18,8 @@
int main()
{
namespace bg = boost::geometry;
typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > point_type;
typedef bg::model::linestring<point_type> linestring_type;
using point_type = bg::model::point<double, 2, bg::cs::geographic<bg::degree>>;
using linestring_type = bg::model::linestring<point_type>;
linestring_type ls1, ls2;
bg::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", ls1);

View File

@ -21,22 +21,22 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/
int main()
{
// Checks if two geometries are disjoint, which means that two geometries have zero intersection.
bg::model::polygon<bg::model::d2::point_xy<double> > poly1;
bg::model::polygon<bg::model::d2::point_xy<double>> poly1;
bg::read_wkt("POLYGON((0 2,-2 0,-4 2,-2 4,0 2))", poly1);
bg::model::polygon<bg::model::d2::point_xy<double> > poly2;
bg::model::polygon<bg::model::d2::point_xy<double>> poly2;
bg::read_wkt("POLYGON((2 2,4 4,6 2,4 0,2 2))", poly2);
bool check_disjoint = bg::disjoint(poly1, poly2);
if (check_disjoint) {
std::cout << "Disjoint: Yes" << std::endl;
std::cout << "Disjoint: Yes" << std::endl;
} else {
std::cout << "Disjoint: No" << std::endl;
}
bg::model::polygon<bg::model::d2::point_xy<double> > poly3;
bg::model::polygon<bg::model::d2::point_xy<double>> poly3;
bg::read_wkt("POLYGON((0 2,2 4,4 2,2 0,0 2))", poly3);
check_disjoint = bg::disjoint(poly1, poly3);
if (check_disjoint) {
std::cout << "Disjoint: Yes" << std::endl;
std::cout << "Disjoint: Yes" << std::endl;
} else {
std::cout << "Disjoint: No" << std::endl;
}

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -20,14 +20,12 @@
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/foreach.hpp>
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
typedef boost::geometry::model::linestring<point_type> linestring_type;
typedef boost::geometry::model::multi_point<point_type> multi_point_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
using linestring_type = boost::geometry::model::linestring<point_type>;
using multi_point_type = boost::geometry::model::multi_point<point_type>;
point_type p(1,2);
polygon_type poly;

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -20,7 +20,7 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point;
using point = boost::geometry::model::d2::point_xy<double>;
boost::geometry::model::polygon<point> polygon;

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -18,17 +18,13 @@
BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
#include <boost/assign.hpp>
int main()
{
using boost::assign::tuple_list_of;
typedef boost::tuple<int, int> point;
using point = boost::tuple<int, int>;
boost::geometry::model::polygon<point> poly1, poly2;
boost::geometry::exterior_ring(poly1) = tuple_list_of(0, 0)(0, 5)(5, 5)(5, 0)(0, 0);
boost::geometry::exterior_ring(poly2) = tuple_list_of(5, 0)(0, 0)(0, 5)(5, 5)(5, 0);
boost::geometry::exterior_ring(poly1) = {{0, 0}, {0, 5}, {5, 5}, {5, 0}, {0, 0}};
boost::geometry::exterior_ring(poly2) = {{5, 0}, {0, 0}, {0, 5}, {5, 5}, {5, 0}};
std::cout
<< "polygons are spatially "
@ -43,7 +39,6 @@ int main()
<< (boost::geometry::equals(box, poly2) ? "equal" : "not equal")
<< std::endl;
return 0;
}

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -19,8 +19,8 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<short int> point_type;
typedef boost::geometry::model::box<point_type> box_type;
using point_type = boost::geometry::model::d2::point_xy<short int>;
using box_type = boost::geometry::model::box<point_type>;
using boost::geometry::expand;

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -16,41 +16,27 @@
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
template <typename Point>
class round_coordinates
{
private :
typedef typename boost::geometry::coordinate_type<Point>::type coordinate_type;
coordinate_type factor;
inline coordinate_type round(coordinate_type value)
{
return floor(0.5 + (value / factor)) * factor;
}
public :
round_coordinates(coordinate_type f)
: factor(f)
{}
inline void operator()(Point& p)
{
using boost::geometry::get;
using boost::geometry::set;
set<0>(p, round(get<0>(p)));
set<1>(p, round(get<1>(p)));
}
};
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point;
using point = boost::geometry::model::d2::point_xy<double>;
constexpr auto factor = 0.1;
auto round = [&](auto value)
{
return floor(0.5 + (value / factor)) * factor;
};
boost::geometry::model::polygon<point> poly;
boost::geometry::read_wkt("POLYGON((0 0,1.123 9.987,8.876 2.234,0 0),(3.345 4.456,7.654 8.765,9.123 5.432,3.345 4.456))", poly);
boost::geometry::for_each_point(poly, round_coordinates<point>(0.1));
boost::geometry::for_each_point(poly,
[&round](auto& p)
{
using boost::geometry::get;
using boost::geometry::set;
set<0>(p, round(get<0>(p)));
set<1>(p, round(get<1>(p)));
}
);
std::cout << "Rounded: " << boost::geometry::wkt(poly) << std::endl;
return 0;
}

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -26,7 +26,7 @@ void list_coordinates(Point const& p)
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point;
using point = boost::geometry::model::d2::point_xy<double>;
boost::geometry::model::polygon<point> poly;
boost::geometry::read_wkt("POLYGON((0 0,0 4,4 0,0 0))", poly);
boost::geometry::for_each_point(poly, list_coordinates<point>);

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -11,72 +11,37 @@
//` Sample using for_each_segment, using a functor to get the minimum and maximum length of a segment in a linestring
#include <iostream>
#include <limits>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/assign.hpp>
template <typename Segment>
struct gather_segment_statistics
{
// Remember that if coordinates are integer, the length might be floating point
// So use "double" for integers. In other cases, use coordinate type
typedef typename boost::geometry::select_most_precise
<
typename boost::geometry::coordinate_type<Segment>::type,
double
>::type type;
type min_length, max_length;
// Initialize min and max
gather_segment_statistics()
: min_length(1e38)
, max_length(-1)
{}
// This operator is called for each segment
inline void operator()(Segment const& s)
{
type length = boost::geometry::length(s);
if (length < min_length) min_length = length;
if (length > max_length) max_length = length;
}
};
int main()
{
// Bring "+=" for a vector into scope
using namespace boost::assign;
// Define a type
typedef boost::geometry::model::d2::point_xy<double> point;
using point = boost::geometry::model::d2::point_xy<double>;
// Declare a linestring
boost::geometry::model::linestring<point> polyline;
// Create a linestring
const boost::geometry::model::linestring<point> polyline =
{{0, 0}, {3, 3}, {5, 1}, {6, 2}, {8, 0}, {4, -4}, {1, -1}, {3, 2}};
// Use Boost.Assign to initialize a linestring
polyline += point(0, 0), point(3, 3), point(5, 1), point(6, 2),
point(8, 0), point(4, -4), point(1, -1), point(3, 2);
// Declare the gathering class...
gather_segment_statistics
<
boost::geometry::model::referring_segment<point>
> functor;
// ... and use it, the essention.
// As also in std::for_each it is a const value, so retrieve it as a return value.
functor = boost::geometry::for_each_segment(polyline, functor);
// Iterate over its segments to find the minimum and maximum length
double min_length = std::numeric_limits<double>::max();
double max_length = -std::numeric_limits<double>::max();
boost::geometry::for_each_segment(polyline,
[&](auto const& s)
{
const auto length = static_cast<double>(boost::geometry::length(s));
min_length = std::min(min_length, length);
max_length = std::max(max_length, length);
});
// Output the results
std::cout
<< "Min segment length: " << functor.min_length << std::endl
<< "Max segment length: " << functor.max_length << std::endl;
<< "Min segment length: " << min_length << std::endl
<< "Max segment length: " << max_length << std::endl;
return 0;
}

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -17,14 +17,12 @@
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/register/linestring.hpp>
#include <boost/foreach.hpp>
BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
int main()
{
typedef boost::geometry::model::d2::point_xy<double> P;
using P = boost::geometry::model::d2::point_xy<double>;
std::vector<P> line1, line2;
boost::geometry::read_wkt("linestring(1 1,2 2,3 1)", line1);
boost::geometry::read_wkt("linestring(1 2,2 1,3 2)", line2);
@ -32,7 +30,7 @@ int main()
std::deque<P> intersection_points;
boost::geometry::intersection(line1, line2, intersection_points);
BOOST_FOREACH(P const& p, intersection_points)
for (P const& p : intersection_points)
{
std::cout << " " << boost::geometry::wkt(p);
}

Some files were not shown because too many files have changed in this diff Show More