Gnash  0.8.10
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends
gnash::geometry::SnappingRanges2d Class Reference

#include <snappingrange.h>

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 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.

Static Public Member Functions

typedef geometry::Range2d< T > RangeType

Friends

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

Member Typedef Documentation

typedef RangeList::size_type gnash::geometry::SnappingRanges2d::size_type

Constructor & Destructor Documentation

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

Templated copy constructor, for casting between range types.


Member Function Documentation

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

combines two snapping ranges

void gnash::geometry::SnappingRanges2d::combineRanges ( ) const [inline]

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

bool gnash::geometry::SnappingRanges2d::contains ( x,
y 
) const [inline]

Returns true if any of the ranges contains the point.

Referenced by gnash::geometry::SnappingRanges2d< T >::contains().

bool gnash::geometry::SnappingRanges2d::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.

bool gnash::geometry::SnappingRanges2d::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 !

RangeType gnash::geometry::SnappingRanges2d::getFullArea ( ) const [inline]

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

Referenced by gnash::Gui::setInvalidatedRegions(), and gnash::geometry::SnappingRanges2d< T >::combineRanges().

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

Grows all ranges by the specified amount.

void gnash::geometry::SnappingRanges2d::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().

void gnash::geometry::SnappingRanges2d::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().

void gnash::geometry::SnappingRanges2d::intersect ( const RangeType r) [inline]

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

bool gnash::geometry::SnappingRanges2d::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.

bool gnash::geometry::SnappingRanges2d::isNull ( ) const [inline]
bool gnash::geometry::SnappingRanges2d::isWorld ( ) const [inline]
void gnash::geometry::SnappingRanges2d::scale ( const float  factor) [inline]

Scale all ranges by the specified factor.

void gnash::geometry::SnappingRanges2d::setNull ( ) [inline]
void gnash::geometry::SnappingRanges2d::setRangeCountLimit ( const size_type  limit) [inline]

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

void gnash::geometry::SnappingRanges2d::setSingleMode ( const bool  mode) [inline]

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

void gnash::geometry::SnappingRanges2d::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.

void gnash::geometry::SnappingRanges2d::setWorld ( ) [inline]
size_type gnash::geometry::SnappingRanges2d::size ( ) const [inline]
template<class V >
bool gnash::geometry::SnappingRanges2d::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.

Referenced by gnash::geometry::SnappingRanges2d< T >::add().

template<class V >
void gnash::geometry::SnappingRanges2d::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 U >
std::ostream& operator<< ( std::ostream &  os,
const SnappingRanges2d< U > &  r 
) [friend]

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