#include <qgarlib/FreemanCode.H>
Inheritance diagram for qgar::FreemanCode:

A direction is coded using predefined enum type qgar::QGEdirection. As the origin of the coordinates system in images is at top left corner, North and South are upside down for more convenience:
(0,0) +---------------------------------------------> X
|
| QGE_DIRECTION_N
| |
| QGE_DIRECTION_NW \ | / QGE_DIRECTION_NE
| \|/
| QGE_DIRECTION_W -----+----- QGE_DIRECTION_E
| /|\
| QGE_DIRECTION_SW / | \ QGE_DIRECTION_SE
| |
| QGE_DIRECTION_S
Y V
Definition at line 89 of file FreemanCode.H.
Public Member Functions | |
Constructors | |
| FreemanCode () | |
| Default constructor. | |
| FreemanCode (const FreemanCode &aCode) | |
| Copy constructor. | |
| FreemanCode (QGEdirection aDir, unsigned int aLength) | |
| Initialize with a direction and a length. | |
Destructor | |
| virtual | ~FreemanCode () |
| Virtual destructor. | |
Access | |
| QGEdirection | direction () const |
| Get direction. | |
| int | length () const |
| Get length. | |
Transformation | |
| void | setDir (QGEdirection aDir) |
| Set direction. | |
| void | setLength (unsigned int aLength) |
| Set length. | |
| void | setDirLength (QGEdirection aDir, unsigned int aLength) |
| Set both direction and length. | |
Conversions | |
| template<class T> | |
| GenPoint< T > | toPoint (const GenPoint< T > &aPt) const |
| Return the point at the location defined by the current Freeman code, starting from the given point. | |
| template<class T> | |
| GenPoint< T > | toOppositePoint (const GenPoint< T > &aPt) const |
| Return the point at the location defined by the current Freeman code, whose direction is changed into its opposite, starting from the given point. | |
Operators | |
| FreemanCode & | operator= (const FreemanCode &aCode) |
| Assignment operator. | |
Serialization/deserialization | |
| virtual std::istream & | read (std::istream &anInStream) |
| Deserializes the current Freeman code from an input stream. | |
| virtual std::ostream & | write (std::ostream &anOutStream) const |
| Serializes the current Freeman code to an input stream. | |
Protected Attributes | |
Representation of a Freeman code | |
| QGEdirection | _direction |
| The direction code. | |
| int | _length |
| The length. | |
Private Member Functions | |
Auxiliaries | |
| template<class T> | |
| GenPoint< T > | toPointAUX (const GenPoint< T > &aPt, QGEdirection aDir, unsigned int aLength) const throw (QgarErrorInvalidArg) |
| Return the point located at given length in given direction from the given point. | |
|
|
Default constructor. Direction is initialized to qgar::QGE_DIRECTION_N and length to 0. Definition at line 63 of file FreemanCode.C. |
|
|
Copy constructor.
Definition at line 74 of file FreemanCode.C. |
|
||||||||||||
|
Initialize with a direction and a length.
Definition at line 85 of file FreemanCode.C. |
|
|
Virtual destructor.
Definition at line 104 of file FreemanCode.C. |
|
|
Get direction.
Definition at line 307 of file FreemanCode.H. References _direction. Referenced by qgar::FreemanChain::push_front(). |
|
|
Get length.
Definition at line 315 of file FreemanCode.H. References _length. Referenced by qgar::FreemanChain::push_front(). |
|
|
Assignment operator.
Definition at line 120 of file FreemanCode.C. References _direction, and _length. |
|
|
Deserializes the current Freeman code from an input stream.
FreemanCode ( <DIRECTION> ) ( <LENGTH> )
Implements qgar::ISerializable. Definition at line 141 of file FreemanCode.C. References _direction, _length, qgar::qgReadObjData(), and qgar::qgReadObjName(). |
|
|
Set direction.
Definition at line 328 of file FreemanCode.H. References _direction. |
|
||||||||||||
|
Set both direction and length.
Definition at line 344 of file FreemanCode.H. References _direction, and _length. Referenced by qgar::FreemanChain::push_front(). |
|
|
Set length.
Definition at line 336 of file FreemanCode.H. References _length. |
|
||||||||||
|
Return the point at the location defined by the current Freeman code, whose direction is changed into its opposite, starting from the given point.
Definition at line 369 of file FreemanCode.H. References _direction, _length, qgar::qgOpposite(), and toPointAUX(). |
|
||||||||||
|
Return the point at the location defined by the current Freeman code, starting from the given point.
Definition at line 359 of file FreemanCode.H. References _direction, _length, and toPointAUX(). Referenced by qgar::FreemanChain::FreemanChain(), qgar::FreemanChain::push_back(), and qgar::FreemanChain::push_front(). |
|
||||||||||||||||||||
|
Return the point located at given length in given direction from the given point.
Definition at line 384 of file FreemanCode.H. References qgar::QGE_DIRECTION_E, qgar::QGE_DIRECTION_N, qgar::QGE_DIRECTION_NE, qgar::QGE_DIRECTION_NW, qgar::QGE_DIRECTION_S, qgar::QGE_DIRECTION_SE, qgar::QGE_DIRECTION_SW, and qgar::QGE_DIRECTION_W. Referenced by toOppositePoint(), and toPoint(). |
|
|
Serializes the current Freeman code to an input stream.
FreemanCode ( <DIRECTION> ) ( <LENGTH> ) Implements qgar::ISerializable. Definition at line 156 of file FreemanCode.C. References _direction, and _length. |
|
|
The direction code.
Definition at line 257 of file FreemanCode.H. Referenced by direction(), operator=(), read(), setDir(), setDirLength(), toOppositePoint(), toPoint(), and write(). |
|
|
The length.
Definition at line 262 of file FreemanCode.H. Referenced by length(), operator=(), read(), setDirLength(), setLength(), toOppositePoint(), toPoint(), and write(). |