Browse Source

【OCToSwift】CPDFLineAnnotation+PDFListView

tangchao 1 year ago
parent
commit
b0f80883b2

+ 8 - 10
PDF Office/PDF Master.xcodeproj/project.pbxproj

@@ -2484,6 +2484,9 @@
 		BB5F8A1F29BB15AD00365ADB /* KMEmailSubWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = BB5F8A1829BB15AD00365ADB /* KMEmailSubWindowController.m */; };
 		BB5F8A2029BB15AD00365ADB /* KMEmailSubWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = BB5F8A1829BB15AD00365ADB /* KMEmailSubWindowController.m */; };
 		BB5F8A2129BB15AD00365ADB /* KMEmailSubWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = BB5F8A1829BB15AD00365ADB /* KMEmailSubWindowController.m */; };
+		BB6719E52AD28527003D44D5 /* CPDFLineAnnotation+PDFListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6719E42AD28527003D44D5 /* CPDFLineAnnotation+PDFListView.swift */; };
+		BB6719E62AD28527003D44D5 /* CPDFLineAnnotation+PDFListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6719E42AD28527003D44D5 /* CPDFLineAnnotation+PDFListView.swift */; };
+		BB6719E72AD28527003D44D5 /* CPDFLineAnnotation+PDFListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6719E42AD28527003D44D5 /* CPDFLineAnnotation+PDFListView.swift */; };
 		BB69C95C299116FD0001A9B1 /* five_line_score.pdf in Resources */ = {isa = PBXBuildFile; fileRef = BB69C959299116FD0001A9B1 /* five_line_score.pdf */; };
 		BB69C95D299116FD0001A9B1 /* five_line_score.pdf in Resources */ = {isa = PBXBuildFile; fileRef = BB69C959299116FD0001A9B1 /* five_line_score.pdf */; };
 		BB69C95E299116FD0001A9B1 /* five_line_score.pdf in Resources */ = {isa = PBXBuildFile; fileRef = BB69C959299116FD0001A9B1 /* five_line_score.pdf */; };
@@ -3315,9 +3318,6 @@
 		F3732305292DF9410013862C /* CPDFSquareAnnotation+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = F37322D4292DF9410013862C /* CPDFSquareAnnotation+PDFListView.m */; };
 		F3732306292DF9410013862C /* CPDFSquareAnnotation+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = F37322D4292DF9410013862C /* CPDFSquareAnnotation+PDFListView.m */; };
 		F3732307292DF9410013862C /* CPDFSquareAnnotation+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = F37322D4292DF9410013862C /* CPDFSquareAnnotation+PDFListView.m */; };
-		F3732308292DF9410013862C /* CPDFLineAnnotation+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = F37322D5292DF9410013862C /* CPDFLineAnnotation+PDFListView.m */; };
-		F3732309292DF9410013862C /* CPDFLineAnnotation+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = F37322D5292DF9410013862C /* CPDFLineAnnotation+PDFListView.m */; };
-		F373230A292DF9410013862C /* CPDFLineAnnotation+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = F37322D5292DF9410013862C /* CPDFLineAnnotation+PDFListView.m */; };
 		F373230B292DF9410013862C /* CPDFTextWidgetAnnotation+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = F37322D6292DF9410013862C /* CPDFTextWidgetAnnotation+PDFListView.m */; };
 		F373230C292DF9410013862C /* CPDFTextWidgetAnnotation+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = F37322D6292DF9410013862C /* CPDFTextWidgetAnnotation+PDFListView.m */; };
 		F373230D292DF9410013862C /* CPDFTextWidgetAnnotation+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = F37322D6292DF9410013862C /* CPDFTextWidgetAnnotation+PDFListView.m */; };
@@ -4510,6 +4510,7 @@
 		BB5F8A1629BB15AD00365ADB /* pic_mail.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = pic_mail.pdf; sourceTree = "<group>"; };
 		BB5F8A1729BB15AD00365ADB /* KMEmailSubWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMEmailSubWindowController.xib; sourceTree = "<group>"; };
 		BB5F8A1829BB15AD00365ADB /* KMEmailSubWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KMEmailSubWindowController.m; sourceTree = "<group>"; };
+		BB6719E42AD28527003D44D5 /* CPDFLineAnnotation+PDFListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CPDFLineAnnotation+PDFListView.swift"; sourceTree = "<group>"; };
 		BB69C959299116FD0001A9B1 /* five_line_score.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = five_line_score.pdf; sourceTree = "<group>"; };
 		BB69C95A299116FD0001A9B1 /* plaid.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = plaid.pdf; sourceTree = "<group>"; };
 		BB69C95B299116FD0001A9B1 /* horizontal_line.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = horizontal_line.pdf; sourceTree = "<group>"; };
@@ -4859,7 +4860,6 @@
 		F37322BF292DF9410013862C /* CPDFAnnotationHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPDFAnnotationHeader.h; sourceTree = "<group>"; };
 		F37322C0292DF9410013862C /* CPDFSignatureWidgetAnnotation+PDFListView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CPDFSignatureWidgetAnnotation+PDFListView.h"; sourceTree = "<group>"; };
 		F37322C3292DF9410013862C /* CPDFTextWidgetAnnotation+PDFListView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CPDFTextWidgetAnnotation+PDFListView.h"; sourceTree = "<group>"; };
-		F37322C4292DF9410013862C /* CPDFLineAnnotation+PDFListView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CPDFLineAnnotation+PDFListView.h"; sourceTree = "<group>"; };
 		F37322C7292DF9410013862C /* CSelfSignAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSelfSignAnnotation.h; sourceTree = "<group>"; };
 		F37322C8292DF9410013862C /* CSelfSignAnnotationFreeText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSelfSignAnnotationFreeText.m; sourceTree = "<group>"; };
 		F37322C9292DF9410013862C /* CSelfSignAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSelfSignAnnotation.m; sourceTree = "<group>"; };
@@ -4871,7 +4871,6 @@
 		F37322D2292DF9410013862C /* CPDFLinkAnnotation+PDFListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CPDFLinkAnnotation+PDFListView.m"; sourceTree = "<group>"; };
 		F37322D3292DF9410013862C /* CPDFStampAnnotation+PDFListView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CPDFStampAnnotation+PDFListView.h"; sourceTree = "<group>"; };
 		F37322D4292DF9410013862C /* CPDFSquareAnnotation+PDFListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CPDFSquareAnnotation+PDFListView.m"; sourceTree = "<group>"; };
-		F37322D5292DF9410013862C /* CPDFLineAnnotation+PDFListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CPDFLineAnnotation+PDFListView.m"; sourceTree = "<group>"; };
 		F37322D6292DF9410013862C /* CPDFTextWidgetAnnotation+PDFListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CPDFTextWidgetAnnotation+PDFListView.m"; sourceTree = "<group>"; };
 		F37322D9292DF9410013862C /* CPDFSignatureWidgetAnnotation+PDFListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CPDFSignatureWidgetAnnotation+PDFListView.m"; sourceTree = "<group>"; };
 		F37322DA292DF9410013862C /* CPDFTextAnnotation+PDFListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CPDFTextAnnotation+PDFListView.m"; sourceTree = "<group>"; };
@@ -9187,8 +9186,7 @@
 				BBBB6CD52AD150D20035AA66 /* CPDFCircleAnnotation+PDFListView.swift */,
 				BBBB6CD92AD15B900035AA66 /* CPDFFreeTextAnnotation+PDFListView.swift */,
 				BBBB6CDD2AD174080035AA66 /* CPDFInkAnnotation+PDFListView.swift */,
-				F37322C4292DF9410013862C /* CPDFLineAnnotation+PDFListView.h */,
-				F37322D5292DF9410013862C /* CPDFLineAnnotation+PDFListView.m */,
+				BB6719E42AD28527003D44D5 /* CPDFLineAnnotation+PDFListView.swift */,
 				F37322BB292DF9410013862C /* CPDFLinkAnnotation+PDFListView.h */,
 				F37322D2292DF9410013862C /* CPDFLinkAnnotation+PDFListView.m */,
 				F37322D1292DF9410013862C /* CPDFMarkupAnnotation+PDFListView.h */,
@@ -10910,7 +10908,6 @@
 				BB4DD047299B294000E80DF6 /* KMCloudFileEmptyView.swift in Sources */,
 				89316846296E436B0073EA59 /* KMPDFSignatureImageView.m in Sources */,
 				ADD272D029B9CFD30032B5D6 /* KMLightNoNetworkView.swift in Sources */,
-				F3732308292DF9410013862C /* CPDFLineAnnotation+PDFListView.m in Sources */,
 				9F1F82CA292F6CF90092C4B4 /* KMPDFInsertPageWindow.swift in Sources */,
 				8931683D296E436B0073EA59 /* KMPDFSignatureTextView.m in Sources */,
 				9FBA0EE128FEC253001117AF /* KMProductPromotionViewController.swift in Sources */,
@@ -11078,6 +11075,7 @@
 				BBFE6E6D2930D9C600142C01 /* KMMergeSettingWindowController.swift in Sources */,
 				9F8539CB29430BF300DF644E /* KMBrowserWindowController.swift in Sources */,
 				9F0CB5192986568000007028 /* KMDesignToken+BorderRadiusTopRight.swift in Sources */,
+				BB6719E52AD28527003D44D5 /* CPDFLineAnnotation+PDFListView.swift in Sources */,
 				9FBA0EF528FFC8A0001117AF /* KMCollectionView.swift in Sources */,
 				9F0CB4672967E5CB00007028 /* KMPropertiesPanelSubViewController.swift in Sources */,
 				8942F7FF29260EC700389627 /* KMLeftMethodMode.swift in Sources */,
@@ -11359,6 +11357,7 @@
 				9F1FE4B529406E4700E952CA /* CTBrowser.m in Sources */,
 				BB2E666029C885550000FEBC /* KMSignatureHelpViewController.m in Sources */,
 				ADB1FE5E2975182100ED072D /* KMBatchProcessingDeleteTableCell.swift in Sources */,
+				BB6719E62AD28527003D44D5 /* CPDFLineAnnotation+PDFListView.swift in Sources */,
 				9FDD0FAB29534FCC000C4DAD /* KMAliasLight.swift in Sources */,
 				ADC63E402A49816900854E02 /* KMSubscribeSuccessView.swift in Sources */,
 				BBF38A63294F53FD0086D025 /* KMWatermarkFileView.swift in Sources */,
@@ -11728,7 +11727,6 @@
 				ADC63E382A49813E00854E02 /* KMSubscribeSuccessWindowController.swift in Sources */,
 				AD71E7C52990A8A4001C5D3F /* KMBatchRemoveViewModel.swift in Sources */,
 				BB74DA782AC41182006EDFE7 /* NSFont+KMExtension.swift in Sources */,
-				F3732309292DF9410013862C /* CPDFLineAnnotation+PDFListView.m in Sources */,
 				ADD5AE562A64D31200C14249 /* KMPurchaseAlertView.swift in Sources */,
 				F34BF927295303E8002C25A2 /* NSCursor+PDFListView.m in Sources */,
 				ADB2D6EE2947415E0029D2B3 /* KMPrintPaperSetView.swift in Sources */,
@@ -12243,6 +12241,7 @@
 				BB4DD04D299B296500E80DF6 /* KMCloudPathControl.swift in Sources */,
 				ADCB98DB2924774F00B51A03 /* KMBatchProcessingOrderTableCell.swift in Sources */,
 				BBB9B32D299A5D6D004F3235 /* GTMOAuth2KeychainCompatibility.m in Sources */,
+				BB6719E72AD28527003D44D5 /* CPDFLineAnnotation+PDFListView.swift in Sources */,
 				9F0CB4EB2986559400007028 /* KMDesignToken+PaddingBottom.swift in Sources */,
 				89D9897628FE743E003A3E87 /* KMOutlineView.swift in Sources */,
 				F34BF94129530D02002C25A2 /* NSBezierPath+PDFListView.m in Sources */,
@@ -12539,7 +12538,6 @@
 				9F0CB4BF2977C06300007028 /* KMPropertiesPanelColorSubVC.swift in Sources */,
 				ADD1B6BD29420B4A00C3FFF7 /* KMPrintPreviewView.swift in Sources */,
 				BB146FF2299DC0D100784A6A /* GTLRUploadParameters.m in Sources */,
-				F373230A292DF9410013862C /* CPDFLineAnnotation+PDFListView.m in Sources */,
 				ADE8BC3D29F9458700570F89 /* KMRecommondManager.m in Sources */,
 				BB6B436D2A04935000E02B54 /* KMPDFThumbViewBaseController.swift in Sources */,
 				BBB9B330299A5D6D004F3235 /* GTMAppAuthFetcherAuthorization.m in Sources */,

+ 53 - 5
PDF Office/PDF Master.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -71,16 +71,64 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "CE1D713A-5ED0-429C-8A71-4266D6188CCA"
+            uuid = "D9465E32-7786-4AFC-BF9A-1602FA07BAC9"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFInkAnnotation+PDFListView.swift"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "142"
-            endingLineNumber = "142"
-            landmarkName = "pathsImage(_:)"
+            startingLineNumber = "245"
+            endingLineNumber = "245"
+            landmarkName = "_closedArrowExPoints(_:point:cpoint:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "D22DB8C9-04C7-490E-ABEF-653803D4918A"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "277"
+            endingLineNumber = "277"
+            landmarkName = "_squareExPoints(_:point:cpoint:borderWidth:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "734C870F-06D9-4009-B30B-FA60A8A7A087"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "321"
+            endingLineNumber = "321"
+            landmarkName = "_circleExPoints(_:point:cpoint:borderWidth:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "5566D3A6-CD33-46F4-95AB-B60ACB70F4FC"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "364"
+            endingLineNumber = "364"
+            landmarkName = "_diamondExPoints(_:point:cpoint:borderWidth:)"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>

+ 0 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotationModel.m

@@ -12,7 +12,6 @@
 
 #import "CPDFAnnotationModel.h"
 
-#import "CPDFLineAnnotation+PDFListView.h"
 #import "CPDFSquareAnnotation+PDFListView.h"
 #import "CPDFMarkupAnnotation+PDFListView.h"
 #import "CPDFStampAnnotation+PDFListView.h"

+ 0 - 43
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.h

@@ -1,43 +0,0 @@
-//
-//  CPDFLineAnnotation+PDFListView.h
-//  ComPDFKit
-//
-//  Copyright © 2014-2022 PDF Technologies, Inc. All Rights Reserved.
-//
-//  THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
-//  AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
-//  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
-//  This notice may not be removed from this file.
-//
-
-#import <ComPDFKit/ComPDFKit.h>
-
-#import "NSGraphics+PDFListView.h"
-#import "NSGeometry+PDFListView.h"
-
-@class CPDFAnnotationModel,CPDFListView;
-
-@interface CPDFLineAnnotation (PDFListView)
-
-- (instancetype)initPDFListViewNoteWithDocument:(CPDFDocument *)document  annotationType:(CAnnotationType)annotationType;
-
-- (void)drawSelectionHighlightForView:(CPDFListView *)pdfView inContext:(CGContextRef)context isHover:(BOOL)isHover;
-
-- (CRectEdges)resizeHandleForPoint:(NSPoint)point scaleFactor:(CGFloat)scaleFactor;
-
-- (NSPoint)observedStartPoint;
-
-- (void)setObservedStartPoint:(NSPoint)point;
-
-- (NSPoint)observedEndPoint;
-
-- (void)setObservedEndPoint:(NSPoint)point;
-
-- (NSSet *)keysForValuesToObserveForUndo;
-
-+ (CGPoint)drawLineExEndingWithStyle:(CPDFLineStyle)style point:(CGPoint)point cpoint:(CGPoint)cpoint inContext:(CGContextRef)context model:(CPDFAnnotationModel *)annotationModel;
-
-+ (NSImage *)annotationImageWithAnnotationModel:(CPDFAnnotationModel *)annotationModel;
-
-@end
-

+ 0 - 375
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.m

@@ -1,375 +0,0 @@
-//
-//  CPDFLineAnnotation+PDFListView.m
-//  ComPDFKit
-//
-//  Copyright © 2014-2022 PDF Technologies, Inc. All Rights Reserved.
-//
-//  THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
-//  AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
-//  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
-//  This notice may not be removed from this file.
-//
-
-#import "CPDFLineAnnotation+PDFListView.h"
-#import "CPDFListView+Tool.h"
-#import "CPDFListView+Private.h"
-
-#import "CPDFAnnotationModel.h"
-#import "CPDFListViewConfig.h"
-#import <PDF_Master-Swift.h>
-
-@implementation CPDFLineAnnotation (PDFListView)
-
-- (instancetype)initPDFListViewNoteWithDocument:(CPDFDocument *)document  annotationType:(CAnnotationType)annotationType {
-    self = [self initWithDocument:document];
-    if (self) {
-        CPDFAnnotationModel *annotationModel = [[CPDFAnnotationModel alloc] initWithAnnotationType:annotationType];
-        self.color = annotationModel.color;
-        
-        CPDFBorder *border = [[CPDFBorder alloc] initWithStyle:annotationModel.style lineWidth:annotationModel.lineWidth dashPattern:annotationModel.dashPattern];
-        [self setBorder:border];
-        self.opacity = annotationModel.opacity;
-        
-        [self setStartLineStyle:annotationModel.startLineStyle];
-        [self setEndLineStyle:annotationModel.endLineStyle];
-
-    }
-    return self;
-}
-
-- (void)drawSelectionHighlightForView:(CPDFListView *)pdfView inContext:(CGContextRef)context isHover:(BOOL)isHover {
-    if (NSIsEmptyRect([self bounds]))
-        return;
-    if ([self isResizable]) {
-        if((pdfView.activeAnnotations.count == 1 || pdfView.selectAnnotations.count > 0) || isHover) {
-            NSPoint point = [self startPoint];
-            CGFloat delta = 4.0 * [pdfView unitWidthOnPage:[self page]];
-            CPDFListViewDrawResizeHandle(context, point, delta, YES);
-            point = [self endPoint];
-            CPDFListViewDrawResizeHandle(context, point, delta, YES);
-        } else {
-            NSRect rect = [self bounds];
-            CGFloat lineWidth = [pdfView unitWidthOnPage:[self page]];
-            CGContextSaveGState(context);
-            CGColorRef color = [CPDFListViewConfig defaultManager].annotationBorderColor.CGColor;
-            CGContextSetStrokeColorWithColor(context, color);
-            
-            if(isHover) {
-                CGFloat length[] = {5,5};
-                CGContextSetLineDash(context, 0, length, 2);
-                CGContextStrokeRectWithWidth(context, rect, lineWidth);
-            } else {
-                CGContextStrokeRectWithWidth(context, CGRectInset(NSRectToCGRect(rect), 0,0), lineWidth);
-            }
-
-            CGContextRestoreGState(context);
-        }
-    }
-}
-
-- (CGRect)borderRecctForView:(CPDFListView *)pdfView{
-    NSRect rect = [pdfView integralRect:[self bounds] onPage:[self page]];
-    return rect;
-}
-
-- (BOOL)isResizable { return YES; }
-
-- (BOOL)isMovable { return YES; }
-
-- (BOOL)hitTest:(NSPoint)point {
-    CGFloat delta = fmax(4.0, 0.5 * [self lineWidth]);
-    return [self shouldDisplay] && CPDFListViewPointNearLineFromPointToPoint(CPDFListViewSubstractPoints(point, [self bounds].origin), CPDFListViewSubstractPoints([self observedStartPoint],[self bounds].origin), CPDFListViewSubstractPoints([self observedEndPoint],[self bounds].origin), delta);
-}
-
-- (CRectEdges)resizeHandleForPoint:(NSPoint)point scaleFactor:(CGFloat)scaleFactor {
-    if ([self isResizable] == NO)
-        return 0;
-    NSSize size = CPDFListViewMakeSquareSize(8 / scaleFactor);
-    if (NSPointInRect(point, CPDFListViewRectFromCenterAndSize([self endPoint], size)))
-        return CMaxXEdgeMask;
-    else if (NSPointInRect(point, CPDFListViewRectFromCenterAndSize([self startPoint], size)))
-        return CMinXEdgeMask;
-    else if ([self hitTest:point])
-        return CEditInEdgeMask;
-    else
-        return 0;
-}
-
-- (NSPoint)observedStartPoint {
-    return [self startPoint];
-}
-
-- (void)setObservedStartPoint:(NSPoint)point {
-    [self setStartPoint:point];
-}
-
-- (NSPoint)observedEndPoint {
-    return [self endPoint];
-}
-
-- (void)setObservedEndPoint:(NSPoint)point {
-    [self setEndPoint:point];
-}
-
-- (NSSet *)keysForValuesToObserveForUndo {
-    static NSSet *circleKeys = nil;
-    if (circleKeys == nil) {
-        NSMutableSet *mutableKeys = [[super keysForValuesToObserveForUndo] mutableCopy];
-        [mutableKeys addObjectsFromArray:@[CPDFAnnotationStartPointKey,
-                                           CPDFAnnotationEndPointKey,
-                                           CPDFAnnotationStartLineStyleKey,
-                                           CPDFAnnotationEndLineStyleKey,
-                                           CPDFAnnotationInteriorOpacityKey,
-                                           CPDFAnnotationInteriorColorKey]];
-        circleKeys = mutableKeys;
-    }
-    return circleKeys;
-}
-
-+ (CGPoint)drawLineExEndingWithStyle:(CPDFLineStyle)style point:(CGPoint)point cpoint:(CGPoint)cpoint inContext:(CGContextRef)context model:(CPDFAnnotationModel *)annotationModel {
-    CGPoint rpoint = point;
-    switch (style) {
-        case CPDFLineStyleOpenArrow: {
-            CGPoint points[3];
-            [self openArrowExPoints:points point:point cpoint:cpoint borderWidth:annotationModel.lineWidth];
-            CGContextBeginPath(context);
-            CGContextAddLines(context, points, 3);
-            CGContextDrawPath(context, kCGPathStroke);
-        }
-            break;
-        case CPDFLineStyleClosedArrow: {
-            CGPoint points[3];
-            rpoint = [self closedArrowExPoints:points point:point cpoint:cpoint];
-            CGContextBeginPath(context);
-            CGContextAddLines(context, points, 3);
-            CGContextClosePath(context);
-            CGContextDrawPath(context, kCGPathFillStroke);
-        }
-            break;
-        case CPDFLineStyleSquare: {
-            CGPoint points[4];
-            rpoint = [self squareExPoints:points point:point cpoint:cpoint borderWidth:annotationModel.lineWidth];
-            CGContextBeginPath(context);
-            CGContextAddLines(context, points, 4);
-            CGContextClosePath(context);
-            CGContextDrawPath(context, kCGPathFillStroke);
-        }
-            break;
-        case CPDFLineStyleCircle: {
-            CGPoint points[1];
-            rpoint = [self circleExPoints:points point:point cpoint:cpoint borderWidth:annotationModel.lineWidth];
-            CGFloat radius = sqrt((rpoint.x - points[0].x) * (rpoint.x - points[0].x) + (rpoint.y - points[0].y) * (rpoint.y - points[0].y));
-            CGContextBeginPath(context);
-            CGContextAddArc(context, points[0].x, points[0].y, radius, 0, 2 * M_PI, 0);
-            CGContextClosePath(context);
-            CGContextDrawPath(context, kCGPathFillStroke);
-        }
-            break;
-        case CPDFLineStyleDiamond: {
-            CGPoint points[4];
-            rpoint = [self diamondExPoints:points point:point cpoint:cpoint borderWidth:annotationModel.lineWidth];
-            CGContextBeginPath(context);
-            CGContextAddLines(context, points, 4);
-            CGContextClosePath(context);
-            CGContextDrawPath(context, kCGPathFillStroke);
-        }
-            break;
-        default:
-            break;
-    }
-    return rpoint;
-}
-
-+ (CGPoint)openArrowExPoints:(CGPoint *)points point:(CGPoint)point cpoint:(CGPoint)cpoint borderWidth:(CGFloat)borderWidth {
-    float len = 4 + borderWidth;
-    float dx = 0, dy = 0;
-    CGPoint point0 = CGPointZero;
-    CGPoint point1 = CGPointZero;
-    CGPoint point2 = CGPointZero;
-    
-    float mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y);
-    dx = (point.x - cpoint.x) * len / sqrt(mAB) ;
-    dy = (point.y - cpoint.y) * len / sqrt(mAB) ;
-    point0.x = point.x - dx;
-    point0.y = point.y - dy;
-    
-    float mCB = (point.x - point0.x) * (point.x - point0.x) + (point.y - point0.y) * (point.y - point0.y);
-    dx = -(point.y - point0.y) * len / sqrt(mCB) ;
-    dy = (point.x - point0.x) * len / sqrt(mCB) ;
-    point1.x = point0.x + dx;
-    point1.y = point0.y + dy;
-    point2.x = 2 * point0.x - point1.x;
-    point2.y = 2 * point0.y - point1.y;
-    
-    points[0] = point1;
-    points[1] = point;
-    points[2] = point2;
-    
-    return point0;
-}
-
-+ (CGPoint)closedArrowExPoints:(CGPoint *)points point:(CGPoint)point cpoint:(CGPoint)cpoint {
-    float len = 4;
-    float dx = 0, dy = 0;
-    CGPoint point0 = CGPointZero;
-    CGPoint point1 = CGPointZero;
-    CGPoint point2 = CGPointZero;
-    
-    float mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y);
-    dx = (point.x - cpoint.x) * len / sqrt(mAB) ;
-    dy = (point.y - cpoint.y) * len / sqrt(mAB) ;
-    point0.x = point.x - dx;
-    point0.y = point.y - dy;
-    
-    float mCB = (point.x - point0.x) * (point.x - point0.x) + (point.y - point0.y) * (point.y - point0.y);
-    dx = -(point.y - point0.y) * len / sqrt(mCB) ;
-    dy = (point.x - point0.x) * len / sqrt(mCB) ;
-    point1.x = point0.x + dx;
-    point1.y = point0.y + dy;
-    point2.x = 2 * point0.x - point1.x;
-    point2.y = 2 * point0.y - point1.y;
-    
-    points[0] = point1;
-    points[1] = point;
-    points[2] = point2;
-    
-    return point0;
-}
-
-+ (CGPoint)squareExPoints:(CGPoint *)points point:(CGPoint)point cpoint:(CGPoint)cpoint borderWidth:(CGFloat)borderWidth {
-    float len = MAX(4, borderWidth);
-    float dx = 0, dy = 0;
-    CGPoint point0 = CGPointZero;
-    CGPoint point1 = CGPointZero;
-    CGPoint point2 = CGPointZero;
-    CGPoint point3 = CGPointZero;
-    CGPoint point4 = CGPointZero;
-    CGPoint point5 = CGPointZero;
-    CGPoint point6 = CGPointZero;
-    
-    float mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y);
-    dx = (point.x - cpoint.x) * len / sqrt(mAB) ;
-    dy = (point.y - cpoint.y) * len / sqrt(mAB) ;
-    point0.x = point.x - dx;
-    point0.y = point.y - dy;
-    point5.x = point.x - 2 * dx;
-    point5.y = point.y - 2 * dy;
-    point6.x = point.x + dx;
-    point6.y = point.y + dy;
-    
-    float mCD = (point0.x - point5.x) * (point0.x - point5.x) + (point0.y - point5.y) * (point0.y - point5.y);
-    dx = -(point0.y - point5.y) * len / sqrt(mCD) ;
-    dy = (point0.x - point5.x) * len / sqrt(mCD) ;
-    point1.x = point5.x + dx;
-    point1.y = point5.y + dy;
-    point2.x = 2 * point5.x - point1.x;
-    point2.y = 2 * point5.y - point1.y;
-    
-    float mEB = (point6.x - point.x) * (point6.x - point.x) + (point6.y - point.y) * (point6.y - point.y);
-    dx = -(point6.y - point.y) * len / sqrt(mEB) ;
-    dy = (point6.x - point.x) * len / sqrt(mEB) ;
-    point3.x = point.x + dx;
-    point3.y = point.y + dy;
-    point4.x = 2 * point.x - point3.x;
-    point4.y = 2 * point.y - point3.y;
-    
-    points[0] = point1;
-    points[1] = point3;
-    points[2] = point4;
-    points[3] = point2;
-    
-    return point5;
-}
-
-+ (CGPoint)circleExPoints:(CGPoint *)points point:(CGPoint)point cpoint:(CGPoint)cpoint borderWidth:(CGFloat)borderWidth {
-    float len = MAX(4, borderWidth);
-    float dx = 0, dy = 0;
-    CGPoint point0 = CGPointZero;
-    CGPoint point1 = CGPointZero;
-    
-    float mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y);
-    dx = (point.x - cpoint.x) * len / sqrt(mAB) ;
-    dy = (point.y - cpoint.y) * len / sqrt(mAB) ;
-    point0.x = point.x - dx;
-    point0.y = point.y - dy;
-    point1.x = point.x - 2 * dx;
-    point1.y = point.y - 2 * dy;
-    
-    points[0] = point0;
-    
-    return point1;
-}
-
-+ (CGPoint)diamondExPoints:(CGPoint *)points point:(CGPoint)point cpoint:(CGPoint)cpoint borderWidth:(CGFloat)borderWidth {
-    float len = MAX(4, borderWidth);
-    float dx = 0, dy = 0;
-    CGPoint point0 = CGPointZero;
-    CGPoint point1 = CGPointZero;
-    CGPoint point2 = CGPointZero;
-    CGPoint point3 = CGPointZero;
-    
-    float mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y);
-    dx = (point.x - cpoint.x) * len / sqrt(mAB) ;
-    dy = (point.y - cpoint.y) * len / sqrt(mAB) ;
-    point0.x = point.x - dx;
-    point0.y = point.y - dy;
-    point3.x = point.x - 2 * dx;
-    point3.y = point.y - 2 * dy;
-    
-    float mCB = (point.x - point0.x) * (point.x - point0.x) + (point.y - point0.y) * (point.y - point0.y);
-    dx = -(point.y - point0.y) * len / sqrt(mCB) ;
-    dy = (point.x - point0.x) * len / sqrt(mCB) ;
-    point1.x = point0.x + dx;
-    point1.y = point0.y + dy;
-    point2.x = 2 * point0.x - point1.x;
-    point2.y = 2 * point0.y - point1.y;
-    
-    points[0] = point1;
-    points[1] = point;
-    points[2] = point2;
-    points[3] = point3;
-    
-    return point3;
-}
-
-+ (NSImage *)annotationImageWithAnnotationModel:(CPDFAnnotationModel *)annotationModel{
-    NSImage * image = [[NSImage alloc] initWithSize:CGSizeMake(50+annotationModel.lineWidth, 50+annotationModel.lineWidth)];
-    [image lockFocus];
-    [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
-    CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
-    
-    CGPoint startPoint = annotationModel.annotationImageStartPoint;
-    CGPoint endPoint = annotationModel.annotationImageEndPoint;
-    NSColor *color = [annotationModel.color colorWithAlphaComponent:annotationModel.opacity];
-    if (color) {
-        CGContextSetStrokeColorWithColor(context, color.CGColor);
-    }
-    NSColor *interiorColor = [annotationModel.interiorColor colorWithAlphaComponent:annotationModel.opacity];
-    if (interiorColor) {
-        CGContextSetFillColorWithColor(context, interiorColor.CGColor);
-    } else {
-        CGContextSetFillColorWithColor(context, [NSColor clearColor].CGColor);
-    }
-    CGContextSetLineWidth(context, annotationModel.lineWidth);
-    
-    startPoint = [CPDFLineAnnotation drawLineExEndingWithStyle:annotationModel.startLineStyle point:startPoint cpoint:endPoint inContext:context model:annotationModel];
-    endPoint = [CPDFLineAnnotation drawLineExEndingWithStyle:annotationModel.endLineStyle point:endPoint cpoint:startPoint inContext:context model:annotationModel];
-    if (annotationModel.style == CPDFBorderStyleDashed &&
-        annotationModel.dashPattern) {
-        size_t count = annotationModel.dashPattern.count;
-        CGFloat lengths[count];
-        for (int i=0; i<count; i++) {
-            lengths[i] = [annotationModel.dashPattern[i] floatValue];
-        }
-        CGContextSetLineDash(context, 0, lengths, count);
-    }
-    CGContextMoveToPoint(context, startPoint.x, startPoint.y);
-    CGContextAddLineToPoint(context, endPoint.x, endPoint.y);
-    CGContextStrokePath(context);
-    
-    [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationDefault];
-    [image unlockFocus];
-    return image;
-}
-
-@end

+ 369 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.swift

@@ -0,0 +1,369 @@
+//
+//  CPDFLineAnnotation+PDFListView.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/10/8.
+//
+
+import Foundation
+
+@objc extension CPDFLineAnnotation {
+    convenience init(PDFListViewNoteWith document: CPDFDocument, annotationType: CAnnotationType) {
+        self.init(document: document)
+        if let model = CPDFAnnotationModel(annotationType: annotationType) {
+            self.color = model.color()
+            self.border = CPDFBorder(style: model.style(), lineWidth: model.lineWidth(), dashPattern: model.dashPattern())
+            self.opacity = model.opacity()
+            
+            self.startLineStyle = model.startLineStyle()
+            self.endLineStyle = model.endLineStyle()
+        }
+    }
+    
+    override func drawSelectionHighlightForView(_ pdfView: CPDFListView, inContext context: CGContext, isHover: Bool) {
+        if (NSIsEmptyRect(self.bounds)) {
+            return
+        }
+        
+        if (self.isResizable()) {
+            if((pdfView.activeAnnotations.count == 1 || pdfView.selectAnnotations.count > 0) || isHover) {
+                var point = self.startPoint
+                let delta = 4.0 * pdfView.unitWidth(on: self.page)
+                CPDFListViewDrawResizeHandle(context, point, delta, true)
+                
+                point = self.endPoint
+                CPDFListViewDrawResizeHandle(context, point, delta, true)
+            } else {
+                let rect = self.bounds
+                let lineWidth = pdfView.unitWidth(on: self.page)
+                context.saveGState()
+                let color = CPDFListViewConfig.defaultManager().annotationBorderColor.cgColor
+                context.setStrokeColor(color)
+                
+                if(isHover) {
+                    var length: [CGFloat] = [5.0, 5.0]
+                    context.setLineDash(phase: 0, lengths: length)
+                    context.stroke(rect, width: lineWidth)
+                } else {
+                    context.stroke(CGRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
+                }
+                context.restoreGState()
+            }
+        }
+    }
+    
+    override func borderRecct(for pdfView: CPDFListView) -> CGRect {
+        let rect = pdfView.integralRect(self.bounds, on: self.page)
+        return rect
+    }
+    
+    override func isMovable() -> Bool {
+        return true
+    }
+    
+    override func isResizable() -> Bool {
+        return true
+    }
+    
+    override func hitTest(_ point: NSPoint) -> Bool {
+        let delta = fmax(4.0, 0.5 * self.lineWidth())
+        return self.shouldDisplay() && CPDFListViewPointNearLineFromPointToPoint(CPDFListViewSubstractPoints(point, self.bounds.origin), CPDFListViewSubstractPoints(self.observedStartPoint(),self.bounds.origin), CPDFListViewSubstractPoints(self.observedEndPoint(),self.bounds.origin), delta)
+    }
+    
+    func observedStartPoint() -> NSPoint {
+        return self.startPoint
+    }
+    
+    func setObservedStartPoint(_ point: NSPoint) {
+        self.startPoint = point
+    }
+    
+    func observedEndPoint() -> NSPoint {
+        return self.endPoint
+    }
+    
+    func setObservedEndPoint(_ point: NSPoint) {
+        self.endPoint = point
+    }
+    
+    override func resizeHandleForPoint(_ point: NSPoint, scaleFactor: CGFloat) -> CRectEdges {
+        if (!self.isResizable()) {
+            return CRectEdges(rawValue: 0)
+        }
+        let size = CPDFListViewMakeSquareSize(8 / scaleFactor)
+        if (NSPointInRect(point, CPDFListViewRectFromCenterAndSize(self.endPoint, size))) {
+            return .maxXEdgeMask
+        } else if (NSPointInRect(point, CPDFListViewRectFromCenterAndSize(self.startPoint, size))) {
+            return .minXEdgeMask
+        } else if (self.hitTest(point)) {
+            return .editInEdgeMask
+        }
+        
+        return CRectEdges(rawValue: 0)
+    }
+    
+    private static var _l_keys: Set<AnyHashable>?
+    override func keysForValuesToObserveForUndo() -> Set<AnyHashable>! {
+        if (CPDFLineAnnotation._l_keys == nil) {
+            CPDFLineAnnotation._l_keys = super.keysForValuesToObserveForUndo()
+            _ = CPDFLineAnnotation._l_keys?.insert(CPDFAnnotationStartPointKey)
+            _ = CPDFLineAnnotation._l_keys?.insert(CPDFAnnotationEndPointKey)
+            _ = CPDFLineAnnotation._l_keys?.insert(CPDFAnnotationStartLineStyleKey)
+            _ = CPDFLineAnnotation._l_keys?.insert(CPDFAnnotationEndLineStyleKey)
+            _ = CPDFLineAnnotation._l_keys?.insert(CPDFAnnotationInteriorOpacityKey)
+            _ = CPDFLineAnnotation._l_keys?.insert(CPDFAnnotationInteriorColorKey)
+        }
+        return CPDFLineAnnotation._l_keys
+    }
+    
+    class func annotationImage(annotationModel: CPDFAnnotationModel) -> NSImage? {
+        let image = NSImage(size: CGSizeMake(50+annotationModel.lineWidth(), 50+annotationModel.lineWidth()))
+        image.lockFocus()
+        NSGraphicsContext.current?.imageInterpolation = .high
+        let context = NSGraphicsContext.current?.cgContext
+        
+        var startPoint = annotationModel.annotationImageStartPoint()
+        var endPoint = annotationModel.annotationImageEndPoint()
+        if let color = annotationModel.color() {
+            context?.setStrokeColor(color.withAlphaComponent(annotationModel.opacity()).cgColor)
+        }
+        if let interiorColor = annotationModel.interiorColor() {
+            context?.setFillColor(interiorColor.withAlphaComponent(annotationModel.opacity()).cgColor)
+        } else {
+            context?.setFillColor(NSColor.clear.cgColor)
+        }
+        context?.setLineWidth(annotationModel.lineWidth())
+        
+        startPoint = self._drawLineExEnding(style: annotationModel.startLineStyle(), point: startPoint, cpoint: endPoint, inContext: context!, model: annotationModel)
+        endPoint = self._drawLineExEnding(style: annotationModel.endLineStyle(), point: endPoint, cpoint: startPoint, inContext: context!, model: annotationModel)
+        if (annotationModel.style() == .dashed) {
+            if let dashPattern = annotationModel.dashPattern(), dashPattern.count > 0 {
+                let count = annotationModel.dashPattern().count
+                var lengths: [CGFloat] = []
+                for i in 0 ..< count {
+                    if let data = annotationModel.dashPattern()[i] as? NSNumber {
+                        lengths.append(CGFloat(data.floatValue))
+                    }
+                }
+                context?.setLineDash(phase: 0, lengths: lengths)
+            }
+        }
+        context?.move(to: startPoint)
+        context?.addLine(to: endPoint)
+        context?.strokePath()
+        
+        NSGraphicsContext.current?.imageInterpolation = .default
+        
+        image.unlockFocus()
+        return image
+    }
+}
+
+// MARK: - Private Methods
+
+extension CPDFLineAnnotation {
+    private class func _drawLineExEnding(style: CPDFLineStyle, point: CGPoint, cpoint: CGPoint, inContext context: CGContext, model annotationModel: CPDFAnnotationModel) -> CGPoint {
+        var rpoint = point
+        switch style {
+        case .openArrow:
+            var points: [CGPoint] = [CGPoint](repeating: CGPointZero, count: 3)
+            self._openArrowExPoints(&points, point: point, cpoint: cpoint, borderWidth: annotationModel.lineWidth())
+            context.beginPath()
+            context.addLines(between: points)
+            context.drawPath(using: .stroke)
+            break
+        case .closedArrow:
+            var points: [CGPoint] = [CGPoint](repeating: CGPointZero, count: 3)
+            rpoint = self._closedArrowExPoints(&points, point: point, cpoint: cpoint)
+            context.beginPath()
+            context.addLines(between: points)
+            context.closePath()
+            context.drawPath(using: .fillStroke)
+            break
+        case .square:
+            var points: [CGPoint] = [CGPoint](repeating: CGPointZero, count: 4)
+            rpoint = self._squareExPoints(&points, point: point, cpoint: cpoint, borderWidth: annotationModel.lineWidth())
+            context.beginPath()
+            context.addLines(between: points)
+            context.closePath()
+            context.drawPath(using: .fillStroke)
+            break
+        case .circle:
+            var points: [CGPoint] = [CGPoint](repeating: CGPointZero, count: 1)
+            rpoint = self._circleExPoints(&points, point: point, cpoint: cpoint, borderWidth: annotationModel.lineWidth())
+            let radius = sqrt((rpoint.x - points[0].x) * (rpoint.x - points[0].x) + (rpoint.y - points[0].y) * (rpoint.y - points[0].y))
+            context.beginPath()
+            context.addArc(center: points[0], radius: radius, startAngle: 0, endAngle: 2 * Double.pi, clockwise: false)
+            context.closePath()
+            context.drawPath(using: .fillStroke)
+        case .diamond:
+            var points: [CGPoint] = [CGPoint](repeating: CGPointZero, count: 4)
+            rpoint = self._diamondExPoints(&points, point: point, cpoint: cpoint, borderWidth: annotationModel.lineWidth())
+            context.beginPath()
+            context.addLines(between: points)
+            context.closePath()
+            context.drawPath(using: .fillStroke)
+            break
+        default:
+            break
+        }
+        return rpoint
+    }
+    
+    private class func _openArrowExPoints(_  points: inout [CGPoint], point: CGPoint, cpoint: CGPoint, borderWidth: CGFloat) -> CGPoint {
+        let len = 4 + borderWidth
+        var dx = 0.0
+        var dy = 0.0
+        var point0 = CGPointZero
+        var point1 = CGPointZero
+        var point2 = CGPointZero
+        
+        let mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y)
+        dx = (point.x - cpoint.x) * len / sqrt(mAB)
+        dy = (point.y - cpoint.y) * len / sqrt(mAB)
+        point0.x = point.x - dx
+        point0.y = point.y - dy
+        
+        let mCB = (point.x - point0.x) * (point.x - point0.x) + (point.y - point0.y) * (point.y - point0.y)
+        dx = -(point.y - point0.y) * len / sqrt(mCB)
+        dy = (point.x - point0.x) * len / sqrt(mCB)
+        point1.x = point0.x + dx
+        point1.y = point0.y + dy
+        point2.x = 2 * point0.x - point1.x
+        point2.y = 2 * point0.y - point1.y
+        
+        points[0] = point1
+        points[1] = point
+        points[2] = point2
+        
+        return point0
+    }
+    
+    private class func _closedArrowExPoints(_ points: inout [CGPoint], point: CGPoint, cpoint: CGPoint) -> CGPoint {
+        let len = 4.0
+        var dx = 0.0
+        var dy = 0.0
+        var point0 = CGPointZero
+        var point1 = CGPointZero
+        var point2 = CGPointZero
+        
+        let mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y)
+        dx = (point.x - cpoint.x) * len / sqrt(mAB)
+        dy = (point.y - cpoint.y) * len / sqrt(mAB)
+        point0.x = point.x - dx
+        point0.y = point.y - dy
+        
+        let mCB = (point.x - point0.x) * (point.x - point0.x) + (point.y - point0.y) * (point.y - point0.y)
+        dx = -(point.y - point0.y) * len / sqrt(mCB)
+        dy = (point.x - point0.x) * len / sqrt(mCB)
+        point1.x = point0.x + dx
+        point1.y = point0.y + dy
+        point2.x = 2 * point0.x - point1.x
+        point2.y = 2 * point0.y - point1.y
+        
+        points[0] = point1
+        points[1] = point
+        points[2] = point2
+        
+        return point0
+    }
+    
+    private class func _squareExPoints(_ points: inout [CGPoint], point: CGPoint, cpoint: CGPoint, borderWidth: CGFloat) -> CGPoint {
+        let len = max(4, borderWidth)
+        var dx = 0.0
+        var dy = 0.0
+        var point0 = CGPointZero
+        var point1 = CGPointZero
+        var point2 = CGPointZero
+        var point3 = CGPointZero
+        var point4 = CGPointZero
+        var point5 = CGPointZero
+        var point6 = CGPointZero
+        
+        let mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y)
+        dx = (point.x - cpoint.x) * len / sqrt(mAB)
+        dy = (point.y - cpoint.y) * len / sqrt(mAB)
+        point0.x = point.x - dx
+        point0.y = point.y - dy
+        point5.x = point.x - 2 * dx
+        point5.y = point.y - 2 * dy
+        point6.x = point.x + dx
+        point6.y = point.y + dy
+        
+        let mCD = (point0.x - point5.x) * (point0.x - point5.x) + (point0.y - point5.y) * (point0.y - point5.y)
+        dx = -(point0.y - point5.y) * len / sqrt(mCD)
+        dy = (point0.x - point5.x) * len / sqrt(mCD)
+        point1.x = point5.x + dx
+        point1.y = point5.y + dy
+        point2.x = 2 * point5.x - point1.x
+        point2.y = 2 * point5.y - point1.y
+        
+        let mEB = (point6.x - point.x) * (point6.x - point.x) + (point6.y - point.y) * (point6.y - point.y)
+        dx = -(point6.y - point.y) * len / sqrt(mEB)
+        dy = (point6.x - point.x) * len / sqrt(mEB)
+        point3.x = point.x + dx
+        point3.y = point.y + dy
+        point4.x = 2 * point.x - point3.x
+        point4.y = 2 * point.y - point3.y
+        
+        points[0] = point1
+        points[1] = point3
+        points[2] = point4
+        points[3] = point2
+        
+        return point5
+    }
+    
+    private class func _circleExPoints(_ points: inout [CGPoint], point: CGPoint, cpoint: CGPoint, borderWidth: CGFloat) -> CGPoint {
+        let len = max(4, borderWidth)
+        var dx = 0.0
+        var dy = 0.0
+        var point0 = CGPointZero
+        var point1 = CGPointZero
+        
+        let mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y)
+        dx = (point.x - cpoint.x) * len / sqrt(mAB)
+        dy = (point.y - cpoint.y) * len / sqrt(mAB)
+        point0.x = point.x - dx
+        point0.y = point.y - dy
+        point1.x = point.x - 2 * dx
+        point1.y = point.y - 2 * dy
+        
+        points[0] = point0
+        
+        return point1
+    }
+    
+    private class func _diamondExPoints(_ points: inout [CGPoint], point: CGPoint, cpoint: CGPoint, borderWidth: CGFloat) -> CGPoint {
+        let len = max(4, borderWidth)
+        var dx = 0.0
+        var dy = 0.0
+        var point0 = CGPointZero
+        var point1 = CGPointZero
+        var point2 = CGPointZero
+        var point3 = CGPointZero
+        
+        let mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y)
+        dx = (point.x - cpoint.x) * len / sqrt(mAB)
+        dy = (point.y - cpoint.y) * len / sqrt(mAB)
+        point0.x = point.x - dx
+        point0.y = point.y - dy
+        point3.x = point.x - 2 * dx
+        point3.y = point.y - 2 * dy
+        
+        let mCB = (point.x - point0.x) * (point.x - point0.x) + (point.y - point0.y) * (point.y - point0.y)
+        dx = -(point.y - point0.y) * len / sqrt(mCB)
+        dy = (point.x - point0.x) * len / sqrt(mCB)
+        point1.x = point0.x + dx
+        point1.y = point0.y + dy
+        point2.x = 2 * point0.x - point1.x
+        point2.y = 2 * point0.y - point1.y
+        
+        points[0] = point1
+        points[1] = point
+        points[2] = point2
+        points[3] = point3
+        
+        return point3
+    }
+}

+ 2 - 3
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m

@@ -30,7 +30,6 @@
 
 #import "CPDFMarkupAnnotation+PDFListView.h"
 #import "CPDFTextWidgetAnnotation+PDFListView.h"
-#import "CPDFLineAnnotation+PDFListView.h"
 #import "NSPopover+PDFListView.h"
 #import "CPDFListView+Extension.h"
 #import <PDF_Master-Swift.h>
@@ -358,14 +357,14 @@ NSNotificationName const CPDFListViewAnnotationsAttributeHasChangeNotification =
                 annotation.bounds = bounds;
                 break;
             case CAnnotationTypeLine:
-                annotation = [[CPDFLineAnnotation alloc]initPDFListViewNoteWithDocument:self.document annotationType:CAnnotationTypeLine];
+                annotation = [[CPDFLineAnnotation alloc]initWithPDFListViewNoteWith:self.document annotationType:CAnnotationTypeLine];
                 [(CPDFLineAnnotation *)annotation setObservedStartPoint:CGPointMake(bounds.origin.x, bounds.origin.y)];
                 [(CPDFLineAnnotation *)annotation setObservedEndPoint:CGPointMake(bounds.origin.x + bounds.size.width,bounds.origin.y+ bounds.size.height)];
                 [(CPDFLineAnnotation *)annotation setStartLineStyle:CPDFLineStyleNone];
                 [(CPDFLineAnnotation *)annotation setEndLineStyle:CPDFLineStyleNone];
                 break;
             case CAnnotationTypeArrow: {
-                annotation = [[CPDFLineAnnotation alloc]initPDFListViewNoteWithDocument:self.document annotationType:CAnnotationTypeArrow];
+                annotation = [[CPDFLineAnnotation alloc]initWithPDFListViewNoteWith:self.document annotationType:CAnnotationTypeArrow];
                 [(CPDFLineAnnotation *)annotation setObservedStartPoint:CGPointMake(bounds.origin.x, bounds.origin.y)];
                 [(CPDFLineAnnotation *)annotation setObservedEndPoint:CGPointMake(bounds.origin.x + bounds.size.width,bounds.origin.y+ bounds.size.height)];
             }

+ 0 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Event.m

@@ -24,7 +24,6 @@
 #import "CPDFListEditAnnotationViewController.h"
 
 #import "CPDFListView+Extension.h"
-#import "CPDFLineAnnotation+PDFListView.h"
 #import "CPDFMarkupAnnotation+PDFListView.h"
 #import "CSelfSignAnnotationFreeText.h"
 

+ 0 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/ComPDFUIKit.h

@@ -19,7 +19,6 @@
 
 #import "CPDFTextAnnotation+PDFListView.h"
 #import "CPDFStampAnnotation+PDFListView.h"
-#import "CPDFLineAnnotation+PDFListView.h"
 #import "CPDFLinkAnnotation+PDFListView.h"
 #import "CPDFMarkupAnnotation+PDFListView.h"
 #import "CPDFRedactAnnotation+PDFListView.h"

+ 0 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.m

@@ -12,7 +12,6 @@
 #import "KMSelfSignAnnotation.h"
 #import "KMSelfSignAnnotationFreeText.h"
 #import "CPDFMarkupAnnotation+PDFListView.h"
-#import "CPDFLineAnnotation+PDFListView.h"
 
 #import "KMGeneralButton.h"
 #import "KMPropertiesViewPopController.h"

+ 2 - 0
PDF Office/PDF Master/PDF_Master-Bridging-Header.h

@@ -68,3 +68,5 @@
 #import "NSGeometry+PDFListView.h"
 #import "CPDFAnnotationHeader.h"
 #import "KMTableRowView.h"
+
+#import "NSGraphics+PDFListView.h"