1 // ColoredShapes.cpp: implementation of the CColoredShape class.
3 //////////////////////////////////////////////////////////////////////
9 #include "ColoredShapes.h"
11 //////////////////////////////////////////////////////////////////////
12 // Construction/Destruction
13 //////////////////////////////////////////////////////////////////////
15 CColoredShapes::CColoredShapes()
20 void CColoredShapes::Add(const Quantity_NameOfColor aColor, const TopoDS_Shape& aShape)
22 m_shapeList.Append(aShape);
23 m_colorMap.Bind(aShape, aColor);
26 void CColoredShapes::Remove(const TopoDS_Shape& aShape)
28 m_colorMap.UnBind(aShape);
29 for ( TopoDS_ListIteratorOfListOfShape iter(m_shapeList); iter.More(); iter.Next() ) {
30 if(iter.Value() == aShape) {
31 m_shapeList.Remove(iter);
37 IMPLEMENT_SERIAL(CColoredShapes, CObject,1);
39 #include <TopoDS_Shape.hxx>
41 // Tools to put Persistent Object in an archive
42 #include <FSD_Archive.hxx>
43 #include <Storage_Data.hxx>
44 #include <Storage_HSeqOfRoot.hxx>
45 #include <Storage_Root.hxx>
47 void CColoredShapes::Display(Handle(AIS_InteractiveContext)& anAIScontext)
49 for ( TopoDS_ListIteratorOfListOfShape iter(m_shapeList); iter.More(); iter.Next() )
51 Handle(AIS_Shape) ais = new AIS_Shape(iter.Value());
52 anAIScontext->SetColor(ais, (Quantity_NameOfColor)m_colorMap.Find(iter.Value()));
53 anAIScontext->SetMaterial(ais, Graphic3d_NOM_GOLD, Standard_False);
54 anAIScontext->Display(ais, Standard_False);