Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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. More...
 
void addLine (FieldDim theDim, double theMC, double theBegin, double theEnd)
 Calls previous. More...
 
int insertLine (FieldDim theDim, GLViewer_LineList *, int thePosition)
 Adds new line and sorted field. More...
 
int insertLine (FieldDim theDim, double theMC, double theBegin, double theEnd, int thePosition)
 Calls previous. More...
 
GLViewer_LineListgetLine (int index, FieldDim)
 Returns line by index and dimension. More...
 
void setBorders (double X1, double X2, double Y1, double Y2)
 Nullifys field and sets same continued segments. More...
 
void addRectangle (double top, double right, double bottom, double left)
 Cut rectangle in grid. More...
 
int * intersectIndexes (FieldDim theDim, int theIndex, const GLViewer_LineList *theLL, int &theSize)
 returns arrey of intersects indexes with More...
 
void print ()
 
void show ()
 
int getDimSize (FieldDim)
 
int segmentNumber ()
 Returns number of segment. More...
 
bool setPoint (FieldPoint, double x, double y)
 Sets start/end search point. More...
 
void optimize ()
 Optimize field. More...
 
void initialize ()
 Some prepare actions. More...
 
EndStatus startAlgorithm ()
 Main method. More...
 
double * solution (int &size)
 Returns solution and size of solution. More...
 

Static Public Member Functions

static FieldDim invertDim (FieldDim)
 Returns other dimension. More...
 

Protected Member Functions

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

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
ES_ERROR 
ES_LOOP 
ES_SOLVED 
Enumerator
FP_Start 
FP_End 
Enumerator
IS_ERROR 
IS_LOOP 
IS_NOT_SOLVED 
IS_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().

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::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.

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

References FD_X, FD_Y, myXSize, and myYSize.

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.

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.

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

References myCurArrayIndex, myGraphArray1, and myGraphArray2.

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().

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.

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

References FD_X, and FD_Y.

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

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

void GLViewer_LineField::print ( )

Prints debug info about line field

References myXLineArray, myXSize, myYLineArray, and myYSize.

int GLViewer_LineField::segmentNumber ( )
Returns
number of segments

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

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().

bool GLViewer_LineField::setPoint ( FieldPoint  thePoint,
double  theX,
double  theY 
)
void GLViewer_LineField::show ( )

Draws field with help of OpenGL

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

GLViewer_LineField::EndStatus GLViewer_LineField::startAlgorithm ( )

Member Data Documentation

int GLViewer_LineField::myCurArrayIndex
private
int GLViewer_LineField::myCurCount
private
SearchPoint GLViewer_LineField::myEndPoint
private
GraphNode* GLViewer_LineField::myGraphArray1
private
GraphNode * GLViewer_LineField::myGraphArray2
private
SearchPoint GLViewer_LineField::myStartPoint
private
GLViewer_LineList** GLViewer_LineField::myXLineArray
private
int GLViewer_LineField::myXSize
private
GLViewer_LineList ** GLViewer_LineField::myYLineArray
private
int GLViewer_LineField::myYSize
private

The documentation for this class was generated from the following files: