]> SALOME platform Git repositories - modules/gui.git/blobdiff - src/GLViewer/GLViewer_Tools.cxx
Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/gui.git] / src / GLViewer / GLViewer_Tools.cxx
index a54ad837f7bfc42b90cf95eb09ac659c72a6d82e..9d8739175b860aa531e08fa0875926d297b8016d 100644 (file)
 
 #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;
@@ -52,11 +50,18 @@ GLViewer_LineList::GLViewer_LineList( int 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 )
@@ -158,6 +163,11 @@ bool GLViewer_LineList::addSegment( double coord1, double 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)
@@ -169,6 +179,10 @@ bool GLViewer_LineList::readSegment( int theIndex, double& coord1, double& coord
   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 )
@@ -182,6 +196,10 @@ int GLViewer_LineList::contains( double thePoint ) const
 
 }
 
+/*!
+  Removes segment
+  \param theIndex - segment index
+*/
 bool GLViewer_LineList::removeSegment( int theIndex )
 {
   if( theIndex > mySegmentNumber || !myArray)
@@ -198,6 +216,10 @@ bool GLViewer_LineList::removeSegment( int theIndex )
   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 )
@@ -350,12 +372,18 @@ bool GLViewer_LineList::removeSegment( double coord1, double 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 << " :::";
@@ -365,6 +393,10 @@ void GLViewer_LineList::print()
   cout << endl;
 }
 
+/*!
+  Draws line list with help of OpenGL 
+  \param theDim - dimension
+*/
 void GLViewer_LineList::show( FieldDim theDim )
 {
   if( !myArray )
@@ -393,12 +425,10 @@ void GLViewer_LineList::show( FieldDim theDim )
   }
 }
 
-/****************************************************************************
-**  Class:   GLViewer_LineField 
-**  Descr:   Tools for solving 
-**  Module:  GLViewer
-**  Created: UI team, 27.10.05
-*****************************************************************************/
+
+/*!
+  Constructor
+*/
 GLViewer_LineField::GLViewer_LineField()
 {
   myCurArrayIndex = 0;
@@ -412,6 +442,10 @@ GLViewer_LineField::GLViewer_LineField()
   myXLineArray = NULL;
   myYLineArray = NULL;
 }
+
+/*!
+  Constructor
+*/
 GLViewer_LineField::GLViewer_LineField( const int theMAXSize, const int theXN, const int theYN )
 {
   myCurArrayIndex = 0;
@@ -443,6 +477,9 @@ GLViewer_LineField::GLViewer_LineField( const int theMAXSize, const int theXN, c
   }
 }
 
+/*!
+  Destructor
+*/
 GLViewer_LineField::~GLViewer_LineField()
 {
   if( myXLineArray )
@@ -468,11 +505,21 @@ GLViewer_LineField::~GLViewer_LineField()
     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 );
@@ -481,7 +528,12 @@ void GLViewer_LineField:: addLine( FieldDim theDim, double theMC, double theBegi
   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 )
@@ -533,6 +585,14 @@ int GLViewer_LineField::insertLine( FieldDim theDim, GLViewer_LineList* theLL, i
   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 );
@@ -541,7 +601,9 @@ int GLViewer_LineField::insertLine( FieldDim theDim, double theMainCoord, double
   return insertLine( theDim, aLL, thePosition );
 }
 
-
+/*!
+  \return other dimension
+*/
 FieldDim GLViewer_LineField::invertDim( FieldDim theFD )
 {
   if( theFD == FD_X )
@@ -550,6 +612,11 @@ FieldDim GLViewer_LineField::invertDim( FieldDim theFD )
     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 )
@@ -573,6 +640,11 @@ GLViewer_LineList* GLViewer_LineField::getLine( int theIndex, FieldDim theFD )
   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 )
@@ -593,6 +665,11 @@ void GLViewer_LineField::setBorders( double X1, double X2, double Y1, double Y2
   }
 } 
 
+/*!
+  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 )
@@ -612,6 +689,9 @@ void GLViewer_LineField::addRectangle( double top, double right, double bottom,
   }
 }
 
+/*!
+  Prints debug info about line field
+*/
 void GLViewer_LineField::print()
 {
   cout << "My X matrix Number: " << myXSize << endl;
@@ -623,6 +703,9 @@ void GLViewer_LineField::print()
     myYLineArray[j]->print();
 }
 
+/*!
+  Draws field with help of OpenGL 
+*/
 void GLViewer_LineField::show()
 {
   for( int i = 0; i < myXSize; i++ )
@@ -644,6 +727,10 @@ void GLViewer_LineField::show()
   cout << "Show function" << endl;
 }
 
+/*!
+  \return size
+  \param theDim - dimension
+*/
 int GLViewer_LineField::getDimSize( FieldDim theDim )
 {
   if( theDim == FD_X )
@@ -654,6 +741,13 @@ int GLViewer_LineField::getDimSize( FieldDim theDim )
   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;
@@ -678,7 +772,11 @@ int* GLViewer_LineField::intersectIndexes( FieldDim theDim, int theIndex, const
   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 )
@@ -730,6 +828,9 @@ bool GLViewer_LineField::setPoint( FieldPoint thePoint, double theX, double theY
     return false;
 }
 
+/*!
+  \return number of segments
+*/
 int GLViewer_LineField::segmentNumber()
 {
   if( !(myXLineArray || myYLineArray) )
@@ -743,6 +844,9 @@ int GLViewer_LineField::segmentNumber()
   return aNumber;
 }
 
+/*!
+  Removes all multiple segments
+*/
 void GLViewer_LineField::optimize()
 {
   if( !myXLineArray || !myYLineArray )
@@ -790,6 +894,10 @@ void GLViewer_LineField::optimize()
   }
 }
 
+/*!
+  Some prepare actions
+  Needs call setPoint before
+*/
 void GLViewer_LineField::initialize()
 {
   if( !myXLineArray || !myYLineArray )
@@ -843,6 +951,9 @@ void GLViewer_LineField::initialize()
   }
 }
 
+/*!
+  One iteration of algorithm
+*/
 void GLViewer_LineField::iteration()
 {
   int aParam = myCurCount;
@@ -874,6 +985,9 @@ void GLViewer_LineField::iteration()
   delete[] aNodes;
 }
 
+/*!
+  Checks for complete status
+*/
 GLViewer_LineField::IterationStatus GLViewer_LineField::checkComplete()
 {
   if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
@@ -924,6 +1038,9 @@ GLViewer_LineField::IterationStatus GLViewer_LineField::checkComplete()
   return IS_NOT_SOLVED;
 }
 
+/*!
+  Finds LineList by counts and returns indexes
+*/
 int* GLViewer_LineField::findByCount( int& theParam )
 {
   if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
@@ -948,6 +1065,9 @@ int* GLViewer_LineField::findByCount( int& theParam )
   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 )
@@ -969,6 +1089,9 @@ int GLViewer_LineField::findBySegment( FieldDim theDim, int theLineIndex, int th
   return -1;
 }
 
+/*!
+  Main method, performs algorithm execution
+*/
 GLViewer_LineField::EndStatus GLViewer_LineField::startAlgorithm()
 {
   if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
@@ -990,6 +1113,9 @@ GLViewer_LineField::EndStatus GLViewer_LineField::startAlgorithm()
   return ES_SOLVED;
 }
 
+/*!
+  \return solution and size of solution
+*/
 double* GLViewer_LineField::solution( int& theSize )
 {
   if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
@@ -1033,6 +1159,9 @@ double* GLViewer_LineField::solution( int& theSize )
   return anArray;
 }
 
+/*!
+  \return current solution array
+*/
 GraphNode* GLViewer_LineField::getCurArray()
 {
   if( !myGraphArray1 || !myGraphArray2 )
@@ -1044,6 +1173,9 @@ GraphNode* GLViewer_LineField::getCurArray()
     return myGraphArray2;
 }
 
+/*!
+  \return other solution array
+*/
 GraphNode* GLViewer_LineField::getSecArray()
 {
   if( !myGraphArray1 || !myGraphArray2 )
@@ -1055,6 +1187,9 @@ GraphNode* GLViewer_LineField::getSecArray()
     return myGraphArray1;
 }
 
+/*!
+  \return maximum segment number
+*/
 int GLViewer_LineField::maxSegmentNum()
 {
   if( !myXLineArray || !myYLineArray )
@@ -1074,6 +1209,10 @@ int GLViewer_LineField::maxSegmentNum()
   return max_num;
 }
 
+/*!
+  \return list of LileList by dimension
+  \param theDim - dimension
+*/
 GLViewer_LineList** GLViewer_LineField::getLLArray( FieldDim theDim )
 {
   if( theDim == FD_X )