1 // Created on: 2014-04-24
2 // Created by: Kirill Gavrilov
3 // Copyright (c) 2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <AIS_ColoredShape.hxx>
18 #include <AIS_InteractiveContext.hxx>
19 #include <BRep_Builder.hxx>
20 #include <BRepTools.hxx>
21 #include <gp_Pnt2d.hxx>
22 #include <Graphic3d_AspectFillArea3d.hxx>
23 #include <Graphic3d_AspectLine3d.hxx>
24 #include <Graphic3d_ArrayOfTriangles.hxx>
25 #include <Graphic3d_ArrayOfSegments.hxx>
26 #include <Graphic3d_Group.hxx>
27 #include <Graphic3d_StructureManager.hxx>
28 #include <Graphic3d_Texture2Dmanual.hxx>
29 #include <Precision.hxx>
31 #include <Prs3d_LineAspect.hxx>
32 #include <Prs3d_IsoAspect.hxx>
33 #include <Prs3d_Presentation.hxx>
34 #include <Prs3d_ShadingAspect.hxx>
35 #include <Prs3d_Root.hxx>
36 #include <PrsMgr_PresentationManager3d.hxx>
37 #include <Standard_ErrorHandler.hxx>
38 #include <StdPrs_ShadedShape.hxx>
39 #include <StdPrs_ToolTriangulatedShape.hxx>
40 #include <StdPrs_WFShape.hxx>
41 #include <TopExp_Explorer.hxx>
43 #include <TopoDS_Compound.hxx>
44 #include <TopoDS_Iterator.hxx>
46 IMPLEMENT_STANDARD_RTTIEXT(AIS_ColoredShape,AIS_Shape)
47 IMPLEMENT_STANDARD_RTTIEXT(AIS_ColoredDrawer,Prs3d_Drawer)
51 //! Collect all sub-compounds into map.
52 static void collectSubCompounds (TopTools_MapOfShape& theMap,
53 const TopoDS_Shape& theShape)
55 for (TopoDS_Iterator aChildIter (theShape); aChildIter.More(); aChildIter.Next())
57 const TopoDS_Shape& aShape = aChildIter.Value();
58 if (aShape.ShapeType() == TopAbs_COMPOUND
59 && theMap.Add (aShape))
61 collectSubCompounds (theMap, aShape);
67 //=======================================================================
68 //function : AIS_ColoredShape
70 //=======================================================================
71 AIS_ColoredShape::AIS_ColoredShape (const TopoDS_Shape& theShape)
72 : AIS_Shape (theShape)
74 // disable dedicated line aspects
75 myDrawer->SetFreeBoundaryAspect (myDrawer->LineAspect());
76 myDrawer->SetUnFreeBoundaryAspect(myDrawer->LineAspect());
77 myDrawer->SetSeenLineAspect (myDrawer->LineAspect());
80 //=======================================================================
81 //function : AIS_ColoredShape
83 //=======================================================================
84 AIS_ColoredShape::AIS_ColoredShape (const Handle(AIS_Shape)& theShape)
85 : AIS_Shape (theShape->Shape())
87 // disable dedicated line aspects
88 myDrawer->SetFreeBoundaryAspect (myDrawer->LineAspect());
89 myDrawer->SetUnFreeBoundaryAspect(myDrawer->LineAspect());
90 myDrawer->SetSeenLineAspect (myDrawer->LineAspect());
91 if (theShape->HasMaterial())
93 SetMaterial (theShape->Material());
95 if (theShape->HasColor())
97 Quantity_Color aColor;
98 theShape->Color (aColor);
101 if (theShape->HasWidth())
103 SetWidth (theShape->Width());
105 if (theShape->IsTransparent())
107 SetTransparency (theShape->Transparency());
111 //=======================================================================
112 //function : CustomAspects
114 //=======================================================================
115 Handle(AIS_ColoredDrawer) AIS_ColoredShape::CustomAspects (const TopoDS_Shape& theShape)
117 Handle(AIS_ColoredDrawer) aDrawer;
118 myShapeColors.Find (theShape, aDrawer);
119 if (aDrawer.IsNull())
121 aDrawer = new AIS_ColoredDrawer (myDrawer);
122 myShapeColors.Bind (theShape, aDrawer);
123 LoadRecomputable (AIS_WireFrame);
124 LoadRecomputable (AIS_Shaded);
129 //=======================================================================
130 //function : ClearCustomAspects
132 //=======================================================================
133 void AIS_ColoredShape::ClearCustomAspects()
135 if (myShapeColors.IsEmpty())
139 myShapeColors.Clear();
140 LoadRecomputable (AIS_WireFrame);
141 LoadRecomputable (AIS_Shaded);
144 //=======================================================================
145 //function : UnsetCustomAspects
147 //=======================================================================
148 void AIS_ColoredShape::UnsetCustomAspects (const TopoDS_Shape& theShape,
149 const Standard_Boolean theToUnregister)
151 if (!myShapeColors.IsBound (theShape))
156 LoadRecomputable (AIS_WireFrame);
157 LoadRecomputable (AIS_Shaded);
160 myShapeColors.UnBind (theShape);
164 myShapeColors.ChangeFind (theShape) = new AIS_ColoredDrawer (myDrawer);
167 //=======================================================================
168 //function : SetCustomColor
170 //=======================================================================
171 void AIS_ColoredShape::SetCustomColor (const TopoDS_Shape& theShape,
172 const Quantity_Color& theColor)
174 if (theShape.IsNull())
179 const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
180 setColor (aDrawer, theColor);
181 aDrawer->SetOwnColor (theColor);
182 LoadRecomputable (AIS_WireFrame);
183 LoadRecomputable (AIS_Shaded);
186 //=======================================================================
187 //function : SetCustomWidth
189 //=======================================================================
190 void AIS_ColoredShape::SetCustomWidth (const TopoDS_Shape& theShape,
191 const Standard_Real theLineWidth)
193 if (theShape.IsNull())
198 const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
199 setWidth (CustomAspects (theShape), theLineWidth);
200 aDrawer->SetOwnWidth (theLineWidth);
201 LoadRecomputable (AIS_WireFrame);
202 LoadRecomputable (AIS_Shaded);
205 //=======================================================================
206 //function : SetColor
208 //=======================================================================
210 void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
212 setColor (myDrawer, theColor);
213 myDrawer->SetColor (theColor);
214 hasOwnColor = Standard_True;
215 LoadRecomputable (AIS_WireFrame);
216 LoadRecomputable (AIS_Shaded);
217 for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
219 const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
220 if (aDrawer->HasOwnColor())
225 if (aDrawer->HasOwnShadingAspect())
227 aDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
229 if (aDrawer->HasOwnLineAspect())
231 aDrawer->LineAspect()->SetColor (theColor);
233 if (aDrawer->HasOwnWireAspect())
235 aDrawer->WireAspect()->SetColor (theColor);
240 //=======================================================================
241 //function : SetWidth
243 //=======================================================================
245 void AIS_ColoredShape::SetWidth (const Standard_Real theLineWidth)
247 setWidth (myDrawer, theLineWidth);
248 myOwnWidth = theLineWidth;
249 LoadRecomputable (AIS_WireFrame);
250 LoadRecomputable (AIS_Shaded);
251 for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
253 const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
254 if (aDrawer->HasOwnWidth())
259 if (aDrawer->HasOwnLineAspect())
261 aDrawer->LineAspect()->SetWidth (theLineWidth);
263 if (aDrawer->HasOwnWireAspect())
265 aDrawer->WireAspect()->SetWidth (theLineWidth);
270 //=======================================================================
271 //function : SetTransparency
273 //=======================================================================
275 void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
277 setTransparency (myDrawer, theValue);
278 myDrawer->SetTransparency ((Standard_ShortReal )theValue);
279 LoadRecomputable (AIS_WireFrame);
280 LoadRecomputable (AIS_Shaded);
281 for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
283 const Handle(Prs3d_Drawer)& aDrawer = anIter.Value();
284 if (aDrawer->HasOwnShadingAspect())
286 aDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
291 //=======================================================================
292 //function : UnsetTransparency
294 //=======================================================================
295 void AIS_ColoredShape::UnsetTransparency()
297 myDrawer->SetTransparency (0.0f);
298 if (myDrawer->HasOwnShadingAspect())
300 myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
303 && !myDrawer->ShadingAspect()->Aspect()->ToMapTexture())
305 myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
309 for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
311 const Handle(Prs3d_Drawer)& aDrawer = anIter.Value();
312 if (aDrawer->HasOwnShadingAspect())
314 aDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
317 SynchronizeAspects();
320 //=======================================================================
321 //function : SetMaterial
323 //=======================================================================
325 void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
327 setMaterial (myDrawer, theMaterial, HasColor(), IsTransparent());
328 //myOwnMaterial = theMaterial;
329 hasOwnMaterial = Standard_True;
330 LoadRecomputable (AIS_Shaded);
331 for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
333 const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
334 //if (aDrawer->HasOwnMaterial()) continue;
335 if (aDrawer->HasOwnShadingAspect())
337 setMaterial (aDrawer, theMaterial, aDrawer->HasOwnColor(), Standard_False); // aDrawer->IsTransparent()
342 //=======================================================================
345 //=======================================================================
346 void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
347 const Handle(Prs3d_Presentation)& thePrs,
348 const Standard_Integer theMode)
350 if (myshape.IsNull())
357 thePrs->SetInfiniteState (Standard_True);
360 if (theMode == AIS_Shaded)
362 if (myDrawer->IsAutoTriangulation())
364 // compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
365 StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
367 // After this call if type of deflection is relative
368 // computed deflection coefficient is stored as absolute.
369 Standard_Boolean wasRecomputed = StdPrs_ToolTriangulatedShape::Tessellate (myshape, myDrawer);
371 // Set to update wireframe presentation on triangulation.
372 if (myDrawer->IsoOnTriangulation() && wasRecomputed)
374 SetToUpdate (AIS_WireFrame);
378 else // WireFrame mode
380 StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
382 // After this call if type of deflection is relative
383 // computed deflection coefficient is stored as absolute.
384 Prs3d::GetDeflection (myshape, myDrawer);
387 // Extract myShapeColors map (KeyshapeColored -> Color)
388 // to subshapes map (Subshape -> Color).
389 // This needed when colored shape is not part of BaseShape
390 // (but subshapes are) and actually container for subshapes.
391 AIS_DataMapOfShapeDrawer aSubshapeDrawerMap;
393 // unroll compounds specified for grouping sub-shapes with the same style
394 // (e.g. the compounds that are not a part of the main shape)
395 TopTools_MapOfShape aMapOfOwnCompounds;
396 if (myshape.ShapeType() == TopAbs_COMPOUND)
398 aMapOfOwnCompounds.Add (myshape);
399 collectSubCompounds (aMapOfOwnCompounds, myshape);
401 for (AIS_DataMapOfShapeDrawer::Iterator aKeyShapeIter (myShapeColors);
402 aKeyShapeIter.More(); aKeyShapeIter.Next())
404 const TopoDS_Shape& aKeyShape = aKeyShapeIter.Key();
405 if (aKeyShape.ShapeType() != TopAbs_COMPOUND
406 || aMapOfOwnCompounds.Contains (aKeyShape))
411 for (TopoDS_Iterator aChildIter (aKeyShape); aChildIter.More(); aChildIter.Next())
413 const TopoDS_Shape& aShape = aChildIter.Value();
414 if (!myShapeColors.IsBound (aShape))
416 bindSubShapes (aSubshapeDrawerMap, aShape, aKeyShapeIter.Value());
421 // assign other sub-shapes with styles
422 for (AIS_DataMapOfShapeDrawer::Iterator aKeyShapeIter (myShapeColors);
423 aKeyShapeIter.More(); aKeyShapeIter.Next())
425 const TopoDS_Shape& aKeyShape = aKeyShapeIter.Key();
426 if (myshape == aKeyShape
427 || (aKeyShape.ShapeType() == TopAbs_COMPOUND
428 && !aMapOfOwnCompounds.Contains (aKeyShape)))
433 bindSubShapes (aSubshapeDrawerMap, aKeyShape, aKeyShapeIter.Value());
437 Handle(AIS_ColoredDrawer) aBaseDrawer;
438 myShapeColors.Find (myshape, aBaseDrawer);
440 // myShapeColors + anOpened --> array[TopAbs_ShapeEnum] of map of color-to-compound
441 DataMapOfDrawerCompd aDispatchedOpened[(size_t)TopAbs_SHAPE];
442 DataMapOfDrawerCompd aDispatchedClosed;
443 dispatchColors (aBaseDrawer, myshape,
444 aSubshapeDrawerMap, TopAbs_COMPOUND, Standard_False,
445 aDispatchedOpened, theMode == AIS_Shaded ? aDispatchedClosed : aDispatchedOpened[TopAbs_FACE]);
446 addShapesWithCustomProps (thePrs, aDispatchedOpened, aDispatchedClosed, theMode);
449 //=======================================================================
450 //function : addShapesWithCustomProps
452 //=======================================================================
453 void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation)& thePrs,
454 const DataMapOfDrawerCompd* theDrawerOpenedShapePerType,
455 const DataMapOfDrawerCompd& theDrawerClosedFaces,
456 const Standard_Integer theMode)
458 Handle(Graphic3d_Group) anOpenGroup, aClosedGroup;
459 for (size_t aShType = 0; aShType <= (size_t )TopAbs_SHAPE; ++aShType)
461 const Standard_Boolean isClosed = aShType == TopAbs_SHAPE;
462 Handle(Graphic3d_Group)& aShadedGroup = isClosed ? aClosedGroup : anOpenGroup;
463 const DataMapOfDrawerCompd& aDrawerShapeMap = isClosed
464 ? theDrawerClosedFaces
465 : theDrawerOpenedShapePerType[aShType];
466 for (DataMapOfDrawerCompd::Iterator aMapIter (aDrawerShapeMap);
467 aMapIter.More(); aMapIter.Next())
469 const Handle(AIS_ColoredDrawer)& aCustomDrawer = aMapIter.Key();
470 const TopoDS_Compound& aShapeDraw = aMapIter.Value(); // compound of subshapes with <aShType> type
471 Handle(Prs3d_Drawer) aDrawer;
472 if (!aCustomDrawer.IsNull())
474 aDrawer = aCustomDrawer;
475 if (aCustomDrawer->IsHidden())
485 // It is supposed that absolute deflection contains previously computed relative deflection
486 // (if deflection type is relative).
487 // In case of CustomDrawer it is taken from Link().
488 Aspect_TypeOfDeflection aPrevType = aDrawer->TypeOfDeflection();
489 aDrawer->SetTypeOfDeflection (Aspect_TOD_ABSOLUTE);
491 // Draw each kind of subshapes and personal-colored shapes in a separate group
492 // since it's necessary to set transparency/material for all subshapes
493 // without affecting their unique colors
494 if (theMode == AIS_Shaded
495 && aShapeDraw.ShapeType() <= TopAbs_FACE
498 // add wireframe presentation for isolated edges and vertices
499 StdPrs_ShadedShape::AddWireframeForFreeElements (thePrs, aShapeDraw, aDrawer);
501 // add special wireframe presentation for faces without triangulation
502 StdPrs_ShadedShape::AddWireframeForFacesWithoutTriangles (thePrs, aShapeDraw, aDrawer);
504 Handle(Graphic3d_ArrayOfTriangles) aTriangles = StdPrs_ShadedShape::FillTriangles (aShapeDraw,
505 aDrawer->ShadingAspect()->Aspect()->ToMapTexture()
506 && !aDrawer->ShadingAspect()->Aspect()->TextureMap().IsNull(),
507 myUVOrigin, myUVRepeat, myUVScale);
508 if (!aTriangles.IsNull())
510 if (aShadedGroup.IsNull())
512 aShadedGroup = Prs3d_Root::NewGroup (thePrs);
513 aShadedGroup->SetClosed (isClosed);
515 aShadedGroup->SetPrimitivesAspect (aDrawer->ShadingAspect()->Aspect());
516 aShadedGroup->AddPrimitiveArray (aTriangles);
519 if (aDrawer->FaceBoundaryDraw())
521 Handle(Graphic3d_ArrayOfSegments) aBndSegments = StdPrs_ShadedShape::FillFaceBoundaries (aShapeDraw);
522 if (!aBndSegments.IsNull())
524 if (aShadedGroup.IsNull())
526 aShadedGroup = Prs3d_Root::NewGroup (thePrs);
527 aShadedGroup->SetClosed (isClosed);
530 Handle(Graphic3d_AspectLine3d) aBoundaryAspect = aDrawer->FaceBoundaryAspect()->Aspect();
531 aShadedGroup->SetPrimitivesAspect (aBoundaryAspect);
532 aShadedGroup->AddPrimitiveArray (aBndSegments);
538 StdPrs_WFShape::Add (thePrs, aShapeDraw, aDrawer);
540 aDrawer->SetTypeOfDeflection (aPrevType);
545 //=======================================================================
546 //function : dispatchColors
548 //=======================================================================
549 Standard_Boolean AIS_ColoredShape::dispatchColors (const Handle(AIS_ColoredDrawer)& theParentDrawer,
550 const TopoDS_Shape& theShapeToParse,
551 const AIS_DataMapOfShapeDrawer& theShapeDrawerMap,
552 const TopAbs_ShapeEnum theParentType,
553 const Standard_Boolean theIsParentClosed,
554 DataMapOfDrawerCompd* theDrawerOpenedShapePerType,
555 DataMapOfDrawerCompd& theDrawerClosedFaces)
557 const TopAbs_ShapeEnum aShapeType = theShapeToParse.ShapeType();
558 if (aShapeType == TopAbs_SHAPE)
560 return Standard_False;
563 // check own setting of current shape
564 Handle(AIS_ColoredDrawer) aDrawer = theParentDrawer;
565 const Standard_Boolean isOverriden = theShapeDrawerMap.Find (theShapeToParse, aDrawer);
567 && aDrawer->IsHidden())
569 return Standard_True;
572 // handle compounds, solids and shells
573 Standard_Boolean isSubOverride = Standard_False;
574 if (aShapeType <= TopAbs_SHELL)
576 // detect parts of closed solids
577 Standard_Boolean isClosedShell = theParentType == TopAbs_SOLID
578 && aShapeType == TopAbs_SHELL
579 && BRep_Tool::IsClosed (theShapeToParse)
580 && StdPrs_ToolTriangulatedShape::IsTriangulated (theShapeToParse);
583 for (TopoDS_Iterator aFaceIter (theShapeToParse); aFaceIter.More(); aFaceIter.Next())
585 const TopoDS_Shape& aFace = aFaceIter.Value();
586 Handle(AIS_ColoredDrawer) aFaceDrawer;
587 if (aFace.ShapeType() == TopAbs_FACE
588 && theShapeDrawerMap.Find (aFace, aFaceDrawer)
589 && aFaceDrawer->IsHidden())
591 isClosedShell = Standard_False;
597 for (TopoDS_Iterator aSubShapeIter (theShapeToParse); aSubShapeIter.More(); aSubShapeIter.Next())
599 const TopoDS_Shape& aSubShape = aSubShapeIter.Value();
600 if (dispatchColors (aDrawer, aSubShape,
601 theShapeDrawerMap, aShapeType,
603 theDrawerOpenedShapePerType,
604 theDrawerClosedFaces))
606 isSubOverride = Standard_True;
609 return isOverriden || isSubOverride;
612 // iterate on sub-shapes
613 BRep_Builder aBBuilder;
614 TopoDS_Shape aShapeCopy = theShapeToParse.EmptyCopied();
615 aShapeCopy.Closed (theShapeToParse.Closed());
616 Standard_Integer nbDef = 0;
617 for (TopoDS_Iterator aSubShapeIter (theShapeToParse); aSubShapeIter.More(); aSubShapeIter.Next())
619 const TopoDS_Shape& aSubShape = aSubShapeIter.Value();
620 if (dispatchColors (aDrawer, aSubShape,
621 theShapeDrawerMap, aShapeType,
623 theDrawerOpenedShapePerType,
624 theDrawerClosedFaces))
626 isSubOverride = Standard_True;
630 aBBuilder.Add (aShapeCopy, aSubShape);
634 if (aShapeType == TopAbs_FACE || !isSubOverride)
636 aShapeCopy = theShapeToParse;
640 return isOverriden || isSubOverride; // empty compound
643 // if any of styles is overridden regarding to default one, add rest to map
645 || (isSubOverride && theParentType != TopAbs_WIRE // avoid drawing edges when vertex color is overridden
646 && theParentType != TopAbs_FACE) // avoid drawing edges of the same color as face
647 || (theParentType <= TopAbs_SHELL && !(isOverriden || isSubOverride))) // bind original shape to default color
649 TopoDS_Compound aCompound;
650 DataMapOfDrawerCompd& aDrawerShapeMap = theIsParentClosed
651 && aShapeType == TopAbs_FACE
652 ? theDrawerClosedFaces
653 : theDrawerOpenedShapePerType[(size_t)aShapeType];
654 if (!aDrawerShapeMap.FindFromKey (aDrawer, aCompound))
656 aBBuilder.MakeCompound (aCompound);
657 aDrawerShapeMap.Add (aDrawer, aCompound);
659 aBBuilder.Add (aCompound, aShapeCopy);
661 return isOverriden || isSubOverride;
664 //=======================================================================
665 //function : isShapeEntirelyVisible
667 //=======================================================================
668 Standard_Boolean AIS_ColoredShape::isShapeEntirelyVisible() const
670 for (AIS_DataMapOfShapeDrawer::Iterator aMapIter (myShapeColors); aMapIter.More(); aMapIter.Next())
672 if (aMapIter.Value()->IsHidden())
674 return Standard_False;
677 return Standard_True;
680 //=======================================================================
681 //function : bindSubShapes
683 //=======================================================================
684 void AIS_ColoredShape::bindSubShapes (AIS_DataMapOfShapeDrawer& theShapeDrawerMap,
685 const TopoDS_Shape& theKeyShape,
686 const Handle(AIS_ColoredDrawer)& theDrawer)
688 TopAbs_ShapeEnum aShapeWithColorType = theKeyShape.ShapeType();
689 if (aShapeWithColorType == TopAbs_COMPOUND)
691 theShapeDrawerMap.Bind (theKeyShape, theDrawer);
693 else if (aShapeWithColorType == TopAbs_SOLID || aShapeWithColorType == TopAbs_SHELL)
695 for (TopExp_Explorer anExp (theKeyShape, TopAbs_FACE); anExp.More(); anExp.Next())
697 if (!theShapeDrawerMap.IsBound (anExp.Current()))
699 theShapeDrawerMap.Bind (anExp.Current(), theDrawer);
703 else if (aShapeWithColorType == TopAbs_WIRE)
705 for (TopExp_Explorer anExp (theKeyShape, TopAbs_EDGE); anExp.More(); anExp.Next())
707 if (!theShapeDrawerMap.IsBound (anExp.Current()))
709 theShapeDrawerMap.Bind (anExp.Current(), theDrawer);
715 // bind single face, edge and vertex
716 // force rebind if required due to the color of single shape has
717 // higher priority than the color of "compound" shape (wire is a
718 // compound of edges, shell is a compound of faces) that contains
719 // this single shape.
720 theShapeDrawerMap.Bind (theKeyShape, theDrawer);