// ColoredShapes.cpp: implementation of the CColoredShape class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include #include "ColoredShapes.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CColoredShapes::CColoredShapes() { } void CColoredShapes::Add(const Quantity_NameOfColor aColor, const TopoDS_Shape& aShape) { m_shapeList.Append(aShape); m_colorMap.Bind(aShape, aColor); } void CColoredShapes::Remove(const TopoDS_Shape& aShape) { m_colorMap.UnBind(aShape); for ( TopoDS_ListIteratorOfListOfShape iter(m_shapeList); iter.More(); iter.Next() ) { if(iter.Value() == aShape) { m_shapeList.Remove(iter); break; } } } IMPLEMENT_SERIAL(CColoredShapes, CObject,1); #include // Tools to put Persistent Object in an archive #include #include #include #include void CColoredShapes::Display(Handle(AIS_InteractiveContext)& anAIScontext) { for ( TopoDS_ListIteratorOfListOfShape iter(m_shapeList); iter.More(); iter.Next() ) { Handle(AIS_Shape) ais = new AIS_Shape(iter.Value()); anAIScontext->SetColor(ais, (Quantity_NameOfColor)m_colorMap.Find(iter.Value())); anAIScontext->SetMaterial(ais, Graphic3d_NOM_GOLD, Standard_False); anAIScontext->Display(ais, Standard_False); } }