Edge Placement Heuristic. More...

#include <rplacementedge.h>

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

Public Member Functions

 RPlacementEdge (size_t maxobjs, bool calc, bool use, RRandom &r, RParamStruct *dist, RParamStruct *area, bool firstrandom, bool ori)
 
virtual void Init (RProblem2D *prob, RLayout *layout, RGrid *grid)
 
virtual void SearchValidPositions (RGeoInfo *info)
 
virtual void PostPlace (RGeoInfo *info, const RPoint &pos)
 
- Public Member Functions inherited from RPlacementHeuristic
 RPlacementHeuristic (size_t maxobjs, bool calc, bool use, RRandom &r, RParamStruct *dist, RParamStruct *area, bool firstrandom, bool ori)
 
RGeoInfoNextObject (void)
 
void Run (RProblem2D *prob, RLayout *layout, RGrid *grid)
 
void AddValidPosition (RPoint &pos)
 
virtual void PostRun (void)
 
RRect GetResult (void)
 
double GetDistances (void)
 
bool IsEnd (void)
 
size_t GetNbObjsOk (void)
 
RFreePolygonsGetFreePolygons (void)
 
RLayoutGetLayout (void) const
 
virtual ~RPlacementHeuristic (void)
 

Private Attributes

RPoint Levels [40]
 
size_t NbLevels
 
RPoint Actual
 
RPoint Max
 
RPoint Last
 
size_t CurLevel
 

Additional Inherited Members

- Protected Member Functions inherited from RPlacementHeuristic
virtual RGeoInfoSelectNextObject (void)
 
- Protected Attributes inherited from RPlacementHeuristic
RRandomRandom
 
RGridGrid
 
RLayoutLayout
 
RSize Limits
 
bool WeightedDistances
 
size_t NbObjs
 
size_t NbObjsOk
 
RRect Result
 
double Distances
 
RGeoInfo ** Order
 
RGeoInfoCurInfo
 
RFreePolygons Free
 
bool CalcFree
 
bool UseFree
 
bool AllOri
 
RContainer< ObjectPos, true,
false > 
ValidPos
 
RPromKernel Prom
 
RPromCriterionDist
 
const RParamDistParams
 
RPromCriterionArea
 
const RParamAreaParams
 
bool FirstRandom
 

Detailed Description

Edge Placement Heuristic.

The RPlacementEdge class provides an edge placement heuristic. The RPlacementEdge class provides an edge placement heuristic, it is a modified version of the bottom-left heuristic where the resulting rectangle have a width and a height in proportiion to the limits.
This heuristic hanbles objects in the edge. The first object is place in bottom-left part of the rectangle representing the limits. After that, the heuristic try to place the next object either at the right or on the top of the first one depending of the width and height of the first object. The next objects are then place to try to fill the resulting rectangle while his width and height are proportional to the limits.

Constructor & Destructor Documentation

RPlacementEdge ( size_t  maxobjs,
bool  calc,
bool  use,
RRandom r,
RParamStruct dist,
RParamStruct area,
bool  firstrandom,
bool  ori 
)

Construct the edge heuristic.

Parameters
maxobjsThe maximum objects to placed fore this object.
calcMust free polygons be calculated.
useMust free polygons be used.
rThe random generator to use.
distDistance criteria parameters.
areaArea criteria parameters.
firstrandomMust the first object be placed randomly?
oriMust all orientation be tested.

Member Function Documentation

virtual void Init ( RProblem2D prob,
RLayout layout,
RGrid grid 
)
virtual

Initialize the heuristic.

Parameters
probThe problem.
layoutLayout.
gridGrid.

Reimplemented from RPlacementHeuristic.

virtual void SearchValidPositions ( RGeoInfo info)
virtual

Calculate all the possible positions to place a given object. The method must register these valid positions with the 'AddValidPosition' method.

Parameters
infoGeometric information representing the object placed.

Implements RPlacementHeuristic.

virtual void PostPlace ( RGeoInfo info,
const RPoint pos 
)
virtual

This method is called each time a given object is placed at a given position. It can be used to make some specific computational updates.

This method must update Result, the rectangle bounding all placed objects.

Parameters
infoGeometric information representing the object placed.
posThe position where it is placed.

Implements RPlacementHeuristic.

Member Data Documentation

RPoint Levels[40]
private

Array to hold the different lines actually handled by the heuristic.

size_t NbLevels
private

The number of total lines handled.

RPoint Actual
private

Position where the next object has to be placed.

RPoint Max
private

The dimension of the resulting rectangle.

RPoint Last
private

Indicate where a new line has to be added.

size_t CurLevel
private

Current line handled by the heuristic.