0024372: HLR Sample: erased objects are shown in HLR
authoraba <aba@opencascade.com>
Thu, 5 Dec 2013 11:39:48 +0000 (15:39 +0400)
committerbugmaster <bugmaster@opencascade.com>
Fri, 6 Dec 2013 09:10:42 +0000 (13:10 +0400)
Compilation errors were corrected.
Removed .aps files
Sample paths fields were updated to read help file from sample folder.

34 files changed:
samples/mfc/standard/01_Geometry/res/Geometry.aps [deleted file]
samples/mfc/standard/01_Geometry/src/GeometryApp.cpp
samples/mfc/standard/02_Modeling/res/Modeling.aps [deleted file]
samples/mfc/standard/02_Modeling/src/ModelingApp.cpp
samples/mfc/standard/03_Viewer2d/README.txt
samples/mfc/standard/03_Viewer2d/res/Viewer2d.aps [deleted file]
samples/mfc/standard/03_Viewer2d/src/Viewer2dApp.cpp
samples/mfc/standard/04_Viewer3d/src/TexturesExt_Presentation.cpp
samples/mfc/standard/04_Viewer3d/src/Viewer3dApp.cpp
samples/mfc/standard/05_ImportExport/res/ImportExport.aps [deleted file]
samples/mfc/standard/05_ImportExport/src/ImportExportApp.cpp
samples/mfc/standard/06_Ocaf/res/Ocaf.aps [deleted file]
samples/mfc/standard/06_Ocaf/src/OcafApp.cpp
samples/mfc/standard/07_Triangulation/res/Triangulation.aps [deleted file]
samples/mfc/standard/07_Triangulation/src/TriangulationApp.cpp
samples/mfc/standard/08_HLR/README.txt [new file with mode: 0644]
samples/mfc/standard/08_HLR/res/HLR.APS [deleted file]
samples/mfc/standard/08_HLR/res/HLR.rc
samples/mfc/standard/08_HLR/res/resource.h
samples/mfc/standard/08_HLR/src/HLRApp.cpp
samples/mfc/standard/08_HLR/src/HLRDoc.cpp
samples/mfc/standard/08_HLR/src/HLRDoc.h
samples/mfc/standard/08_HLR/src/SelectionDialog.cpp
samples/mfc/standard/08_HLR/src/SelectionDialog.h
samples/mfc/standard/09_Animation/res/Animation.aps [deleted file]
samples/mfc/standard/09_Animation/src/AnimationApp.cpp
samples/mfc/standard/09_Animation/src/AnimationDoc.cpp
samples/mfc/standard/10_Convert/src/Convert_Presentation.cpp
samples/mfc/standard/Common/ISession2D/ISession2D_Shape.cpp
samples/mfc/standard/Common/ISession2D/ISession2D_Shape.h
samples/mfc/standard/Common/OCC_3dBaseDoc.cpp
samples/mfc/standard/Common/OCC_App.cpp
samples/mfc/standard/Common/res/OCC_Resource.aps [deleted file]
samples/mfc/standard/Common/res/OCC_Resource.rc

diff --git a/samples/mfc/standard/01_Geometry/res/Geometry.aps b/samples/mfc/standard/01_Geometry/res/Geometry.aps
deleted file mode 100755 (executable)
index 9013c22..0000000
Binary files a/samples/mfc/standard/01_Geometry/res/Geometry.aps and /dev/null differ
index b00b7c8..a59c263 100755 (executable)
@@ -17,7 +17,8 @@
 
 CGeometryApp::CGeometryApp() : OCC_App()
 {
-  SampleName = "Geometry";     //for about dialog
+  SampleName = "Geometry"; //for about dialog
+  SetSamplePath ("..\\..\\01_Geometry");
 }
 
 CGeometryApp::~CGeometryApp()
diff --git a/samples/mfc/standard/02_Modeling/res/Modeling.aps b/samples/mfc/standard/02_Modeling/res/Modeling.aps
deleted file mode 100755 (executable)
index becf2e1..0000000
Binary files a/samples/mfc/standard/02_Modeling/res/Modeling.aps and /dev/null differ
index 663b421..caa38d7 100755 (executable)
@@ -18,6 +18,7 @@
 CModelingApp::CModelingApp() : OCC_App()
 {
   SampleName = "Modeling"; //for about dialog
+  SetSamplePath ("..\\..\\02_Modeling");
 }
 
 /////////////////////////////////////////////////////////////////////////////
index 9d5df75..fa8efd0 100644 (file)
@@ -1,9 +1,9 @@
-Viewer2d sample demonstrates how the functionality of TKV3d package can be used
-for 2D visualization. It provides samples of 2D objects visualization,
+Viewer2d sample demonstrates how the functionality of TKV3d package can be
+used for 2D visualization. It provides samples of 2D objects visualization,
 dynamic selection and highlighting.
-It illustratea how to:
-1) implement 2D view behavior with V3d_View class, with interactive zooming and
-panning of the 2D scene;
+It illustrates how to:
+1) implement 2D view behavior with V3d_View class, with interactive zooming
+and panning of the 2D scene;
 2) draw 2D primitives like rectangles, lines, curves;
 3) draw different types of markers;
 4) draw text defined by its font, height, style, angle;
diff --git a/samples/mfc/standard/03_Viewer2d/res/Viewer2d.aps b/samples/mfc/standard/03_Viewer2d/res/Viewer2d.aps
deleted file mode 100755 (executable)
index d3d21b5..0000000
Binary files a/samples/mfc/standard/03_Viewer2d/res/Viewer2d.aps and /dev/null differ
index 249cdd0..302a0d1 100755 (executable)
@@ -22,6 +22,7 @@ static char THIS_FILE[] = __FILE__;
 CViewer2dApp::CViewer2dApp() : OCC_App()
 {
   SampleName = "Viewer2d"; //for about dialog
+  SetSamplePath ("..\\..\\03_Viewer2d");
 }
 
 /////////////////////////////////////////////////////////////////////////////
index 6aad84e..59e57a6 100755 (executable)
@@ -59,7 +59,7 @@ TexturesExt_Presentation::TexturesExt_Presentation()
 void TexturesExt_Presentation::DoSample()
 {
        ((CViewer3dApp*) AfxGetApp())->SetSampleName("Viewer3d");
-       ((CViewer3dApp*) AfxGetApp())->SetSamplePath("..\\..\\04_Viewer3d");
+       ((CViewer3dApp*) AfxGetApp())->SetSamplePath ("..\\..\\04_Viewer3d");
        getAISContext()->EraseAll();
        if (myIndex >=0 && myIndex < myNbSamples)
        {
index 1cdb61c..a8c4cb6 100755 (executable)
@@ -29,6 +29,7 @@ END_MESSAGE_MAP()
 CViewer3dApp::CViewer3dApp() : OCC_App()
 {
   SampleName = "Viewer3d"; //for about dialog
+  SetSamplePath ("..\\..\\03_Viewer3d");
 }
 
 /////////////////////////////////////////////////////////////////////////////
diff --git a/samples/mfc/standard/05_ImportExport/res/ImportExport.aps b/samples/mfc/standard/05_ImportExport/res/ImportExport.aps
deleted file mode 100755 (executable)
index 56f8a48..0000000
Binary files a/samples/mfc/standard/05_ImportExport/res/ImportExport.aps and /dev/null differ
index 7c18ec8..63f77cf 100755 (executable)
@@ -33,6 +33,7 @@ CImportExportApp::CImportExportApp() : OCC_App()
   }
 
   SampleName = "ImportExport"; //for about dialog
+  SetSamplePath ("..\\..\\05_ImportExport");
 }
 
 /////////////////////////////////////////////////////////////////////////////
diff --git a/samples/mfc/standard/06_Ocaf/res/Ocaf.aps b/samples/mfc/standard/06_Ocaf/res/Ocaf.aps
deleted file mode 100755 (executable)
index 57e13d3..0000000
Binary files a/samples/mfc/standard/06_Ocaf/res/Ocaf.aps and /dev/null differ
index 5387a70..6ab6ac0 100755 (executable)
@@ -35,9 +35,9 @@ END_MESSAGE_MAP()
 
 COcafApp::COcafApp() : OCC_App()
 {
-  SetSamplePath("06_Ocaf");
   myApp = new TOcaf_Application();
   SampleName = "OCAF"; //for about dialog
+  SetSamplePath ("..\\..\\06_Ocaf");
 
   try
   {
diff --git a/samples/mfc/standard/07_Triangulation/res/Triangulation.aps b/samples/mfc/standard/07_Triangulation/res/Triangulation.aps
deleted file mode 100644 (file)
index fa41e16..0000000
Binary files a/samples/mfc/standard/07_Triangulation/res/Triangulation.aps and /dev/null differ
index 40af313..140fdf6 100755 (executable)
@@ -16,6 +16,7 @@
 CTriangulationApp::CTriangulationApp() : OCC_App()
 {
   SampleName = "TopologyTriangulation"; //for about dialog
+  SetSamplePath("..\\..\\07_Triangulation");
 }
 
 /////////////////////////////////////////////////////////////////////////////
diff --git a/samples/mfc/standard/08_HLR/README.txt b/samples/mfc/standard/08_HLR/README.txt
new file mode 100644 (file)
index 0000000..a74515a
--- /dev/null
@@ -0,0 +1,12 @@
+HLR sample demonstrates hidden line removal algorithm.
+It supports exact and polygonal HLR algorihms.
+
+To try HLR you need to follow some steps:
+1) to import model, which will displayed in 3d view.
+2) to choose "File->Process HLR" or press "HLR' button in the toolbar.
+   Dialog with options of HLR will be opened.
+3) to press "Get shapes" button of the HLR dialog to
+   display results in the 2d view.
+   Optionally, this dialog allow to view chosen shapes 
+   in his own view. Here you can choose needed direction
+   of view and press "Update 2d" button to update shapes HLR 2d view.
diff --git a/samples/mfc/standard/08_HLR/res/HLR.APS b/samples/mfc/standard/08_HLR/res/HLR.APS
deleted file mode 100755 (executable)
index f5487fb..0000000
Binary files a/samples/mfc/standard/08_HLR/res/HLR.APS and /dev/null differ
index 0ece1ee..21e4c41 100755 (executable)
@@ -343,6 +343,7 @@ BEGIN
         MENUITEM "&New\tCtrl+N",                ID_FILE_NEW
         MENUITEM "&Close",                      ID_FILE_CLOSE
         MENUITEM SEPARATOR
+        MENUITEM "Process HLR",                 ID_FILE_HLR
         POPUP "Import"
         BEGIN
             MENUITEM "BRep...",                     ID_FILE_IMPORT_BREP
@@ -443,7 +444,8 @@ END
 
 STRINGTABLE 
 BEGIN
-    ID_BUTTON_HLRDialog     "Display The HLR Dialog \nHLR Dialog"
+    ID_BUTTON_HLRDialog     "Open the HLR dialog \nHLR dialog"
+    ID_FILE_HLR             "Open the HLR dialog \nHLR dialog"
 END
 
 #endif    // English (U.S.) resources
index 87c1bda..1dc47a3 100755 (executable)
 #define IDC_BackView                    1534
 #define IDC_FrontView                   1535
 #define IDC_AxoView                     1536
-#define ID_BUTTON_HLRDialog             32795
+#define ID_BUTTON_HLRDialog             1537
+#define ID_FILE_HLR                     1539
 
 // Next default values for new objects
 // 
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        173
-#define _APS_NEXT_COMMAND_VALUE         32796
+#define _APS_NEXT_COMMAND_VALUE         32797
 #define _APS_NEXT_CONTROL_VALUE         1538
 #define _APS_NEXT_SYMED_VALUE           170
 #endif
index 407f235..aa0dbdd 100755 (executable)
@@ -28,6 +28,7 @@ static char THIS_FILE[] = __FILE__;
 CHLRApp::CHLRApp() : OCC_App()
 {
   SampleName = "HLR"; //for about dialog
+  SetSamplePath ("..\\..\\08_HLR");
 }
 
 CHLRApp::~CHLRApp()
index 54a4d2e..59d83d6 100755 (executable)
@@ -30,8 +30,10 @@ BEGIN_MESSAGE_MAP(CHLRDoc, OCC_3dBaseDoc)
   //{{AFX_MSG_MAP(CHLRDoc)
   ON_COMMAND(ID_WINDOW_NEW3D, OnWindowNew3d)
   ON_COMMAND(ID_WINDOW_NEW2D, OnWindowNew2d)
+  ON_COMMAND(ID_FILE_HLR, OnBUTTONHLRDialog)
   ON_COMMAND(ID_FILE_IMPORT_BREP, OnFileImportBrep)
   ON_COMMAND(ID_BUTTON_HLRDialog, OnBUTTONHLRDialog)
+  ON_COMMAND(ID_OBJECT_ERASE, OnObjectErase)
   //}}AFX_MSG_MAP
 
 
@@ -83,17 +85,17 @@ CHLRDoc::~CHLRDoc()
   }
 }
 
-void CHLRDoc::OnWindowNew2d() 
+void CHLRDoc::OnWindowNew2d()
 {
-  ((CHLRApp*)AfxGetApp())->CreateView2D(this); 
+  ((CHLRApp*)AfxGetApp())->CreateView2D(this);
 }
 
-void CHLRDoc::OnWindowNew3d() 
+void CHLRDoc::OnWindowNew3d()
 {
-  ((CHLRApp*)AfxGetApp())->CreateView3D(this); 
+  ((CHLRApp*)AfxGetApp())->CreateView3D(this);
 }
 
-//  nCmdShow could be :    ( default is SW_RESTORE ) 
+//  nCmdShow could be :    ( default is SW_RESTORE )
 // SW_HIDE   SW_SHOWNORMAL   SW_NORMAL   
 // SW_SHOWMINIMIZED     SW_SHOWMAXIMIZED    
 // SW_MAXIMIZE          SW_SHOWNOACTIVATE   
@@ -154,7 +156,7 @@ void CHLRDoc::Dump(CDumpContext& dc) const
 
 /////////////////////////////////////////////////////////////////////////////
 // CHLRDoc commands
-void CHLRDoc::OnBUTTONHLRDialog() 
+void CHLRDoc::OnBUTTONHLRDialog()
 {
   if (!myCSelectionDialogIsCreated)
   {
@@ -162,7 +164,7 @@ void CHLRDoc::OnBUTTONHLRDialog()
     myCSelectionDialog->Create(CSelectionDialog::IDD, AfxGetMainWnd());
     myCSelectionDialogIsCreated = true;
   }
-  myCSelectionDialog->ShowWindow(SW_RESTORE);  
+  myCSelectionDialog->ShowWindow(SW_RESTORE);
 }
 
 void CHLRDoc::OnFileImportBrep() 
@@ -181,3 +183,25 @@ void CHLRDoc::Fit()
     }
   }
 }
+
+void CHLRDoc::OnObjectErase()
+{
+  Standard_Boolean toUpdateDisplayable = Standard_False;
+  for (myAISContext->InitCurrent(); myAISContext->MoreCurrent(); myAISContext->NextCurrent())
+  {
+    myAISContext->Erase (myAISContext->Current(), Standard_True);
+    if (myAISContext->Current()->Type() == AIS_KOI_Shape && myCSelectionDialogIsCreated)
+    {
+      myCSelectionDialog->DiplayableShape()->Remove (Handle(AIS_Shape)::DownCast (myAISContext->Current())->Shape());
+      toUpdateDisplayable = Standard_True;
+    }
+  }
+
+  myAISContext->ClearCurrents();
+
+  if (toUpdateDisplayable)
+  {
+    // Update view in the HLR dialog if list of displayable shapes has been changed.
+    myCSelectionDialog->UpdateViews();
+  }
+}
index 7df01fc..85c9768 100755 (executable)
@@ -39,6 +39,7 @@ protected:
   afx_msg void OnWindowNew2d();
   afx_msg void OnFileImportBrep();
   afx_msg void OnBUTTONHLRDialog();
+  afx_msg void OnObjectErase();
   //}}AFX_MSG
   DECLARE_MESSAGE_MAP()
 
index afd7d09..c5888b6 100644 (file)
@@ -22,11 +22,11 @@ static char THIS_FILE[] = __FILE__;
 /////////////////////////////////////////////////////////////////////////////
 // CSelectionDialog dialog
 
-CSelectionDialog::CSelectionDialog(CHLRDoc* aDoc,CWnd* pParent /*=NULL*/)
+CSelectionDialog::CSelectionDialog (CHLRDoc* aDoc,CWnd* pParent /*=NULL*/)
 : CDialog(CSelectionDialog::IDD, pParent)
 {
   myDoc =  aDoc;
-  myDisplay = false;
+  myIsDisplayed = false;
   //{{AFX_DATA_INIT(CSelectionDialog)
   m_Algo        = 0;
   m_DisplayMode = 0;
@@ -36,7 +36,7 @@ CSelectionDialog::CSelectionDialog(CHLRDoc* aDoc,CWnd* pParent /*=NULL*/)
   //}}AFX_DATA_INIT
 }
 
-void CSelectionDialog::DoDataExchange(CDataExchange* pDX)
+void CSelectionDialog::DoDataExchange (CDataExchange* pDX)
 {
   CDialog::DoDataExchange(pDX);
   //{{AFX_DATA_MAP(CSelectionDialog)
@@ -51,7 +51,7 @@ void CSelectionDialog::DoDataExchange(CDataExchange* pDX)
 
 BEGIN_MESSAGE_MAP(CSelectionDialog, CDialog)
   //{{AFX_MSG_MAP(CSelectionDialog)
-  ON_BN_CLICKED(ID_GetShape, OnGetShape)
+  ON_BN_CLICKED(ID_GetShape, OnGetSelectedShapes)
   ON_BN_CLICKED(IDC_DisplayDefault, OnDisplayDefault)
   ON_BN_CLICKED(IDC_VIsoParametrics, OnVIsoParametrics)
   ON_BN_CLICKED(IDC_VApparentContour, OnVApparentContour)
@@ -89,136 +89,171 @@ END_MESSAGE_MAP()
 /////////////////////////////////////////////////////////////////////////////
 // CSelectionDialog message handlers
 
-BOOL CSelectionDialog::OnInitDialog() 
+BOOL CSelectionDialog::OnInitDialog()
 {
   CDialog::OnInitDialog();
 
-  VERIFY(TopView.AutoLoad(IDC_TopView, this));
-  VERIFY(BottomView.AutoLoad(IDC_BottomView, this)) ;
-  VERIFY(LeftView  .AutoLoad(IDC_LeftView  , this)) ;
-  VERIFY(RightView .AutoLoad(IDC_RightView , this)) ;
-  VERIFY(FrontView .AutoLoad(IDC_FrontView , this)) ;
-  VERIFY(BackView  .AutoLoad(IDC_BackView  , this)) ;
-  VERIFY(AxoView   .AutoLoad(IDC_AxoView   , this)) ;
+  VERIFY(TopView.AutoLoad (IDC_TopView, this));
+  VERIFY(BottomView.AutoLoad (IDC_BottomView, this)) ;
+  VERIFY(LeftView  .AutoLoad (IDC_LeftView  , this)) ;
+  VERIFY(RightView .AutoLoad (IDC_RightView , this)) ;
+  VERIFY(FrontView .AutoLoad (IDC_FrontView , this)) ;
+  VERIFY(BackView  .AutoLoad (IDC_BackView  , this)) ;
+  VERIFY(AxoView   .AutoLoad (IDC_AxoView   , this)) ;
 
   // get the View Window position to managed mouse move
   CRect BoxRect,ViewRect;
-  GetWindowRect(BoxRect);
-  CWnd * TheViewerWindow = GetDlgItem(IDC_DUMMYBUTTON);
-  TheViewerWindow->GetWindowRect(ViewRect);
+  GetWindowRect (BoxRect);
+  CWnd * TheViewerWindow = GetDlgItem (IDC_DUMMYBUTTON);
+  TheViewerWindow->GetWindowRect (ViewRect);
   myPosMinX = ViewRect.TopLeft().x - BoxRect.TopLeft().x;
   myPosMaxX = ViewRect.Width()+myPosMinX;
   myPosMinY = ViewRect.TopLeft().y - BoxRect.TopLeft().y;
   myPosMaxY = myPosMinY + ViewRect.Height();
 
-  ShowHideButton(Standard_False);
-  OnDisplay(true);
+  ShowHideButton (Standard_False);
+  OnDisplay (true);
 
-  return TRUE;  // return TRUE unless you set the focus to a control
+  // return TRUE unless you set the focus to a control
   // EXCEPTION: OCX Property Pages should return FALSE
+  return TRUE;
 }
 
-void CSelectionDialog::OnDisplay(bool isFit) 
+void CSelectionDialog::OnDisplay (bool isFit)
 {
-  GetDlgItem(IDC_DUMMYBUTTON)->SetRedraw(true);
-  if(!myDisplay) {
+  GetDlgItem(IDC_DUMMYBUTTON)->SetRedraw (true);
+  if (!myIsDisplayed)
+  {
     Handle(Graphic3d_GraphicDriver) aGraphicDriver = 
       ((CHLRApp*)AfxGetApp())->GetGraphicDriver();
 
-    myActiveViewer = new V3d_Viewer(aGraphicDriver,(short *) "Visu3D");
+    myActiveViewer = new V3d_Viewer (aGraphicDriver, (short *) "Visu3D");
     myActiveViewer->SetDefaultLights();
     myActiveViewer->SetLightOn();
     myActiveView = myActiveViewer->CreateView();
 
-    Handle(WNT_Window) aWNTWindow = new WNT_Window (GetDlgItem(IDC_DUMMYBUTTON)->GetSafeHwnd(),
+    Handle(WNT_Window) aWNTWindow = new WNT_Window (GetDlgItem (IDC_DUMMYBUTTON)->GetSafeHwnd(),
                                                     Quantity_NOC_GRAY);
     myActiveView->SetComputedMode (m_HlrModeIsOn);
     myActiveView->SetWindow(aWNTWindow);
 
-    myInteractiveContext = new AIS_InteractiveContext(myActiveViewer);
+    myInteractiveContext = new AIS_InteractiveContext (myActiveViewer);
 
     // TRIHEDRON
-    Handle(Geom_Axis2Placement) aTrihedronAxis=new Geom_Axis2Placement(gp::XOY());
-    myTrihedron=new AIS_Trihedron(aTrihedronAxis);
+    Handle(Geom_Axis2Placement) aTrihedronAxis = new Geom_Axis2Placement (gp::XOY());
+    myTrihedron = new AIS_Trihedron (aTrihedronAxis);
 
-    myInteractiveContext->Display(myTrihedron);
+    myInteractiveContext->Display (myTrihedron);
   }
-  if(isFit) {
+  if(isFit)
+  {
     myActiveView->ZFitAll();
     myActiveView->FitAll();
   }
+
   myActiveView->Redraw();
-  myDisplay = Standard_True;
-  GetDlgItem(IDC_DUMMYBUTTON)->SetRedraw(false);
+  myIsDisplayed = Standard_True;
+  GetDlgItem (IDC_DUMMYBUTTON)->SetRedraw (false);
 }
 
 
-void CSelectionDialog::SetTitle(CString & aTitle)
+void CSelectionDialog::SetTitle (const CString & aTitle)
 {
-  SetWindowText(aTitle);
+  SetWindowText (aTitle);
 }
 
-void CSelectionDialog::OnGetShape() 
+void CSelectionDialog::UpdateViews()
 {
-  UpdateData(true);
-  myDoc->GetInteractiveContext2D()->RemoveAll();
-  myDisplayableShape = new ISession2D_Shape( );
-  UpdateProjector();
-  myDisplayableShape->SetNbIsos(m_NbIsos);
+  // Clear HLR dialog view
+  myInteractiveContext->RemoveAll();
+  myInteractiveContext->Display (myTrihedron);
 
-  myInteractiveContext->EraseAll();
-  myInteractiveContext->Display(myTrihedron);
+  UpdateProjector();
 
+  // Display chosen shapes in the HLR dialog view.
   Standard_Boolean OneOrMoreFound = Standard_False;
   for (myDoc->GetAISContext()->InitCurrent();
-       myDoc->GetAISContext()->MoreCurrent ();
-       myDoc->GetAISContext()->NextCurrent ())
+       myDoc->GetAISContext()->MoreCurrent();
+       myDoc->GetAISContext()->NextCurrent())
   {
-    Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast(myDoc->GetAISContext()->Current());
-
+    Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast (myDoc->GetAISContext()->Current());
     if (!anAISShape.IsNull())
-      {
-        OneOrMoreFound = Standard_True;
-        TopoDS_Shape aShape = anAISShape->Shape();
-        myDisplayableShape->Add( aShape  );
-        myInteractiveContext->Display(anAISShape);
-      }
+    {
+      OneOrMoreFound = Standard_True;
+      myInteractiveContext->Display (anAISShape);
+    }
   }
 
-  Standard_Integer DisplayMode = m_DisplayMode;
-  if (m_Algo == 1) DisplayMode+=100;
-  if (!m_DrawHiddenLine) DisplayMode+=1000;
+  // Apply HLR to chosen shapes and display result into the 2d view.
+  Apply();
+  // Update viewer
+  myDoc->FitAll2DViews (Standard_False);
+  // Check the selection: if no object : disable all possiblity.
+  ShowHideButton (OneOrMoreFound);
+  OnDisplay (true);
+}
 
-   myDoc->GetInteractiveContext2D()->Display(myDisplayableShape,  // object
-                                             DisplayMode,  // display mode
-                                             DisplayMode,   // selection mode 
-                                             Standard_True);   // Redraw
+void CSelectionDialog::OnGetSelectedShapes()
+{
+  // Create new displayable shape.
+  myDisplayableShape = new ISession2D_Shape();
+  UpdateProjector();
+  myDisplayableShape->SetNbIsos (m_NbIsos);
 
-  myDoc->FitAll2DViews(Standard_False); // Update Viewer
+  // Clear HLR dialog view
+  myInteractiveContext->RemoveAll();
+  myInteractiveContext->Display (myTrihedron);
 
-  // check the selection :
-  // if no object : disable all possiblity!!
-  ShowHideButton(OneOrMoreFound);
-  OnDisplay(true);
+  Standard_Boolean OneOrMoreFound = Standard_False;
+  for (myDoc->GetAISContext()->InitCurrent();
+       myDoc->GetAISContext()->MoreCurrent();
+       myDoc->GetAISContext()->NextCurrent())
+  {
+    Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast (myDoc->GetAISContext()->Current());
+
+    if (!anAISShape.IsNull())
+    {
+      OneOrMoreFound = Standard_True;
+      TopoDS_Shape aShape = anAISShape->Shape();
+      myDisplayableShape->Add (aShape);
+      myInteractiveContext->Display (anAISShape);
+    }
+  }
+
+  // Apply HLR to chosen shapes and display result into the 2d view.
+  Apply();
+  // Update viewer
+  myDoc->FitAll2DViews (Standard_False);
+
+  // Check the selection: if no object : disable all possiblity.
+  ShowHideButton (OneOrMoreFound);
+  OnDisplay (true);
 }
 
-void CSelectionDialog::Apply() 
+void CSelectionDialog::Apply()
 {
-  SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
+  SetCursor(AfxGetApp()->LoadStandardCursor (IDC_WAIT));
   myDoc->GetInteractiveContext2D()->RemoveAll();
-  UpdateData(true);
+  UpdateData (true);
 
-  Standard_Integer DisplayMode = m_DisplayMode;
-  if (m_Algo == 1) DisplayMode+=100;
+  Standard_Integer aDisplayMode = m_DisplayMode;
 
-  if (!m_DrawHiddenLine) DisplayMode+=1000;
+  if (m_Algo == 1)
+  {
+    aDisplayMode += 100;
+  }
 
-  myDoc->GetInteractiveContext2D()->Display(myDisplayableShape,  // object
-                                            DisplayMode,  
-                                            DisplayMode,
-                                            Standard_True); // Redraw
+  if (!m_DrawHiddenLine)
+  {
+    aDisplayMode += 1000;
+  }
 
-  SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
+  myDoc->GetInteractiveContext2D()->Display (myDisplayableShape,  // object
+                                             aDisplayMode,
+                                             aDisplayMode,
+                                             Standard_True); // Redraw
+
+  SetCursor(AfxGetApp()->LoadStandardCursor (IDC_ARROW));
 }
 
 void CSelectionDialog::UpdateProjector()
@@ -265,8 +300,10 @@ void CSelectionDialog::ShowHideButton(Standard_Boolean EnableButton)
 
   if(m_Algo == 0)
   {
-    if (m_DisplayMode == 5) m_DisplayMode=0;
-    if (m_DisplayMode == 10) m_DisplayMode=0;
+    if (m_DisplayMode == 5 || m_DisplayMode == 10)
+    {
+      m_DisplayMode=0;
+    }
 
     GetDlgItem(IDC_VIsoParametrics)->EnableWindow(false);
     GetDlgItem(IDC_HIsoParametrics)->EnableWindow(false);
@@ -458,7 +495,7 @@ void CSelectionDialog::OnRButtonUp(UINT nFlags, CPoint point)
   }
 
   SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
-  // reset tyhe good HLR mode according to the strored one
+  // reset the good HLR mode according to the stored one
   //   --> dynamic rotation may have change it
   myActiveView->SetComputedMode (m_HlrModeIsOn);
   OnDisplay(false);
index d4b8a26..eb0fedb 100755 (executable)
@@ -18,18 +18,26 @@ class CSelectionDialog : public CDialog
 {
   // Construction
 public:
-  void SetTitle(CString& aTitle);
-  CSelectionDialog(CHLRDoc* aDoc,CWnd* pParent = NULL);   // standard constructor
-  void OnDisplay(bool isfit);
+  // standard constructor
+  CSelectionDialog (CHLRDoc* aDoc,CWnd* pParent = NULL);
+
+  void SetTitle (const CString& aTitle);
+
+  void OnDisplay (bool isFit);
+
+  const Handle(ISession2D_Shape) DiplayableShape() { return myDisplayableShape; }
+
+  // Updates in dialog view and main 2d nad 3d views shapes for which HLR presentations are going to be displayed in 2d view.
+  void UpdateViews();
 
   // Dialog Data
   //{{AFX_DATA(CSelectionDialog)
   enum { IDD = IDD_SelectionDialog };
-  int          m_Algo;
-  int          m_DisplayMode;
-  int          m_NbIsos;
-  BOOL m_DrawHiddenLine;
-  BOOL m_HlrModeIsOn;
+  int m_Algo;
+  int m_DisplayMode;
+  int m_NbIsos;
+  BOOL m_DrawHiddenLine;
+  BOOL m_HlrModeIsOn;
   //}}AFX_DATA
 
   // Overrides
@@ -45,7 +53,7 @@ protected:
   // Generated message map functions
   //{{AFX_MSG(CSelectionDialog)
   virtual BOOL OnInitDialog();
-  afx_msg void OnGetShape();
+  afx_msg void OnGetSelectedShapes();
   afx_msg void OnDisplayDefault();
   afx_msg void OnVIsoParametrics();
   afx_msg void OnVApparentContour();
@@ -85,26 +93,32 @@ private :
   void Apply();
   CHLRDoc* myDoc;
 
+  Handle(AIS_InteractiveContext) myInteractiveContext;
   Handle(V3d_Viewer) myActiveViewer;
   Handle(V3d_View)   myActiveView;
-  Standard_Integer   myPosMaxX,  myPosMinX ,myBoxX;
-  Standard_Integer   myPosMinY, myPosMaxY ,myBoxY;
+  Handle(AIS_Trihedron)          myTrihedron;
+  Handle(ISession2D_Shape)       myDisplayableShape;
+
+  Standard_Integer myPosMaxX;
+  Standard_Integer myPosMinX;
+  Standard_Integer myBoxX;
+
+  Standard_Integer myPosMinY;
+  Standard_Integer myPosMaxY;
+  Standard_Integer myBoxY;
+
   Standard_Integer   myXmax;
   Standard_Integer   myYmax;
 
-  Handle(AIS_InteractiveContext) myInteractiveContext;
-  Handle(AIS_Trihedron)          myTrihedron;
-  Handle(ISession2D_Shape)        myDisplayableShape;
-
 protected:
-  CBitmapButton TopView    ;
-  CBitmapButton BottomView ;
-  CBitmapButton LeftView   ;
-  CBitmapButton RightView  ;
-  CBitmapButton FrontView  ;
-  CBitmapButton BackView   ;
-  CBitmapButton AxoView    ;
-  bool myDisplay;
+  CBitmapButton TopView;
+  CBitmapButton BottomView;
+  CBitmapButton LeftView;
+  CBitmapButton RightView;
+  CBitmapButton FrontView;
+  CBitmapButton BackView;
+  CBitmapButton AxoView;
+  bool myIsDisplayed;
 };
 
 //{{AFX_INSERT_LOCATION}}
diff --git a/samples/mfc/standard/09_Animation/res/Animation.aps b/samples/mfc/standard/09_Animation/res/Animation.aps
deleted file mode 100755 (executable)
index da8b5a1..0000000
Binary files a/samples/mfc/standard/09_Animation/res/Animation.aps and /dev/null differ
index 4061981..14cfb7a 100755 (executable)
@@ -26,6 +26,7 @@ END_MESSAGE_MAP()
 CAnimationApp::CAnimationApp() : OCC_App()
 {
   SampleName = "Animation"; //for about dialog
+  SetSamplePath ("..\\..\\09_Animation");
 }
 
 /////////////////////////////////////////////////////////////////////////////
index 33de177..17d9d2c 100755 (executable)
@@ -360,7 +360,7 @@ void CAnimationDoc::OnFileLoadgrid()
                  NULL );
 
        CString initdir(((OCC_App*) AfxGetApp())->GetInitDataDir());
-       initdir += "\\..\\..\\Data\\";
+       initdir += "\\Data\\";
 
        dlg.m_ofn.lpstrInitialDir = initdir;
 
index b5d06bf..4b01dd3 100755 (executable)
@@ -78,6 +78,7 @@ Convert_Presentation::Convert_Presentation()
 void Convert_Presentation::DoSample()
 {
        ((COCCDemoApp*) AfxGetApp())->SetSampleName("Convert");
+  ((COCCDemoApp*) AfxGetApp())->SetSamplePath("..\\..\\10_Convert");
        getAISContext()->EraseAll();
        if (myIndex >=0 && myIndex < myNbFuncs)
     (this->*SampleFuncs[myIndex])();
index 14f0d78..6c46537 100755 (executable)
@@ -21,7 +21,24 @@ void ISession2D_Shape::Add(const TopoDS_Shape& aShape)
   Update(); // protected method used to specify that the presentation are not up to date 
 }
 
-void ISession2D_Shape::SetProjector(HLRAlgo_Projector& aProjector) 
+void ISession2D_Shape::Remove (const TopoDS_Shape& theShape)
+{
+  if (myListOfShape.Size() == 0)
+  {
+    return;
+  }
+
+  for (NCollection_List<TopoDS_Shape>::Iterator anIt (myListOfShape); anIt.More(); anIt.Next())
+ {
+   if (anIt.Value() == theShape)
+   {
+     myListOfShape.Remove (anIt);
+     return;
+   }
+ }
+}
+
+void ISession2D_Shape::SetProjector (HLRAlgo_Projector& aProjector) 
 {
   myProjector= aProjector;
   myAlgo.Nullify();
@@ -48,7 +65,7 @@ void ISession2D_Shape::SetNbIsos(Standard_Integer& aNbIsos)
 void ISession2D_Shape::BuildAlgo() 
 {
   myAlgo = new HLRBRep_Algo();
-  TopTools_ListIteratorOfListOfShape anIterator(myListOfShape);
+  NCollection_List<TopoDS_Shape>::Iterator anIterator(myListOfShape);
   for (;anIterator.More();anIterator.Next()) myAlgo->Add(anIterator.Value(),myNbIsos);
   myAlgo->Projector(myProjector);
   myAlgo->Update();
@@ -58,7 +75,7 @@ void ISession2D_Shape::BuildAlgo()
 void ISession2D_Shape::BuildPolyAlgo() 
 {
   myPolyAlgo = new HLRBRep_PolyAlgo();
-  TopTools_ListIteratorOfListOfShape anIterator(myListOfShape);
+  NCollection_List<TopoDS_Shape>::Iterator anIterator(myListOfShape);
   for (;anIterator.More();anIterator.Next()) myPolyAlgo->Load(anIterator.Value());
   myPolyAlgo->Projector(myProjector);
   myPolyAlgo->Update();
index 38cd560..397a6e4 100755 (executable)
@@ -1,65 +1,71 @@
 #ifndef _ISession2D_Shape_HeaderFile
 #define _ISession2D_Shape_HeaderFile
 
-#include <Standard_Macro.hxx>
-#include <Standard_DefineHandle.hxx>
-#include "TopoDS_Shape.hxx"
-
-#include "SelectMgr_SelectableObject.hxx"  
-#include "Graphic3d_ArrayOfPolylines.hxx"  
-#include "AIS_InteractiveObject.hxx"  
-
+#include "AIS_InteractiveObject.hxx"
+#include "Graphic3d_ArrayOfPolylines.hxx"
 #include <HLRAlgo_Projector.hxx>
 #include <HLRBRep_Algo.hxx>
 #include <HLRBRep_PolyAlgo.hxx>
+#include <NCollection_List.hxx>
+#include "SelectMgr_SelectableObject.hxx"
+#include <Standard_Macro.hxx>
+#include <Standard_DefineHandle.hxx>
+#include "TopoDS_Shape.hxx"
 
 DEFINE_STANDARD_HANDLE(ISession2D_Shape,AIS_InteractiveObject)
-class ISession2D_Shape : public AIS_InteractiveObject {
 
+class ISession2D_Shape : public AIS_InteractiveObject
+{
 public:
-Standard_EXPORT ISession2D_Shape ();
-void Standard_EXPORT Add(const TopoDS_Shape& aShape);
+  Standard_EXPORT ISession2D_Shape ();
 
-HLRAlgo_Projector& Projector() { return myProjector; }
-Standard_EXPORT void SetProjector(HLRAlgo_Projector& aProjector);
+  // Adds shape to the list of topological shapes
+  void Standard_EXPORT Add (const TopoDS_Shape& aShape);
 
-private:
-Standard_Integer myNbIsos;
+  // Removes shape from the list of shapes.
+  // It is used in case of shapes erasing.
+  void Standard_EXPORT Remove (const TopoDS_Shape& theShape);
+  // Returns myProjector
+  HLRAlgo_Projector& Projector() { return myProjector;};
 
-public :
-Standard_Integer& NbIsos() { return myNbIsos;};
-Standard_EXPORT void SetNbIsos(Standard_Integer& aNbIsos) ;
+  Standard_EXPORT void SetProjector (HLRAlgo_Projector& aProjector);
 
-Standard_Boolean AcceptShapeDecomposition() {return Standard_True;}
 
-virtual Standard_Boolean AcceptSelectionMode(const Standard_Integer /*aMode*/) const
-{return Standard_True; }
+  Standard_Integer& NbIsos() { return myNbIsos;};
 
-DEFINE_STANDARD_RTTI(ISession2D_Shape)
+  Standard_EXPORT void SetNbIsos (Standard_Integer& aNbIsos);
 
-private: 
-void BuildAlgo();
-void BuildPolyAlgo();
+  Standard_Boolean AcceptShapeDecomposition() {return Standard_True;}
 
-void DrawCompound(const Handle(Prs3d_Presentation)& thePresentation,
-                  const TopoDS_Shape& theCompound, 
-                  const Handle(Prs3d_LineAspect) theAspect);
+  virtual Standard_Boolean AcceptSelectionMode (const Standard_Integer /*aMode*/) const
+  { return Standard_True; }
 
+public:
+  DEFINE_STANDARD_RTTI(ISession2D_Shape)
 
-Standard_EXPORT virtual  void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
-                                      const Handle(Prs3d_Presentation)& thePresentation,
-                                      const Standard_Integer theMode = 0);
+private:
+  void BuildAlgo();
+  void BuildPolyAlgo();
 
-virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode) ;
+  void DrawCompound (const Handle(Prs3d_Presentation)& thePresentation,
+                     const TopoDS_Shape& theCompound,
+                     const Handle(Prs3d_LineAspect) theAspect);
 
-private :
-TopTools_ListOfShape myListOfShape;
-HLRAlgo_Projector myProjector;
-Handle(HLRBRep_Algo) myAlgo;
-Handle(HLRBRep_PolyAlgo) myPolyAlgo;
-};
+  Standard_EXPORT virtual  void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+                                         const Handle(Prs3d_Presentation)& thePresentation,
+                                         const Standard_Integer theMode = 0);
 
+  virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection,
+                                 const Standard_Integer aMode);
 
+private:
+
+  Standard_Integer myNbIsos;
+  NCollection_List<TopoDS_Shape> myListOfShape;
+  HLRAlgo_Projector myProjector;
+  Handle(HLRBRep_Algo) myAlgo;
+  Handle(HLRBRep_PolyAlgo) myPolyAlgo;
+};
 // other inCurve functions and methods (like "C++: function call" methods)
 //
 
index b579e8b..1826767 100755 (executable)
@@ -274,21 +274,26 @@ void OCC_3dBaseDoc::OnUpdateObjectColor(CCmdUI* pCmdUI)
     if (myAISContext->IsDisplayed(myAISContext->Current(),0)
                ||myAISContext->IsDisplayed(myAISContext->Current(),1)) 
                OneOrMoreIsShadingOrWireframe=true;
-  pCmdUI->Enable (OneOrMoreIsShadingOrWireframe);      
+  pCmdUI->Enable (OneOrMoreIsShadingOrWireframe);
 }
 
 void OCC_3dBaseDoc::OnObjectErase() 
 {
-  for(myAISContext->InitCurrent();myAISContext->MoreCurrent();myAISContext->NextCurrent())
-        myAISContext->Erase(myAISContext->Current(),Standard_True);
-       myAISContext->ClearCurrents();
+  for (myAISContext->InitCurrent(); myAISContext->MoreCurrent(); myAISContext->NextCurrent())
+  {
+    myAISContext->Erase (myAISContext->Current(), Standard_True);
+  }
+  myAISContext->ClearCurrents();
 }
 void OCC_3dBaseDoc::OnUpdateObjectErase(CCmdUI* pCmdUI) 
 {
   bool OneOrMoreIsDisplayed = false;
-  for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ())
-    if (myAISContext->IsDisplayed(myAISContext->Current())) OneOrMoreIsDisplayed=true;
-  pCmdUI->Enable (OneOrMoreIsDisplayed);       
+  for (myAISContext->InitCurrent(); myAISContext->MoreCurrent(); myAISContext->NextCurrent())
+  {
+    if (myAISContext->IsDisplayed (myAISContext->Current()))
+      OneOrMoreIsDisplayed = true;
+  }
+  pCmdUI->Enable (OneOrMoreIsDisplayed);
 }
 
 void OCC_3dBaseDoc::OnObjectWireframe() 
index 7a10cc2..ba76749 100644 (file)
@@ -129,24 +129,24 @@ BOOL CAboutDlgStd::OnInitDialog(){
 
   Title->SetWindowText(strTitle);
   SetWindowText(dlgTitle);
-  if(SampleName.Find("Viewer2d")==-1)
+
+  CWnd* aReadmeEdit = GetDlgItem(IDC_README);
+  CFile aFile;
+  CString aHelpFilePath = CString (((OCC_App*)AfxGetApp())->GetInitDataDir()) + "\\README.txt";
+  if(aFile.Open (aHelpFilePath, CFile::modeRead))
   {
-    CWnd* aReadmeEdit = GetDlgItem(IDC_README);
-    aReadmeEdit->ShowWindow(FALSE);
+    aReadmeEdit->ShowWindow(TRUE);
+    UINT aFileLength = (UINT)aFile.GetLength();
+    char* buffer=new char[aFileLength];
+    aFile.Read(buffer,aFileLength);
+    ReadmeText.SetString(buffer);
+    ReadmeText.SetAt(aFileLength,'\0');
+    ReadmeText.Replace("\n","\r\n");
+    UpdateData(FALSE);
   }
   else
   {
-    CFile aFile;
-    if(aFile.Open("..//..//..//README.txt",CFile::modeRead))
-    {
-      UINT aFileLength = (UINT)aFile.GetLength();
-      char* buffer=new char[aFileLength];
-      aFile.Read(buffer,aFileLength);
-      ReadmeText.SetString(buffer);
-      ReadmeText.SetAt(aFileLength,'\0');
-      ReadmeText.Replace("\n","\r\n");
-      UpdateData(FALSE);
-    }
+    aReadmeEdit->ShowWindow(FALSE);
   }
 
   CenterWindow();
diff --git a/samples/mfc/standard/Common/res/OCC_Resource.aps b/samples/mfc/standard/Common/res/OCC_Resource.aps
deleted file mode 100755 (executable)
index f404b32..0000000
Binary files a/samples/mfc/standard/Common/res/OCC_Resource.aps and /dev/null differ
index c6951ea..3cb627e 100755 (executable)
@@ -129,7 +129,7 @@ BEGIN
     DEFPUSHBUTTON   "OK",IDOK,101,233,88,14,WS_GROUP
     CTEXT           "http://www.opencascade.com",IDC_STATIC,92,116,98,8,SS_CENTERIMAGE
     CONTROL         1300,IDC_STATIC,"Static",SS_BITMAP,73,28,132,64,WS_EX_CLIENTEDGE
-    EDITTEXT        IDC_README,7,131,270,94,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL,WS_EX_LEFTSCROLLBAR
+    EDITTEXT        IDC_README,7,131,270,94,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
 END
 
 IDD_ResultDialog DIALOG  0, 0, 212, 202