Salome HOME
refs #568: use ordered list view with selection synchronized with object browser...
[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_LandCover.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 <Prs3d_ShadingAspect.hxx>
42 #include <TopoDS.hxx>
43 #include <TopoDS_Face.hxx>
44 #include <TopoDS_Wire.hxx>
45 #include <TopExp_Explorer.hxx>
46
47 HYDROGUI_Shape::HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext,
48                                 const Handle(HYDROData_Entity)&       theObject,
49                                 const int                             theZLayer )
50 : myContext( theContext ),
51   myObject( theObject ),
52   myZLayer( theZLayer ),
53   myIsHighlight( false ),
54   myFillingColor( Qt::transparent ),
55   myBorderColor( Qt::black ),
56   myHighlightColor( Qt::white ),
57   myIsToUpdate( false ),
58   myIsVisible( true ),
59   myDisplayMode( AIS_Shaded )
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   myContext->Erase( myShape, 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         if ( aPolylineShape.ShapeType() == TopAbs_WIRE ) {
171           TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolylineShape );
172           setWire( aPolylineWire, false, false );  
173         } else {
174           myTopoShape = aPolylineShape;
175           // Set shading mode to avoid that hilight presentation is equal to "normal" object presentation.
176           // Note that hilight presentation is always to be on top ( i.e. in the top Z layer ).
177           myDisplayMode = AIS_Shaded;
178
179           buildShape();
180           updateShape( false, false );
181         }
182       }
183
184       QColor aWireColor = aPolyline->GetWireColor();
185       setBorderColor( aWireColor, false, false );
186     }
187     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Polyline3D) ) )
188     {
189       Handle(HYDROData_Polyline3D) aPolyline =
190         Handle(HYDROData_Polyline3D)::DownCast( myObject );
191
192       TopoDS_Shape aPolylineShape = aPolyline->GetShape3D();
193
194       if ( !aPolylineShape.IsNull() ) {
195         if ( aPolylineShape.ShapeType() == TopAbs_WIRE ) {
196           TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolylineShape );
197           setWire( aPolylineWire, false, false );  
198         } else {
199           myTopoShape = aPolylineShape;
200           // Set shading mode to avoid that hilight presentation is equal to "normal" object presentation.
201           // Note that hilight presentation is always to be on top ( i.e. in the top Z layer ).
202           myDisplayMode = AIS_Shaded;
203
204           buildShape();
205           updateShape( false, false );
206         }
207       }
208
209       QColor aWireColor = aPolyline->GetBorderColor();
210       setBorderColor( aWireColor, false, false );
211     }
212     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Zone) ) )
213     {
214       Handle(HYDROData_Zone) aZone =
215         Handle(HYDROData_Zone)::DownCast( myObject );
216
217       TopoDS_Face aZoneFace = TopoDS::Face( aZone->GetShape() );
218
219       setFace( aZoneFace, false, false, "" );
220       if (aZone->IsMergingNeed() && aZone->GetMergeType() == HYDROData_Zone::Merge_UNKNOWN )
221       {
222         // Red color for a zone with bathymetry conflict
223         setFillingColor( Qt::red );
224       }
225       else
226       {
227                 // Set the filling color for zone
228                 setFillingColor( aZone->GetColor(HYDROData_ImmersibleZone::DefaultFillingColor()) );
229       }
230     }
231     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Profile) ) )
232     {
233       Handle(HYDROData_Profile) aProfile =
234         Handle(HYDROData_Profile)::DownCast( myObject );
235
236       TopoDS_Wire aProfileWire;
237
238       if ( aProfile->IsValid() ) {
239         TopoDS_Shape aProfileShape = aProfile->GetShape3D();
240
241         if ( !aProfileShape.IsNull() && 
242              aProfileShape.ShapeType() == TopAbs_WIRE ) {
243           aProfileWire = TopoDS::Wire( aProfileShape );
244         }
245       }
246
247       setWire( aProfileWire, false, false );  
248
249       QColor aWireColor = aProfile->GetBorderColor();
250       setBorderColor( aWireColor, false, false );
251     }
252     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Stream) ) ||
253               myObject->IsKind( STANDARD_TYPE(HYDROData_Channel) ) ||
254               myObject->IsKind( STANDARD_TYPE(HYDROData_Obstacle) ) )
255     {
256       Handle(HYDROData_Object) aGeomObject =
257         Handle(HYDROData_Object)::DownCast( myObject );
258
259       TopoDS_Shape anObjShape = aGeomObject->GetTopShape();
260
261       setShape( anObjShape, false, false );
262
263       QColor aFillingColor = aGeomObject->GetFillingColor();
264       QColor aBorderColor = aGeomObject->GetBorderColor();
265
266       setFillingColor( aFillingColor, false, false );
267       setBorderColor( aBorderColor, false, false );
268     }
269     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_DummyObject3D) ) )
270     {
271       Handle(HYDROData_DummyObject3D) anObject3D =
272         Handle(HYDROData_DummyObject3D)::DownCast( myObject );
273       TopoDS_Shape aShape3D = anObject3D->GetShape();
274
275       setShape( aShape3D, false, false );
276
277       QColor aFillingColor = anObject3D->GetFillingColor();
278       QColor aBorderColor = anObject3D->GetBorderColor();
279
280       setFillingColor( aFillingColor, false, false );
281       setBorderColor( aBorderColor, false, false );
282     }
283     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_ShapesGroup) ) )
284     {
285       Handle(HYDROData_ShapesGroup) aShapesGroup =
286         Handle(HYDROData_ShapesGroup)::DownCast( myObject );
287
288       TopTools_SequenceOfShape aShapes;
289       aShapesGroup->GetShapes( aShapes );
290
291       TopoDS_Compound aCompound;
292       BRep_Builder aCompoundBuilder;
293       aCompoundBuilder.MakeCompound( aCompound );
294
295       for ( int i = 1, n = aShapes.Length(); i <= n; ++i )
296       {
297         const TopoDS_Shape& aShape = aShapes.Value( i );
298         aCompoundBuilder.Add( aCompound, aShape );
299       }
300
301       setShape( aCompound, false, false );  
302     }
303     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_LandCover) ) )
304     {
305       Handle(HYDROData_LandCover) aLandCoverObj =
306         Handle(HYDROData_LandCover)::DownCast( myObject );
307
308       TopoDS_Shape aLandCoverShape = aLandCoverObj->GetShape();
309       if ( !aLandCoverShape.IsNull() ) {
310         setShape( aLandCoverShape, false, false );
311       }
312
313       QColor aFillingColor = aLandCoverObj->GetFillingColor();
314       QColor aBorderColor = aLandCoverObj->GetBorderColor();
315
316       setFillingColor( aFillingColor, false, false );
317       setBorderColor( aBorderColor, false, false );
318     }
319   }
320  
321   if ( myShape.IsNull() || !isVisible() )
322     return;
323
324   displayShape( isUpdateViewer );
325
326   if (isDeactivateSelection)
327     myContext->Deactivate(myShape);
328 }
329
330 void HYDROGUI_Shape::setVisible( const bool theState,
331                                  const bool theIsUpdateViewer )
332 {
333   myIsVisible = theState;
334
335   if ( myShape.IsNull() )
336     return;
337
338   if ( ( myIsVisible && myContext->IsDisplayed( myShape ) ) ||
339        ( !myIsVisible && !myContext->IsDisplayed( myShape ) ) )
340     return;
341
342   if ( myIsVisible ) {
343     displayShape( theIsUpdateViewer );
344   }
345   else
346     myContext->Erase( myShape, theIsUpdateViewer );
347 }
348
349 void HYDROGUI_Shape::highlight( bool theIsHighlight, bool isUpdateViewer )
350 {
351   if ( myIsHighlight == theIsHighlight )
352     return;
353
354   myIsHighlight = theIsHighlight;
355
356   if ( myContext.IsNull() || myShape.IsNull() )
357     return;
358
359   colorShapeBorder( getActiveColor() );
360   displayShape( isUpdateViewer );
361 }
362
363 bool HYDROGUI_Shape::isHighlighted() const
364 {
365   return myIsHighlight;
366 }
367
368 void HYDROGUI_Shape::setWire( const TopoDS_Wire& theWire,
369                               const bool         theToDisplay,
370                               const bool         theIsUpdateViewer )
371 {
372   myTopoShape = theWire;
373   // To avoid that hilight presentation is equal to "normal" object presentation.
374   // Note that hilight presentation is always to be on top ( i.e. in the top Z layer ).
375   myDisplayMode = AIS_Shaded;
376
377   buildShape();
378   updateShape( theToDisplay, theIsUpdateViewer );
379 }
380
381 void HYDROGUI_Shape::setFaces( const TopoDS_Compound& theWires,
382                                const bool             theToDisplay,
383                                const bool             theIsUpdateViewer )
384 {
385   TopExp_Explorer anExp( theWires, TopAbs_WIRE );
386   TopoDS_Compound aCompound;
387   BRep_Builder aBuilder;
388     aBuilder.MakeCompound( aCompound );
389
390   for ( ; anExp.More(); anExp.Next() ) {
391     TopoDS_Wire aWire = TopoDS::Wire( anExp.Current() );
392     if ( aWire.IsNull() ) {
393       continue;
394     }
395
396     BRepBuilderAPI_MakeFace aMakeFace( aWire, Standard_True );
397     aMakeFace.Build();
398     if( aMakeFace.IsDone() ) {
399       aBuilder.Add( aCompound, aMakeFace.Face() );
400     }
401   }
402
403   myTopoShape = aCompound;
404   myDisplayMode = AIS_Shaded;
405
406   buildShape();
407   updateShape( theToDisplay, theIsUpdateViewer );
408 }
409
410 void HYDROGUI_Shape::setFace( const TopoDS_Wire& theWire,
411                               const bool         theToDisplay,
412                               const bool         theIsUpdateViewer,
413                               const QString&     theTextureFileName )
414 {
415   BRepBuilderAPI_MakeFace aFaceBuilder( theWire, Standard_True );
416   aFaceBuilder.Build();
417   if( aFaceBuilder.IsDone() )
418   {
419     TopoDS_Face aFace = aFaceBuilder.Face();
420     setFace( aFace, theToDisplay, theIsUpdateViewer, theTextureFileName );
421   }
422 }
423
424 void HYDROGUI_Shape::setFace( const TopoDS_Face& theFace,
425                               const bool         theToDisplay,
426                               const bool         theIsUpdateViewer,
427                               const QString&     theTextureFileName )
428 {
429   myTopoShape = theFace;
430   myDisplayMode = theTextureFileName.isEmpty() ? AIS_Shaded : AIS_Shaded+2;
431   //Note: AIS_Shaded+2 is the same as AIS_ExactHLR
432   //TODO: it would be more suitable to use TexturedShape mode from GEOM_AISShape
433
434   buildShape();
435   updateShape( theToDisplay, theIsUpdateViewer );
436 }
437
438 void HYDROGUI_Shape::setShape( const TopoDS_Shape& theShape,
439                                const bool          theToDisplay,
440                                const bool          theIsUpdateViewer )
441 {
442   myTopoShape = theShape;
443   myDisplayMode = AIS_Shaded;
444
445   buildShape();
446   updateShape( theToDisplay, theIsUpdateViewer );
447 }
448
449 void HYDROGUI_Shape::setFillingColor( const QColor& theColor,
450                                       const bool    theToDisplay,
451                                       const bool    theIsUpdateViewer )
452 {
453   myFillingColor = theColor;
454   updateShape( theToDisplay, theIsUpdateViewer );
455 }
456
457 QColor HYDROGUI_Shape::getFillingColor() const
458 {
459   return myFillingColor;
460 }
461
462 void HYDROGUI_Shape::setBorderColor( const QColor& theColor,
463                                      const bool    theToDisplay,
464                                      const bool    theIsUpdateViewer )
465 {
466   myBorderColor = theColor;
467   updateShape( theToDisplay, theIsUpdateViewer );
468 }
469
470 QColor HYDROGUI_Shape::getBorderColor() const
471 {
472   return myBorderColor;
473 }
474
475 void HYDROGUI_Shape::setHighlightColor( const QColor& theColor )
476 {
477   myHighlightColor = theColor;
478 }
479
480 QColor HYDROGUI_Shape::getHighlightColor() const
481 {
482   return myHighlightColor;
483 }
484
485 void HYDROGUI_Shape::setZLayer( const int theZLayer )
486 {
487   if ( myZLayer == theZLayer )
488     return;
489
490   myZLayer = theZLayer;
491   if ( !myShape.IsNull() && isVisible() && !myContext.IsNull() && myZLayer >= 0 )
492     myContext->SetZLayer( myShape, myZLayer );
493 }
494
495 Handle_AIS_InteractiveObject HYDROGUI_Shape::createShape() const
496 {
497   if( myTopoShape.IsNull() )
498     return Handle_AIS_InteractiveObject();
499   
500   TopAbs_ShapeEnum aShapeType = myTopoShape.ShapeType();
501   if ( aShapeType==TopAbs_EDGE || aShapeType==TopAbs_WIRE ) {
502     return new HYDROGUI_Polyline( myTopoShape );
503   } else {
504     return new AIS_Shape( myTopoShape );
505   }
506 }
507
508 void HYDROGUI_Shape::buildShape()
509 {
510   // Erase previously created shape
511   erase();
512
513   myShape = createShape();
514   if( myShape.IsNull() )
515     return;
516
517   Handle_AIS_Shape anAISShape = Handle_AIS_Shape::DownCast( myShape );
518   if( !anAISShape.IsNull() )
519     anAISShape ->SetHLRAngleAndDeviation( 0.001 );
520
521   if ( !myObject.IsNull() )
522     myShape->SetOwner( myObject );
523
524   myShape->SetTransparency( 0 );
525   myShape->SetDisplayMode( (AIS_DisplayMode)myDisplayMode );
526
527     // Init default params for shape
528   const Handle(Prs3d_Drawer)& anAttributes = myShape->Attributes();
529   if ( !anAttributes.IsNull() )
530   {
531     Handle(Prs3d_IsoAspect) anIsoAspect = anAttributes->UIsoAspect();
532     if ( !anIsoAspect.IsNull() ) {
533       anIsoAspect->SetNumber( 0 );
534       anAttributes->SetUIsoAspect( anIsoAspect );
535     }
536       
537     anIsoAspect = anAttributes->VIsoAspect();
538     if ( !anIsoAspect.IsNull() ) {
539       anIsoAspect->SetNumber( 0 );
540       anAttributes->SetVIsoAspect( anIsoAspect );
541     }
542
543     if ( myDisplayMode == AIS_Shaded )
544     {
545       Handle(Prs3d_ShadingAspect) aShadingAspect = anAttributes->ShadingAspect();
546       if ( !aShadingAspect.IsNull() )
547       {
548         Graphic3d_MaterialAspect aMatAspect( Graphic3d_NOM_PLASTIC );
549         //aMatAspect.SetAmbient( 1 );
550         //aMatAspect.SetDiffuse( 0 );
551
552         aShadingAspect->Aspect()->SetFrontMaterial( aMatAspect );
553         aShadingAspect->Aspect()->SetBackMaterial( aMatAspect );
554       }
555     }
556     else if ( myDisplayMode == AIS_WireFrame )
557     {
558       anAttributes->SetWireDraw( true );
559     }
560   }
561 }
562
563 void HYDROGUI_Shape::updateShape( const bool theToDisplay,
564                                   const bool theIsUpdateViewer )
565 {
566   if ( myShape.IsNull() )
567     return;
568
569   const Handle(Prs3d_Drawer)& anAttributes = myShape->Attributes();
570   if ( !anAttributes.IsNull() )
571   {
572     if ( myDisplayMode == AIS_Shaded )
573     {
574       // Coloring face filling
575       Handle(Prs3d_ShadingAspect) aShadingAspect = anAttributes->ShadingAspect();
576       if ( !aShadingAspect.IsNull() )
577       {
578         Quantity_Color aFillingColor( getQuantityColorVal( myFillingColor.red() ), 
579                                       getQuantityColorVal( myFillingColor.green() ),
580                                       getQuantityColorVal( myFillingColor.blue() ),
581                                       Quantity_TOC_RGB );
582
583         aShadingAspect->SetColor( aFillingColor );
584         aShadingAspect->SetTransparency( 1 - getQuantityColorVal( myFillingColor.alpha() ) );
585       }
586     }
587     else if ( myDisplayMode == AIS_WireFrame )
588     {
589     }
590
591     // Coloring borders
592     colorShapeBorder( getActiveColor() );
593   }
594
595   if ( !theToDisplay || !isVisible() || myContext.IsNull() )
596     return;
597   
598   displayShape( theIsUpdateViewer );
599 }
600
601 void HYDROGUI_Shape::displayShape( const bool theIsUpdateViewer )
602 {
603   myContext->Display( myShape, Standard_False );
604
605   if ( myZLayer >= 0 )
606     myContext->SetZLayer( myShape, myZLayer );
607
608   myContext->UpdateCurrentViewer();
609 }
610
611 QColor HYDROGUI_Shape::getActiveColor() const
612 {
613   return isHighlighted() ? myHighlightColor : myBorderColor;
614 }
615
616 double HYDROGUI_Shape::getQuantityColorVal( const int theColorVal )
617 {
618   return theColorVal == 0 ? 0 : ( (double)theColorVal / 255 );
619 }
620
621 void HYDROGUI_Shape::colorShapeBorder( const QColor& theColor )
622 {
623   if ( myShape.IsNull() )
624     return;
625
626   const Handle(Prs3d_Drawer)& anAttributes = myShape->Attributes();
627   if ( anAttributes.IsNull() )
628     return;
629
630   Quantity_Color aBorderColor( getQuantityColorVal( theColor.red() ), 
631                                getQuantityColorVal( theColor.green() ),
632                                getQuantityColorVal( theColor.blue() ),
633                                Quantity_TOC_RGB );
634   
635   if( !myTopoShape.IsNull() )
636   {
637     if ( myTopoShape.ShapeType() == TopAbs_WIRE ) // Note that we display polylines in shaded mode
638     {
639       myShape->SetColor( aBorderColor );
640     }
641     else if ( myDisplayMode == AIS_Shaded )
642     {
643       if ( theColor.alpha() == 0 )
644       {
645         anAttributes->SetFaceBoundaryDraw( false );
646       }
647       else
648       {
649         anAttributes->SetFaceBoundaryDraw( true );
650   
651         Handle(Prs3d_LineAspect) aBoundaryAspect = anAttributes->FaceBoundaryAspect();
652         if ( !aBoundaryAspect.IsNull() )
653         {
654           aBoundaryAspect->SetColor( aBorderColor );
655           anAttributes->SetFaceBoundaryAspect( aBoundaryAspect );
656         }
657         Handle(Prs3d_LineAspect) aWireAspect = anAttributes->WireAspect();
658         if ( !aWireAspect.IsNull() )
659         {
660           aWireAspect->SetColor( aBorderColor );
661           anAttributes->SetWireAspect( aWireAspect );
662         }
663       }
664     }
665     else if ( myDisplayMode == AIS_WireFrame )
666     {
667       myShape->SetColor( aBorderColor );
668     }
669   }
670 }
671
672 void HYDROGUI_Shape::setDisplayMode( int theDisplayMode )
673 {
674   myDisplayMode = theDisplayMode;
675 }