mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
163
samples/mfc/standard/08_HLR/src/HLRApp.cpp
Executable file
163
samples/mfc/standard/08_HLR/src/HLRApp.cpp
Executable file
@@ -0,0 +1,163 @@
|
||||
// HLRApp.cpp : Defines the class behaviors for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "HLRApp.h"
|
||||
|
||||
#include <OCC_MainFrame.h>
|
||||
#include <OCC_3dChildFrame.h>
|
||||
#include "HLRDoc.h"
|
||||
#include <OCC_2dChildFrame.h>
|
||||
#include "HLRView2D.h"
|
||||
#include <OCC_3dView.h>
|
||||
// End CasCade
|
||||
|
||||
#ifdef _DEBUG
|
||||
// CasCade :
|
||||
//#define new DEBUG_NEW
|
||||
// End CasCade
|
||||
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHLRApp construction
|
||||
|
||||
CHLRApp::CHLRApp()
|
||||
{
|
||||
SampleName = "HLR"; //for about dialog
|
||||
}
|
||||
|
||||
CHLRApp::~CHLRApp()
|
||||
{
|
||||
delete pDocTemplateForView2d;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// The one and only CHLRApp object
|
||||
|
||||
CHLRApp theApp;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHLRApp initialization
|
||||
|
||||
BOOL CHLRApp::InitInstance()
|
||||
{
|
||||
AfxEnableControlContainer();
|
||||
|
||||
// Standard initialization
|
||||
// If you are not using these features and wish to reduce the size
|
||||
// of your final executable, you should remove from the following
|
||||
// the specific initialization routines you do not need.
|
||||
|
||||
// Change the registry key under which our settings are stored.
|
||||
// You should modify this string to be something appropriate
|
||||
// such as the name of your company or organization.
|
||||
// Modified by CasCade :
|
||||
SetRegistryKey(_T("Local CasCade Applications"));
|
||||
|
||||
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
|
||||
|
||||
// Register the application's document templates. Document templates
|
||||
// serve as the connection between documents, frame windows and views.
|
||||
|
||||
// CasCade :
|
||||
|
||||
|
||||
pDocTemplateForView2d = new CMultiDocTemplate(
|
||||
IDR_2DTYPE,
|
||||
RUNTIME_CLASS(CHLRDoc),
|
||||
RUNTIME_CLASS(OCC_2dChildFrame), // custom MDI child frame
|
||||
RUNTIME_CLASS(CHLRView2D));
|
||||
|
||||
// AddDocTemplate(pDocTemplateForView2d);
|
||||
|
||||
// End CasCade
|
||||
|
||||
pDocTemplateForView3d = new CMultiDocTemplate(
|
||||
IDR_3DTYPE,
|
||||
RUNTIME_CLASS(CHLRDoc),
|
||||
RUNTIME_CLASS(OCC_3dChildFrame), // custom MDI child frame
|
||||
RUNTIME_CLASS(OCC_3dView));
|
||||
|
||||
AddDocTemplate(pDocTemplateForView3d);
|
||||
|
||||
|
||||
// create main MDI Frame window
|
||||
OCC_MainFrame* pMainFrame = new OCC_MainFrame(with_AIS_TB);
|
||||
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
|
||||
return FALSE;
|
||||
m_pMainWnd = pMainFrame;
|
||||
|
||||
// Parse command line for standard shell commands, DDE, file open
|
||||
CCommandLineInfo cmdInfo;
|
||||
ParseCommandLine(cmdInfo);
|
||||
|
||||
// Dispatch commands specified on the command line
|
||||
if (!ProcessShellCommand(cmdInfo))
|
||||
return FALSE;
|
||||
|
||||
// The main window has been initialized, so show and update it.
|
||||
pMainFrame->MDITile(MDITILE_VERTICAL);
|
||||
pMainFrame->ShowWindow(m_nCmdShow);
|
||||
pMainFrame->UpdateWindow();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHLRApp commands
|
||||
|
||||
//===================================================
|
||||
|
||||
CFrameWnd* CHLRApp::CreateView2D(CHLRDoc* pDoc )
|
||||
{
|
||||
ASSERT_VALID(pDoc);
|
||||
ASSERT_VALID(pDocTemplateForView2d);
|
||||
CRuntimeClass * pViewClass = RUNTIME_CLASS(OCC_2dView);
|
||||
ASSERT(pViewClass != (CRuntimeClass *)NULL );
|
||||
// Create a new frame window
|
||||
CFrameWnd* pNewFrame = pDocTemplateForView2d->CreateNewFrame(pDoc, NULL);
|
||||
ASSERT_VALID(pDoc);
|
||||
pDocTemplateForView2d->InitialUpdateFrame(pNewFrame, pDoc);
|
||||
ASSERT_VALID(pDoc);
|
||||
return pNewFrame;
|
||||
}
|
||||
|
||||
//===================================================
|
||||
CFrameWnd* CHLRApp::CreateView3D(CHLRDoc* pDoc )
|
||||
{
|
||||
ASSERT_VALID(pDoc);
|
||||
ASSERT_VALID(pDocTemplateForView3d);
|
||||
CRuntimeClass * pViewClass = RUNTIME_CLASS(OCC_3dView);
|
||||
ASSERT(pViewClass != (CRuntimeClass *)NULL );
|
||||
// Create a new frame window
|
||||
CFrameWnd* pNewFrame = pDocTemplateForView3d->CreateNewFrame(pDoc, NULL);
|
||||
pDocTemplateForView3d->InitialUpdateFrame(pNewFrame, pDoc);
|
||||
return pNewFrame;
|
||||
|
||||
}
|
||||
|
||||
|
||||
BOOL CHLRApp::IsViewExisting(CDocument * pDoc, CRuntimeClass * pViewClass, CView * & pView)
|
||||
{
|
||||
ASSERT_VALID(pDoc);
|
||||
ASSERT(pViewClass != (CRuntimeClass *)NULL );
|
||||
|
||||
POSITION position = pDoc->GetFirstViewPosition();
|
||||
while (position != (POSITION)NULL)
|
||||
{
|
||||
CView* pCurrentView = pDoc->GetNextView(position);
|
||||
ASSERT_VALID(pCurrentView);
|
||||
if (pCurrentView->IsKindOf(pViewClass))
|
||||
{
|
||||
pView = pCurrentView;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
36
samples/mfc/standard/08_HLR/src/HLRApp.h
Executable file
36
samples/mfc/standard/08_HLR/src/HLRApp.h
Executable file
@@ -0,0 +1,36 @@
|
||||
// HLRApp.h : main header file for the HLR application
|
||||
//
|
||||
|
||||
#if !defined(AFX_HLR_H__376C7004_0B3D_11D2_8E0A_0800369C8A03__INCLUDED_)
|
||||
#define AFX_HLR_H__376C7004_0B3D_11D2_8E0A_0800369C8A03__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include <OCC_3dApp.h>
|
||||
#include "HLRDoc.h"
|
||||
//#include "CutAndPasteSession.h"
|
||||
|
||||
class CHLRApp : public OCC_3dApp
|
||||
{
|
||||
public:
|
||||
CHLRApp();
|
||||
~CHLRApp();
|
||||
virtual BOOL InitInstance();
|
||||
|
||||
// =========================================
|
||||
CFrameWnd* CreateView2D(CHLRDoc* pDoc);
|
||||
// =========================================
|
||||
CFrameWnd* CreateView3D(CHLRDoc* pDoc);
|
||||
// =========================================
|
||||
|
||||
private :
|
||||
BOOL IsViewExisting(CDocument* pDoc,CRuntimeClass* pViewClass,CView*& pView);
|
||||
CMultiDocTemplate* pDocTemplateForView3d;
|
||||
CMultiDocTemplate* pDocTemplateForView2d;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // !defined(AFX_HLR_H__376C7004_0B3D_11D2_8E0A_0800369C8A03__INCLUDED_)
|
234
samples/mfc/standard/08_HLR/src/HLRDoc.cpp
Executable file
234
samples/mfc/standard/08_HLR/src/HLRDoc.cpp
Executable file
@@ -0,0 +1,234 @@
|
||||
// HLRDoc.cpp : implementation of the CHLRDoc class
|
||||
//
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "HLRDoc.h"
|
||||
|
||||
#include "HLRApp.h"
|
||||
#include <OCC_2dView.h>
|
||||
#include <OCC_3dView.h>
|
||||
|
||||
|
||||
#include <ImportExport/ImportExport.h>
|
||||
#include "AISDialogs.h"
|
||||
#include "Properties/PropertiesSheet.h"
|
||||
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
|
||||
#ifdef _DEBUG
|
||||
//#define new DEBUG_NEW // by cascade
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHLRDoc
|
||||
|
||||
IMPLEMENT_DYNCREATE(CHLRDoc, CDocument)
|
||||
|
||||
|
||||
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_IMPORT_BREP, OnFileImportBrep)
|
||||
ON_COMMAND(ID_BUTTON_HLRDialog, OnBUTTONHLRDialog)
|
||||
ON_COMMAND(ID_MENU_CASCADE_PROPERTIES, OnBUTTONTest2DProperties)
|
||||
//}}AFX_MSG_MAP
|
||||
|
||||
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHLRDoc construction/destruction
|
||||
|
||||
CHLRDoc::CHLRDoc()
|
||||
{
|
||||
// TODO: add one-time construction code here
|
||||
|
||||
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
|
||||
((CHLRApp*)AfxGetApp())->GetGraphicDevice();
|
||||
|
||||
TCollection_ExtendedString a3DName("Visu3D");
|
||||
myViewer = new V3d_Viewer(theGraphicDevice,a3DName.ToExtString(),"", 1000.0,
|
||||
V3d_XposYnegZpos, Quantity_NOC_GRAY30,
|
||||
V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
|
||||
Standard_True, Standard_False);
|
||||
/*
|
||||
Handle(V3d_Viewer) myViewerCollector;
|
||||
myViewerCollector = new V3d_Viewer(theGraphicDevice,a3DName.ToExtString(),"", 1000.0,
|
||||
V3d_XposYnegZpos, Quantity_NOC_GRAY30,
|
||||
V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
|
||||
Standard_True, Standard_False);
|
||||
*/
|
||||
myViewer->SetDefaultLights();
|
||||
myViewer->SetLightOn();
|
||||
|
||||
//myAISContext =new AIS_InteractiveContext(myViewer,myViewerCollector);
|
||||
|
||||
myAISContext =new AIS_InteractiveContext(myViewer);
|
||||
|
||||
// VIEWER 2D
|
||||
TCollection_ExtendedString a2DName("Visu2D");
|
||||
my2DViewer = new V2d_Viewer(theGraphicDevice,a2DName.ToExtString());
|
||||
my2DViewer->SetCircularGridValues(0,0,10,8,0);
|
||||
my2DViewer->SetRectangularGridValues(0,0,10,10,0);
|
||||
|
||||
myInteractiveContext2D= new ISession2D_InteractiveContext(my2DViewer);
|
||||
|
||||
CFrameWnd* pFrame2d=((CHLRApp*)AfxGetApp())->CreateView2D(this);
|
||||
pFrame2d->ShowWindow(SW_SHOWNORMAL/*SW_MINIMIZE*/);
|
||||
|
||||
// update the Maps :
|
||||
// entries are reserve for utilisation :
|
||||
// - 1 for Visible edges HighLighted
|
||||
// - 2 for Visible edges
|
||||
// - 3 for Hidden edges HighLighted
|
||||
// - 4 for Hidden edges
|
||||
|
||||
Handle(Aspect_GenericColorMap) aColorMap= Handle(Aspect_GenericColorMap)::DownCast(my2DViewer->ColorMap());
|
||||
ASSERT(!aColorMap.IsNull());
|
||||
aColorMap->AddEntry(Aspect_ColorMapEntry (1,Quantity_Color(Quantity_NOC_RED ))); // in fact just update
|
||||
aColorMap->AddEntry(Aspect_ColorMapEntry (2,Quantity_Color(Quantity_NOC_WHITE))); // in fact just update
|
||||
aColorMap->AddEntry(Aspect_ColorMapEntry (3,Quantity_Color(Quantity_NOC_RED ))); // in fact just update
|
||||
aColorMap->AddEntry(Aspect_ColorMapEntry (4,Quantity_Color(Quantity_NOC_BLUE1))); // in fact just update
|
||||
my2DViewer->SetColorMap(aColorMap);
|
||||
|
||||
Handle(Aspect_WidthMap) aWidthMap = my2DViewer->WidthMap();
|
||||
aWidthMap->AddEntry(Aspect_WidthMapEntry(1,0.8)); // in fact just update
|
||||
aWidthMap->AddEntry(Aspect_WidthMapEntry(2,0.4)); // in fact just update
|
||||
aWidthMap->AddEntry(Aspect_WidthMapEntry(3,0.6)); // in fact just update
|
||||
aWidthMap->AddEntry(Aspect_WidthMapEntry(4,0.2)); // in fact just update
|
||||
my2DViewer->SetWidthMap(aWidthMap);
|
||||
|
||||
Handle(Aspect_TypeMap) aTypeMap = my2DViewer->TypeMap();
|
||||
aTypeMap->AddEntry(Aspect_TypeMapEntry(1,Aspect_LineStyle(Aspect_TOL_SOLID)));
|
||||
aTypeMap->AddEntry(Aspect_TypeMapEntry(2,Aspect_LineStyle(Aspect_TOL_SOLID)));
|
||||
TColQuantity_Array1OfLength anArray(1,2);
|
||||
anArray(1) = 0.5; anArray(2) = 0.5;
|
||||
aTypeMap->AddEntry(Aspect_TypeMapEntry(3,Aspect_LineStyle(anArray)));
|
||||
aTypeMap->AddEntry(Aspect_TypeMapEntry(4,Aspect_LineStyle(anArray)));
|
||||
my2DViewer->SetTypeMap(aTypeMap);
|
||||
|
||||
myCSelectionDialogIsCreated=false;
|
||||
}
|
||||
|
||||
CHLRDoc::~CHLRDoc()
|
||||
{
|
||||
if (myCSelectionDialogIsCreated)
|
||||
{
|
||||
myCSelectionDialog->ShowWindow(SW_ERASE);
|
||||
delete myCSelectionDialog;
|
||||
}
|
||||
}
|
||||
|
||||
void CHLRDoc::OnWindowNew2d()
|
||||
{
|
||||
((CHLRApp*)AfxGetApp())->CreateView2D(this);
|
||||
}
|
||||
|
||||
void CHLRDoc::OnWindowNew3d()
|
||||
{
|
||||
((CHLRApp*)AfxGetApp())->CreateView3D(this);
|
||||
}
|
||||
|
||||
// nCmdShow could be : ( default is SW_RESTORE )
|
||||
// SW_HIDE SW_SHOWNORMAL SW_NORMAL
|
||||
// SW_SHOWMINIMIZED SW_SHOWMAXIMIZED
|
||||
// SW_MAXIMIZE SW_SHOWNOACTIVATE
|
||||
// SW_SHOW SW_MINIMIZE
|
||||
// SW_SHOWMINNOACTIVE SW_SHOWNA
|
||||
// SW_RESTORE SW_SHOWDEFAULT
|
||||
// SW_MAX
|
||||
|
||||
// use pViewClass = RUNTIME_CLASS( CHLRView3D ) for 3D Views
|
||||
// use pViewClass = RUNTIME_CLASS( CHLRView2D ) for 2D Views
|
||||
|
||||
void CHLRDoc::ActivateFrame(CRuntimeClass* pViewClass,int nCmdShow)
|
||||
{
|
||||
POSITION position = GetFirstViewPosition();
|
||||
while (position != (POSITION)NULL)
|
||||
{
|
||||
CView* pCurrentView = (CView*)GetNextView(position);
|
||||
if(pCurrentView->IsKindOf(pViewClass) )
|
||||
{
|
||||
ASSERT_VALID(pCurrentView);
|
||||
CFrameWnd* pParentFrm = pCurrentView->GetParentFrame();
|
||||
ASSERT(pParentFrm != (CFrameWnd *)NULL);
|
||||
// simply make the frame window visible
|
||||
pParentFrm->ActivateFrame(nCmdShow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CHLRDoc::FitAll2DViews(Standard_Boolean UpdateViewer)
|
||||
{
|
||||
if (UpdateViewer) my2DViewer->Update();
|
||||
POSITION position = GetFirstViewPosition();
|
||||
while (position != (POSITION)NULL)
|
||||
{
|
||||
CView* pCurrentView = (CView*)GetNextView(position);
|
||||
if(pCurrentView->IsKindOf(RUNTIME_CLASS(OCC_2dView)) )
|
||||
{
|
||||
ASSERT_VALID(pCurrentView);
|
||||
((OCC_2dView*)pCurrentView)->GetV2dView()->Fitall();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CHLRDoc::OnBUTTONTest2DProperties()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
CPropertiesSheet aDial;
|
||||
aDial.SetViewer(my2DViewer);
|
||||
aDial.DoModal();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHLRDoc diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CHLRDoc::AssertValid() const
|
||||
{
|
||||
CDocument::AssertValid();
|
||||
}
|
||||
|
||||
void CHLRDoc::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CDocument::Dump(dc);
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHLRDoc commands
|
||||
void CHLRDoc::OnBUTTONHLRDialog()
|
||||
|
||||
{
|
||||
if (!myCSelectionDialogIsCreated)
|
||||
{
|
||||
myCSelectionDialog = new CSelectionDialog(this,AfxGetMainWnd());
|
||||
myCSelectionDialog->Create(CSelectionDialog::IDD, AfxGetMainWnd());
|
||||
myCSelectionDialogIsCreated = true;
|
||||
}
|
||||
myCSelectionDialog->ShowWindow(SW_RESTORE);
|
||||
}
|
||||
|
||||
void CHLRDoc::OnFileImportBrep()
|
||||
{ CImportExport::ReadBREP(myAISContext);
|
||||
Fit();
|
||||
}
|
||||
void CHLRDoc::Fit()
|
||||
{
|
||||
POSITION position = GetFirstViewPosition();
|
||||
while (position != (POSITION)NULL)
|
||||
{
|
||||
CView* pCurrentView = (CView*)GetNextView(position);
|
||||
if(pCurrentView->IsKindOf(RUNTIME_CLASS(OCC_3dView)) )
|
||||
{
|
||||
((OCC_3dView *) pCurrentView)->FitAll();
|
||||
}
|
||||
}
|
||||
}
|
68
samples/mfc/standard/08_HLR/src/HLRDoc.h
Executable file
68
samples/mfc/standard/08_HLR/src/HLRDoc.h
Executable file
@@ -0,0 +1,68 @@
|
||||
// HLRDoc.h : interface of the CHLRDoc class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_HLRDOC_H__376C700E_0B3D_11D2_8E0A_0800369C8A03__INCLUDED_)
|
||||
#define AFX_HLRDOC_H__376C700E_0B3D_11D2_8E0A_0800369C8A03__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include <ISession2D/ISession2D_InteractiveContext.h>
|
||||
#include "SelectionDialog.h"
|
||||
#include <OCC_3dDoc.h>
|
||||
|
||||
class CHLRDoc : public OCC_3dBaseDoc
|
||||
{
|
||||
public:
|
||||
|
||||
protected: // create from serialization only
|
||||
CHLRDoc();
|
||||
DECLARE_DYNCREATE(CHLRDoc)
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CHLRDoc();
|
||||
void Fit();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CHLRDoc)
|
||||
afx_msg void OnWindowNew3d();
|
||||
afx_msg void OnWindowNew2d();
|
||||
afx_msg void OnFileImportBrep();
|
||||
afx_msg void OnBUTTONTest2DProperties();
|
||||
afx_msg void OnBUTTONHLRDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public :
|
||||
void ActivateFrame(CRuntimeClass* pViewClass, int nCmdShow = SW_RESTORE );
|
||||
|
||||
private:
|
||||
Handle_V2d_Viewer my2DViewer;
|
||||
Handle_ISession2D_InteractiveContext myInteractiveContext2D;
|
||||
public :
|
||||
Handle_V2d_Viewer GetViewer2D() { return my2DViewer; };
|
||||
Handle_ISession2D_InteractiveContext& GetInteractiveContext2D(){ return myInteractiveContext2D; };
|
||||
void FitAll2DViews(Standard_Boolean UpdateViewer=Standard_False);
|
||||
|
||||
public :
|
||||
CSelectionDialog* myCSelectionDialog;
|
||||
bool myCSelectionDialogIsCreated;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_HLRDOC_H__376C700E_0B3D_11D2_8E0A_0800369C8A03__INCLUDED_)
|
149
samples/mfc/standard/08_HLR/src/HLRView2D.cpp
Executable file
149
samples/mfc/standard/08_HLR/src/HLRView2D.cpp
Executable file
@@ -0,0 +1,149 @@
|
||||
// HLRView.cpp : implementation of the CHLRView2D class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "HLRView2D.h"
|
||||
|
||||
#include "HLRApp.h"
|
||||
#include "HLRDoc.h"
|
||||
#include "resource2d\RectangularGrid.h"
|
||||
#include "resource2d\CircularGrid.h"
|
||||
|
||||
#define ValZWMin 1
|
||||
|
||||
#ifdef _DEBUG
|
||||
//#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
// the key for multi selection :
|
||||
#define MULTISELECTIONKEY MK_SHIFT
|
||||
|
||||
// the key for shortcut ( use to activate dynamic rotation, panning )
|
||||
#define CASCADESHORTCUTKEY MK_CONTROL
|
||||
|
||||
// define in witch case you want to display the popup
|
||||
#define POPUPONBUTTONDOWN
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHLRView2D
|
||||
|
||||
IMPLEMENT_DYNCREATE(CHLRView2D, OCC_2dView)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CHLRView2D, OCC_2dView)
|
||||
//{{AFX_MSG_MAP(CHLRView2D)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHLRView2D construction/destruction
|
||||
|
||||
CHLRView2D::CHLRView2D()
|
||||
{
|
||||
}
|
||||
|
||||
CHLRView2D::~CHLRView2D()
|
||||
{
|
||||
}
|
||||
|
||||
CHLRDoc* CHLRView2D::GetDocument() // non-debug version is inline
|
||||
{
|
||||
//ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(OCC_2dDoc)));
|
||||
return (CHLRDoc*)m_pDocument;
|
||||
}
|
||||
|
||||
|
||||
void CHLRView2D::OnInitialUpdate()
|
||||
{
|
||||
|
||||
Handle(WNT_Window) aWNTWindow;
|
||||
aWNTWindow = new WNT_Window(((CHLRApp*)AfxGetApp())->GetGraphicDevice(),GetSafeHwnd());
|
||||
// aWNTWindow->SetBackground(Quantity_NOC_BLACK);
|
||||
|
||||
Handle(WNT_WDriver) aDriver= new WNT_WDriver(aWNTWindow);
|
||||
myV2dView = new V2d_View(aDriver, GetDocument()->GetViewer2D(),0,0,50);
|
||||
|
||||
// initialyse the grids dialogs
|
||||
TheRectangularGridDialog.Create(CRectangularGrid::IDD, NULL);
|
||||
TheCircularGridDialog.Create(CCircularGrid::IDD, NULL);
|
||||
TheRectangularGridDialog.SetViewer (GetDocument()->GetViewer2D());
|
||||
TheCircularGridDialog.SetViewer (GetDocument()->GetViewer2D());
|
||||
|
||||
Standard_Integer w=100 , h=100 ; /* Debug Matrox */
|
||||
aWNTWindow->Size (w,h) ; /* Keeps me unsatisfied (rlb)..... */
|
||||
/* Resize is not supposed to be done on */
|
||||
/* Matrox */
|
||||
/* I suspect another problem elsewhere */
|
||||
::PostMessage ( GetSafeHwnd () , WM_SIZE , SIZE_RESTORED , w + h*65536 ) ;
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
void CHLRView2D::DragEvent2D(const Standard_Integer x ,
|
||||
const Standard_Integer y ,
|
||||
const Standard_Integer TheState )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
void CHLRView2D::InputEvent2D(const Standard_Integer x ,
|
||||
const Standard_Integer y )
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
void CHLRView2D::MoveEvent2D(const Standard_Integer x ,
|
||||
const Standard_Integer y )
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
void CHLRView2D::MultiMoveEvent2D(const Standard_Integer x ,
|
||||
const Standard_Integer y )
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
void CHLRView2D::MultiDragEvent2D(const Standard_Integer x ,
|
||||
const Standard_Integer y ,
|
||||
const Standard_Integer TheState)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
void CHLRView2D::MultiInputEvent2D(const Standard_Integer x ,
|
||||
const Standard_Integer y )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CHLRView2D::AssertValid() const
|
||||
{
|
||||
OCC_2dView::AssertValid();
|
||||
}
|
||||
|
||||
void CHLRView2D::Dump(CDumpContext& dc) const
|
||||
{
|
||||
OCC_2dView::Dump(dc);
|
||||
}
|
||||
|
||||
#endif
|
71
samples/mfc/standard/08_HLR/src/HLRView2D.h
Executable file
71
samples/mfc/standard/08_HLR/src/HLRView2D.h
Executable file
@@ -0,0 +1,71 @@
|
||||
// HLRView.h : interface of the CHLRView2D class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_HLRVIEW2D_H__376C7013_0B3D_11D2_8E0A_0800369C8A03_2D_INCLUDED_)
|
||||
#define AFX_HLRVIEW2D_H__376C7013_0B3D_11D2_8E0A_0800369C8A03_2D_INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include "HLRDoc.h"
|
||||
#include <OCC_2dView.h>
|
||||
#include "Resource2d/RectangularGrid.h"
|
||||
#include "Resource2d/CircularGrid.h"
|
||||
|
||||
|
||||
class CHLRView2D : public OCC_2dView
|
||||
{
|
||||
protected: // create from serialization only
|
||||
CHLRView2D();
|
||||
DECLARE_DYNCREATE(CHLRView2D)
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CHLRView2D)
|
||||
protected:
|
||||
virtual void OnInitialUpdate(); // called first time after construct
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CHLRView2D();
|
||||
CHLRDoc* GetDocument();
|
||||
virtual void DragEvent2D (const Standard_Integer x ,
|
||||
const Standard_Integer y ,
|
||||
const Standard_Integer TheState);
|
||||
virtual void InputEvent2D (const Standard_Integer x ,
|
||||
const Standard_Integer y );
|
||||
virtual void MoveEvent2D (const Standard_Integer x ,
|
||||
const Standard_Integer y );
|
||||
virtual void MultiMoveEvent2D (const Standard_Integer x ,
|
||||
const Standard_Integer y );
|
||||
virtual void MultiDragEvent2D (const Standard_Integer x ,
|
||||
const Standard_Integer y ,
|
||||
const Standard_Integer TheState);
|
||||
virtual void MultiInputEvent2D (const Standard_Integer x ,
|
||||
const Standard_Integer y );
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CHLRView2D)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_HLRVIEW2D_H__376C7013_0B3D_11D2_8E0A_0800369C8A03_2D_INCLUDED_)
|
390
samples/mfc/standard/08_HLR/src/HLRView3D.cpp
Executable file
390
samples/mfc/standard/08_HLR/src/HLRView3D.cpp
Executable file
@@ -0,0 +1,390 @@
|
||||
// HLRView.cpp : implementation of the CHLRView3D3D class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "HLRApp.h"
|
||||
|
||||
#include "HLRDoc.h"
|
||||
#include "HLRView3D.h"
|
||||
#include "..\..\Common\res\OCC_Resource.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
//#define new DEBUG_NEW by CasCade
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
// for elastic bean selection
|
||||
#define ValZWMin 1
|
||||
|
||||
// the key for multi selection :
|
||||
#define MULTISELECTIONKEY MK_SHIFT
|
||||
|
||||
// the key for shortcut ( use to activate dynamic rotation, panning )
|
||||
#define CASCADESHORTCUTKEY MK_CONTROL
|
||||
|
||||
// define in witch case you want to display the popup
|
||||
#define POPUPONBUTTONDOWN
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHLRView3D
|
||||
|
||||
IMPLEMENT_DYNCREATE(CHLRView3D, OCC_3dView)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CHLRView3D, OCC_3dView)
|
||||
//{{AFX_MSG_MAP(CHLRView3D)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG_MAP
|
||||
// CasCade
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_LBUTTONUP()
|
||||
ON_WM_MOUSEMOVE()
|
||||
ON_WM_RBUTTONDOWN()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHLRView3D construction/destruction
|
||||
|
||||
CHLRView3D::CHLRView3D()
|
||||
{
|
||||
}
|
||||
|
||||
CHLRView3D::~CHLRView3D()
|
||||
{
|
||||
}
|
||||
|
||||
void CHLRView3D::OnInitialUpdate()
|
||||
{
|
||||
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
myView = GetDocument()->GetViewer()->CreateView();
|
||||
|
||||
// store for restore state after rotation (witch is in Degenerated mode)
|
||||
myDegenerateModeIsOn = myView->DegenerateModeIsOn();
|
||||
|
||||
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
|
||||
((CHLRApp*)AfxGetApp())->GetGraphicDevice();
|
||||
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window(theGraphicDevice,GetSafeHwnd ());
|
||||
myView->SetWindow(aWNTWindow);
|
||||
if (!aWNTWindow->IsMapped()) aWNTWindow->Map();
|
||||
|
||||
Standard_Integer w=100 , h=100 ; /* Debug Matrox */
|
||||
aWNTWindow->Size (w,h) ; /* Keeps me unsatisfied (rlb)..... */
|
||||
/* Resize is not supposed to be done on */
|
||||
/* Matrox */
|
||||
/* I suspect another problem elsewhere */
|
||||
::PostMessage ( GetSafeHwnd () , WM_SIZE , SIZE_RESTORED , w + h*65536 ) ;
|
||||
|
||||
// store the mode ( nothing , dynamic zooming, dynamic ... )
|
||||
myCurrentMode = CurAction3d_Nothing;
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHLRView3D diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CHLRView3D::AssertValid() const
|
||||
{
|
||||
CView::AssertValid();
|
||||
}
|
||||
|
||||
void CHLRView3D::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CView::Dump(dc);
|
||||
}
|
||||
|
||||
CHLRDoc* CHLRView3D::GetDocument() // non-debug version is inline
|
||||
{
|
||||
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CHLRDoc)));
|
||||
return (CHLRDoc*)m_pDocument;
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHLRView3D message handlers
|
||||
|
||||
|
||||
void CHLRView3D::OnLButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
// save the current mouse coordinate in min
|
||||
myXmin=point.x; myYmin=point.y;
|
||||
myXmax=point.x; myYmax=point.y;
|
||||
|
||||
if ( nFlags & CASCADESHORTCUTKEY )
|
||||
{
|
||||
// Button MB1 down Control :start zomming
|
||||
// SetCursor(AfxGetApp()->LoadStandardCursor());
|
||||
}
|
||||
else // if ( Ctrl )
|
||||
{
|
||||
switch (myCurrentMode)
|
||||
{
|
||||
case CurAction3d_Nothing : // start a drag
|
||||
if (nFlags & MULTISELECTIONKEY)
|
||||
MultiDragEvent(myXmax,myYmax,-1);
|
||||
else
|
||||
DragEvent(myXmax,myYmax,-1);
|
||||
break;
|
||||
break;
|
||||
case CurAction3d_DynamicZooming : // noting
|
||||
break;
|
||||
case CurAction3d_WindowZooming : // noting
|
||||
break;
|
||||
case CurAction3d_DynamicPanning :// noting
|
||||
break;
|
||||
case CurAction3d_GlobalPanning :// noting
|
||||
break;
|
||||
case CurAction3d_DynamicRotation :
|
||||
if (!myDegenerateModeIsOn)
|
||||
myView->SetDegenerateModeOn();
|
||||
myView->StartRotation(point.x,point.y);
|
||||
break;
|
||||
default :
|
||||
Standard_Failure::Raise(" incompatible Current Mode ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CHLRView3D::OnLButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
if ( nFlags & CASCADESHORTCUTKEY )
|
||||
{
|
||||
return;
|
||||
}
|
||||
else // if ( Ctrl )
|
||||
{
|
||||
switch (myCurrentMode)
|
||||
{
|
||||
case CurAction3d_Nothing :
|
||||
if (point.x == myXmin && point.y == myYmin)
|
||||
{ // no offset between down and up --> selectEvent
|
||||
myXmax=point.x;
|
||||
myYmax=point.y;
|
||||
if (nFlags & MULTISELECTIONKEY )
|
||||
MultiInputEvent(point.x,point.y);
|
||||
else
|
||||
InputEvent (point.x,point.y);
|
||||
} else
|
||||
{
|
||||
myXmax=point.x; myYmax=point.y;
|
||||
DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False);
|
||||
if (nFlags & MULTISELECTIONKEY)
|
||||
MultiDragEvent(point.x,point.y,1);
|
||||
else
|
||||
DragEvent(point.x,point.y,1);
|
||||
}
|
||||
break;
|
||||
case CurAction3d_DynamicZooming :
|
||||
// SetCursor(AfxGetApp()->LoadStandardCursor());
|
||||
myCurrentMode = CurAction3d_Nothing;
|
||||
break;
|
||||
case CurAction3d_WindowZooming :
|
||||
myXmax=point.x; myYmax=point.y;
|
||||
DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False,LongDash);
|
||||
if ((abs(myXmin-myXmax)>ValZWMin) || (abs(myYmin-myYmax)>ValZWMin))
|
||||
// Test if the zoom window is greater than a minimale window.
|
||||
{
|
||||
// Do the zoom window between Pmin and Pmax
|
||||
myView->WindowFitAll(myXmin,myYmin,myXmax,myYmax);
|
||||
}
|
||||
myCurrentMode = CurAction3d_Nothing;
|
||||
break;
|
||||
case CurAction3d_DynamicPanning :
|
||||
myCurrentMode = CurAction3d_Nothing;
|
||||
break;
|
||||
case CurAction3d_GlobalPanning :
|
||||
myView->Place(point.x,point.y,myCurZoom);
|
||||
myCurrentMode = CurAction3d_Nothing;
|
||||
break;
|
||||
case CurAction3d_DynamicRotation :
|
||||
myCurrentMode = CurAction3d_Nothing;
|
||||
break;
|
||||
default :
|
||||
Standard_Failure::Raise(" incompatible Current Mode ");
|
||||
break;
|
||||
} //switch (myCurrentMode)
|
||||
} // else // if ( Ctrl )
|
||||
}
|
||||
|
||||
void CHLRView3D::OnRButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
if ( nFlags & CASCADESHORTCUTKEY )
|
||||
{
|
||||
if (!myDegenerateModeIsOn)
|
||||
myView->SetDegenerateModeOn();
|
||||
myView->StartRotation(point.x,point.y);
|
||||
}
|
||||
else // if ( CASCADESHORTCUTKEY )
|
||||
{
|
||||
#ifdef POPUPONBUTTONDOWN
|
||||
GetDocument()->Popup(point.x,point.y, myView);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void CHLRView3D::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
// ============================ LEFT BUTTON =======================
|
||||
if ( nFlags & MK_LBUTTON)
|
||||
{
|
||||
if ( nFlags & CASCADESHORTCUTKEY )
|
||||
{
|
||||
// move with MB1 and Control : on the dynamic zooming
|
||||
// Do the zoom in function of mouse's coordinates
|
||||
myView->Zoom(myXmax,myYmax,point.x,point.y);
|
||||
// save the current mouse coordinate in min
|
||||
myXmax = point.x;
|
||||
myYmax = point.y;
|
||||
}
|
||||
else // if ( Ctrl )
|
||||
{
|
||||
switch (myCurrentMode)
|
||||
{
|
||||
case CurAction3d_Nothing :
|
||||
DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False);
|
||||
myXmax = point.x;
|
||||
myYmax = point.y;
|
||||
if (nFlags & MULTISELECTIONKEY)
|
||||
MultiDragEvent(myXmax,myYmax,0);
|
||||
else
|
||||
DragEvent(myXmax,myYmax,0);
|
||||
DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_True);
|
||||
break;
|
||||
case CurAction3d_DynamicZooming :
|
||||
myView->Zoom(myXmax,myYmax,point.x,point.y);
|
||||
// save the current mouse coordinate in min \n";
|
||||
myXmax=point.x; myYmax=point.y;
|
||||
break;
|
||||
case CurAction3d_WindowZooming :
|
||||
myXmax = point.x; myYmax = point.y;
|
||||
DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False,LongDash);
|
||||
DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_True,LongDash);
|
||||
break;
|
||||
case CurAction3d_DynamicPanning :
|
||||
myView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
|
||||
myXmax = point.x; myYmax = point.y;
|
||||
break;
|
||||
case CurAction3d_GlobalPanning : // nothing
|
||||
break;
|
||||
case CurAction3d_DynamicRotation :
|
||||
myView->Rotation(point.x,point.y);
|
||||
myView->Redraw();
|
||||
break;
|
||||
default :
|
||||
Standard_Failure::Raise(" incompatible Current Mode ");
|
||||
break;
|
||||
}// switch (myCurrentMode)
|
||||
}// if ( nFlags & CASCADESHORTCUTKEY ) else
|
||||
} else // if ( nFlags & MK_LBUTTON)
|
||||
// ============================ MIDDLE BUTTON =======================
|
||||
if ( nFlags & MK_MBUTTON)
|
||||
{
|
||||
if ( nFlags & CASCADESHORTCUTKEY )
|
||||
{
|
||||
myView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
|
||||
myXmax = point.x; myYmax = point.y;
|
||||
|
||||
}
|
||||
} else // if ( nFlags & MK_MBUTTON)
|
||||
// ============================ RIGHT BUTTON =======================
|
||||
if ( nFlags & MK_RBUTTON)
|
||||
{
|
||||
if ( nFlags & CASCADESHORTCUTKEY )
|
||||
{
|
||||
myView->Rotation(point.x,point.y);
|
||||
}
|
||||
}else //if ( nFlags & MK_RBUTTON)
|
||||
// ============================ NO BUTTON =======================
|
||||
{ // No buttons
|
||||
myXmax = point.x; myYmax = point.y;
|
||||
if (nFlags & MULTISELECTIONKEY)
|
||||
MultiMoveEvent(point.x,point.y);
|
||||
else
|
||||
MoveEvent(point.x,point.y);
|
||||
}
|
||||
}
|
||||
|
||||
void CHLRView3D::DragEvent(const Standard_Integer x ,
|
||||
const Standard_Integer y ,
|
||||
const Standard_Integer TheState )
|
||||
{
|
||||
|
||||
// TheState == -1 button down
|
||||
// TheState == 0 move
|
||||
// TheState == 1 button up
|
||||
|
||||
static Standard_Integer theButtonDownX=0;
|
||||
static Standard_Integer theButtonDownY=0;
|
||||
|
||||
if (TheState == -1)
|
||||
{
|
||||
theButtonDownX=x;
|
||||
theButtonDownY=y;
|
||||
}
|
||||
|
||||
if (TheState == 0)
|
||||
GetDocument()->GetAISContext()->Select(theButtonDownX,theButtonDownY,x,y,myView);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
void CHLRView3D::InputEvent(const Standard_Integer x ,
|
||||
const Standard_Integer y )
|
||||
{
|
||||
GetDocument()->GetAISContext()->Select();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
void CHLRView3D::MoveEvent(const Standard_Integer x ,
|
||||
const Standard_Integer y )
|
||||
{
|
||||
GetDocument()->GetAISContext()->MoveTo(x,y,myView);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
void CHLRView3D::MultiMoveEvent(const Standard_Integer x ,
|
||||
const Standard_Integer y )
|
||||
{
|
||||
GetDocument()->GetAISContext()->MoveTo(x,y,myView);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
void CHLRView3D::MultiDragEvent(const Standard_Integer x ,
|
||||
const Standard_Integer y ,
|
||||
const Standard_Integer TheState )
|
||||
{
|
||||
static Standard_Integer theButtonDownX=0;
|
||||
static Standard_Integer theButtonDownY=0;
|
||||
|
||||
if (TheState == -1)
|
||||
{
|
||||
theButtonDownX=x;
|
||||
theButtonDownY=y;
|
||||
}
|
||||
|
||||
if (TheState == 0)
|
||||
GetDocument()->GetAISContext()->ShiftSelect(theButtonDownX,theButtonDownY,x,y,myView);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
void CHLRView3D::MultiInputEvent(const Standard_Integer x ,
|
||||
const Standard_Integer y )
|
||||
{
|
||||
GetDocument()->GetAISContext()->ShiftSelect();
|
||||
}
|
||||
|
85
samples/mfc/standard/08_HLR/src/HLRView3D.h
Executable file
85
samples/mfc/standard/08_HLR/src/HLRView3D.h
Executable file
@@ -0,0 +1,85 @@
|
||||
// HLRView.h : interface of the CHLRView3D class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_HLRVIEW3D_H__376C7010_0B3D_11D2_8E0A_0800369C8A03_3D_INCLUDED_)
|
||||
#define AFX_HLRVIEW3D_H__376C7010_0B3D_11D2_8E0A_0800369C8A03_3D_INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include <OCC_3dView.h>
|
||||
|
||||
class CHLRView3D : public OCC_3dView
|
||||
{
|
||||
protected: // create from serialization only
|
||||
CHLRView3D();
|
||||
DECLARE_DYNCREATE(CHLRView3D)
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
CHLRDoc* GetDocument();
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CHLRView3D)
|
||||
public:
|
||||
virtual void OnInitialUpdate(); // CasCade
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CHLRView3D();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CHLRView3D)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
// CasCade :
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
void DragEvent (const Standard_Integer x ,
|
||||
const Standard_Integer y ,
|
||||
const Standard_Integer TheState);
|
||||
void InputEvent (const Standard_Integer x ,
|
||||
const Standard_Integer y );
|
||||
void MoveEvent (const Standard_Integer x ,
|
||||
const Standard_Integer y );
|
||||
void MultiMoveEvent (const Standard_Integer x ,
|
||||
const Standard_Integer y );
|
||||
void MultiDragEvent (const Standard_Integer x ,
|
||||
const Standard_Integer y ,
|
||||
const Standard_Integer TheState);
|
||||
void MultiInputEvent(const Standard_Integer x ,
|
||||
const Standard_Integer y );
|
||||
|
||||
|
||||
};
|
||||
|
||||
#ifndef _DEBUG // debug version in HLRView.cpp
|
||||
inline CHLRDoc* CHLRView3D::GetDocument()
|
||||
{ return (CHLRDoc*)m_pDocument; }
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_HLRVIEW3D_H__376C7010_0B3D_11D2_8E0A_0800369C8A03_3D_INCLUDED_)
|
@@ -0,0 +1,70 @@
|
||||
// ColorNewColorCubeColorMapDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "ColorNewColorCubeColorMapDialog.h"
|
||||
|
||||
#include <HLRApp.h>
|
||||
#include "Aspect_ColorCubeColorMap.hxx"
|
||||
|
||||
#ifdef _DEBUG
|
||||
//#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CColorNewColorCubeColorMapDialog dialog
|
||||
|
||||
|
||||
CColorNewColorCubeColorMapDialog::CColorNewColorCubeColorMapDialog(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CColorNewColorCubeColorMapDialog::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CColorNewColorCubeColorMapDialog)
|
||||
m_base_pixel = 0;
|
||||
m_redmax = 7;
|
||||
m_redmult = 1;
|
||||
m_greenmax = 7;
|
||||
m_greenmult = 8;
|
||||
m_bluemax = 3;
|
||||
m_bluemult = 64;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
void CColorNewColorCubeColorMapDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CColorNewColorCubeColorMapDialog)
|
||||
DDX_Text(pDX, IDC_NewColorCube_EDIT_base_pixel, m_base_pixel);
|
||||
DDX_Text(pDX, IDC_NewColorCube_EDIT_redmax, m_redmax);
|
||||
DDX_Text(pDX, IDC_NewColorCube_EDIT_redmult, m_redmult);
|
||||
DDX_Text(pDX, IDC_NewColorCube_EDIT_greenmax, m_greenmax);
|
||||
DDX_Text(pDX, IDC_NewColorCube_EDIT_grennmult, m_greenmult);
|
||||
DDX_Text(pDX, IDC_NewColorCube_EDIT_bluemax, m_bluemax);
|
||||
DDX_Text(pDX, IDC_NewColorCube_EDIT_bluemult, m_bluemult);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CColorNewColorCubeColorMapDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(CColorNewColorCubeColorMapDialog)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CColorNewColorCubeColorMapDialog message handlers
|
||||
|
||||
void CColorNewColorCubeColorMapDialog::OnOK()
|
||||
{
|
||||
UpdateData(true);
|
||||
myColorMap =
|
||||
new Aspect_ColorCubeColorMap(m_base_pixel,
|
||||
m_redmax ,
|
||||
m_redmult ,
|
||||
m_greenmax ,
|
||||
m_greenmult ,
|
||||
m_bluemax ,
|
||||
m_bluemult );
|
||||
CDialog::OnOK();
|
||||
}
|
59
samples/mfc/standard/08_HLR/src/Properties/ColorNewColorCubeColorMapDialog.h
Executable file
59
samples/mfc/standard/08_HLR/src/Properties/ColorNewColorCubeColorMapDialog.h
Executable file
@@ -0,0 +1,59 @@
|
||||
// ColorNewColorCubeColorMapDialog.h : header file
|
||||
//
|
||||
|
||||
#if !defined(AFX_COLORNEWCOLORCUBECOLORMAPDIALOG_H__67E9AE93_D9F9_11D1_8DE3_0800369C8A03__INCLUDED_)
|
||||
#define AFX_COLORNEWCOLORCUBECOLORMAPDIALOG_H__67E9AE93_D9F9_11D1_8DE3_0800369C8A03__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include "Aspect_ColorMap.hxx"
|
||||
#include "resource.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CColorNewColorCubeColorMapDialog dialog
|
||||
|
||||
class CColorNewColorCubeColorMapDialog : public CDialog
|
||||
{
|
||||
private :
|
||||
Handle(Aspect_ColorMap) myColorMap;
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CColorNewColorCubeColorMapDialog(CWnd* pParent = NULL); // standard constructor
|
||||
Handle(Aspect_ColorMap) ColorMap() {return myColorMap;};
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CColorNewColorCubeColorMapDialog)
|
||||
enum { IDD = IDD_DIALOG_NewColorCube };
|
||||
int m_base_pixel;
|
||||
int m_redmax;
|
||||
int m_redmult;
|
||||
int m_greenmax;
|
||||
int m_greenmult;
|
||||
int m_bluemax;
|
||||
int m_bluemult;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CColorNewColorCubeColorMapDialog)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CColorNewColorCubeColorMapDialog)
|
||||
virtual void OnOK();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_COLORNEWCOLORCUBECOLORMAPDIALOG_H__67E9AE93_D9F9_11D1_8DE3_0800369C8A03__INCLUDED_)
|
151
samples/mfc/standard/08_HLR/src/Properties/ColorNewColorRampColorMapDialog.cpp
Executable file
151
samples/mfc/standard/08_HLR/src/Properties/ColorNewColorRampColorMapDialog.cpp
Executable file
@@ -0,0 +1,151 @@
|
||||
// ColorNewColorRampColorMapDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "ColorNewColorRampColorMapDialog.h"
|
||||
|
||||
#include "HLRApp.h"
|
||||
#include "Quantity_Color.hxx"
|
||||
#include "Aspect_ColorRampColorMap.hxx"
|
||||
|
||||
#ifdef _DEBUG
|
||||
//#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CColorNewColorRampColorMapDialog dialog
|
||||
|
||||
CColorNewColorRampColorMapDialog::CColorNewColorRampColorMapDialog(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CColorNewColorRampColorMapDialog::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CColorNewColorRampColorMapDialog)
|
||||
m_base_pixel = 0;
|
||||
m_dimension = 16;
|
||||
m_Red = 1.0;
|
||||
m_Green = 0.0;
|
||||
m_Blue = 0.0;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
void CColorNewColorRampColorMapDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CColorNewColorRampColorMapDialog)
|
||||
DDX_Control(pDX, IDC_NewColorMap_COMBO_NewEntryColorName, m_ColorList);
|
||||
DDX_Text(pDX, IDC_NewColorRamp_EDIT_base_pixel, m_base_pixel);
|
||||
DDX_Text(pDX, IDC_NewColorramp_EDIT_dimension, m_dimension);
|
||||
DDX_Text(pDX, IDC_NewColorMapRamp_EDIT_ColorRed, m_Red);
|
||||
DDX_Text(pDX, IDC_NewColorMapRamp_EDIT_ColorGreen, m_Green);
|
||||
DDX_Text(pDX, IDC_NewColorMapRamp_EDIT_ColorBlue, m_Blue);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CColorNewColorRampColorMapDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(CColorNewColorRampColorMapDialog)
|
||||
ON_BN_CLICKED(IDC_NewColorMapRamp_BUTTON_EditColor, OnColorMapRampBUTTONEditColor)
|
||||
ON_EN_CHANGE(IDC_NewColorMapRamp_EDIT_ColorRed, OnChangeColorMapRampEDITColorRed)
|
||||
ON_EN_CHANGE(IDC_NewColorMapRamp_EDIT_ColorGreen, OnChangeColorMapRampEDITColorGreen)
|
||||
ON_EN_CHANGE(IDC_NewColorMapRamp_EDIT_ColorBlue, OnChangeColorMapRampEDITColorBlue)
|
||||
ON_CBN_SELCHANGE(IDC_NewColorMap_COMBO_NewEntryColorName, OnSelchangeColorMapCOMBONewEntryColorName)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CColorNewColorRampColorMapDialog message handlers
|
||||
BOOL CColorNewColorRampColorMapDialog::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
for (int i = 0 ;i< 517 ; i++)
|
||||
{
|
||||
Standard_CString TheColorName = Quantity_Color::StringName((Quantity_NameOfColor)i);
|
||||
// update the CComboBox to add the enumeration possibilities.
|
||||
m_ColorList.AddString( TheColorName );
|
||||
}
|
||||
Quantity_Color aColor(m_Red,m_Green,m_Blue,Quantity_TOC_RGB);
|
||||
m_ColorList.SetCurSel(aColor.Name());
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
void CColorNewColorRampColorMapDialog::OnColorMapRampBUTTONEditColor()
|
||||
{
|
||||
UpdateData(true);
|
||||
COLORREF m_clr ;
|
||||
m_clr = RGB(m_Red*255,m_Green*255,m_Blue*255);
|
||||
CColorDialog dlgColor(m_clr);
|
||||
if (dlgColor.DoModal() == IDOK)
|
||||
{
|
||||
m_clr = dlgColor.GetColor();
|
||||
m_Red = GetRValue(m_clr)/255.;
|
||||
m_Green = GetGValue(m_clr)/255.;
|
||||
m_Blue = GetBValue(m_clr)/255.;
|
||||
}
|
||||
Quantity_Color aColor(m_Red,m_Green,m_Blue,Quantity_TOC_RGB);
|
||||
m_ColorList.SetCurSel(aColor.Name());
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
|
||||
void CColorNewColorRampColorMapDialog::OnChangeColorMapRampEDITColorRed()
|
||||
{
|
||||
UpdateData(true);
|
||||
if (m_Red<0) m_Red=0;
|
||||
if (m_Red>1) m_Red=1;
|
||||
|
||||
Quantity_Color aColor(m_Red,m_Green,m_Blue,Quantity_TOC_RGB);
|
||||
m_ColorList.SetCurSel(aColor.Name());
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CColorNewColorRampColorMapDialog::OnChangeColorMapRampEDITColorGreen()
|
||||
{
|
||||
UpdateData(true);
|
||||
if (m_Green<0) m_Green=0;
|
||||
if (m_Green>1) m_Green=1;
|
||||
Quantity_Color aColor(m_Red,m_Green,m_Blue,Quantity_TOC_RGB);
|
||||
m_ColorList.SetCurSel(aColor.Name());
|
||||
UpdateData(false);
|
||||
}
|
||||
void CColorNewColorRampColorMapDialog::OnChangeColorMapRampEDITColorBlue()
|
||||
{
|
||||
UpdateData(true);
|
||||
if (m_Blue<0) m_Blue=0;
|
||||
if (m_Blue>1) m_Blue=1;
|
||||
Quantity_Color aColor(m_Red,m_Green,m_Blue,Quantity_TOC_RGB);
|
||||
m_ColorList.SetCurSel(aColor.Name());
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CColorNewColorRampColorMapDialog::OnSelchangeColorMapCOMBONewEntryColorName()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
UpdateData(true);
|
||||
int CurSel = m_ColorList.GetCurSel();
|
||||
Quantity_NameOfColor SelectedNameOfColor = (Quantity_NameOfColor)CurSel;
|
||||
Quantity_Color TheSelectedEquivalentColor(SelectedNameOfColor);
|
||||
|
||||
Quantity_Parameter Red,Green,Blue;
|
||||
TheSelectedEquivalentColor.Values(Red,Green,Blue,Quantity_TOC_RGB);
|
||||
m_Red = Red;
|
||||
m_Green = Green;
|
||||
m_Blue = Blue;
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
|
||||
void CColorNewColorRampColorMapDialog::OnOK()
|
||||
{
|
||||
UpdateData(true);
|
||||
Quantity_Color TheColor(m_Red,m_Green,m_Blue,Quantity_TOC_RGB);
|
||||
myColorMap =
|
||||
new Aspect_ColorRampColorMap(m_base_pixel,
|
||||
m_dimension,
|
||||
TheColor );
|
||||
CDialog::OnOK();
|
||||
}
|
294
samples/mfc/standard/08_HLR/src/Properties/ColorPropertyPage.cpp
Executable file
294
samples/mfc/standard/08_HLR/src/Properties/ColorPropertyPage.cpp
Executable file
@@ -0,0 +1,294 @@
|
||||
// ColorPropertyPage.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "ColorPropertyPage.h"
|
||||
|
||||
#include "HLRApp.h"
|
||||
#include "ColorNewColorCubeColorMapDialog.h"
|
||||
#include "ColorNewColorRampColorMapDialog.h"
|
||||
#include "Aspect_ColorMapEntry.hxx"
|
||||
#include "V2d_DefaultMap.hxx"
|
||||
#include "Aspect_GenericColorMap.hxx"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CColorPropertyPage property page
|
||||
|
||||
IMPLEMENT_DYNCREATE(CColorPropertyPage, CPropertyPage)
|
||||
|
||||
CColorPropertyPage::CColorPropertyPage()
|
||||
: CPropertyPage(CColorPropertyPage::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CColorPropertyPage)
|
||||
m_ColorMapSize = _T("Computing...");
|
||||
m_ColorMapType = _T("Computing...");
|
||||
m_CurrentEntryRed = _T("9.999");
|
||||
m_CurrentEntryGreen = _T("9.999");
|
||||
m_CurrentEntryBlue = _T("9.999");
|
||||
m_NearsetColorName = _T("Computing...");
|
||||
m_NewEntryRed = 9.999;
|
||||
m_NewEntryBlue = 9.999;
|
||||
m_NewEntryGreen = 9.999;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
BOOL CColorPropertyPage::OnInitDialog()
|
||||
{
|
||||
CPropertyPage::OnInitDialog();
|
||||
|
||||
for (int i = 0 ;i< 517 ; i++)
|
||||
{
|
||||
Standard_CString TheColorName = Quantity_Color::StringName((Quantity_NameOfColor)i);
|
||||
// update the CComboBox to add the enumeration possibilities.
|
||||
m_NewEntryColorNameCtrl.AddString( TheColorName );
|
||||
}
|
||||
m_NewEntryColorNameCtrl.SetCurSel(1);
|
||||
// TODO: Add extra initialization here
|
||||
UpdateDisplay(1);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
CColorPropertyPage::~CColorPropertyPage()
|
||||
{
|
||||
}
|
||||
|
||||
void CColorPropertyPage::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CColorPropertyPage)
|
||||
DDX_Control(pDX, IDC_ColorMap_COMBO_NewEntryColorName , m_NewEntryColorNameCtrl );
|
||||
DDX_Control(pDX, IDC_ColorMap_TAB , m_TabCtrl );
|
||||
DDX_Text (pDX, IDC_ColorMap_STATIC_Size , m_ColorMapSize );
|
||||
DDX_Text (pDX, IDC_ColorMap_STATIC_Type , m_ColorMapType );
|
||||
DDX_Text (pDX, IDC_ColorMap_STATIC_EntryColorRed , m_CurrentEntryRed );
|
||||
DDX_Text (pDX, IDC_ColorMap_STATIC_EntryColorGreen , m_CurrentEntryGreen );
|
||||
DDX_Text (pDX, IDC_ColorMap_STATIC_EntryColorBlue , m_CurrentEntryBlue );
|
||||
DDX_Text (pDX, IDC_ColorMap_STATIC_EntryColorName , m_NearsetColorName );
|
||||
DDX_Text (pDX, IDC_ColorMap_EDIT_NewEntryColorRed , m_NewEntryRed );
|
||||
DDX_Text (pDX, IDC_ColorMap_EDIT_NewEntryColorBlue , m_NewEntryBlue );
|
||||
DDX_Text (pDX, IDC_ColorMap_EDIT_NewEntryColorGreen , m_NewEntryGreen );
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CColorPropertyPage, CPropertyPage)
|
||||
//{{AFX_MSG_MAP(CColorPropertyPage)
|
||||
ON_NOTIFY(TCN_SELCHANGE, IDC_ColorMap_TAB, OnSelchangeColorMapTAB)
|
||||
ON_CBN_SELCHANGE(IDC_ColorMap_COMBO_NewEntryColorName, OnSelchangeColorMapCOMBONewEntryColorName)
|
||||
ON_BN_CLICKED(IDC_ColorMap_BUTTON_UpdateCurrentEntry, OnColorMapBUTTONUpdateCurrentEntry)
|
||||
ON_BN_CLICKED(IDC_ColorMap_BUTTON_NewColorCubeColorMap, OnColorMapBUTTONNewColorCubeColorMap)
|
||||
ON_BN_CLICKED(IDC_ColorMap_BUTTON_NewGenericColorMap, OnColorMapBUTTONNewGenericColorMap)
|
||||
ON_BN_CLICKED(IDC_ColorMap_BUTTON_NewColorRampColorMap, OnColorMapBUTTONNewColorRampColorMap)
|
||||
ON_BN_CLICKED(IDC_ColorMap_BUTTON_NewEntry_EditColor, OnColorMapBUTTONNewEntryEditColor)
|
||||
ON_BN_CLICKED(IDC_ColorMap_BUTTON_AddNewEntry, OnColorMapBUTTONAddNewEntry)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
void CColorPropertyPage::UpdateDisplay(int CurrentSelectionIndex)
|
||||
{
|
||||
Aspect_TypeOfColorMap aColorMapType = myColorMap->Type();
|
||||
switch (aColorMapType) {
|
||||
case Aspect_TOC_Generic : m_ColorMapType = _T("Generic"); ; break;
|
||||
case Aspect_TOC_ColorCube : m_ColorMapType = _T("ColorCube"); break;
|
||||
case Aspect_TOC_ColorRamp : m_ColorMapType = _T("ColorRamp"); break;
|
||||
default : cout<<" Underknown";
|
||||
}
|
||||
|
||||
int ShowOrHide;
|
||||
if (aColorMapType == Aspect_TOC_Generic)
|
||||
{
|
||||
ShowOrHide = SW_SHOW;
|
||||
GetDlgItem(IDC_ColorMap_STATIC_NewEntryNotavailable)->ShowWindow(SW_HIDE);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowOrHide = SW_HIDE;
|
||||
GetDlgItem(IDC_ColorMap_STATIC_NewEntryNotavailable)->ShowWindow(SW_SHOW);
|
||||
}
|
||||
|
||||
GetDlgItem(IDC_ColorMap_EDIT_NewEntryColorRed)->ShowWindow(ShowOrHide);
|
||||
GetDlgItem(IDC_ColorMap_EDIT_NewEntryColorGreen)->ShowWindow(ShowOrHide);
|
||||
GetDlgItem(IDC_ColorMap_EDIT_NewEntryColorBlue)->ShowWindow(ShowOrHide);
|
||||
GetDlgItem(IDC_ColorMap_COMBO_NewEntryColorName)->ShowWindow(ShowOrHide);
|
||||
GetDlgItem(IDC_ColorMap_BUTTON_NewEntry_EditColor)->ShowWindow(ShowOrHide);
|
||||
GetDlgItem(IDC_ColorMap_BUTTON_UpdateCurrentEntry)->ShowWindow(ShowOrHide);
|
||||
GetDlgItem(IDC_ColorMap_BUTTON_AddNewEntry)->ShowWindow(ShowOrHide);
|
||||
GetDlgItem(IDC_ColorMap_STATIC_NewEntryColorNameStatic)->ShowWindow(ShowOrHide);
|
||||
|
||||
TCollection_AsciiString SizeMessage(myColorMap->Size());
|
||||
m_ColorMapSize = _T(SizeMessage.ToCString());
|
||||
// clear the Tab Ctrl
|
||||
m_TabCtrl.DeleteAllItems();
|
||||
|
||||
TC_ITEM TabCtrlItem;
|
||||
TabCtrlItem.mask = TCIF_TEXT;
|
||||
|
||||
for(int i =0;i<myColorMap->Size();i++) // not <=ColorMapSize, I've enter a CSR
|
||||
{
|
||||
Aspect_ColorMapEntry aColorMapEntry = myColorMap->FindEntry(i);
|
||||
TCollection_AsciiString EntryNumerMessage(aColorMapEntry.Index());
|
||||
TabCtrlItem.pszText = (LPSTR) EntryNumerMessage.ToCString();
|
||||
m_TabCtrl.InsertItem( aColorMapEntry.Index(), &TabCtrlItem );
|
||||
}
|
||||
m_TabCtrl.SetCurSel(CurrentSelectionIndex);
|
||||
|
||||
// update The Current Selected entry
|
||||
Aspect_ColorMapEntry aColorMapEntry = myColorMap->FindEntry(CurrentSelectionIndex);
|
||||
if (aColorMapEntry. IsAllocated () )
|
||||
{
|
||||
Quantity_Color TheColor = aColorMapEntry.Color();
|
||||
Quantity_Parameter Red,Green,Blue;
|
||||
TheColor.Values(Red,Green,Blue,Quantity_TOC_RGB);
|
||||
TCollection_AsciiString Message;
|
||||
Message = Red;
|
||||
m_CurrentEntryRed = _T(Message.ToCString());
|
||||
m_NewEntryRed = Red;
|
||||
Message = Green;
|
||||
m_CurrentEntryGreen = _T(Message.ToCString());
|
||||
m_NewEntryGreen = Green;
|
||||
Message = Blue;
|
||||
m_CurrentEntryBlue = _T(Message.ToCString());
|
||||
m_NewEntryBlue = Blue;
|
||||
|
||||
Standard_CString StringName = Quantity_Color::StringName(TheColor.Name());
|
||||
m_NearsetColorName = StringName;
|
||||
cout<<"StringName : "<<TheColor.Name()<<endl;
|
||||
m_NewEntryColorNameCtrl.SetCurSel(TheColor.Name());
|
||||
if (aColorMapType == Aspect_TOC_Generic)
|
||||
if (m_TabCtrl.GetCurSel() == 0)
|
||||
GetDlgItem(IDC_ColorMap_BUTTON_UpdateCurrentEntry)->ShowWindow(SW_HIDE);
|
||||
else
|
||||
GetDlgItem(IDC_ColorMap_BUTTON_UpdateCurrentEntry)->ShowWindow(SW_SHOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_NearsetColorName = _T("Not Allocated");
|
||||
m_CurrentEntryRed = _T("9.999");
|
||||
m_NewEntryRed = 9.999;
|
||||
m_CurrentEntryGreen = _T("9.999");
|
||||
m_NewEntryGreen = 9.999;
|
||||
m_CurrentEntryBlue = _T("9.999");
|
||||
m_NewEntryBlue = 9.999;
|
||||
GetDlgItem(IDC_ColorMap_BUTTON_UpdateCurrentEntry)->ShowWindow(SW_HIDE);
|
||||
}
|
||||
|
||||
UpdateData(false);
|
||||
}
|
||||
void CColorPropertyPage::OnColorMapBUTTONNewGenericColorMap()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
myColorMap = V2d_DefaultMap::ColorMap();
|
||||
SetModified(true);
|
||||
UpdateDisplay(1);
|
||||
}
|
||||
|
||||
void CColorPropertyPage::OnColorMapBUTTONNewColorCubeColorMap()
|
||||
{
|
||||
CColorNewColorCubeColorMapDialog aDlg(NULL);
|
||||
if (aDlg.DoModal() == IDOK)
|
||||
{
|
||||
myColorMap = aDlg.ColorMap();
|
||||
SetModified(true);
|
||||
UpdateDisplay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void CColorPropertyPage::OnColorMapBUTTONNewColorRampColorMap()
|
||||
{
|
||||
CColorNewColorRampColorMapDialog aDlg(NULL);
|
||||
if (aDlg.DoModal() == IDOK)
|
||||
{
|
||||
myColorMap = aDlg.ColorMap();
|
||||
SetModified(true);
|
||||
UpdateDisplay(1);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CColorPropertyPage message handlers
|
||||
|
||||
void CColorPropertyPage::OnSelchangeColorMapTAB(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
UpdateDisplay(m_TabCtrl.GetCurSel());
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CColorPropertyPage::OnSelchangeColorMapCOMBONewEntryColorName()
|
||||
{
|
||||
UpdateData(true);
|
||||
int CurSel = m_NewEntryColorNameCtrl.GetCurSel();
|
||||
Quantity_NameOfColor SelectedNameOfColor = (Quantity_NameOfColor)CurSel;
|
||||
Quantity_Color TheSelectedEquivalentColor(SelectedNameOfColor);
|
||||
|
||||
Quantity_Parameter Red,Green,Blue;
|
||||
TheSelectedEquivalentColor.Values(Red,Green,Blue,Quantity_TOC_RGB);
|
||||
m_NewEntryRed = Red;
|
||||
m_NewEntryGreen = Green;
|
||||
m_NewEntryBlue = Blue;
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CColorPropertyPage::OnColorMapBUTTONNewEntryEditColor()
|
||||
{
|
||||
int CurrentSelectedItem = m_TabCtrl.GetCurSel();
|
||||
|
||||
COLORREF m_clr ;
|
||||
m_clr = RGB(m_NewEntryRed*255,m_NewEntryGreen*255,m_NewEntryBlue*255);
|
||||
CColorDialog dlgColor(m_clr);
|
||||
if (dlgColor.DoModal() == IDOK)
|
||||
{
|
||||
SetModified(TRUE);
|
||||
m_clr = dlgColor.GetColor();
|
||||
m_NewEntryRed = GetRValue(m_clr)/255.;
|
||||
m_NewEntryGreen = GetGValue(m_clr)/255.;
|
||||
m_NewEntryBlue = GetBValue(m_clr)/255.;
|
||||
}
|
||||
Quantity_Color aColor(m_NewEntryRed,m_NewEntryGreen,m_NewEntryBlue,Quantity_TOC_RGB);
|
||||
m_NewEntryColorNameCtrl.SetCurSel(aColor.Name());
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CColorPropertyPage::OnColorMapBUTTONUpdateCurrentEntry()
|
||||
{
|
||||
UpdateData(true);
|
||||
Handle(Aspect_GenericColorMap) aGenericColorMap = Handle(Aspect_GenericColorMap)::DownCast(myColorMap);
|
||||
if (aGenericColorMap.IsNull())
|
||||
Standard_Failure::Raise(" couldn't update a none Generic Color Map");
|
||||
|
||||
Aspect_ColorMapEntry aColorMapEntry = myColorMap->FindEntry( m_TabCtrl.GetCurSel());
|
||||
Quantity_Color aColor(m_NewEntryRed,m_NewEntryGreen,m_NewEntryBlue,Quantity_TOC_RGB);
|
||||
aColorMapEntry.SetColor(aColor);
|
||||
aGenericColorMap->AddEntry(aColorMapEntry); // in fact just update
|
||||
SetModified(true);
|
||||
UpdateData(true);
|
||||
UpdateDisplay(m_TabCtrl.GetCurSel());
|
||||
}
|
||||
|
||||
void CColorPropertyPage::OnColorMapBUTTONAddNewEntry()
|
||||
{
|
||||
UpdateData(true);
|
||||
Quantity_Color aColor(m_NewEntryRed,m_NewEntryGreen,m_NewEntryBlue,Quantity_TOC_RGB);
|
||||
Handle(Aspect_GenericColorMap) aGenericColorMap = Handle(Aspect_GenericColorMap)::DownCast(myColorMap);
|
||||
if (aGenericColorMap.IsNull())
|
||||
Standard_Failure::Raise(" couldn't update a none Generic Color Map");
|
||||
|
||||
int NewEntry = aGenericColorMap->AddEntry(aColor);
|
||||
SetModified(true);
|
||||
UpdateDisplay(NewEntry);
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
BOOL CColorPropertyPage::OnApply()
|
||||
{
|
||||
myViewer->SetColorMap(myColorMap);
|
||||
myViewer->Update();
|
||||
return CPropertyPage::OnApply();
|
||||
}
|
86
samples/mfc/standard/08_HLR/src/Properties/ColorPropertyPage.h
Executable file
86
samples/mfc/standard/08_HLR/src/Properties/ColorPropertyPage.h
Executable file
@@ -0,0 +1,86 @@
|
||||
// ColorPropertyPage.h : header file
|
||||
//
|
||||
|
||||
#if !defined(AFX_ColorPropertyPage_H__A815F7A3_D51B_11D1_8DDE_0800369C8A03__INCLUDED_)
|
||||
#define AFX_ColorPropertyPage_H__A815F7A3_D51B_11D1_8DDE_0800369C8A03__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include "Aspect_ColorMap.hxx"
|
||||
#include <resource.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CColorPropertyPage dialog
|
||||
|
||||
class CColorPropertyPage : public CPropertyPage
|
||||
{
|
||||
DECLARE_DYNCREATE(CColorPropertyPage)
|
||||
|
||||
private :
|
||||
Handle(Aspect_ColorMap) myColorMap;
|
||||
private :
|
||||
Handle(V2d_Viewer) myViewer;
|
||||
public:
|
||||
void SetViewer(Handle(V2d_Viewer) aViewer) {
|
||||
myViewer = aViewer;
|
||||
myColorMap = aViewer->ColorMap();
|
||||
};
|
||||
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CColorPropertyPage();
|
||||
~CColorPropertyPage();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CColorPropertyPage)
|
||||
enum { IDD = IDD_DIALOG_Color };
|
||||
CComboBox m_NewEntryColorNameCtrl;
|
||||
CTabCtrl m_TabCtrl;
|
||||
CString m_ColorMapSize ;
|
||||
CString m_ColorMapType ;
|
||||
CString m_CurrentEntryRed;
|
||||
CString m_CurrentEntryGreen;
|
||||
CString m_CurrentEntryBlue;
|
||||
CString m_NearsetColorName;
|
||||
double m_NewEntryRed;
|
||||
double m_NewEntryBlue;
|
||||
double m_NewEntryGreen;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CColorPropertyPage)
|
||||
public:
|
||||
virtual BOOL OnApply();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CColorPropertyPage)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnSelchangeColorMapTAB(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnSelchangeColorMapCOMBONewEntryColorName();
|
||||
afx_msg void OnColorMapBUTTONUpdateCurrentEntry();
|
||||
afx_msg void OnColorMapBUTTONNewColorCubeColorMap();
|
||||
afx_msg void OnColorMapBUTTONNewGenericColorMap();
|
||||
afx_msg void OnColorMapBUTTONNewColorRampColorMap();
|
||||
afx_msg void OnColorMapBUTTONNewEntryEditColor();
|
||||
afx_msg void OnColorMapBUTTONAddNewEntry();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
void UpdateDisplay(int CurrentSelectionIndex);
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_ColorPropertyPage_H__A815F7A3_D51B_11D1_8DDE_0800369C8A03__INCLUDED_)
|
275
samples/mfc/standard/08_HLR/src/Properties/FontPropertyPage.cpp
Executable file
275
samples/mfc/standard/08_HLR/src/Properties/FontPropertyPage.cpp
Executable file
@@ -0,0 +1,275 @@
|
||||
// FontPropertyPage.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "FontPropertyPage.h"
|
||||
|
||||
#include "HLRApp.h"
|
||||
#include "Aspect_FontMapEntry.hxx"
|
||||
|
||||
#ifdef _DEBUG
|
||||
//#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFontPropertyPage property page
|
||||
|
||||
IMPLEMENT_DYNCREATE(CFontPropertyPage, CPropertyPage)
|
||||
|
||||
CFontPropertyPage::CFontPropertyPage() : CPropertyPage(CFontPropertyPage::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CFontPropertyPage)
|
||||
m_FontMapSize = _T("Computing...");
|
||||
m_CurrentEntryValue = _T("Computing...");
|
||||
m_CurrentEntryStyle = _T("Computing...");
|
||||
m_CurrentEntrySize = _T("Computing...");
|
||||
m_CurrentEntrySlant = _T("Computing...");
|
||||
m_NewEntryValue = _T("");
|
||||
m_NewEntrySize = 1.0;
|
||||
m_NewEntrySlant = 0.0;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
CFontPropertyPage::~CFontPropertyPage()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL CFontPropertyPage::OnInitDialog()
|
||||
{
|
||||
CPropertyPage::OnInitDialog();
|
||||
|
||||
m_NewEntry_Type.AddString("DEFAULT");
|
||||
m_NewEntry_Type.AddString("COURIER");
|
||||
m_NewEntry_Type.AddString("HELVETICA");
|
||||
m_NewEntry_Type.AddString("TIMES");
|
||||
m_NewEntry_Type.AddString("USERDEFINED");
|
||||
m_NewEntry_Type.SetCurSel(1);
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
UpdateDisplay(1);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
void CFontPropertyPage::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CFontPropertyPage)
|
||||
DDX_Text (pDX, IDC_FontMap_STATIC_Size , m_FontMapSize );
|
||||
DDX_Control(pDX, IDC_FontMap_TAB , m_TabCtrl );
|
||||
DDX_Text (pDX, IDC_FontMap_STATIC_CurrentEntryValue , m_CurrentEntryValue );
|
||||
DDX_Text (pDX, IDC_FontMap_STATIC_CurrentEntryType , m_CurrentEntryStyle );
|
||||
DDX_Text (pDX, IDC_FontMap_STATIC_CurrentEntrySize , m_CurrentEntrySize );
|
||||
DDX_Text (pDX, IDC_FontMap_STATIC_CurrentEntrySlant , m_CurrentEntrySlant );
|
||||
|
||||
DDX_Control(pDX, IDC_FontMap_COMBO_NewEntryType , m_NewEntry_Type );
|
||||
DDX_Text(pDX, IDC_FontMap_EDIT_NewEntryValue, m_NewEntryValue);
|
||||
DDX_Text(pDX, IDC_FontMap_EDIT_NewEntrySize, m_NewEntrySize);
|
||||
DDX_Text(pDX, IDC_FontMap_EDIT_NewEntrySlant, m_NewEntrySlant);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CFontPropertyPage, CPropertyPage)
|
||||
//{{AFX_MSG_MAP(CFontPropertyPage)
|
||||
ON_NOTIFY(TCN_SELCHANGE, IDC_FontMap_TAB, OnSelchangeFontMapTAB)
|
||||
ON_BN_CLICKED(IDC_FontMap_BUTTON_NewEntry_EditFont, OnFontMapBUTTONNewEntryEditFont)
|
||||
ON_BN_CLICKED(IDC_FontMap_BUTTON_UpdateCurrent, OnFontMapBUTTONUpdateCurrent)
|
||||
ON_CBN_SELCHANGE(IDC_FontMap_COMBO_NewEntryType, OnSelchangeFontMapCOMBONewEntryType)
|
||||
ON_BN_CLICKED(IDC_FontMap_BUTTON_NewEntry, OnFontMapBUTTONNewEntry)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFontPropertyPage message handlers
|
||||
void CFontPropertyPage::UpdateDisplay(int CurrentSelectionIndex)
|
||||
{
|
||||
// Update the size of the Width map
|
||||
TCollection_AsciiString SizeMessage(myFontMap->Size());
|
||||
m_FontMapSize = _T(SizeMessage.ToCString());
|
||||
|
||||
// clear the Tab Ctrl
|
||||
m_TabCtrl.DeleteAllItems();
|
||||
TC_ITEM TabCtrlItem;
|
||||
TabCtrlItem.mask = TCIF_TEXT;
|
||||
for(int i =1;i<=myFontMap->Size();i++)
|
||||
{
|
||||
Aspect_FontMapEntry aFontMapEntry = myFontMap->Entry(i);
|
||||
TCollection_AsciiString EntryNumerMessage(aFontMapEntry.Index());
|
||||
TabCtrlItem.pszText = (LPSTR) EntryNumerMessage.ToCString();
|
||||
m_TabCtrl.InsertItem( aFontMapEntry.Index(), &TabCtrlItem );
|
||||
}
|
||||
m_TabCtrl.SetCurSel(CurrentSelectionIndex-1);
|
||||
// update the current Entry informations
|
||||
Aspect_FontMapEntry aFontMapEntry = myFontMap->Entry(CurrentSelectionIndex);
|
||||
|
||||
Aspect_FontStyle TheType = aFontMapEntry.Type();
|
||||
m_CurrentEntryValue = (TheType.Value() == NULL?" ":TheType.Value());
|
||||
|
||||
TCollection_AsciiString Message;
|
||||
switch (TheType.Style())
|
||||
{
|
||||
case Aspect_TOF_DEFAULT : Message = "Aspect_TOF_DEFAULT"; break;
|
||||
case Aspect_TOF_COURIER : Message = "Aspect_TOF_COURIER"; break;
|
||||
case Aspect_TOF_HELVETICA : Message = "Aspect_TOF_HELVETICA"; break;
|
||||
case Aspect_TOF_TIMES : Message = "Aspect_TOF_TIMES"; break;
|
||||
case Aspect_TOF_USERDEFINED : Message = "Aspect_TOF_USERDEFINED"; break;
|
||||
default: Message = "Underknown";
|
||||
}
|
||||
m_CurrentEntryStyle = _T(Message.ToCString());
|
||||
|
||||
Message = TheType.Size ();
|
||||
m_CurrentEntrySize = _T(Message.ToCString());
|
||||
|
||||
Message = TheType.Slant ();
|
||||
m_CurrentEntrySlant = _T(Message.ToCString());
|
||||
|
||||
// update The New Entry :
|
||||
switch (TheType.Style())
|
||||
{
|
||||
case Aspect_TOF_DEFAULT : m_NewEntry_Type.SetCurSel(0); break;
|
||||
case Aspect_TOF_COURIER : m_NewEntry_Type.SetCurSel(1); break;
|
||||
case Aspect_TOF_HELVETICA : m_NewEntry_Type.SetCurSel(2); break;
|
||||
case Aspect_TOF_TIMES : m_NewEntry_Type.SetCurSel(3); break;
|
||||
case Aspect_TOF_USERDEFINED : m_NewEntry_Type.SetCurSel(4); break;
|
||||
default: ;
|
||||
}
|
||||
|
||||
m_NewEntryValue = (TheType.Value() == NULL?" ":TheType.Value());
|
||||
m_NewEntrySize = TheType.Size ();
|
||||
m_NewEntrySlant = TheType.Slant ();
|
||||
if (TheType.Style()==Aspect_TOF_USERDEFINED)
|
||||
{
|
||||
GetDlgItem(IDC_FontMap_EDIT_NewEntrySize)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_FontMap_EDIT_NewEntrySlant)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_FontMap_BUTTON_NewEntry_EditFont)->ShowWindow(SW_SHOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetDlgItem(IDC_FontMap_EDIT_NewEntrySize)->ShowWindow(SW_SHOW);
|
||||
GetDlgItem(IDC_FontMap_EDIT_NewEntrySlant)->ShowWindow(SW_SHOW);
|
||||
GetDlgItem(IDC_FontMap_BUTTON_NewEntry_EditFont)->ShowWindow(SW_HIDE);
|
||||
}
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CFontPropertyPage::OnSelchangeFontMapTAB(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
UpdateDisplay( m_TabCtrl.GetCurSel()+1);
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CFontPropertyPage::OnSelchangeFontMapCOMBONewEntryType()
|
||||
{
|
||||
UpdateData(true);
|
||||
// update the New Entry Value message
|
||||
if (m_NewEntry_Type.GetCurSel() == Aspect_TOF_USERDEFINED)
|
||||
{
|
||||
// allow the user to select a font from the common CFontDialog
|
||||
GetDlgItem(IDC_FontMap_BUTTON_NewEntry_EditFont)->ShowWindow(SW_SHOW);
|
||||
m_NewEntryValue = "Please Select a Font";
|
||||
// remove the posiblility to update while a font was selected
|
||||
GetDlgItem(IDC_FontMap_BUTTON_UpdateCurrent)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_FontMap_BUTTON_NewEntry)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_FontMap_EDIT_NewEntrySize)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_FontMap_EDIT_NewEntrySlant)->ShowWindow(SW_HIDE);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetDlgItem(IDC_FontMap_EDIT_NewEntrySize)->ShowWindow(SW_SHOW);
|
||||
GetDlgItem(IDC_FontMap_EDIT_NewEntrySlant)->ShowWindow(SW_SHOW);
|
||||
GetDlgItem(IDC_FontMap_BUTTON_NewEntry_EditFont)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_FontMap_BUTTON_UpdateCurrent)->ShowWindow(SW_SHOW);
|
||||
GetDlgItem(IDC_FontMap_BUTTON_NewEntry)->ShowWindow(SW_SHOW);
|
||||
Aspect_FontStyle TheType((Aspect_TypeOfFont)m_NewEntry_Type.GetCurSel(),m_NewEntrySize);
|
||||
m_NewEntryValue = (TheType.Value() == NULL?" ":TheType.Value());
|
||||
}
|
||||
UpdateData(false);
|
||||
|
||||
}
|
||||
|
||||
#include "WNT_FontMapEntry.hxx"
|
||||
void CFontPropertyPage::OnFontMapBUTTONNewEntryEditFont()
|
||||
{
|
||||
Handle(WNT_FontMapEntry) anEntry = new WNT_FontMapEntry((char* const)(LPCTSTR )m_NewEntryValue);
|
||||
Standard_Address anAddress = anEntry->LogFont();
|
||||
LOGFONT* lf = (LOGFONT*)(anAddress );
|
||||
CFontDialog dlg(lf);
|
||||
if (dlg.DoModal() == IDOK)
|
||||
{
|
||||
TCHAR buff[ 255 ];
|
||||
wsprintf ( buff, "%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%s",
|
||||
lf->lfHeight, lf->lfWidth, lf->lfEscapement, lf->lfOrientation, lf->lfWeight, lf->lfItalic,
|
||||
lf->lfUnderline, lf->lfStrikeOut, lf->lfCharSet, lf->lfOutPrecision, lf->lfClipPrecision, lf->lfQuality,
|
||||
lf->lfPitchAndFamily, lf->lfFaceName);
|
||||
|
||||
GetDlgItem(IDC_FontMap_BUTTON_UpdateCurrent)->ShowWindow(SW_SHOW);
|
||||
GetDlgItem(IDC_FontMap_BUTTON_NewEntry)->ShowWindow(SW_SHOW);
|
||||
Aspect_FontStyle TheType(buff);
|
||||
m_NewEntryValue = (TheType.Value() == NULL?" ":TheType.Value());
|
||||
}
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CFontPropertyPage::OnFontMapBUTTONUpdateCurrent()
|
||||
{
|
||||
// The Entry to modify :
|
||||
Aspect_FontMapEntry aFontMapEntry = myFontMap->Entry( m_TabCtrl.GetCurSel()+1);
|
||||
|
||||
UpdateData(true);
|
||||
Aspect_TypeOfFont aTypeOfFont = (Aspect_TypeOfFont)m_NewEntry_Type.GetCurSel();
|
||||
|
||||
if (aTypeOfFont == Aspect_TOF_USERDEFINED)
|
||||
{
|
||||
Aspect_FontStyle TheType((Standard_CString)(LPCTSTR )m_NewEntryValue);
|
||||
aFontMapEntry.SetType(TheType);
|
||||
}
|
||||
else
|
||||
{
|
||||
Aspect_FontStyle TheType((Aspect_TypeOfFont)m_NewEntry_Type.GetCurSel(),m_NewEntrySize,m_NewEntrySlant);
|
||||
aFontMapEntry.SetType(TheType);
|
||||
}
|
||||
myFontMap->AddEntry(aFontMapEntry); // in fact just update
|
||||
SetModified(true);
|
||||
UpdateDisplay(m_TabCtrl.GetCurSel()+1);
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
|
||||
void CFontPropertyPage::OnFontMapBUTTONNewEntry()
|
||||
{
|
||||
// The Entry to modify :
|
||||
Aspect_FontMapEntry aFontMapEntry;
|
||||
|
||||
UpdateData(true);
|
||||
Aspect_TypeOfFont aTypeOfFont = (Aspect_TypeOfFont)m_NewEntry_Type.GetCurSel();
|
||||
|
||||
if (aTypeOfFont == Aspect_TOF_USERDEFINED)
|
||||
{
|
||||
Aspect_FontStyle TheType((Standard_CString)(LPCTSTR )m_NewEntryValue);
|
||||
aFontMapEntry.SetType(TheType);
|
||||
}
|
||||
else
|
||||
{
|
||||
Aspect_FontStyle TheType((Aspect_TypeOfFont)m_NewEntry_Type.GetCurSel(),m_NewEntrySize,m_NewEntrySlant);
|
||||
aFontMapEntry.SetType(TheType);
|
||||
}
|
||||
myFontMap->AddEntry(aFontMapEntry); // in fact just update
|
||||
SetModified(true);
|
||||
UpdateDisplay(m_TabCtrl.GetCurSel()+1);
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
BOOL CFontPropertyPage::OnApply()
|
||||
{
|
||||
myViewer->SetFontMap(myFontMap);
|
||||
myViewer->Update();
|
||||
|
||||
return CPropertyPage::OnApply();
|
||||
}
|
80
samples/mfc/standard/08_HLR/src/Properties/FontPropertyPage.h
Executable file
80
samples/mfc/standard/08_HLR/src/Properties/FontPropertyPage.h
Executable file
@@ -0,0 +1,80 @@
|
||||
// FontPropertyPage.h : header file
|
||||
//
|
||||
|
||||
#if !defined(AFX_FontPropertyPage_H__A815F7A5_D51B_11D1_8DDE_0800369C8A03__INCLUDED_)
|
||||
#define AFX_FontPropertyPage_H__A815F7A5_D51B_11D1_8DDE_0800369C8A03__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include "Aspect_FontMap.hxx"
|
||||
#include <resource.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFontPropertyPage dialog
|
||||
|
||||
class CFontPropertyPage : public CPropertyPage
|
||||
{
|
||||
DECLARE_DYNCREATE(CFontPropertyPage)
|
||||
|
||||
private :
|
||||
Handle(Aspect_FontMap) myFontMap;
|
||||
private :
|
||||
Handle(V2d_Viewer) myViewer;
|
||||
public:
|
||||
void SetViewer(Handle(V2d_Viewer) aViewer) {
|
||||
myViewer = aViewer;
|
||||
myFontMap = aViewer->FontMap();
|
||||
};
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CFontPropertyPage();
|
||||
~CFontPropertyPage();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CFontPropertyPage)
|
||||
enum { IDD = IDD_DIALOG_Font };
|
||||
CString m_FontMapSize;
|
||||
CTabCtrl m_TabCtrl;
|
||||
CString m_CurrentEntryValue;
|
||||
CString m_CurrentEntryStyle;
|
||||
CString m_CurrentEntrySize;
|
||||
CString m_CurrentEntrySlant;
|
||||
CComboBox m_NewEntry_Type;
|
||||
double m_NewEntrySize;
|
||||
double m_NewEntrySlant;
|
||||
CString m_NewEntryValue;
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CFontPropertyPage)
|
||||
public:
|
||||
virtual BOOL OnApply();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CFontPropertyPage)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnSelchangeFontMapTAB(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnFontMapBUTTONNewEntryEditFont();
|
||||
afx_msg void OnFontMapBUTTONUpdateCurrent();
|
||||
afx_msg void OnSelchangeFontMapCOMBONewEntryType();
|
||||
afx_msg void OnFontMapBUTTONNewEntry();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
void UpdateDisplay(int CurrentSelectionIndex);
|
||||
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_FontPropertyPage_H__A815F7A5_D51B_11D1_8DDE_0800369C8A03__INCLUDED_)
|
180
samples/mfc/standard/08_HLR/src/Properties/MarkPropertyPage.cpp
Executable file
180
samples/mfc/standard/08_HLR/src/Properties/MarkPropertyPage.cpp
Executable file
@@ -0,0 +1,180 @@
|
||||
// MarkPropertyPage.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "MarkPropertyPage.h"
|
||||
|
||||
#include "HLRApp.h"
|
||||
|
||||
#include "Aspect_MarkMap.hxx"
|
||||
#include "Aspect_MarkMapEntry.hxx"
|
||||
#include "TColQuantity_Array1OfLength.hxx"
|
||||
#include "TColStd_SequenceOfReal.hxx"
|
||||
#include "TShort_Array1OfShortReal.hxx"
|
||||
#include "TColStd_Array1OfBoolean.hxx"
|
||||
|
||||
#ifdef _DEBUG
|
||||
//#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMarkPropertyPage property page
|
||||
|
||||
IMPLEMENT_DYNCREATE(CMarkPropertyPage, CPropertyPage)
|
||||
|
||||
CMarkPropertyPage::CMarkPropertyPage() : CPropertyPage(CMarkPropertyPage::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CMarkPropertyPage)
|
||||
m_MarkMapSize = _T("Computing...");
|
||||
m_CurrentEntryStyle = _T("Computing...");
|
||||
m_CurrentEntryXValue = _T("Computing...");
|
||||
m_CurrentEntryYValue = _T("Computing...");
|
||||
m_CurrentEntrySValue = _T("Computing...");
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
|
||||
}
|
||||
BOOL CMarkPropertyPage::OnInitDialog()
|
||||
{
|
||||
CPropertyPage::OnInitDialog();
|
||||
|
||||
UpdateDisplay(1);
|
||||
|
||||
UpdateData(false);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
CMarkPropertyPage::~CMarkPropertyPage()
|
||||
{
|
||||
}
|
||||
|
||||
void CMarkPropertyPage::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CMarkPropertyPage)
|
||||
DDX_Control(pDX, IDC_MarkMap_TAB, m_TabCtrl);
|
||||
DDX_Text(pDX, IDC_MarkMap_STATIC_Size, m_MarkMapSize);
|
||||
DDX_Text(pDX, IDC_MarkMap_STATIC_CurrentEntryStyle, m_CurrentEntryStyle);
|
||||
DDX_Text(pDX, IDC_MarkMap_STATIC_CurrentEntryXValue, m_CurrentEntryXValue);
|
||||
DDX_Text(pDX, IDC_MarkMap_STATIC_CurrentEntryYValue, m_CurrentEntryYValue);
|
||||
DDX_Text(pDX, IDC_MarkMap_STATIC_CurrentEntrySValue, m_CurrentEntrySValue);
|
||||
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMarkPropertyPage, CPropertyPage)
|
||||
//{{AFX_MSG_MAP(CMarkPropertyPage)
|
||||
ON_NOTIFY(TCN_SELCHANGE, IDC_MarkMap_TAB, OnSelchangeMarkMapTAB)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMarkPropertyPage message handlers
|
||||
void CMarkPropertyPage::UpdateDisplay(int CurrentSelectionIndex)
|
||||
{
|
||||
TCollection_AsciiString SizeMessage(myMarkMap->Size());
|
||||
m_MarkMapSize = _T(SizeMessage.ToCString());
|
||||
|
||||
m_TabCtrl.DeleteAllItems();
|
||||
|
||||
TC_ITEM TabCtrlItem;
|
||||
TabCtrlItem.mask = TCIF_TEXT;
|
||||
|
||||
for(int i =1;i<=myMarkMap->Size();i++)
|
||||
{
|
||||
Aspect_MarkMapEntry aMarkMapEntry = myMarkMap->Entry(i);
|
||||
TCollection_AsciiString EntryNumerMessage(aMarkMapEntry.Index());
|
||||
TabCtrlItem.pszText = (LPSTR) EntryNumerMessage.ToCString();
|
||||
m_TabCtrl.InsertItem( aMarkMapEntry.Index(), &TabCtrlItem );
|
||||
}
|
||||
m_TabCtrl.SetCurSel(CurrentSelectionIndex-1);
|
||||
|
||||
// update The Current Selected entry
|
||||
Aspect_MarkMapEntry aMarkMapEntry = myMarkMap->Entry(CurrentSelectionIndex);
|
||||
if (aMarkMapEntry. IsAllocated () )
|
||||
{
|
||||
Aspect_MarkerStyle aMarkerStyle = aMarkMapEntry.Style() ;
|
||||
switch (aMarkerStyle.Type()) {
|
||||
case Aspect_TOM_POINT : m_CurrentEntryStyle = _T("Aspect_TOM_POINT"); break;
|
||||
case Aspect_TOM_PLUS : m_CurrentEntryStyle = _T("Aspect_TOM_PLUS"); break;
|
||||
case Aspect_TOM_STAR : m_CurrentEntryStyle = _T("Aspect_TOM_STAR"); break;
|
||||
case Aspect_TOM_O : m_CurrentEntryStyle = _T("Aspect_TOM_O"); break;
|
||||
case Aspect_TOM_X : m_CurrentEntryStyle = _T("Aspect_TOM_X"); break;
|
||||
case Aspect_TOM_O_POINT : m_CurrentEntryStyle = _T("Aspect_TOM_O_POINT"); break;
|
||||
case Aspect_TOM_O_PLUS : m_CurrentEntryStyle = _T("Aspect_TOM_O_PLUS"); break;
|
||||
case Aspect_TOM_O_STAR : m_CurrentEntryStyle = _T("Aspect_TOM_O_STAR"); break;
|
||||
case Aspect_TOM_O_X : m_CurrentEntryStyle = _T("Aspect_TOM_O_X"); break;
|
||||
case Aspect_TOM_BALL : m_CurrentEntryStyle = _T("Aspect_TOM_BALL"); break;
|
||||
case Aspect_TOM_RING1 : m_CurrentEntryStyle = _T("Aspect_TOM_RING1"); break;
|
||||
case Aspect_TOM_RING2 : m_CurrentEntryStyle = _T("Aspect_TOM_RING2"); break;
|
||||
case Aspect_TOM_RING3 : m_CurrentEntryStyle = _T("Aspect_TOM_RING3"); break;
|
||||
case Aspect_TOM_USERDEFINED : m_CurrentEntryStyle = _T("Aspect_TOM_USERDEFINED"); break;
|
||||
default : m_CurrentEntryStyle = _T("Underknown");
|
||||
}
|
||||
|
||||
cout<<" aMarkerStyle Length: "<<aMarkerStyle.Length()<<endl;
|
||||
|
||||
const TShort_Array1OfShortReal& aMarkerStyleXValues = aMarkerStyle.XValues() ;
|
||||
const TShort_Array1OfShortReal& aMarkerStyleYValues= aMarkerStyle.YValues() ;
|
||||
const TColStd_Array1OfBoolean& aMarkerStyleSValues= aMarkerStyle.SValues() ;
|
||||
|
||||
TCollection_AsciiString MessageX =BuildValuesAscii(aMarkerStyleXValues);
|
||||
TCollection_AsciiString MessageY =BuildValuesAscii(aMarkerStyleYValues);
|
||||
TCollection_AsciiString MessageS =BuildValuesAscii(aMarkerStyleSValues);
|
||||
|
||||
m_CurrentEntryXValue = _T(MessageX.ToCString());
|
||||
m_CurrentEntryYValue = _T(MessageY.ToCString());
|
||||
m_CurrentEntrySValue = _T(MessageS.ToCString());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CurrentEntryStyle = _T("Not Allocated");
|
||||
m_CurrentEntryXValue = _T("");
|
||||
m_CurrentEntryYValue = _T("");
|
||||
m_CurrentEntrySValue = _T("");
|
||||
GetDlgItem(IDC_FontMap_BUTTON_UpdateCurrent)->ShowWindow(SW_HIDE);
|
||||
}
|
||||
}
|
||||
|
||||
void CMarkPropertyPage::OnSelchangeMarkMapTAB(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
UpdateDisplay(m_TabCtrl.GetCurSel()+1);
|
||||
UpdateData(false);
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
BOOL CMarkPropertyPage::OnApply()
|
||||
{
|
||||
// myViewer->SetMarkMap(myMarkMap);
|
||||
// myViewer->Update();
|
||||
return CPropertyPage::OnApply();
|
||||
}
|
||||
|
||||
TCollection_AsciiString CMarkPropertyPage::BuildValuesAscii(const TShort_Array1OfShortReal& anArray)
|
||||
{
|
||||
TCollection_AsciiString Message;
|
||||
for(int i=1;i<=anArray.Length();i++)
|
||||
{
|
||||
Message += anArray.Value(i);
|
||||
Message += "\t";
|
||||
}
|
||||
return Message;
|
||||
}
|
||||
|
||||
TCollection_AsciiString CMarkPropertyPage::BuildValuesAscii(const TColStd_Array1OfBoolean& anArray)
|
||||
{
|
||||
TCollection_AsciiString Message;
|
||||
for(int i=1;i<=anArray.Length();i++)
|
||||
{
|
||||
if (anArray(i)) Message += "True"; else Message += "False";
|
||||
Message += "\t";
|
||||
}
|
||||
return Message;
|
||||
}
|
82
samples/mfc/standard/08_HLR/src/Properties/MarkPropertyPage.h
Executable file
82
samples/mfc/standard/08_HLR/src/Properties/MarkPropertyPage.h
Executable file
@@ -0,0 +1,82 @@
|
||||
// MarkPropertyPage.h : header file
|
||||
//
|
||||
|
||||
#if !defined(AFX_MarkPropertyPage_H__B6E7AAD3_DB72_11D1_8DE5_0800369C8A03__INCLUDED_)
|
||||
#define AFX_MarkPropertyPage_H__B6E7AAD3_DB72_11D1_8DE5_0800369C8A03__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include <resource.h>
|
||||
|
||||
#include "V2d_Viewer.hxx"
|
||||
#include "TColQuantity_Array1OfLength.hxx"
|
||||
#include "TColQuantity_HArray1OfLength.hxx"
|
||||
#include "TColStd_Array1OfBoolean.hxx"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMarkPropertyPage dialog
|
||||
|
||||
class CMarkPropertyPage : public CPropertyPage
|
||||
{
|
||||
private :
|
||||
Handle(Aspect_MarkMap) myMarkMap;
|
||||
private :
|
||||
Handle(V2d_Viewer) myViewer;
|
||||
public:
|
||||
void SetViewer(Handle(V2d_Viewer) aViewer) {
|
||||
myViewer = aViewer;
|
||||
myMarkMap = aViewer->MarkMap();
|
||||
};
|
||||
|
||||
DECLARE_DYNCREATE(CMarkPropertyPage)
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CMarkPropertyPage();
|
||||
~CMarkPropertyPage();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CMarkPropertyPage)
|
||||
enum { IDD = IDD_DIALOG_Mark };
|
||||
CTabCtrl m_TabCtrl;
|
||||
CComboBox m_NewEntryControl;
|
||||
|
||||
CString m_MarkMapSize;
|
||||
CString m_CurrentEntryStyle;
|
||||
CString m_CurrentEntryXValue;
|
||||
CString m_CurrentEntryYValue;
|
||||
CString m_CurrentEntrySValue;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMarkPropertyPage)
|
||||
public:
|
||||
virtual BOOL OnApply();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CMarkPropertyPage)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnSelchangeMarkMapTAB(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
void UpdateDisplay(int CurrentSelectionIndex);
|
||||
|
||||
TCollection_AsciiString BuildValuesAscii(const TShort_Array1OfShortReal& anArray);
|
||||
TCollection_AsciiString BuildValuesAscii(const TColStd_Array1OfBoolean& anArray);
|
||||
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MarkPropertyPage_H__B6E7AAD3_DB72_11D1_8DE5_0800369C8A03__INCLUDED_)
|
236
samples/mfc/standard/08_HLR/src/Properties/PropertiesDialog.rc2
Executable file
236
samples/mfc/standard/08_HLR/src/Properties/PropertiesDialog.rc2
Executable file
@@ -0,0 +1,236 @@
|
||||
//
|
||||
// resources Microsoft Visual C++
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Add manually edited resources here...
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IDD_DIALOG_Color DIALOG DISCARDABLE 0, 0, 281, 186
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Color Map "
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Type Of The Color Map :",IDC_STATIC,20,10,87,10
|
||||
LTEXT "To be updated ...",IDC_ColorMap_STATIC_Type,110,10,69,
|
||||
10
|
||||
LTEXT "Size Of The Color Map :",IDC_STATIC,20,20,79,10
|
||||
CONTROL "Tab1",IDC_ColorMap_TAB,"SysTabControl32",TCS_BUTTONS,19,
|
||||
53,242,15
|
||||
LTEXT "To be updated ...",IDC_ColorMap_STATIC_Size,110,20,69,
|
||||
10
|
||||
GROUPBOX "Entries :",IDC_STATIC,10,40,264,50
|
||||
LTEXT "Color Name :",IDC_STATIC,20,75,50,10
|
||||
LTEXT "To be updated ...",IDC_ColorMap_STATIC_EntryColorName,
|
||||
204,75,69,10
|
||||
PUSHBUTTON "Add",IDC_ColorMap_BUTTON_AddNewEntry,110,145,55,15
|
||||
GROUPBOX "New Entry",IDC_STATIC,10,100,267,79
|
||||
PUSHBUTTON "Update Current",IDC_ColorMap_BUTTON_UpdateCurrentEntry,
|
||||
20,145,55,15
|
||||
LTEXT "Color Name :",
|
||||
IDC_ColorMap_STATIC_NewEntryColorNameStatic,20,120,55,10
|
||||
PUSHBUTTON "Edit...",IDC_ColorMap_BUTTON_NewEntry_EditColor,204,145,
|
||||
55,15
|
||||
LTEXT "999",IDC_ColorMap_STATIC_EntryColorRed,75,75,35,10
|
||||
LTEXT "999",IDC_ColorMap_STATIC_EntryColorGreen,120,75,35,10
|
||||
LTEXT "999",IDC_ColorMap_STATIC_EntryColorBlue,165,75,35,10
|
||||
EDITTEXT IDC_ColorMap_EDIT_NewEntryColorRed,75,120,35,12,
|
||||
ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_ColorMap_EDIT_NewEntryColorGreen,120,120,30,12,
|
||||
ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_ColorMap_EDIT_NewEntryColorBlue,165,120,35,12,
|
||||
ES_AUTOHSCROLL
|
||||
COMBOBOX IDC_ColorMap_COMBO_NewEntryColorName,204,120,70,193,
|
||||
CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "New Generic Color Map",
|
||||
IDC_ColorMap_BUTTON_NewGenericColorMap,179,4,95,13
|
||||
LTEXT "Not available for this type of Color map",
|
||||
IDC_ColorMap_STATIC_NewEntryNotavailable,70,130,160,10
|
||||
PUSHBUTTON "New Color Cube Color Map ",
|
||||
IDC_ColorMap_BUTTON_NewColorCubeColorMap,179,18,95,13
|
||||
PUSHBUTTON "New Color Ramp Color Map",
|
||||
IDC_ColorMap_BUTTON_NewColorRampColorMap,179,31,95,13
|
||||
END
|
||||
|
||||
IDD_DIALOG_Font DIALOGEX 0, 0, 287, 210
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Font Map"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Size Of The Font Map :",IDC_STATIC,20,10,80,10
|
||||
LTEXT "To be updated ...",IDC_FontMap_STATIC_Size,110,10,80,10
|
||||
GROUPBOX "Entries :",IDC_STATIC,10,28,270,97,0,WS_EX_TRANSPARENT
|
||||
CONTROL "Tab1",IDC_FontMap_TAB,"SysTabControl32",TCS_BUTTONS,20,
|
||||
40,242,15
|
||||
GROUPBOX "New Entry",IDC_STATIC,10,130,270,73
|
||||
PUSHBUTTON "Update Current",IDC_FontMap_BUTTON_UpdateCurrent,158,
|
||||
181,55,15
|
||||
PUSHBUTTON "Add",IDC_FontMap_BUTTON_NewEntry,221,179,55,16
|
||||
LTEXT "To be updated...",IDC_FontMap_STATIC_CurrentEntryValue,
|
||||
63,75,217,10
|
||||
LTEXT "Type :",IDC_STATIC,21,155,23,10
|
||||
LTEXT "Type :",IDC_STATIC,21,60,40,10
|
||||
LTEXT "To be updated ...",IDC_FontMap_STATIC_CurrentEntryType,
|
||||
63,60,80,10
|
||||
LTEXT "Size :",IDC_STATIC,21,174,42,10
|
||||
LTEXT "Slant :",IDC_STATIC,21,189,28,10
|
||||
EDITTEXT IDC_FontMap_EDIT_NewEntrySize,63,172,62,12,
|
||||
ES_AUTOHSCROLL | ES_WANTRETURN
|
||||
EDITTEXT IDC_FontMap_EDIT_NewEntrySlant,63,187,62,12,
|
||||
ES_AUTOHSCROLL | ES_WANTRETURN
|
||||
LTEXT "Size :",IDC_STATIC,21,90,30,10
|
||||
LTEXT "Slant :",IDC_STATIC,21,106,36,10
|
||||
LTEXT "Value :",IDC_STATIC,21,75,40,10
|
||||
LTEXT "Type :",IDC_STATIC,21,140,42,10
|
||||
COMBOBOX IDC_FontMap_COMBO_NewEntryType,63,138,113,77,
|
||||
CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
|
||||
EDITTEXT IDC_FontMap_EDIT_NewEntryValue,63,153,209,12,
|
||||
ES_AUTOHSCROLL | ES_READONLY
|
||||
LTEXT "To be updated...",IDC_FontMap_STATIC_CurrentEntrySize,
|
||||
63,90,70,10
|
||||
LTEXT "To be updated...",IDC_FontMap_STATIC_CurrentEntrySlant,
|
||||
63,106,80,10
|
||||
PUSHBUTTON "Edit...",IDC_FontMap_BUTTON_NewEntry_EditFont,191,138,
|
||||
55,12
|
||||
END
|
||||
|
||||
IDD_DIALOG_Width DIALOG DISCARDABLE 0, 0, 281, 167
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Width Map "
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Size Of The Width Map :",IDC_STATIC,15,10,80,10
|
||||
CONTROL "Tab1",IDC_WidthMap_TAB,"SysTabControl32",TCS_BUTTONS,21,
|
||||
40,242,15
|
||||
LTEXT "To be updated ...",IDC_WidthMap_STATIC_Size,107,10,80,
|
||||
10
|
||||
GROUPBOX "Entries :",IDC_STATIC,10,30,264,57
|
||||
LTEXT "Type :",IDC_STATIC,15,60,80,10
|
||||
LTEXT "Width :",IDC_STATIC,15,75,80,10
|
||||
LTEXT "Type :",IDC_STATIC,15,115,49,10
|
||||
LTEXT "Width :",IDC_STATIC,15,130,49,10
|
||||
COMBOBOX IDC_WidthMap_COMBO_NewEntryType,70,113,113,77,
|
||||
CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
|
||||
EDITTEXT IDC_WidthMap_EDIT_NewEntryWidth,70,128,62,12,
|
||||
ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN
|
||||
LTEXT "To be updated ...",IDC_WidthMap_STATIC_EntryType,107,60,
|
||||
80,10
|
||||
LTEXT "To be updated ...",IDC_WidthMap_STATIC_EntryWidth,107,
|
||||
75,80,10
|
||||
PUSHBUTTON "Add",IDC_WidthMap_BUTTON_AddNewEntry,200,130,55,15
|
||||
GROUPBOX "New Entry",IDC_STATIC,7,101,267,51
|
||||
PUSHBUTTON "Update Current",IDC_WidthMap_BUTTON_UpdateCurrentEntry,
|
||||
200,110,55,15
|
||||
END
|
||||
|
||||
IDD_DIALOG_NewColorCube DIALOG DISCARDABLE 0, 0, 207, 156
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "New Color Cube"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,150,10,50,13
|
||||
PUSHBUTTON "Cancel",IDCANCEL,150,30,50,14
|
||||
LTEXT "base_pixel",IDC_STATIC,20,10,50,10
|
||||
LTEXT "greenmax",IDC_STATIC,20,70,50,10
|
||||
LTEXT "greenmult",IDC_STATIC,20,90,50,10
|
||||
LTEXT "bluemax",IDC_STATIC,20,110,50,10
|
||||
LTEXT "bluemult",IDC_STATIC,20,130,50,10
|
||||
EDITTEXT IDC_NewColorCube_EDIT_bluemult,80,130,50,12,
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_NewColorCube_EDIT_bluemax,80,110,50,12,
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_NewColorCube_EDIT_grennmult,80,90,50,12,
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_NewColorCube_EDIT_greenmax,80,70,50,12,
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_NewColorCube_EDIT_base_pixel,80,10,50,12,
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "redmax",IDC_STATIC,20,30,50,10
|
||||
EDITTEXT IDC_NewColorCube_EDIT_redmax,80,30,50,12,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
LTEXT "redmult",IDC_STATIC,20,50,50,10
|
||||
EDITTEXT IDC_NewColorCube_EDIT_redmult,80,50,50,12,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
END
|
||||
|
||||
IDD_DIALOG_NewColorRamp DIALOG DISCARDABLE 0, 0, 252, 121
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "New Color ramp"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,150,10,50,13
|
||||
PUSHBUTTON "Cancel",IDCANCEL,150,30,50,14
|
||||
LTEXT "base_pixel",-1,20,10,49,10
|
||||
EDITTEXT IDC_NewColorRamp_EDIT_base_pixel,80,10,40,12,
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "dimension",-1,20,30,49,10
|
||||
EDITTEXT IDC_NewColorramp_EDIT_dimension,80,30,40,12,
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "Color Name :",
|
||||
IDC_ColorMap_STATIC_NewEntryColorNameStatic,20,50,49,10
|
||||
PUSHBUTTON "Edit...",IDC_NewColorMapRamp_BUTTON_EditColor,145,70,55,10
|
||||
EDITTEXT IDC_NewColorMapRamp_EDIT_ColorRed,28,70,35,12,
|
||||
ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_NewColorMapRamp_EDIT_ColorGreen,65,70,35,12,
|
||||
ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_NewColorMapRamp_EDIT_ColorBlue,103,70,35,12,
|
||||
ES_AUTOHSCROLL
|
||||
COMBOBOX IDC_NewColorMap_COMBO_NewEntryColorName,80,50,70,193,
|
||||
CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_DIALOG_Type DIALOGEX 0, 0, 287, 170
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Type Map"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Size Of The Typet Map :",-1,20,10,80,10
|
||||
LTEXT "To be updated ...",IDC_TypeMap_STATIC_Size,110,10,80,10
|
||||
GROUPBOX "Entries :",-1,10,28,270,62,0,WS_EX_TRANSPARENT
|
||||
CONTROL "Tab1",IDC_TypeMap_TAB,"SysTabControl32",TCS_BUTTONS,20,
|
||||
40,242,15
|
||||
GROUPBOX "New Entry",-1,10,100,270,60
|
||||
PUSHBUTTON "Update Current",IDC_FontMap_BUTTON_UpdateCurrent,160,
|
||||
140,55,15
|
||||
PUSHBUTTON "Add",IDC_FontMap_BUTTON_NewEntry,220,140,55,15
|
||||
LTEXT "To be updated...",IDC_TypeMap_STATIC_CurrentEntryValue,
|
||||
63,75,217,10
|
||||
LTEXT "Value :",-1,21,126,42,10
|
||||
LTEXT "Style :",-1,21,60,40,10
|
||||
LTEXT "To be updated ...",IDC_TypeMap_STATIC_CurrentEntryStyle,
|
||||
63,60,80,10
|
||||
LTEXT "Value :",-1,21,75,40,10
|
||||
LTEXT "Style :",-1,21,111,42,10
|
||||
COMBOBOX IDC_TypeMap_COMBO_NewEntryStyle,63,108,113,77,
|
||||
CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
|
||||
EDITTEXT IDC_TypeMap_EDIT_NewEntryValue,63,124,194,12,
|
||||
ES_AUTOHSCROLL | ES_READONLY
|
||||
END
|
||||
|
||||
IDD_DIALOG_Mark DIALOGEX 0, 0, 287, 201
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Mark Map"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Size Of The Mark Map :",AFX_ID_PREVIEW_CLOSE,20,10,80,
|
||||
10
|
||||
LTEXT "To be updated ...",IDC_MarkMap_STATIC_Size,110,10,80,10
|
||||
GROUPBOX "Entries :",-1,10,28,270,92,0,WS_EX_TRANSPARENT
|
||||
CONTROL "Tab1",IDC_MarkMap_TAB,"SysTabControl32",TCS_BUTTONS,20,
|
||||
40,242,15
|
||||
LTEXT "To be updated...",IDC_MarkMap_STATIC_CurrentEntryXValue,
|
||||
63,75,217,9
|
||||
LTEXT "Style :",-1,21,60,40,10
|
||||
LTEXT "To be updated ...",IDC_MarkMap_STATIC_CurrentEntryStyle,
|
||||
63,60,80,10
|
||||
LTEXT "XValue :",-1,21,75,40,9
|
||||
LTEXT "To be updated...",IDC_MarkMap_STATIC_CurrentEntryYValue,
|
||||
63,90,217,10
|
||||
LTEXT "YValue :",-1,21,90,40,10
|
||||
LTEXT "To be updated...",IDC_MarkMap_STATIC_CurrentEntrySValue,
|
||||
63,105,217,10
|
||||
LTEXT "SValue :",-1,21,105,40,10
|
||||
LTEXT "To be updated...",IDC_MarkMap_STATIC_CurrentEntryValue,
|
||||
62,90,217,10
|
||||
END
|
63
samples/mfc/standard/08_HLR/src/Properties/PropertiesSheet.cpp
Executable file
63
samples/mfc/standard/08_HLR/src/Properties/PropertiesSheet.cpp
Executable file
@@ -0,0 +1,63 @@
|
||||
// MapProperties.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "PropertiesSheet.h"
|
||||
|
||||
#include "HLRApp.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPropertiesSheet
|
||||
|
||||
IMPLEMENT_DYNAMIC(CPropertiesSheet, CPropertySheet)
|
||||
|
||||
CPropertiesSheet::CPropertiesSheet(CWnd* pParentWnd, UINT iSelectPage)
|
||||
:CPropertySheet("View Map Properties", pParentWnd, iSelectPage)
|
||||
{
|
||||
}
|
||||
|
||||
void CPropertiesSheet::SetViewer (Handle(V2d_Viewer) aViewer)
|
||||
{
|
||||
AddPage(& m_pageWidthProperty);
|
||||
m_pageWidthProperty.SetViewer(aViewer);
|
||||
|
||||
AddPage(& m_pageColorProperty);
|
||||
m_pageColorProperty.SetViewer(aViewer);
|
||||
|
||||
AddPage(& m_pageFontProperty);
|
||||
m_pageFontProperty.SetViewer(aViewer);
|
||||
|
||||
AddPage(& m_pageTypeProperty);
|
||||
m_pageTypeProperty.SetViewer(aViewer);
|
||||
|
||||
AddPage(& m_pageMarkProperty);
|
||||
m_pageMarkProperty.SetViewer(aViewer);
|
||||
|
||||
}
|
||||
|
||||
CPropertiesSheet::~CPropertiesSheet()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CPropertiesSheet, CPropertySheet)
|
||||
//{{AFX_MSG_MAP(CPropertiesSheet)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPropertiesSheet message handlers
|
||||
|
||||
BOOL CPropertiesSheet::OnInitDialog()
|
||||
{
|
||||
BOOL bResult = CPropertySheet::OnInitDialog();
|
||||
return bResult;
|
||||
}
|
||||
|
68
samples/mfc/standard/08_HLR/src/Properties/PropertiesSheet.h
Executable file
68
samples/mfc/standard/08_HLR/src/Properties/PropertiesSheet.h
Executable file
@@ -0,0 +1,68 @@
|
||||
#if !defined(AFX_PropertiesSheet_H__A815F7A6_D51B_11D1_8DDE_0800369C8A03__INCLUDED_)
|
||||
#define AFX_PropertiesSheet_H__A815F7A6_D51B_11D1_8DDE_0800369C8A03__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// PropertiesSheet.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPropertiesSheet
|
||||
#include "ColorPropertyPage.h"
|
||||
#include "FontPropertyPage.h"
|
||||
#include "WidthPropertyPage.h"
|
||||
#include "TypePropertyPage.h"
|
||||
#include "MarkPropertyPage.h"
|
||||
|
||||
|
||||
class CPropertiesSheet : public CPropertySheet
|
||||
{
|
||||
DECLARE_DYNAMIC(CPropertiesSheet)
|
||||
|
||||
|
||||
|
||||
private :
|
||||
CColorPropertyPage m_pageColorProperty;
|
||||
CFontPropertyPage m_pageFontProperty;
|
||||
CWidthPropertyPage m_pageWidthProperty;
|
||||
CTypePropertyPage m_pageTypeProperty;
|
||||
CMarkPropertyPage m_pageMarkProperty;
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CPropertiesSheet(CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
|
||||
|
||||
void SetViewer (Handle(V2d_Viewer) aViewer);
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CPropertiesSheet)
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CPropertiesSheet();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CPropertiesSheet)
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_PropertiesSheet_H__A815F7A6_D51B_11D1_8DDE_0800369C8A03__INCLUDED_)
|
294
samples/mfc/standard/08_HLR/src/Properties/TypePropertyPage.cpp
Executable file
294
samples/mfc/standard/08_HLR/src/Properties/TypePropertyPage.cpp
Executable file
@@ -0,0 +1,294 @@
|
||||
// TypePropertyPage.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "TypePropertyPage.h"
|
||||
|
||||
#include "HLRApp.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
//#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#include "Aspect_TypeMap.hxx"
|
||||
#include "Aspect_TypeMapEntry.hxx"
|
||||
#include "TColQuantity_Array1OfLength.hxx"
|
||||
#include "TColStd_SequenceOfReal.hxx"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTypePropertyPage property page
|
||||
|
||||
IMPLEMENT_DYNCREATE(CTypePropertyPage, CPropertyPage)
|
||||
|
||||
CTypePropertyPage::CTypePropertyPage() : CPropertyPage(CTypePropertyPage::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CTypePropertyPage)
|
||||
m_TypeMapSize = _T("Computing...");
|
||||
m_CurrentEntryStyle = _T("Computing...");
|
||||
m_CurrentEntryValue = _T("Computing...");
|
||||
m_NewEntryValue = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
BOOL CTypePropertyPage::OnInitDialog()
|
||||
{
|
||||
CPropertyPage::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
|
||||
m_NewEntryControl.AddString("SOLID");
|
||||
m_NewEntryControl.AddString("DASH");
|
||||
m_NewEntryControl.AddString("DOT");
|
||||
m_NewEntryControl.AddString("DOTDASH");
|
||||
m_NewEntryControl.AddString("USERDEFINED");
|
||||
m_NewEntryControl.SetCurSel(1);
|
||||
|
||||
UpdateDisplay(1);
|
||||
|
||||
UpdateData(false);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
CTypePropertyPage::~CTypePropertyPage()
|
||||
{
|
||||
}
|
||||
|
||||
void CTypePropertyPage::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CTypePropertyPage)
|
||||
DDX_Control(pDX, IDC_TypeMap_TAB, m_TabCtrl);
|
||||
DDX_Control(pDX, IDC_TypeMap_COMBO_NewEntryStyle, m_NewEntryControl);
|
||||
DDX_Control(pDX, IDC_TypeMap_EDIT_NewEntryValue, m_NewEntryValueControl);
|
||||
DDX_Text(pDX, IDC_TypeMap_STATIC_Size, m_TypeMapSize);
|
||||
DDX_Text(pDX, IDC_TypeMap_STATIC_CurrentEntryStyle, m_CurrentEntryStyle);
|
||||
DDX_Text(pDX, IDC_TypeMap_STATIC_CurrentEntryValue, m_CurrentEntryValue);
|
||||
DDX_Text(pDX, IDC_TypeMap_EDIT_NewEntryValue, m_NewEntryValue);
|
||||
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTypePropertyPage, CPropertyPage)
|
||||
//{{AFX_MSG_MAP(CTypePropertyPage)
|
||||
ON_BN_CLICKED(IDC_FontMap_BUTTON_NewEntry, OnFontMapBUTTONNewEntry)
|
||||
ON_BN_CLICKED(IDC_FontMap_BUTTON_UpdateCurrent, OnFontMapBUTTONUpdateCurrent)
|
||||
ON_EN_CHANGE(IDC_TypeMap_EDIT_NewEntryValue, OnChangeTypeMapEDITNewEntryValue)
|
||||
ON_NOTIFY(TCN_SELCHANGE, IDC_TypeMap_TAB, OnSelchangeTypeMapTAB)
|
||||
ON_CBN_SELCHANGE(IDC_TypeMap_COMBO_NewEntryStyle, OnSelchangeTypeMapCOMBONewEntryStyle)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTypePropertyPage message handlers
|
||||
void CTypePropertyPage::UpdateDisplay(int CurrentSelectionIndex)
|
||||
{
|
||||
TCollection_AsciiString SizeMessage(myTypeMap->Size());
|
||||
m_TypeMapSize = _T(SizeMessage.ToCString());
|
||||
|
||||
m_TabCtrl.DeleteAllItems();
|
||||
|
||||
TC_ITEM TabCtrlItem;
|
||||
TabCtrlItem.mask = TCIF_TEXT;
|
||||
|
||||
for(int i =1;i<=myTypeMap->Size();i++)
|
||||
{
|
||||
Aspect_TypeMapEntry aTypeMapEntry = myTypeMap->Entry(i);
|
||||
TCollection_AsciiString EntryNumerMessage(aTypeMapEntry.Index());
|
||||
TabCtrlItem.pszText = (LPSTR) EntryNumerMessage.ToCString();
|
||||
m_TabCtrl.InsertItem( aTypeMapEntry.Index(), &TabCtrlItem );
|
||||
}
|
||||
m_TabCtrl.SetCurSel(CurrentSelectionIndex-1);
|
||||
|
||||
// update The Current Selected entry
|
||||
Aspect_TypeMapEntry aTypeMapEntry = myTypeMap->Entry(CurrentSelectionIndex);
|
||||
if (aTypeMapEntry. IsAllocated () )
|
||||
{
|
||||
Aspect_LineStyle TypeMapEntryType = aTypeMapEntry.Type() ;
|
||||
|
||||
switch (TypeMapEntryType.Style()) {
|
||||
case Aspect_TOL_SOLID : m_CurrentEntryStyle = _T("SOLID"); break;
|
||||
case Aspect_TOL_DASH : m_CurrentEntryStyle = _T("DASH"); break;
|
||||
case Aspect_TOL_DOT : m_CurrentEntryStyle = _T("DOT"); break;
|
||||
case Aspect_TOL_DOTDASH : m_CurrentEntryStyle = _T("DOTDASH"); break;
|
||||
case Aspect_TOL_USERDEFINED : m_CurrentEntryStyle = _T("USERDEFINED"); break;
|
||||
default : m_CurrentEntryStyle = _T("Underknown");
|
||||
}
|
||||
int NbValue = TypeMapEntryType.Length();
|
||||
TCollection_AsciiString Message = BuildValuesAscii(TypeMapEntryType.Values());
|
||||
|
||||
m_CurrentEntryValue = _T(Message.ToCString());
|
||||
|
||||
m_NewEntryControl.SetCurSel(TypeMapEntryType.Style());
|
||||
m_NewEntryValue = _T(Message.ToCString());
|
||||
if (TypeMapEntryType.Style() == Aspect_TOL_USERDEFINED)
|
||||
m_NewEntryValueControl.SetReadOnly( false );
|
||||
else
|
||||
m_NewEntryValueControl.SetReadOnly( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CurrentEntryStyle = _T("Not Allocated");
|
||||
m_CurrentEntryValue = _T("");
|
||||
m_NewEntryValue = _T("No value");
|
||||
GetDlgItem(IDC_FontMap_BUTTON_UpdateCurrent)->ShowWindow(SW_HIDE);
|
||||
}
|
||||
}
|
||||
|
||||
void CTypePropertyPage::OnSelchangeTypeMapTAB(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
UpdateDisplay(m_TabCtrl.GetCurSel()+1);
|
||||
UpdateData(false);
|
||||
*pResult = 0;
|
||||
}
|
||||
void CTypePropertyPage::OnSelchangeTypeMapCOMBONewEntryStyle()
|
||||
{
|
||||
UpdateData(true);
|
||||
// the Type Map entry change in the edit part
|
||||
if (m_NewEntryControl.GetCurSel() == Aspect_TOL_USERDEFINED)
|
||||
m_NewEntryValueControl.SetReadOnly( false );
|
||||
else
|
||||
{
|
||||
m_NewEntryValueControl.SetReadOnly( true );
|
||||
|
||||
// create a dummy map to extract the default values
|
||||
Aspect_TypeMapEntry aTypeMapEntry(99,(Aspect_TypeOfLine)m_NewEntryControl.GetCurSel());
|
||||
Aspect_LineStyle TypeMapEntryType = aTypeMapEntry.Type() ;
|
||||
TCollection_AsciiString Message = BuildValuesAscii(TypeMapEntryType.Values());
|
||||
|
||||
m_NewEntryValue = _T(Message.ToCString());
|
||||
}
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CTypePropertyPage::OnChangeTypeMapEDITNewEntryValue()
|
||||
{
|
||||
UpdateData(true);
|
||||
Handle(TColQuantity_HArray1OfLength) anArray;
|
||||
Standard_Boolean IsDone = ExtractValues(TCollection_AsciiString((char *)(LPCSTR)m_NewEntryValue),anArray);
|
||||
if (IsDone)
|
||||
{
|
||||
GetDlgItem(IDC_FontMap_BUTTON_UpdateCurrent)->ShowWindow(SW_SHOW);
|
||||
GetDlgItem(IDC_FontMap_BUTTON_NewEntry)->ShowWindow(SW_SHOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetDlgItem(IDC_FontMap_BUTTON_UpdateCurrent)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_FontMap_BUTTON_NewEntry)->ShowWindow(SW_HIDE);
|
||||
}
|
||||
}
|
||||
|
||||
void CTypePropertyPage::OnFontMapBUTTONNewEntry()
|
||||
{
|
||||
UpdateData(true);
|
||||
int NewEntry;
|
||||
|
||||
if (m_NewEntryControl.GetCurSel() == Aspect_TOL_USERDEFINED)
|
||||
{
|
||||
Handle(TColQuantity_HArray1OfLength) anArray;
|
||||
if (ExtractValues(TCollection_AsciiString((char *)(LPCSTR)m_NewEntryValue),anArray))
|
||||
{
|
||||
Aspect_LineStyle aLineStyle(anArray->Array1());
|
||||
NewEntry = myTypeMap->AddEntry( aLineStyle );
|
||||
}
|
||||
else Standard_Failure::Raise(" The String is not Valid ");
|
||||
}
|
||||
else
|
||||
{
|
||||
Aspect_LineStyle aLineStyle((Aspect_TypeOfLine)m_NewEntryControl.GetCurSel());
|
||||
NewEntry = myTypeMap->AddEntry( aLineStyle );
|
||||
}
|
||||
|
||||
SetModified(true);
|
||||
UpdateDisplay(NewEntry);
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CTypePropertyPage::OnFontMapBUTTONUpdateCurrent()
|
||||
{
|
||||
UpdateData(true);
|
||||
Aspect_TypeMapEntry aTypeMapEntry = myTypeMap->Entry( m_TabCtrl.GetCurSel()+1);
|
||||
|
||||
if (m_NewEntryControl.GetCurSel() == Aspect_TOL_USERDEFINED)
|
||||
{
|
||||
Handle(TColQuantity_HArray1OfLength) anArray;
|
||||
if (ExtractValues(TCollection_AsciiString((char *)(LPCSTR)m_NewEntryValue),anArray))
|
||||
{
|
||||
Aspect_LineStyle aLineStyle(anArray->Array1());
|
||||
aTypeMapEntry.SetType( aLineStyle );
|
||||
}
|
||||
else Standard_Failure::Raise(" The String is not Valid ");
|
||||
}
|
||||
else
|
||||
{
|
||||
Aspect_LineStyle aLineStyle((Aspect_TypeOfLine)m_NewEntryControl.GetCurSel());
|
||||
aTypeMapEntry.SetType( aLineStyle );
|
||||
}
|
||||
|
||||
myTypeMap->AddEntry(aTypeMapEntry); // in fact just update
|
||||
|
||||
SetModified(true);
|
||||
UpdateDisplay(m_TabCtrl.GetCurSel()+1);
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
BOOL CTypePropertyPage::OnApply()
|
||||
{
|
||||
myViewer->SetTypeMap(myTypeMap);
|
||||
myViewer->Update();
|
||||
return CPropertyPage::OnApply();
|
||||
}
|
||||
|
||||
Standard_Boolean CTypePropertyPage::ExtractValues(TCollection_AsciiString aMessage,
|
||||
Handle(TColQuantity_HArray1OfLength)& anArray) // out
|
||||
{
|
||||
TColStd_SequenceOfReal aSequenceOfReal;
|
||||
Standard_Integer CurrentStartValue=1;
|
||||
bool NotFinish = true;
|
||||
while (NotFinish)
|
||||
{
|
||||
CurrentStartValue = aMessage.SearchFromEnd(";");
|
||||
if ( CurrentStartValue == aMessage.Length()) return Standard_False;
|
||||
if (CurrentStartValue != -1)
|
||||
{
|
||||
TCollection_AsciiString aNewMessage = aMessage.Split(CurrentStartValue);
|
||||
aMessage.Remove(aMessage.Length());
|
||||
if (aNewMessage.IsRealValue())
|
||||
aSequenceOfReal.Append(aNewMessage.RealValue());
|
||||
else return Standard_False;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aMessage.IsRealValue())
|
||||
aSequenceOfReal.Append(aMessage.RealValue());
|
||||
else return Standard_False;
|
||||
NotFinish = false;
|
||||
}
|
||||
}
|
||||
|
||||
anArray = new TColQuantity_HArray1OfLength(1,aSequenceOfReal.Length());
|
||||
for (int i=1;i<=aSequenceOfReal.Length();i++)
|
||||
anArray->SetValue(i,aSequenceOfReal(aSequenceOfReal.Length()-i+1));
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
TCollection_AsciiString CTypePropertyPage::BuildValuesAscii(const TColQuantity_Array1OfLength& anArray)
|
||||
{
|
||||
TCollection_AsciiString Message;
|
||||
int NbValue = anArray.Length();
|
||||
for (int j=1;j<NbValue;j++)
|
||||
{
|
||||
Message += anArray(j);
|
||||
Message += " ; ";
|
||||
}
|
||||
Quantity_Length Length = anArray(NbValue);
|
||||
if (Length > Precision::Confusion()) Message += Length;
|
||||
else Message += "No value";
|
||||
return Message;
|
||||
}
|
84
samples/mfc/standard/08_HLR/src/Properties/TypePropertyPage.h
Executable file
84
samples/mfc/standard/08_HLR/src/Properties/TypePropertyPage.h
Executable file
@@ -0,0 +1,84 @@
|
||||
// TypePropertyPage.h : header file
|
||||
//
|
||||
|
||||
#if !defined(AFX_TypePropertyPage_H__B6E7AAD3_DB72_11D1_8DE5_0800369C8A03__INCLUDED_)
|
||||
#define AFX_TypePropertyPage_H__B6E7AAD3_DB72_11D1_8DE5_0800369C8A03__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include <resource.h>
|
||||
|
||||
#include "V2d_Viewer.hxx"
|
||||
#include "TColQuantity_HArray1OfLength.hxx"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTypePropertyPage dialog
|
||||
|
||||
class CTypePropertyPage : public CPropertyPage
|
||||
{
|
||||
private :
|
||||
Handle(Aspect_TypeMap) myTypeMap;
|
||||
private :
|
||||
Handle(V2d_Viewer) myViewer;
|
||||
public:
|
||||
void SetViewer(Handle(V2d_Viewer) aViewer) {
|
||||
myViewer = aViewer;
|
||||
myTypeMap = aViewer->TypeMap();
|
||||
};
|
||||
|
||||
DECLARE_DYNCREATE(CTypePropertyPage)
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CTypePropertyPage();
|
||||
~CTypePropertyPage();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CTypePropertyPage)
|
||||
enum { IDD = IDD_DIALOG_Type };
|
||||
CTabCtrl m_TabCtrl;
|
||||
CComboBox m_NewEntryControl;
|
||||
|
||||
CString m_TypeMapSize;
|
||||
CString m_CurrentEntryStyle;
|
||||
CString m_CurrentEntryValue;
|
||||
CEdit m_NewEntryValueControl;
|
||||
CString m_NewEntryValue;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CTypePropertyPage)
|
||||
public:
|
||||
virtual BOOL OnApply();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CTypePropertyPage)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnFontMapBUTTONNewEntry();
|
||||
afx_msg void OnFontMapBUTTONUpdateCurrent();
|
||||
afx_msg void OnChangeTypeMapEDITNewEntryValue();
|
||||
afx_msg void OnSelchangeTypeMapTAB(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnSelchangeTypeMapCOMBONewEntryStyle();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
void UpdateDisplay(int CurrentSelectionIndex);
|
||||
|
||||
TCollection_AsciiString BuildValuesAscii(const TColQuantity_Array1OfLength& anArray);
|
||||
Standard_Boolean ExtractValues(TCollection_AsciiString aMessage,Handle(TColQuantity_HArray1OfLength)& anArray);
|
||||
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_TypePropertyPage_H__B6E7AAD3_DB72_11D1_8DE5_0800369C8A03__INCLUDED_)
|
191
samples/mfc/standard/08_HLR/src/Properties/WidthPropertyPage.cpp
Executable file
191
samples/mfc/standard/08_HLR/src/Properties/WidthPropertyPage.cpp
Executable file
@@ -0,0 +1,191 @@
|
||||
// WidthPropertyPage.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "WidthPropertyPage.h"
|
||||
|
||||
#include "HLRApp.h"
|
||||
#include "Aspect_WidthMapEntry.hxx"
|
||||
#include "Aspect_LineStyle.hxx"
|
||||
|
||||
#ifdef _DEBUG
|
||||
// #define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CWidthPropertyPage property page
|
||||
|
||||
IMPLEMENT_DYNCREATE(CWidthPropertyPage, CPropertyPage)
|
||||
|
||||
CWidthPropertyPage::CWidthPropertyPage() : CPropertyPage(CWidthPropertyPage::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CWidthPropertyPage)
|
||||
m_WidthMapSize = _T("Computing...");
|
||||
m_EntryType = _T("Computing...");
|
||||
m_EntryWidth = _T("Computing...");
|
||||
m_NewEntryWidth = 1;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
CWidthPropertyPage::~CWidthPropertyPage()
|
||||
{
|
||||
}
|
||||
|
||||
void CWidthPropertyPage::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CWidthPropertyPage)
|
||||
DDX_Text (pDX, IDC_WidthMap_STATIC_Size, m_WidthMapSize);
|
||||
DDX_Control (pDX, IDC_WidthMap_TAB, m_TabCtrl);
|
||||
DDX_Text (pDX, IDC_WidthMap_STATIC_EntryType, m_EntryType);
|
||||
DDX_Text (pDX, IDC_WidthMap_STATIC_EntryWidth, m_EntryWidth);
|
||||
DDX_Control (pDX, IDC_WidthMap_COMBO_NewEntryType, m_NewEntryType);
|
||||
DDX_Control (pDX, IDC_WidthMap_EDIT_NewEntryWidth, m_NewEntryWidthControl);
|
||||
DDX_Text (pDX, IDC_WidthMap_EDIT_NewEntryWidth, m_NewEntryWidth);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CWidthPropertyPage, CPropertyPage)
|
||||
//{{AFX_MSG_MAP(CWidthPropertyPage)
|
||||
ON_NOTIFY(TCN_SELCHANGE, IDC_WidthMap_TAB, OnSelchangeDialogWidthTAB)
|
||||
ON_BN_CLICKED(IDC_WidthMap_BUTTON_AddNewEntry, OnWidthMapBUTTONAddNewEntry)
|
||||
ON_CBN_SELCHANGE(IDC_WidthMap_COMBO_NewEntryType, OnSelchangeWidthMapCOMBONewEntryType)
|
||||
ON_BN_CLICKED(IDC_WidthMap_BUTTON_UpdateCurrentEntry, OnWidthMapBUTTONUpdateCurrentEntry)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CWidthPropertyPage message handlers
|
||||
|
||||
BOOL CWidthPropertyPage::OnInitDialog()
|
||||
{
|
||||
CPropertyPage::OnInitDialog();
|
||||
|
||||
// update the CComboBox to add the enumeration possibilities.
|
||||
m_NewEntryType.AddString( "THIN" );
|
||||
m_NewEntryType.AddString( "MEDIUM" );
|
||||
m_NewEntryType.AddString( "THICK" );
|
||||
m_NewEntryType.AddString( "VERYTHICK" );
|
||||
m_NewEntryType.AddString( "USERDEFINED" );
|
||||
m_NewEntryType.SetCurSel(0);
|
||||
|
||||
UpdateDisplay(1);
|
||||
UpdateData(false);
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
void CWidthPropertyPage::UpdateDisplay(int CurrentSelectionIndex)
|
||||
{
|
||||
// Update the size of the Width map
|
||||
TCollection_AsciiString SizeMessage(myWidthMap->Size());
|
||||
m_WidthMapSize = _T(SizeMessage.ToCString());
|
||||
|
||||
// clear the Tab Ctrl
|
||||
m_TabCtrl.DeleteAllItems();
|
||||
TC_ITEM TabCtrlItem;
|
||||
TabCtrlItem.mask = TCIF_TEXT;
|
||||
for(int i =1;i<=myWidthMap->Size();i++)
|
||||
{
|
||||
Aspect_WidthMapEntry aWidthMapEntry = myWidthMap->Entry(i);
|
||||
|
||||
TCollection_AsciiString EntryNumerMessage(aWidthMapEntry.Index());
|
||||
TabCtrlItem.pszText = (LPSTR) EntryNumerMessage.ToCString();
|
||||
m_TabCtrl.InsertItem( aWidthMapEntry.Index(), &TabCtrlItem );
|
||||
}
|
||||
m_TabCtrl.SetCurSel(CurrentSelectionIndex-1);
|
||||
// update the current Entry informations
|
||||
Aspect_WidthMapEntry aWidthMapEntry = myWidthMap->Entry(CurrentSelectionIndex);
|
||||
|
||||
// update the current entry
|
||||
switch (aWidthMapEntry.Type()) {
|
||||
case Aspect_WOL_THIN : m_EntryType = _T("Aspect_WOL_THIN") ; break;
|
||||
case Aspect_WOL_MEDIUM : m_EntryType = _T("Aspect_WOL_MEDIUM") ; break;
|
||||
case Aspect_WOL_THICK : m_EntryType = _T("Aspect_WOL_THICK") ; break;
|
||||
case Aspect_WOL_VERYTHICK : m_EntryType = _T("Aspect_WOL_VERYTHICK") ; break;
|
||||
case Aspect_WOL_USERDEFINED : m_EntryType = _T("Aspect_WOL_USERDEFINED") ; break;
|
||||
default : cout<<" Underknown";
|
||||
}
|
||||
|
||||
TCollection_AsciiString WidthMessage(aWidthMapEntry.Width());
|
||||
m_EntryWidth = _T(WidthMessage.ToCString());
|
||||
|
||||
// update the edit / new part of the
|
||||
// also update the edit part
|
||||
m_NewEntryType.SetCurSel(aWidthMapEntry.Type());
|
||||
m_NewEntryWidth = aWidthMapEntry.Width();
|
||||
if (aWidthMapEntry.Type() == Aspect_WOL_USERDEFINED)
|
||||
m_NewEntryWidthControl.SetReadOnly( false);
|
||||
else
|
||||
m_NewEntryWidthControl.SetReadOnly( true);
|
||||
|
||||
if (CurrentSelectionIndex == 1) // the item 1 is not editable ( in the map by default )
|
||||
GetDlgItem(IDC_WidthMap_BUTTON_UpdateCurrentEntry)->ShowWindow(SW_HIDE);
|
||||
else
|
||||
GetDlgItem(IDC_WidthMap_BUTTON_UpdateCurrentEntry)->ShowWindow(SW_SHOW);
|
||||
}
|
||||
|
||||
void CWidthPropertyPage::OnSelchangeDialogWidthTAB(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
UpdateDisplay( m_TabCtrl.GetCurSel()+1);
|
||||
UpdateData(false);
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CWidthPropertyPage::OnSelchangeWidthMapCOMBONewEntryType()
|
||||
{
|
||||
UpdateData(true);
|
||||
// the Width Map entry change in the edit part
|
||||
if (m_NewEntryType.GetCurSel() == Aspect_WOL_USERDEFINED)
|
||||
m_NewEntryWidthControl.SetReadOnly( false);
|
||||
else
|
||||
{
|
||||
m_NewEntryWidthControl.SetReadOnly( true);
|
||||
Aspect_WidthMapEntry aTmpWidthMapEntry (99,(Aspect_WidthOfLine)m_NewEntryType.GetCurSel());
|
||||
m_NewEntryWidth = aTmpWidthMapEntry.Width();
|
||||
}
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CWidthPropertyPage::OnWidthMapBUTTONAddNewEntry()
|
||||
{
|
||||
UpdateData(true);
|
||||
int NewEntry;
|
||||
if (m_NewEntryType.GetCurSel() == Aspect_WOL_USERDEFINED)
|
||||
NewEntry =myWidthMap->AddEntry(m_NewEntryWidth);
|
||||
else
|
||||
NewEntry =myWidthMap->AddEntry( (Aspect_WidthOfLine)m_NewEntryType.GetCurSel());
|
||||
SetModified(true);
|
||||
UpdateDisplay(NewEntry);
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CWidthPropertyPage::OnWidthMapBUTTONUpdateCurrentEntry()
|
||||
{
|
||||
UpdateData(true);
|
||||
|
||||
Aspect_WidthMapEntry aWidthMapEntry = myWidthMap->Entry( m_TabCtrl.GetCurSel()+1);
|
||||
|
||||
if (m_NewEntryType.GetCurSel() == Aspect_WOL_USERDEFINED)
|
||||
aWidthMapEntry.SetWidth(m_NewEntryWidth );
|
||||
else
|
||||
aWidthMapEntry.SetType((Aspect_WidthOfLine)m_NewEntryType.GetCurSel());
|
||||
|
||||
myWidthMap->AddEntry(aWidthMapEntry); // in fact just update
|
||||
SetModified(true);
|
||||
UpdateDisplay(m_TabCtrl.GetCurSel()+1);
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
BOOL CWidthPropertyPage::OnApply()
|
||||
{
|
||||
//AfxGetMainWnd()->SendMessage(WM_USERAPPLY_InMapProperties);
|
||||
myViewer->SetWidthMap(myWidthMap);
|
||||
myViewer->Update();
|
||||
return CPropertyPage::OnApply();
|
||||
}
|
78
samples/mfc/standard/08_HLR/src/Properties/WidthPropertyPage.h
Executable file
78
samples/mfc/standard/08_HLR/src/Properties/WidthPropertyPage.h
Executable file
@@ -0,0 +1,78 @@
|
||||
// WidthProperty.h : header file
|
||||
//
|
||||
|
||||
#if !defined(AFX_WIDTHPROPERTY_H__0F6C04B3_D5DB_11D1_8DDF_0800369C8A03__INCLUDED_)
|
||||
#define AFX_WIDTHPROPERTY_H__0F6C04B3_D5DB_11D1_8DDF_0800369C8A03__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include <resource.h>
|
||||
|
||||
#include "Aspect_WidthMap.hxx"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CWidthPropertyPage dialog
|
||||
|
||||
class CWidthPropertyPage : public CPropertyPage
|
||||
{
|
||||
DECLARE_DYNCREATE(CWidthPropertyPage)
|
||||
|
||||
private :
|
||||
Handle(Aspect_WidthMap) myWidthMap;
|
||||
private :
|
||||
Handle(V2d_Viewer) myViewer;
|
||||
public:
|
||||
void SetViewer(Handle(V2d_Viewer) aViewer) {
|
||||
myViewer = aViewer;
|
||||
myWidthMap = aViewer->WidthMap();
|
||||
};
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CWidthPropertyPage();
|
||||
~CWidthPropertyPage();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CWidthPropertyPage)
|
||||
enum { IDD = IDD_DIALOG_Width };
|
||||
CString m_WidthMapSize;
|
||||
CTabCtrl m_TabCtrl;
|
||||
CString m_EntryType;
|
||||
CString m_EntryWidth;
|
||||
CComboBox m_NewEntryType;
|
||||
CEdit m_NewEntryWidthControl;
|
||||
double m_NewEntryWidth;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CWidthPropertyPage)
|
||||
public:
|
||||
virtual BOOL OnApply();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CWidthPropertyPage)
|
||||
afx_msg void OnSelchangeDialogWidthTAB(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnWidthMapBUTTONAddNewEntry();
|
||||
afx_msg void OnSelchangeWidthMapCOMBONewEntryType();
|
||||
afx_msg void OnWidthMapBUTTONUpdateCurrentEntry();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
void UpdateDisplay(int CurrentSelectionIndex);
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_WIDTHPROPERTY_H__0F6C04B3_D5DB_11D1_8DDF_0800369C8A03__INCLUDED_)
|
64
samples/mfc/standard/08_HLR/src/Properties/colornewcolorrampcolormapDialog.h
Executable file
64
samples/mfc/standard/08_HLR/src/Properties/colornewcolorrampcolormapDialog.h
Executable file
@@ -0,0 +1,64 @@
|
||||
// ColorNewColorRampColorMapDialog.h : header file
|
||||
//
|
||||
|
||||
#if !defined(AFX_ColorNewColorRampColorMapDialog_H__A45F6973_DB41_11D1_8DE5_0800369C8A03__INCLUDED_)
|
||||
#define AFX_ColorNewColorRampColorMapDialog_H__A45F6973_DB41_11D1_8DE5_0800369C8A03__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include <resource.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CColorNewColorRampColorMapDialog dialog
|
||||
|
||||
class CColorNewColorRampColorMapDialog : public CDialog
|
||||
{
|
||||
private :
|
||||
Handle(Aspect_ColorMap) myColorMap;
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CColorNewColorRampColorMapDialog(CWnd* pParent = NULL); // standard constructor
|
||||
Handle(Aspect_ColorMap) ColorMap() {return myColorMap;};
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CColorNewColorRampColorMapDialog)
|
||||
enum { IDD = IDD_DIALOG_NewColorRamp };
|
||||
CComboBox m_ColorList;
|
||||
int m_base_pixel;
|
||||
int m_dimension;
|
||||
double m_Red;
|
||||
double m_Green;
|
||||
double m_Blue;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CColorNewColorRampColorMapDialog)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CColorNewColorRampColorMapDialog)
|
||||
virtual void OnOK();
|
||||
afx_msg void OnColorMapRampBUTTONEditColor();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnChangeColorMapRampEDITColorRed();
|
||||
afx_msg void OnChangeColorMapRampEDITColorGreen();
|
||||
afx_msg void OnChangeColorMapRampEDITColorBlue();
|
||||
afx_msg void OnSelchangeColorMapCOMBONewEntryColorName();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_ColorNewColorRampColorMapDialog_H__A45F6973_DB41_11D1_8DE5_0800369C8A03__INCLUDED_)
|
521
samples/mfc/standard/08_HLR/src/SelectionDialog.cpp
Executable file
521
samples/mfc/standard/08_HLR/src/SelectionDialog.cpp
Executable file
@@ -0,0 +1,521 @@
|
||||
// SelectionDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "SelectionDialog.h"
|
||||
|
||||
#include "HLRApp.h"
|
||||
#include "OCC_2dView.h"
|
||||
#include <ISession2D/ISession2D_Shape.h>
|
||||
#include "Prs3d_Projector.hxx"
|
||||
|
||||
#ifdef _DEBUG
|
||||
//#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
// the key for shortcut ( use to activate dynamic rotation, panning )
|
||||
#define CASCADESHORTCUTKEY MK_CONTROL
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSelectionDialog dialog
|
||||
|
||||
CSelectionDialog::CSelectionDialog(CHLRDoc* aDoc,CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CSelectionDialog::IDD, pParent)
|
||||
{
|
||||
myDoc = aDoc;
|
||||
myDisplay = false;
|
||||
//{{AFX_DATA_INIT(CSelectionDialog)
|
||||
m_Algo = 0;
|
||||
m_DisplayMode = 0;
|
||||
m_NbIsos = 2;
|
||||
m_DrawHiddenLine = TRUE;
|
||||
m_DegeneratedModeOn = TRUE;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
void CSelectionDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CSelectionDialog)
|
||||
DDX_Radio(pDX, IDC_PolyAlgo, m_Algo);
|
||||
DDX_Radio(pDX, IDC_DisplayDefault, m_DisplayMode);
|
||||
DDX_Text(pDX, IDC_EDIT_NBIsos, m_NbIsos);
|
||||
DDX_Check(pDX, IDC_DrawHiddenLine, m_DrawHiddenLine);
|
||||
DDX_Check(pDX, IDC_DegeneratedMode, m_DegeneratedModeOn);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CSelectionDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(CSelectionDialog)
|
||||
ON_BN_CLICKED(ID_GetShape, OnGetShape)
|
||||
ON_BN_CLICKED(IDC_DisplayDefault, OnDisplayDefault)
|
||||
ON_BN_CLICKED(IDC_VIsoParametrics, OnVIsoParametrics)
|
||||
ON_BN_CLICKED(IDC_VApparentContour, OnVApparentContour)
|
||||
ON_BN_CLICKED(IDC_VSewingEdges, OnVSewingEdges)
|
||||
ON_BN_CLICKED(IDC_VsharpEdges, OnVsharpEdges)
|
||||
ON_BN_CLICKED(IDC_VsmoothEdges, OnVsmoothEdges)
|
||||
ON_BN_CLICKED(IDC_HsharpEdges, OnHsharpEdges)
|
||||
ON_BN_CLICKED(IDC_HsmoothEdges, OnHsmoothEdges)
|
||||
ON_BN_CLICKED(IDC_HSewingEdges, OnHSewingEdges)
|
||||
ON_BN_CLICKED(IDC_HIsoParametrics, OnHIsoParametrics)
|
||||
ON_BN_CLICKED(IDC_HApparentContour, OnHApparentContour)
|
||||
ON_EN_CHANGE(IDC_EDIT_NBIsos, OnChangeEDITNBIsos)
|
||||
ON_BN_CLICKED(IDC_Algo, OnAlgo)
|
||||
ON_BN_CLICKED(IDC_PolyAlgo, OnPolyAlgo)
|
||||
ON_BN_CLICKED(ID_Update2D, OnUpdate2D)
|
||||
ON_BN_CLICKED(IDC_TopView, OnTopView)
|
||||
ON_BN_CLICKED(IDC_BottomView, OnBottomView)
|
||||
ON_BN_CLICKED(IDC_LeftView, OnLeftView)
|
||||
ON_BN_CLICKED(IDC_RightView, OnRightView)
|
||||
ON_BN_CLICKED(IDC_FrontView, OnFrontView)
|
||||
ON_BN_CLICKED(IDC_BackView, OnBackView)
|
||||
ON_BN_CLICKED(IDC_AxoView, OnAxoView)
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_LBUTTONUP()
|
||||
ON_WM_RBUTTONDOWN()
|
||||
ON_WM_RBUTTONUP()
|
||||
ON_WM_MOUSEMOVE()
|
||||
ON_BN_CLICKED(IDC_DrawHiddenLine, OnDrawHiddenLine)
|
||||
ON_BN_CLICKED(IDC_DegeneratedMode, OnDegeneratedMode)
|
||||
ON_WM_DRAWITEM()
|
||||
ON_WM_PAINT()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSelectionDialog message handlers
|
||||
|
||||
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)) ;
|
||||
|
||||
// get the View Window position to managed mouse move
|
||||
CRect BoxRect,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);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnDisplay(bool isFit)
|
||||
{
|
||||
GetDlgItem(IDC_DUMMYBUTTON)->SetRedraw(true);
|
||||
if(!myDisplay) {
|
||||
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
|
||||
((CHLRApp*)AfxGetApp())->GetGraphicDevice();
|
||||
|
||||
myActiveViewer = new V3d_Viewer(theGraphicDevice,(short *) "Visu3D");
|
||||
myActiveViewer->SetDefaultLights();
|
||||
myActiveViewer->SetLightOn();
|
||||
myActiveView = myActiveViewer->CreateView();
|
||||
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window(theGraphicDevice,
|
||||
GetDlgItem(IDC_DUMMYBUTTON)->GetSafeHwnd(),
|
||||
Quantity_NOC_GRAY);
|
||||
|
||||
aWNTWindow->SetDoubleBuffer(Standard_False);
|
||||
|
||||
if (m_DegeneratedModeOn) myActiveView->SetDegenerateModeOn();
|
||||
myActiveView->SetWindow(aWNTWindow);
|
||||
|
||||
myInteractiveContext = new AIS_InteractiveContext(myActiveViewer);
|
||||
|
||||
// TRIHEDRON
|
||||
Handle(Geom_Axis2Placement) aTrihedronAxis=new Geom_Axis2Placement(gp::XOY());
|
||||
myTrihedron=new AIS_Trihedron(aTrihedronAxis);
|
||||
|
||||
myInteractiveContext->Display(myTrihedron);
|
||||
}
|
||||
if(isFit) {
|
||||
myActiveView->ZFitAll();
|
||||
myActiveView->FitAll();
|
||||
}
|
||||
myActiveView->Redraw();
|
||||
myDisplay = Standard_True;
|
||||
GetDlgItem(IDC_DUMMYBUTTON)->SetRedraw(false);
|
||||
}
|
||||
|
||||
|
||||
void CSelectionDialog::SetTitle(CString & aTitle)
|
||||
{
|
||||
SetWindowText(aTitle);
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnGetShape()
|
||||
{
|
||||
UpdateData(true);
|
||||
myDoc->GetInteractiveContext2D()->EraseAll();
|
||||
myDisplayableShape = new ISession2D_Shape( );
|
||||
UpdateProjector();
|
||||
myDisplayableShape->SetNbIsos(m_NbIsos);
|
||||
|
||||
myInteractiveContext->EraseAll(Standard_False);
|
||||
myInteractiveContext->Display(myTrihedron);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer DisplayMode = m_DisplayMode;
|
||||
if (m_Algo == 1) DisplayMode+=100;
|
||||
if (!m_DrawHiddenLine) DisplayMode+=1000;
|
||||
|
||||
myDoc->GetInteractiveContext2D()->Display(myDisplayableShape, // object
|
||||
DisplayMode, // display mode
|
||||
DisplayMode, // selection mode
|
||||
Standard_True); // Redraw
|
||||
|
||||
myDoc->FitAll2DViews(Standard_False); // Update Viewer
|
||||
|
||||
|
||||
// check the selection :
|
||||
// if no object : disable all possiblity!!
|
||||
ShowHideButton(OneOrMoreFound);
|
||||
OnDisplay(true);
|
||||
}
|
||||
|
||||
void CSelectionDialog::Apply()
|
||||
{
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
|
||||
myDoc->GetInteractiveContext2D()->EraseAll(Standard_False);
|
||||
UpdateData(true);
|
||||
|
||||
Standard_Integer DisplayMode = m_DisplayMode;
|
||||
if (m_Algo == 1) DisplayMode+=100;
|
||||
|
||||
if (!m_DrawHiddenLine) DisplayMode+=1000;
|
||||
|
||||
myDoc->GetInteractiveContext2D()->Display(myDisplayableShape, // object
|
||||
DisplayMode,
|
||||
DisplayMode,
|
||||
Standard_True); // Redraw
|
||||
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
|
||||
}
|
||||
|
||||
void CSelectionDialog::UpdateProjector()
|
||||
{
|
||||
V3d_Coordinate DX,DY,DZ,XAt,YAt,ZAt, Vx,Vy,Vz ;
|
||||
myActiveView->Proj(DX,DY,DZ);
|
||||
myActiveView->At(XAt,YAt,ZAt);
|
||||
myActiveView->Up( Vx,Vy,Vz );
|
||||
OnDisplay(false);
|
||||
Standard_Boolean IsPerspective = (myActiveView->Type() == V3d_PERSPECTIVE);
|
||||
Quantity_Length aFocus = 1;
|
||||
Prs3d_Projector aPrs3dProjector(IsPerspective,aFocus,DX,DY,DZ,XAt,YAt,ZAt,Vx,Vy,Vz);
|
||||
HLRAlgo_Projector aProjector = aPrs3dProjector.Projector();
|
||||
|
||||
if (myDisplayableShape.IsNull()) return;
|
||||
myDisplayableShape->SetProjector(aProjector);
|
||||
}
|
||||
|
||||
void CSelectionDialog::ShowHideButton(Standard_Boolean EnableButton)
|
||||
{
|
||||
UpdateData(true);
|
||||
|
||||
GetDlgItem(ID_Update2D )->EnableWindow(EnableButton);
|
||||
GetDlgItem(IDC_DisplayDefault )->EnableWindow(EnableButton);
|
||||
GetDlgItem(IDC_PolyAlgo )->EnableWindow(EnableButton);
|
||||
GetDlgItem(IDC_Algo )->EnableWindow(EnableButton);
|
||||
|
||||
GetDlgItem(IDC_VsharpEdges )->EnableWindow(EnableButton);
|
||||
GetDlgItem(IDC_VsmoothEdges )->EnableWindow(EnableButton);
|
||||
GetDlgItem(IDC_VSewingEdges )->EnableWindow(EnableButton);
|
||||
GetDlgItem(IDC_VApparentContour )->EnableWindow(EnableButton);
|
||||
GetDlgItem(IDC_VIsoParametrics )->EnableWindow(EnableButton);
|
||||
|
||||
GetDlgItem(IDC_DrawHiddenLine )->EnableWindow(EnableButton);
|
||||
|
||||
GetDlgItem(IDC_HsmoothEdges )->EnableWindow(EnableButton && m_DrawHiddenLine);
|
||||
GetDlgItem(IDC_HSewingEdges )->EnableWindow(EnableButton && m_DrawHiddenLine);
|
||||
GetDlgItem(IDC_HApparentContour )->EnableWindow(EnableButton && m_DrawHiddenLine);
|
||||
GetDlgItem(IDC_HsharpEdges )->EnableWindow(EnableButton && m_DrawHiddenLine);
|
||||
GetDlgItem(IDC_HIsoParametrics )->EnableWindow(EnableButton && m_DrawHiddenLine);
|
||||
|
||||
GetDlgItem(IDC_EDIT_NBIsos )->EnableWindow(EnableButton);
|
||||
GetDlgItem(IDC_STATIC_NbIsos )->EnableWindow(EnableButton);
|
||||
|
||||
if(m_Algo == 0)
|
||||
{
|
||||
if (m_DisplayMode == 5) m_DisplayMode=0;
|
||||
if (m_DisplayMode == 10) m_DisplayMode=0;
|
||||
|
||||
GetDlgItem(IDC_VIsoParametrics)->EnableWindow(false);
|
||||
GetDlgItem(IDC_HIsoParametrics)->EnableWindow(false);
|
||||
GetDlgItem(IDC_STATIC_NbIsos) ->EnableWindow(false);
|
||||
GetDlgItem(IDC_EDIT_NBIsos) ->EnableWindow(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetDlgItem(IDC_VIsoParametrics)->EnableWindow(true);
|
||||
GetDlgItem(IDC_HIsoParametrics)->EnableWindow(m_DrawHiddenLine);
|
||||
GetDlgItem(IDC_STATIC_NbIsos) ->EnableWindow(true);
|
||||
GetDlgItem(IDC_EDIT_NBIsos) ->EnableWindow(true);
|
||||
}
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnDisplayDefault()
|
||||
{ Apply(); }
|
||||
void CSelectionDialog::OnVIsoParametrics()
|
||||
{ Apply(); }
|
||||
void CSelectionDialog::OnVApparentContour()
|
||||
{ Apply(); }
|
||||
void CSelectionDialog::OnVSewingEdges()
|
||||
{ Apply(); }
|
||||
void CSelectionDialog::OnVsharpEdges()
|
||||
{ Apply(); }
|
||||
void CSelectionDialog::OnVsmoothEdges()
|
||||
{ Apply(); }
|
||||
void CSelectionDialog::OnHsharpEdges()
|
||||
{ Apply(); }
|
||||
void CSelectionDialog::OnHsmoothEdges()
|
||||
{ Apply(); }
|
||||
void CSelectionDialog::OnHSewingEdges()
|
||||
{ Apply(); }
|
||||
void CSelectionDialog::OnHIsoParametrics()
|
||||
{ Apply(); }
|
||||
void CSelectionDialog::OnHApparentContour()
|
||||
{ Apply(); }
|
||||
|
||||
void CSelectionDialog::OnChangeEDITNBIsos()
|
||||
{
|
||||
UpdateData(true);
|
||||
myDisplayableShape->SetNbIsos(m_NbIsos);
|
||||
Apply();
|
||||
}
|
||||
void CSelectionDialog::OnAlgo()
|
||||
{ ShowHideButton();
|
||||
Apply();
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnPolyAlgo()
|
||||
{ ShowHideButton();
|
||||
Apply();
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnDrawHiddenLine()
|
||||
{
|
||||
UpdateData(true);
|
||||
if (m_DisplayMode >=6 )
|
||||
{ m_DisplayMode=0;
|
||||
UpdateData(false); }
|
||||
ShowHideButton();
|
||||
Apply();
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnUpdate2D()
|
||||
{
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
|
||||
myDoc->ActivateFrame(RUNTIME_CLASS(OCC_2dView),SW_NORMAL);
|
||||
UpdateProjector();
|
||||
Apply();
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnTopView()
|
||||
{
|
||||
myActiveView->SetProj(V3d_Zpos);
|
||||
OnDisplay(true);
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnBottomView()
|
||||
{
|
||||
myActiveView->SetProj(V3d_Zneg);
|
||||
OnDisplay(true);
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnLeftView()
|
||||
{
|
||||
myActiveView->SetProj(V3d_Ypos);
|
||||
OnDisplay(true);
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnRightView()
|
||||
{
|
||||
myActiveView->SetProj(V3d_Yneg);
|
||||
OnDisplay(true);
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnFrontView()
|
||||
{
|
||||
myActiveView->SetProj(V3d_Xpos);
|
||||
OnDisplay(true);
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnBackView()
|
||||
{
|
||||
myActiveView->SetProj(V3d_Xneg);
|
||||
OnDisplay(true);
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnAxoView()
|
||||
{
|
||||
myActiveView->SetProj(V3d_XposYnegZpos);
|
||||
OnDisplay(true);
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnDegeneratedMode()
|
||||
{
|
||||
UpdateData(true);
|
||||
|
||||
if(m_DegeneratedModeOn)
|
||||
{
|
||||
myActiveView->SetDegenerateModeOn();
|
||||
m_DegeneratedModeOn = Standard_True;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
|
||||
myActiveView->SetDegenerateModeOff();
|
||||
m_DegeneratedModeOn = Standard_False;
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
|
||||
}
|
||||
OnDisplay(false);
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnLButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
CDialog::OnLButtonDown(nFlags, point);
|
||||
|
||||
if ((myPosMinX > point.x)||(myPosMaxX < point.x) ||
|
||||
(myPosMinY > point.y) ||(myPosMaxY < point.y))
|
||||
return;
|
||||
|
||||
// save the current mouse coordinate
|
||||
myXmax=point.x; myYmax=point.y;
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnLButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
CDialog::OnLButtonUp(nFlags, point);
|
||||
|
||||
if ((myPosMinX > point.x)||(myPosMaxX < point.x) ||
|
||||
(myPosMinY > point.y) ||(myPosMaxY < point.y))
|
||||
return;
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnRButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
CDialog::OnRButtonDown(nFlags, point);
|
||||
|
||||
if ((myPosMinX > point.x)||(myPosMaxX < point.x) ||
|
||||
(myPosMinY > point.y) ||(myPosMaxY < point.y))
|
||||
return;
|
||||
|
||||
if ( nFlags & CASCADESHORTCUTKEY )
|
||||
{
|
||||
if (!m_DegeneratedModeOn)
|
||||
myActiveView->SetDegenerateModeOn();
|
||||
myActiveView->StartRotation(point.x,point.y);
|
||||
OnDisplay(false);
|
||||
}
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnRButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
CDialog::OnRButtonUp(nFlags, point);
|
||||
|
||||
if ((myPosMinX > point.x)||(myPosMaxX < point.x) ||
|
||||
(myPosMinY > point.y) ||(myPosMaxY < point.y))
|
||||
return;
|
||||
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
|
||||
// reset tyhe good Degenerated mode according to the strored one
|
||||
// --> dynamic rotation may have change it
|
||||
if (!m_DegeneratedModeOn)
|
||||
myActiveView->SetDegenerateModeOff();
|
||||
else
|
||||
myActiveView->SetDegenerateModeOn();
|
||||
OnDisplay(false);
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
CDialog::OnMouseMove(nFlags, point);
|
||||
|
||||
if ((myPosMinX > point.x)||(myPosMaxX < point.x) ||
|
||||
(myPosMinY > point.y) ||(myPosMaxY < point.y))
|
||||
return;
|
||||
|
||||
// ============================ LEFT BUTTON =======================
|
||||
if ( nFlags & MK_LBUTTON)
|
||||
{
|
||||
if ( nFlags & CASCADESHORTCUTKEY )
|
||||
{
|
||||
// move with MB1 and Control : on the dynamic zooming
|
||||
// Do the zoom in function of mouse's coordinates
|
||||
myActiveView->Zoom(myXmax,myYmax,point.x,point.y);
|
||||
// save the current mouse coordinate
|
||||
myXmax = point.x; myYmax = point.y;
|
||||
}// if ( nFlags & CASCADESHORTCUTKEY ) else
|
||||
} else // if ( nFlags & MK_LBUTTON)
|
||||
// ============================ MIDDLE BUTTON =======================
|
||||
if ( nFlags & MK_MBUTTON)
|
||||
{
|
||||
if ( nFlags & CASCADESHORTCUTKEY )
|
||||
{
|
||||
myActiveView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
|
||||
myXmax = point.x; myYmax = point.y;
|
||||
}
|
||||
} else // if ( nFlags & MK_MBUTTON)
|
||||
// ============================ RIGHT BUTTON =======================
|
||||
if ( nFlags & MK_RBUTTON)
|
||||
{
|
||||
if ( nFlags & CASCADESHORTCUTKEY )
|
||||
{
|
||||
myActiveView->Rotation(point.x,point.y);
|
||||
}
|
||||
} else //if ( nFlags & MK_RBUTTON)
|
||||
// ============================ NO BUTTON =======================
|
||||
{ // No buttons
|
||||
myXmax = point.x; myYmax = point.y;
|
||||
}
|
||||
OnDisplay(false);
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnOK()
|
||||
{
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void CSelectionDialog::OnPaint()
|
||||
{
|
||||
CPaintDC dc(this); // device context for painting
|
||||
|
||||
OnDisplay(false);
|
||||
}
|
113
samples/mfc/standard/08_HLR/src/SelectionDialog.h
Executable file
113
samples/mfc/standard/08_HLR/src/SelectionDialog.h
Executable file
@@ -0,0 +1,113 @@
|
||||
#if !defined(AFX_SelectionDialog_H__0307BDF3_AF53_11D1_8DAE_0800369C8A03__INCLUDED_)
|
||||
#define AFX_SelectionDialog_H__0307BDF3_AF53_11D1_8DAE_0800369C8A03__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// SelectionDialog.h : header file
|
||||
//
|
||||
#include "resource.h"
|
||||
#include <ISession2D/ISession2D_Shape.h>
|
||||
#include "SelectionDialog.h"
|
||||
|
||||
class CHLRDoc;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSelectionDialog dialog
|
||||
|
||||
class CSelectionDialog : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
void SetTitle(CString& aTitle);
|
||||
CSelectionDialog(CHLRDoc* aDoc,CWnd* pParent = NULL); // standard constructor
|
||||
void OnDisplay(bool isfit);
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CSelectionDialog)
|
||||
enum { IDD = IDD_SelectionDialog };
|
||||
int m_Algo;
|
||||
int m_DisplayMode;
|
||||
int m_NbIsos;
|
||||
BOOL m_DrawHiddenLine;
|
||||
BOOL m_DegeneratedModeOn;
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CSelectionDialog)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CSelectionDialog)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnGetShape();
|
||||
afx_msg void OnDisplayDefault();
|
||||
afx_msg void OnVIsoParametrics();
|
||||
afx_msg void OnVApparentContour();
|
||||
afx_msg void OnVSewingEdges();
|
||||
afx_msg void OnVsharpEdges();
|
||||
afx_msg void OnVsmoothEdges();
|
||||
afx_msg void OnHsharpEdges();
|
||||
afx_msg void OnHsmoothEdges();
|
||||
afx_msg void OnHSewingEdges();
|
||||
afx_msg void OnHIsoParametrics();
|
||||
afx_msg void OnHApparentContour();
|
||||
afx_msg void OnChangeEDITNBIsos();
|
||||
afx_msg void OnAlgo();
|
||||
afx_msg void OnPolyAlgo();
|
||||
afx_msg void OnUpdate2D();
|
||||
afx_msg void OnTopView();
|
||||
afx_msg void OnBottomView();
|
||||
afx_msg void OnLeftView();
|
||||
afx_msg void OnRightView();
|
||||
afx_msg void OnFrontView();
|
||||
afx_msg void OnBackView();
|
||||
afx_msg void OnAxoView();
|
||||
virtual void OnOK();
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnDrawHiddenLine();
|
||||
afx_msg void OnDegeneratedMode();
|
||||
afx_msg void OnPaint();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
private :
|
||||
void UpdateProjector();
|
||||
void ShowHideButton(Standard_Boolean EnableButton=Standard_True;);
|
||||
void Apply();
|
||||
CHLRDoc* myDoc;
|
||||
|
||||
Handle(V3d_Viewer) myActiveViewer ;
|
||||
Handle(V3d_View) myActiveView;
|
||||
Standard_Integer myPosMaxX, myPosMinX ,myBoxX;
|
||||
Standard_Integer myPosMinY, myPosMaxY ,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;
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_SelectionDialog_H__0307BDF3_AF53_11D1_8DAE_0800369C8A03__INCLUDED_)
|
6
samples/mfc/standard/08_HLR/src/StdAfx.cpp
Executable file
6
samples/mfc/standard/08_HLR/src/StdAfx.cpp
Executable file
@@ -0,0 +1,6 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// SampleHLR.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
263
samples/mfc/standard/08_HLR/src/StdAfx.h
Executable file
263
samples/mfc/standard/08_HLR/src/StdAfx.h
Executable file
@@ -0,0 +1,263 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#if !defined(AFX_STDAFX_H__376C7006_0B3D_11D2_8E0A_0800369C8A03__INCLUDED_)
|
||||
#define AFX_STDAFX_H__376C7006_0B3D_11D2_8E0A_0800369C8A03__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
#include <afxdisp.h> // MFC OLE automation classes
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
|
||||
|
||||
// CasCade :
|
||||
|
||||
#if !defined(WNT)
|
||||
#error WNT precompiler directive is mandatory for CasCade
|
||||
#endif
|
||||
#if !defined(CSFDB)
|
||||
#error CSFDB precompiler directive is mandatory for CasCade
|
||||
#endif
|
||||
|
||||
#define DEFAULT_DEVIATIONCOEFFICIENT 0.001
|
||||
#define DEFAULT_DCBIG 0.005
|
||||
#define DEFAULT_DCVBIG 0.01
|
||||
#define DEFAULT_DCSMALL 0.0002
|
||||
#define DEFAULT_DCVSMALL 0.00004
|
||||
#define DEFAULT_COLOR Quantity_NOC_CYAN1
|
||||
#define DEFAULT_MATERIAL Graphic3d_NOM_PLASTER
|
||||
#define DEFAULT_BACKGROUNDCOLOR Quantity_NOC_MATRAGRAY
|
||||
#define DEFAULT_HILIGHTCOLOR Quantity_NOC_YELLOW
|
||||
|
||||
#pragma warning( disable : 4244 ) // Issue warning 4244
|
||||
#include <Standard_ShortReal.hxx>
|
||||
#pragma warning( default : 4244 ) // Issue warning 4244
|
||||
|
||||
#include <Standard.hxx>
|
||||
/*
|
||||
#ifndef Version15B
|
||||
# ifndef Version15D
|
||||
# ifndef Version20
|
||||
# define Version15B
|
||||
# endif // Version20
|
||||
# endif // Version15D
|
||||
#endif // Version15B
|
||||
|
||||
#pragma message ("=============================")
|
||||
#ifdef Version15B
|
||||
# pragma message ("Set the libs for version 1.5B")
|
||||
#endif // Version15B
|
||||
|
||||
#ifdef Version15D
|
||||
# pragma message ("Set the libs for version 1.5D")
|
||||
#endif // Version15D
|
||||
|
||||
#ifdef Version20
|
||||
# pragma message ("Set the libs for version 2.0 ")
|
||||
#endif // Version20
|
||||
#pragma message ("=============================")
|
||||
|
||||
#ifdef Version15B
|
||||
# pragma comment (lib,"TKTop.lib")
|
||||
# pragma comment (lib,"TShort.lib")
|
||||
# pragma comment (lib,"TColQuantity.lib")
|
||||
#endif
|
||||
|
||||
#ifdef Version15D
|
||||
# pragma comment (lib,"TKTop.lib")
|
||||
#endif
|
||||
|
||||
#ifdef Version20
|
||||
# pragma comment (lib,"TKTop1.lib")
|
||||
# pragma comment (lib,"TKTop2.lib")
|
||||
#endif
|
||||
|
||||
#pragma message ("Set the specific libs for the application")
|
||||
# pragma comment (lib,"TKPrs.lib")
|
||||
# pragma comment (lib,"TKGeom.lib")
|
||||
# pragma comment (lib,"TKGlt.lib")
|
||||
# pragma comment (lib,"TKGraphic.lib")
|
||||
# pragma comment (lib,"TKPrsMgr.lib")
|
||||
# pragma comment (lib,"TKViewers.lib")
|
||||
# pragma comment (lib,"TKSession.lib")
|
||||
# pragma comment (lib,"gp.lib")
|
||||
# pragma comment (lib,"TKernel.lib")
|
||||
# pragma comment (lib,"UnitsAPI.lib")
|
||||
# pragma comment (lib,"PTColStd.lib")
|
||||
# pragma comment (lib,"TKMgtShape.lib")
|
||||
# pragma comment (lib,"TKPShape.lib")
|
||||
# pragma comment (lib,"ShapeSchema.lib")
|
||||
# pragma comment (lib,"FSD.lib")
|
||||
# pragma comment (lib,"OSDriver.lib")
|
||||
# pragma comment (lib,"ObjMgt.lib")
|
||||
# pragma comment (lib,"TKXSBase.lib")
|
||||
# pragma comment (lib,"TKXSIGES.lib")
|
||||
# pragma comment (lib,"TKXS214.lib")
|
||||
*/
|
||||
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <AIS_Trihedron.hxx>
|
||||
|
||||
#include <Aspect_Background.hxx>
|
||||
#include <Aspect_TypeOfline.hxx>
|
||||
#include <Aspect_TypeOfText.hxx>
|
||||
#include <Aspect_WidthOfline.hxx>
|
||||
#include <Aspect_Window.hxx>
|
||||
#include <Bnd_Box2d.hxx>
|
||||
#include <BndLib_Add2dCurve.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepBuilderAPI.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
#include <DsgPrs_LengthPresentation.hxx>
|
||||
#include <GCE2d_MakeSegment.hxx>
|
||||
#include <GCPnts_TangentialDeflection.hxx>
|
||||
#include <Geom_CartesianPoint.hxx>
|
||||
#include <Geom_Axis2Placement.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomTools_Curve2dSet.hxx>
|
||||
#include <gp_Ax2d.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <Graphic2d_Array1OfVertex.hxx>
|
||||
#include <Graphic2d_Buffer.hxx>
|
||||
#include <Graphic2d_CircleMarker.hxx>
|
||||
#include <Graphic2d_DisplayList.hxx>
|
||||
#include <Graphic2d_Drawer.hxx>
|
||||
#include <Graphic2d_PolyLine.hxx>
|
||||
#include <Graphic2d_Segment.hxx>
|
||||
#include <Graphic2d_SetOfCurves.hxx>
|
||||
#include <Graphic2d_SetOfSegments.hxx>
|
||||
#include <Graphic2d_Text.hxx>
|
||||
#include <Graphic2d_Vertex.hxx>
|
||||
#include <Graphic2d_View.hxx>
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <PrsMgr_PresentationManager2d.hxx>
|
||||
#include <Quantity_Factor.hxx>
|
||||
#include <Quantity_Length.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
#include <Quantity_PhysicalQuantity.hxx>
|
||||
#include <Quantity_PlaneAngle.hxx>
|
||||
#include <Quantity_TypeOfColor.hxx>
|
||||
#include <Select2D_SensitiveArc.hxx>
|
||||
#include <Select2D_SensitiveBox.hxx>
|
||||
#include <Select2D_SensitiveEntity.hxx>
|
||||
#include <Select2D_SensitiveSegment.hxx>
|
||||
#include <SelectBasics_BasicTool.hxx>
|
||||
#include <SelectBasics_ListOfBox2d.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_SelectableObject.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <SelectMgr_SelectionManager.hxx>
|
||||
|
||||
// for opencasdade
|
||||
|
||||
//#include <Session_Selection.hxx>
|
||||
//#include <Session_Session.hxx>
|
||||
//#include <ShapeSchema.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_IStream.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <StdPrs_Curve.hxx>
|
||||
#include <StdPrs_Point.hxx>
|
||||
#include <StdPrs_PoleCurve.hxx>
|
||||
#include <StdSelect_SensitiveText2d.hxx>
|
||||
#include <StdSelect_TextProjector2d.hxx>
|
||||
#include <StdSelect_ViewerSelector2d.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColgp_HArray1OfPnt2d.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <TColStd_MapIteratorOfMapOfTransient.hxx>
|
||||
#include <TColStd_MapOfTransient.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopTools_HSequenceOfShape.hxx>
|
||||
#include <UnitsAPI.hxx>
|
||||
#include <V2d_View.hxx>
|
||||
#include <V2d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <WNT_WDriver.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
|
||||
#include <HLRAlgo_Projector.hxx>
|
||||
#include <Aspect_MarkMap.hxx>
|
||||
// specific to ISession2D_Shape
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <HLRAlgo_Projector.hxx>
|
||||
#include <HLRBRep_Algo.hxx>
|
||||
#include <HLRBRep_PolyAlgo.hxx>
|
||||
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <HLRBRep_PolyHLRToShape.hxx>
|
||||
#include <HLRBRep_HLRToShape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <Aspect_GenericColorMap.hxx>
|
||||
#include <Aspect_ColorMapEntry.hxx>
|
||||
#include <Aspect_WidthMapEntry.hxx>
|
||||
#include <Aspect_TypeMapEntry.hxx>
|
||||
#include <Aspect_LineStyle.hxx>
|
||||
#include <Aspect_TypeMap.hxx>
|
||||
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||
|
||||
#include <Aspect_ColorMapEntry.hxx>
|
||||
#include <Aspect_GenericColorMap.hxx>
|
||||
|
||||
#include "..\res\resource.h"
|
||||
|
||||
//End CasCade
|
||||
|
||||
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__376C7006_0B3D_11D2_8E0A_0800369C8A03__INCLUDED_)
|
Reference in New Issue
Block a user