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