Compilation errors were corrected.
Removed .aps files
Sample paths fields were updated to read help file from sample folder.
CGeometryApp::CGeometryApp() : OCC_App()
{
- SampleName = "Geometry"; //for about dialog
+ SampleName = "Geometry"; //for about dialog
+ SetSamplePath ("..\\..\\01_Geometry");
}
CGeometryApp::~CGeometryApp()
CModelingApp::CModelingApp() : OCC_App()
{
SampleName = "Modeling"; //for about dialog
+ SetSamplePath ("..\\..\\02_Modeling");
}
/////////////////////////////////////////////////////////////////////////////
-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;
CViewer2dApp::CViewer2dApp() : OCC_App()
{
SampleName = "Viewer2d"; //for about dialog
+ SetSamplePath ("..\\..\\03_Viewer2d");
}
/////////////////////////////////////////////////////////////////////////////
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)
{
CViewer3dApp::CViewer3dApp() : OCC_App()
{
SampleName = "Viewer3d"; //for about dialog
+ SetSamplePath ("..\\..\\03_Viewer3d");
}
/////////////////////////////////////////////////////////////////////////////
}
SampleName = "ImportExport"; //for about dialog
+ SetSamplePath ("..\\..\\05_ImportExport");
}
/////////////////////////////////////////////////////////////////////////////
COcafApp::COcafApp() : OCC_App()
{
- SetSamplePath("06_Ocaf");
myApp = new TOcaf_Application();
SampleName = "OCAF"; //for about dialog
+ SetSamplePath ("..\\..\\06_Ocaf");
try
{
CTriangulationApp::CTriangulationApp() : OCC_App()
{
SampleName = "TopologyTriangulation"; //for about dialog
+ SetSamplePath("..\\..\\07_Triangulation");
}
/////////////////////////////////////////////////////////////////////////////
--- /dev/null
+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.
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
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
#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
CHLRApp::CHLRApp() : OCC_App()
{
SampleName = "HLR"; //for about dialog
+ SetSamplePath ("..\\..\\08_HLR");
}
CHLRApp::~CHLRApp()
//{{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
}
}
-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
/////////////////////////////////////////////////////////////////////////////
// CHLRDoc commands
-void CHLRDoc::OnBUTTONHLRDialog()
+void CHLRDoc::OnBUTTONHLRDialog()
{
if (!myCSelectionDialogIsCreated)
{
myCSelectionDialog->Create(CSelectionDialog::IDD, AfxGetMainWnd());
myCSelectionDialogIsCreated = true;
}
- myCSelectionDialog->ShowWindow(SW_RESTORE);
+ myCSelectionDialog->ShowWindow(SW_RESTORE);
}
void CHLRDoc::OnFileImportBrep()
}
}
}
+
+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();
+ }
+}
afx_msg void OnWindowNew2d();
afx_msg void OnFileImportBrep();
afx_msg void OnBUTTONHLRDialog();
+ afx_msg void OnObjectErase();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// 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;
//}}AFX_DATA_INIT
}
-void CSelectionDialog::DoDataExchange(CDataExchange* pDX)
+void CSelectionDialog::DoDataExchange (CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSelectionDialog)
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)
/////////////////////////////////////////////////////////////////////////////
// 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()
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);
}
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);
{
// 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
// 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();
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}}
CAnimationApp::CAnimationApp() : OCC_App()
{
SampleName = "Animation"; //for about dialog
+ SetSamplePath ("..\\..\\09_Animation");
}
/////////////////////////////////////////////////////////////////////////////
NULL );
CString initdir(((OCC_App*) AfxGetApp())->GetInitDataDir());
- initdir += "\\..\\..\\Data\\";
+ initdir += "\\Data\\";
dlg.m_ofn.lpstrInitialDir = initdir;
void Convert_Presentation::DoSample()
{
((COCCDemoApp*) AfxGetApp())->SetSampleName("Convert");
+ ((COCCDemoApp*) AfxGetApp())->SetSamplePath("..\\..\\10_Convert");
getAISContext()->EraseAll();
if (myIndex >=0 && myIndex < myNbFuncs)
(this->*SampleFuncs[myIndex])();
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();
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();
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();
#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)
//
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()
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();
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