Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
R*tree implementation based on boost::variant
[SVN r70531]
- Loading branch information
0 parents
commit c5e823b
Showing
32 changed files
with
3,190 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
* text=auto !eol svneol=native#text/plain | ||
*.gitattributes text svneol=native#text/plain | ||
|
||
# Scriptish formats | ||
*.bat text svneol=native#text/plain | ||
*.bsh text svneol=native#text/x-beanshell | ||
*.cgi text svneol=native#text/plain | ||
*.cmd text svneol=native#text/plain | ||
*.js text svneol=native#text/javascript | ||
*.php text svneol=native#text/x-php | ||
*.pl text svneol=native#text/x-perl | ||
*.pm text svneol=native#text/x-perl | ||
*.py text svneol=native#text/x-python | ||
*.sh eol=lf svneol=LF#text/x-sh | ||
configure eol=lf svneol=LF#text/x-sh | ||
|
||
# Image formats | ||
*.bmp binary svneol=unset#image/bmp | ||
*.gif binary svneol=unset#image/gif | ||
*.ico binary svneol=unset#image/ico | ||
*.jpeg binary svneol=unset#image/jpeg | ||
*.jpg binary svneol=unset#image/jpeg | ||
*.png binary svneol=unset#image/png | ||
*.tif binary svneol=unset#image/tiff | ||
*.tiff binary svneol=unset#image/tiff | ||
*.svg text svneol=native#image/svg%2Bxml | ||
|
||
# Data formats | ||
*.pdf binary svneol=unset#application/pdf | ||
*.avi binary svneol=unset#video/avi | ||
*.doc binary svneol=unset#application/msword | ||
*.dsp text svneol=crlf#text/plain | ||
*.dsw text svneol=crlf#text/plain | ||
*.eps binary svneol=unset#application/postscript | ||
*.gz binary svneol=unset#application/gzip | ||
*.mov binary svneol=unset#video/quicktime | ||
*.mp3 binary svneol=unset#audio/mpeg | ||
*.ppt binary svneol=unset#application/vnd.ms-powerpoint | ||
*.ps binary svneol=unset#application/postscript | ||
*.psd binary svneol=unset#application/photoshop | ||
*.rdf binary svneol=unset#text/rdf | ||
*.rss text svneol=unset#text/xml | ||
*.rtf binary svneol=unset#text/rtf | ||
*.sln text svneol=native#text/plain | ||
*.swf binary svneol=unset#application/x-shockwave-flash | ||
*.tgz binary svneol=unset#application/gzip | ||
*.vcproj text svneol=native#text/xml | ||
*.vcxproj text svneol=native#text/xml | ||
*.vsprops text svneol=native#text/xml | ||
*.wav binary svneol=unset#audio/wav | ||
*.xls binary svneol=unset#application/vnd.ms-excel | ||
*.zip binary svneol=unset#application/zip | ||
|
||
# Text formats | ||
.htaccess text svneol=native#text/plain | ||
*.bbk text svneol=native#text/xml | ||
*.cmake text svneol=native#text/plain | ||
*.css text svneol=native#text/css | ||
*.dtd text svneol=native#text/xml | ||
*.htm text svneol=native#text/html | ||
*.html text svneol=native#text/html | ||
*.ini text svneol=native#text/plain | ||
*.log text svneol=native#text/plain | ||
*.mak text svneol=native#text/plain | ||
*.qbk text svneol=native#text/plain | ||
*.rst text svneol=native#text/plain | ||
*.sql text svneol=native#text/x-sql | ||
*.txt text svneol=native#text/plain | ||
*.xhtml text svneol=native#text/xhtml%2Bxml | ||
*.xml text svneol=native#text/xml | ||
*.xsd text svneol=native#text/xml | ||
*.xsl text svneol=native#text/xml | ||
*.xslt text svneol=native#text/xml | ||
*.xul text svneol=native#text/xul | ||
*.yml text svneol=native#text/plain | ||
boost-no-inspect text svneol=native#text/plain | ||
CHANGES text svneol=native#text/plain | ||
COPYING text svneol=native#text/plain | ||
INSTALL text svneol=native#text/plain | ||
Jamfile text svneol=native#text/plain | ||
Jamroot text svneol=native#text/plain | ||
Jamfile.v2 text svneol=native#text/plain | ||
Jamrules text svneol=native#text/plain | ||
Makefile* text svneol=native#text/plain | ||
README text svneol=native#text/plain | ||
TODO text svneol=native#text/plain | ||
|
||
# Code formats | ||
*.c text svneol=native#text/plain | ||
*.cpp text svneol=native#text/plain | ||
*.h text svneol=native#text/plain | ||
*.hpp text svneol=native#text/plain | ||
*.ipp text svneol=native#text/plain | ||
*.tpp text svneol=native#text/plain | ||
*.jam text svneol=native#text/plain | ||
*.java text svneol=native#text/plain |
58 changes: 58 additions & 0 deletions
58
include/boost/geometry/extensions/index/algorithms/area.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Boost.Geometry (aka GGL, Generic Geometry Library) | ||
// | ||
// Boost.SpatialIndex - n-dimensional box's area/volume | ||
// | ||
// Copyright 2011 Adam Wulkiewicz. | ||
// 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 BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_AREA_HPP | ||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_AREA_HPP | ||
|
||
namespace boost { namespace geometry { namespace index { | ||
|
||
template <typename Box> | ||
struct area_result | ||
{ | ||
typedef typename select_most_precise< | ||
typename coordinate_type<Box>::type, | ||
long double | ||
>::type type; | ||
}; | ||
|
||
namespace detail { | ||
|
||
template <typename Box, size_t CurrentDimension> | ||
struct area_for_each_dimension | ||
{ | ||
BOOST_STATIC_ASSERT(0 < CurrentDimension); | ||
BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension<Box>::value); | ||
|
||
static inline typename area_result<Box>::type apply(Box const& b) | ||
{ | ||
return area_for_each_dimension<Box, CurrentDimension - 1>::apply(b) * | ||
( geometry::get<max_corner, CurrentDimension - 1>(b) - geometry::get<min_corner, CurrentDimension - 1>(b) ); | ||
} | ||
}; | ||
|
||
template <typename Box> | ||
struct area_for_each_dimension<Box, 1> | ||
{ | ||
static inline typename area_result<Box>::type apply(Box const& b) | ||
{ | ||
return geometry::get<max_corner, 0>(b) - geometry::get<min_corner, 0>(b); | ||
} | ||
}; | ||
|
||
} // namespace detail | ||
|
||
template <typename Box> | ||
typename area_result<Box>::type area(Box const& b) | ||
{ | ||
return detail::area_for_each_dimension<Box, traits::dimension<Box>::value>::apply(b); | ||
} | ||
|
||
}}} // namespace boost::geometry::index | ||
|
||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_AREA_HPP |
102 changes: 102 additions & 0 deletions
102
include/boost/geometry/extensions/index/algorithms/margin.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// Boost.Geometry (aka GGL, Generic Geometry Library) | ||
// | ||
// Boost.SpatialIndex - n-dimensional box's margin value, 2d perimeter, 3d surface, etc... | ||
// | ||
// Copyright 2011 Adam Wulkiewicz. | ||
// 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 BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MARGIN_HPP | ||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MARGIN_HPP | ||
|
||
namespace boost { namespace geometry { namespace index { | ||
|
||
template <typename Box> | ||
struct margin_result | ||
{ | ||
typedef typename select_most_precise< | ||
typename coordinate_type<Box>::type, | ||
long double | ||
>::type type; | ||
}; | ||
|
||
namespace detail { | ||
|
||
template <typename Box, size_t CurrentDimension, size_t EdgeDimension> | ||
struct margin_for_each_edge | ||
{ | ||
BOOST_STATIC_ASSERT(0 < CurrentDimension); | ||
BOOST_STATIC_ASSERT(0 < EdgeDimension); | ||
|
||
static inline typename margin_result<Box>::type apply(Box const& b) | ||
{ | ||
return margin_for_each_edge<Box, CurrentDimension, EdgeDimension - 1>::apply(b) * | ||
( geometry::get<max_corner, EdgeDimension - 1>(b) - geometry::get<min_corner, EdgeDimension - 1>(b) ); | ||
} | ||
}; | ||
|
||
template <typename Box, size_t CurrentDimension> | ||
struct margin_for_each_edge<Box, CurrentDimension, CurrentDimension> | ||
{ | ||
BOOST_STATIC_ASSERT(0 < CurrentDimension); | ||
|
||
static inline typename margin_result<Box>::type apply(Box const& b) | ||
{ | ||
return margin_for_each_edge<Box, CurrentDimension, CurrentDimension - 1>::apply(b); | ||
} | ||
}; | ||
|
||
template <typename Box, size_t CurrentDimension> | ||
struct margin_for_each_edge<Box, CurrentDimension, 1> | ||
{ | ||
BOOST_STATIC_ASSERT(0 < CurrentDimension); | ||
|
||
static inline typename margin_result<Box>::type apply(Box const& b) | ||
{ | ||
return geometry::get<max_corner, 0>(b) - geometry::get<min_corner, 0>(b); | ||
} | ||
}; | ||
|
||
template <typename Box> | ||
struct margin_for_each_edge<Box, 1, 1> | ||
{ | ||
static inline typename margin_result<Box>::type apply(Box const& b) | ||
{ | ||
return 1; | ||
} | ||
}; | ||
|
||
template <typename Box, size_t CurrentDimension> | ||
struct margin_for_each_dimension | ||
{ | ||
BOOST_STATIC_ASSERT(0 < CurrentDimension); | ||
BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension<Box>::value); | ||
|
||
static inline typename margin_result<Box>::type apply(Box const& b) | ||
{ | ||
return margin_for_each_dimension<Box, CurrentDimension - 1>::apply(b) + | ||
2 * margin_for_each_edge<Box, CurrentDimension, traits::dimension<Box>::value>::apply(b); | ||
} | ||
}; | ||
|
||
template <typename Box> | ||
struct margin_for_each_dimension<Box, 1> | ||
{ | ||
static inline typename margin_result<Box>::type apply(Box const& b) | ||
{ | ||
return 2 * margin_for_each_edge<Box, 1, traits::dimension<Box>::value>::apply(b); | ||
} | ||
}; | ||
|
||
} // namespace detail | ||
|
||
template <typename Box> | ||
typename margin_result<Box>::type margin(Box const& b) | ||
{ | ||
return detail::margin_for_each_dimension<Box, traits::dimension<Box>::value>::apply(b); | ||
} | ||
|
||
}}} // namespace boost::geometry::index | ||
|
||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MARGIN_HPP |
34 changes: 34 additions & 0 deletions
34
include/boost/geometry/extensions/index/algorithms/overlap.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Boost.Geometry (aka GGL, Generic Geometry Library) | ||
// | ||
// Boost.SpatialIndex - n-dimensional area/volume of boxes intersecion/overlap | ||
// | ||
// Copyright 2011 Adam Wulkiewicz. | ||
// 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 BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP | ||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP | ||
|
||
#include <boost/geometry/algorithms/intersection.hpp> | ||
#include <boost/geometry/extensions/index/algorithms/area.hpp> | ||
|
||
namespace boost { namespace geometry { namespace index { | ||
|
||
template <typename Box> | ||
struct overlap_result | ||
{ | ||
typedef typename area_result<Box>::type type; | ||
}; | ||
|
||
template <typename Box> | ||
typename overlap_result<Box>::type overlap(Box const& b1, Box const& b2) | ||
{ | ||
Box inters; | ||
geometry::intersection(b1, b2, inters); | ||
return index::area(inters); | ||
} | ||
|
||
}}} // namespace boost::geometry::index | ||
|
||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP |
32 changes: 32 additions & 0 deletions
32
include/boost/geometry/extensions/index/algorithms/union_area.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Boost.Geometry (aka GGL, Generic Geometry Library) | ||
// | ||
// Boost.SpatialIndex - boxes union/intersection area/volume | ||
// | ||
// Copyright 2008 Federico J. Fernandez. | ||
// Copyright 2011 Adam Wulkiewicz. | ||
// 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 BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_AREA_HPP | ||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_AREA_HPP | ||
|
||
#include <boost/geometry/algorithms/expand.hpp> | ||
#include <boost/geometry/extensions/index/algorithms/area.hpp> | ||
|
||
namespace boost { namespace geometry { namespace index { | ||
|
||
/** | ||
* \brief Compute the area of the union of b1 and b2 | ||
*/ | ||
template <typename Box, typename Geometry> | ||
inline typename area_result<Box>::type union_area(Box const& b, Geometry const& g) | ||
{ | ||
Box expanded_box(b); | ||
geometry::expand(expanded_box, g); | ||
return index::area(expanded_box); | ||
} | ||
|
||
}}} // namespace boost::geometry::index | ||
|
||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_AREA_HPP |
62 changes: 62 additions & 0 deletions
62
include/boost/geometry/extensions/index/default_parameter.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Boost.Geometry (aka GGL, Generic Geometry Library) | ||
// | ||
// Boost.SpatialIndex - default indexes parameters | ||
// | ||
// Copyright 2011 Adam Wulkiewicz. | ||
// 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 BOOST_GEOMETRY_EXTENSIONS_INDEX_DEFAULT_PARAMETER_HPP | ||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DEFAULT_PARAMETER_HPP | ||
|
||
#include <boost/geometry/geometries/point.hpp> | ||
#include <boost/geometry/geometries/box.hpp> | ||
#include <boost/geometry/extensions/index/translator/def.hpp> | ||
|
||
namespace boost { namespace geometry { namespace index { | ||
|
||
// TODO: awulkiew - move this elsewhere | ||
struct default_parameter {}; | ||
|
||
namespace detail { | ||
|
||
template <typename Indexable> | ||
struct geometry_box_type | ||
{ | ||
typedef geometry::model::box< | ||
geometry::model::point< | ||
typename index::traits::coordinate_type<Indexable>::type, | ||
index::traits::dimension<Indexable>::value, | ||
typename index::traits::coordinate_system<Indexable>::type | ||
> | ||
> type; | ||
}; | ||
|
||
template <typename Value, typename Translator> | ||
struct default_translator_type | ||
{ | ||
typedef Translator type; | ||
}; | ||
template <typename Value> | ||
struct default_translator_type<Value, default_parameter> | ||
{ | ||
typedef translator::def<Value> type; | ||
}; | ||
|
||
template <typename Indexable, typename Box> | ||
struct default_box_type | ||
{ | ||
typedef Box type; | ||
}; | ||
template <typename Indexable> | ||
struct default_box_type<Indexable, default_parameter> | ||
{ | ||
typedef typename detail::geometry_box_type<Indexable>::type type; | ||
}; | ||
|
||
} // namespace detail | ||
|
||
}}} // namespace boost::geometry::index | ||
|
||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DEFAULT_PARAMETER_HPP |
Oops, something went wrong.