Salome HOME
Merge from V5_1_main 14/05/2010
[modules/visu.git] / src / PIPELINE / VISU_MergedPL.cxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
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.
7 //
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.
12 //
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
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //  VISU OBJECT : interactive object for VISU entities implementation
21 // File:    VISU_MergedPL.cxx
22 // Author:  Alexey PETROV
23 // Module : VISU
24 //
25 #include "VISU_MergedPL.hxx"
26 #include "VISU_PipeLine.hxx"
27
28
29 //----------------------------------------------------------------------------
30 void
31 VISU_MergedPL
32 ::DoShallowCopy(VISU_PipeLine *thePipeLine,
33                 bool theIsCopyInput)
34 {
35   if(VISU_MergedPL *aPipeLine = dynamic_cast<VISU_MergedPL*>(thePipeLine)){
36     if ( this == aPipeLine ) 
37       return;
38
39     if ( aPipeLine->IsExternalGeometryUsed() ) {
40       ClearGeometry();
41       int aNbOfGeometry = aPipeLine->GetNumberOfGeometry();
42       for ( int aGeomNumber = 0; aGeomNumber < aNbOfGeometry; aGeomNumber++ ) {
43         VISU::TName aGeomName;
44         AddGeometry( aPipeLine->GetGeometry( aGeomNumber, aGeomName ), aGeomName );
45       }
46     }else
47       SetSourceGeometry();
48   }
49 }
50
51 //----------------------------------------------------------------------------
52 void
53 VISU_MergedPL
54 ::AddGeometryName(const VISU::TName& theGeomName)
55 {
56   myGeometryNames.push_back( theGeomName );
57 }
58
59 //----------------------------------------------------------------------------
60 VISU::TName
61 VISU_MergedPL
62 ::GetGeometryName( int theGeomNumber ) const
63 {
64   if( theGeomNumber < myGeometryNames.size() )
65     return myGeometryNames[ theGeomNumber ];
66   return VISU::TName();
67 }
68
69 //----------------------------------------------------------------------------
70 const VISU::TNames&
71 VISU_MergedPL
72 ::GetGeometryNames() const
73 {
74   return myGeometryNames;
75 }
76
77 //----------------------------------------------------------------------------
78 void
79 VISU_MergedPL
80 ::ClearGeometryNames()
81 {
82   myGeometryNames.clear();
83 }