프로젝트

일반

사용자정보

통계
| 개정판:

hytos / ID2.Manager / ID2.Manager.Compare / Model / MyModel.cs @ 67cfe4dc

이력 | 보기 | 이력해설 | 다운로드 (4.79 KB)

1
using devDept;
2
using devDept.Eyeshot;
3
using devDept.Eyeshot.Entities;
4
using devDept.Graphics;
5
using ID2.Manager.Controls;
6
using System;
7
using System.Collections.Generic;
8
using System.ComponentModel;
9
using System.Diagnostics;
10
using System.Drawing;
11
using System.IO;
12
using System.Linq;
13
using System.Runtime.CompilerServices;
14
using System.Text;
15
using System.Threading.Tasks;
16
using System.Windows.Forms;
17

    
18
namespace Xtractor.Viewer
19
{
20
    public class FixedText : IEquatable<FixedText>
21
    {
22
        public FixedText(int x, int y, string text)
23
        {
24
            X = x;
25
            Y = y;
26
            TextString = text.Replace(System.Environment.NewLine, string.Empty);
27
        }
28

    
29
        public int X { get; set; }
30
        public int Y { get; set; }
31
        public string TextString { get; set; }
32

    
33
        public bool Equals(FixedText other)
34
        {
35
            return this.X == other.X 
36
                && this.Y == other.Y 
37
                && this.TextString.Equals(other.TextString);
38
        }
39

    
40
        public bool Equals(Text text)
41
        {
42
            return this.X == Convert.ToInt32(text.InsertionPoint.X)
43
                            && this.Y == Convert.ToInt32(text.InsertionPoint.Y)
44
                            && this.TextString.Equals(text.TextString.Replace(System.Environment.NewLine, string.Empty));
45
        }
46

    
47
        public override string ToString()
48
        {
49
            return $"{X},{Y},{TextString}";
50
        }
51
    }
52

    
53
    public partial class MyModel : Design
54
    {
55
        private int entityUnderMouseID;
56
        private Entity selEntity = null;
57

    
58
        public string FilePath { get; set; }
59

    
60
        /// <summary>
61
        /// WorkUnit Queue
62
        /// </summary>
63
        private WorkManager<WorkUnit> _WorkUnitQueue = new WorkManager<WorkUnit>();
64
        public WorkManager<WorkUnit> WorkUnitQueue { get { return _WorkUnitQueue; } }
65

    
66
        public MyModel(IContainer container)
67
        {
68
            container.Add(this);
69
            InitializeComponent();
70

    
71
            ProgressBar = new devDept.Eyeshot.ProgressBar();
72
        }
73

    
74
        public void ClearEntity()
75
        {
76
            this.Entities.Clear();            
77
        }
78

    
79

    
80
        public void SetPerformanceCondition()
81
        {
82
            this.ActiveViewport.DisplayMode = displayType.Rendered;
83
            this.SetView(viewType.vcFrontFaceTopLeft);
84
            //this.ActiveViewport.SmallSizeRatioMoving = 1;
85
            //this.MinimumFramerate = 8;
86
            this.Shaded.ShowEdges = false;
87
            this.Shaded.ShowInternalWires = false;
88
            this.Rendered.ShowEdges = true;
89
            this.Rendered.ShadowMode = shadowType.None;
90

    
91
            /// IsolateBlocks에 필수 
92
            this.UseShaders = true;
93

    
94
            this.Wireframe.SilhouettesDrawingMode = silhouettesDrawingType.Never;
95
            this.Shaded.SilhouettesDrawingMode = silhouettesDrawingType.Never;
96
            this.Rendered.SilhouettesDrawingMode = silhouettesDrawingType.Never;
97
        }
98

    
99
        public List<Entity> GetHidedEntities()
100
        {
101
            return this.Entities.Where(x => x.Visible == false).ToList();
102
        }
103

    
104
        public List<Entity> GetSelectedEntities()
105
        {
106
            return this.Entities.Where(x => x.Selected).ToList();
107
        }
108

    
109
        protected override void OnKeyDown(KeyEventArgs e)
110
        {
111
            if (e.KeyCode == Keys.F8) // ProjectionType 변경
112
            {
113
                if (ActiveViewport.Camera.ProjectionMode == projectionType.Orthographic)
114
                {
115
                    ActiveViewport.Camera.ProjectionMode = projectionType.Perspective;
116
                }
117
                else
118
                {
119
                    ActiveViewport.Camera.ProjectionMode = projectionType.Orthographic;
120
                }
121

    
122
                AdjustNearAndFarPlanes();
123
                Invalidate();
124
            }
125
            else
126
            {
127
                base.OnKeyDown(e);
128
            }
129
        }
130

    
131
        protected override void OnMouseMove(MouseEventArgs e)
132
        {
133

    
134
            if (ActiveViewport.ToolBar.Contains(e.Location) || ActiveViewport.ViewCubeIcon.Contains(e.Location) || this.IsBusy)
135
            {
136
                base.OnMouseMove(e);
137

    
138
                return;
139
            }
140

    
141

    
142
            base.OnMouseMove(e);
143
        }
144

    
145
        protected override void OnMouseDown(MouseEventArgs e)
146
        {
147
            if ((ActiveViewport.ToolBar.Contains(e.Location) || ActiveViewport.ViewCubeIcon.Contains(e.Location)))
148
            {
149
                base.OnMouseDown(e);
150
                return;
151
            }
152

    
153
            entityUnderMouseID = GetEntityUnderMouseCursor(e.Location);
154

    
155
            if (e.Button == MouseButtons.Left)
156
            {
157
                if (entityUnderMouseID > -1)
158
                {
159
                    this.selEntity = Entities[entityUnderMouseID];
160
                    
161

    
162
                }
163
            }
164

    
165
            base.OnMouseDown(e);
166
        }
167
    }
168
}
클립보드 이미지 추가 (최대 크기: 500 MB)