#include <iostream.h>
-/****************************************************************************
-** Class: GLViewer_LineList
-** Descr: Tools for distinct line
-** Module: GLViewer
-** Created: UI team, 27.10.05
-*****************************************************************************/
+/*!
+ Constructor
+ \param size - size of internal array
+*/
GLViewer_LineList::GLViewer_LineList( int size )
{
myRealSize = 2*size;
memset( myArray, 0, myRealSize*sizeof(double) );
}
+/*!
+ Destructor
+*/
GLViewer_LineList::~GLViewer_LineList()
{
delete myArray;
}
+/*!
+ Adds new line segment to list
+ \param coord1, coord2 - co-ordinates of points
+*/
bool GLViewer_LineList::addSegment( double coord1, double coord2 )
{
if( coord1 > coord2 )
return true;
}
+/*!
+ Gets info about segment
+ \param theIndex - index of segment
+ \param coord1, coord2 - co-ordinates of points
+*/
bool GLViewer_LineList::readSegment( int theIndex, double& coord1, double& coord2 )
{
if( theIndex > mySegmentNumber || !myArray)
return true;
}
+/*!
+ \return true if line list covers point
+ \param thePoint - point co-ordinate
+*/
int GLViewer_LineList::contains( double thePoint ) const
{
if( !myArray || mySegmentNumber == 0 )
}
+/*!
+ Removes segment
+ \param theIndex - segment index
+*/
bool GLViewer_LineList::removeSegment( int theIndex )
{
if( theIndex > mySegmentNumber || !myArray)
return true;
}
+/*!
+ Removes segment from line list
+ \param coord1, coord2 - co-ordinates of points
+*/
bool GLViewer_LineList::removeSegment( double coord1, double coord2 )
{
if( coord1 > coord2 )
return true;
}
+/*!
+ Clears line list
+*/
void GLViewer_LineList::clear()
{
if( myArray )
memset( myArray, 0, myRealSize*sizeof(double) );
}
+/*!
+ Prints debug info about line list
+*/
void GLViewer_LineList::print()
{
cout << "MainCoord: " << myMainCoord <<" SIZE: " << myRealSize << " ENum: " << mySegmentNumber << " :::";
cout << endl;
}
+/*!
+ Draws line list with help of OpenGL
+ \param theDim - dimension
+*/
void GLViewer_LineList::show( FieldDim theDim )
{
if( !myArray )
}
}
-/****************************************************************************
-** Class: GLViewer_LineField
-** Descr: Tools for solving
-** Module: GLViewer
-** Created: UI team, 27.10.05
-*****************************************************************************/
+
+/*!
+ Constructor
+*/
GLViewer_LineField::GLViewer_LineField()
{
myCurArrayIndex = 0;
myXLineArray = NULL;
myYLineArray = NULL;
}
+
+/*!
+ Constructor
+*/
GLViewer_LineField::GLViewer_LineField( const int theMAXSize, const int theXN, const int theYN )
{
myCurArrayIndex = 0;
}
}
+/*!
+ Destructor
+*/
GLViewer_LineField::~GLViewer_LineField()
{
if( myXLineArray )
delete myGraphArray2;
}
+/*!
+ Adds line
+*/
void GLViewer_LineField::addLine( FieldDim theDim, GLViewer_LineList* )
{
//not implemented
}
+/*!
+ Adds line
+ \param theDim - dimension
+ \param theMC - main co-ordinate
+ \param theBegin - start co-ordinate
+ \param theEnd - end co-ordinate
+*/
void GLViewer_LineField:: addLine( FieldDim theDim, double theMC, double theBegin, double theEnd )
{
GLViewer_LineList* aLL = new GLViewer_LineList( 1 );
addLine( theDim, aLL );
}
-
+/*!
+ Adds line
+ \param theDim - dimension
+ \param theLL - main co-ordinate
+ \param thePosition - index in list
+*/
int GLViewer_LineField::insertLine( FieldDim theDim, GLViewer_LineList* theLL, int thePosition )
{
if( !myXLineArray || !myYLineArray )
return -1;
}
+/*!
+ Adds line
+ \param theDim - dimension
+ \param theMainCoord - main co-ordinate
+ \param theBegin - start co-ordinate
+ \param theEnd - end co-ordinate
+ \param thePosition - index in list
+*/
int GLViewer_LineField::insertLine( FieldDim theDim, double theMainCoord, double theBegin, double theEnd, int thePosition )
{
GLViewer_LineList* aLL = new GLViewer_LineList( 1 );
return insertLine( theDim, aLL, thePosition );
}
-
+/*!
+ \return other dimension
+*/
FieldDim GLViewer_LineField::invertDim( FieldDim theFD )
{
if( theFD == FD_X )
return FD_X;
}
+/*!
+ \return line list
+ \param theIndex - index in list
+ \param tehFD - dimension
+*/
GLViewer_LineList* GLViewer_LineField::getLine( int theIndex, FieldDim theFD )
{
if( !myXLineArray || !myYLineArray )
return NULL;
}
+/*!
+ Sets borders of field
+ \param X1, X2 - minimal and maximal abscisses
+ \param Y1, Y2 - minimal and maximal ordinates
+*/
void GLViewer_LineField::setBorders( double X1, double X2, double Y1, double Y2 )
{
if( !myXLineArray || !myYLineArray )
}
}
+/*!
+ Adds rectangle
+ \param top, right - a corner of rectangle
+ \param bottom, left - other corner of rectangle
+*/
void GLViewer_LineField::addRectangle( double top, double right, double bottom, double left )
{
if( !myXLineArray || !myYLineArray )
}
}
+/*!
+ Prints debug info about line field
+*/
void GLViewer_LineField::print()
{
cout << "My X matrix Number: " << myXSize << endl;
myYLineArray[j]->print();
}
+/*!
+ Draws field with help of OpenGL
+*/
void GLViewer_LineField::show()
{
for( int i = 0; i < myXSize; i++ )
cout << "Show function" << endl;
}
+/*!
+ \return size
+ \param theDim - dimension
+*/
int GLViewer_LineField::getDimSize( FieldDim theDim )
{
if( theDim == FD_X )
return -1;
}
+/*!
+ \return array of intersected indexes
+ \param theDim - dimension
+ \param theIndex - index
+ \param theLL - line with that intersection is checked
+ \param theSize - to return value of array size
+*/
int* GLViewer_LineField::intersectIndexes( FieldDim theDim, int theIndex, const GLViewer_LineList* theLL, int& theSize )
{
theSize = 0;
return anArray;
}
-
+/*!
+ Sets start/end search point
+ \param thePoint - type of point (start: FP_Start; end: FP_End )
+ \param theX, theY - point co-ordinates
+*/
bool GLViewer_LineField::setPoint( FieldPoint thePoint, double theX, double theY )
{
if( !myXLineArray || !myYLineArray )
return false;
}
+/*!
+ \return number of segments
+*/
int GLViewer_LineField::segmentNumber()
{
if( !(myXLineArray || myYLineArray) )
return aNumber;
}
+/*!
+ Removes all multiple segments
+*/
void GLViewer_LineField::optimize()
{
if( !myXLineArray || !myYLineArray )
}
}
+/*!
+ Some prepare actions
+ Needs call setPoint before
+*/
void GLViewer_LineField::initialize()
{
if( !myXLineArray || !myYLineArray )
}
}
+/*!
+ One iteration of algorithm
+*/
void GLViewer_LineField::iteration()
{
int aParam = myCurCount;
delete[] aNodes;
}
+/*!
+ Checks for complete status
+*/
GLViewer_LineField::IterationStatus GLViewer_LineField::checkComplete()
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
return IS_NOT_SOLVED;
}
+/*!
+ Finds LineList by counts and returns indexes
+*/
int* GLViewer_LineField::findByCount( int& theParam )
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
return anArray;
}
+/*!
+ Finds LineList by segment and dimension
+*/
int GLViewer_LineField::findBySegment( FieldDim theDim, int theLineIndex, int theSegment, bool inCurArray )
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 || getDimSize( theDim ) <= theLineIndex )
return -1;
}
+/*!
+ Main method, performs algorithm execution
+*/
GLViewer_LineField::EndStatus GLViewer_LineField::startAlgorithm()
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
return ES_SOLVED;
}
+/*!
+ \return solution and size of solution
+*/
double* GLViewer_LineField::solution( int& theSize )
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
return anArray;
}
+/*!
+ \return current solution array
+*/
GraphNode* GLViewer_LineField::getCurArray()
{
if( !myGraphArray1 || !myGraphArray2 )
return myGraphArray2;
}
+/*!
+ \return other solution array
+*/
GraphNode* GLViewer_LineField::getSecArray()
{
if( !myGraphArray1 || !myGraphArray2 )
return myGraphArray1;
}
+/*!
+ \return maximum segment number
+*/
int GLViewer_LineField::maxSegmentNum()
{
if( !myXLineArray || !myYLineArray )
return max_num;
}
+/*!
+ \return list of LileList by dimension
+ \param theDim - dimension
+*/
GLViewer_LineList** GLViewer_LineField::getLLArray( FieldDim theDim )
{
if( theDim == FD_X )