1 // AISDialogs.cpp : implementation file
6 #include "AISDialogs.h"
8 #define DEFAULT_DEVIATIONCOEFFICIENT 0.001
9 #define DEFAULT_DCBIG 0.005
10 #define DEFAULT_DCVBIG 0.01
11 #define DEFAULT_DCSMALL 0.0002
12 #define DEFAULT_DCVSMALL 0.00004
13 #define DEFAULT_COLOR Quantity_NOC_CYAN1
14 #define DEFAULT_MATERIAL Graphic3d_NOM_PLASTER
15 #define DEFAULT_BACKGROUNDCOLOR Quantity_NOC_MATRAGRAY
16 #define DEFAULT_HILIGHTCOLOR Quantity_NOC_YELLOW
19 /////////////////////////////////////////////////////////////////////////////
20 // CAISNbrIsosDialog dialog
22 //CAISNbrIsosDialog::CAISNbrIsosDialog(Handle(AIS_InteractiveContext) CurrentIC,
23 // CWnd* pParent /*=NULL*/)
24 // : CDialog(CAISNbrIsosDialog::IDD, pParent)
27 //{{AFX_DATA_INIT(CAISNbrIsosDialog)
32 myCurrentIC = CurrentIC;
33 Handle (Prs3d_Drawer) ICDrawer = myCurrentIC->DefaultDrawer();
34 m_Isosu = ICDrawer->UIsoAspect()->Number();
35 m_Isosv = ICDrawer->VIsoAspect()->Number();
40 void CAISNbrIsosDialog::DoDataExchange(CDataExchange* pDX)
42 CDialog::DoDataExchange(pDX);
43 //{{AFX_DATA_MAP(CAISNbrIsosDialog)
44 DDX_Text(pDX, IDC_EDITAISISOSU, m_Isosu);
45 DDX_Text(pDX, IDC_EDITAISISOSV, m_Isosv);
50 BEGIN_MESSAGE_MAP(CAISNbrIsosDialog, CDialog)
51 //{{AFX_MSG_MAP(CAISNbrIsosDialog)
52 ON_NOTIFY(UDN_DELTAPOS, IDC_SPINAISISOSU, OnDeltaposSpinaisisosu)
53 ON_NOTIFY(UDN_DELTAPOS, IDC_SPINAISISOSV, OnDeltaposSpinaisisosv)
57 /////////////////////////////////////////////////////////////////////////////
58 // CAISNbrIsosDialog message handlers
60 void CAISNbrIsosDialog::OnDeltaposSpinaisisosu(NMHDR* pNMHDR, LRESULT* pResult)
62 NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
63 // TODO: Add your control notification handler code here
65 if ((pNMUpDown->iDelta < 0))
66 m_Isosu = m_Isosu + 1;
67 if ((pNMUpDown->iDelta > 0) && (m_Isosu > 0))
68 m_Isosu = m_Isosu - 1;
75 void CAISNbrIsosDialog::OnDeltaposSpinaisisosv(NMHDR* pNMHDR, LRESULT* pResult)
77 NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
78 // TODO: Add your control notification handler code here
80 if ((pNMUpDown->iDelta < 0))
81 m_Isosv = m_Isosv + 1;
82 if ((pNMUpDown->iDelta > 0) && (m_Isosu > 0))
83 m_Isosv = m_Isosv - 1;
91 #include <AIS_InteractiveObject.hxx>
92 #include <Prs3d_Drawer.hxx>
94 void CAISNbrIsosDialog::UpdateIsos ()
98 for (myCurrentIC->InitCurrent();
99 myCurrentIC->MoreCurrent ();
100 myCurrentIC->NextSelected ())
102 Handle(AIS_InteractiveObject) CurObject;
103 Handle(Prs3d_Drawer) CurDrawer;
106 CurObject = myCurrentIC->Current();
107 CurDrawer = CurObject->Attributes();
109 CurDrawer->UIsoAspect()->SetNumber(m_Isosu);
110 CurDrawer->VIsoAspect()->SetNumber(m_Isosv);
112 myCurrentIC->SetLocalAttributes(CurObject, CurDrawer);
114 myCurrentIC->Redisplay(CurObject);
119 /////////////////////////////////////////////////////////////////////////////
120 // CDevCoeffDialog dialog
123 //CDevCoeffDialog::CDevCoeffDialog(Handle(AIS_InteractiveContext) CurrentIC,
124 // CWnd* pParent /*=NULL*/)
125 // : CDialog(CDevCoeffDialog::IDD, pParent)
128 //{{AFX_DATA_INIT(CDevCoeffDialog)
129 // NOTE: the ClassWizard will add member initialization here
131 myCurrentIC = CurrentIC;
135 void CDevCoeffDialog::DoDataExchange(CDataExchange* pDX)
137 CDialog::DoDataExchange(pDX);
138 //{{AFX_DATA_MAP(CDevCoeffDialog)
139 // NOTE: the ClassWizard will add DDX and DDV calls here
144 BEGIN_MESSAGE_MAP(CDevCoeffDialog, CDialog)
145 //{{AFX_MSG_MAP(CDevCoeffDialog)
146 ON_BN_CLICKED(IDC_DC_BIG, OnDcBig)
147 ON_BN_CLICKED(IDC_DC_DEFAULT, OnDcDefault)
148 ON_BN_CLICKED(IDC_DC_SMALL, OnDcSmall)
149 ON_BN_DOUBLECLICKED(IDC_DC_BIG, OnDoubleclickedDcBig)
150 ON_BN_DOUBLECLICKED(IDC_DC_DEFAULT, OnDoubleclickedDcDefault)
151 ON_BN_DOUBLECLICKED(IDC_DC_SMALL, OnDoubleclickedDcSmall)
152 ON_BN_CLICKED(IDC_DC_VBIG, OnDcVbig)
153 ON_BN_DOUBLECLICKED(IDC_DC_VBIG, OnDoubleclickedDcVbig)
154 ON_BN_CLICKED(IDC_DC_VSMALL, OnDcVsmall)
155 ON_BN_DOUBLECLICKED(IDC_DC_VSMALL, OnDoubleclickedDcVsmall)
159 /////////////////////////////////////////////////////////////////////////////
160 // CDevCoeffDialog message handlers
164 void CDevCoeffDialog::OnDcDefault()
166 // TODO: Add your control notification handler code here
167 myCurrentIC->SetDeviationCoefficient (DEFAULT_DEVIATIONCOEFFICIENT);
170 void CDevCoeffDialog::OnDcSmall()
172 // TODO: Add your control notification handler code here
173 myCurrentIC->SetDeviationCoefficient (DEFAULT_DCSMALL);
176 void CDevCoeffDialog::OnDcVsmall()
178 // TODO: Add your control notification handler code here
179 myCurrentIC->SetDeviationCoefficient (DEFAULT_DCVSMALL);
183 void CDevCoeffDialog::OnDcBig()
185 // TODO: Add your control notification handler code here
186 myCurrentIC->SetDeviationCoefficient (DEFAULT_DCBIG);
189 void CDevCoeffDialog::OnDcVbig()
191 // TODO: Add your control notification handler code here
192 myCurrentIC->SetDeviationCoefficient (DEFAULT_DCVBIG);
197 void CDevCoeffDialog::OnDoubleclickedDcDefault()
199 // TODO: Add your control notification handler code here
200 myCurrentIC->SetDeviationCoefficient (DEFAULT_DEVIATIONCOEFFICIENT);
204 void CDevCoeffDialog::OnDoubleclickedDcSmall()
206 // TODO: Add your control notification handler code here
207 myCurrentIC->SetDeviationCoefficient (DEFAULT_DCSMALL);
211 void CDevCoeffDialog::OnDoubleclickedDcVsmall()
213 // TODO: Add your control notification handler code here
214 myCurrentIC->SetDeviationCoefficient (DEFAULT_DCVSMALL);
218 void CDevCoeffDialog::OnDoubleclickedDcBig()
220 // TODO: Add your control notification handler code here
221 myCurrentIC->SetDeviationCoefficient (DEFAULT_DCBIG);
225 void CDevCoeffDialog::OnDoubleclickedDcVbig()
227 // TODO: Add your control notification handler code here
228 myCurrentIC->SetDeviationCoefficient (DEFAULT_DCVBIG);
234 void CDevCoeffDialog::RedisplaySelected ()
236 for (myCurrentIC->InitCurrent();
237 myCurrentIC->MoreCurrent ();
238 myCurrentIC->NextSelected ())
240 myCurrentIC->Redisplay(myCurrentIC->Current());
246 /////////////////////////////////////////////////////////////////////////////
247 // CDialogMaterial dialog
250 CDialogMaterial::CDialogMaterial(Handle(AIS_InteractiveContext) CurrentIC,
251 CWnd* pParent /*=NULL*/)
252 : CDialog(CDialogMaterial::IDD, pParent)
254 //{{AFX_DATA_INIT(CDialogMaterial)
255 // NOTE: the ClassWizard will add member initialization here
257 myCurrentIC = CurrentIC;
259 for (myCurrentIC->InitCurrent();myCurrentIC->MoreCurrent ();myCurrentIC->NextCurrent ()){
260 for(int i = ID_OBJECT_MATERIAL_BRASS; i <= ID_OBJECT_MATERIAL_DEFAULT; i++){
261 if (myCurrentIC->Current()->Material() - (i - ID_OBJECT_MATERIAL_BRASS) == 0)
262 //GotoDlgCtrl(GetDlgItem(i));
270 void CDialogMaterial::DoDataExchange(CDataExchange* pDX)
272 CDialog::DoDataExchange(pDX);
273 //{{AFX_DATA_MAP(CDialogMaterial)
274 // NOTE: the ClassWizard will add DDX and DDV calls here
279 BEGIN_MESSAGE_MAP(CDialogMaterial, CDialog)
280 //{{AFX_MSG_MAP(CDialogMaterial)
281 ON_BN_CLICKED(ID_OBJECT_MATERIAL_ALUMINIUM, OnObjectMaterialAluminium)
282 ON_BN_CLICKED(ID_OBJECT_MATERIAL_BRASS, OnObjectMaterialBrass)
283 ON_BN_CLICKED(ID_OBJECT_MATERIAL_BRONZE, OnObjectMaterialBronze)
284 ON_BN_CLICKED(ID_OBJECT_MATERIAL_CHROME, OnObjectMaterialChrome)
285 ON_BN_CLICKED(ID_OBJECT_MATERIAL_COPPER, OnObjectMaterialCopper)
286 ON_BN_CLICKED(ID_OBJECT_MATERIAL_GOLD, OnObjectMaterialGold)
287 ON_BN_CLICKED(ID_OBJECT_MATERIAL_JADE, OnObjectMaterialJade)
288 ON_BN_CLICKED(ID_OBJECT_MATERIAL_METALIZED, OnObjectMaterialMetalized)
289 ON_BN_CLICKED(ID_OBJECT_MATERIAL_NEON_GNC, OnObjectMaterialNeonGNC)
290 ON_BN_CLICKED(ID_OBJECT_MATERIAL_NEON_PHC, OnObjectMaterialNeonPHC)
291 ON_BN_CLICKED(ID_OBJECT_MATERIAL_OBSIDIAN, OnObjectMaterialObsidian)
292 ON_BN_CLICKED(ID_OBJECT_MATERIAL_PEWTER, OnObjectMaterialPewter)
293 ON_BN_CLICKED(ID_OBJECT_MATERIAL_PLASTER, OnObjectMaterialPlaster)
294 ON_BN_CLICKED(ID_OBJECT_MATERIAL_PLASTIC, OnObjectMaterialPlastic)
295 ON_BN_CLICKED(ID_OBJECT_MATERIAL_SATIN, OnObjectMaterialSatin)
296 ON_BN_CLICKED(ID_OBJECT_MATERIAL_SHINY_PLASTIC, OnObjectMaterialShinyPlastic)
297 ON_BN_CLICKED(ID_OBJECT_MATERIAL_SILVER, OnObjectMaterialSilver)
298 ON_BN_CLICKED(ID_OBJECT_MATERIAL_STEEL, OnObjectMaterialSteel)
299 ON_BN_CLICKED(ID_OBJECT_MATERIAL_STONE, OnObjectMaterialStone)
300 ON_BN_CLICKED(ID_OBJECT_MATERIAL_DEFAULT, OnObjectMaterialDefault)
304 /////////////////////////////////////////////////////////////////////////////
305 // CDialogMaterial message handlers
307 void CDialogMaterial::OnMaterial(UINT nID)
309 SetMaterial ((Graphic3d_NameOfMaterial)(nID-ID_OBJECT_MATERIAL_BRASS));
312 void CDialogMaterial::SetMaterial(Graphic3d_NameOfMaterial Material)
314 Standard_Real aTransparency;
315 for (myCurrentIC->InitCurrent();myCurrentIC->MoreCurrent ();myCurrentIC->NextCurrent ()){
316 aTransparency = myCurrentIC->Current()->Transparency();
317 myCurrentIC->SetMaterial (myCurrentIC->Current(),(Graphic3d_NameOfMaterial)(Material));
318 myCurrentIC->SetTransparency (myCurrentIC->Current(),aTransparency);
322 void CDialogMaterial::OnObjectMaterialAluminium () { SetMaterial ( Graphic3d_NOM_ALUMINIUM ) ; }
323 void CDialogMaterial::OnObjectMaterialBrass () { SetMaterial ( Graphic3d_NOM_BRASS ) ; }
324 void CDialogMaterial::OnObjectMaterialBronze () { SetMaterial ( Graphic3d_NOM_BRONZE ) ; }
325 void CDialogMaterial::OnObjectMaterialChrome () { SetMaterial ( Graphic3d_NOM_CHROME ) ; }
326 void CDialogMaterial::OnObjectMaterialCopper () { SetMaterial ( Graphic3d_NOM_COPPER ) ; }
327 void CDialogMaterial::OnObjectMaterialGold () { SetMaterial ( Graphic3d_NOM_GOLD ) ; }
328 void CDialogMaterial::OnObjectMaterialJade () { SetMaterial ( Graphic3d_NOM_JADE ) ; }
329 void CDialogMaterial::OnObjectMaterialMetalized () { SetMaterial ( Graphic3d_NOM_METALIZED ) ; }
330 void CDialogMaterial::OnObjectMaterialNeonGNC () { SetMaterial ( Graphic3d_NOM_NEON_GNC ) ; }
331 void CDialogMaterial::OnObjectMaterialNeonPHC () { SetMaterial ( Graphic3d_NOM_NEON_PHC ) ; }
332 void CDialogMaterial::OnObjectMaterialObsidian () { SetMaterial ( Graphic3d_NOM_OBSIDIAN ) ; }
333 void CDialogMaterial::OnObjectMaterialPewter () { SetMaterial ( Graphic3d_NOM_PEWTER ) ; }
334 void CDialogMaterial::OnObjectMaterialPlaster () { SetMaterial ( Graphic3d_NOM_PLASTER ) ; }
335 void CDialogMaterial::OnObjectMaterialPlastic () { SetMaterial ( Graphic3d_NOM_PLASTIC ) ; }
336 void CDialogMaterial::OnObjectMaterialSatin () { SetMaterial ( Graphic3d_NOM_SATIN ) ; }
337 void CDialogMaterial::OnObjectMaterialShinyPlastic () { SetMaterial ( Graphic3d_NOM_SHINY_PLASTIC ) ; }
338 void CDialogMaterial::OnObjectMaterialSilver () { SetMaterial ( Graphic3d_NOM_SILVER ) ; }
339 void CDialogMaterial::OnObjectMaterialSteel () { SetMaterial ( Graphic3d_NOM_STEEL ) ; }
340 void CDialogMaterial::OnObjectMaterialStone () { SetMaterial ( Graphic3d_NOM_STONE ) ; }
341 void CDialogMaterial::OnObjectMaterialDefault () { SetMaterial ( Graphic3d_NOM_DEFAULT ) ; }
344 /////////////////////////////////////////////////////////////////////////////
345 // CDialogTransparency dialog
347 CDialogTransparency::CDialogTransparency(Handle(AIS_InteractiveContext) CurrentIC,
348 CWnd* pParent /*=NULL*/)
349 : CDialog(CDialogTransparency::IDD, pParent)
352 //{{AFX_DATA_INIT(CDialogTransparency)
356 myCurrentIC = CurrentIC;
358 Standard_Real temp = 10;
361 for (myCurrentIC->InitCurrent();
362 myCurrentIC->MoreCurrent ();
363 myCurrentIC->NextCurrent ())
365 t = CurrentIC->Current()->Transparency();
368 //myCurrentIC->SetTransparency (myCurrentIC->Current(), m_TransValue);
371 m_TransValue = int (temp * 10);
372 if (Abs(m_TransValue - temp * 10) > 0.01)
373 m_TransValue = int (temp * 10) + 1;
375 for (myCurrentIC->InitCurrent();
376 myCurrentIC->MoreCurrent ();
377 myCurrentIC->NextCurrent ())
379 myCurrentIC->SetTransparency (myCurrentIC->Current(), temp);
386 void CDialogTransparency::DoDataExchange(CDataExchange* pDX)
388 CDialog::DoDataExchange(pDX);
389 //{{AFX_DATA_MAP(CDialogTransparency)
390 DDX_Text(pDX, IDC_EDITAISTRANSP, m_TransValue);
391 DDV_MinMaxInt(pDX, m_TransValue, 0, 10);
396 BEGIN_MESSAGE_MAP(CDialogTransparency, CDialog)
397 //{{AFX_MSG_MAP(CDialogTransparency)
398 ON_NOTIFY(UDN_DELTAPOS, IDC_SPINAISTRANSP, OnDeltaposSpinaistransp)
399 ON_EN_CHANGE(IDC_EDITAISTRANSP, OnChangeEditaistransp)
403 /////////////////////////////////////////////////////////////////////////////
404 // CDialogTransparency message handlers
406 void CDialogTransparency::OnDeltaposSpinaistransp(NMHDR* pNMHDR, LRESULT* pResult)
408 NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
409 // TODO: Add your control notification handler code here
410 if ((pNMUpDown->iDelta < 0) && (m_TransValue < 10))
411 m_TransValue = m_TransValue + 1;
412 if ((pNMUpDown->iDelta > 0) && (m_TransValue > 0))
413 m_TransValue = m_TransValue - 1;
417 for (myCurrentIC->InitCurrent();
418 myCurrentIC->MoreCurrent ();
419 myCurrentIC->NextCurrent())
421 myCurrentIC->SetTransparency (myCurrentIC->Current(), m_TransValue/10.0);
429 void CDialogTransparency::OnChangeEditaistransp()
431 // TODO: Add your control notification handler code here
432 int temp = m_TransValue;
433 if (UpdateData (true)){
434 for (myCurrentIC->InitCurrent();
435 myCurrentIC->MoreCurrent ();
436 myCurrentIC->NextCurrent())
438 myCurrentIC->SetTransparency (myCurrentIC->Current(), m_TransValue/10.0);