Version: 6.3.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes

GLViewer_LineField Class Reference

#include <GLViewer_Tools.h>

Public Types

enum  FieldPoint { FP_Start = 0, FP_End = 1 }
 

Searched point.

More...
enum  IterationStatus { IS_ERROR = 0, IS_LOOP, IS_NOT_SOLVED, IS_SOLVED }
 

Status of interation.

More...
enum  EndStatus { ES_ERROR = 0, ES_LOOP, ES_SOLVED }
 

Final status of solving.

More...

Public Member Functions

 GLViewer_LineField ()
 GLViewer_LineField (const int theMAXSize, const int xn, const int yn)
virtual ~GLViewer_LineField ()
void addLine (FieldDim, GLViewer_LineList *)
 Adds new line.
void addLine (FieldDim theDim, double theMC, double theBegin, double theEnd)
 Calls previous.
int insertLine (FieldDim theDim, GLViewer_LineList *, int thePosition)
 Adds new line and sorted field.
int insertLine (FieldDim theDim, double theMC, double theBegin, double theEnd, int thePosition)
 Calls previous.
GLViewer_LineListgetLine (int index, FieldDim)
 Returns line by index and dimension.
void setBorders (double X1, double X2, double Y1, double Y2)
 Nullifys field and sets same continued segments.
void addRectangle (double top, double right, double bottom, double left)
 Cut rectangle in grid.
int * intersectIndexes (FieldDim theDim, int theIndex, const GLViewer_LineList *theLL, int &theSize)
 returns arrey of intersects indexes with
void print ()
void show ()
int getDimSize (FieldDim)
int segmentNumber ()
 Returns number of segment.
bool setPoint (FieldPoint, double x, double y)
 Sets start/end search point.
void optimize ()
 Optimize field.
void initialize ()
 Some prepare actions.
EndStatus startAlgorithm ()
 Main method.
double * solution (int &size)
 Returns solution and size of solution.

Static Public Member Functions

static FieldDim invertDim (FieldDim)
 Returns other dimension.

Protected Member Functions

void iteration ()
 One iteration of algorithm.
IterationStatus checkComplete ()
 Checks for complete status.
int * findByCount (int &theParam)
 Finds LineList by counts and returns indexes.
int findBySegment (FieldDim, int coord1, int coord2, bool inCurArray=true)
 Finds LineList by segment and dimension.
GraphNodegetCurArray ()
 Returns current solution array.
GraphNodegetSecArray ()
 Returns.
int maxSegmentNum ()
 Returns maximum segment number.
GLViewer_LineList ** getLLArray (FieldDim)
 Returns list of LileList by dimension.

Private Attributes

GLViewer_LineList ** myXLineArray
GLViewer_LineList ** myYLineArray
int myXSize
int myYSize
GraphNodemyGraphArray1
GraphNodemyGraphArray2
int myCurArrayIndex
SearchPoint myStartPoint
SearchPoint myEndPoint
int myCurCount

Detailed Description

Tools for solving algorithm of finding shortest path on rare grid with minimum of line turns number


Member Enumeration Documentation

Enumerator:
FP_Start 
FP_End 
Enumerator:
IS_ERROR 
IS_LOOP 
IS_NOT_SOLVED 
IS_SOLVED 
Enumerator:
ES_ERROR 
ES_LOOP 
ES_SOLVED 

Constructor & Destructor Documentation

GLViewer_LineField::GLViewer_LineField ( )
GLViewer_LineField::GLViewer_LineField ( const int  theMAXSize,
const int  theXN,
const int  theYN 
)
GLViewer_LineField::~GLViewer_LineField ( ) [virtual]

Member Function Documentation

void GLViewer_LineField::addLine ( FieldDim  theDim,
GLViewer_LineList  
)

best way, if line is already sorted

Adds line

void GLViewer_LineField::addLine ( FieldDim  theDim,
double  theMC,
double  theBegin,
double  theEnd 
)

Adds line

Parameters:
theDim- dimension
theMC- main co-ordinate
theBegin- start co-ordinate
theEnd- end co-ordinate

References addLine(), GLViewer_LineList.addSegment(), and GLViewer_LineList.setMainCoord().

int GLViewer_LineField::insertLine ( FieldDim  theDim,
GLViewer_LineList theLL,
int  thePosition 
)

Returns position

Adds line

Parameters:
theDim- dimension
theLL- main co-ordinate
thePosition- index in list

References getDimSize(), getLLArray(), GLViewer_LineList.mainCoord(), myXLineArray, and myYLineArray.

int GLViewer_LineField::insertLine ( FieldDim  theDim,
double  theMainCoord,
double  theBegin,
double  theEnd,
int  thePosition 
)

Adds line

Parameters:
theDim- dimension
theMainCoord- main co-ordinate
theBegin- start co-ordinate
theEnd- end co-ordinate
thePosition- index in list

References GLViewer_LineList.addSegment(), insertLine(), and GLViewer_LineList.setMainCoord().

FieldDim GLViewer_LineField::invertDim ( FieldDim  theFD) [static]
Returns:
other dimension

References FD_X, and FD_Y.

GLViewer_LineList * GLViewer_LineField::getLine ( int  theIndex,
FieldDim  theFD 
)
Returns:
line list
Parameters:
theIndex- index in list
tehFD- dimension

References FD_X, FD_Y, myXLineArray, myXSize, myYLineArray, and myYSize.

void GLViewer_LineField::setBorders ( double  X1,
double  X2,
double  Y1,
double  Y2 
)

Sets borders of field

Parameters:
X1,X2- minimal and maximal abscisses
Y1,Y2- minimal and maximal ordinates

References GLViewer_LineList.addSegment(), GLViewer_LineList.clear(), myXLineArray, myXSize, myYLineArray, myYSize, and GLViewer_LineList.setMainCoord().

void GLViewer_LineField::addRectangle ( double  top,
double  right,
double  bottom,
double  left 
)

Adds rectangle

Parameters:
top,right- a corner of rectangle
bottom,left- other corner of rectangle

References GLViewer_LineList.mainCoord(), myXLineArray, myXSize, myYLineArray, myYSize, and GLViewer_LineList.removeSegment().

int * GLViewer_LineField::intersectIndexes ( FieldDim  theDim,
int  theIndex,
const GLViewer_LineList theLL,
int &  theSize 
)
Parameters:
theLL
Returns:
array of intersected indexes
Parameters:
theDim- dimension
theIndex- index
theLL- line with that intersection is checked
theSize- to return value of array size

References GLViewer_LineList.contains(), getDimSize(), getLine(), GLViewer_LineList.mainCoord(), myXLineArray, and myYLineArray.

void GLViewer_LineField::print ( )

Prints debug info about line field

References myXLineArray, myXSize, myYLineArray, and myYSize.

void GLViewer_LineField::show ( )

Draws field with help of OpenGL

References FD_X, FD_Y, getLine(), test_big_table.k, myXSize, myYSize, GLViewer_LineList.show(), and solution().

int GLViewer_LineField::getDimSize ( FieldDim  theDim)
Returns:
size
Parameters:
theDim- dimension

References FD_X, FD_Y, myXSize, and myYSize.

int GLViewer_LineField::segmentNumber ( )
Returns:
number of segments

References GLViewer_LineList.count(), getDimSize(), getLine(), myXLineArray, and myYLineArray.

bool GLViewer_LineField::setPoint ( FieldPoint  thePoint,
double  theX,
double  theY 
)
void GLViewer_LineField::optimize ( )
void GLViewer_LineField::initialize ( )
GLViewer_LineField::EndStatus GLViewer_LineField::startAlgorithm ( )
double * GLViewer_LineField::solution ( int &  theSize)
void GLViewer_LineField::iteration ( ) [protected]
GLViewer_LineField::IterationStatus GLViewer_LineField::checkComplete ( ) [protected]
int * GLViewer_LineField::findByCount ( int &  theParam) [protected]

Finds LineList by counts and returns indexes

References getCurArray(), GraphNode.myCount, myGraphArray1, myGraphArray2, myXLineArray, myYLineArray, and segmentNumber().

int GLViewer_LineField::findBySegment ( FieldDim  theDim,
int  theLineIndex,
int  theSegment,
bool  inCurArray = true 
) [protected]
GraphNode * GLViewer_LineField::getCurArray ( ) [protected]
Returns:
current solution array

References myCurArrayIndex, myGraphArray1, and myGraphArray2.

GraphNode * GLViewer_LineField::getSecArray ( ) [protected]
Returns:
other solution array

References myCurArrayIndex, myGraphArray1, and myGraphArray2.

int GLViewer_LineField::maxSegmentNum ( ) [protected]
Returns:
maximum segment number

References GLViewer_LineList.count(), getDimSize(), getLine(), myXLineArray, and myYLineArray.

GLViewer_LineList ** GLViewer_LineField::getLLArray ( FieldDim  theDim) [protected]
Returns:
list of LileList by dimension
Parameters:
theDim- dimension

References FD_X, FD_Y, myXLineArray, and myYLineArray.


Field Documentation

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS