3 using System.Collections;
4 using System.ComponentModel;
5 using System.Windows.Forms;
10 public enum CurrentAction3d
13 CurAction3d_DynamicZooming,
14 CurAction3d_WindowZooming,
15 CurAction3d_DynamicPanning,
16 CurAction3d_GlobalPanning,
17 CurAction3d_DynamicRotation
19 public enum CurrentPressedKey
21 CurPressedKey_Nothing,
25 public enum ModelFormat
35 /// Summary description for Form2.
37 public class Form2 : System.Windows.Forms.Form
39 private System.ComponentModel.IContainer components;
44 // Required for Windows Form Designer support
46 InitializeComponent();
49 // Create OCCT proxy object
51 myOCCTProxy = new OCCTProxy();
52 myCurrentMode = CurrentAction3d.CurAction3d_Nothing;
53 myCurrentPressedKey = CurrentPressedKey.CurPressedKey_Nothing;
54 myDegenerateModeIsOn = true;
55 IsRectVisible = false;
59 /// Clean up any resources being used.
61 protected override void Dispose(bool disposing)
65 if (components != null)
70 base.Dispose(disposing);
73 #region Windows Form Designer generated code
75 /// Required method for Designer support - do not modify
76 /// the contents of this method with the code editor.
78 private void InitializeComponent()
80 this.components = new System.ComponentModel.Container();
81 System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form2));
82 this.imageList1 = new System.Windows.Forms.ImageList(this.components);
83 this.myPopup = new System.Windows.Forms.ContextMenu();
84 this.menuItem1 = new System.Windows.Forms.MenuItem();
85 this.myPopupObject = new System.Windows.Forms.ContextMenu();
86 this.ContextWireframe = new System.Windows.Forms.MenuItem();
87 this.ContextShading = new System.Windows.Forms.MenuItem();
88 this.ContextColor = new System.Windows.Forms.MenuItem();
89 this.ContextMaterial = new System.Windows.Forms.MenuItem();
90 this.ContMatBrass = new System.Windows.Forms.MenuItem();
91 this.ContMenBronze = new System.Windows.Forms.MenuItem();
92 this.ContMenCopper = new System.Windows.Forms.MenuItem();
93 this.ContMenGold = new System.Windows.Forms.MenuItem();
94 this.ContMenPewt = new System.Windows.Forms.MenuItem();
95 this.ContMenPlaster = new System.Windows.Forms.MenuItem();
96 this.ContMenPlastic = new System.Windows.Forms.MenuItem();
97 this.ContMenSilver = new System.Windows.Forms.MenuItem();
98 this.ContMenTranc = new System.Windows.Forms.MenuItem();
99 this.ContMenDelete = new System.Windows.Forms.MenuItem();
103 this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
104 this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
105 this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
109 this.myPopup.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
114 this.menuItem1.Index = 0;
115 this.menuItem1.Text = "Change &Background";
116 this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
120 this.myPopupObject.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
121 this.ContextWireframe,
124 this.ContextMaterial,
126 this.ContMenDelete});
127 this.myPopupObject.Popup += new System.EventHandler(this.myPopupObject_Popup);
131 this.ContextWireframe.Index = 0;
132 this.ContextWireframe.Text = "Wireframe";
133 this.ContextWireframe.Click += new System.EventHandler(this.ContextWireframe_Click);
137 this.ContextShading.Index = 1;
138 this.ContextShading.Text = "Shading";
139 this.ContextShading.Click += new System.EventHandler(this.ContextShading_Click);
143 this.ContextColor.Index = 2;
144 this.ContextColor.Text = "Color";
145 this.ContextColor.Click += new System.EventHandler(this.ContextColor_Click);
149 this.ContextMaterial.Index = 3;
150 this.ContextMaterial.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
158 this.ContMenSilver});
159 this.ContextMaterial.Text = "Material";
163 this.ContMatBrass.Index = 0;
164 this.ContMatBrass.Text = "&Brass";
165 this.ContMatBrass.Click += new System.EventHandler(this.ContMatBrass_Click);
169 this.ContMenBronze.Index = 1;
170 this.ContMenBronze.Text = "&Bronze";
171 this.ContMenBronze.Click += new System.EventHandler(this.ContMenBronze_Click);
175 this.ContMenCopper.Index = 2;
176 this.ContMenCopper.Text = "&Copper";
177 this.ContMenCopper.Click += new System.EventHandler(this.ContMenCopper_Click);
181 this.ContMenGold.Index = 3;
182 this.ContMenGold.Text = "&Gold";
183 this.ContMenGold.Click += new System.EventHandler(this.ContMenGold_Click);
187 this.ContMenPewt.Index = 4;
188 this.ContMenPewt.Text = "&Pewter";
189 this.ContMenPewt.Click += new System.EventHandler(this.ContMenPewt_Click);
193 this.ContMenPlaster.Index = 5;
194 this.ContMenPlaster.Text = "&Plaster";
195 this.ContMenPlaster.Click += new System.EventHandler(this.ContMenPlaster_Click);
199 this.ContMenPlastic.Index = 6;
200 this.ContMenPlastic.Text = "&Plastic";
201 this.ContMenPlastic.Click += new System.EventHandler(this.ContMenPlastic_Click);
205 this.ContMenSilver.Index = 7;
206 this.ContMenSilver.Text = "&Silver";
207 this.ContMenSilver.Click += new System.EventHandler(this.ContMenSilver_Click);
211 this.ContMenTranc.Index = 4;
212 this.ContMenTranc.Text = "&Trancparency";
213 this.ContMenTranc.Click += new System.EventHandler(this.ContMenTranc_Click);
217 this.ContMenDelete.Index = 5;
218 this.ContMenDelete.Text = "&Delete";
219 this.ContMenDelete.Click += new System.EventHandler(this.ContMenDelete_Click);
223 this.AccessibleRole = System.Windows.Forms.AccessibleRole.Window;
224 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
225 this.ClientSize = new System.Drawing.Size(320, 261);
226 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
227 this.ImeMode = System.Windows.Forms.ImeMode.NoControl;
229 this.Text = "Document";
230 this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
231 this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form2_KeyDown);
232 this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form2_MouseDown);
233 this.SizeChanged += new System.EventHandler(this.Form2_SizeChanged);
234 this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form2_MouseUp);
235 this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Form2_KeyUp);
236 this.Closed += new System.EventHandler(this.Form2_Closed);
237 this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form2_Paint);
238 this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form2_MouseMove);
242 private System.Windows.Forms.ImageList imageList1;
243 private System.Windows.Forms.ContextMenu myPopup;
244 private System.Windows.Forms.ContextMenu myPopupObject;
245 private System.Windows.Forms.MenuItem ContextWireframe;
246 private System.Windows.Forms.MenuItem ContextShading;
247 private System.Windows.Forms.MenuItem ContextColor;
248 private System.Windows.Forms.MenuItem ContextMaterial;
249 private System.Windows.Forms.MenuItem ContMatBrass;
250 private System.Windows.Forms.MenuItem ContMenBronze;
251 private System.Windows.Forms.MenuItem ContMenCopper;
252 private System.Windows.Forms.MenuItem ContMenGold;
253 private System.Windows.Forms.MenuItem ContMenPewt;
254 private System.Windows.Forms.MenuItem ContMenPlaster;
255 private System.Windows.Forms.MenuItem ContMenPlastic;
256 private System.Windows.Forms.MenuItem ContMenSilver;
257 private System.Windows.Forms.MenuItem ContMenTranc;
258 private System.Windows.Forms.MenuItem ContMenDelete;
259 private System.Windows.Forms.MenuItem menuItem1;
261 private OCCTProxy myOCCTProxy;
262 private int myDocumentIndex, myViewIndex;
264 public void InitV3D()
266 if (!myOCCTProxy.InitViewer(this.Handle))
267 MessageBox.Show("Fatal Error during the graphic initialisation", "Error!",
268 MessageBoxButtons.OK, MessageBoxIcon.Error);
271 public bool ImportBRep(System.String filename)
273 return myOCCTProxy.ImportBrep(filename);
276 private void Form2_SizeChanged(object sender, System.EventArgs e)
278 myOCCTProxy.UpdateView();
281 private void Form2_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
283 myOCCTProxy.RedrawView();
284 myOCCTProxy.UpdateView();
287 protected CurrentAction3d myCurrentMode;
288 protected CurrentPressedKey myCurrentPressedKey;
289 protected float myCurZoom;// ~ Quantity_Factor
290 protected bool myDegenerateModeIsOn;
291 protected int myXmin;
292 protected int myYmin;
293 protected int myXmax;
294 protected int myYmax;
295 protected int theButtonDownX;
296 protected int theButtonDownY;
297 // for erasing of rectangle
298 protected int theRectDownX;
299 protected int theRectDownY;
300 protected bool IsRectVisible;
302 private void Form2_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
306 case MouseButtons.Left:
307 myXmin = e.X; myYmin = e.Y;
308 myXmax = e.X; myYmax = e.Y;
309 if (myCurrentPressedKey == CurrentPressedKey.CurPressedKey_Ctrl)
310 // start the dinamic zooming....
311 myCurrentMode = CurrentAction3d.CurAction3d_DynamicZooming;
314 switch (myCurrentMode)
316 case CurrentAction3d.CurAction3d_Nothing:
317 if (myCurrentPressedKey == CurrentPressedKey.CurPressedKey_Shift)
318 MultiDragEvent(myXmax, myYmax, -1);
320 DragEvent(myXmax, myYmax, -1);
322 case CurrentAction3d.CurAction3d_DynamicRotation:
323 if (!myDegenerateModeIsOn)
324 myOCCTProxy.SetDegenerateModeOn();
326 myOCCTProxy.StartRotation(e.X, e.Y);
328 case IE_WinForms.CurrentAction3d.CurAction3d_WindowZooming:
329 this.Cursor = System.Windows.Forms.Cursors.Hand;
336 case MouseButtons.Right:
337 //MessageBox.Show("right mouse button is down");
338 if (myCurrentPressedKey == CurrentPressedKey.CurPressedKey_Ctrl)
340 if (!myDegenerateModeIsOn)
341 myOCCTProxy.SetDegenerateModeOn();
342 myOCCTProxy.StartRotation(e.X, e.Y);
352 private void Form2_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
355 myCurrentPressedKey = CurrentPressedKey.CurPressedKey_Shift;
357 myCurrentPressedKey = CurrentPressedKey.CurPressedKey_Ctrl;
360 private void Form2_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
362 myCurrentPressedKey = CurrentPressedKey.CurPressedKey_Nothing;
365 protected void MultiDragEvent(int x, int y, int theState)
372 else if (theState == 1)
373 myOCCTProxy.ShiftSelect(Math.Min(theButtonDownX, x), Math.Min(theButtonDownY, y),
374 Math.Max(theButtonDownX, x), Math.Max(theButtonDownY, y));
377 protected void DragEvent(int x, int y, int theState)
379 if (theState == -1) //mouse is down
384 else if (theState == 1) //mouse is up
386 myOCCTProxy.Select(Math.Min(theButtonDownX, x), Math.Min(theButtonDownY, y),
387 Math.Max(theButtonDownX, x), Math.Max(theButtonDownY, y));
391 protected void Popup(int x, int y)
393 System.Drawing.Point p = new Point(x, y);
394 if (this.myOCCTProxy.IsObjectSelected())
395 this.myPopupObject.Show(this, p);
397 this.myPopup.Show(this, p);
400 private void Form2_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
404 case MouseButtons.Left:
405 if (myCurrentPressedKey == CurrentPressedKey.CurPressedKey_Ctrl)
407 switch (myCurrentMode)
409 case CurrentAction3d.CurAction3d_Nothing:
410 if (e.X == myXmin && e.Y == myYmin)
412 myXmax = e.X; myYmax = e.Y;
413 if (myCurrentPressedKey == CurrentPressedKey.CurPressedKey_Shift)
414 MultiInputEvent(myXmax, myYmax);
416 InputEvent(myXmax, myYmax);
420 myXmax = e.X; myYmax = e.Y;
421 DrawRectangle(false);
422 if (myCurrentPressedKey == CurrentPressedKey.CurPressedKey_Shift)
423 MultiDragEvent(myXmax, myYmax, 1);
425 DragEvent(myXmax, myYmax, 1);
428 case CurrentAction3d.CurAction3d_DynamicZooming:
429 myCurrentMode = CurrentAction3d.CurAction3d_Nothing;
431 case CurrentAction3d.CurAction3d_WindowZooming:
432 myXmax = e.X; myYmax = e.Y;
433 DrawRectangle(false);
435 if (Math.Abs(myXmax - myXmin) > ValZWMin && Math.Abs(myXmax - myYmax) > ValZWMin)
436 myOCCTProxy.WindowFitAll(myXmin, myYmin, myXmax, myYmax);
437 this.Cursor = System.Windows.Forms.Cursors.Default;
438 IE_WinForms.Form1 f = (IE_WinForms.Form1)this.ParentForm;
439 f.SelectionChanged();
440 myCurrentMode = CurrentAction3d.CurAction3d_Nothing;
442 case CurrentAction3d.CurAction3d_DynamicPanning:
443 myCurrentMode = CurrentAction3d.CurAction3d_Nothing;
445 case CurrentAction3d.CurAction3d_GlobalPanning:
446 myOCCTProxy.Place(e.X, e.Y, myCurZoom);
447 myCurrentMode = CurrentAction3d.CurAction3d_Nothing;
449 case CurrentAction3d.CurAction3d_DynamicRotation:
450 myCurrentMode = CurrentAction3d.CurAction3d_Nothing;
451 if (!myDegenerateModeIsOn)
453 myOCCTProxy.SetDegenerateModeOff();
454 myDegenerateModeIsOn = false;
458 myOCCTProxy.SetDegenerateModeOn();
459 myDegenerateModeIsOn = true;
467 case MouseButtons.Right:
468 if (!myDegenerateModeIsOn)
470 myOCCTProxy.SetDegenerateModeOff();
471 myDegenerateModeIsOn = false;
475 myOCCTProxy.SetDegenerateModeOn();
476 myDegenerateModeIsOn = true;
483 IE_WinForms.Form1 parent = (IE_WinForms.Form1)this.ParentForm;
484 parent.SelectionChanged();
487 protected void MultiInputEvent(int x, int y)
489 myOCCTProxy.ShiftSelect();
492 protected void InputEvent(int x, int y)
494 myOCCTProxy.Select();
497 private void DrawRectangle(bool draw)
499 Graphics gr = Graphics.FromHwnd(this.Handle);
500 System.Drawing.Pen p = null;
501 if (this.IsRectVisible || (!draw))//erase the rect
503 int r = myOCCTProxy.GetBGColR();
504 int g = myOCCTProxy.GetBGColG();
505 int b = myOCCTProxy.GetBGColB();
506 p = new Pen(System.Drawing.Color.FromArgb(r, g, b));
507 this.IsRectVisible = false;
508 this.myOCCTProxy.UpdateView();
512 p = new Pen(System.Drawing.Color.White);
513 this.IsRectVisible = true;
517 int x = Math.Min(this.myXmin, this.myXmax);
518 int y = Math.Min(this.myYmin, this.myYmax);
519 gr.DrawRectangle(p, x, y, Math.Abs(myXmax - myXmin), Math.Abs(myYmax - myYmin));
520 this.theRectDownX = Math.Max(this.myXmin, this.myXmax);
521 this.theRectDownY = Math.Max(this.myYmin, this.myYmax);
524 private void Form2_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
526 if (e.Button == MouseButtons.Left) //left button is pressed
528 if (myCurrentPressedKey == CurrentPressedKey.CurPressedKey_Ctrl)
530 myOCCTProxy.Zoom(myXmax, myYmax, e.X, e.Y);
531 myXmax = e.X; myYmax = e.Y;
535 switch (myCurrentMode)
537 case CurrentAction3d.CurAction3d_Nothing:
538 DrawRectangle(false);
539 myXmax = e.X; myYmax = e.Y;
542 case CurrentAction3d.CurAction3d_DynamicZooming:
543 myOCCTProxy.Zoom(myXmax, myYmax, e.X, e.Y);
544 myXmax = e.X; myYmax = e.Y;
546 case CurrentAction3d.CurAction3d_WindowZooming:
547 DrawRectangle(false);
548 myXmax = e.X; myYmax = e.Y;
549 DrawRectangle(true);//add brush here
551 case CurrentAction3d.CurAction3d_DynamicPanning:
552 myOCCTProxy.Pan(e.X - myXmax, myYmax - e.Y);
553 myXmax = e.X; myYmax = e.Y;
555 case CurrentAction3d.CurAction3d_GlobalPanning:
557 case CurrentAction3d.CurAction3d_DynamicRotation:
558 myOCCTProxy.Rotation(e.X, e.Y);
559 myOCCTProxy.RedrawView();
565 } // e.Button == MouseButtons.Left
566 else if (e.Button == MouseButtons.Middle)
568 if (myCurrentPressedKey == CurrentPressedKey.CurPressedKey_Ctrl)
570 myOCCTProxy.Pan(e.X - myXmax, myYmax - e.Y);
571 myXmax = e.X; myYmax = e.Y;
573 }//e.Button=MouseButtons.Middle
574 else if (e.Button == MouseButtons.Right) //right button is pressed
576 if (myCurrentPressedKey == CurrentPressedKey.CurPressedKey_Ctrl)
577 myOCCTProxy.Rotation(e.X, e.Y);
579 else // no buttons are pressed
581 myXmax = e.X; myYmax = e.Y;
582 if (myCurrentPressedKey == CurrentPressedKey.CurPressedKey_Shift)
583 MultiMoveEvent(e.X, e.Y);
591 protected void MultiMoveEvent(int x, int y)
593 myOCCTProxy.MoveTo(x, y);
596 protected void MoveEvent(int x, int y)
598 myOCCTProxy.MoveTo(x, y);
601 public void SetDisplayMode(int aMode)
603 myOCCTProxy.SetDisplayMode(aMode);
606 public void ChangeColor(bool IsObjectColor)
611 r = myOCCTProxy.GetObjColR();
612 g = myOCCTProxy.GetObjColG();
613 b = myOCCTProxy.GetObjColB();
617 r = myOCCTProxy.GetBGColR();
618 g = myOCCTProxy.GetBGColG();
619 b = myOCCTProxy.GetBGColB();
621 System.Windows.Forms.ColorDialog ColDlg = new ColorDialog();
622 ColDlg.Color = System.Drawing.Color.FromArgb(r, g, b);
623 if (ColDlg.ShowDialog() == DialogResult.OK)
625 Color c = ColDlg.Color;
630 myOCCTProxy.SetColor(r, g, b);
632 myOCCTProxy.SetBackgroundColor(r, g, b);
634 this.myOCCTProxy.UpdateCurrentViewer();
638 public void DeleteObjects()
640 myOCCTProxy.EraseObjects();
641 IE_WinForms.Form1 parent = (IE_WinForms.Form1)this.ParentForm;
642 parent.SelectionChanged();
644 public void ImportModel(IE_WinForms.ModelFormat format)
647 System.Windows.Forms.OpenFileDialog openDialog = new OpenFileDialog();
649 string DataDir = ((Environment.GetEnvironmentVariable("CASROOT")) + "\\..\\data");
655 case ModelFormat.BREP:
656 openDialog.InitialDirectory = (DataDir + "\\occ");
658 filter = "BREP Files (*.brep *.rle)|*.brep; *.rle";
660 case IE_WinForms.ModelFormat.STEP:
661 openDialog.InitialDirectory = (DataDir + "\\step");
663 filter = "STEP Files (*.stp *.step)|*.stp; *.step";
665 case IE_WinForms.ModelFormat.IGES:
666 openDialog.InitialDirectory = (DataDir + "\\iges");
668 filter = "IGES Files (*.igs *.iges)|*.igs; *.iges";
673 openDialog.Filter = filter + "|All files (*.*)|*.*";
674 if (openDialog.ShowDialog() == DialogResult.OK)
676 string filename = openDialog.FileName;
679 this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
680 if (!myOCCTProxy.TranslateModel(filename, theformat, true))
681 MessageBox.Show("Cann't read this file", "Error!",
682 MessageBoxButtons.OK, MessageBoxIcon.Warning);
683 this.Cursor = System.Windows.Forms.Cursors.Default;
685 this.myOCCTProxy.ZoomAllView();
688 public void ExportModel(ModelFormat format)
691 System.Windows.Forms.SaveFileDialog saveDialog = new SaveFileDialog();
692 string DataDir = ((Environment.GetEnvironmentVariable("CASROOT")) + "\\..\\data");
696 case IE_WinForms.ModelFormat.BREP:
697 saveDialog.InitialDirectory = (DataDir + "\\occ");
699 filter = "BREP Files (*.brep *.rle)|*.brep; *.rle";
701 case IE_WinForms.ModelFormat.STEP:
702 saveDialog.InitialDirectory = (DataDir + "\\step");
704 filter = "STEP Files (*.stp *.step)|*.step; *.stp";
706 case IE_WinForms.ModelFormat.IGES:
707 saveDialog.InitialDirectory = (DataDir + "\\iges");
709 filter = "IGES Files (*.igs *.iges)| *.iges; *.igs";
711 case IE_WinForms.ModelFormat.VRML:
712 saveDialog.InitialDirectory = (DataDir + "\\vrml");
714 filter = "VRML Files (*.vrml)|*.vrml";
716 case IE_WinForms.ModelFormat.STL:
717 saveDialog.InitialDirectory = (DataDir + "\\stl");
719 filter = "STL Files (*.stl)|*.stl";
721 case IE_WinForms.ModelFormat.IMAGE:
722 saveDialog.InitialDirectory = (DataDir + "\\images");
724 filter = "Images Files (*.bmp *.gif)| *.bmp; *.gif";
729 saveDialog.Filter = filter;
730 if (saveDialog.ShowDialog() == DialogResult.OK)
732 string filename = saveDialog.FileName;
735 this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
736 if (!myOCCTProxy.TranslateModel(filename, theformat, false))
737 MessageBox.Show("Cann't write this file", "Error!",
738 MessageBoxButtons.OK, MessageBoxIcon.Warning);
739 this.Cursor = System.Windows.Forms.Cursors.Default;
743 private void ContextColor_Click(object sender, System.EventArgs e)
745 this.ChangeColor(true);
748 private void menuItem1_Click(object sender, System.EventArgs e)
750 this.myOCCTProxy.UpdateCurrentViewer();
751 this.ChangeColor(false);
754 private void ContextWireframe_Click(object sender, System.EventArgs e)
756 this.SetDisplayMode(0);
757 this.myOCCTProxy.UpdateCurrentViewer();
758 IE_WinForms.Form1 parent = (IE_WinForms.Form1)this.ParentForm;
759 parent.SelectionChanged();
762 private void ContextShading_Click(object sender, System.EventArgs e)
764 this.SetDisplayMode(1);
765 this.myOCCTProxy.UpdateCurrentViewer();
766 IE_WinForms.Form1 parent = (IE_WinForms.Form1)this.ParentForm;
767 parent.SelectionChanged();
770 private void ContMenTranc_Click(object sender, System.EventArgs e)
772 IE_WinForms.TransparencyDialog dlg = new TransparencyDialog();
773 dlg.View = this.myOCCTProxy;
774 dlg.ShowDialog(this);
777 private void ContMenDelete_Click(object sender, System.EventArgs e)
779 this.DeleteObjects();
782 private void ContMatBrass_Click(object sender, System.EventArgs e)
784 this.myOCCTProxy.UpdateCurrentViewer();
785 this.myOCCTProxy.SetMaterial(0);
788 private void ContMenBronze_Click(object sender, System.EventArgs e)
790 this.myOCCTProxy.UpdateCurrentViewer();
791 this.myOCCTProxy.SetMaterial(1);
794 private void ContMenCopper_Click(object sender, System.EventArgs e)
796 this.myOCCTProxy.UpdateCurrentViewer();
797 this.myOCCTProxy.SetMaterial(2);
800 private void ContMenGold_Click(object sender, System.EventArgs e)
802 this.myOCCTProxy.UpdateCurrentViewer();
803 this.myOCCTProxy.SetMaterial(3);
806 private void ContMenPewt_Click(object sender, System.EventArgs e)
808 this.myOCCTProxy.UpdateCurrentViewer();
809 this.myOCCTProxy.SetMaterial(4);
812 private void ContMenPlaster_Click(object sender, System.EventArgs e)
814 this.myOCCTProxy.UpdateCurrentViewer();
815 this.myOCCTProxy.SetMaterial(5);
818 private void ContMenPlastic_Click(object sender, System.EventArgs e)
820 this.myOCCTProxy.UpdateCurrentViewer();
821 this.myOCCTProxy.SetMaterial(6);
824 private void ContMenSilver_Click(object sender, System.EventArgs e)
826 this.myOCCTProxy.UpdateCurrentViewer();
827 this.myOCCTProxy.SetMaterial(7);
830 private void toolBar1_MouseHover(object sender, System.EventArgs e)
832 IE_WinForms.Form1 parent = (IE_WinForms.Form1)this.ParentForm;
833 parent.StatusBar.Text = "View toolbar";
837 private void toolBar1_MouseLeave(object sender, System.EventArgs e)
839 IE_WinForms.Form1 parent = (IE_WinForms.Form1)this.ParentForm;
840 parent.StatusBar.Text = "";
843 private void myPopupObject_Popup(object sender, System.EventArgs e)
845 int mode = this.myOCCTProxy.DisplayMode();
851 this.ContextWireframe.Enabled = false;
852 this.ContextShading.Enabled = true;
853 this.ContMenTranc.Enabled = false;
856 this.ContextShading.Enabled = false;
857 this.ContextWireframe.Enabled = true;
858 this.ContMenTranc.Enabled = true;
861 this.ContextShading.Enabled = true; ;
862 this.ContextWireframe.Enabled = true;
863 this.ContMenTranc.Enabled = true;
871 public OCCTProxy View
875 return this.myOCCTProxy;
879 this.myOCCTProxy = value;
883 public void InitView()
885 this.myOCCTProxy.InitOCCTProxy();
888 public void SetIndex(int documentIndex, int viewIndex)
890 this.myDocumentIndex = documentIndex;
891 this.myViewIndex = viewIndex;
892 this.Text = System.String.Format("Document {0}:{1}", documentIndex, viewIndex);
895 public void SetNextIndex(Form2 other)
897 SetIndex(other.myDocumentIndex, other.myViewIndex + 1);
900 public void SetContext(OCCTProxy View)
902 this.myOCCTProxy.SetAISContext(View);
905 private void Form2_Closed(object sender, System.EventArgs e)
907 IE_WinForms.Form1 parent = (IE_WinForms.Form1)this.ParentForm;
908 parent.OnFileClose();
911 public CurrentAction3d Mode
915 return this.myCurrentMode;
919 this.myCurrentMode = value;
927 this.myCurZoom = value;
931 public bool DegenerateMode
935 return this.myDegenerateModeIsOn;
939 this.myDegenerateModeIsOn = value;