hytos / ID2.Manager / ID2.Manager.Compare / Model / MyModel.cs @ 98fdb329
이력 | 보기 | 이력해설 | 다운로드 (3.68 KB)
1 |
using devDept; |
---|---|
2 |
using devDept.Eyeshot; |
3 |
using devDept.Eyeshot.Entities; |
4 |
using devDept.Graphics; |
5 |
using System; |
6 |
using System.Collections.Generic; |
7 |
using System.ComponentModel; |
8 |
using System.Diagnostics; |
9 |
using System.Drawing; |
10 |
using System.Linq; |
11 |
using System.Text; |
12 |
using System.Threading.Tasks; |
13 |
using System.Windows.Forms; |
14 |
|
15 |
namespace Xtractor.Viewer |
16 |
{ |
17 |
public partial class MyModel : Design |
18 |
{ |
19 |
private int entityUnderMouseID; |
20 |
private Entity selEntity = null; |
21 |
|
22 |
/// <summary> |
23 |
/// WorkUnit Queue |
24 |
/// </summary> |
25 |
private WorkManager<WorkUnit> _WorkUnitQueue = new WorkManager<WorkUnit>(); |
26 |
public WorkManager<WorkUnit> WorkUnitQueue { get { return _WorkUnitQueue; } } |
27 |
|
28 |
public MyModel(IContainer container) |
29 |
{ |
30 |
container.Add(this); |
31 |
InitializeComponent(); |
32 |
|
33 |
ProgressBar = new devDept.Eyeshot.ProgressBar(); |
34 |
} |
35 |
|
36 |
public void ClearEntity() |
37 |
{ |
38 |
this.Entities.Clear(); |
39 |
} |
40 |
|
41 |
|
42 |
public void SetPerformanceCondition() |
43 |
{ |
44 |
this.ActiveViewport.DisplayMode = displayType.Rendered; |
45 |
this.SetView(viewType.vcFrontFaceTopLeft); |
46 |
//this.ActiveViewport.SmallSizeRatioMoving = 1; |
47 |
//this.MinimumFramerate = 8; |
48 |
this.Shaded.ShowEdges = false; |
49 |
this.Shaded.ShowInternalWires = false; |
50 |
this.Rendered.ShowEdges = true; |
51 |
this.Rendered.ShadowMode = shadowType.None; |
52 |
|
53 |
/// IsolateBlocks에 필수 |
54 |
this.UseShaders = true; |
55 |
|
56 |
this.Wireframe.SilhouettesDrawingMode = silhouettesDrawingType.Never; |
57 |
this.Shaded.SilhouettesDrawingMode = silhouettesDrawingType.Never; |
58 |
this.Rendered.SilhouettesDrawingMode = silhouettesDrawingType.Never; |
59 |
} |
60 |
|
61 |
public List<Entity> GetHidedEntities() |
62 |
{ |
63 |
return this.Entities.Where(x => x.Visible == false).ToList(); |
64 |
} |
65 |
|
66 |
public List<Entity> GetSelectedEntities() |
67 |
{ |
68 |
return this.Entities.Where(x => x.Selected).ToList(); |
69 |
} |
70 |
|
71 |
protected override void OnKeyDown(KeyEventArgs e) |
72 |
{ |
73 |
if (e.KeyCode == Keys.F8) // ProjectionType 변경 |
74 |
{ |
75 |
if (ActiveViewport.Camera.ProjectionMode == projectionType.Orthographic) |
76 |
{ |
77 |
ActiveViewport.Camera.ProjectionMode = projectionType.Perspective; |
78 |
} |
79 |
else |
80 |
{ |
81 |
ActiveViewport.Camera.ProjectionMode = projectionType.Orthographic; |
82 |
} |
83 |
|
84 |
AdjustNearAndFarPlanes(); |
85 |
Invalidate(); |
86 |
} |
87 |
else |
88 |
{ |
89 |
base.OnKeyDown(e); |
90 |
} |
91 |
} |
92 |
|
93 |
protected override void OnMouseMove(MouseEventArgs e) |
94 |
{ |
95 |
|
96 |
if (ActiveViewport.ToolBar.Contains(e.Location) || ActiveViewport.ViewCubeIcon.Contains(e.Location) || this.IsBusy) |
97 |
{ |
98 |
base.OnMouseMove(e); |
99 |
|
100 |
return; |
101 |
} |
102 |
|
103 |
|
104 |
base.OnMouseMove(e); |
105 |
} |
106 |
|
107 |
protected override void OnMouseDown(MouseEventArgs e) |
108 |
{ |
109 |
if ((ActiveViewport.ToolBar.Contains(e.Location) || ActiveViewport.ViewCubeIcon.Contains(e.Location))) |
110 |
{ |
111 |
base.OnMouseDown(e); |
112 |
return; |
113 |
} |
114 |
|
115 |
entityUnderMouseID = GetEntityUnderMouseCursor(e.Location); |
116 |
|
117 |
if (e.Button == MouseButtons.Left) |
118 |
{ |
119 |
if (entityUnderMouseID > -1) |
120 |
{ |
121 |
this.selEntity = Entities[entityUnderMouseID]; |
122 |
|
123 |
|
124 |
} |
125 |
} |
126 |
|
127 |
base.OnMouseDown(e); |
128 |
} |
129 |
} |
130 |
} |