LibreOffice Module basegfx (master) 1
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
basegfx::B2DConnectedRanges< UserData > Class Template Reference

Calculate connected ranges from input ranges. More...

#include <b2dconnectedranges.hxx>

Collaboration diagram for basegfx::B2DConnectedRanges< UserData >:
[legend]

Classes

struct  ConnectedComponents
 List of (intersecting) components, plus overall bounds. More...
 

Public Types

typedef ::std::pair< B2DRange, UserDataComponentType
 Type of the basic entity (rect + user data) More...
 
typedef ::std::list< ComponentTypeComponentListType
 
typedef ::std::list< ConnectedComponentsConnectedComponentsType
 

Public Member Functions

 B2DConnectedRanges ()
 Create the range calculator. More...
 
void addRange (const B2DRange &rRange, const UserData &rUserData)
 Add an additional range. More...
 
template<typename UnaryFunctor >
UnaryFunctor forEachAggregate (UnaryFunctor aFunctor) const
 Apply a functor to each of the disjunct component aggregates. More...
 

Private Member Functions

 B2DConnectedRanges (const B2DConnectedRanges &)=delete
 
B2DConnectedRangesoperator= (const B2DConnectedRanges &)=delete
 

Private Attributes

ConnectedComponentsType maDisjunctAggregatesList
 Current list of disjunct sets of connected components. More...
 
B2DRange maTotalBounds
 Global bound rect over all added ranges. More...
 

Detailed Description

template<typename UserData>
class basegfx::B2DConnectedRanges< UserData >

Calculate connected ranges from input ranges.

This template constructs a list of connected ranges from the given input ranges. That is, the output will contain a set of ranges, itself containing a number of input ranges, which will be mutually non-intersecting.

Example:

<code>

| ----—| | | || | — | || | | | ----—| -----— | | +------— | | | | –+ | | | | | | | | -----—

| -------— |

</code

Here, the outer rectangles represent the output ranges. Contained are the input rectangles that comprise these output ranges.

Template parameter: \n UserData
User data to be stored along with the range, to later identify which range went into which connected component. Must be assignable, default- and copy-constructible.

Definition at line 61 of file b2dconnectedranges.hxx.

Member Typedef Documentation

◆ ComponentListType

template<typename UserData >
typedef ::std::list< ComponentType > basegfx::B2DConnectedRanges< UserData >::ComponentListType

Definition at line 66 of file b2dconnectedranges.hxx.

◆ ComponentType

template<typename UserData >
typedef ::std::pair< B2DRange, UserData > basegfx::B2DConnectedRanges< UserData >::ComponentType

Type of the basic entity (rect + user data)

Definition at line 65 of file b2dconnectedranges.hxx.

◆ ConnectedComponentsType

template<typename UserData >
typedef ::std::list< ConnectedComponents > basegfx::B2DConnectedRanges< UserData >::ConnectedComponentsType

Definition at line 75 of file b2dconnectedranges.hxx.

Constructor & Destructor Documentation

◆ B2DConnectedRanges() [1/2]

template<typename UserData >
basegfx::B2DConnectedRanges< UserData >::B2DConnectedRanges ( )
inline

Create the range calculator.

Definition at line 79 of file b2dconnectedranges.hxx.

◆ B2DConnectedRanges() [2/2]

template<typename UserData >
basegfx::B2DConnectedRanges< UserData >::B2DConnectedRanges ( const B2DConnectedRanges< UserData > &  )
privatedelete

Member Function Documentation

◆ addRange()

template<typename UserData >
void basegfx::B2DConnectedRanges< UserData >::addRange ( const B2DRange rRange,
const UserData rUserData 
)
inline

Add an additional range.

This method integrates a new range into the connected ranges lists. The method has a worst-case time complexity of O(n^2), with n denoting the number of already added ranges (typically, for well-behaved input, it is O(n) though).

Definition at line 92 of file b2dconnectedranges.hxx.

References basegfx::Range2D< TYPE, TRAITS >::expand(), basegfx::Range2D< TYPE, TRAITS >::isEmpty(), basegfx::B2DConnectedRanges< UserData >::ConnectedComponents::maComponentList, basegfx::B2DConnectedRanges< UserData >::maDisjunctAggregatesList, basegfx::B2DConnectedRanges< UserData >::ConnectedComponents::maTotalBounds, basegfx::B2DConnectedRanges< UserData >::maTotalBounds, and basegfx::Range2D< TYPE, TRAITS >::overlaps().

◆ forEachAggregate()

template<typename UserData >
template<typename UnaryFunctor >
UnaryFunctor basegfx::B2DConnectedRanges< UserData >::forEachAggregate ( UnaryFunctor  aFunctor) const
inline

Apply a functor to each of the disjunct component aggregates.

Parameters
aFunctorFunctor to apply. Must provide an operator( const ConnectedComponents& ).
Returns
a copy of the functor, as applied to all aggregates.

Definition at line 215 of file b2dconnectedranges.hxx.

References basegfx::B2DConnectedRanges< UserData >::maDisjunctAggregatesList.

◆ operator=()

template<typename UserData >
B2DConnectedRanges & basegfx::B2DConnectedRanges< UserData >::operator= ( const B2DConnectedRanges< UserData > &  )
privatedelete

Member Data Documentation

◆ maDisjunctAggregatesList

template<typename UserData >
ConnectedComponentsType basegfx::B2DConnectedRanges< UserData >::maDisjunctAggregatesList
private

Current list of disjunct sets of connected components.

Each entry corresponds to one of the top-level rectangles in the drawing above.

Definition at line 231 of file b2dconnectedranges.hxx.

Referenced by basegfx::B2DConnectedRanges< UserData >::addRange(), and basegfx::B2DConnectedRanges< UserData >::forEachAggregate().

◆ maTotalBounds

template<typename UserData >
B2DRange basegfx::B2DConnectedRanges< UserData >::maTotalBounds
private

Global bound rect over all added ranges.

Definition at line 235 of file b2dconnectedranges.hxx.

Referenced by basegfx::B2DConnectedRanges< UserData >::addRange().


The documentation for this class was generated from the following file: