ConRouter Class Reference

#include <conrouter.h>

Collaboration diagram for ConRouter:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ConRouter (ICNDocument *cv)
 ~ConRouter ()
void mapRoute (int sx, int sy, int ex, int ey)
void translateRoute (int dx, int dy)
void setPoints (const QPointList &pointList, bool reverse=false)
void setRoutePoints (const QPointList &pointList)
bool needsRouting (int sx, int sy, int ex, int ey) const
QPointList pointList (bool reverse) const
QPointList * cellPointList ()
QPointListList splitPoints (const QPoint &pos) const
QPointListList dividePoints (uint n) const

Protected Member Functions

bool checkLineRoute (int scx, int scy, int ecx, int ecy, int maxConScore, int maxCIScore)
void checkACell (int x, int y, Cell *prev, int prevX, int prevY, int nextScore)
void checkCell (int x, int y)
void removeDuplicatePoints ()

Protected Attributes

int xcells
int ycells
int m_lcx
int m_lcy
CellscellsPtr
TempLabelMap tempLabels
ICNDocumentp_icnDocument
QPointList m_cellPointList

Detailed Description

Abstraction for the routing of a connector.

NB: As a general rule of thumb, the point references stored as members of this class are in Cell-space (i.e. 8^2 x smaller than Canvas-space), and the interfacing functions take or give point references in Canvas-space (unless otherwise indicated).

Author:
David Saxton

Definition at line 42 of file conrouter.h.


Member Function Documentation

void ConRouter::mapRoute ( int  sx,
int  sy,
int  ex,
int  ey 
)

What this class is all about - finding a route, from (sx,sy) to (ex,ey).

Definition at line 336 of file conrouter.cpp.

References Cell::bestScore, ItemDocument::canvas(), ICNDocument::cells(), cellsPtr, checkCell(), checkLineRoute(), ICNDocument::isValidCellReference(), m_cellPointList, m_lcx, m_lcy, p_icnDocument, Cell::permanent, Cell::prevX, Cell::prevY, removeDuplicatePoints(), Cells::reset(), tempLabels, xcells, and ycells.

Referenced by ICNDocument::createConnector(), Connector::rerouteConnector(), and NodeGroup::updateRoutes().

void ConRouter::translateRoute ( int  dx,
int  dy 
)

Translates the precalculated routepoints by the given amount

Definition at line 314 of file conrouter.cpp.

References m_cellPointList, m_lcx, m_lcy, and removeDuplicatePoints().

Referenced by Connector::translateRoute().

void ConRouter::setPoints ( const QPointList &  pointList,
bool  reverse = false 
)

Sets the route to the given canvas points

Parameters:
reverse if true, the points in pointList will be reversed

Definition at line 271 of file conrouter.cpp.

References cellPointList(), m_cellPointList, and removeDuplicatePoints().

Referenced by Connector::setRoutePoints().

void ConRouter::setRoutePoints ( const QPointList &  pointList  ) 

Sets the route to the given route points

Definition at line 265 of file conrouter.cpp.

References m_cellPointList, and removeDuplicatePoints().

Referenced by Connector::restoreFromConnectorData().

bool ConRouter::needsRouting ( int  sx,
int  sy,
int  ex,
int  ey 
) const

Returns:
true if the start or end points differ from that of the current route

Definition at line 243 of file conrouter.cpp.

References m_cellPointList.

QPointList ConRouter::pointList ( bool  reverse  )  const

Returns the list of canvas points

Definition at line 64 of file conrouter.cpp.

References m_cellPointList.

Referenced by Connector::connectorPoints(), and ICNDocument::createConnector().

QPointList* ConRouter::cellPointList (  )  [inline]

Returns a pointer to the internall cellPointList

Definition at line 76 of file conrouter.h.

References m_cellPointList.

Referenced by Connector::connectorData(), setPoints(), Connector::updateConnectorPoints(), and Connector::updateDrawList().

QPointListList ConRouter::splitPoints ( const QPoint &  pos  )  const

This will return two lists of Canvas points from the splitting of the route at the Canvas point "pos". The internall stored points are not affected.

Definition at line 94 of file conrouter.cpp.

References m_cellPointList.

Referenced by Connector::splitConnectorPoints().

QPointListList ConRouter::dividePoints ( uint  n  )  const

This will return a list of Canvas pointLists from the route, divided into n parts (at n-1 equally spaced places).

Definition at line 159 of file conrouter.cpp.

References m_cellPointList, m_lcx, and m_lcy.

Referenced by NodeGroup::updateRoutes().

bool ConRouter::checkLineRoute ( int  scx,
int  scy,
int  ecx,
int  ecy,
int  maxConScore,
int  maxCIScore 
) [protected]

Check a line of the ICNDocument cells for a valid route

Definition at line 446 of file conrouter.cpp.

References ICNDocument::cells(), m_cellPointList, p_icnDocument, and removeDuplicatePoints().

Referenced by mapRoute().

void ConRouter::removeDuplicatePoints (  )  [protected]

Remove duplicated points from the route

Definition at line 499 of file conrouter.cpp.

References m_cellPointList.

Referenced by checkLineRoute(), mapRoute(), setPoints(), setRoutePoints(), and translateRoute().


The documentation for this class was generated from the following files:
Generated on Tue May 8 17:05:37 2007 for KTechLab by  doxygen 1.5.1