Skip to content

Instantly share code, notes, and snippets.

@mloskot
Last active December 18, 2015 17:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mloskot/5821937 to your computer and use it in GitHub Desktop.
Save mloskot/5821937 to your computer and use it in GitHub Desktop.
Quick report of the Boost.Geoemtry implementation support status in plain text format, with modified code for text_outputter.hpp to pretty-print with geometry names included.

Legend

BOX
LS  - LineString
MLS - MultiLineString
MPL - MultiPolygon
MPT - MultiPoint
PL  - Polygon
PT  - Point
RIN - Ring
RNG - Range
SEG - Segment

Status resuls

append
        PT      RNG
PT      OK      OK
SEG     OK      OK
BOX     OK      OK
LS      OK      OK
RIN     OK      OK
PL      OK      OK
MPT     OK      OK
MLS     OK      OK
MPL     OK      OK

area
PT      OK
SEG     OK
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

buffer
        PT      SEG     BOX     LS      RIN     PL      MPT     MLS     MPL
PT      -       -       -       -       -       -       -       -       -
SEG     -       -       -       -       -       -       -       -       -
BOX     -       -       OK      -       -       -       -       -       -
LS      -       -       -       -       -       -       -       -       -
RIN     -       -       -       -       -       -       -       -       -
PL      -       -       -       -       -       -       -       -       -
MPT     -       -       -       -       -       -       -       -       -
MLS     -       -       -       -       -       -       -       -       -
MPL     -       -       -       -       -       -       -       -       -

centroid
PT      OK
SEG     -
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

clear
PT      OK
SEG     OK
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

convert
        PT      SEG     BOX     LS      RIN     PL      MPT     MLS     MPL
PT      OK      -       -       -       -       -       -       -       -
SEG     -       OK      -       -       -       -       -       -       -
BOX     OK      -       OK      -       -       -       -       -       -
LS      -       OK      -       OK      -       -       -       -       -
RIN     -       -       OK      -       OK      OK      -       -       -
PL      -       -       OK      -       OK      OK      -       -       -
MPT     OK      -       -       -       -       -       OK      -       -
MLS     -       OK      -       OK      -       -       -       OK      -
MPL     -       -       OK      -       OK      OK      -       -       OK

convex_hull
PT      OK
SEG     OK
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

correct
PT      OK
SEG     OK
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

covered_by
        PT      SEG     BOX     LS      RIN     PL      MPT     MLS     MPL
PT      -       -       -       -       -       -       -       -       -
SEG     -       -       -       -       -       -       -       -       -
BOX     OK      -       OK      -       -       -       -       -       -
LS      -       -       -       -       -       -       -       -       -
RIN     OK      -       -       -       -       -       -       -       -
PL      OK      -       -       -       -       -       -       -       -
MPT     -       -       -       -       -       -       -       -       -
MLS     -       -       -       -       -       -       -       -       -
MPL     OK      -       -       -       -       -       -       -       -

disjoint
        PT      SEG     BOX     LS      RIN     PL      MPT     MLS     MPL
PT      OK      OK      OK      OK      OK      OK      OK      OK      OK
SEG     OK      OK      OK      OK      OK      OK      OK      OK      OK
BOX     OK      OK      OK      OK      OK      OK      OK      OK      OK
LS      OK      OK      OK      OK      OK      OK      OK      OK      OK
RIN     OK      OK      OK      OK      OK      OK      OK      OK      OK
PL      OK      OK      OK      OK      OK      OK      OK      OK      OK
MPT     OK      OK      OK      OK      OK      OK      OK      OK      OK
MLS     OK      OK      OK      OK      OK      OK      OK      OK      OK
MPL     OK      OK      OK      OK      OK      OK      OK      OK      OK

distance
        PT      SEG     BOX     LS      RIN     PL      MPT     MLS     MPL
PT      OK      OK      -       OK      OK      OK      OK      OK      OK
SEG     OK      -       -       -       -       -       -       -       -
BOX     -       -       -       -       -       -       -       -       -
LS      OK      -       -       -       -       -       OK      -       -
RIN     OK      -       -       -       -       -       -       -       -
PL      OK      -       -       -       -       -       OK      -       -
MPT     OK      -       -       OK      -       OK      OK      OK      OK
MLS     OK      -       -       -       -       -       OK      -       -
MPL     OK      -       -       -       -       -       OK      -       -

envelope
PT      OK
SEG     OK
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

equals
        PT      SEG     BOX     LS      RIN     PL      MPT     MLS     MPL
PT      OK      -       -       -       -       -       -       -       -
SEG     -       -       -       -       -       -       -       -       -
BOX     -       -       OK      -       OK      OK      -       -       -
LS      -       -       -       OK      -       -       -       -       -
RIN     -       -       OK      -       OK      OK      -       -       -
PL      -       -       OK      -       OK      OK      -       -       OK
MPT     -       -       -       -       -       -       -       -       -
MLS     -       -       -       -       -       -       -       -       -
MPL     -       -       -       -       -       OK      -       -       OK

expand
        PT      SEG     BOX     LS      RIN     PL      MPT     MLS     MPL
PT      -       -       OK      -       -       -       -       -       -
SEG     -       -       OK      -       -       -       -       -       -
BOX     -       -       OK      -       -       -       -       -       -
LS      -       -       -       -       -       -       -       -       -
RIN     -       -       -       -       -       -       -       -       -
PL      -       -       -       -       -       -       -       -       -
MPT     -       -       -       -       -       -       -       -       -
MLS     -       -       -       -       -       -       -       -       -
MPL     -       -       -       -       -       -       -       -       -

for_each_point
PT      OK
SEG     -
BOX     -
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

for_each_segment
PT      OK
SEG     -
BOX     -
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

length
PT      OK
SEG     OK
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

num_geometries
PT      OK
SEG     OK
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

num_interior_rings
PT      OK
SEG     OK
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

num_points
PT      OK
SEG     OK
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

overlaps
        PT      SEG     BOX     LS      RIN     PL      MPT     MLS     MPL
PT      -       -       -       -       -       -       -       -       -
SEG     -       -       -       -       -       -       -       -       -
BOX     -       -       OK      -       -       -       -       -       -
LS      -       -       -       -       -       -       -       -       -
RIN     -       -       -       -       -       -       -       -       -
PL      -       -       -       -       -       -       -       -       -
MPT     -       -       -       -       -       -       -       -       -
MLS     -       -       -       -       -       -       -       -       -
MPL     -       -       -       -       -       -       -       -       -

perimeter
PT      OK
SEG     OK
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

reverse
PT      OK
SEG     OK
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

simplify
PT      OK
SEG     -
BOX     -
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

transform
        PT      SEG     BOX     LS      RIN     PL      MPT     MLS     MPL
PT      OK      OK      OK      OK      OK      OK      OK      OK      OK
SEG     OK      OK      OK      OK      OK      OK      OK      OK      OK
BOX     OK      OK      OK      OK      OK      OK      OK      OK      OK
LS      OK      OK      OK      OK      OK      OK      OK      OK      OK
RIN     OK      OK      OK      OK      OK      OK      OK      OK      OK
PL      OK      OK      OK      OK      OK      OK      OK      OK      OK
MPT     OK      OK      OK      OK      OK      OK      OK      OK      OK
MLS     OK      OK      OK      OK      OK      OK      OK      OK      OK
MPL     OK      OK      OK      OK      OK      OK      OK      OK      OK

unique
PT      OK
SEG     OK
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

within
        PT      SEG     BOX     LS      RIN     PL      MPT     MLS     MPL
PT      -       -       -       -       -       -       -       -       -
SEG     -       -       -       -       -       -       -       -       -
BOX     OK      -       OK      -       -       -       -       -       -
LS      -       -       -       -       -       -       -       -       -
RIN     OK      -       -       -       -       -       -       -       -
PL      OK      -       -       -       -       -       -       -       -
MPT     -       -       -       -       -       -       -       -       -
MLS     -       -       -       -       -       -       -       -       -
MPL     OK      -       -       -       -       -       -       -       -

wkt
PT      OK
SEG     OK
BOX     OK
LS      OK
RIN     OK
PL      OK
MPT     OK
MLS     OK
MPL     OK

Modified text_outputter.hpp in order to include geometry names in the output

// Boost.Geometry (aka GGL, Generic Geometry Library)
// Tool reporting Implementation Support Status in QBK or plain text format

// Copyright (c) 2011-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013 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)

#ifndef BOOST_GEOMETRY_SUPPORT_STATUS_TEXT_OUTPUTTER_HPP
#define BOOST_GEOMETRY_SUPPORT_STATUS_TEXT_OUTPUTTER_HPP


template <typename Tag> struct text_geometry_name                            { static inline std::string name() { return "RNG"; } }; // TODO / make general
template <> struct text_geometry_name<boost::geometry::point_tag>            { static inline std::string name() { return "PT "; } };
template <> struct text_geometry_name<boost::geometry::segment_tag>          { static inline std::string name() { return "SEG"; } };
template <> struct text_geometry_name<boost::geometry::box_tag>              { static inline std::string name() { return "BOX"; } };
template <> struct text_geometry_name<boost::geometry::linestring_tag>       { static inline std::string name() { return "LS "; } };
template <> struct text_geometry_name<boost::geometry::ring_tag>             { static inline std::string name() { return "RIN"; } };
template <> struct text_geometry_name<boost::geometry::polygon_tag>          { static inline std::string name() { return "PL "; } };
template <> struct text_geometry_name<boost::geometry::multi_point_tag>      { static inline std::string name() { return "MPT"; } };
template <> struct text_geometry_name<boost::geometry::multi_linestring_tag> { static inline std::string name() { return "MLS"; } };
template <> struct text_geometry_name<boost::geometry::multi_polygon_tag>    { static inline std::string name() { return "MPL"; } };

std::streamsize const field_width = 8;

struct text_table_row_header
{
    std::ostream& m_out;

    text_table_row_header(std::ostream& out)
        : m_out(out)
    {}

    template <typename G>
    void operator()(G)
    {
        m_out << std::setw(field_width) << std::left << std::setfill(' ') <<
            text_geometry_name
                <
                    typename boost::geometry::tag<G>::type
                >::name();// << ' ';
    }
};


struct text_outputter
{
    explicit text_outputter(const std::string&) {}

    static inline void ok()
    {
        std::cout << std::setw(field_width) << std::left << std::setfill(' ') << "OK";
    }
    static inline void nyi() { std::cout << std::setw(field_width) << std::left << std::setfill(' ') << "-"; }
    static inline void header(std::string const& algo) { std::cout << algo << std::endl; }

    template <typename Types>
    static inline void table_header()
    {
        std::cout << std::setw(field_width) << std::left << std::setfill(' ') << ' ';
        boost::mpl::for_each<Types>(
            text_table_row_header(
                    std::cout << std::setw(field_width) << std::left << std::setfill(' ')));
        std::cout << std::endl;
    }

    static inline void table_header() {  }

    static inline void table_footer() { std::cout << std::endl; }

    template <typename G>
    static inline void begin_row()
    {
        std::cout << std::setw(field_width) << std::left << std::setfill(' ')
            << text_geometry_name
            <
            typename boost::geometry::tag<G>::type
            >::name()
            ;
    }

    static inline void end_row() { std::cout << std::endl; }

};

#endif // BOOST_GEOMETRY_SUPPORT_STATUS_TEXT_OUTPUTTER_HPP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment