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);
// This schema contains all the Persistent Geometry and Topology
ON_COMMAND(ID_FILE_EXPORT_STL, OnFileExportStl)
ON_COMMAND(ID_BOX, OnBox)
ON_COMMAND(ID_Cylinder, OnCylinder)
+ ON_COMMAND(ID_OBJECT_REMOVE, OnObjectRemove)
+ ON_COMMAND(ID_OBJECT_ERASE, OnObjectErase)
+ ON_COMMAND(ID_OBJECT_DISPLAYALL, OnObjectDisplayall)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// document has been modified
SetModifiedFlag(TRUE);
+}
+void CImportExportDoc::OnObjectRemove()
+
+{
+ for(GetAISContext()->InitCurrent();GetAISContext()->MoreCurrent();GetAISContext()->NextCurrent()) {
+ Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(GetAISContext()->Current());
+ if(!aShape.IsNull()) {
+ m_pcoloredshapeList->Remove(aShape->Shape());
+ }
+ }
+ OCC_3dBaseDoc::OnObjectRemove();
+}
+
+void CImportExportDoc::OnObjectErase()
+
+{
+ for(GetAISContext()->InitCurrent();GetAISContext()->MoreCurrent();GetAISContext()->NextCurrent()) {
+ Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(GetAISContext()->Current());
+ if(!aShape.IsNull()) {
+ m_pcoloredshapeList->Remove(aShape->Shape());
+ }
+ }
+ OCC_3dBaseDoc::OnObjectErase();
+}
+
+void CImportExportDoc::OnObjectDisplayall()
+
+{
+ OCC_3dBaseDoc::OnObjectDisplayall();
}
\ No newline at end of file