1 // Copyright (C) 2005 OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
19 // Author : OPEN CASCADE
22 // File: GLViewer_Tools.cxx
23 // Created: April, 2005
25 //#include "GLViewerAfx.h"
26 #include "GLViewer_Tools.h"
32 /****************************************************************************
33 ** Class: GLViewer_LineList
34 ** Descr: Tools for distinct line
36 ** Created: UI team, 27.10.05
37 *****************************************************************************/
38 GLViewer_LineList::GLViewer_LineList( int size )
44 myArray = new double[myRealSize];
48 cout << "Can't allocate memory: " << size << endl;
52 memset( myArray, 0, myRealSize*sizeof(double) );
55 GLViewer_LineList::~GLViewer_LineList()
60 bool GLViewer_LineList::addSegment( double coord1, double coord2 )
69 if( 2*mySegmentNumber == myRealSize || !myArray )
74 while( index < mySegmentNumber)
76 readSegment( index, c1, c2 );
77 if( coord1 < c1 && coord2 < c1 )
79 for( int i = mySegmentNumber; i > index - 1; i--)
81 myArray[2*i] = myArray[2*i-2]; //2*(i-1)
82 myArray[2*i+1] = myArray[2*i-1];//2*(i-1)+1
86 // mySegmentNumber; what is means ?
89 else if( coord1 < c1 && coord2 < c2 )
91 myArray[index*2] = coord1;
94 else if( c1 < coord1 && coord2 < c2 )
98 else if( coord1 < c2 && c2 < coord2 )
101 myArray[2*index] = coord1;
103 if( index != mySegmentNumber - 1 )
105 for( int i = index+1; i < mySegmentNumber; i++ )
107 if( coord2 < myArray[2*i] )
109 myArray[2*index+1] = coord2;
112 for( int j = 0; i+j < mySegmentNumber;j++ )
114 myArray[2*(index+1+j)] = myArray[2*(i+j)];
115 myArray[2*(index+1+j)+1] = myArray[2*(i+j)+1];
117 for( int k = 0; k < mySegmentNumber - i; k++ )
119 myArray[2*(mySegmentNumber - 1- k)] = 0.0;
120 myArray[2*(mySegmentNumber - 1- k)+1] = 0.0;
122 mySegmentNumber -= i - index-1;
126 else if( coord2 < myArray[2*i+1] )
128 myArray[2*index+1] = myArray[2*i+1];
130 for( int j = index+1; j < mySegmentNumber-1;j++ )
132 myArray[2*j] = myArray[2*(i+j-index)];
133 myArray[2*j+1] = myArray[2*(i+j-index)+1];
135 for( int k = 0; k < mySegmentNumber - i-1; k++ )
137 myArray[2*(mySegmentNumber - 1- k)] = 0.0;
138 myArray[2*(mySegmentNumber - 1- k)+1] = 0.0;
140 mySegmentNumber -= i - index;
147 myArray[2*index+1] = coord2;
154 myArray[mySegmentNumber*2] = coord1;
155 myArray[mySegmentNumber*2+1] = coord2;
161 bool GLViewer_LineList::readSegment( int theIndex, double& coord1, double& coord2 )
163 if( theIndex > mySegmentNumber || !myArray)
166 coord1 = myArray[theIndex*2];
167 coord2 = myArray[theIndex*2+1];
172 int GLViewer_LineList::contains( double thePoint ) const
174 if( !myArray || mySegmentNumber == 0 )
177 for( int i = 0; i < mySegmentNumber; i++ )
178 if( myArray[2*i] <= thePoint && thePoint <= myArray[2*i+1] )
185 bool GLViewer_LineList::removeSegment( int theIndex )
187 if( theIndex > mySegmentNumber || !myArray)
190 for( int i = theIndex; i < mySegmentNumber; i++ )
192 myArray[i*2] = myArray[(i+1)*2];
193 myArray[i*2+1] = myArray[(i+1)*2+1];
196 myArray[mySegmentNumber*2] = 0.0;
197 myArray[mySegmentNumber*2+1] = 0.0;
201 bool GLViewer_LineList::removeSegment( double coord1, double coord2 )
203 if( coord1 > coord2 )
205 double temp = coord1;
210 if( 2*mySegmentNumber == myRealSize || !myArray )
215 while( index < mySegmentNumber)
217 readSegment( index, c1, c2 );
218 if( coord1 < c1 && coord2 < c1 )
223 else if( coord1 < c1 && coord2 < c2 )
225 myArray[index*2] = coord2;
228 else if( c1 < coord1 && coord2 < c2 )
230 if( 2*mySegmentNumber == myRealSize )
232 for( int i = mySegmentNumber; i > index + 1; i-- )
234 myArray[2*i] = myArray[2*(i-1)];
235 myArray[2*i+1] = myArray[2*(i-1)+1];
237 myArray[2*(index+1)+1] = myArray[2*index+1];
238 myArray[2*(index+1)] = coord2;
239 myArray[2*index+1] = coord1;
243 else if( coord1 < c2 && c2 < coord2 )
247 myArray[2*index+1] = coord1;
250 if( index != mySegmentNumber - 1 )
252 for( int i = index+1; i < mySegmentNumber; i++ )
254 if( coord2 < myArray[2*i] )
258 for( int j = 1; i+j-1 < mySegmentNumber;j++ )
260 myArray[2*(index+j)] = myArray[2*(i+j-1)];
261 myArray[2*(index+j)+1] = myArray[2*(i+j-1)+1];
263 for( int k = 0; k < mySegmentNumber - i; k++ )
265 myArray[2*(mySegmentNumber - 1- k)] = 0.0;
266 myArray[2*(mySegmentNumber - 1- k)+1] = 0.0;
268 mySegmentNumber -= i - index -1;
274 for( int j = 0; index + j + 1 < mySegmentNumber;j++ )
276 myArray[2*(index+j)] = myArray[2*(index+j+1)];
277 myArray[2*(index+j)+1] = myArray[2*(index+j+1)+1];
280 myArray[2*(mySegmentNumber - 1)] = 0.0;
281 myArray[2*(mySegmentNumber - 1)+1] = 0.0;
291 else if( coord2 < myArray[2*i+1] )
298 myArray[2*index] = coord2;
299 myArray[2*index+1] = myArray[2*i+1];
301 for( int j = 1; i+j < mySegmentNumber;j++ )
303 myArray[2*(index+j)] = myArray[2*(i+j)];
304 myArray[2*(index+j)+1] = myArray[2*(i+j)+1];
306 for( int k = 0; k < mySegmentNumber - i - 1; k++ )
308 myArray[2*(mySegmentNumber - 1- k)] = 0.0;
309 myArray[2*(mySegmentNumber - 1- k)+1] = 0.0;
311 mySegmentNumber -= i - index;
317 myArray[2*(index+1)] = coord2;
322 myArray[2*(index)] = coord2;
323 myArray[2*(index)+1] = myArray[2*(index+1)+1];
324 for( int j = index+1; j < mySegmentNumber-1; j++ )
326 myArray[2*j] = myArray[2*(j+1)];
327 myArray[2*j+1] = myArray[2*(j+1)+1];
330 myArray[2*mySegmentNumber] = 0.0;
331 myArray[2*mySegmentNumber+1] = 0.0;
343 myArray[2*index] = 0.0;
344 myArray[2*index+1] = 0.0;
353 void GLViewer_LineList::clear()
356 memset( myArray, 0, myRealSize*sizeof(double) );
359 void GLViewer_LineList::print()
361 cout << "MainCoord: " << myMainCoord <<" SIZE: " << myRealSize << " ENum: " << mySegmentNumber << " :::";
362 for( int i = 0; i < mySegmentNumber; i++ )
363 cout << " " << myArray[2*i] << " " << myArray[2*i+1] << " | ";
368 void GLViewer_LineList::show( FieldDim theDim )
373 glColor3f( 1.0, 0.0, 1.0 );
377 for( int i = 0; i < mySegmentNumber; i++ )
379 glVertex2d( myArray[2*i], myMainCoord );
380 glVertex2d( myArray[2*i+1], myMainCoord );
384 else if( theDim == FD_Y )
387 for( int i = 0; i < mySegmentNumber; i++ )
389 glVertex2d( myMainCoord, myArray[2*i] );
390 glVertex2d( myMainCoord, myArray[2*i+1] );
396 /****************************************************************************
397 ** Class: GLViewer_LineField
398 ** Descr: Tools for solving
400 ** Created: UI team, 27.10.05
401 *****************************************************************************/
402 GLViewer_LineField::GLViewer_LineField()
405 myGraphArray1 = NULL;
406 myGraphArray2 = NULL;
415 GLViewer_LineField::GLViewer_LineField( const int theMAXSize, const int theXN, const int theYN )
418 myGraphArray1 = NULL;
419 myGraphArray2 = NULL;
423 if( theXN <= 0 || theYN <= 0 )
432 myXLineArray = new GLViewer_LineList*[theXN];
433 myYLineArray = new GLViewer_LineList*[theYN];
435 for( int i = 0; i < theXN; i++ )
436 myXLineArray[i] = new GLViewer_LineList( theMAXSize );
438 for( int j = 0; j < theYN; j++ )
439 myYLineArray[j] = new GLViewer_LineList( theMAXSize );
446 GLViewer_LineField::~GLViewer_LineField()
450 for( int i = 0; i < myXSize; i++ )
451 delete myXLineArray[i];
458 for( int j = 0; j < myYSize; j++ )
459 delete myYLineArray[j];
465 delete myGraphArray1;
468 delete myGraphArray2;
471 void GLViewer_LineField::addLine( FieldDim theDim, GLViewer_LineList* )
476 void GLViewer_LineField:: addLine( FieldDim theDim, double theMC, double theBegin, double theEnd )
478 GLViewer_LineList* aLL = new GLViewer_LineList( 1 );
479 aLL->addSegment( theBegin, theEnd );
480 aLL->setMainCoord( theMC );
481 addLine( theDim, aLL );
485 int GLViewer_LineField::insertLine( FieldDim theDim, GLViewer_LineList* theLL, int thePosition )
487 if( !myXLineArray || !myYLineArray )
490 GLViewer_LineList** anArray = getLLArray( theDim );
494 int size = getDimSize( theDim );
496 if( thePosition >= size )
498 else if( thePosition < 0 )
500 if( anArray[size-1]->count() != 0 ) // no more space
503 for( int i = 0; i < size; i++ )
505 if( anArray[i]->count() == 0 )
512 double cur_mc = anArray[i]->mainCoord();
513 if( theLL->mainCoord() < cur_mc )
515 for( int j = 0; j+i+1 < size; j++ )
517 delete anArray[size-j-1];
518 anArray[size-j-1] = anArray[size-j-2];
528 delete anArray[thePosition];
529 anArray[thePosition] = theLL;
536 int GLViewer_LineField::insertLine( FieldDim theDim, double theMainCoord, double theBegin, double theEnd, int thePosition )
538 GLViewer_LineList* aLL = new GLViewer_LineList( 1 );
539 aLL->addSegment( theBegin, theEnd );
540 aLL->setMainCoord( theMainCoord );
541 return insertLine( theDim, aLL, thePosition );
545 FieldDim GLViewer_LineField::invertDim( FieldDim theFD )
553 GLViewer_LineList* GLViewer_LineField::getLine( int theIndex, FieldDim theFD )
555 if( !myXLineArray || !myYLineArray )
560 if( theIndex > myXSize )
563 return myXLineArray[theIndex];
565 else if( theFD == FD_Y )
567 if( theIndex > myYSize )
570 return myYLineArray[theIndex];
576 void GLViewer_LineField::setBorders( double X1, double X2, double Y1, double Y2 )
578 if( !myXLineArray || !myYLineArray )
581 for( int i = 0; i < myXSize; i++ )
583 myXLineArray[i]->clear();
584 myXLineArray[i]->addSegment( X1, X2 );
585 myXLineArray[i]->setMainCoord( Y1 + (Y2-Y1)*(double(i)/(myXSize-1)) );
588 for( int j = 0; j < myYSize; j++ )
590 myYLineArray[j]->clear();
591 myYLineArray[j]->addSegment( Y1, Y2 );
592 myYLineArray[j]->setMainCoord( X1 + (X2-X1)*(double(j)/(myYSize-1)) );
596 void GLViewer_LineField::addRectangle( double top, double right, double bottom, double left )
598 if( !myXLineArray || !myYLineArray )
600 for( int i = 0; i < myXSize; i++ )
602 double mainCoord = myXLineArray[i]->mainCoord();
603 if( mainCoord < top && mainCoord > bottom )
604 myXLineArray[i]->removeSegment( left, right );
607 for( int j = 0; j < myYSize; j++ )
609 double mainCoord = myYLineArray[j]->mainCoord();
610 if( mainCoord < right && mainCoord > left )
611 myYLineArray[j]->removeSegment( bottom, top );
615 void GLViewer_LineField::print()
617 cout << "My X matrix Number: " << myXSize << endl;
618 for( int i = 0; i < myXSize; i++ )
619 myXLineArray[i]->print();
621 cout << "My Y matrix Number: " << myYSize << endl;
622 for( int j = 0; j < myYSize; j++ )
623 myYLineArray[j]->print();
626 void GLViewer_LineField::show()
628 for( int i = 0; i < myXSize; i++ )
629 getLine( i, FD_X )->show( FD_X );
631 for( int j = 0; j < myYSize; j++ )
632 getLine( j, FD_Y )->show( FD_Y );
634 double* anArray = solution( count );
635 glColor3f( 1.0, 0.0, 0.0 );
637 for( int k = 0; k < count; k++ )
639 glVertex2d( anArray[4*k], anArray[4*k+1] );
640 glVertex2d( anArray[4*k+2], anArray[4*k+3] );
644 cout << "Show function" << endl;
647 int GLViewer_LineField::getDimSize( FieldDim theDim )
651 else if( theDim == FD_Y )
657 int* GLViewer_LineField::intersectIndexes( FieldDim theDim, int theIndex, const GLViewer_LineList* theLL, int& theSize )
660 if( !myXLineArray || !myYLineArray )
663 int aDimSize = getDimSize( theDim );
664 int* anArray = new int[aDimSize*2 ];
666 for( int i = 0; i < aDimSize; i++ )
668 GLViewer_LineList* aLL = getLine( i, theDim );
669 int index = aLL->contains( theLL->mainCoord() );
670 if( index != -1 && theLL->contains( aLL->mainCoord() ) == theIndex )
672 anArray[theSize*2] = i;
673 anArray[theSize*2+1] = index;
682 bool GLViewer_LineField::setPoint( FieldPoint thePoint, double theX, double theY )
684 if( !myXLineArray || !myYLineArray )
688 int xSeg = -1, ySeg = -1;
689 for( i = 0; i < myXSize; i++ )
691 GLViewer_LineList* aLL = getLine( i, FD_X );
692 if( aLL->mainCoord() == theY )
694 xSeg = aLL->contains( theX );
699 for( j = 0; j < myYSize; j++ )
701 GLViewer_LineList* aLL = getLine( j, FD_Y );
702 if( aLL->mainCoord() == theX )
704 ySeg = aLL->contains( theY );
709 if( xSeg != -1 && ySeg != -1 )
711 if( thePoint == FP_Start )
713 myStartPoint.myXLineIndex = i;
714 myStartPoint.myXSegmentIndex = xSeg;
715 myStartPoint.myYLineIndex = j;
716 myStartPoint.myYSegmentIndex = ySeg;
717 myStartPoint.mySolveIndex = -1;
721 myEndPoint.myXLineIndex = i;
722 myEndPoint.myXSegmentIndex = xSeg;
723 myEndPoint.myYLineIndex = j;
724 myEndPoint.myYSegmentIndex = ySeg;
725 myEndPoint.mySolveIndex = -1;
733 int GLViewer_LineField::segmentNumber()
735 if( !(myXLineArray || myYLineArray) )
739 for( int aDim = 0; aDim < 2; aDim++ )
740 for( int i = 0, n = getDimSize( (FieldDim)aDim ); i < n; i++ )
741 aNumber += getLine( i, (FieldDim)aDim )->count();
746 void GLViewer_LineField::optimize()
748 if( !myXLineArray || !myYLineArray )
751 for( int aDim = 0; aDim < 2; aDim++ )
753 for( int i = 0, n = getDimSize( (FieldDim)aDim ); i < n; i++ )
755 GLViewer_LineList* aLL = getLine( i, (FieldDim)aDim );
756 for( int k =0, aSegNum = aLL->count(); k < aSegNum; k++ )
758 // int index = i; unused
760 aLL->readSegment( k, a1, a2 );
761 for( int l = i+1, m = getDimSize( (FieldDim)aDim ); l < m; l++ )
764 GLViewer_LineList* aCurLL = getLine( l, (FieldDim)aDim );
765 for( int j = 0, count = aCurLL->count(); j < count; j++ )
768 aCurLL->readSegment( j, c1, c2 );
769 if( a1 == c1 && a2 == c2 )
771 if( !(aDim == 0 && myStartPoint.myXLineIndex == l && myStartPoint.myXSegmentIndex == j) &&
772 !(aDim == 0 && myEndPoint.myXLineIndex == l && myEndPoint.myXSegmentIndex == j) &&
773 !(aDim == 1 && myStartPoint.myYLineIndex == l && myStartPoint.myYSegmentIndex == j) &&
774 !(aDim == 1 && myEndPoint.myYLineIndex == l && myEndPoint.myYSegmentIndex == j) )
775 aCurLL->removeSegment( j );
785 if( end == -1 || end == 1)
793 void GLViewer_LineField::initialize()
795 if( !myXLineArray || !myYLineArray )
798 int size = segmentNumber();
803 myGraphArray1 = new GraphNode[size];
804 myGraphArray2 = new GraphNode[size];
809 for( int aDim = 0; aDim < 2; aDim++ )
811 for( int i = 0, n = getDimSize( (FieldDim)aDim ); i < n; i++ )
813 GLViewer_LineList* aLL = getLine( i, (FieldDim)aDim );
814 for( int k =0, aSegNum = aLL->count(); k < aSegNum; k++ )
816 myGraphArray1[index].myCount = size;
817 myGraphArray1[index].myDim = (FieldDim)aDim;
818 myGraphArray1[index].myLineIndex = i;
819 myGraphArray1[index].mySegmentindex = k;
820 myGraphArray1[index].prevNodeIndex = -1;
822 myGraphArray2[index].myCount = size;
823 myGraphArray2[index].myDim = (FieldDim)aDim;
824 myGraphArray2[index].myLineIndex = i;
825 myGraphArray2[index].mySegmentindex = k;
826 myGraphArray2[index].prevNodeIndex = -1;
828 if( !isXSet && aDim == FD_X && myStartPoint.myXLineIndex == i && myStartPoint.myXSegmentIndex == k )
830 myGraphArray1[index].myCount = 0;
834 if( aDim == FD_Y && !isYSet && myStartPoint.myYLineIndex == i && myStartPoint.myYSegmentIndex == k )
836 myGraphArray1[index].myCount = 0;
846 void GLViewer_LineField::iteration()
848 int aParam = myCurCount;
851 int* aNodes = findByCount( aParam );
852 GraphNode* aCurArray = getCurArray();
854 for( int i = 0; i < aParam; i++ )
856 GraphNode aCurNode = aCurArray[aNodes[i]];
858 int* aInterNodes = intersectIndexes( invertDim( aCurNode.myDim ), aCurNode.mySegmentindex,
859 getLine( aCurNode.myLineIndex, aCurNode.myDim ), aSize );
860 for( int j = 0; j < aSize; j++ )
862 int index = findBySegment( invertDim( aCurNode.myDim ), aInterNodes[2*j], aInterNodes[2*j+1], false );
864 if( aCurArray[index].myCount > myCurCount )
866 aCurArray[index].myCount = myCurCount;
867 aCurArray[index].prevNodeIndex = aNodes[i];
871 delete[] aInterNodes;
877 GLViewer_LineField::IterationStatus GLViewer_LineField::checkComplete()
879 if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
883 GraphNode* aCurArray = getCurArray(),
884 * aSecArray = getSecArray();
886 for( int i = 0, n = segmentNumber(); i < n; i++ )
888 if( aCurArray[i].myCount != aSecArray[i].myCount )
890 if( aCurArray[i].myDim == FD_X &&
891 aCurArray[i].myLineIndex == myEndPoint.myXLineIndex &&
892 aCurArray[i].mySegmentindex == myEndPoint.myXSegmentIndex )
894 cout << "Algorithm complete X!!!!!!!" << endl;
895 myEndPoint.mySolveIndex = i;
898 else if( aCurArray[i].myDim == FD_Y &&
899 aCurArray[i].myLineIndex == myEndPoint.myYLineIndex &&
900 aCurArray[i].mySegmentindex == myEndPoint.myYSegmentIndex )
902 cout << "Algorithm complete Y!!!!!!!" << endl;
903 myEndPoint.mySolveIndex = i;
909 aSecArray[i].myCount = aCurArray[i].myCount;
910 aSecArray[i].prevNodeIndex = aCurArray[i].prevNodeIndex;
915 if( myCurArrayIndex == 0)
920 cout << "Number of ways: " << count << endl;
924 return IS_NOT_SOLVED;
927 int* GLViewer_LineField::findByCount( int& theParam )
929 if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
932 int count = segmentNumber();
933 int* anArray = new int[count];
936 GraphNode* aCurArray = getCurArray();
937 for( int i = 0; i < count; i++ )
939 GraphNode aCurNode = aCurArray[i];
940 if( aCurNode.myCount == theParam )
951 int GLViewer_LineField::findBySegment( FieldDim theDim, int theLineIndex, int theSegment, bool inCurArray )
953 if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 || getDimSize( theDim ) <= theLineIndex )
956 GraphNode* aCurArray;
958 aCurArray = getCurArray();
960 aCurArray = getSecArray();
962 for( int i = 0, n = segmentNumber(); i < n; i++ )
964 GraphNode aCurNode = aCurArray[i];
965 if( aCurNode.myDim == theDim && aCurNode.myLineIndex == theLineIndex && aCurNode.mySegmentindex == theSegment )
972 GLViewer_LineField::EndStatus GLViewer_LineField::startAlgorithm()
974 if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
979 cout << "-----------Iteration #" << myCurCount << "-------------" << endl;
982 IterationStatus is = checkComplete();
985 else if( is == IS_LOOP )
987 else if( is == IS_SOLVED )
993 double* GLViewer_LineField::solution( int& theSize )
995 if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
998 if( myEndPoint.mySolveIndex == -1 )
1001 theSize = myCurCount+1;
1002 double* anArray = new double[theSize*4];
1004 GraphNode* aCurArray = getCurArray();
1006 int index = myEndPoint.mySolveIndex;
1007 for( int i = 0; i <= myCurCount; i++ )
1012 GLViewer_LineList* aLL = getLine( aCurArray[index].myLineIndex, aCurArray[index].myDim );
1013 aLL->readSegment( aCurArray[index].mySegmentindex, c1, c2 );
1015 if( aCurArray[index].myDim == FD_X )
1018 anArray[i*4+1] = aLL->mainCoord();
1019 anArray[i*4+2] = c2;
1020 anArray[i*4+3] = aLL->mainCoord();
1024 anArray[i*4] = aLL->mainCoord();
1025 anArray[i*4+1] = c1;
1026 anArray[i*4+2] = aLL->mainCoord();
1027 anArray[i*4+3] = c2;
1030 index = aCurArray[index].prevNodeIndex;
1036 GraphNode* GLViewer_LineField::getCurArray()
1038 if( !myGraphArray1 || !myGraphArray2 )
1041 if( myCurArrayIndex == 0)
1042 return myGraphArray1;
1044 return myGraphArray2;
1047 GraphNode* GLViewer_LineField::getSecArray()
1049 if( !myGraphArray1 || !myGraphArray2 )
1052 if( myCurArrayIndex == 0)
1053 return myGraphArray2;
1055 return myGraphArray1;
1058 int GLViewer_LineField::maxSegmentNum()
1060 if( !myXLineArray || !myYLineArray )
1064 for( int aDim = 0; aDim < 2; aDim++ )
1066 for( int i = 0, n = getDimSize( (FieldDim)aDim ); i < n; i++ )
1068 int count = getLine( i, (FieldDim)aDim )->count();
1069 if( count > max_num )
1077 GLViewer_LineList** GLViewer_LineField::getLLArray( FieldDim theDim )
1079 if( theDim == FD_X )
1080 return myXLineArray;
1081 else if( theDim == FD_Y )
1082 return myYLineArray;