KMNAnnotationPopMode.swift 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. //
  2. // KMNAnnotationPopMode.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by 丁林圭 on 2024/12/1.
  6. //
  7. import Cocoa
  8. @objc public enum ListViewPopType: Int, CaseIterable{
  9. case generaAnnotation = 0
  10. case freeTextAnnotation
  11. case shapeAnnotation
  12. case linkAnnotation
  13. case formAnnotation
  14. case formRadioAnnotation
  15. case multpleAnnotation
  16. case popTypeNone
  17. }
  18. @objc public enum linkDetailType: Int, CaseIterable{
  19. case linkSetting
  20. case page
  21. case url
  22. case email
  23. }
  24. @objc public enum DetailPopType: Int, CaseIterable{
  25. case freeTextAlight = 0
  26. case contentEditAlight
  27. case freeTextDoubleAlight
  28. case doubleObjectAlight
  29. case freeTextMultpleAlight
  30. case multpleObjectAlight
  31. case detailNone
  32. }
  33. @objc public enum ObjectAlignType: Int, CaseIterable{
  34. case alightLeft = 0
  35. case alightRight
  36. case alightTop
  37. case alightVer
  38. case alightHor
  39. case alightBottom
  40. case averageVer
  41. case averageHor
  42. }
  43. @objc public enum ListViewDetailPopType: Int, CaseIterable{
  44. case textAlight = 0
  45. case alight
  46. }
  47. let changeValue:CGFloat = 1.0
  48. class KMNAnnotationPopMode: NSObject {
  49. private(set) var annotation: CPDFAnnotation?
  50. private(set) var annotations: [CPDFAnnotation] = []
  51. private(set) var annotationType: CAnnotationType = CAnnotationType.unkown
  52. private(set) var popType: ListViewPopType = .popTypeNone
  53. init(pdfAnnotations: [CPDFAnnotation]) {
  54. super.init()
  55. if let firstAnnotation = pdfAnnotations.first {
  56. annotation = firstAnnotation
  57. }
  58. self.annotations = pdfAnnotations
  59. popType = self.annotationPopType()
  60. }
  61. private func annotationPopType()->ListViewPopType {
  62. let firstAnnotation:CPDFAnnotation = annotations.first ?? CPDFAnnotation.init()
  63. let type = annotationType(annotation: firstAnnotation)
  64. if annotations.count == 0 {
  65. return .popTypeNone
  66. } else if annotations.count == 1 {
  67. return type
  68. } else {
  69. var isSampleAnnotation = true
  70. for i in 1 ..< annotations.count {
  71. let annotation = annotations[i]
  72. if type != annotationType(annotation: annotation) {
  73. isSampleAnnotation = false
  74. break
  75. }
  76. }
  77. if(isSampleAnnotation) {
  78. return type
  79. } else {
  80. return .popTypeNone
  81. }
  82. }
  83. }
  84. public func annotationType(annotation:CPDFAnnotation)->ListViewPopType {
  85. if annotation.isKind(of: CPDFMarkupAnnotation.self) {
  86. return .generaAnnotation
  87. } else if annotation.isKind(of: CPDFFreeTextAnnotation.self) {
  88. return .freeTextAnnotation
  89. } else if (annotation.isKind(of: CPDFInkAnnotation.self) ||
  90. annotation.isKind(of: CPDFCircleAnnotation.self) ||
  91. annotation.isKind(of: CPDFSquareAnnotation.self) ||
  92. annotation.isKind(of: CPDFLineAnnotation.self) ||
  93. annotation.isKind(of: CPDFPolygonAnnotation.self) ||
  94. annotation.isKind(of: CPDFPolylineAnnotation.self) ||
  95. annotation.isKind(of: CSelfSignAnnotation.self)) {
  96. return .shapeAnnotation
  97. } else if annotation.isKind(of: CPDFLinkAnnotation.self) {
  98. if(annotations.count > 1) {
  99. return .multpleAnnotation
  100. } else {
  101. return .linkAnnotation
  102. }
  103. } else if annotation.isForm() {
  104. if(annotations.count > 1) {
  105. return .multpleAnnotation
  106. } else if(annotations.count == 1) {
  107. if(annotation.isKind(of: CPDFButtonWidgetAnnotation.self)) {
  108. let button = annotation as! CPDFButtonWidgetAnnotation
  109. if(button.controlType() == .radioButtonControl) {
  110. return .formRadioAnnotation
  111. }
  112. }
  113. return .formAnnotation
  114. }
  115. }
  116. return .popTypeNone
  117. }
  118. private func convertAnnotationType(firstAnnotation:CPDFAnnotation) -> CAnnotationType {
  119. var annotationType = CAnnotationType.unkown
  120. if firstAnnotation.isKind(of: CSelfSignAnnotationFreeText.self) {
  121. let freeText:CSelfSignAnnotationFreeText = firstAnnotation as! CSelfSignAnnotationFreeText
  122. annotationType = freeText.subType
  123. } else if firstAnnotation.isKind(of: CPDFPolygonAnnotation.self) {
  124. annotationType = CAnnotationType.measurePolyGon
  125. } else if firstAnnotation.isKind(of: CPDFPolylineAnnotation.self) {
  126. annotationType = CAnnotationType.measurePolyLine
  127. } else if firstAnnotation.isKind(of: CSelfSignAnnotation.self) {
  128. let selfSignAnnotation:CSelfSignAnnotation = firstAnnotation as! CSelfSignAnnotation
  129. annotationType = selfSignAnnotation.annotationType
  130. } else if firstAnnotation.isKind(of: CPDFFreeTextAnnotation.self) {
  131. annotationType = CAnnotationType.freeText
  132. } else if firstAnnotation.isKind(of: CPDFTextAnnotation.self) {
  133. annotationType = CAnnotationType.anchored
  134. } else if firstAnnotation.isKind(of: CPDFCircleAnnotation.self) {
  135. annotationType = CAnnotationType.circle
  136. } else if firstAnnotation.isKind(of: CPDFSquareAnnotation.self) {
  137. annotationType = CAnnotationType.square
  138. } else if firstAnnotation.isKind(of: CPDFMarkupAnnotation.self) {
  139. let markupAnnotation:CPDFMarkupAnnotation = firstAnnotation as! CPDFMarkupAnnotation
  140. let markupType = markupAnnotation.markupType()
  141. if markupType == .highlight {
  142. annotationType = CAnnotationType.highlight
  143. } else if(markupType == .strikeOut) {
  144. annotationType = CAnnotationType.strikeOut
  145. } else if(markupType == .underline) {
  146. annotationType = CAnnotationType.underline
  147. } else if(markupType == .squiggly) {
  148. annotationType = CAnnotationType.squiggly
  149. }
  150. } else if firstAnnotation.isKind(of: CPDFLineAnnotation.self) {
  151. let lineAnnotation:CPDFLineAnnotation = firstAnnotation as! CPDFLineAnnotation
  152. if lineAnnotation.isMeasure == true {
  153. annotationType = CAnnotationType.measureLine
  154. } else if lineAnnotation.isArrowLine() == true {
  155. annotationType = CAnnotationType.arrow
  156. } else {
  157. annotationType = CAnnotationType.line
  158. }
  159. } else if firstAnnotation.isKind(of: KMTableAnnotation.self) {
  160. annotationType = CAnnotationType.table
  161. } else if firstAnnotation.isKind(of: CPDFInkAnnotation.self) {
  162. annotationType = CAnnotationType.ink
  163. } else if firstAnnotation.isKind(of: CPDFLinkAnnotation.self) {
  164. annotationType = CAnnotationType.link
  165. } else if firstAnnotation.isKind(of: CPDFListSignatureAnnotation.self) {
  166. annotationType = CAnnotationType.signSignature
  167. } else if firstAnnotation.isKind(of: CPDFStampAnnotation.self) {
  168. annotationType = CAnnotationType.stamp
  169. } else if firstAnnotation.isKind(of: CPDFButtonWidgetAnnotation.self) {
  170. let buttonWidgetAnnotation:CPDFButtonWidgetAnnotation = firstAnnotation as! CPDFButtonWidgetAnnotation
  171. let controlType = buttonWidgetAnnotation.controlType()
  172. if controlType == .radioButtonControl {
  173. annotationType = CAnnotationType.radioButton
  174. } else if(controlType == .checkBoxControl) {
  175. annotationType = CAnnotationType.checkBox
  176. } else if(controlType == .pushButtonControl) {
  177. annotationType = CAnnotationType.actionButton
  178. }
  179. } else if firstAnnotation.isKind(of: CPDFTextWidgetAnnotation.self) {
  180. annotationType = CAnnotationType.textField
  181. } else if firstAnnotation.isKind(of: CPDFChoiceWidgetAnnotation.self) {
  182. annotationType = CAnnotationType.textField
  183. }
  184. else if firstAnnotation.isKind(of: CPDFChoiceWidgetAnnotation.self) {
  185. let choiceWidgetAnnotation:CPDFChoiceWidgetAnnotation = firstAnnotation as! CPDFChoiceWidgetAnnotation
  186. if(choiceWidgetAnnotation.isListChoice == true) {
  187. annotationType = CAnnotationType.listMenu
  188. } else {
  189. annotationType = CAnnotationType.comboBox
  190. }
  191. } else if firstAnnotation.isKind(of: CPDFSignatureWidgetAnnotation.self) {
  192. annotationType = CAnnotationType.signature
  193. }
  194. return annotationType
  195. }
  196. public func annotationColor()->NSColor? { //返回颜色是nil说明颜色不一样,返回透明则说明是没有颜色或者透明色
  197. var color:NSColor? = nil
  198. let isNotSameColor: Bool = CPDFListView.isAnnotationsContainMultiType(annotations, withType: .color)
  199. if isNotSameColor == false {
  200. var anColor = annotation?.color
  201. if let selfAnnotation = annotation as? CSelfSignAnnotation {
  202. anColor = selfAnnotation.lineColor
  203. }
  204. color = (anColor != nil) ? anColor : .clear
  205. }
  206. return color
  207. }
  208. public func setAnnotationColor(annotationColor:NSColor?) {
  209. for i in 0 ..< annotations.count {
  210. let annotation = annotations[i]
  211. if annotation.isKind(of: CSelfSignAnnotation.self) == true {
  212. if let signAnnotation:CSelfSignAnnotation = annotation as? CSelfSignAnnotation {
  213. signAnnotation.lineColor = annotationColor
  214. }
  215. } else {
  216. annotation.color = annotationColor
  217. }
  218. let annotationType = convertAnnotationType(firstAnnotation: annotation)
  219. var keyValue = ""
  220. if annotationType == .highlight {
  221. keyValue = CHighlightNoteColorKey
  222. } else if annotationType == .underline {
  223. keyValue = CUnderlineNoteColorKey
  224. } else if annotationType == .strikeOut {
  225. keyValue = CStrikeOutNoteColorKey
  226. } else if annotationType == .squiggly {
  227. keyValue = CSquigglyNoteColorKey
  228. } else if annotationType == .circle {
  229. keyValue = CCircleNoteColorKey
  230. } else if annotationType == .square {
  231. keyValue = CSquareNoteColorKey
  232. } else if annotationType == .freeText ||
  233. annotationType == .signDate ||
  234. annotationType == .signText {
  235. keyValue = CFreeTextNoteBorderColorKey
  236. } else if annotationType == .line {
  237. keyValue = CLineNoteColorKey
  238. } else if annotationType == .arrow {
  239. keyValue = CArrowNoteColorKey
  240. } else if annotationType == .ink {
  241. keyValue = CInkNoteColorKey
  242. } else if annotationType == .signFalse {
  243. keyValue = CAnnotationSelfSignFalseColorKey
  244. } else if annotationType == .signTure {
  245. keyValue = CAnnotationSelfSignTureColorKey
  246. } else if annotationType == .signLine {
  247. keyValue = CAnnotationSelfSignLineColorKey
  248. } else if annotationType == .signDot {
  249. keyValue = CAnnotationSelfSignDotColorKey
  250. } else if annotationType == .redact {
  251. keyValue = CAnnotationRedactBorderColorKey
  252. }
  253. if keyValue.isEmpty == false {
  254. if annotationColor != nil {
  255. UserDefaults.standard.setPDFListViewColor(annotationColor!, forKey: keyValue)
  256. } else {
  257. UserDefaults.standard.removeObject(forKey: keyValue)
  258. }
  259. }
  260. }
  261. }
  262. public func annotationFontColor()->NSColor? { //不管相同还是不相同 pop框都是显示第一个颜色
  263. var fontColor:NSColor? = nil
  264. if annotation?.isKind(of: CPDFFreeTextAnnotation.self) == true {
  265. let freeTextAnnotation = annotation as! CPDFFreeTextAnnotation
  266. let anColor = freeTextAnnotation.fontColor
  267. fontColor = (anColor != nil) ? anColor : .clear
  268. }
  269. return fontColor
  270. }
  271. public func setAnnotationFontColor(annotationFontColor:NSColor?) {
  272. for i in 0 ..< annotations.count {
  273. let annotation = annotations[i]
  274. if annotation.isKind(of: CPDFFreeTextAnnotation.self) == true {
  275. let freeTextAnnotation = annotation as! CPDFFreeTextAnnotation
  276. freeTextAnnotation.fontColor = annotationFontColor
  277. let keyValue = CFreeTextNoteFontColorKey
  278. if annotationFontColor != nil {
  279. UserDefaults.standard.setPDFListViewColor(annotationFontColor!, forKey: keyValue)
  280. } else {
  281. UserDefaults.standard.removeObject(forKey: keyValue)
  282. }
  283. }
  284. }
  285. }
  286. public func annotationAlignment()->NSTextAlignment { //natural时说明不一致
  287. var textAlignment:NSTextAlignment = .natural
  288. if annotation?.isKind(of: CPDFFreeTextAnnotation.self) == true {
  289. let freeTextAnnotation = annotation as! CPDFFreeTextAnnotation
  290. let isNotSameColor: Bool = CPDFListView.isAnnotationsContainMultiType(annotations, withType: .font_Alignment)
  291. if isNotSameColor == false {
  292. textAlignment = freeTextAnnotation.alignment
  293. }
  294. }
  295. return textAlignment
  296. }
  297. public func setAnnotationAlignment(annotationAlignment:NSTextAlignment) {
  298. for i in 0 ..< annotations.count {
  299. let annotation = annotations[i]
  300. if annotation.isKind(of: CPDFFreeTextAnnotation.self) == true {
  301. let freeTextAnnotation = annotation as! CPDFFreeTextAnnotation
  302. freeTextAnnotation.alignment = annotationAlignment
  303. let keyValue = CFreeTextNoteAlignmentKey
  304. UserDefaults.standard.set(annotationAlignment.rawValue, forKey: keyValue)
  305. }
  306. }
  307. }
  308. public func annotationFontName()->CPDFFont? { //返回字体是nil说明字体名不一样
  309. var cFont:CPDFFont? = nil
  310. if annotation?.isKind(of: CPDFFreeTextAnnotation.self) == true {
  311. let isNotSameName: Bool = CPDFListView.isAnnotationsContainMultiType(annotations, withType: .font_Name)
  312. let isNotSameStyle: Bool = CPDFListView.isAnnotationsContainMultiType(annotations, withType: .font_Style)
  313. if isNotSameName == false && isNotSameStyle == false {
  314. let freeTextAnnotation = annotation as! CPDFFreeTextAnnotation
  315. cFont = freeTextAnnotation.cFont
  316. }
  317. }
  318. return cFont
  319. }
  320. public func setAnnotationFont(font:CPDFFont) {
  321. for i in 0 ..< annotations.count {
  322. let annotation = annotations[i]
  323. if annotation.isKind(of: CPDFFreeTextAnnotation.self) == true {
  324. let freeTextAnnotation = annotation as! CPDFFreeTextAnnotation
  325. freeTextAnnotation.cFont = font
  326. let keyValue = CFreeTextNoteFontNameKey
  327. let appleFont:String = CPDFFont.convertAppleFont(font) ?? "Helvetica"
  328. UserDefaults.standard.set(appleFont, forKey: keyValue)
  329. }
  330. }
  331. }
  332. public func annotationFieldName()->String? { //pop只有一个的时候才会支持获取,不然是对齐
  333. var fieldName:String? = nil
  334. if annotations.count == 1 && annotation?.isForm() == true {
  335. if(annotation?.isKind(of: CPDFWidgetAnnotation.self) == true) {
  336. if let widgetAnnotation = annotation as? CPDFWidgetAnnotation {
  337. fieldName = widgetAnnotation.fieldName()
  338. }
  339. }
  340. }
  341. return fieldName
  342. }
  343. public func setannotationFieldName(fieldName:String) {
  344. for i in 0 ..< annotations.count {
  345. let annotation = annotations[i]
  346. if annotation.isKind(of: CPDFWidgetAnnotation.self) == true {
  347. if let widgetAnnotation = annotation as? CPDFWidgetAnnotation {
  348. widgetAnnotation.setFieldName(fieldName)
  349. }
  350. }
  351. }
  352. }
  353. public func annotationGropName()->String? { //pop只有一个的时候才会支持获取,不然是对齐
  354. var gropNameName:String? = nil
  355. if annotations.count == 1 && annotation?.isForm() == true {
  356. if(annotation?.isKind(of: CPDFButtonWidgetAnnotation.self) == true) {
  357. if let buttonWidgetAnnotation = annotation as? CPDFButtonWidgetAnnotation {
  358. if buttonWidgetAnnotation.controlType() == .radioButtonControl {
  359. gropNameName = buttonWidgetAnnotation.buttonWidgetStateString()
  360. }
  361. }
  362. }
  363. }
  364. return gropNameName
  365. }
  366. public func setannotationGropName(gropName:String) {
  367. for i in 0 ..< annotations.count {
  368. let annotation = annotations[i]
  369. if(annotation.isKind(of: CPDFButtonWidgetAnnotation.self) == true) {
  370. if let buttonWidgetAnnotation = annotation as? CPDFButtonWidgetAnnotation {
  371. buttonWidgetAnnotation.setButtonWidgetStateString(gropName)
  372. }
  373. }
  374. }
  375. }
  376. public func zoomOutFontSize()->Bool{ //悬浮菜单注释同一类型
  377. var isChange:Bool = false
  378. for i in 0 ..< annotations.count {
  379. let annotation = annotations[i]
  380. if annotation.isKind(of: CPDFFreeTextAnnotation.self) == true {
  381. let freeTextAnnotation = annotation as! CPDFFreeTextAnnotation
  382. var fontSize = freeTextAnnotation.fontSize
  383. if(fontSize > changeValue) {
  384. fontSize -= changeValue
  385. freeTextAnnotation.fontSize = fontSize
  386. let keyValue = CFreeTextNoteFontSizeKey
  387. UserDefaults.standard.set(fontSize, forKey: keyValue)
  388. isChange = true
  389. }
  390. }
  391. }
  392. return isChange
  393. }
  394. public func zoomInFontSize()->Bool{ //悬浮菜单注释同一类型
  395. for i in 0 ..< annotations.count {
  396. let annotation = annotations[i]
  397. if annotation.isKind(of: CPDFFreeTextAnnotation.self) == true {
  398. let freeTextAnnotation = annotation as! CPDFFreeTextAnnotation
  399. var fontSize = freeTextAnnotation.fontSize
  400. fontSize += changeValue
  401. freeTextAnnotation.fontSize = fontSize
  402. let keyValue = CFreeTextNoteFontSizeKey
  403. UserDefaults.standard.set(fontSize, forKey: keyValue)
  404. }
  405. }
  406. return true
  407. }
  408. public func zoomOutShapeWidth()->Bool{
  409. for i in 0 ..< annotations.count {
  410. let annotation = annotations[i]
  411. var shapeWidth = annotation.borderWidth
  412. if annotation.isKind(of: CSelfSignAnnotation.self) == true {
  413. if let signAnnotation:CSelfSignAnnotation = annotation as? CSelfSignAnnotation {
  414. shapeWidth = signAnnotation.lineAnnotationWidth
  415. }
  416. }
  417. if(shapeWidth > changeValue) {
  418. shapeWidth -= changeValue
  419. if annotation.isKind(of: CSelfSignAnnotation.self) == true {
  420. if let signAnnotation:CSelfSignAnnotation = annotation as? CSelfSignAnnotation {
  421. signAnnotation.lineAnnotationWidth = shapeWidth
  422. }
  423. } else {
  424. annotation.borderWidth = shapeWidth
  425. }
  426. var keyValue = ""
  427. let annotationType = convertAnnotationType(firstAnnotation: annotation)
  428. if annotationType == .circle {
  429. keyValue = CCircleNoteLineWidthKey
  430. } else if annotationType == .square {
  431. keyValue = CSquareNoteLineWidthKey
  432. } else if annotationType == .line {
  433. keyValue = CLineNoteLineWidthKey
  434. } else if annotationType == .arrow {
  435. keyValue = CArrowNoteLineWidthKey
  436. } else if annotationType == .ink {
  437. keyValue = CInkNoteLineWidthKey
  438. } else if annotationType == .freeText {
  439. keyValue = CAnnotationTextWidgetLineWidthKey
  440. } else if annotationType == .signFalse {
  441. keyValue = CAnnotationSelfSignFalseLineWidthKey
  442. } else if annotationType == .signTure {
  443. keyValue = CAnnotationSelfSignTureLineWidthKey
  444. } else if annotationType == .signCircle {
  445. keyValue = CAnnotationSelfSignCircleLineWidthKey
  446. } else if annotationType == .signLine {
  447. keyValue = CAnnotationSelfSignLineLineWidthKey
  448. }
  449. if keyValue.isEmpty == false {
  450. UserDefaults.standard.set(shapeWidth, forKey: keyValue)
  451. }
  452. return true
  453. }
  454. }
  455. return false
  456. }
  457. public func zoomInShapeWidth()->Bool{
  458. for i in 0 ..< annotations.count {
  459. let annotation = annotations[i]
  460. var shapeWidth = annotation.borderWidth
  461. if annotation.isKind(of: CSelfSignAnnotation.self) == true {
  462. if let signAnnotation:CSelfSignAnnotation = annotation as? CSelfSignAnnotation {
  463. shapeWidth = signAnnotation.lineAnnotationWidth
  464. }
  465. }
  466. shapeWidth += changeValue
  467. if annotation.isKind(of: CSelfSignAnnotation.self) == true {
  468. if let signAnnotation:CSelfSignAnnotation = annotation as? CSelfSignAnnotation {
  469. signAnnotation.lineAnnotationWidth = shapeWidth
  470. }
  471. } else {
  472. annotation.borderWidth = shapeWidth
  473. }
  474. var keyValue = ""
  475. let annotationType = convertAnnotationType(firstAnnotation: annotation)
  476. if annotationType == .circle {
  477. keyValue = CCircleNoteLineWidthKey
  478. } else if annotationType == .square {
  479. keyValue = CSquareNoteLineWidthKey
  480. } else if annotationType == .line {
  481. keyValue = CLineNoteLineWidthKey
  482. } else if annotationType == .arrow {
  483. keyValue = CArrowNoteLineWidthKey
  484. } else if annotationType == .ink {
  485. keyValue = CInkNoteLineWidthKey
  486. } else if annotationType == .freeText {
  487. keyValue = CAnnotationTextWidgetLineWidthKey
  488. } else if annotationType == .signFalse {
  489. keyValue = CAnnotationSelfSignFalseLineWidthKey
  490. } else if annotationType == .signTure {
  491. keyValue = CAnnotationSelfSignTureLineWidthKey
  492. } else if annotationType == .signCircle {
  493. keyValue = CAnnotationSelfSignCircleLineWidthKey
  494. } else if annotationType == .signLine {
  495. keyValue = CAnnotationSelfSignLineLineWidthKey
  496. }
  497. if keyValue.isEmpty == false {
  498. UserDefaults.standard.set(shapeWidth, forKey: keyValue)
  499. }
  500. }
  501. return true
  502. }
  503. }