Small update V6_5_1
authorbugmaster <>
Wed, 1 Jun 2011 12:52:26 +0000 (12:52 +0000)
committerbugmaster <bugmaster@opencascade.com>
Mon, 5 Mar 2012 15:29:13 +0000 (19:29 +0400)
samples/mfc/standard/05_ImportExport/src/ColoredShapes.cpp
samples/mfc/standard/05_ImportExport/src/ColoredShapes.h
samples/mfc/standard/05_ImportExport/src/ImportExportDoc.cpp
samples/mfc/standard/05_ImportExport/src/ImportExportDoc.h
samples/mfc/standard/Common/OCC_3dBaseDoc.cpp

index 4e57f37..3118280 100755 (executable)
@@ -23,6 +23,17 @@ void CColoredShapes::Add(const Quantity_NameOfColor aColor, const TopoDS_Shape&
        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
index 3e472da..a873ee9 100755 (executable)
@@ -14,6 +14,7 @@ class CColoredShapes : public CObject
 public:
        CColoredShapes();
        void Add(const Quantity_NameOfColor aColor, const TopoDS_Shape& aShape);
+       void Remove(const TopoDS_Shape& aShape);
 
        void Display( Handle(AIS_InteractiveContext)& anAIScontext);
 
index d778427..7f50af3 100755 (executable)
@@ -37,6 +37,9 @@ BEGIN_MESSAGE_MAP(CImportExportDoc, OCC_3dBaseDoc)
        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()
@@ -283,4 +286,33 @@ void CImportExportDoc::OnCylinder()
 
        // 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
index 05ce79b..151e9f9 100755 (executable)
@@ -46,6 +46,9 @@ protected:
        afx_msg void OnFileExportStl();
        afx_msg void OnBox();
        afx_msg void OnCylinder();
+       afx_msg void OnObjectRemove();
+       afx_msg void OnObjectErase();
+       afx_msg void OnObjectDisplayall();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 
index 711fd28..15f0698 100755 (executable)
@@ -362,7 +362,7 @@ void OCC_3dBaseDoc::OnUpdateObjectTransparency(CCmdUI* pCmdUI)
 
 void OCC_3dBaseDoc::OnObjectDisplayall() 
 {
-       myAISContext->DisplayAll(Standard_True);
+       myAISContext->DisplayAll(Standard_False);
 }
 
 void OCC_3dBaseDoc::OnUpdateObjectDisplayall(CCmdUI* pCmdUI)