Geometric Information. More...

#include <rgeoinfo.h>

Inheritance diagram for RGeoInfo:
[legend]
Collaboration diagram for RGeoInfo:
[legend]

Public Member Functions

 RGeoInfo (RObj2D *obj)
 
 RGeoInfo (const RGeoInfo &info)
 
int Compare (const RGeoInfo &info) const
 
int Compare (const size_t id) const
 
virtual void ClearInfo (void)
 
tCoord GetArea (void) const
 
void Boundary (RRect &rect)
 
RObj2DContainerGetContainer (void) const
 
void SetContainer (RObj2DContainer *container)
 
bool IsValid (void) const
 
RObj2DGetObj (void) const
 
void SetConfig (tOrientation ori)
 
RObj2DConfigGetConfig (void) const
 
virtual void Assign (const RPoint &pos, RGrid *grid, size_t order)
 
bool IsValid (const RPoint &pos, const RSize &limits) const
 
bool IsMovingAway (const RPoint &pos, const RPoint &ref, bool left, bool bottom) const
 
bool Test (RPoint &pos, RGrid *grid)
 
void PushBottomLeft (RPoint &pos, const RSize &limits, RGrid *grid)
 
void PushCenter (RPoint &pos, const RSize &limits, RGrid *grid)
 
bool Overlap (RGeoInfo *info) const
 
size_t GetNbPoints (void) const
 
RPoint GetPos (void) const
 
RGeoInfooperator+= (const RPoint &pt)
 
RGeoInfooperator-= (const RPoint &pt)
 
RGeoInfooperator= (const RGeoInfo &info)
 
bool IsIn (RPoint pos) const
 
void Add (RPolygons &polys)
 
RPolygon GetPlacedPolygon (void) const
 
size_t GetOrder (void) const
 
virtual ~RGeoInfo (void)
 

Protected Member Functions

 RGeoInfo (void)
 

Protected Attributes

RObj2DObj
 
RObj2DConfigConfig
 
RPoint Pos
 
RObj2DContainerContainer
 
size_t Order
 

Detailed Description

Geometric Information.

The RGeoInfo class provides a geometric information concerning the placement of an object.

Constructor & Destructor Documentation

RGeoInfo ( void  )
protected

Construct a geometric information.

RGeoInfo ( RObj2D obj)

Construct a geometric information.

Parameters
objObject represented.
RGeoInfo ( const RGeoInfo info)

Construct a geometric information from another one.

virtual ~RGeoInfo ( void  )
virtual

Destruct the geometric information.

Member Function Documentation

int Compare ( const RGeoInfo info) const

Compare function use for the RContainer class. Compare only the addresses of the pointers.

Parameters
infoPointer used for the comparison.
int Compare ( const size_t  id) const

Compare function use for the RContainer class. Compare the identifier with the one of the corresponding object.

Parameters
idIdentifier used for the comparison.
virtual void ClearInfo ( void  )
virtual

Clears the geometric information.

Reimplemented in RObj2DContainer.

tCoord GetArea ( void  ) const

Area used by the polygon.

void Boundary ( RRect rect)

Calculate the boundary rectangle of the polygon according to the position.

Parameters
rectRectangle that will hold the result.
RObj2DContainer* GetContainer ( void  ) const
Returns
a pointer to the container or null if the object is not aggregated.
void SetContainer ( RObj2DContainer container)

Set the container that hold the object.

Parameters
containerContainer.
bool IsValid ( void  ) const

Return true if the geometric information is a valid one.

RObj2D* GetObj ( void  ) const

Return the object.

void SetConfig ( tOrientation  ori)

Set the configuration used.

Parameters
oriOrientation.
RObj2DConfig* GetConfig ( void  ) const

Return the configuration used.

virtual void Assign ( const RPoint pos,
RGrid grid,
size_t  order 
)
virtual

Assign the geometric information to the position and update the grids with the identifier of the object.

Parameters
posPosition to place.
gridGrid.
orderOrder of the corresponding geometric information.

Reimplemented in RObj2DContainer.

bool IsValid ( const RPoint pos,
const RSize limits 
) const

Return true if the geometric information is a valid one in given limits.

Parameters
posPosition to verify.
limitsLimits.
bool IsMovingAway ( const RPoint pos,
const RPoint ref,
bool  left,
bool  bottom 
) const

Verify that a given position is not moving away from a reference one.

Parameters
posPosition to verify.
refReference position.
leftIs the position moving to the left (true) or to the right (false)?
bottomIs the position moving to the bottom (true) or to the up (false)?
Returns
true if the position moves away.
bool Test ( RPoint pos,
RGrid grid 
)

Test if the shape of the object can be placed at a specific position based on a given grid.

Parameters
posPosition to test.
gridGrid.
void PushBottomLeft ( RPoint pos,
const RSize limits,
RGrid grid 
)

Calculate the position where the object represented can be placed, if it is pushed to the bottom and to the left.

Parameters
posInitial position, and then the final one.
limitsLimits for the placement.
gridGrid.
void PushCenter ( RPoint pos,
const RSize limits,
RGrid grid 
)

Calculate the position where the object represented can be placed, if it is pushed in direction of the center.

Parameters
posInitial position, and then the final one.
limitsLimits for the placement.
gridGrid.
bool Overlap ( RGeoInfo info) const

This function returns true if the two objects represented by this geometric information overlap (Rects have to be calculated.

size_t GetNbPoints ( void  ) const

Return the number of points contained in the polygon.

RPoint GetPos ( void  ) const
Returns
the position of the geometric information.
RGeoInfo& operator+= ( const RPoint pt)

Make a translation of the point.

Parameters
ptPoint representing the vector used.
RGeoInfo& operator-= ( const RPoint pt)

Make a translation of the point.

Parameters
ptThe point representing the vector used.
RGeoInfo& operator= ( const RGeoInfo info)

Assignment Operator.

bool IsIn ( RPoint  pos) const

Return true if a point is in the polygon.

void Add ( RPolygons polys)

Add the polygon representing the object in the container of polygons.

RPolygon GetPlacedPolygon ( void  ) const

Return the polygon representing the object placed.

size_t GetOrder ( void  ) const

Get the order.

Member Data Documentation

RObj2D* Obj
protected

Pointer to the the object.

RObj2DConfig* Config
protected

The particular configuration of the object used.

RPoint Pos
protected

Position of the object.

RObj2DContainer* Container
protected

Indicate the container of the object (if any). This is used to aggregate a set of objects.

size_t Order
protected

Order of the geometric information.