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.
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.
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
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include <HYDROGUI_Shape.h>
20 #include <HYDROGUI_Tool.h>
21 #include <HYDROGUI_Polyline.h>
22 #include <HYDROGUI_AISShape.h>
24 #include <HYDROData_Channel.h>
25 #include <HYDROData_Document.h>
26 #include <HYDROData_DummyObject3D.h>
27 #include <HYDROData_ImmersibleZone.h>
28 #include <HYDROData_BCPolygon.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 #include <HYDROData_LandCoverMap.h>
38 #include <BRep_Builder.hxx>
39 #include <BRepBuilderAPI_MakeFace.hxx>
40 #include <Prs3d_IsoAspect.hxx>
42 #include <TopoDS_Face.hxx>
43 #include <TopoDS_Wire.hxx>
44 #include <TopExp_Explorer.hxx>
47 #include <SUIT_ResourceMgr.h>
48 #include <SUIT_Session.h>
50 HYDROGUI_Shape::HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext,
51 const Handle(HYDROData_Entity)& theObject,
53 : myContext( theContext ),
54 myObject( theObject ),
55 myZLayer( theZLayer ),
56 myIsHighlight( false ),
57 myFillingColor( Qt::transparent ),
58 myBorderColor( Qt::black ),
59 myHighlightColor( Qt::white ),
60 myIsToUpdate( false ),
62 myDisplayMode( AIS_Shaded ),
63 mySelectionMode( AIS_Shape::SelectionMode( TopAbs_SHAPE ) )
67 HYDROGUI_Shape::~HYDROGUI_Shape()
72 Handle(AIS_InteractiveContext) HYDROGUI_Shape::getContext() const
77 Handle(HYDROData_Entity) HYDROGUI_Shape::getObject() const
82 TopoDS_Shape HYDROGUI_Shape::getTopoShape() const
87 bool HYDROGUI_Shape::getIsToUpdate() const
92 void HYDROGUI_Shape::setIsToUpdate( bool theState )
94 myIsToUpdate = theState;
97 bool HYDROGUI_Shape::isVisible() const
102 QList<Handle(AIS_InteractiveObject)> HYDROGUI_Shape::getAISObjects() const
107 void HYDROGUI_Shape::display( const bool theIsUpdateViewer )
109 if ( myContext.IsNull() || myShapes.empty() || !isVisible() )
112 displayShape( theIsUpdateViewer );
115 void HYDROGUI_Shape::erase( const bool theIsUpdateViewer )
117 if ( myContext.IsNull() || myShapes.empty() )
120 eraseShape( theIsUpdateViewer );
123 void HYDROGUI_Shape::update( bool isUpdateViewer,
124 bool isDeactivateSelection )
127 setIsToUpdate( false );
129 if ( myContext.IsNull() )
132 // Try to retrieve information from object
133 if ( !myObject.IsNull() )
135 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myObject->Label() );
137 if ( myObject->IsKind( STANDARD_TYPE(HYDROData_ImmersibleZone) ) )
139 Handle(HYDROData_ImmersibleZone) aZoneObj =
140 Handle(HYDROData_ImmersibleZone)::DownCast( myObject );
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, "" );
148 myTopoShape = aZoneShape;
149 //TODO: myDisplayMode = myTextureFileName.isEmpty() ? AIS_Shaded : AIS_Shaded+2;
150 myDisplayMode = AIS_Shaded;
153 updateShape( false, false );
157 QColor aFillingColor = aZoneObj->GetFillingColor();
158 QColor aBorderColor = aZoneObj->GetBorderColor();
160 setFillingColor( aFillingColor, false, false );
161 setBorderColor( aBorderColor, false, false );
163 else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_PolylineXY) ) )
165 Handle(HYDROData_PolylineXY) aPolyline =
166 Handle(HYDROData_PolylineXY)::DownCast( myObject );
168 TopoDS_Shape aPolylineShape = aPolyline->GetShape();
170 if ( !aPolylineShape.IsNull() )
172 if ( aPolylineShape.ShapeType() == TopAbs_WIRE )
174 TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolylineShape );
175 setWire( aPolylineWire, false, false );
179 myTopoShape = aPolylineShape;
180 // Set shading mode to avoid that hilight presentation is equal to "normal" object presentation.
181 // Note that hilight presentation is always to be on top ( i.e. in the top Z layer ).
182 myDisplayMode = AIS_Shaded;
185 updateShape( false, false );
189 //QColor aWireColor = aPolyline->GetWireColor();
190 std::vector<QColor> aSectColors;
191 //TODO backward comp. with old aWireColor??
192 int nbSec = aPolyline->NbSections();
193 for (int i = 0; i < nbSec; i++)
196 aPolyline->GetSectionColor(i, aColor);
197 aSectColors.push_back(aColor);
201 //setBorderColor( aWireColor, false, false );
203 foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
205 if( !myTopoShape.IsNull() )
207 Handle(HYDROGUI_Polyline) aPShape = Handle(HYDROGUI_Polyline)::DownCast( aShape );
208 bool WireOrCmp = myTopoShape.ShapeType() == TopAbs_WIRE || myTopoShape.ShapeType() == TopAbs_COMPOUND;
209 if ( !aPShape.IsNull() && WireOrCmp)
211 TopTools_IndexedMapOfShape MW;
212 TopExp::MapShapes(myTopoShape, TopAbs_WIRE, MW);
213 if (MW.Extent() == nbSec)
215 for (int i=0;i<nbSec;i++)
217 const TopoDS_Shape& CW = MW(i+1);
218 Quantity_Color aFColor( getQuantityColorVal( aSectColors[i].red() ),
219 getQuantityColorVal( aSectColors[i].green() ),
220 getQuantityColorVal( aSectColors[i].blue() ),
222 aPShape->myShapeToColor.Add(CW, aFColor);
229 //if ( theToDisplay && isVisible() && !myContext.IsNull() )
230 // displayShape( false );
232 else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Polyline3D) ) )
234 Handle(HYDROData_Polyline3D) aPolyline =
235 Handle(HYDROData_Polyline3D)::DownCast( myObject );
237 TopoDS_Shape aPolylineShape = aPolyline->GetShape3D();
239 if ( !aPolylineShape.IsNull() ) {
240 if ( aPolylineShape.ShapeType() == TopAbs_WIRE ) {
241 TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolylineShape );
242 setWire( aPolylineWire, false, false );
244 myTopoShape = aPolylineShape;
245 // Set shading mode to avoid that hilight presentation is equal to "normal" object presentation.
246 // Note that hilight presentation is always to be on top ( i.e. in the top Z layer ).
247 myDisplayMode = AIS_Shaded;
250 updateShape( false, false );
254 QColor aWireColor = aPolyline->GetBorderColor();
255 setBorderColor( aWireColor, false, false );
257 else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Zone) ) )
259 Handle(HYDROData_Zone) aZone =
260 Handle(HYDROData_Zone)::DownCast( myObject );
262 TopoDS_Face aZoneFace = TopoDS::Face( aZone->GetShape() );
264 setFace( aZoneFace, false, false, "" );
265 if( aZone->IsMergingNeed() && aZone->GetMergeType() == HYDROData_Zone::Merge_UNKNOWN )
267 // Red color for a zone with bathymetry conflict
268 setFillingColor( Qt::red );
272 // Set the filling color for zone
273 setFillingColor( aZone->GetColor( Qt::darkBlue ) );
276 else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Profile) ) )
278 Handle(HYDROData_Profile) aProfile =
279 Handle(HYDROData_Profile)::DownCast( myObject );
281 TopoDS_Wire aProfileWire;
283 if ( aProfile->IsValid() ) {
284 TopoDS_Shape aProfileShape = aProfile->GetShape3D();
286 if ( !aProfileShape.IsNull() &&
287 aProfileShape.ShapeType() == TopAbs_WIRE ) {
288 aProfileWire = TopoDS::Wire( aProfileShape );
292 setWire( aProfileWire, false, false );
294 QColor aWireColor = aProfile->GetBorderColor();
295 setBorderColor( aWireColor, false, false );
297 else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Stream) ) ||
298 myObject->IsKind( STANDARD_TYPE(HYDROData_Channel) ) ||
299 myObject->IsKind( STANDARD_TYPE(HYDROData_Obstacle) ) )
301 Handle(HYDROData_Object) aGeomObject =
302 Handle(HYDROData_Object)::DownCast( myObject );
304 TopoDS_Shape anObjShape = aGeomObject->GetTopShape();
306 setShape( anObjShape, false, false );
308 QColor aFillingColor = aGeomObject->GetFillingColor();
309 QColor aBorderColor = aGeomObject->GetBorderColor();
311 setFillingColor( aFillingColor, false, false );
312 setBorderColor( aBorderColor, false, false );
314 else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_DummyObject3D) ) )
316 Handle(HYDROData_DummyObject3D) anObject3D =
317 Handle(HYDROData_DummyObject3D)::DownCast( myObject );
318 TopoDS_Shape aShape3D = anObject3D->GetShape();
320 setShape( aShape3D, false, false );
322 QColor aFillingColor = anObject3D->GetFillingColor();
323 QColor aBorderColor = anObject3D->GetBorderColor();
325 setFillingColor( aFillingColor, false, false );
326 setBorderColor( aBorderColor, false, false );
328 else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_ShapesGroup) ) )
330 Handle(HYDROData_ShapesGroup) aShapesGroup =
331 Handle(HYDROData_ShapesGroup)::DownCast( myObject );
333 TopTools_SequenceOfShape aShapes;
334 aShapesGroup->GetShapes( aShapes );
336 TopoDS_Compound aCompound;
337 BRep_Builder aCompoundBuilder;
338 aCompoundBuilder.MakeCompound( aCompound );
340 for ( int i = 1, n = aShapes.Length(); i <= n; ++i )
342 const TopoDS_Shape& aShape = aShapes.Value( i );
343 aCompoundBuilder.Add( aCompound, aShape );
346 setShape( aCompound, false, false );
348 else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_BCPolygon) ) )
350 Handle(HYDROData_BCPolygon) aBCObj = Handle(HYDROData_BCPolygon)::DownCast( myObject );
352 TopoDS_Shape aBCShape = aBCObj->GetTopShape();
353 if ( !aBCShape.IsNull() )
355 if ( aBCShape.ShapeType() == TopAbs_FACE )
357 TopoDS_Face aBCFace = TopoDS::Face( aBCShape );
358 setFace( aBCFace, false, false, "" );
362 myTopoShape = aBCShape;
363 myDisplayMode = AIS_Shaded;
365 updateShape( false, false );
369 QColor aFillingColor = aBCObj->GetFillingColor();
370 QColor aBorderColor = aBCObj->GetBorderColor();
371 aFillingColor.setAlpha(175);
373 setFillingColor( aFillingColor, false, false );
374 setBorderColor( aBorderColor, false, false );
379 if ( myShapes.empty() || !isVisible() )
382 displayShape( isUpdateViewer );
384 if (isDeactivateSelection)
385 foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
386 myContext->Deactivate( aShape );
389 void HYDROGUI_Shape::setVisible( const bool theState,
390 const bool theIsUpdateViewer )
392 myIsVisible = theState;
394 if ( myShapes.empty() )
397 if ( ( myIsVisible && myContext->IsDisplayed( myShapes[0] ) ) ||
398 ( !myIsVisible && !myContext->IsDisplayed( myShapes[0] ) ) )
402 displayShape( theIsUpdateViewer );
405 eraseShape( theIsUpdateViewer );
408 void HYDROGUI_Shape::highlight( bool theIsHighlight, bool isUpdateViewer )
410 if ( myIsHighlight == theIsHighlight )
413 myIsHighlight = theIsHighlight;
415 if ( myContext.IsNull() || myShapes.empty() )
418 colorShapeBorder( getActiveColor() );
419 displayShape( isUpdateViewer );
422 bool HYDROGUI_Shape::isHighlighted() const
424 return myIsHighlight;
427 void HYDROGUI_Shape::setWire( const TopoDS_Wire& theWire,
428 const bool theToDisplay,
429 const bool theIsUpdateViewer )
431 myTopoShape = theWire;
432 // To avoid that hilight presentation is equal to "normal" object presentation.
433 // Note that hilight presentation is always to be on top ( i.e. in the top Z layer ).
434 myDisplayMode = AIS_Shaded;
437 updateShape( theToDisplay, theIsUpdateViewer );
440 void HYDROGUI_Shape::setFaces( const TopoDS_Compound& theWires,
441 const bool theToDisplay,
442 const bool theIsUpdateViewer )
444 TopExp_Explorer anExp( theWires, TopAbs_WIRE );
445 TopoDS_Compound aCompound;
446 BRep_Builder aBuilder;
447 aBuilder.MakeCompound( aCompound );
449 for ( ; anExp.More(); anExp.Next() ) {
450 TopoDS_Wire aWire = TopoDS::Wire( anExp.Current() );
451 if ( aWire.IsNull() ) {
455 BRepBuilderAPI_MakeFace aMakeFace( aWire, Standard_True );
457 if( aMakeFace.IsDone() ) {
458 aBuilder.Add( aCompound, aMakeFace.Face() );
462 myTopoShape = aCompound;
463 myDisplayMode = AIS_Shaded;
466 updateShape( theToDisplay, theIsUpdateViewer );
469 void HYDROGUI_Shape::setFace( const TopoDS_Wire& theWire,
470 const bool theToDisplay,
471 const bool theIsUpdateViewer,
472 const QString& theTextureFileName )
474 BRepBuilderAPI_MakeFace aFaceBuilder( theWire, Standard_True );
475 aFaceBuilder.Build();
476 if( aFaceBuilder.IsDone() )
478 TopoDS_Face aFace = aFaceBuilder.Face();
479 setFace( aFace, theToDisplay, theIsUpdateViewer, theTextureFileName );
483 void HYDROGUI_Shape::setFace( const TopoDS_Face& theFace,
484 const bool theToDisplay,
485 const bool theIsUpdateViewer,
486 const QString& theTextureFileName )
488 myTopoShape = theFace;
489 myDisplayMode = theTextureFileName.isEmpty() ? AIS_Shaded : AIS_Shaded+2;
490 //Note: AIS_Shaded+2 is the same as AIS_ExactHLR
491 //TODO: it would be more suitable to use TexturedShape mode from GEOM_AISShape
494 updateShape( theToDisplay, theIsUpdateViewer );
497 void HYDROGUI_Shape::setShape( const TopoDS_Shape& theShape,
498 const bool theToDisplay,
499 const bool theIsUpdateViewer,
500 const int theDisplayMode )
502 myTopoShape = theShape;
503 myDisplayMode = theDisplayMode;
506 updateShape( theToDisplay, theIsUpdateViewer );
509 void HYDROGUI_Shape::setFillingColor( const QColor& theColor,
510 const bool theToDisplay,
511 const bool theIsUpdateViewer )
513 myFillingColor = theColor;
514 updateShape( theToDisplay, theIsUpdateViewer );
517 QColor HYDROGUI_Shape::getFillingColor() const
519 return myFillingColor;
522 void HYDROGUI_Shape::setBorderColor( const QColor& theColor,
523 const bool theToDisplay,
524 const bool theIsUpdateViewer )
526 myBorderColor = theColor;
527 updateShape( theToDisplay, theIsUpdateViewer );
530 QColor HYDROGUI_Shape::getBorderColor() const
532 return myBorderColor;
535 void HYDROGUI_Shape::setHighlightColor( const QColor& theColor )
537 myHighlightColor = theColor;
540 QColor HYDROGUI_Shape::getHighlightColor() const
542 return myHighlightColor;
545 void HYDROGUI_Shape::setZLayer( const int theZLayer )
547 if ( myZLayer == theZLayer )
550 myZLayer = theZLayer;
551 if( isVisible() && !myContext.IsNull() && myZLayer >= 0 )
552 foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
553 myContext->SetZLayer( aShape, myZLayer );
556 QList<Handle(AIS_InteractiveObject)> HYDROGUI_Shape::createShape() const
558 QList<Handle(AIS_InteractiveObject)> shapes;
559 if( myTopoShape.IsNull() ) {
563 TopAbs_ShapeEnum aShapeType = myTopoShape.ShapeType();
564 bool IsWireEdgeCompound = aShapeType==TopAbs_COMPOUND;
565 if (IsWireEdgeCompound) {
566 TopoDS_Iterator itr(myTopoShape);
567 while (itr.More() && IsWireEdgeCompound) {
568 if (itr.Value().ShapeType() != TopAbs_WIRE && itr.Value().ShapeType() != TopAbs_EDGE)
569 IsWireEdgeCompound = false;
574 if ( aShapeType==TopAbs_EDGE || aShapeType==TopAbs_WIRE || IsWireEdgeCompound)
576 SUIT_ResourceMgr* aResMgr = 0;
577 SUIT_Session* aSession = SUIT_Session::session();
579 aResMgr = SUIT_Session::session()->resourceMgr();
584 if( myShapes.length()>1 )
586 Handle(HYDROGUI_Arrow) arrow = Handle(HYDROGUI_Arrow)::DownCast( myShapes[1] );
587 if( !arrow.IsNull() )
589 aType = arrow->GetType();
590 aSize = arrow->GetSize();
593 if( aResMgr && ( aType<0 || aSize < 0 ) )
595 aResMgr->value( "polyline", "arrow_type", aType );
596 aResMgr->value( "polyline", "arrow_size", aSize );
599 shapes.append( HYDROGUI_Polyline::createPresentations( myTopoShape, aType, aSize ) );
603 shapes.append( new HYDROGUI_AISShape( myTopoShape ) );
608 void HYDROGUI_Shape::buildShape()
610 // Erase previously created shape
613 myShapes = createShape();
614 if( myShapes.empty() )
617 foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
619 Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast( aShape );
620 if( !anAISShape.IsNull() )
621 anAISShape ->SetHLRAngleAndDeviation( 0.001 );
623 if ( !myObject.IsNull() )
624 aShape->SetOwner( myObject );
626 if ( !myObject.IsNull() && !myObject->IsKind( STANDARD_TYPE(HYDROData_LandCoverMap) ) )
627 aShape->SetTransparency( 0 );
628 aShape->SetDisplayMode( (AIS_DisplayMode)myDisplayMode );
630 // Init default params for shape
631 const Handle(Prs3d_Drawer)& anAttributes = aShape->Attributes();
632 if ( !anAttributes.IsNull() )
634 Handle(Prs3d_IsoAspect) anIsoAspect = anAttributes->UIsoAspect();
635 if ( !anIsoAspect.IsNull() ) {
636 anIsoAspect->SetNumber( 0 );
637 anAttributes->SetUIsoAspect( anIsoAspect );
640 anIsoAspect = anAttributes->VIsoAspect();
641 if ( !anIsoAspect.IsNull() )
643 anIsoAspect->SetNumber( 0 );
644 anAttributes->SetVIsoAspect( anIsoAspect );
647 if ( myDisplayMode == AIS_Shaded )
649 aShape->SetMaterial( Graphic3d_NOM_PLASTIC );
651 else if ( myDisplayMode == AIS_WireFrame )
653 anAttributes->SetWireDraw( true );
659 void HYDROGUI_Shape::updateShape( const bool theToDisplay,
660 const bool theIsUpdateViewer )
662 foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
664 const Handle(Prs3d_Drawer)& anAttributes = aShape->Attributes();
665 if ( !anAttributes.IsNull() )
667 if ( myDisplayMode == AIS_Shaded && myFillingColor.isValid() )
669 Quantity_Color aFillingColor( getQuantityColorVal( myFillingColor.red() ),
670 getQuantityColorVal( myFillingColor.green() ),
671 getQuantityColorVal( myFillingColor.blue() ),
674 aShape->SetColor( aFillingColor );
675 aShape->SetTransparency( 1 - getQuantityColorVal( myFillingColor.alpha() ) );
677 else if ( myDisplayMode == AIS_WireFrame )
685 colorShapeBorder( myBorderColor );
686 if ( !theToDisplay || !isVisible() || myContext.IsNull() )
689 displayShape( theIsUpdateViewer );
692 void HYDROGUI_Shape::displayShape( const bool theIsUpdateViewer )
694 if ( myContext->HasOpenedContext() && mySelectionMode > 0 )
695 myContext->CloseLocalContext();
697 foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
699 if ( mySelectionMode > 0 )
700 // Display object in local context with selection
701 myContext->Display( aShape, myDisplayMode, mySelectionMode, Standard_False, Standard_False );
704 if ( !myContext->HasOpenedContext() )
705 // Ordinary display of object published in the Object Browser
706 myContext->Display( aShape, Standard_False );
708 // Display object in local context without selection
709 myContext->Display( aShape, myDisplayMode, -1, Standard_False, Standard_False );
713 if ( mySelectionMode > 0 )
715 myContext->OpenLocalContext();
716 foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
717 myContext->Activate( aShape, mySelectionMode, Standard_True );
722 foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
723 myContext->SetZLayer( aShape, myZLayer );
726 if ( theIsUpdateViewer ) {
727 myContext->UpdateCurrentViewer();
731 void HYDROGUI_Shape::eraseShape( const bool theIsUpdateViewer )
733 if ( myContext->HasOpenedContext() && mySelectionMode > 0 )
734 myContext->CloseLocalContext();
736 foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
737 myContext->Erase( aShape, Standard_False );
739 if( theIsUpdateViewer )
740 myContext->UpdateCurrentViewer();
743 QColor HYDROGUI_Shape::getActiveColor() const
745 return isHighlighted() ? myHighlightColor : myBorderColor;
748 double HYDROGUI_Shape::getQuantityColorVal( const int theColorVal )
750 return theColorVal == 0 ? 0 : ( (double)theColorVal / 255 );
753 void HYDROGUI_Shape::colorShapeBorder( const QColor& theColor )
755 foreach( Handle(AIS_InteractiveObject) aShape1, myShapes )
757 const Handle(Prs3d_Drawer)& anAttributes = aShape1->Attributes();
758 if ( anAttributes.IsNull() )
761 Quantity_Color aBorderColor( getQuantityColorVal( theColor.red() ),
762 getQuantityColorVal( theColor.green() ),
763 getQuantityColorVal( theColor.blue() ),
766 if( !myTopoShape.IsNull() )
768 if ( myTopoShape.ShapeType() == TopAbs_WIRE ) // Note that we display polylines in shaded mode
770 aShape1->SetColor( aBorderColor );
772 else if ( myDisplayMode == AIS_Shaded )
774 Handle(HYDROGUI_AISShape) aShape = Handle(HYDROGUI_AISShape)::DownCast( aShape1 );
775 if( !aShape.IsNull() )
776 aShape->SetBorderColor( aBorderColor );
778 else if ( myDisplayMode == AIS_WireFrame )
780 aShape1->SetColor( aBorderColor );
786 void HYDROGUI_Shape::setDisplayMode( int theDisplayMode )
788 myDisplayMode = theDisplayMode;
791 void HYDROGUI_Shape::setSelectionMode( int theSelectionMode )
793 mySelectionMode = theSelectionMode;