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