Classes | Public Types | Public Member Functions | Friends

gnash::geometry::SnappingRanges2d< T > Class Template Reference

#include <snappingrange.h>

Inheritance diagram for gnash::geometry::SnappingRanges2d< T >:
Inheritance graph
[legend]

List of all members.

Classes

class  AddTo
class  ContainsPoint
class  ContainsRange
struct  ExpandToIfSnap
 Merge two ranges based on snaptest. More...
class  GrowBy
class  IntersectsRange
class  Scale

Public Types

typedef geometry::Range2d< T > RangeType
typedef std::vector< RangeTypeRangeList
typedef RangeList::size_type size_type

Public Member Functions

 SnappingRanges2d ()
template<typename U >
 SnappingRanges2d (const SnappingRanges2d< U > &from)
 Templated copy constructor, for casting between range types.
void setSnapFactor (const float factor)
float getSnapFactor () const
void setSingleMode (const bool mode)
 if mode==true, then the snapping ranges will act like a normal Range2d
bool getSingleMode () const
void setRangeCountLimit (const size_type limit)
size_type getRangeCountLimit () const
void inheritConfig (const SnappingRanges2d< T > &from)
void add (const RangeType &range)
 Add a Range to the set, merging when possible and appropriate.
void add (const SnappingRanges2d< T > &other)
 combines two snapping ranges
void growBy (const T amount)
 Grows all ranges by the specified amount.
void scale (const float factor)
 Scale all ranges by the specified factor.
void setNull ()
 Resets to NULL range.
void setWorld ()
 Resets to one range with world flags.
bool isWorld () const
 Returns true, when the ranges equal world range.
bool isNull () const
 Returns true, when there is no range.
size_type size () const
 Returns the number of ranges in the list.
const RangeTypegetRange (size_type index) const
 Returns the range at the specified index.
RangeType getFullArea () const
bool intersects (const RangeType &r) const
 Returns true if any of the ranges intersect the given range.
bool contains (T x, T y) const
 Returns true if any of the ranges contains the point.
bool contains (const RangeType &r) const
 Returns true if any of the ranges contains the range.
bool contains (const SnappingRanges2d< T > &o) const
 Returns true if all ranges in the given SnappingRanges2d are contained in at least one of the ranges composing this one.
void intersect (const SnappingRanges2d< T > &o)
void intersect (const RangeType &r)
void combineRanges () const
template<class V >
bool visit (V &visitor) const
 Visit the current Ranges set.
template<class V >
void visitAll (V &visitor) const
 Visit the current Ranges set.

Friends

template<typename U >
std::ostream & operator<< (std::ostream &os, const SnappingRanges2d< U > &r)

template<typename T>
class gnash::geometry::SnappingRanges2d< T >


Member Typedef Documentation

template<typename T>
typedef std::vector<RangeType> gnash::geometry::SnappingRanges2d< T >::RangeList
template<typename T>
typedef geometry::Range2d<T> gnash::geometry::SnappingRanges2d< T >::RangeType
template<typename T>
typedef RangeList::size_type gnash::geometry::SnappingRanges2d< T >::size_type

Constructor & Destructor Documentation

template<typename T>
gnash::geometry::SnappingRanges2d< T >::SnappingRanges2d (  )  [inline]
template<typename T>
template<typename U >
gnash::geometry::SnappingRanges2d< T >::SnappingRanges2d ( const SnappingRanges2d< U > &  from  )  [inline]

Templated copy constructor, for casting between range types.


Member Function Documentation

template<typename T>
void gnash::geometry::SnappingRanges2d< T >::add ( const RangeType range  )  [inline]
template<typename T>
void gnash::geometry::SnappingRanges2d< T >::add ( const SnappingRanges2d< T > &  other  )  [inline]

combines two snapping ranges

template<typename T>
void gnash::geometry::SnappingRanges2d< T >::combineRanges (  )  const [inline]

Combines known ranges. Previously merged ranges may have come close to other ranges. Algorithm could be optimized.

template<typename T>
bool gnash::geometry::SnappingRanges2d< T >::contains ( x,
y 
) const [inline]

Returns true if any of the ranges contains the point.

Referenced by gnash::geometry::SnappingRanges2d< boost::int32_t >::contains(), and main().

template<typename T>
bool gnash::geometry::SnappingRanges2d< T >::contains ( const RangeType r  )  const [inline]

Returns true if any of the ranges contains the range.

Note that a NULL range is not contained in any range and a WORLD range is onluy contained in another WORLD range.

template<typename T>
bool gnash::geometry::SnappingRanges2d< T >::contains ( const SnappingRanges2d< T > &  o  )  const [inline]

Returns true if all ranges in the given SnappingRanges2d are contained in at least one of the ranges composing this one.

Note that a NULL range is not contained in any range and a WORLD range is onluy contained in another WORLD range.

TODO: use a visitor !

template<typename T>
RangeType gnash::geometry::SnappingRanges2d< T >::getFullArea (  )  const [inline]

Return a range that surrounds *all* added ranges. This is used mainly for compatibilty issues.

Referenced by gnash::Gui::setInvalidatedRegions().

template<typename T>
const RangeType& gnash::geometry::SnappingRanges2d< T >::getRange ( size_type  index  )  const [inline]
template<typename T>
size_type gnash::geometry::SnappingRanges2d< T >::getRangeCountLimit (  )  const [inline]
template<typename T>
bool gnash::geometry::SnappingRanges2d< T >::getSingleMode (  )  const [inline]
template<typename T>
float gnash::geometry::SnappingRanges2d< T >::getSnapFactor (  )  const [inline]
template<typename T>
void gnash::geometry::SnappingRanges2d< T >::growBy ( const T  amount  )  [inline]

Grows all ranges by the specified amount.

template<typename T>
void gnash::geometry::SnappingRanges2d< T >::inheritConfig ( const SnappingRanges2d< T > &  from  )  [inline]

Copy the snapping settings from another ranges list, without copying the ranges itself

Referenced by gnash::DisplayList::add_invalidated_bounds().

template<typename T>
void gnash::geometry::SnappingRanges2d< T >::intersect ( const SnappingRanges2d< T > &  o  )  [inline]

Intersect this ranges list with the given ranges list, updating the current ranges list. Note this is currently a relatively expensive operation for complex lists.

Referenced by gnash::DisplayList::add_invalidated_bounds().

template<typename T>
void gnash::geometry::SnappingRanges2d< T >::intersect ( const RangeType r  )  [inline]

Intersects this ranges list with the given single range, updating the current ranges list.

template<typename T>
bool gnash::geometry::SnappingRanges2d< T >::intersects ( const RangeType r  )  const [inline]

Returns true if any of the ranges intersect the given range.

Note that a NULL range doesn't intersect anything and a WORLD range intersects everything except a NULL Range.

template<typename T>
bool gnash::geometry::SnappingRanges2d< T >::isNull (  )  const [inline]
template<typename T>
bool gnash::geometry::SnappingRanges2d< T >::isWorld (  )  const [inline]
template<typename T>
void gnash::geometry::SnappingRanges2d< T >::scale ( const float  factor  )  [inline]

Scale all ranges by the specified factor.

Referenced by gnash::MovieTester::getInvalidatedRanges().

template<typename T>
void gnash::geometry::SnappingRanges2d< T >::setNull (  )  [inline]
template<typename T>
void gnash::geometry::SnappingRanges2d< T >::setRangeCountLimit ( const size_type  limit  )  [inline]

Sets the maximum number of ranges allowed (to avoid lots of small ranges)

template<typename T>
void gnash::geometry::SnappingRanges2d< T >::setSingleMode ( const bool  mode  )  [inline]

if mode==true, then the snapping ranges will act like a normal Range2d

template<typename T>
void gnash::geometry::SnappingRanges2d< T >::setSnapFactor ( const float  factor  )  [inline]

Sets the snapping factor (which must be > 1.0). Higher factors make the ranges more attractive for snapping. A good value is usually 1.3.

Referenced by main().

template<typename T>
void gnash::geometry::SnappingRanges2d< T >::setWorld (  )  [inline]

Resets to one range with world flags.

Referenced by main().

template<typename T>
size_type gnash::geometry::SnappingRanges2d< T >::size (  )  const [inline]
template<typename T>
template<class V >
bool gnash::geometry::SnappingRanges2d< T >::visit ( V &  visitor  )  const [inline]

Visit the current Ranges set.

Visitor functor will be invoked for each RangeType in the current set.

The visitor functor will receive a RangeType reference; must return true if it wants next item or true to exit the loop.

Returns:
false if the visitor reached the end.
template<typename T>
template<class V >
void gnash::geometry::SnappingRanges2d< T >::visitAll ( V &  visitor  )  const [inline]

Visit the current Ranges set.

Visitor functor will be invoked inconditionally for each RangeType in the current set.

The visitor functor will receive a RangeType reference.


Friends And Related Function Documentation

template<typename T>
template<typename U >
std::ostream& operator<< ( std::ostream &  os,
const SnappingRanges2d< U > &  r 
) [friend]

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