개정판 8c3a888c
issue #1027 web service roll back
Change-Id: I16486234f4e8a940dea38e9877bb122652a09108
FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.cs | ||
---|---|---|
2 | 2 |
using iTextSharp.text.pdf; |
3 | 3 |
using KCOMDataModel.Common; |
4 | 4 |
using KCOMDataModel.DataModel; |
5 |
using MarkupToPDF.Common; |
|
6 | 5 |
using MarkupToPDF.Controls.Common; |
7 | 6 |
using MarkupToPDF.Serialize.Core; |
8 | 7 |
using MarkupToPDF.Serialize.S_Control; |
... | ... | |
29 | 28 |
private string _FinalPDFStorgeLocal = null; |
30 | 29 |
private string _FinalPDFStorgeRemote = null; |
31 | 30 |
private string OriginFileName = null; |
32 |
public CommonLib.MARKUS_API.FINAL_PDF FinalItem;
|
|
33 |
public CommonLib.MARKUS_API.DOCINFO DocInfoItem = null;
|
|
34 |
public List<CommonLib.MARKUS_API.DOCPAGE> DocPageItem = null;
|
|
35 |
public CommonLib.MARKUS_API.MARKUP_INFO MarkupInfoItem = null;
|
|
36 |
public List<CommonLib.MARKUS_API.MARKUP_DATA> MarkupDataSet = null;
|
|
31 |
public FINAL_PDF FinalItem; |
|
32 |
public DOCINFO DocInfoItem = null; |
|
33 |
public List<DOCPAGE> DocPageItem = null; |
|
34 |
public MARKUP_INFO MarkupInfoItem = null; |
|
35 |
public List<MARKUP_DATA> MarkupDataSet = null; |
|
37 | 36 |
//private string _PrintPDFStorgeLocal = null; |
38 | 37 |
//private string _PrintPDFStorgeRemote = null; |
39 | 38 |
public event EventHandler<MakeFinalErrorArgs> FinalMakeError; |
... | ... | |
69 | 68 |
return false; |
70 | 69 |
} |
71 | 70 |
|
72 |
private void SetNotice(string finalID , string message)
|
|
71 |
private void SetNotice(string finalID, string message) |
|
73 | 72 |
{ |
74 | 73 |
if (FinalMakeError != null) |
75 | 74 |
{ |
... | ... | |
110 | 109 |
return (size / scaleWidth); |
111 | 110 |
} |
112 | 111 |
|
113 |
public List<Point> GetPdfPointSystem(List<Point> point)
|
|
112 |
public List<Point> GetPdfPointSystem(List<Point> point) |
|
114 | 113 |
{ |
115 | 114 |
List<Point> dummy = new List<Point>(); |
116 | 115 |
foreach (var item in point) |
... | ... | |
138 | 137 |
#region 생성자 & 소멸자 |
139 | 138 |
public void MakeFinalPDF(object _FinalPDF) |
140 | 139 |
{ |
141 |
|
|
142 |
CommonLib.MARKUS_API.DOCUMENT_ITEM documentItem;
|
|
143 |
CommonLib.MARKUS_API.FINAL_PDF FinalPDF = (CommonLib.MARKUS_API.FINAL_PDF)_FinalPDF;
|
|
140 |
|
|
141 |
DOCUMENT_ITEM documentItem; |
|
142 |
FINAL_PDF FinalPDF = (FINAL_PDF)_FinalPDF;
|
|
144 | 143 |
FinalItem = FinalPDF; |
145 | 144 |
|
146 | 145 |
|
... | ... | |
150 | 149 |
#region 문서 경로를 가져오는 것과 Status를 Create (1단계) 로 수정 |
151 | 150 |
try |
152 | 151 |
{ |
153 |
using (DataController dc = new DataController())
|
|
152 |
using (KCOMEntities _entity = new KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
|
|
154 | 153 |
{ |
155 |
var _properties = dc.GetProperties(FinalPDF.PROJECT_NO); |
|
156 |
if(_properties != null) |
|
154 |
var _properties = _entity.PROPERTIES.Where(pro => pro.PROPERTY == FinalPDF.PROJECT_NO); |
|
155 |
|
|
156 |
if (_properties.Count() > 0) |
|
157 | 157 |
{ |
158 |
PdfFilePathRoot = _properties.Where(t => t.TYPE == PropertiesType.Const_TileSorcePath).FirstOrDefault().VALUE;
|
|
158 |
PdfFilePathRoot = _properties.Where(t => t.TYPE == PropertiesType.Const_TileSorcePath).First().VALUE; |
|
159 | 159 |
_FinalPDFStorgeLocal = _properties.Where(t => t.TYPE == PropertiesType.Const_FinalPDFStorgeLocal).First().VALUE; |
160 | 160 |
_FinalPDFStorgeRemote = _properties.Where(t => t.TYPE == PropertiesType.Const_FinalPDFStorgeRemote).First().VALUE; |
161 | 161 |
} |
... | ... | |
164 | 164 |
SetNotice(FinalPDF.ID, "프로퍼티를 가지고 올 수 없습니다."); |
165 | 165 |
return; |
166 | 166 |
} |
167 |
dc.SetFinalStatus(FinalPDF.ID, CommonLib.MARKUS_API.FinalStatus.Create); |
|
168 |
} |
|
167 |
|
|
168 |
var finalList = _entity.FINAL_PDF.Where(final => final.ID == FinalPDF.ID); |
|
169 |
|
|
170 |
if (finalList.Count() > 0) |
|
171 |
{ |
|
172 |
finalList.FirstOrDefault().START_DATETIME = DateTime.Now; |
|
173 |
finalList.FirstOrDefault().STATUS = (int)FinalStatus.Create; |
|
174 |
_entity.SaveChanges(); |
|
175 |
} |
|
176 |
} |
|
169 | 177 |
} |
170 | 178 |
catch (Exception ex) |
171 | 179 |
{ |
... | ... | |
177 | 185 |
#region 문서 복사 |
178 | 186 |
try |
179 | 187 |
{ |
180 |
using (DataController dc = new DataController())
|
|
188 |
using (CIEntities _entity = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(FinalPDF.PROJECT_NO).ToString()))
|
|
181 | 189 |
{ |
182 |
//var _DOCINFO = _entity.DOCINFO.Where(doc => doc.ID == FinalPDF.DOCINFO_ID); |
|
183 |
string project_no = FinalPDF.PROJECT_NO; |
|
184 |
string docinfo_id = FinalPDF.DOCINFO_ID; |
|
190 |
var _DOCINFO = _entity.DOCINFO.Where(doc => doc.ID == FinalPDF.DOCINFO_ID); |
|
185 | 191 |
|
186 |
var _DOCINFO = dc.GetDocInfo(project_no, docinfo_id); |
|
187 |
if (_DOCINFO != null) |
|
192 |
if (_DOCINFO.Count() > 0) |
|
188 | 193 |
{ |
189 |
DocInfoItem = _DOCINFO; |
|
190 |
DocPageItem = dc.GetDocpage(project_no, docinfo_id);
|
|
194 |
DocInfoItem = _DOCINFO.FirstOrDefault();
|
|
195 |
DocPageItem = DocInfoItem.DOCPAGE.ToList();
|
|
191 | 196 |
|
192 | 197 |
PdfFilePathRoot = PdfFilePathRoot + @"\" + FinalPDF.PROJECT_NO + "_Tile" + @"\" |
193 | 198 |
+ (System.Convert.ToInt64(FinalPDF.DOCUMENT_ID) / 100).ToString() |
194 | 199 |
+ @"\" + FinalPDF.DOCUMENT_ID + @"\"; |
195 | 200 |
|
196 |
MarkupInfoItem = dc.GetMarkupInfo(project_no, docinfo_id);
|
|
201 |
MarkupInfoItem = DocInfoItem.MARKUP_INFO.Where(data => data.CONSOLIDATE == 1 && data.AVOID_CONSOLIDATE == 0 && data.PART_CONSOLIDATE == 0).FirstOrDefault();
|
|
197 | 202 |
|
198 | 203 |
if (MarkupInfoItem == null) |
199 | 204 |
{ |
... | ... | |
201 | 206 |
} |
202 | 207 |
else |
203 | 208 |
{ |
204 |
MarkupDataSet = dc.GetMarkupData(project_no, docinfo_id); |
|
205 |
if (MarkupDataSet == null) |
|
209 |
if (MarkupInfoItem.MARKUP_INFO_VERSION.Count > 0) |
|
210 |
{ |
|
211 |
MarkupDataSet = MarkupInfoItem.MARKUP_INFO_VERSION.OrderBy(d => d.CREATE_DATE).LastOrDefault().MARKUP_DATA.ToList().OrderBy(d => d.PAGENUMBER).ToList(); |
|
212 |
} |
|
213 |
else |
|
206 | 214 |
{ |
207 | 215 |
throw new Exception("MARKUP_INFO_VERSION 이 존재 하지 않습니다"); |
208 |
} |
|
209 |
} |
|
210 |
documentItem = dc.GetDocumentItem(project_no, DocInfoItem.DOCUMENT_ID); |
|
211 |
if (documentItem == null) |
|
212 |
{ |
|
213 |
throw new Exception("DocInfo와 DocumentItem의 documentItemID가 같지 않습니다. 데이터를 확인해주세요"); |
|
216 |
} |
|
214 | 217 |
} |
215 |
var _files = new DirectoryInfo(PdfFilePathRoot).GetFiles("*.pdf"); //해당 폴더에 파일을 |
|
216 | 218 |
|
217 |
#region 파일 체크 |
|
218 |
if (_files.Count() == 1) |
|
219 |
using (CIEntities _ci_Internal = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(FinalPDF.PROJECT_NO).ToString())) |
|
219 | 220 |
{ |
220 |
if (_files.First().Name.ToLower() == GetFileName(HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE).ToLower())) |
|
221 |
documentItem = _ci_Internal.DOCUMENT_ITEM.Where(data => data.DOCUMENT_ID == DocInfoItem.DOCUMENT_ID).FirstOrDefault(); |
|
222 |
if (documentItem == null) |
|
221 | 223 |
{ |
222 |
OriginFileName = _files.First().Name; |
|
223 |
PdfFilePath = _files.First().CopyTo(TestFile, true); |
|
224 |
throw new Exception("DocInfo와 DocumentItem의 documentItemID가 같지 않습니다. 데이터를 확인해주세요"); |
|
224 | 225 |
} |
225 |
else |
|
226 |
|
|
227 |
var _files = new DirectoryInfo(PdfFilePathRoot).GetFiles("*.pdf"); //해당 폴더에 파일을 |
|
228 |
|
|
229 |
#region 파일 체크 |
|
230 |
if (_files.Count() == 1) |
|
226 | 231 |
{ |
227 |
throw new Exception("현재 폴더 내 파일명이 데이터베이스와 상이합니다.filename:" + _files.First().Name.ToLower() + ",url:" + HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE).ToLower()); |
|
232 |
if (_files.First().Name.ToLower() == GetFileName(HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE).ToLower())) |
|
233 |
{ |
|
234 |
OriginFileName = _files.First().Name; |
|
235 |
PdfFilePath = _files.First().CopyTo(TestFile, true); |
|
236 |
} |
|
237 |
else |
|
238 |
{ |
|
239 |
throw new Exception("현재 폴더 내 파일명이 데이터베이스와 상이합니다.filename:" + _files.First().Name.ToLower() + ",url:" + HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE).ToLower()); |
|
240 |
} |
|
228 | 241 |
} |
229 |
} |
|
230 |
else if (_files.Count() > 1) |
|
231 |
{ |
|
232 |
var originalFile = _files.Where(data => data.Name == GetFileName(HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE))).FirstOrDefault(); |
|
233 |
|
|
234 |
if (originalFile == null) |
|
242 |
else if (_files.Count() > 1) |
|
235 | 243 |
{ |
236 |
throw new Exception("해당 폴더에 복수로 PDF들 존재하고 document_Item의 문서는 존재하지 않습니다"); |
|
244 |
var originalFile = _files.Where(data => data.Name == GetFileName(HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE))).FirstOrDefault(); |
|
245 |
|
|
246 |
if (originalFile == null) |
|
247 |
{ |
|
248 |
throw new Exception("해당 폴더에 복수로 PDF들 존재하고 document_Item의 문서는 존재하지 않습니다"); |
|
249 |
} |
|
250 |
else |
|
251 |
{ |
|
252 |
OriginFileName = originalFile.Name; |
|
253 |
PdfFilePath = originalFile.CopyTo(TestFile, true); |
|
254 |
} |
|
237 | 255 |
} |
238 | 256 |
else |
239 | 257 |
{ |
240 |
OriginFileName = originalFile.Name; |
|
241 |
PdfFilePath = originalFile.CopyTo(TestFile, true); |
|
258 |
throw new Exception("PDF를 찾지 못하였습니다"); |
|
242 | 259 |
} |
243 |
} |
|
244 |
else |
|
245 |
{ |
|
246 |
throw new Exception("PDF를 찾지 못하였습니다"); |
|
247 |
} |
|
248 |
#endregion |
|
260 |
#endregion |
|
249 | 261 |
|
250 |
#region 예외처리 |
|
251 |
if (PdfFilePath == null) |
|
252 |
{ |
|
253 |
throw new Exception("작업에 필요한 PDF가 정상적으로 복사되지 않았거나 DB정보가 상이합니다"); |
|
254 |
} |
|
255 |
if (!PdfFilePath.Exists) |
|
256 |
{ |
|
257 |
throw new Exception("PDF원본이 존재하지 않습니다"); |
|
262 |
#region 예외처리 |
|
263 |
if (PdfFilePath == null) |
|
264 |
{ |
|
265 |
throw new Exception("작업에 필요한 PDF가 정상적으로 복사되지 않았거나 DB정보가 상이합니다"); |
|
266 |
} |
|
267 |
if (!PdfFilePath.Exists) |
|
268 |
{ |
|
269 |
throw new Exception("PDF원본이 존재하지 않습니다"); |
|
270 |
} |
|
271 |
#endregion |
|
258 | 272 |
} |
259 |
#endregion |
|
260 | 273 |
} |
261 | 274 |
else |
262 | 275 |
{ |
263 | 276 |
throw new Exception("일치하는 DocInfo가 없습니다"); |
264 | 277 |
} |
265 | 278 |
} |
266 |
|
|
267 |
|
|
268 | 279 |
} |
269 | 280 |
catch (Exception ex) |
270 | 281 |
{ |
... | ... | |
285 | 296 |
|
286 | 297 |
try |
287 | 298 |
{ |
288 |
TestFile = SetFlattingPDF(TestFile); |
|
289 |
SetStampInPDF(FinalItem, TestFile, MarkupInfoItem); |
|
290 | 299 |
|
291 |
if (EndFinal != null) |
|
300 |
using (KCOMEntities _entity = new KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
301 |
{ |
|
302 |
var finalList = _entity.FINAL_PDF.Where(final => final.ID == FinalPDF.ID); |
|
303 |
|
|
304 |
if (finalList.Count() > 0) |
|
292 | 305 |
{ |
293 |
EndFinal(this, new EndFinalEventArgs |
|
294 |
{ |
|
295 |
OriginPDFName = OriginFileName, |
|
296 |
FinalPDFPath = FinalPDFPath.FullName, |
|
297 |
Error = "", |
|
298 |
Message = "", |
|
299 |
FinalPDF = FinalPDF, |
|
300 |
}); |
|
306 |
TestFile = SetFlattingPDF(TestFile); |
|
307 |
//finalList.FirstOrDefault().STATUS = (int)FinalStatus.Insert; |
|
308 |
//_entity.SaveChanges(); |
|
309 |
|
|
310 |
SetStampInPDF(FinalItem, TestFile, MarkupInfoItem); |
|
311 |
//finalList.FirstOrDefault().STATUS = (int)FinalStatus.PdfStamp; |
|
312 |
//_entity.SaveChanges(); |
|
301 | 313 |
} |
314 |
} |
|
315 |
if (EndFinal != null) |
|
316 |
{ |
|
317 |
EndFinal(this, new EndFinalEventArgs |
|
318 |
{ |
|
319 |
OriginPDFName = OriginFileName, |
|
320 |
FinalPDFPath = FinalPDFPath.FullName, |
|
321 |
Error = "", |
|
322 |
Message = "", |
|
323 |
FinalPDF = FinalPDF, |
|
324 |
}); |
|
325 |
} |
|
302 | 326 |
} |
303 | 327 |
catch (Exception ex) |
304 | 328 |
{ |
... | ... | |
311 | 335 |
#region PDF |
312 | 336 |
public static float scaleWidth = 0; |
313 | 337 |
public static float scaleHeight = 0; |
314 |
|
|
338 |
|
|
315 | 339 |
private string SetFlattingPDF(string tempFileInfo) |
316 | 340 |
{ |
317 | 341 |
if (File.Exists(tempFileInfo)) |
... | ... | |
324 | 348 |
var mediaBox = pdfReader.GetPageSize(i); |
325 | 349 |
var cropbox = pdfReader.GetCropBox(i); |
326 | 350 |
|
351 |
//using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString().ToString())) |
|
352 |
//{ |
|
353 |
// _entity.DOCPAGE.Where(d=>d.DOCINFO_ID == DocInfoItem.DOCPAGE) |
|
354 |
//} |
|
327 | 355 |
var currentPage = DocPageItem.Where(d => d.PAGE_NUMBER == i).FirstOrDefault(); |
328 | 356 |
|
357 |
//scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / mediaBox.Width; |
|
358 |
//scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / mediaBox.Height; |
|
359 |
//scaleWidth = 2.0832634F; |
|
360 |
//scaleHeight = 3.0F; |
|
361 |
|
|
329 | 362 |
PdfRectangle rect = new PdfRectangle(cropbox, pdfReader.GetPageRotation(i)); |
363 |
//강인구 수정 |
|
364 |
//if (cropbox != null && (cropbox.Width < mediaBox.Width || cropbox.Height < cropbox.Height)) |
|
365 |
//if (cropbox != null && (cropbox.Width < mediaBox.Width || cropbox.Height < mediaBox.Height)) |
|
366 |
//{ |
|
367 |
// var pageDict = pdfReader.GetPageN(i); |
|
368 |
// pageDict.Put(PdfName.MEDIABOX, rect); |
|
369 |
//} |
|
330 | 370 |
} |
331 | 371 |
|
332 | 372 |
var memStream = new MemoryStream(); |
... | ... | |
366 | 406 |
var array = memStream.ToArray(); |
367 | 407 |
File.WriteAllBytes(dest, array); |
368 | 408 |
} |
369 |
|
|
370 |
public bool SetStampInPDF(CommonLib.MARKUS_API.FINAL_PDF finaldata, string testFile, CommonLib.MARKUS_API.MARKUP_INFO markupInfo)
|
|
409 |
|
|
410 |
public bool SetStampInPDF(FINAL_PDF finaldata, string testFile, MARKUP_INFO markupInfo)
|
|
371 | 411 |
{ |
372 | 412 |
string pdfFilePath = null; |
373 |
|
|
413 |
List<MEMBER> memberlist = null; |
|
374 | 414 |
FileInfo tempFileInfo = new FileInfo(testFile); |
375 | 415 |
|
376 | 416 |
if (!Directory.Exists(_FinalPDFStorgeLocal)) |
... | ... | |
378 | 418 |
Directory.CreateDirectory(_FinalPDFStorgeLocal); |
379 | 419 |
} |
380 | 420 |
pdfFilePath = _FinalPDFStorgeLocal + @"\" + tempFileInfo.Name; |
381 |
|
|
382 |
#region 코멘트 적용 + 커버시트 |
|
383 |
using (Stream pdfStream = new FileInfo(testFile).Open(FileMode.Open, FileAccess.ReadWrite)) // |
|
421 |
using (CIEntities cIEntities = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(finaldata.PROJECT_NO).ToString())) |
|
384 | 422 |
{ |
385 |
PdfReader pdfReader = new PdfReader(pdfStream); |
|
386 |
//List<Dictionary<string, object>> lstoutlineTop = new List<Dictionary<string, object>>(); |
|
387 |
Dictionary<string, object> bookmark; |
|
388 |
List<Dictionary<string, object>> outlines; |
|
389 |
outlines = new List<Dictionary<string, object>>(); |
|
390 |
List<Dictionary<string, object>> root = new List<Dictionary<string, object>>(); |
|
391 |
|
|
392 |
var dic = new Dictionary<string, object>(); |
|
393 |
foreach (var data in MarkupDataSet) |
|
394 |
{ |
|
423 |
memberlist = cIEntities.MEMBER.ToList(); |
|
424 |
} |
|
425 |
using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
426 |
{ |
|
427 |
FINAL_PDF pdfLink = _entity.FINAL_PDF.Where(data => data.ID == finaldata.ID).FirstOrDefault(); |
|
395 | 428 |
|
396 |
string userid = string.Empty; |
|
397 |
string username = string.Empty; |
|
398 |
string userdept = string.Empty; |
|
399 |
using (DataController dataController = new DataController()) |
|
429 |
#region 코멘트 적용 + 커버시트 |
|
430 |
using (Stream pdfStream = new FileInfo(testFile).Open(FileMode.Open, FileAccess.ReadWrite)) // |
|
431 |
{ |
|
432 |
PdfReader pdfReader = new PdfReader(pdfStream); |
|
433 |
//List<Dictionary<string, object>> lstoutlineTop = new List<Dictionary<string, object>>(); |
|
434 |
Dictionary<string, object> bookmark; |
|
435 |
List<Dictionary<string, object>> outlines; |
|
436 |
outlines = new List<Dictionary<string, object>>(); |
|
437 |
List<Dictionary<string, object>> root = new List<Dictionary<string, object>>(); |
|
438 |
|
|
439 |
var dic = new Dictionary<string, object>(); |
|
440 |
foreach (var data in MarkupDataSet) |
|
400 | 441 |
{ |
401 |
var member = dataController.GetCommentMemberInfo(finaldata.PROJECT_NO, data.ID); |
|
402 |
userid = member.ID; |
|
403 |
username = member.NAME; |
|
404 |
userdept = member.DEPARTMENT; |
|
405 |
} |
|
406 | 442 |
|
407 |
bookmark = new Dictionary<string, object>(); |
|
408 |
bookmark.Add("Title", string.Format("User:{0}[{1}] Commented Page : {2}", username, userdept, data.PAGENUMBER)); |
|
409 |
bookmark.Add("Page", data.PAGENUMBER + " Fit"); |
|
410 |
bookmark.Add("Action", "GoTo"); |
|
411 |
bookmark.Add("Kids", outlines); |
|
412 |
root.Add(bookmark); |
|
413 |
} |
|
443 |
string userid = data.MARKUP_INFO_VERSION.MARKUP_INFO.USER_ID; |
|
444 |
|
|
445 |
var member = memberlist.Where(u => u.ID == userid).FirstOrDefault(); |
|
446 |
string username = member.NAME; |
|
447 |
string userdept = member.DEPARTMENT; |
|
448 |
bookmark = new Dictionary<string, object>(); |
|
449 |
bookmark.Add("Title", string.Format("User:{0}[{1}] Commented Page : {2}", username, userdept, data.PAGENUMBER)); |
|
450 |
bookmark.Add("Page", data.PAGENUMBER + " Fit"); |
|
451 |
bookmark.Add("Action", "GoTo"); |
|
452 |
bookmark.Add("Kids", outlines); |
|
453 |
root.Add(bookmark); |
|
454 |
} |
|
414 | 455 |
|
415 | 456 |
|
416 |
using (PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(pdfFilePath, FileMode.Create))) |
|
417 |
{ |
|
418 |
var _SetColor = new SolidColorBrush(Colors.Red); |
|
457 |
using (PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(pdfFilePath, FileMode.Create)))
|
|
458 |
{
|
|
459 |
var _SetColor = new SolidColorBrush(Colors.Red);
|
|
419 | 460 |
|
420 |
string[] delimiterChars = { "|DZ|" }; |
|
421 |
string[] delimiterChars2 = { "|" }; |
|
461 |
string[] delimiterChars = { "|DZ|" };
|
|
462 |
string[] delimiterChars2 = { "|" };
|
|
422 | 463 |
|
423 |
//pdfStamper.FormFlattening = true; //이미 선처리 작업함 |
|
424 |
pdfStamper.SetFullCompression(); |
|
425 |
_SetColor = new SolidColorBrush(Colors.Red); |
|
464 |
//pdfStamper.FormFlattening = true; //이미 선처리 작업함
|
|
465 |
pdfStamper.SetFullCompression();
|
|
466 |
_SetColor = new SolidColorBrush(Colors.Red);
|
|
426 | 467 |
|
427 |
foreach (var markupItem in MarkupDataSet) |
|
428 |
{ |
|
429 |
pdfSize = pdfReader.GetPageSizeWithRotation(markupItem.PAGENUMBER); |
|
430 |
var currentPage = DocPageItem.Where(d => d.PAGE_NUMBER == markupItem.PAGENUMBER).FirstOrDefault(); |
|
468 |
foreach (var markupItem in MarkupDataSet)
|
|
469 |
{
|
|
470 |
pdfSize = pdfReader.GetPageSizeWithRotation(markupItem.PAGENUMBER);
|
|
471 |
var currentPage = DocPageItem.Where(d => d.PAGE_NUMBER == markupItem.PAGENUMBER).FirstOrDefault();
|
|
431 | 472 |
|
432 |
mediaBox = pdfReader.GetPageSize(markupItem.PAGENUMBER); |
|
433 |
var cropBox = pdfReader.GetCropBox(markupItem.PAGENUMBER); |
|
473 |
mediaBox = pdfReader.GetPageSize(markupItem.PAGENUMBER);
|
|
474 |
var cropBox = pdfReader.GetCropBox(markupItem.PAGENUMBER);
|
|
434 | 475 |
|
435 |
//scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / mediaBox.Width; |
|
436 |
//scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / mediaBox.Height; |
|
476 |
//scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / mediaBox.Width;
|
|
477 |
//scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / mediaBox.Height;
|
|
437 | 478 |
|
438 |
//강인구 테스트 |
|
439 |
scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / pdfSize.Width; |
|
440 |
scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / pdfSize.Height; |
|
479 |
//강인구 테스트
|
|
480 |
scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / pdfSize.Width;
|
|
481 |
scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / pdfSize.Height;
|
|
441 | 482 |
|
442 |
if (cropBox != null && cropBox.Width < mediaBox.Width || cropBox.Height < mediaBox.Height) |
|
443 |
{ |
|
444 |
mediaBox = cropBox; |
|
445 |
} |
|
446 |
using (DataController dc = new DataController()) |
|
447 |
{ |
|
448 |
dc.SetFinalCurrentPage(finaldata.ID, markupItem.PAGENUMBER); |
|
449 |
} |
|
483 |
if (cropBox != null && cropBox.Width < mediaBox.Width || cropBox.Height < mediaBox.Height) |
|
484 |
{ |
|
485 |
mediaBox = cropBox; |
|
486 |
} |
|
450 | 487 |
|
451 |
string[] markedData = markupItem.DATA.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
|
488 |
pdfLink.CURRENT_PAGE = markupItem.PAGENUMBER; |
|
489 |
_entity.SaveChanges(); |
|
452 | 490 |
|
453 |
PdfContentByte contentByte = pdfStamper.GetOverContent(markupItem.PAGENUMBER);
|
|
491 |
string[] markedData = markupItem.DATA.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
|
|
454 | 492 |
|
493 |
PdfContentByte contentByte = pdfStamper.GetOverContent(markupItem.PAGENUMBER); |
|
455 | 494 |
|
456 |
foreach (var data in markedData) |
|
457 |
{ |
|
458 |
var item = JsonSerializerHelper.UnCompressString(data); |
|
459 |
var ControlT = JsonSerializerHelper.JsonDeserialize<S_BaseControl>(item); |
|
460 | 495 |
|
461 |
try
|
|
496 |
foreach (var data in markedData)
|
|
462 | 497 |
{ |
463 |
switch (ControlT.Name) |
|
498 |
var item = JsonSerializerHelper.UnCompressString(data); |
|
499 |
var ControlT = JsonSerializerHelper.JsonDeserialize<S_BaseControl>(item); |
|
500 |
|
|
501 |
try |
|
464 | 502 |
{ |
465 |
#region LINE
|
|
466 |
case "LineControl":
|
|
467 |
{
|
|
468 |
using (S_LineControl control = JsonSerializerHelper.JsonDeserialize<S_LineControl>(item))
|
|
503 |
switch (ControlT.Name)
|
|
504 |
{
|
|
505 |
#region LINE
|
|
506 |
case "LineControl":
|
|
469 | 507 |
{ |
470 |
string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
471 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
472 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
473 |
DoubleCollection DashSize = control.DashSize; |
|
474 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
475 |
|
|
476 |
var Opacity = control.Opac; |
|
477 |
string UserID = control.UserID; |
|
478 |
double Interval = control.Interval; |
|
479 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First())); |
|
480 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(StartPoint, EndPoint, LineSize, contentByte, control.DashSize, _SetColor, Opacity); |
|
481 |
switch (control.LineStyleSet) |
|
508 |
using (S_LineControl control = JsonSerializerHelper.JsonDeserialize<S_LineControl>(item)) |
|
482 | 509 |
{ |
483 |
case LineStyleSet.ArrowLine: |
|
484 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
485 |
break; |
|
486 |
case LineStyleSet.CancelLine: |
|
487 |
{ |
|
488 |
var x = Math.Abs((Math.Abs(StartPoint.X) - Math.Abs(EndPoint.X))); |
|
489 |
var y = Math.Abs((Math.Abs(StartPoint.Y) - Math.Abs(EndPoint.Y))); |
|
490 |
|
|
491 |
if (x > y) |
|
510 |
string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
511 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
512 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
513 |
DoubleCollection DashSize = control.DashSize; |
|
514 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
515 |
|
|
516 |
var Opacity = control.Opac; |
|
517 |
string UserID = control.UserID; |
|
518 |
double Interval = control.Interval; |
|
519 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First())); |
|
520 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(StartPoint, EndPoint, LineSize, contentByte, control.DashSize, _SetColor, Opacity); |
|
521 |
switch (control.LineStyleSet) |
|
522 |
{ |
|
523 |
case LineStyleSet.ArrowLine: |
|
524 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
525 |
break; |
|
526 |
case LineStyleSet.CancelLine: |
|
492 | 527 |
{ |
493 |
StartPoint = new Point(StartPoint.X, StartPoint.Y - (float)(control.Interval / 3.0)); |
|
494 |
EndPoint = new Point(EndPoint.X, EndPoint.Y - (float)(control.Interval / 3.0)); |
|
495 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, Opacity); |
|
528 |
var x = Math.Abs((Math.Abs(StartPoint.X) - Math.Abs(EndPoint.X))); |
|
529 |
var y = Math.Abs((Math.Abs(StartPoint.Y) - Math.Abs(EndPoint.Y))); |
|
530 |
|
|
531 |
if (x > y) |
|
532 |
{ |
|
533 |
StartPoint = new Point(StartPoint.X, StartPoint.Y - (float)(control.Interval / 3.0)); |
|
534 |
EndPoint = new Point(EndPoint.X, EndPoint.Y - (float)(control.Interval / 3.0)); |
|
535 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, Opacity); |
|
536 |
} |
|
496 | 537 |
} |
497 |
} |
|
498 |
break; |
|
499 |
case LineStyleSet.TwinLine: |
|
500 |
{ |
|
501 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
502 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(StartPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
503 |
} |
|
504 |
break; |
|
505 |
case LineStyleSet.DimLine: |
|
506 |
{ |
|
507 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.DimAllow(StartPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
508 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
509 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(StartPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
510 |
} |
|
511 |
break; |
|
512 |
default: |
|
513 |
break; |
|
514 |
} |
|
538 |
break; |
|
539 |
case LineStyleSet.TwinLine: |
|
540 |
{ |
|
541 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
542 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(StartPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
543 |
} |
|
544 |
break; |
|
545 |
case LineStyleSet.DimLine: |
|
546 |
{ |
|
547 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.DimAllow(StartPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
548 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
549 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(StartPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
550 |
} |
|
551 |
break; |
|
552 |
default: |
|
553 |
break; |
|
554 |
} |
|
515 | 555 |
|
516 | 556 |
|
557 |
} |
|
517 | 558 |
} |
518 |
} |
|
519 |
break; |
|
520 |
#endregion |
|
521 |
#region ArrowControlMulti |
|
522 |
case "ArrowControl_Multi": |
|
523 |
{ |
|
524 |
using (S_ArrowControl_Multi control = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item)) |
|
559 |
break; |
|
560 |
#endregion |
|
561 |
#region ArrowControlMulti |
|
562 |
case "ArrowControl_Multi": |
|
525 | 563 |
{ |
526 |
string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
527 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
528 |
Point MidPoint = GetPdfPointSystem(control.MidPoint); |
|
529 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
530 |
DoubleCollection DashSize = control.DashSize; |
|
531 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
532 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First())); |
|
564 |
using (S_ArrowControl_Multi control = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item)) |
|
565 |
{ |
|
566 |
string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
567 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
568 |
Point MidPoint = GetPdfPointSystem(control.MidPoint); |
|
569 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
570 |
DoubleCollection DashSize = control.DashSize; |
|
571 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
572 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First())); |
|
533 | 573 |
|
534 |
double Opacity = control.Opac; |
|
574 |
double Opacity = control.Opac;
|
|
535 | 575 |
|
536 |
if (EndPoint == MidPoint) |
|
537 |
{ |
|
538 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
539 |
} |
|
540 |
else |
|
541 |
{ |
|
542 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, MidPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
543 |
} |
|
576 |
if (EndPoint == MidPoint)
|
|
577 |
{
|
|
578 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity);
|
|
579 |
}
|
|
580 |
else
|
|
581 |
{
|
|
582 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, MidPoint, (int)LineSize, contentByte, _SetColor, Opacity);
|
|
583 |
}
|
|
544 | 584 |
|
545 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity); |
|
585 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
|
|
546 | 586 |
|
587 |
} |
|
547 | 588 |
} |
548 |
} |
|
549 |
break; |
|
550 |
#endregion |
|
551 |
#region PolyControl |
|
552 |
case "PolygonControl": |
|
553 |
using (S_PolyControl control = JsonSerializerHelper.JsonDeserialize<S_PolyControl>(item)) |
|
554 |
{ |
|
555 |
string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
556 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
557 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
558 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
559 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First())); |
|
560 |
double Opacity = control.Opac; |
|
561 |
DoubleCollection DashSize = control.DashSize; |
|
562 |
|
|
563 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity); |
|
564 |
} |
|
565 |
break; |
|
566 |
#endregion |
|
567 |
#region ArcControl |
|
568 |
case "ArcControl": |
|
569 |
{ |
|
570 |
using (S_ArcControl control = JsonSerializerHelper.JsonDeserialize<S_ArcControl>(item)) |
|
589 |
break; |
|
590 |
#endregion |
|
591 |
#region PolyControl |
|
592 |
case "PolygonControl": |
|
593 |
using (S_PolyControl control = JsonSerializerHelper.JsonDeserialize<S_PolyControl>(item)) |
|
571 | 594 |
{ |
572 | 595 |
string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
573 | 596 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
574 | 597 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
575 |
Point MidPoint = GetPdfPointSystem(control.MidPoint); |
|
576 |
DoubleCollection DashSize = control.DashSize; |
|
577 | 598 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
578 |
|
|
579 |
var Opacity = control.Opac; |
|
580 |
string UserID = control.UserID; |
|
581 | 599 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First())); |
582 |
bool IsTransOn = control.IsTransOn; |
|
583 |
|
|
584 |
if (control.IsTransOn) |
|
585 |
{ |
|
586 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity, true); |
|
587 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity, true); |
|
588 |
} |
|
589 |
else |
|
590 |
{ |
|
591 |
Controls_PDF.HoneyPDFLib_DrawSet_Arc.DrawArc(StartPoint, MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
592 |
} |
|
600 |
double Opacity = control.Opac; |
|
601 |
DoubleCollection DashSize = control.DashSize; |
|
593 | 602 |
|
594 |
} |
|
595 |
} |
|
596 |
break; |
|
597 |
#endregion |
|
598 |
#region RectangleControl |
|
599 |
case "RectangleControl": |
|
600 |
using (S_RectControl control = JsonSerializerHelper.JsonDeserialize<S_RectControl>(item)) |
|
601 |
{ |
|
602 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
603 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
604 |
var PaintStyle = control.PaintState; |
|
605 |
double Angle = control.Angle; |
|
606 |
DoubleCollection DashSize = control.DashSize; |
|
607 |
double Opacity = control.Opac; |
|
608 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
609 |
|
|
610 |
Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawRectangle(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity); |
|
611 |
} |
|
612 |
break; |
|
613 |
#endregion |
|
614 |
#region TriControl |
|
615 |
case "TriControl": |
|
616 |
using (S_TriControl control = JsonSerializerHelper.JsonDeserialize<S_TriControl>(item)) |
|
617 |
{ |
|
618 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
619 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
620 |
var PaintStyle = control.Paint; |
|
621 |
double Angle = control.Angle; |
|
622 |
//StrokeColor = _SetColor, //색상은 레드 |
|
623 |
DoubleCollection DashSize = control.DashSize; |
|
624 |
double Opacity = control.Opac; |
|
625 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
626 |
|
|
627 |
Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity); |
|
628 |
} |
|
629 |
break; |
|
630 |
#endregion |
|
631 |
#region CircleControl |
|
632 |
case "CircleControl": |
|
633 |
using (S_CircleControl control = JsonSerializerHelper.JsonDeserialize<S_CircleControl>(item)) |
|
634 |
{ |
|
635 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
636 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
637 |
var StartPoint = GetPdfPointSystem(control.StartPoint); |
|
638 |
var EndPoint = GetPdfPointSystem(control.EndPoint); |
|
639 |
var PaintStyle = control.PaintState; |
|
640 |
double Angle = control.Angle; |
|
641 |
DoubleCollection DashSize = control.DashSize; |
|
642 |
double Opacity = control.Opac; |
|
643 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
644 |
Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawCircle(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity, Angle, PointSet); |
|
645 |
|
|
646 |
} |
|
647 |
break; |
|
648 |
#endregion |
|
649 |
#region RectCloudControl |
|
650 |
case "RectCloudControl": |
|
651 |
using (S_RectCloudControl control = JsonSerializerHelper.JsonDeserialize<S_RectCloudControl>(item)) |
|
652 |
{ |
|
653 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
654 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
655 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
656 |
double size = MathSet.DistanceTo(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint)); |
|
657 |
|
|
658 |
double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight); |
|
659 |
|
|
660 |
var PaintStyle = control.PaintState; |
|
661 |
double Opacity = control.Opac; |
|
662 |
DoubleCollection DashSize = control.DashSize; |
|
663 |
|
|
664 |
//드로잉 방식이 표현되지 않음 |
|
665 |
var rrrr = returnAngle(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint)); |
|
666 |
|
|
667 |
double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet)); |
|
668 |
bool reverse = (area < 0); |
|
669 |
if (PaintStyle == PaintSet.None) |
|
670 |
{ |
|
671 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity); |
|
672 |
} |
|
673 |
else |
|
674 |
{ |
|
675 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity); |
|
676 |
} |
|
677 |
} |
|
678 |
break; |
|
679 |
#endregion |
|
680 |
#region CloudControl |
|
681 |
case "CloudControl": |
|
682 |
using (S_CloudControl control = JsonSerializerHelper.JsonDeserialize<S_CloudControl>(item)) |
|
683 |
{ |
|
684 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
685 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
686 |
double Toler = control.Toler; |
|
687 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
688 |
double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight); |
|
689 |
var PaintStyle = control.PaintState; |
|
690 |
double Opacity = control.Opac; |
|
691 |
bool isTransOn = control.IsTrans; |
|
692 |
bool isChain = control.IsChain; |
|
693 |
|
|
694 |
DoubleCollection DashSize = control.DashSize; |
|
695 |
|
|
696 |
if (isChain) |
|
697 |
{ |
|
698 | 603 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity); |
699 | 604 |
} |
700 |
else |
|
605 |
break; |
|
606 |
#endregion |
|
607 |
#region ArcControl |
|
608 |
case "ArcControl": |
|
701 | 609 |
{ |
702 |
if (isTransOn)
|
|
610 |
using (S_ArcControl control = JsonSerializerHelper.JsonDeserialize<S_ArcControl>(item))
|
|
703 | 611 |
{ |
704 |
double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet)); |
|
705 |
bool reverse = (area < 0); |
|
706 |
|
|
707 |
if (PaintStyle == PaintSet.None) |
|
612 |
string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
613 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
614 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
615 |
Point MidPoint = GetPdfPointSystem(control.MidPoint); |
|
616 |
DoubleCollection DashSize = control.DashSize; |
|
617 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
618 |
|
|
619 |
var Opacity = control.Opac; |
|
620 |
string UserID = control.UserID; |
|
621 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First())); |
|
622 |
bool IsTransOn = control.IsTransOn; |
|
623 |
|
|
624 |
if (control.IsTransOn) |
|
708 | 625 |
{ |
709 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity); |
|
626 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity, true); |
|
627 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity, true); |
|
710 | 628 |
} |
711 | 629 |
else |
712 | 630 |
{ |
713 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
|
|
631 |
Controls_PDF.HoneyPDFLib_DrawSet_Arc.DrawArc(StartPoint, MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity);
|
|
714 | 632 |
} |
715 |
} |
|
716 |
else |
|
717 |
{ |
|
718 |
Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity); |
|
633 |
|
|
719 | 634 |
} |
720 | 635 |
} |
721 |
} |
|
722 |
break; |
|
723 |
#endregion |
|
724 |
#region TEXT |
|
725 |
case "TextControl": |
|
726 |
using (S_TextControl control = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item)) |
|
727 |
{ |
|
728 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
729 |
string Text = control.Text; |
|
730 |
|
|
731 |
bool isUnderline = false; |
|
732 |
control.BoxW -= scaleWidth; |
|
733 |
control.BoxH -= scaleHeight; |
|
734 |
System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxW, (float)control.BoxH); |
|
735 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
736 |
Point EndPoint = GetPdfPointSystem(new Point(control.StartPoint.X + control.BoxW, control.StartPoint.Y + control.BoxH)); |
|
737 |
|
|
738 |
List<Point> pointSet = new List<Point>(); |
|
739 |
pointSet.Add(StartPoint); |
|
740 |
pointSet.Add(EndPoint); |
|
741 |
|
|
742 |
PaintSet paint = PaintSet.None; |
|
743 |
switch (control.paintMethod) |
|
636 |
break; |
|
637 |
#endregion |
|
638 |
#region RectangleControl |
|
639 |
case "RectangleControl": |
|
640 |
using (S_RectControl control = JsonSerializerHelper.JsonDeserialize<S_RectControl>(item)) |
|
744 | 641 |
{ |
745 |
case 1: |
|
746 |
{ |
|
747 |
paint = PaintSet.Fill; |
|
748 |
} |
|
749 |
break; |
|
750 |
case 2: |
|
751 |
{ |
|
752 |
paint = PaintSet.Hatch; |
|
753 |
} |
|
754 |
break; |
|
755 |
default: |
|
756 |
break; |
|
642 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
643 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
644 |
var PaintStyle = control.PaintState; |
|
645 |
double Angle = control.Angle; |
|
646 |
DoubleCollection DashSize = control.DashSize; |
|
647 |
double Opacity = control.Opac; |
|
648 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
649 |
|
|
650 |
Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawRectangle(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity); |
|
757 | 651 |
} |
758 |
if (control.isHighLight) paint |= PaintSet.Highlight; |
|
759 |
|
|
760 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
761 |
double TextSize = Convert.ToDouble(data2[1]); |
|
762 |
SolidColorBrush FontColor = _SetColor; |
|
763 |
double Angle = control.Angle; |
|
764 |
double Opacity = control.Opac; |
|
765 |
FontFamily fontfamilly = new FontFamily(control.fontConfig[0]); |
|
766 |
var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]); |
|
767 |
|
|
768 |
FontStyle fontStyle = FontStyles.Normal; |
|
769 |
if (FontStyles.Italic == TextStyle) |
|
652 |
break; |
|
653 |
#endregion |
|
654 |
#region TriControl |
|
655 |
case "TriControl": |
|
656 |
using (S_TriControl control = JsonSerializerHelper.JsonDeserialize<S_TriControl>(item)) |
|
770 | 657 |
{ |
771 |
fontStyle = FontStyles.Italic; |
|
772 |
} |
|
773 |
|
|
774 |
FontWeight fontWeight = FontWeights.Black; |
|
658 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
659 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
660 |
var PaintStyle = control.Paint; |
|
661 |
double Angle = control.Angle; |
|
662 |
//StrokeColor = _SetColor, //색상은 레드 |
|
663 |
DoubleCollection DashSize = control.DashSize; |
|
664 |
double Opacity = control.Opac; |
|
665 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
775 | 666 |
|
776 |
var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]); |
|
777 |
//강인구 수정(2018.04.17) |
|
778 |
if (FontWeights.Bold == TextWeight) |
|
779 |
//if (FontWeights.ExtraBold == TextWeight) |
|
780 |
{ |
|
781 |
fontWeight = FontWeights.Bold; |
|
667 |
Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity); |
|
782 | 668 |
} |
783 |
|
|
784 |
TextDecorationCollection decoration = TextDecorations.Baseline; |
|
785 |
if (control.fontConfig.Count() == 4) |
|
669 |
break; |
|
670 |
#endregion |
|
671 |
#region CircleControl |
|
672 |
case "CircleControl": |
|
673 |
using (S_CircleControl control = JsonSerializerHelper.JsonDeserialize<S_CircleControl>(item)) |
|
786 | 674 |
{ |
787 |
decoration = TextDecorations.Underline; |
|
675 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
676 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
677 |
var StartPoint = GetPdfPointSystem(control.StartPoint); |
|
678 |
var EndPoint = GetPdfPointSystem(control.EndPoint); |
|
679 |
var PaintStyle = control.PaintState; |
|
680 |
double Angle = control.Angle; |
|
681 |
DoubleCollection DashSize = control.DashSize; |
|
682 |
double Opacity = control.Opac; |
|
683 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
684 |
Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawCircle(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity, Angle, PointSet); |
|
685 |
|
|
788 | 686 |
} |
687 |
break; |
|
688 |
#endregion |
|
689 |
#region RectCloudControl |
|
690 |
case "RectCloudControl": |
|
691 |
using (S_RectCloudControl control = JsonSerializerHelper.JsonDeserialize<S_RectCloudControl>(item)) |
|
692 |
{ |
|
693 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
694 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
695 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
696 |
double size = MathSet.DistanceTo(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint)); |
|
789 | 697 |
|
790 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString(StartPoint, EndPoint, LineSize, contentByte, _SetColor, paint, TextSize, fontfamilly, fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
|
791 |
} |
|
792 |
break; |
|
793 |
#endregion |
|
794 |
#region ArrowTextControl |
|
795 |
case "ArrowTextControl": |
|
796 |
using (S_ArrowTextControl control = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(item)) |
|
797 |
{ |
|
798 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
799 |
Point tempStartPoint = GetPdfPointSystem(control.StartPoint); |
|
800 |
Point tempMidPoint = GetPdfPointSystem(control.MidPoint); |
|
801 |
Point tempEndPoint = GetPdfPointSystem(control.EndPoint); |
|
802 |
bool isUnderLine = false; |
|
803 |
string Text = ""; |
|
804 |
double fontsize = 30; |
|
805 |
|
|
806 |
System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxWidth, (float)control.BoxHeight); |
|
807 |
Rect rect = new Rect(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight)); |
|
808 |
List<Point> tempPoint = new List<Point>(); |
|
809 |
|
|
810 |
var tempRectMidPoint = MathSet.getRectMiddlePoint(rect); |
|
811 |
|
|
812 |
tempPoint.Add(new Point(rect.Left, tempRectMidPoint.Y)); |
|
813 |
tempPoint.Add(new Point(tempRectMidPoint.X, rect.Top)); |
|
814 |
tempPoint.Add(new Point(rect.Right, tempRectMidPoint.Y)); |
|
815 |
tempPoint.Add(new Point(tempRectMidPoint.X, rect.Bottom)); |
|
816 |
double Angle = control.Angle; |
|
817 |
var newStartPoint = tempStartPoint; |
|
818 |
var newEndPoint = MathSet.getNearPoint(tempPoint, tempMidPoint); |
|
819 |
var newMidPoint = MathSet.getMiddlePoint(newStartPoint, newEndPoint); |
|
820 |
|
|
821 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
822 |
SolidColorBrush FontColor = _SetColor; |
|
823 |
bool isHighlight = control.isHighLight; |
|
824 |
double Opacity = control.Opac; |
|
825 |
PaintSet Paint = PaintSet.None; |
|
826 |
|
|
827 |
switch (control.ArrowStyle) |
|
698 |
double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight); |
|
699 |
|
|
700 |
var PaintStyle = control.PaintState; |
|
701 |
double Opacity = control.Opac; |
|
702 |
DoubleCollection DashSize = control.DashSize; |
|
703 |
|
|
704 |
//드로잉 방식이 표현되지 않음 |
|
705 |
var rrrr = returnAngle(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint)); |
|
706 |
|
|
707 |
double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet)); |
|
708 |
bool reverse = (area < 0); |
|
709 |
if (PaintStyle == PaintSet.None) |
|
710 |
{ |
|
711 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity); |
|
712 |
} |
|
713 |
else |
|
714 |
{ |
|
715 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity); |
|
716 |
} |
|
717 |
} |
|
718 |
break; |
|
719 |
#endregion |
|
720 |
#region CloudControl |
|
721 |
case "CloudControl": |
|
722 |
using (S_CloudControl control = JsonSerializerHelper.JsonDeserialize<S_CloudControl>(item)) |
|
828 | 723 |
{ |
829 |
case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Normal: |
|
830 |
{ |
|
831 |
Paint = PaintSet.None; |
|
832 |
} |
|
833 |
break; |
|
834 |
case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud: |
|
724 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
725 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
726 |
double Toler = control.Toler; |
|
727 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
728 |
double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight); |
|
729 |
var PaintStyle = control.PaintState; |
|
730 |
double Opacity = control.Opac; |
|
731 |
bool isTransOn = control.IsTrans; |
|
732 |
bool isChain = control.IsChain; |
|
733 |
|
|
734 |
DoubleCollection DashSize = control.DashSize; |
|
735 |
|
|
736 |
if (isChain) |
|
737 |
{ |
|
738 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity); |
|
739 |
} |
|
740 |
else |
|
741 |
{ |
|
742 |
if (isTransOn) |
|
835 | 743 |
{ |
836 |
Paint = PaintSet.Hatch; |
|
744 |
double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet)); |
|
745 |
bool reverse = (area < 0); |
|
746 |
|
|
747 |
if (PaintStyle == PaintSet.None) |
|
748 |
{ |
|
749 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity); |
|
750 |
} |
|
751 |
else |
|
752 |
{ |
|
753 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity); |
|
754 |
} |
|
837 | 755 |
} |
838 |
break; |
|
839 |
case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect: |
|
756 |
else |
|
840 | 757 |
{ |
841 |
Paint = PaintSet.Fill;
|
|
758 |
Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity);
|
|
842 | 759 |
} |
843 |
break; |
|
844 |
default: |
|
845 |
break; |
|
846 |
} |
|
847 |
if (control.isHighLight) Paint |= PaintSet.Highlight; |
|
848 |
|
|
849 |
if (Paint == PaintSet.Hatch) |
|
850 |
{ |
|
851 |
Text = control.ArrowText; |
|
760 |
} |
|
852 | 761 |
} |
853 |
else |
|
762 |
break; |
|
763 |
#endregion |
|
764 |
#region TEXT |
|
765 |
case "TextControl": |
|
766 |
using (S_TextControl control = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item)) |
|
854 | 767 |
{ |
855 |
Text = control.ArrowText;
|
|
856 |
}
|
|
768 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
|
|
769 |
string Text = control.Text;
|
|
857 | 770 |
|
858 |
try |
|
859 |
{ |
|
860 |
if (control.fontConfig.Count == 4) |
|
771 |
bool isUnderline = false; |
|
772 |
control.BoxW -= scaleWidth; |
|
773 |
control.BoxH -= scaleHeight; |
|
774 |
System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxW, (float)control.BoxH); |
|
775 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
776 |
Point EndPoint = GetPdfPointSystem(new Point(control.StartPoint.X + control.BoxW, control.StartPoint.Y + control.BoxH)); |
|
777 |
|
|
778 |
List<Point> pointSet = new List<Point>(); |
|
779 |
pointSet.Add(StartPoint); |
|
780 |
pointSet.Add(EndPoint); |
|
781 |
|
|
782 |
PaintSet paint = PaintSet.None; |
|
783 |
switch (control.paintMethod) |
|
861 | 784 |
{ |
862 |
fontsize = Convert.ToDouble(control.fontConfig[3]); |
|
785 |
case 1: |
|
786 |
{ |
|
787 |
paint = PaintSet.Fill; |
|
788 |
} |
|
789 |
break; |
|
790 |
case 2: |
|
791 |
{ |
|
792 |
paint = PaintSet.Hatch; |
|
793 |
} |
|
794 |
break; |
|
795 |
default: |
|
796 |
break; |
|
863 | 797 |
} |
798 |
if (control.isHighLight) paint |= PaintSet.Highlight; |
|
864 | 799 |
|
865 |
//강인구 수정(2018.04.17) |
|
800 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
801 |
double TextSize = Convert.ToDouble(data2[1]); |
|
802 |
SolidColorBrush FontColor = _SetColor; |
|
803 |
double Angle = control.Angle; |
|
804 |
double Opacity = control.Opac; |
|
805 |
FontFamily fontfamilly = new FontFamily(control.fontConfig[0]); |
|
866 | 806 |
var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]); |
867 | 807 |
|
868 | 808 |
FontStyle fontStyle = FontStyles.Normal; |
... | ... | |
874 | 814 |
FontWeight fontWeight = FontWeights.Black; |
875 | 815 |
|
876 | 816 |
var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]); |
817 |
//강인구 수정(2018.04.17) |
|
877 | 818 |
if (FontWeights.Bold == TextWeight) |
819 |
//if (FontWeights.ExtraBold == TextWeight) |
|
878 | 820 |
{ |
879 | 821 |
fontWeight = FontWeights.Bold; |
880 | 822 |
} |
881 | 823 |
|
882 | 824 |
TextDecorationCollection decoration = TextDecorations.Baseline; |
883 |
if (control.fontConfig.Count() == 5)
|
|
825 |
if (control.fontConfig.Count() == 4)
|
|
884 | 826 |
{ |
885 | 827 |
decoration = TextDecorations.Underline; |
886 | 828 |
} |
887 | 829 |
|
888 |
if (control.isTrans) |
|
830 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString(StartPoint, EndPoint, LineSize, contentByte, _SetColor, paint, TextSize, fontfamilly, fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
|
831 |
} |
|
832 |
break; |
|
833 |
#endregion |
|
834 |
#region ArrowTextControl |
|
835 |
case "ArrowTextControl": |
|
836 |
using (S_ArrowTextControl control = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(item)) |
|
837 |
{ |
|
838 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
839 |
Point tempStartPoint = GetPdfPointSystem(control.StartPoint); |
|
840 |
Point tempMidPoint = GetPdfPointSystem(control.MidPoint); |
|
841 |
Point tempEndPoint = GetPdfPointSystem(control.EndPoint); |
|
842 |
bool isUnderLine = false; |
|
843 |
string Text = ""; |
|
844 |
double fontsize = 30; |
|
845 |
|
|
846 |
System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxWidth, (float)control.BoxHeight); |
|
847 |
Rect rect = new Rect(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight)); |
|
848 |
List<Point> tempPoint = new List<Point>(); |
|
849 |
|
|
850 |
var tempRectMidPoint = MathSet.getRectMiddlePoint(rect); |
|
851 |
|
|
852 |
tempPoint.Add(new Point(rect.Left, tempRectMidPoint.Y)); |
|
853 |
tempPoint.Add(new Point(tempRectMidPoint.X, rect.Top)); |
|
854 |
tempPoint.Add(new Point(rect.Right, tempRectMidPoint.Y)); |
|
855 |
tempPoint.Add(new Point(tempRectMidPoint.X, rect.Bottom)); |
|
856 |
double Angle = control.Angle; |
|
857 |
var newStartPoint = tempStartPoint; |
|
858 |
var newEndPoint = MathSet.getNearPoint(tempPoint, tempMidPoint); |
|
859 |
var newMidPoint = MathSet.getMiddlePoint(newStartPoint, newEndPoint); |
|
860 |
|
|
861 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
|
862 |
SolidColorBrush FontColor = _SetColor; |
|
863 |
bool isHighlight = control.isHighLight; |
|
864 |
double Opacity = control.Opac; |
|
865 |
PaintSet Paint = PaintSet.None; |
|
866 |
|
|
867 |
switch (control.ArrowStyle) |
|
889 | 868 |
{ |
890 |
//인구 수정 Arrow Text Style적용 되도록 변경 |
|
891 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), |
|
892 |
newStartPoint, tempMidPoint, |
|
893 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
|
869 |
case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Normal: |
|
870 |
{ |
|
871 |
Paint = PaintSet.None; |
|
872 |
} |
|
873 |
break; |
|
874 |
case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud: |
|
875 |
{ |
|
876 |
Paint = PaintSet.Hatch; |
|
877 |
} |
|
878 |
break; |
|
879 |
case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect: |
|
880 |
{ |
|
881 |
Paint = PaintSet.Fill; |
|
882 |
} |
|
883 |
break; |
|
884 |
default: |
|
885 |
break; |
|
886 |
} |
|
887 |
if (control.isHighLight) Paint |= PaintSet.Highlight; |
|
888 |
|
|
889 |
if (Paint == PaintSet.Hatch) |
|
890 |
{ |
|
891 |
Text = control.ArrowText; |
|
894 | 892 |
} |
895 | 893 |
else |
896 | 894 |
{ |
897 |
if (control.isFixed) |
|
895 |
Text = control.ArrowText; |
|
896 |
} |
|
897 |
|
|
898 |
try |
|
899 |
{ |
|
900 |
if (control.fontConfig.Count == 4) |
|
898 | 901 |
{ |
899 |
var testP = new Point(0, 0); |
|
900 |
if (control.isFixed) |
|
901 |
{ |
|
902 |
if (tempPoint[1] == newEndPoint) |
|
903 |
{ |
|
904 |
testP = new Point(newEndPoint.X, newEndPoint.Y - 10); |
|
905 |
} |
|
906 |
else if (tempPoint[3] == newEndPoint) |
|
907 |
{ |
|
908 |
testP = new Point(newEndPoint.X, newEndPoint.Y + 10); |
|
909 |
} |
|
910 |
else if (tempPoint[0] == newEndPoint) |
|
911 |
{ |
|
912 |
testP = new Point(newEndPoint.X - 10, newEndPoint.Y); |
|
913 |
} |
|
914 |
else if (tempPoint[2] == newEndPoint) |
|
915 |
{ |
|
916 |
testP = new Point(newEndPoint.X + 10, newEndPoint.Y); |
|
917 |
} |
|
918 |
} |
|
919 |
//인구 수정 Arrow Text Style적용 되도록 변경 |
|
920 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), |
|
921 |
tempStartPoint, testP, |
|
922 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, |
|
923 |
new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
|
902 |
fontsize = Convert.ToDouble(control.fontConfig[3]); |
|
924 | 903 |
} |
925 |
else |
|
904 |
|
|
905 |
//강인구 수정(2018.04.17) |
|
906 |
var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]); |
|
907 |
|
|
908 |
FontStyle fontStyle = FontStyles.Normal; |
|
909 |
if (FontStyles.Italic == TextStyle) |
|
910 |
{ |
|
911 |
fontStyle = FontStyles.Italic; |
|
912 |
} |
|
913 |
|
|
914 |
FontWeight fontWeight = FontWeights.Black; |
|
915 |
|
|
916 |
var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]); |
|
917 |
if (FontWeights.Bold == TextWeight) |
|
918 |
{ |
|
919 |
fontWeight = FontWeights.Bold; |
|
920 |
} |
|
921 |
|
|
922 |
TextDecorationCollection decoration = TextDecorations.Baseline; |
|
923 |
if (control.fontConfig.Count() == 5) |
|
924 |
{ |
|
925 |
decoration = TextDecorations.Underline; |
|
926 |
} |
|
927 |
|
|
928 |
if (control.isTrans) |
|
926 | 929 |
{ |
927 | 930 |
//인구 수정 Arrow Text Style적용 되도록 변경 |
928 | 931 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), |
929 |
newStartPoint, newMidPoint,
|
|
932 |
newStartPoint, tempMidPoint,
|
|
930 | 933 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
931 | 934 |
} |
935 |
else |
|
936 |
{ |
|
937 |
if (control.isFixed) |
|
938 |
{ |
|
939 |
var testP = new Point(0, 0); |
|
940 |
if (control.isFixed) |
|
941 |
{ |
|
942 |
if (tempPoint[1] == newEndPoint) |
|
943 |
{ |
|
944 |
testP = new Point(newEndPoint.X, newEndPoint.Y - 10); |
|
945 |
} |
|
946 |
else if (tempPoint[3] == newEndPoint) |
|
947 |
{ |
|
948 |
testP = new Point(newEndPoint.X, newEndPoint.Y + 10); |
|
949 |
} |
|
950 |
else if (tempPoint[0] == newEndPoint) |
|
951 |
{ |
|
952 |
testP = new Point(newEndPoint.X - 10, newEndPoint.Y); |
|
953 |
} |
|
954 |
else if (tempPoint[2] == newEndPoint) |
|
955 |
{ |
|
956 |
testP = new Point(newEndPoint.X + 10, newEndPoint.Y); |
|
957 |
} |
|
958 |
} |
|
959 |
//인구 수정 Arrow Text Style적용 되도록 변경 |
|
960 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), |
|
961 |
tempStartPoint, testP, |
|
962 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, |
|
963 |
new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
|
964 |
} |
|
965 |
else |
|
966 |
{ |
|
967 |
//인구 수정 Arrow Text Style적용 되도록 변경 |
|
968 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), |
|
969 |
newStartPoint, newMidPoint, |
|
970 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
|
971 |
} |
|
972 |
} |
|
932 | 973 |
} |
974 |
catch (Exception ex) |
|
975 |
{ |
|
976 |
|
|
977 |
} |
|
978 |
} |
|
979 |
break; |
|
980 |
#endregion |
|
981 |
#region SignControl |
|
982 |
case "SignControl": |
|
983 |
using (S_SignControl control = JsonSerializerHelper.JsonDeserialize<S_SignControl>(item)) |
|
984 |
{ |
|
985 |
|
|
986 |
double Angle = control.Angle; |
|
987 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
988 |
Point TopRightPoint = GetPdfPointSystem(control.TR); |
|
989 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
990 |
Point LeftBottomPoint = GetPdfPointSystem(control.LB); |
|
991 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
992 |
double Opacity = control.Opac; |
|
993 |
string UserNumber = control.UserNumber; |
|
994 |
Controls_PDF.HoneyPDFLib_DrawSet_Image.DrawSign(StartPoint, EndPoint, PointSet, contentByte, UserNumber, Angle, Opacity, finaldata.PROJECT_NO); |
|
995 |
} |
|
996 |
break; |
|
997 |
#endregion |
|
998 |
#region MyRegion |
|
999 |
case "DateControl": |
|
1000 |
using (S_DateControl control = JsonSerializerHelper.JsonDeserialize<S_DateControl>(item)) |
|
1001 |
{ |
|
1002 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
1003 |
string Text = control.Text; |
|
1004 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
1005 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
1006 |
List<Point> pointSet = GetPdfPointSystem(control.PointSet); |
|
1007 |
SolidColorBrush FontColor = _SetColor; |
|
1008 |
double Angle = control.Angle; |
|
1009 |
double Opacity = control.Opac; |
|
1010 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawDate(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Text, Angle, Opacity); |
|
1011 |
} |
|
1012 |
break; |
|
1013 |
#endregion |
|
1014 |
#region SymControlN (APPROVED) |
|
1015 |
case "SymControlN": |
|
1016 |
using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item)) |
|
1017 |
{ |
|
1018 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
1019 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
1020 |
List<Point> pointSet = GetPdfPointSystem(control.PointSet); |
|
1021 |
SolidColorBrush FontColor = _SetColor; |
|
1022 |
double Angle = control.Angle; |
|
1023 |
double Opacity = control.Opac; |
|
1024 |
|
|
1025 |
string imgpath = CommonLib.Common.GetConfigString("ApprovedImgPath", "URL", ""); |
|
1026 |
Controls_PDF.HoneyPDFLib_DrawSet_Symbol.DrawApproval(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath); |
|
933 | 1027 |
} |
934 |
catch (Exception ex) |
|
1028 |
break; |
|
1029 |
case "SymControl": |
|
1030 |
using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item)) |
|
935 | 1031 |
{ |
1032 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
1033 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
1034 |
List<Point> pointSet = GetPdfPointSystem(control.PointSet); |
|
1035 |
SolidColorBrush FontColor = _SetColor; |
|
1036 |
double Angle = control.Angle; |
|
1037 |
double Opacity = control.Opac; |
|
936 | 1038 |
|
1039 |
string imgpath = CommonLib.Common.GetConfigString("CheckmarkImgPath", "URL", ""); |
|
1040 |
Controls_PDF.HoneyPDFLib_DrawSet_Symbol.DrawCheckMark(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath); |
|
937 | 1041 |
} |
938 |
} |
|
939 |
break; |
|
940 |
#endregion |
|
941 |
#region SignControl |
|
942 |
case "SignControl": |
|
943 |
using (S_SignControl control = JsonSerializerHelper.JsonDeserialize<S_SignControl>(item)) |
|
944 |
{ |
|
945 |
|
|
946 |
double Angle = control.Angle; |
|
947 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
948 |
Point TopRightPoint = GetPdfPointSystem(control.TR); |
|
949 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
950 |
Point LeftBottomPoint = GetPdfPointSystem(control.LB); |
|
951 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
952 |
double Opacity = control.Opac; |
|
953 |
string UserNumber = control.UserNumber; |
|
954 |
Controls_PDF.HoneyPDFLib_DrawSet_Image.DrawSign(StartPoint, EndPoint, PointSet, contentByte, UserNumber, Angle, Opacity, finaldata.PROJECT_NO); |
|
955 |
} |
|
956 |
break; |
|
957 |
#endregion |
|
958 |
#region MyRegion |
|
959 |
case "DateControl": |
|
960 |
using (S_DateControl control = JsonSerializerHelper.JsonDeserialize<S_DateControl>(item)) |
|
961 |
{ |
|
962 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
963 |
string Text = control.Text; |
|
964 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
965 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
966 |
List<Point> pointSet = GetPdfPointSystem(control.PointSet); |
|
967 |
SolidColorBrush FontColor = _SetColor; |
|
968 |
double Angle = control.Angle; |
|
969 |
double Opacity = control.Opac; |
|
970 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawDate(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Text, Angle, Opacity); |
|
971 |
} |
|
972 |
break; |
|
973 |
#endregion |
|
974 |
#region SymControlN (APPROVED) |
|
975 |
case "SymControlN": |
|
976 |
using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item)) |
|
977 |
{ |
|
978 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
979 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
980 |
List<Point> pointSet = GetPdfPointSystem(control.PointSet); |
|
981 |
SolidColorBrush FontColor = _SetColor; |
|
982 |
double Angle = control.Angle; |
|
983 |
double Opacity = control.Opac; |
|
984 |
|
|
985 |
string imgpath = CommonLib.Common.GetConfigString("ApprovedImgPath", "URL", ""); |
|
986 |
Controls_PDF.HoneyPDFLib_DrawSet_Symbol.DrawApproval(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath); |
|
987 |
} |
|
988 |
break; |
|
989 |
case "SymControl": |
|
990 |
using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item)) |
|
991 |
{ |
|
992 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
993 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
994 |
List<Point> pointSet = GetPdfPointSystem(control.PointSet); |
|
995 |
SolidColorBrush FontColor = _SetColor; |
|
996 |
double Angle = control.Angle; |
|
997 |
double Opacity = control.Opac; |
|
998 |
|
|
999 |
string imgpath = CommonLib.Common.GetConfigString("CheckmarkImgPath", "URL", ""); |
|
1000 |
Controls_PDF.HoneyPDFLib_DrawSet_Symbol.DrawCheckMark(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath); |
|
1001 |
} |
|
1002 |
break; |
|
1003 |
#endregion |
|
1004 |
#region Image |
|
1005 |
case "ImgControl": |
|
1006 |
using (S_ImgControl control = JsonSerializerHelper.JsonDeserialize<S_ImgControl>(item)) |
|
1007 |
{ |
|
1008 |
double Angle = control.Angle; |
|
1009 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
|
1010 |
Point TopRightPoint = GetPdfPointSystem(control.TR); |
|
1011 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
|
1012 |
Point LeftBottomPoint = GetPdfPointSystem(control.LB); |
|
1013 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
|
1014 |
double Opacity = control.Opac; |
|
1015 |
string FilePath = control.ImagePath; |
|
1016 |
//Uri uri = new Uri(s.ImagePath); |
|
1017 |
|
|
1018 |
Controls_PDF.HoneyPDFLib_DrawSet_Image.DrawImage(StartPoint, EndPoint, PointSet, contentByte, FilePath, Angle, Opacity); |
내보내기 Unified diff