Salome HOME
ca073c3528469ad0502f43c9f70aab44f08932a2
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Shape.cxx
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #include <HYDROGUI_Shape.h>
20 #include <HYDROGUI_Tool.h>
21 #include <HYDROData_Channel.h>
22 #include <HYDROData_Document.h>
23 #include <HYDROData_DummyObject3D.h>
24 #include <HYDROData_ImmersibleZone.h>
25 #include <HYDROData_Obstacle.h>
26 #include <HYDROData_PolylineXY.h>
27 #include <HYDROData_Polyline3D.h>
28 #include <HYDROData_Profile.h>
29 #include <HYDROData_ShapesGroup.h>
30 #include <HYDROData_Stream.h>
31 #include <HYDROData_Zone.h>
32
33 #include <AIS_Shape.hxx>
34 #include <BRep_Builder.hxx>
35 #include <BRepBuilderAPI_MakeFace.hxx>
36 #include <Graphic3d_AspectFillArea3d.hxx>
37 #include <Prs3d_IsoAspect.hxx>
38 #include <Prs3d_ShadingAspect.hxx>
39 #include <TopoDS.hxx>
40 #include <TopoDS_Face.hxx>
41 #include <TopoDS_Wire.hxx>
42 #include <TopExp_Explorer.hxx>
43
44 HYDROGUI_Shape::HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext,
45                                 const Handle(HYDROData_Entity)&       theObject,
46                                 const int                             theZLayer )
47 : myContext( theContext ),
48   myObject( theObject ),
49   myZLayer( theZLayer ),
50   myIsHighlight( false ),
51   myFillingColor( Qt::transparent ),
52   myBorderColor( Qt::black ),
53   myHighlightColor( Qt::white ),
54   myIsToUpdate( false ),
55   myIsVisible( true ),
56   myDisplayMode( AIS_Shaded )
57 {
58 }
59
60 HYDROGUI_Shape::~HYDROGUI_Shape()
61 {
62   erase( false );
63
64   if ( !myShape.IsNull() )
65     myShape.Nullify();
66 }
67
68 Handle(AIS_InteractiveContext) HYDROGUI_Shape::getContext() const
69 {
70   return myContext;
71 }
72
73 Handle(HYDROData_Entity) HYDROGUI_Shape::getObject() const
74 {
75   return myObject;
76 }
77
78 TopoDS_Shape HYDROGUI_Shape::getTopoShape() const
79 {
80   return myTopoShape;
81 }
82
83 bool HYDROGUI_Shape::getIsToUpdate() const
84 {
85   return myIsToUpdate;
86 }
87
88 void HYDROGUI_Shape::setIsToUpdate( bool theState )
89 {
90   myIsToUpdate = theState;
91 }
92
93 bool HYDROGUI_Shape::isVisible() const
94 {
95   return myIsVisible;
96 }
97
98 Handle(AIS_InteractiveObject) HYDROGUI_Shape::getAISObject() const
99 {
100   return myShape;
101 }
102
103 void HYDROGUI_Shape::display( const bool theIsUpdateViewer )
104 {
105   if ( myContext.IsNull() || myShape.IsNull() || !isVisible() )
106     return;
107
108   displayShape( theIsUpdateViewer );
109 }
110
111 void HYDROGUI_Shape::erase( const bool theIsUpdateViewer )
112 {
113   if ( myContext.IsNull() || myShape.IsNull() )
114     return;
115
116   myContext->Erase( myShape, theIsUpdateViewer );
117 }
118
119 void HYDROGUI_Shape::update( bool isUpdateViewer,
120                              bool isDeactivateSelection )
121
122 {
123   setIsToUpdate( false );
124
125   if ( myContext.IsNull() )
126     return;
127
128   // Try to retrieve information from object
129   if ( !myObject.IsNull() )
130   {
131     Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myObject->Label() );
132   
133     if ( myObject->IsKind( STANDARD_TYPE(HYDROData_ImmersibleZone) ) )
134     {
135       Handle(HYDROData_ImmersibleZone) aZoneObj =
136         Handle(HYDROData_ImmersibleZone)::DownCast( myObject );
137
138       TopoDS_Shape aZoneShape = aZoneObj->GetTopShape();
139       if ( !aZoneShape.IsNull() ) {
140         if ( aZoneShape.ShapeType() == TopAbs_FACE ) {
141           TopoDS_Face aZoneFace = TopoDS::Face( aZoneShape );
142           setFace( aZoneFace, false, false, "" );
143         } else {
144           myTopoShape = aZoneShape;
145           //TODO: myDisplayMode = myTextureFileName.isEmpty() ? AIS_Shaded : AIS_Shaded+2;
146           myDisplayMode = AIS_Shaded;
147
148           buildShape();
149           updateShape( false, false );
150         }
151       }
152
153       QColor aFillingColor = aZoneObj->GetFillingColor();
154       QColor aBorderColor = aZoneObj->GetBorderColor();
155
156       setFillingColor( aFillingColor, false, false );
157       setBorderColor( aBorderColor, false, false );
158     }
159     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_PolylineXY) ) )
160     {
161       Handle(HYDROData_PolylineXY) aPolyline =
162         Handle(HYDROData_PolylineXY)::DownCast( myObject );
163
164       TopoDS_Shape aPolylineShape = aPolyline->GetShape();
165
166       if ( !aPolylineShape.IsNull() ) {
167         if ( aPolylineShape.ShapeType() == TopAbs_WIRE ) {
168           TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolylineShape );
169           setWire( aPolylineWire, false, false );  
170         } else {
171           myTopoShape = aPolylineShape;
172           // Set shading mode to avoid that hilight presentation is equal to "normal" object presentation.
173           // Note that hilight presentation is always to be on top ( i.e. in the top Z layer ).
174           myDisplayMode = AIS_Shaded;
175
176           buildShape();
177           updateShape( false, false );
178         }
179       }
180
181       QColor aWireColor = aPolyline->GetWireColor();
182       setBorderColor( aWireColor, false, false );
183     }
184     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Polyline3D) ) )
185     {
186       Handle(HYDROData_Polyline3D) aPolyline =
187         Handle(HYDROData_Polyline3D)::DownCast( myObject );
188
189       TopoDS_Shape aPolylineShape = aPolyline->GetShape3D();
190
191       if ( !aPolylineShape.IsNull() ) {
192         if ( aPolylineShape.ShapeType() == TopAbs_WIRE ) {
193           TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolylineShape );
194           setWire( aPolylineWire, false, false );  
195         } else {
196           myTopoShape = aPolylineShape;
197           // Set shading mode to avoid that hilight presentation is equal to "normal" object presentation.
198           // Note that hilight presentation is always to be on top ( i.e. in the top Z layer ).
199           myDisplayMode = AIS_Shaded;
200
201           buildShape();
202           updateShape( false, false );
203         }
204       }
205
206       QColor aWireColor = aPolyline->GetBorderColor();
207       setBorderColor( aWireColor, false, false );
208     }
209     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Zone) ) )
210     {
211       Handle(HYDROData_Zone) aZone =
212         Handle(HYDROData_Zone)::DownCast( myObject );
213
214       TopoDS_Face aZoneFace = TopoDS::Face( aZone->GetShape() );
215
216       setFace( aZoneFace, false, false, "" );
217       if (aZone->IsMergingNeed() && aZone->GetMergeType() == HYDROData_Zone::Merge_UNKNOWN )
218       {
219         // Red color for a zone with bathymetry conflict
220         setFillingColor( Qt::red );
221       }
222       else
223       {
224         // Generate the filling color for zone
225         QStringList aGeomObjectsNames;
226
227         HYDROData_SequenceOfObjects aRefObjects = aZone->GetGeometryObjects();
228         HYDROData_SequenceOfObjects::Iterator anIter( aRefObjects );
229         for ( ; anIter.More(); anIter.Next() )
230         {
231           Handle(HYDROData_Object) aRefbject = 
232             Handle(HYDROData_Object)::DownCast( anIter.Value() );
233           if ( aRefbject.IsNull() )
234             continue;
235
236           QString aRefObjectName = aRefbject->GetName();
237           if ( aRefObjectName.isEmpty() )
238             continue;
239
240           aGeomObjectsNames.append( aRefObjectName );
241         }
242
243         setFillingColor( HYDROGUI_Tool::GenerateFillingColor( aDocument, aGeomObjectsNames ) );
244       }
245     }
246     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Profile) ) )
247     {
248       Handle(HYDROData_Profile) aProfile =
249         Handle(HYDROData_Profile)::DownCast( myObject );
250
251       TopoDS_Wire aProfileWire;
252
253       if ( aProfile->IsValid() ) {
254         TopoDS_Shape aProfileShape = aProfile->GetShape3D();
255
256         if ( !aProfileShape.IsNull() && 
257              aProfileShape.ShapeType() == TopAbs_WIRE ) {
258           aProfileWire = TopoDS::Wire( aProfileShape );
259         }
260       }
261
262       setWire( aProfileWire, false, false );  
263
264       QColor aWireColor = aProfile->GetBorderColor();
265       setBorderColor( aWireColor, false, false );
266     }
267     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Stream) ) ||
268               myObject->IsKind( STANDARD_TYPE(HYDROData_Channel) ) ||
269               myObject->IsKind( STANDARD_TYPE(HYDROData_Obstacle) ) )
270     {
271       Handle(HYDROData_Object) aGeomObject =
272         Handle(HYDROData_Object)::DownCast( myObject );
273
274       TopoDS_Shape anObjShape = aGeomObject->GetTopShape();
275
276       setShape( anObjShape, false, false );
277
278       QColor aFillingColor = aGeomObject->GetFillingColor();
279       QColor aBorderColor = aGeomObject->GetBorderColor();
280
281       setFillingColor( aFillingColor, false, false );
282       setBorderColor( aBorderColor, false, false );
283     }
284     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_DummyObject3D) ) )
285     {
286       Handle(HYDROData_DummyObject3D) anObject3D =
287         Handle(HYDROData_DummyObject3D)::DownCast( myObject );
288       TopoDS_Shape aShape3D = anObject3D->GetShape();
289
290       setShape( aShape3D, false, false );
291
292       QColor aFillingColor = anObject3D->GetFillingColor();
293       QColor aBorderColor = anObject3D->GetBorderColor();
294
295       setFillingColor( aFillingColor, false, false );
296       setBorderColor( aBorderColor, false, false );
297     }
298     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_ShapesGroup) ) )
299     {
300       Handle(HYDROData_ShapesGroup) aShapesGroup =
301         Handle(HYDROData_ShapesGroup)::DownCast( myObject );
302
303       TopTools_SequenceOfShape aShapes;
304       aShapesGroup->GetShapes( aShapes );
305
306       TopoDS_Compound aCompound;
307       BRep_Builder aCompoundBuilder;
308       aCompoundBuilder.MakeCompound( aCompound );
309
310       for ( int i = 1, n = aShapes.Length(); i <= n; ++i )
311       {
312         const TopoDS_Shape& aShape = aShapes.Value( i );
313         aCompoundBuilder.Add( aCompound, aShape );
314       }
315
316       setShape( aCompound, false, false );  
317     }
318   }
319  
320   if ( myShape.IsNull() || !isVisible() )
321     return;
322
323   displayShape( isUpdateViewer );
324
325   if (isDeactivateSelection)
326     myContext->Deactivate(myShape);
327 }
328
329 void HYDROGUI_Shape::setVisible( const bool theState,
330                                  const bool theIsUpdateViewer )
331 {
332   myIsVisible = theState;
333
334   if ( myShape.IsNull() )
335     return;
336
337   if ( ( myIsVisible && myContext->IsDisplayed( myShape ) ) ||
338        ( !myIsVisible && !myContext->IsDisplayed( myShape ) ) )
339     return;
340
341   if ( myIsVisible ) {
342     displayShape( theIsUpdateViewer );
343   }
344   else
345     myContext->Erase( myShape, theIsUpdateViewer );
346 }
347
348 void HYDROGUI_Shape::highlight( bool theIsHighlight, bool isUpdateViewer )
349 {
350   if ( myIsHighlight == theIsHighlight )
351     return;
352
353   myIsHighlight = theIsHighlight;
354
355   if ( myContext.IsNull() || myShape.IsNull() )
356     return;
357
358   colorShapeBorder( getActiveColor() );
359   displayShape( isUpdateViewer );
360 }
361
362 bool HYDROGUI_Shape::isHighlighted() const
363 {
364   return myIsHighlight;
365 }
366
367 void HYDROGUI_Shape::setWire( const TopoDS_Wire& theWire,
368                               const bool         theToDisplay,
369                               const bool         theIsUpdateViewer )
370 {
371   myTopoShape = theWire;
372   // To avoid that hilight presentation is equal to "normal" object presentation.
373   // Note that hilight presentation is always to be on top ( i.e. in the top Z layer ).
374   myDisplayMode = AIS_Shaded;
375
376   buildShape();
377   updateShape( theToDisplay, theIsUpdateViewer );
378 }
379
380 void HYDROGUI_Shape::setFaces( const TopoDS_Compound& theWires,
381                                const bool             theToDisplay,
382                                const bool             theIsUpdateViewer )
383 {
384   TopExp_Explorer anExp( theWires, TopAbs_WIRE );
385   TopoDS_Compound aCompound;
386   BRep_Builder aBuilder;
387     aBuilder.MakeCompound( aCompound );
388
389   for ( ; anExp.More(); anExp.Next() ) {
390     TopoDS_Wire aWire = TopoDS::Wire( anExp.Current() );
391     if ( aWire.IsNull() ) {
392       continue;
393     }
394
395     BRepBuilderAPI_MakeFace aMakeFace( aWire, Standard_True );
396     aMakeFace.Build();
397     if( aMakeFace.IsDone() ) {
398       aBuilder.Add( aCompound, aMakeFace.Face() );
399     }
400   }
401
402   myTopoShape = aCompound;
403   myDisplayMode = AIS_Shaded;
404
405   buildShape();
406   updateShape( theToDisplay, theIsUpdateViewer );
407 }
408
409 void HYDROGUI_Shape::setFace( const TopoDS_Wire& theWire,
410                               const bool         theToDisplay,
411                               const bool         theIsUpdateViewer,
412                               const QString&     theTextureFileName )
413 {
414   BRepBuilderAPI_MakeFace aFaceBuilder( theWire, Standard_True );
415   aFaceBuilder.Build();
416   if( aFaceBuilder.IsDone() )
417   {
418     TopoDS_Face aFace = aFaceBuilder.Face();
419     setFace( aFace, theToDisplay, theIsUpdateViewer, theTextureFileName );
420   }
421 }
422
423 void HYDROGUI_Shape::setFace( const TopoDS_Face& theFace,
424                               const bool         theToDisplay,
425                               const bool         theIsUpdateViewer,
426                               const QString&     theTextureFileName )
427 {
428   myTopoShape = theFace;
429   myDisplayMode = theTextureFileName.isEmpty() ? AIS_Shaded : AIS_Shaded+2;
430   //Note: AIS_Shaded+2 is the same as AIS_ExactHLR
431   //TODO: it would be more suitable to use TexturedShape mode from GEOM_AISShape
432
433   buildShape();
434   updateShape( theToDisplay, theIsUpdateViewer );
435 }
436
437 void HYDROGUI_Shape::setShape( const TopoDS_Shape& theShape,
438                                const bool          theToDisplay,
439                                const bool          theIsUpdateViewer )
440 {
441   myTopoShape = theShape;
442   myDisplayMode = AIS_Shaded;
443
444   buildShape();
445   updateShape( theToDisplay, theIsUpdateViewer );
446 }
447
448 void HYDROGUI_Shape::setFillingColor( const QColor& theColor,
449                                       const bool    theToDisplay,
450                                       const bool    theIsUpdateViewer )
451 {
452   myFillingColor = theColor;
453   updateShape( theToDisplay, theIsUpdateViewer );
454 }
455
456 QColor HYDROGUI_Shape::getFillingColor() const
457 {
458   return myFillingColor;
459 }
460
461 void HYDROGUI_Shape::setBorderColor( const QColor& theColor,
462                                      const bool    theToDisplay,
463                                      const bool    theIsUpdateViewer )
464 {
465   myBorderColor = theColor;
466   updateShape( theToDisplay, theIsUpdateViewer );
467 }
468
469 QColor HYDROGUI_Shape::getBorderColor() const
470 {
471   return myBorderColor;
472 }
473
474 void HYDROGUI_Shape::setHighlightColor( const QColor& theColor )
475 {
476   myHighlightColor = theColor;
477 }
478
479 QColor HYDROGUI_Shape::getHighlightColor() const
480 {
481   return myHighlightColor;
482 }
483
484 void HYDROGUI_Shape::setZLayer( const int theZLayer )
485 {
486   if ( myZLayer == theZLayer )
487     return;
488
489   myZLayer = theZLayer;
490   if ( !myShape.IsNull() && isVisible() && !myContext.IsNull() && myZLayer >= 0 )
491     myContext->SetZLayer( myShape, myZLayer );
492 }
493
494 Handle_AIS_InteractiveObject HYDROGUI_Shape::createShape() const
495 {
496   if( myTopoShape.IsNull() )
497     return Handle_AIS_InteractiveObject();
498   else
499     return new AIS_Shape( myTopoShape );
500 }
501
502 void HYDROGUI_Shape::buildShape()
503 {
504   // Erase previously created shape
505   erase();
506
507   myShape = createShape();
508   if( myShape.IsNull() )
509     return;
510
511   Handle_AIS_Shape anAISShape = Handle_AIS_Shape::DownCast( myShape );
512   if( !anAISShape.IsNull() )
513     anAISShape ->SetHLRAngleAndDeviation( 0.001 );
514
515   if ( !myObject.IsNull() )
516     myShape->SetOwner( myObject );
517
518   myShape->SetTransparency( 0 );
519   myShape->SetDisplayMode( (AIS_DisplayMode)myDisplayMode );
520
521     // Init default params for shape
522   const Handle(Prs3d_Drawer)& anAttributes = myShape->Attributes();
523   if ( !anAttributes.IsNull() )
524   {
525     Handle(Prs3d_IsoAspect) anIsoAspect = anAttributes->UIsoAspect();
526     if ( !anIsoAspect.IsNull() ) {
527       anIsoAspect->SetNumber( 0 );
528       anAttributes->SetUIsoAspect( anIsoAspect );
529     }
530       
531     anIsoAspect = anAttributes->VIsoAspect();
532     if ( !anIsoAspect.IsNull() ) {
533       anIsoAspect->SetNumber( 0 );
534       anAttributes->SetVIsoAspect( anIsoAspect );
535     }
536
537     if ( myDisplayMode == AIS_Shaded )
538     {
539       Handle(Prs3d_ShadingAspect) aShadingAspect = anAttributes->ShadingAspect();
540       if ( !aShadingAspect.IsNull() )
541       {
542         Graphic3d_MaterialAspect aMatAspect( Graphic3d_NOM_PLASTIC );
543         //aMatAspect.SetAmbient( 1 );
544         //aMatAspect.SetDiffuse( 0 );
545
546         aShadingAspect->Aspect()->SetFrontMaterial( aMatAspect );
547         aShadingAspect->Aspect()->SetBackMaterial( aMatAspect );
548       }
549     }
550     else if ( myDisplayMode == AIS_WireFrame )
551     {
552       anAttributes->SetWireDraw( true );
553     }
554   }
555 }
556
557 void HYDROGUI_Shape::updateShape( const bool theToDisplay,
558                                   const bool theIsUpdateViewer )
559 {
560   if ( myShape.IsNull() )
561     return;
562
563   const Handle(Prs3d_Drawer)& anAttributes = myShape->Attributes();
564   if ( !anAttributes.IsNull() )
565   {
566     if ( myDisplayMode == AIS_Shaded )
567     {
568       // Coloring face filling
569       Handle(Prs3d_ShadingAspect) aShadingAspect = anAttributes->ShadingAspect();
570       if ( !aShadingAspect.IsNull() )
571       {
572         Quantity_Color aFillingColor( getQuantityColorVal( myFillingColor.red() ), 
573                                       getQuantityColorVal( myFillingColor.green() ),
574                                       getQuantityColorVal( myFillingColor.blue() ),
575                                       Quantity_TOC_RGB );
576
577         aShadingAspect->SetColor( aFillingColor );
578         aShadingAspect->SetTransparency( 1 - getQuantityColorVal( myFillingColor.alpha() ) );
579       }
580     }
581     else if ( myDisplayMode == AIS_WireFrame )
582     {
583     }
584
585     // Coloring borders
586     colorShapeBorder( getActiveColor() );
587   }
588
589   if ( !theToDisplay || !isVisible() || myContext.IsNull() )
590     return;
591   
592   displayShape( theIsUpdateViewer );
593 }
594
595 void HYDROGUI_Shape::displayShape( const bool theIsUpdateViewer )
596 {
597   myContext->Display( myShape, Standard_False );
598
599   if ( myZLayer >= 0 )
600     myContext->SetZLayer( myShape, myZLayer );
601
602   myContext->UpdateCurrentViewer();
603 }
604
605 QColor HYDROGUI_Shape::getActiveColor() const
606 {
607   return isHighlighted() ? myHighlightColor : myBorderColor;
608 }
609
610 double HYDROGUI_Shape::getQuantityColorVal( const int theColorVal )
611 {
612   return theColorVal == 0 ? 0 : ( (double)theColorVal / 255 );
613 }
614
615 void HYDROGUI_Shape::colorShapeBorder( const QColor& theColor )
616 {
617   if ( myShape.IsNull() )
618     return;
619
620   const Handle(Prs3d_Drawer)& anAttributes = myShape->Attributes();
621   if ( anAttributes.IsNull() )
622     return;
623
624   Quantity_Color aBorderColor( getQuantityColorVal( theColor.red() ), 
625                                getQuantityColorVal( theColor.green() ),
626                                getQuantityColorVal( theColor.blue() ),
627                                Quantity_TOC_RGB );
628   
629   if( !myTopoShape.IsNull() )
630   {
631     if ( myTopoShape.ShapeType() == TopAbs_WIRE ) // Note that we display polylines in shaded mode
632     {
633       myShape->SetColor( aBorderColor );
634     }
635     else if ( myDisplayMode == AIS_Shaded )
636     {
637       if ( theColor.alpha() == 0 )
638       {
639         anAttributes->SetFaceBoundaryDraw( false );
640       }
641       else
642       {
643         anAttributes->SetFaceBoundaryDraw( true );
644   
645         Handle(Prs3d_LineAspect) aBoundaryAspect = anAttributes->FaceBoundaryAspect();
646         if ( !aBoundaryAspect.IsNull() )
647         {
648           aBoundaryAspect->SetColor( aBorderColor );
649           anAttributes->SetFaceBoundaryAspect( aBoundaryAspect );
650         }
651         Handle(Prs3d_LineAspect) aWireAspect = anAttributes->WireAspect();
652         if ( !aWireAspect.IsNull() )
653         {
654           aWireAspect->SetColor( aBorderColor );
655           anAttributes->SetWireAspect( aWireAspect );
656         }
657       }
658     }
659     else if ( myDisplayMode == AIS_WireFrame )
660     {
661       myShape->SetColor( aBorderColor );
662     }
663   }
664 }
665
666 void HYDROGUI_Shape::setDisplayMode( int theDisplayMode )
667 {
668   myDisplayMode = theDisplayMode;
669 }