프로젝트

일반

사용자정보

개정판 91efe37a

ID91efe37a3e77ce6c2dcbf9b588a9731060346c4d
상위 bbccdd30
하위 077896be

백흠경이(가) 5년 이상 전에 추가함

issue #534: Add ItemRect property to all of controls

Change-Id: Id0d640b9fd9959615758b5e55b499f97d6f38dae

차이점 보기:

FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.cs
933 933

  
934 934
                                                if (control.isTrans)
935 935
                                                {
936
                                                    //Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(newStartPoint, tempMidPoint, (int)LineSize, contentByte, _SetColor, Opacity);
937
                                                    //Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(newStartPoint, tempMidPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity);
938
                                                    //Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(tempMidPoint, tempEndPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity);
939 936
                                                    //인구 수정 Arrow Text Style적용 되도록 변경
940 937
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), 
941 938
                                                        newStartPoint, tempMidPoint, 
......
965 962
                                                                testP = new Point(newEndPoint.X + 10, newEndPoint.Y);
966 963
                                                            }
967 964
                                                        }
968
                                                        //Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(tempStartPoint, testP, (int)LineSize, contentByte, _SetColor, Opacity);
969
                                                        //Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(tempStartPoint, testP, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity);
970
                                                        //Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(testP, tempEndPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity);
971

  
972 965
                                                        //인구 수정 Arrow Text Style적용 되도록 변경
973 966
                                                        Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), 
974 967
                                                            tempStartPoint, testP,
......
977 970
                                                    }
978 971
                                                    else
979 972
                                                    {
980
                                                        //Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(newStartPoint, newMidPoint, (int)LineSize, contentByte, _SetColor, Opacity);
981
                                                        //Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(newStartPoint, newMidPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity);
982
                                                        //Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(newMidPoint, tempEndPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity);
983

  
984 973
                                                        //인구 수정 Arrow Text Style적용 되도록 변경
985 974
                                                        Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), 
986 975
                                                            newStartPoint, newMidPoint,
KCOM/Common/SelectionSet.cs
47 47
                return _instance;
48 48
            }
49 49
        }
50

  
51
        /// <summary>
52
        /// Control Select
53
        /// </summary>
54
        /// <author>humkyung</author>
55
        /// <date>2019.06.13</date>
56
        /// <param name="Control"></param>
57
        /// <param name="dragrect"></param>
58
        /// <returns></returns>
59
        public Boolean SelectControl(CommentUserInfo control, Rect dragrect)
60
        {
61
            return dragrect.Contains(control.ItemRect);
62
        }
50 63
    }
51 64
}
KCOM/Controls/Symbol.xaml.cs
619 619
            //move.
620 620
            foreach (var item in Items)
621 621
            {
622
                Flag = move.control_Select(item, dragRect);
622
                Flag = SelectionSet.Instance.SelectControl(item, dragRect);
623 623

  
624 624
                if (Flag)
625 625
                {
KCOM/Events/Move.cs
63 63
            set;
64 64
        }
65 65

  
66

  
67
        /// <summary>
68
        /// Control Select
69
        /// </summary>
70
        /// <param name="Control"></param>
71
        /// <param name="dragrect"></param>
72
        /// <returns></returns>
73
        public Boolean control_Select(object Control, Rect dragrect)
74
        {
75
            DragRect = dragrect;
76

  
77
            ItemRect(Control);
78

  
79
            if (DragRect.Contains(itemRect))
80
                return true;
81
            else
82
                return false;
83
            
84
        }
85
        
86
        
87
        /// <summary>
88
        /// return bounding box of given control
89
        /// </summary>
90
        /// <param name="control"></param>
91
        /// <history>humkyung 2018.06.14 return bouding box of the control</history>
92
        public Rect ItemRect(object control)
93
        {
94
            s_point = new Point();
95
            e_point = new Point();
96

  
97
            if (control.GetType().Name == "TextControl")
98
            {
99
                s_point.X = (control as TextControl).CanvasX;
100
                s_point.Y = (control as TextControl).CanvasY;
101

  
102
                Point length = new Point();
103
                double angle = (control as TextControl).Angle;
104
                angle = Math.PI * angle / 180;
105

  
106
                length.X = (control as TextControl).BoxWidth * Math.Cos(angle) - (control as TextControl).BoxHeight * Math.Sin(angle);
107
                length.Y = (control as TextControl).BoxWidth * Math.Sin(angle) + (control as TextControl).BoxHeight * Math.Cos(angle);
108

  
109
                e_point.X = s_point.X + length.X;
110
                e_point.Y = s_point.Y + length.Y;
111
                rectSize = e_point - s_point;
112

  
113
                itemRect = new Rect(s_point, new Point(s_point.X + rectSize.X, s_point.Y + rectSize.Y));
114
                return itemRect;
115
            }
116

  
117
            switch ((control as IMarkupCommonData).ControlType)
118
            {
119
                #region Shape
120
                case (ControlType.Rectangle):
121
                    {
122
                        s_point.X = Math.Min((control as RectangleControl).StartPoint.X, (control as RectangleControl).EndPoint.X);
123
                        s_point.Y = Math.Min((control as RectangleControl).StartPoint.Y, (control as RectangleControl).EndPoint.Y);
124
                        e_point.X = Math.Max((control as RectangleControl).StartPoint.X, (control as RectangleControl).EndPoint.X);
125
                        e_point.Y = Math.Max((control as RectangleControl).StartPoint.Y, (control as RectangleControl).EndPoint.Y);
126
                        rectSize = e_point - s_point;
127
                    }
128
                    break;
129
                case (ControlType.Circle):
130
                    {
131
                        s_point.X = Math.Min((control as CircleControl).StartPoint.X, (control as CircleControl).EndPoint.X);
132
                        s_point.Y = Math.Min((control as CircleControl).StartPoint.Y, (control as CircleControl).EndPoint.Y);
133
                        e_point.X = Math.Max((control as CircleControl).StartPoint.X, (control as CircleControl).EndPoint.X);
134
                        e_point.Y = Math.Max((control as CircleControl).StartPoint.Y, (control as CircleControl).EndPoint.Y);
135
                        rectSize = e_point - s_point;
136
                    }
137
                    break;
138
                case (ControlType.RectCloud):
139
                    {
140
                        s_point.X = Math.Min((control as RectCloudControl).StartPoint.X, (control as RectCloudControl).EndPoint.X);
141
                        s_point.Y = Math.Min((control as RectCloudControl).StartPoint.Y, (control as RectCloudControl).EndPoint.Y);
142
                        e_point.X = Math.Max((control as RectCloudControl).StartPoint.X, (control as RectCloudControl).EndPoint.X);
143
                        e_point.Y = Math.Max((control as RectCloudControl).StartPoint.Y, (control as RectCloudControl).EndPoint.Y);
144
                        rectSize = e_point - s_point;
145
                    }
146
                    break;
147
                case (ControlType.Triangle):
148
                    {
149
                        s_point.X = Math.Min((control as TriControl).StartPoint.X, (control as TriControl).EndPoint.X);
150
                        s_point.X = Math.Min((control as TriControl).MidPoint.X, s_point.X);
151
                        s_point.Y = Math.Min((control as TriControl).StartPoint.Y, (control as TriControl).EndPoint.Y);
152
                        s_point.Y = Math.Min((control as TriControl).MidPoint.Y, s_point.Y);
153
                        e_point.X = Math.Max((control as TriControl).StartPoint.X, (control as TriControl).EndPoint.X);
154
                        e_point.X = Math.Max((control as TriControl).MidPoint.X, e_point.X);
155
                        e_point.Y = Math.Max((control as TriControl).StartPoint.Y, (control as TriControl).EndPoint.Y);
156
                        e_point.Y = Math.Max((control as TriControl).MidPoint.Y, e_point.Y);
157
                        rectSize = e_point - s_point;
158
                    }
159
                    break;
160
                #endregion
161

  
162
                #region Line
163
                case (ControlType.SingleLine):
164
                    {
165
                        s_point.X = Math.Min((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X);
166
                        s_point.Y = Math.Min((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y);
167
                        e_point.X = Math.Max((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X);
168
                        e_point.Y = Math.Max((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y);
169
                        rectSize = e_point - s_point;
170
                    }
171
                    break;
172
                case (ControlType.ArrowLine):
173
                    {
174
                        s_point.X = Math.Min((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X);
175
                        s_point.Y = Math.Min((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y);
176
                        e_point.X = Math.Max((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X);
177
                        e_point.Y = Math.Max((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y);
178
                        rectSize = e_point - s_point;
179
                    }
180
                    break;
181
                case (ControlType.ArrowMultiLine):
182
                    {
183
                        s_point.X = Math.Min((control as ArrowControl_Multi).StartPoint.X, (control as ArrowControl_Multi).EndPoint.X);
184
                        s_point.X = Math.Min((control as ArrowControl_Multi).MiddlePoint.X, s_point.X);
185
                        s_point.Y = Math.Min((control as ArrowControl_Multi).StartPoint.Y, (control as ArrowControl_Multi).EndPoint.Y);
186
                        s_point.Y = Math.Min((control as ArrowControl_Multi).MiddlePoint.Y, s_point.Y);
187
                        e_point.X = Math.Max((control as ArrowControl_Multi).StartPoint.X, (control as ArrowControl_Multi).EndPoint.X);
188
                        e_point.X = Math.Max((control as ArrowControl_Multi).MiddlePoint.X, e_point.X);
189
                        e_point.Y = Math.Max((control as ArrowControl_Multi).StartPoint.Y, (control as ArrowControl_Multi).EndPoint.Y);
190
                        e_point.Y = Math.Max((control as ArrowControl_Multi).MiddlePoint.Y, e_point.Y);
191
                        rectSize = e_point - s_point;
192
                    }
193
                    break;
194
                case (ControlType.CancelLine):
195
                    {
196
                        s_point.X = Math.Min((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X);
197
                        s_point.Y = Math.Min((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y);
198
                        e_point.X = Math.Max((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X);
199
                        e_point.Y = Math.Max((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y);
200
                        rectSize = e_point - s_point;
201
                    }
202
                    break;
203
                case (ControlType.DimLine):
204
                    {
205
                        s_point.X = Math.Min((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X);
206
                        s_point.Y = Math.Min((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y);
207
                        e_point.X = Math.Max((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X);
208
                        e_point.Y = Math.Max((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y);
209
                        rectSize = e_point - s_point;
210
                    }
211
                    break;
212
                case (ControlType.TwinLine):
213
                    {
214
                        s_point.X = Math.Min((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X);
215
                        s_point.Y = Math.Min((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y);
216
                        e_point.X = Math.Max((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X);
217
                        e_point.Y = Math.Max((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y);
218
                        rectSize = e_point - s_point;
219
                    }
220
                    break;
221
                case (ControlType.ArcLine):
222
                    {
223
                        s_point.X = Math.Min((control as ArcControl).StartPoint.X, (control as ArcControl).EndPoint.X);
224
                        s_point.X = Math.Min((control as ArcControl).MidPoint.X, s_point.X);
225
                        s_point.Y = Math.Min((control as ArcControl).StartPoint.Y, (control as ArcControl).EndPoint.Y);
226
                        s_point.Y = Math.Min((control as ArcControl).MidPoint.Y, s_point.Y);
227
                        e_point.X = Math.Max((control as ArcControl).StartPoint.X, (control as ArcControl).EndPoint.X);
228
                        e_point.X = Math.Max((control as ArcControl).MidPoint.X, e_point.X);
229
                        e_point.Y = Math.Max((control as ArcControl).StartPoint.Y, (control as ArcControl).EndPoint.Y);
230
                        e_point.Y = Math.Max((control as ArcControl).MidPoint.Y, e_point.Y);
231
                        rectSize = e_point - s_point;
232
                    }
233
                    break;
234
                case (ControlType.ArcArrow):
235
                    {
236
                        s_point.X = Math.Min((control as ArrowArcControl).StartPoint.X, (control as ArrowArcControl).EndPoint.X);
237
                        s_point.X = Math.Min((control as ArrowArcControl).MidPoint.X, s_point.X);
238
                        s_point.Y = Math.Min((control as ArrowArcControl).StartPoint.Y, (control as ArrowArcControl).EndPoint.Y);
239
                        s_point.Y = Math.Min((control as ArrowArcControl).MidPoint.Y, s_point.Y);
240
                        e_point.X = Math.Max((control as ArrowArcControl).StartPoint.X, (control as ArrowArcControl).EndPoint.X);
241
                        e_point.X = Math.Max((control as ArrowArcControl).MidPoint.X, e_point.X);
242
                        e_point.Y = Math.Max((control as ArrowArcControl).StartPoint.Y, (control as ArrowArcControl).EndPoint.Y);
243
                        e_point.Y = Math.Max((control as ArrowArcControl).MidPoint.Y, e_point.Y);
244
                        rectSize = e_point - s_point;
245
                    }
246
                    break;
247
                #endregion
248

  
249
                #region Polygon
250

  
251

  
252
                case (ControlType.Ink):
253
                    {
254
                        s_point.X = Math.Min((control as PolygonControl).StartPoint.X, (control as PolygonControl).EndPoint.X);
255
                        s_point.Y = Math.Min((control as PolygonControl).StartPoint.Y, (control as PolygonControl).EndPoint.Y);
256
                        e_point.X = Math.Max((control as PolygonControl).StartPoint.X, (control as PolygonControl).EndPoint.X);
257
                        e_point.Y = Math.Max((control as PolygonControl).StartPoint.Y, (control as PolygonControl).EndPoint.Y);
258

  
259
                        rectSize = e_point - s_point;
260
                    }
261
                    break;
262

  
263
                case (ControlType.ChainLine):
264
                    {
265
                        //rectSize
266

  
267
                        foreach (Point A in (control as PolygonControl).PointSet)
268
                        {
269
                            if (s_point == new Point())
270
                            {
271
                                s_point = A;
272
                                e_point = A;
273
                            }
274
                            s_point.X = Math.Min(s_point.X, A.X);
275
                            s_point.Y = Math.Min(s_point.Y, A.Y);
276
                            e_point.X = Math.Max(e_point.X, A.X);
277
                            e_point.Y = Math.Max(e_point.Y, A.Y);
278
                        }
279

  
280
                        rectSize = e_point - s_point;
281
                    }
282
                    break;
283

  
284
                case (ControlType.PolygonControl):
285
                    {
286
                        //rectSize
287

  
288
                        foreach (Point A in (control as PolygonControl).PointSet)
289
                        {
290
                            if (s_point == new Point())
291
                            {
292
                                s_point = A;
293
                                e_point = A;
294
                            }
295
                            s_point.X = Math.Min(s_point.X, A.X);
296
                            s_point.Y = Math.Min(s_point.Y, A.Y);
297
                            e_point.X = Math.Max(e_point.X, A.X);
298
                            e_point.Y = Math.Max(e_point.Y, A.Y);
299
                        }
300

  
301
                        rectSize = e_point - s_point;
302
                    }
303
                    break;
304
                case (ControlType.PolygonCloud):
305
                    {
306
                        //rectSize
307

  
308
                        foreach (Point A in (control as CloudControl).PointSet)
309
                        {
310
                            if (s_point == new Point())
311
                            {
312
                                s_point = A;
313
                                e_point = A;
314
                            }
315
                            s_point.X = Math.Min(s_point.X, A.X);
316
                            s_point.Y = Math.Min(s_point.Y, A.Y);
317
                            e_point.X = Math.Max(e_point.X, A.X);
318
                            e_point.Y = Math.Max(e_point.Y, A.Y);
319
                        }
320

  
321
                        rectSize = e_point - s_point;
322
                    }
323
                    break;
324
                #endregion
325

  
326
                #region Text
327
                //case (ControlType.TextControl):
328
                //    {
329
                //        s_point.X = (control as TextControl).CanvasX;
330
                //        s_point.Y = (control as TextControl).CanvasY;
331

  
332
                //        e_point.X = s_point.X + (control as TextControl).BoxWidth;
333
                //        e_point.Y = s_point.Y + (control as TextControl).BoxHeight;
334

  
335
                //        rectSize = e_point - s_point;
336
                //    }
337
                //    break;
338

  
339
                //case (ControlType.TextBorder):
340
                //    {
341

  
342
                //        s_point.X = (control as TextControl).CanvasX;
343
                //        s_point.Y = (control as TextControl).CanvasY;
344

  
345
                //        e_point.X = s_point.X + (control as TextControl).BoxWidth;
346
                //        e_point.Y = s_point.Y + (control as TextControl).BoxHeight;
347

  
348
                //        rectSize = e_point - s_point;
349
                //    }
350
                //    break;
351

  
352
                //case (ControlType.TextCloud):
353
                //    {
354

  
355
                //        s_point.X = (control as TextControl).CanvasX;
356
                //        s_point.Y = (control as TextControl).CanvasY;
357

  
358
                //        e_point.X = s_point.X + (control as TextControl).BoxWidth;
359
                //        e_point.Y = s_point.Y + (control as TextControl).BoxHeight;
360

  
361
                //        rectSize = e_point - s_point;
362
                //    }
363
                //    break;
364
                #endregion
365

  
366
                #region ArrowText
367

  
368
                case (ControlType.ArrowTextControl):
369
                    {
370
                        s_point.X = Math.Min((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X);
371
                        s_point.Y = Math.Min((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y);
372
                        e_point.X = Math.Max((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X);
373
                        e_point.Y = Math.Max((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y);
374
                        rectSize = e_point - s_point;
375
                    }
376
                    break;
377
                case (ControlType.ArrowTransTextControl):
378
                    {
379
                        s_point.X = Math.Min((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X);
380
                        s_point.Y = Math.Min((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y);
381
                        e_point.X = Math.Max((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X);
382
                        e_point.Y = Math.Max((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y);
383
                        rectSize = e_point - s_point;
384
                    }
385
                    break;
386
                case (ControlType.ArrowTextBorderControl):
387
                    {
388
                        s_point.X = Math.Min((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X);
389
                        s_point.Y = Math.Min((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y);
390
                        e_point.X = Math.Max((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X);
391
                        e_point.Y = Math.Max((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y);
392
                        rectSize = e_point - s_point;
393
                    }
394
                    break;
395
                case (ControlType.ArrowTransTextBorderControl):
396
                    {
397
                        s_point.X = Math.Min((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X);
398
                        s_point.Y = Math.Min((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y);
399
                        e_point.X = Math.Max((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X);
400
                        e_point.Y = Math.Max((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y);
401
                        rectSize = e_point - s_point;
402
                    }
403
                    break;
404
                case (ControlType.ArrowTextCloudControl):
405
                    {
406
                        s_point.X = Math.Min((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X);
407
                        s_point.Y = Math.Min((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y);
408
                        e_point.X = Math.Max((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X);
409
                        e_point.Y = Math.Max((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y);
410
                        rectSize = e_point - s_point;
411
                    }
412
                    break;
413
                case (ControlType.ArrowTransTextCloudControl):
414
                    {
415
                        s_point.X = Math.Min((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X);
416
                        s_point.Y = Math.Min((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y);
417
                        e_point.X = Math.Max((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X);
418
                        e_point.Y = Math.Max((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y);
419
                        rectSize = e_point - s_point;
420
                    }
421
                    break;
422
                #endregion
423

  
424
                #region ETC
425
                case (ControlType.Date):
426
                    {
427
                        s_point.X = Math.Min((control as DateControl).StartPoint.X, (control as DateControl).EndPoint.X);
428
                        s_point.Y = Math.Min((control as DateControl).StartPoint.Y, (control as DateControl).EndPoint.Y);
429
                        e_point.X = Math.Max((control as DateControl).StartPoint.X, (control as DateControl).EndPoint.X);
430
                        e_point.Y = Math.Max((control as DateControl).StartPoint.Y, (control as DateControl).EndPoint.Y);
431
                        rectSize = e_point - s_point;
432
                    }
433
                    break;
434
                case (ControlType.ImgControl):
435
                    {
436
                        s_point.X = Math.Min((control as ImgControl).StartPoint.X, (control as ImgControl).EndPoint.X);
437
                        s_point.Y = Math.Min((control as ImgControl).StartPoint.Y, (control as ImgControl).EndPoint.Y);
438
                        e_point.X = Math.Max((control as ImgControl).StartPoint.X, (control as ImgControl).EndPoint.X);
439
                        e_point.Y = Math.Max((control as ImgControl).StartPoint.Y, (control as ImgControl).EndPoint.Y);
440
                        rectSize = e_point - s_point;
441
                    }
442
                    break;
443
                case (ControlType.Sign):
444
                    {
445
                        s_point.X = Math.Min((control as SignControl).StartPoint.X, (control as SignControl).EndPoint.X);
446
                        s_point.Y = Math.Min((control as SignControl).StartPoint.Y, (control as SignControl).EndPoint.Y);
447
                        e_point.X = Math.Max((control as SignControl).StartPoint.X, (control as SignControl).EndPoint.X);
448
                        e_point.Y = Math.Max((control as SignControl).StartPoint.Y, (control as SignControl).EndPoint.Y);
449
                        rectSize = e_point - s_point;
450
                    }
451
                    break;
452
                case (ControlType.Symbol):
453
                    {
454
                        s_point.X = Math.Min((control as SymControl).StartPoint.X, (control as SymControl).EndPoint.X);
455
                        s_point.Y = Math.Min((control as SymControl).StartPoint.Y, (control as SymControl).EndPoint.Y);
456
                        e_point.X = Math.Max((control as SymControl).StartPoint.X, (control as SymControl).EndPoint.X);
457
                        e_point.Y = Math.Max((control as SymControl).StartPoint.Y, (control as SymControl).EndPoint.Y);
458
                        rectSize = e_point - s_point;
459
                    }
460
                    break;
461
                case (ControlType.Mark):
462
                    {
463
                        s_point.X = Math.Min((control as RectangleControl).StartPoint.X, (control as RectangleControl).EndPoint.X);
464
                        s_point.Y = Math.Min((control as RectangleControl).StartPoint.Y, (control as RectangleControl).EndPoint.Y);
465
                        e_point.X = Math.Max((control as RectangleControl).StartPoint.X, (control as RectangleControl).EndPoint.X);
466
                        e_point.Y = Math.Max((control as RectangleControl).StartPoint.Y, (control as RectangleControl).EndPoint.Y);
467
                        rectSize = e_point - s_point;
468
                    }
469
                    break;
470
                case (ControlType.Stamp):
471
                    {
472
                        s_point.X = Math.Min((control as SymControlN).StartPoint.X, (control as SymControlN).EndPoint.X);
473
                        s_point.Y = Math.Min((control as SymControlN).StartPoint.Y, (control as SymControlN).EndPoint.Y);
474
                        e_point.X = Math.Max((control as SymControlN).StartPoint.X, (control as SymControlN).EndPoint.X);
475
                        e_point.Y = Math.Max((control as SymControlN).StartPoint.Y, (control as SymControlN).EndPoint.Y);
476
                        rectSize = e_point - s_point;
477
                    }
478
                    break;
479

  
480
                #endregion
481
                #region Cad
482
                case (ControlType.InsideWhite):
483
                    {
484
                        s_point.X = Math.Min((control as InsideWhiteControl).StartPoint.X, (control as InsideWhiteControl).EndPoint.X);
485
                        s_point.Y = Math.Min((control as InsideWhiteControl).StartPoint.Y, (control as InsideWhiteControl).EndPoint.Y);
486
                        e_point.X = Math.Max((control as InsideWhiteControl).StartPoint.X, (control as InsideWhiteControl).EndPoint.X);
487
                        e_point.Y = Math.Max((control as InsideWhiteControl).StartPoint.Y, (control as InsideWhiteControl).EndPoint.Y);
488
                        rectSize = e_point - s_point;
489
                    }
490
                    break;
491
                case (ControlType.OverlapWhite):
492
                    {
493
                        s_point.X = Math.Min((control as OverlapWhiteControl).StartPoint.X, (control as OverlapWhiteControl).EndPoint.X);
494
                        s_point.Y = Math.Min((control as OverlapWhiteControl).StartPoint.Y, (control as OverlapWhiteControl).EndPoint.Y);
495
                        e_point.X = Math.Max((control as OverlapWhiteControl).StartPoint.X, (control as OverlapWhiteControl).EndPoint.X);
496
                        e_point.Y = Math.Max((control as OverlapWhiteControl).StartPoint.Y, (control as OverlapWhiteControl).EndPoint.Y);
497
                        rectSize = e_point - s_point;
498
                    }
499
                    break;
500
                case (ControlType.ClipWhite):
501
                    {
502
                        s_point.X = Math.Min((control as ClipWhiteControl).StartPoint.X, (control as ClipWhiteControl).EndPoint.X);
503
                        s_point.Y = Math.Min((control as ClipWhiteControl).StartPoint.Y, (control as ClipWhiteControl).EndPoint.Y);
504
                        e_point.X = Math.Max((control as ClipWhiteControl).StartPoint.X, (control as ClipWhiteControl).EndPoint.X);
505
                        e_point.Y = Math.Max((control as ClipWhiteControl).StartPoint.Y, (control as ClipWhiteControl).EndPoint.Y);
506
                        rectSize = e_point - s_point;
507
                    }
508
                    break;
509
                case (ControlType.Coordinate):
510
                    {
511
                        s_point.X = Math.Min((control as CoordinateControl).StartPoint.X, (control as CoordinateControl).EndPoint.X);
512
                        s_point.Y = Math.Min((control as CoordinateControl).StartPoint.Y, (control as CoordinateControl).EndPoint.Y);
513
                        e_point.X = Math.Max((control as CoordinateControl).StartPoint.X, (control as CoordinateControl).EndPoint.X);
514
                        e_point.Y = Math.Max((control as CoordinateControl).StartPoint.Y, (control as CoordinateControl).EndPoint.Y);
515
                        rectSize = e_point - s_point;
516
                    }
517
                    break;
518
                    #endregion
519
            }
520
            itemRect = new Rect(s_point.X, s_point.Y, rectSize.X, rectSize.Y);
521

  
522
            return itemRect;
523
        }
524

  
525 66
        /// <summary>
526 67
        /// Control Select 여부 확인
527 68
        /// </summary>
KCOM/KCOM.csproj.user
2 2
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 3
  <PropertyGroup>
4 4
    <ReferencePath>C:\Users\Admin\Downloads\KCOM 2018-02-04(통합)\KCOM\x64\;C:\Users\Admin\Downloads\KCOM 2018-02-04(통합)\KCOM\x86\</ReferencePath>
5
    <ProjectView>ShowAllFiles</ProjectView>
5
    <ProjectView>ProjectFiles</ProjectView>
6 6
  </PropertyGroup>
7 7
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
8 8
    <StartArguments>eyJEb2N1bWVudEl0ZW1JRCI6IjQwMDAwMTQyIiwiYlBhcnRuZXIiOmZhbHNlLCJDcmVhdGVGaW5hbFBERlBlcm1pc3Npb24iOnRydWUsIk5ld0NvbW1lbnRQZXJtaXNzaW9uIjp0cnVlLCJQcm9qZWN0Tk8iOiIwMDAwMDAiLCJVc2VySUQiOiJhZG1pbiIsIk1vZGUiOjB9</StartArguments>
KCOM/Views/MainMenu.xaml.cs
2929 2929

  
2930 2930
            CommentUserInfo selected = null;
2931 2931
            double dMinDiff = double.MaxValue;
2932
            Move tmp = new Move();
2933 2932
            foreach (var item in Items)
2934 2933
            {
2935
                Rect boundingBox = tmp.ItemRect(item);
2934
                Rect boundingBox = item.ItemRect;
2936 2935
                double dx = rect.X - boundingBox.X;
2937 2936
                double dy = rect.Y - boundingBox.Y;
2938 2937
                double dxx = rect.Right - boundingBox.Right;
......
2997 2996

  
2998 2997
            foreach (var item in Items)
2999 2998
            {
3000
                Flag = move.control_Select(item, dragRect);
2999
                Flag = SelectionSet.Instance.SelectControl(item, dragRect);
3001 3000

  
3002 3001
                if (Flag)
3003 3002
                {
MarkupToPDF/Common/CommentUserInfo.cs
5 5
using System.Collections.Generic;
6 6
using System.Linq;
7 7
using System.Text;
8
using System.Windows;
8 9
using System.Windows.Media;
9 10

  
10 11
namespace MarkupToPDF.Common
......
70 71
        /// <summary>
71 72
        /// subclass has to override this property
72 73
        /// </summary>
73
        public virtual bool IsSelected{ get; set; }
74
        public virtual bool IsSelected { get; set; }
74 75

  
75 76
        /// <summary>
76 77
        /// subclass has to override this property
......
103 104
                GROUP_ID = this.GroupID
104 105
            };
105 106
        }
107

  
108
        /// <summary>
109
        /// return item's area
110
        /// </summary>
111
        public virtual Rect ItemRect
112
        {
113
            get;
114
        }
106 115
    }
107 116
}
MarkupToPDF/Controls/Cad/ClipWhiteControlcs.cs
552 552
        }
553 553

  
554 554
        /// <summary>
555
        /// return ClipWhiteControl's area
556
        /// </summary>
557
        /// <author>humkyung</author>
558
        /// <date>2019.06.13</date>
559
        public override Rect ItemRect
560
        {
561
            get
562
            {
563
                double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
564
                double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
565
                double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
566
                double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
567

  
568
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
569
            }
570
        }
571

  
572
        /// <summary>
555 573
        /// Serialize this
556 574
        /// </summary>
557 575
        /// <param name="sUserId"></param>
MarkupToPDF/Controls/Cad/CoordinateControl.cs
551 551
        }
552 552

  
553 553
        /// <summary>
554
        /// return CoordinateControl's area
555
        /// </summary>
556
        /// <author>humkyung</author>
557
        /// <date>2019.06.13</date>
558
        public override Rect ItemRect
559
        {
560
            get
561
            {
562
                double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
563
                double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
564
                double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
565
                double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
566

  
567
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
568
            }
569
        }
570

  
571
        /// <summary>
554 572
        /// Serialize this
555 573
        /// </summary>
556 574
        /// <param name="sUserId"></param>
MarkupToPDF/Controls/Cad/InsideWhiteControlcs.cs
552 552
        }
553 553

  
554 554
        /// <summary>
555
        /// return InsideWhiteControl's area
556
        /// </summary>
557
        /// <author>humkyung</author>
558
        /// <date>2019.06.13</date>
559
        public override Rect ItemRect
560
        {
561
            get
562
            {
563
                double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
564
                double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
565
                double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
566
                double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
567

  
568
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
569
            }
570
        }
571

  
572
        /// <summary>
555 573
        /// Serialize this
556 574
        /// </summary>
557 575
        /// <param name="sUserId"></param>
MarkupToPDF/Controls/Cad/OverlapWhiteControl.cs
1
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Linq;
5
using System.Text;
6
using System.Threading.Tasks;
7
using System.Windows;
8
using System.Windows.Shapes;
9
using System.Windows.Controls;
10
using System.Windows.Media;
11
using MarkupToPDF.Controls.Common;
12
using MarkupToPDF.Common;
13
using MarkupToPDF.Serialize.Core;
14
using MarkupToPDF.Serialize.S_Control;
15

  
16
namespace MarkupToPDF.Controls.Cad
17
{
18

  
19
    //강인구 추가 IShapeControl
20
    public class OverlapWhiteControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IMarkupCommonData, IShapeControl, IDashControl
21
    {
22
        public Path Base_RectPath { get; set; }
23
        private const string PART_RectPath = "PART_RectPath";
24

  
25
        #region Property
26

  
27

  
28
        public MouseMode mousemode
29
        {
30
            get
31
            {
32
                return (MouseMode)GetValue(mousemodeProperty);
33
            }
34
            set
35
            {
36
                SetValue(mousemodeProperty, value);
37
                OnPropertyChanged("mousemode");
38
            }
39
        }
40

  
41
        public SolidColorBrush StrokeColor
42
        {
43
            get
44
            {
45
                return (SolidColorBrush)GetValue(StrokeColorProperty);
46
            }
47
            set
48
            {
49
                SetValue(StrokeColorProperty, value);
50
                OnPropertyChanged("StrokeColor");
51
            }
52
        }
53

  
54
        public Double LineSize
55
        {
56
            get
57
            {
58
                return (Double)GetValue(LineSizeProperty);
59
            }
60
            set
61
            {
62
                SetValue(LineSizeProperty, value);
63
                OnPropertyChanged("LineSize");
64
            }
65
        }
66

  
67
        public Geometry PathData
68
        {
69
            get
70
            {
71
                return (Geometry)GetValue(PathDataProperty);
72
            }
73
            set
74
            {
75
                SetValue(PathDataProperty, value);
76
                OnPropertyChanged("PathData");
77
            }
78

  
79
        }
80

  
81
        public Geometry OverViewPathData
82
        {
83
            get
84
            {
85
                return (Geometry)GetValue(OverViewPathDataProperty);
86
            }
87
            set
88
            {
89
                SetValue(OverViewPathDataProperty, value);
90
                OnPropertyChanged("OverViewPathData");
91
            }
92
        }
93

  
94
        public SolidColorBrush FillColor
95
        {
96
            get { return (SolidColorBrush)GetValue(FillColorProperty); }
97
            set
98
            {
99
                SetValue(FillColorProperty, value);
100
                OnPropertyChanged("FillColor");
101
            }
102
        }
103
        //강인구 추가
104
        public DoubleCollection DashSize
105
        {
106
            get { return (DoubleCollection)GetValue(DashSizeProperty); }
107
            set
108
            {
109
                if (this.DashSize != value)
110
                {
111
                    SetValue(DashSizeProperty, value);
112
                }
113
            }
114
        }
115

  
116
        public Point StartPoint
117
        {
118
            get
119
            {
120
                return (Point)GetValue(StartPointProperty);
121
            }
122
            set
123
            {
124
                SetValue(StartPointProperty, value);
125
                OnPropertyChanged("StartPoint");
126
            }
127
        }
128

  
129
        public Point SetPoint
130
        {
131
            get
132
            {
133
                return (Point)GetValue(SetPointProperty);
134
            }
135
            set
136
            {
137
                SetValue(SetPointProperty, value);
138
                OnPropertyChanged("SetPoint");
139
            }
140
        }
141

  
142
        public Point OriginPoint
143
        {
144
            get
145
            {
146
                return (Point)GetValue(OriginPointProperty);
147
            }
148
            set
149
            {
150
                SetValue(OriginPointProperty, value);
151
                OnPropertyChanged("OriginPoint");
152
            }
153
        }
154

  
155
        public Point TopRightPoint
156
        {
157
            get
158
            {
159
                return (Point)GetValue(TopRightPointProperty);
160
            }
161
            set
162
            {
163
                SetValue(TopRightPointProperty, value);
164
                OnPropertyChanged("TopRightPoint");
165
            }
166
        }
167

  
168
        public Point LeftBottomPoint
169
        {
170
            get
171
            {
172
                return (Point)GetValue(LeftBottomPointProperty);
173
            }
174
            set
175
            {
176
                SetValue(LeftBottomPointProperty, value);
177
                OnPropertyChanged("LeftBottomPoint");
178
            }
179
        }
180

  
181
        public Point EndPoint
182
        {
183
            get
184
            {
185
                return (Point)GetValue(EndPointProperty);
186
            }
187
            set
188
            {
189
                SetValue(EndPointProperty, value);
190
                OnPropertyChanged("EndPoint");
191
            }
192
        }
193

  
194
        public override bool IsSelected
195
        {
196
            get
197
            {
198
                return (bool)GetValue(IsSelectedProperty);
199
            }
200
            set
201
            {
202
                SetValue(IsSelectedProperty, value);
203
                OnPropertyChanged("IsSelected");
204
            }
205
        }
206

  
207
        public ControlType ControlType
208
        {
209
            set
210
            {
211
                SetValue(ControlTypeProperty, value);
212
                OnPropertyChanged("ControlType");
213
            }
214
            get
215
            {
216
                return (ControlType)GetValue(ControlTypeProperty);
217
            }
218
        }
219

  
220
        public List<Point> PointSet
221
        {
222
            get { return (List<Point>)GetValue(PointSetProperty); }
223
            set { SetValue(PointSetProperty, value); }
224
        }
225

  
226

  
227
        public double CanvasX
228
        {
229
            get { return (double)GetValue(CanvasXProperty); }
230
            set
231
            {
232
                if (this.CanvasX != value)
233
                {
234
                    SetValue(CanvasXProperty, value);
235
                    OnPropertyChanged("CanvasX");
236
                }
237
            }
238
        }
239

  
240
        public double CanvasY
241
        {
242
            get { return (double)GetValue(CanvasYProperty); }
243
            set
244
            {
245
                if (this.CanvasY != value)
246
                {
247
                    SetValue(CanvasYProperty, value);
248
                    OnPropertyChanged("CanvasY");
249
                }
250
            }
251
        }
252

  
253
        public PaintSet Paint
254
        {
255
            get { return (PaintSet)GetValue(PaintProperty); }
256
            set
257
            {
258
                if (this.Paint != value)
259
                {
260
                    SetValue(PaintProperty, value);
261
                }
262
            }
263
        }
264

  
265
        public double Angle
266
        {
267
            get { return (double)GetValue(AngleProperty); }
268
            set
269
            {
270
                if (this.Angle != value)
271
                {
272
                    SetValue(AngleProperty, value);
273
                }
274
            }
275
        }
276
        public string UserID
277
        {
278
            get { return (string)GetValue(UserIDProperty); }
279
            set
280
            {
281
                if (this.UserID != value)
282
                {
283
                    SetValue(UserIDProperty, value);
284
                    OnPropertyChanged("UserID");
285
                }
286
            }
287
        }
288

  
289
        #endregion
290

  
291
        #region Dependency Property
292

  
293

  
294
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
295
        "UserID", typeof(string), typeof(OverlapWhiteControl), new PropertyMetadata(null));
296

  
297
        public static readonly DependencyProperty mousemodeProperty =
298
                DependencyProperty.Register("mousemode", typeof(MouseMode), typeof(OverlapWhiteControl), new PropertyMetadata(MouseMode.None, PointValueChanged));
299

  
300
        public static readonly DependencyProperty IsSelectedProperty =
301
          DependencyProperty.Register("IsSelected", typeof(bool), typeof(OverlapWhiteControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
302

  
303
        public static readonly DependencyProperty ControlTypeProperty =
304
                DependencyProperty.Register("ControlType", typeof(ControlType), typeof(OverlapWhiteControl), new FrameworkPropertyMetadata(ControlType.OverlapWhite));
305

  
306
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
307
                "StrokeColor", typeof(SolidColorBrush), typeof(OverlapWhiteControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
308

  
309
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
310
              "LineSize", typeof(double), typeof(OverlapWhiteControl), new PropertyMetadata((Double)3));
311

  
312
        //강인구 추가
313
        public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register(
314
                "DashSize", typeof(DoubleCollection), typeof(OverlapWhiteControl), new PropertyMetadata(new DoubleCollection { 1, 1 }, PointValueChanged));
315
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
316
               "PathData", typeof(Geometry), typeof(OverlapWhiteControl), null);
317

  
318
        public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
319
               "OverViewPathData", typeof(Geometry), typeof(OverlapWhiteControl), null);
320

  
321
        //강인구 추가
322
        public static readonly DependencyProperty PaintProperty = DependencyProperty.Register(
323
        "Paint", typeof(PaintSet), typeof(OverlapWhiteControl), new PropertyMetadata(PaintSet.None, PointValueChanged));
324

  
325

  
326
        public static readonly DependencyProperty FillColorProperty = DependencyProperty.Register(
327
                "FillColor", typeof(SolidColorBrush), typeof(OverlapWhiteControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
328

  
329
        public static readonly DependencyProperty CanvasXProperty = DependencyProperty.Register(
330
                 "CanvasX", typeof(double), typeof(OverlapWhiteControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
331

  
332
        public static readonly DependencyProperty CanvasYProperty = DependencyProperty.Register(
333
                "CanvasY", typeof(double), typeof(OverlapWhiteControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
334

  
335
        public static readonly DependencyProperty TopRightPointProperty = DependencyProperty.Register(
336
               "TopRightPoint", typeof(Point), typeof(OverlapWhiteControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
337

  
338
        public static readonly DependencyProperty LeftBottomPointProperty = DependencyProperty.Register(
339
                 "LeftBottomPoint", typeof(Point), typeof(OverlapWhiteControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
340

  
341
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
342
            "StartPoint", typeof(Point), typeof(OverlapWhiteControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
343

  
344
        public static readonly DependencyProperty SetPointProperty = DependencyProperty.Register(
345
        "SetPoint", typeof(Point), typeof(OverlapWhiteControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
346

  
347
        public static readonly DependencyProperty OriginPointProperty = DependencyProperty.Register(
348
        "OriginPoint", typeof(Point), typeof(OverlapWhiteControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
349
        public static readonly DependencyProperty AngleProperty = DependencyProperty.Register(
350
            "Angle", typeof(double), typeof(OverlapWhiteControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged)));
351
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
352
         "PointSet", typeof(List<Point>), typeof(OverlapWhiteControl), new PropertyMetadata(new List<Point>()));
353

  
354
        public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
355
              "EndPoint", typeof(Point), typeof(OverlapWhiteControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
356

  
357
        #endregion  Dependency Property
358

  
359
        #region Dependency PropertyChanged
360
        public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
361
        {
362
            var instance = (OverlapWhiteControl)sender;
363

  
364
            if (e.OldValue != e.NewValue && instance != null)
365
            {
366
                instance.SetValue(e.Property, e.NewValue);
367
                Canvas.SetLeft(instance, instance.SetPoint.X);
368
                Canvas.SetTop(instance, instance.SetPoint.Y);
369
                //Canvas.SetLeft(instance, instance.CanvasX);
370
                //Canvas.SetTop(instance, instance.CanvasY);
371
            }
372
        }
373

  
374

  
375
        public static void OnUpdateChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
376
        {
377
            var instance = (OverlapWhiteControl)sender;
378

  
379
            if (e.OldValue != e.NewValue && instance != null)
380
            {
381
                instance.SetValue(e.Property, e.NewValue);
382
                instance.SetRectPath();
383
            }
384
        }
385

  
386
        public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
387
        {
388
            var instance = (OverlapWhiteControl)sender;
389
            if (e.OldValue != e.NewValue && instance.Base_RectPath != null)
390
            {
391
                instance.SetValue(e.Property, e.NewValue);
392
                instance.SetRectPath();
393
            }
394
        }
395

  
396
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
397
        {
398
            //var instance = (OverlapWhiteControl)sender;
399

  
400
            //if (e.OldValue != e.NewValue && instance.Base_RectPath != null)
401
            //{
402
            //    instance.SetValue(e.Property, e.NewValue);
403

  
404
            //    if (instance.IsSelected)
405
            //    {
406
            //        instance.Base_RectPath.Stroke = new SolidColorBrush(Colors.Blue);
407
            //    }
408
            //    else
409
            //    {
410
            //        instance.Base_RectPath.Stroke = new SolidColorBrush(Colors.Red);
411
            //    }
412
            //}
413
        }
414

  
415
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
416
        {
417
            var instance = (OverlapWhiteControl)sender;
418

  
419
            if (e.OldValue != e.NewValue && instance.Base_RectPath != null)
420
            {
421
                instance.SetValue(e.Property, e.NewValue);
422
                instance.SetRectPath();
423
            }
424
        }
425
        #endregion Dependency PropertyChanged
426

  
427
        public void SetRectPath()
428
        {
429
            this.ApplyTemplate();
430

  
431
            if (Base_RectPath != null)
432
            {
433
                //강인구 추가
434
                Base_RectPath.StrokeDashArray.Clear();
435
                if (DashSize != null)
436
                {
437
                    foreach (var item in this.DashSize)
438
                    {
439
                        Base_RectPath.StrokeDashArray.Add(item);
440
                    }
441
                    Base_RectPath.StrokeDashCap = PenLineCap.Square;
442
                }
443

  
444
                PathFigure pathFigure = new PathFigure
445
                {
446
                    IsClosed = true
447
                };
448

  
449
                if (ControlType == ControlType.OverlapWhite)
450
                {
451
                    switch (this.Paint)
452
                    {
453
                        case PaintSet.None:
454
                            this.FillColor = null;
455
                            pathFigure.IsFilled = false;
456
                            break;
457
                        default:
458
                            {
459

  
460
                            }
461
                            break;
462
                    }
463
                }
464

  
465
                pathFigure.StartPoint = this.StartPoint;
466

  
467
                LineSegment lineSegment1 = new LineSegment();
468
                lineSegment1.Point = this.LeftBottomPoint;
469
                pathFigure.Segments.Add(lineSegment1);
470

  
471
                LineSegment lineSegment2 = new LineSegment();
472
                lineSegment2.Point = this.EndPoint;
473
                pathFigure.Segments.Add(lineSegment2);
474

  
475
                LineSegment lineSegment3 = new LineSegment();
476
                lineSegment3.Point = this.TopRightPoint;
477
                pathFigure.Segments.Add(lineSegment3);
478

  
479
                LineSegment lineSegment0 = new LineSegment();
480
                lineSegment0.Point = this.StartPoint;
481
                pathFigure.Segments.Add(lineSegment0);
482

  
483
                PathGeometry pathGeometry = new PathGeometry();
484
                pathGeometry.Figures = new PathFigureCollection();
485
                pathGeometry.Figures.Add(pathFigure);
486

  
487

  
488
                //Base_RectPath.StrokeThickness = 3;
489
                this.FillColor = null;
490
                this.PathData = pathGeometry;
491
                ApplyOverViewData();
492
                //OverViewPathData = PathData;
493
                //AdornerControl adornerControl = new Adorner.AdornerControl();
494
                ////adornerControl
495

  
496
                //adornerControl.Content = pathGeometry;
497

  
498
            }
499
        }
500

  
501
        public void ApplyOverViewData()
502
        {
503
            this.OverViewPathData = this.PathData;
504
        }
505

  
506
        #region Internal Method
507

  
508

  
509
        static OverlapWhiteControl()
510
        {
511
            DefaultStyleKeyProperty.OverrideMetadata(typeof(OverlapWhiteControl), new FrameworkPropertyMetadata(typeof(OverlapWhiteControl)));
512
            ResourceDictionary dictionary = new ResourceDictionary();
513
            dictionary.Source = new Uri("/MarkupToPDF;component/themes/generic.xaml", UriKind.RelativeOrAbsolute);
514
            Application.Current.Resources.MergedDictionaries.Add(dictionary);
515
        }
516

  
517

  
518
        public override void OnApplyTemplate()
519
        {
520
            base.OnApplyTemplate();
521

  
522
            Base_RectPath = GetTemplateChild(PART_RectPath) as Path;
523

  
524

  
525
            if (Base_RectPath == null)
526
                return;
527

  
528
            SetRectPath();
529
            Base_RectPath.Focus();
530
        }
531

  
532
        public void updateControl()
533
        {
534
            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
535
            this.LeftBottomPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
536
            this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y);
537
            this.TopRightPoint = new Point(this.PointSet[3].X, this.PointSet[3].Y);
538
        }
539

  
540
        private void OnPropertyChanged(string name)
541
        {
542
            if (PropertyChanged != null)
543
            {
544
                PropertyChanged(this, new PropertyChangedEventArgs(name));
545
            }
546
        }
547

  
548
        public void ChangePaint(PaintSet state)
549
        {
550
            this.Paint = state;
551
            this.SetRectPath();
552
        }
553

  
554
        /// <summary>
555
        /// return OverlapWhiteControl's area
556
        /// </summary>
557
        /// <author>humkyung</author>
558
        /// <date>2019.06.13</date>
559
        public override Rect ItemRect
560
        {
561
            get
562
            {
563
                double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
564
                double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
565
                double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
566
                double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
567

  
568
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
569
            }
570
        }
571

  
572
        /// <summary>
573
        /// Serialize this
574
        /// </summary>
575
        /// <param name="sUserId"></param>
576
        /// <returns></returns>
577
        public override string Serialize()
578
        {
579
            using (S_OverlapWhiteControl STemp = new S_OverlapWhiteControl())
580
            {
581
                STemp.TransformPoint = "0|0";
582
                STemp.SizeSet = String.Format("{0}", this.LineSize);
583
                STemp.PaintState = this.Paint;
584
                STemp.PointSet = this.PointSet;
585
                //STemp.StrokeColor = "#FF00FF00";
586
                STemp.StrokeColor = this.StrokeColor.Color.ToString();
587
                if (this.FillColor != null)
588
                {
589
                    STemp.FillColor = this.FillColor.Color.ToString();
590
                }
591
                STemp.StartPoint = this.StartPoint;
592
                STemp.UserID = this.UserID;
593
                STemp.EndPoint = this.EndPoint;
594
                STemp.LB = this.LeftBottomPoint;
595
                STemp.TR = this.TopRightPoint;
596
                STemp.DashSize = this.DashSize;
597
                STemp.Opac = this.Opacity;
598
                STemp.Name = this.GetType().Name.ToString();
599
                STemp.Memo = this.Memo;
600

  
601
                return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize()));
602
            };
603
        }
604

  
605
        /// <summary>
606
        /// create a OverlapWhiteControl from given string
607
        /// </summary>
608
        /// <param name="str"></param>
609
        /// <returns></returns>
610
        public static OverlapWhiteControl FromString(string str, SolidColorBrush brush, string sProjectNo)
611
        {
612
            using (S_OverlapWhiteControl s = JsonSerializerHelper.JsonDeserialize<S_OverlapWhiteControl>(str))
613
            {
614
                string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
615
                return new OverlapWhiteControl
616
                {
617
                    LineSize = Convert.ToDouble(data2.First()),
618
                    Paint = s.PaintState,
619
                    StartPoint = s.StartPoint,
620
                    EndPoint = s.EndPoint,
621
                    Angle = s.Angle,
622
                    StrokeColor = Brushes.White,
623
                    DashSize = s.DashSize,
624
                    Opacity = s.Opac,
625
                    LeftBottomPoint = s.LB,
626
                    TopRightPoint = s.TR,
627
                    PointSet = s.PointSet,
628
                    UserID = s.UserID,
629
                    FillColor = Brushes.White,
630
                    Memo = s.Memo
631
                };
632
            }
633
        }
634

  
635
        public event PropertyChangedEventHandler PropertyChanged;
636

  
637
        public void Dispose()
638
        {
639
            GC.Collect();
640
            GC.SuppressFinalize(this);
641
        }
642
        #endregion Internal Method
643
    }
644
}
MarkupToPDF/Controls/Cad/OverlapWhiteControlcs.cs
1
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Linq;
5
using System.Text;
6
using System.Threading.Tasks;
7
using System.Windows;
8
using System.Windows.Shapes;
9
using System.Windows.Controls;
10
using System.Windows.Media;
11
using MarkupToPDF.Controls.Common;
12
using MarkupToPDF.Common;
13
using MarkupToPDF.Serialize.Core;
14
using MarkupToPDF.Serialize.S_Control;
15

  
16
namespace MarkupToPDF.Controls.Cad
17
{
18

  
19
    //강인구 추가 IShapeControl
20
    public class OverlapWhiteControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IMarkupCommonData, IShapeControl, IDashControl
21
    {
22
        public Path Base_RectPath { get; set; }
23
        private const string PART_RectPath = "PART_RectPath";
24

  
25
        #region Property
26

  
27

  
28
        public MouseMode mousemode
29
        {
30
            get
31
            {
32
                return (MouseMode)GetValue(mousemodeProperty);
33
            }
34
            set
35
            {
36
                SetValue(mousemodeProperty, value);
37
                OnPropertyChanged("mousemode");
38
            }
39
        }
40

  
41
        public SolidColorBrush StrokeColor
42
        {
43
            get
44
            {
45
                return (SolidColorBrush)GetValue(StrokeColorProperty);
46
            }
47
            set
48
            {
49
                SetValue(StrokeColorProperty, value);
50
                OnPropertyChanged("StrokeColor");
51
            }
52
        }
53

  
54
        public Double LineSize
55
        {
56
            get
57
            {
58
                return (Double)GetValue(LineSizeProperty);
59
            }
60
            set
61
            {
62
                SetValue(LineSizeProperty, value);
63
                OnPropertyChanged("LineSize");
64
            }
65
        }
66

  
67
        public Geometry PathData
68
        {
69
            get
70
            {
71
                return (Geometry)GetValue(PathDataProperty);
72
            }
73
            set
74
            {
75
                SetValue(PathDataProperty, value);
76
                OnPropertyChanged("PathData");
77
            }
78

  
79
        }
80

  
81
        public Geometry OverViewPathData
82
        {
83
            get
84
            {
85
                return (Geometry)GetValue(OverViewPathDataProperty);
86
            }
87
            set
88
            {
89
                SetValue(OverViewPathDataProperty, value);
90
                OnPropertyChanged("OverViewPathData");
91
            }
92
        }
93

  
94
        public SolidColorBrush FillColor
95
        {
96
            get { return (SolidColorBrush)GetValue(FillColorProperty); }
97
            set
98
            {
99
                SetValue(FillColorProperty, value);
100
                OnPropertyChanged("FillColor");
101
            }
102
        }
103
        //강인구 추가
104
        public DoubleCollection DashSize
105
        {
106
            get { return (DoubleCollection)GetValue(DashSizeProperty); }
107
            set
108
            {
109
                if (this.DashSize != value)
110
                {
111
                    SetValue(DashSizeProperty, value);
112
                }
113
            }
114
        }
115

  
116
        public Point StartPoint
117
        {
118
            get
119
            {
120
                return (Point)GetValue(StartPointProperty);
121
            }
122
            set
123
            {
124
                SetValue(StartPointProperty, value);
125
                OnPropertyChanged("StartPoint");
126
            }
127
        }
128

  
129
        public Point SetPoint
130
        {
131
            get
132
            {
133
                return (Point)GetValue(SetPointProperty);
134
            }
135
            set
... 이 차이점은 표시할 수 있는 최대 줄수를 초과해서 이 차이점은 잘렸습니다.

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)