|
@@ -1236,31 +1236,52 @@ namespace ComPDFKit.Tool
|
|
|
break;
|
|
|
case C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON:
|
|
|
{
|
|
|
- if ((annotation as CPDFPolygonAnnotation).IsMeasured())
|
|
|
+ if (measurepoints.Count >= 3)
|
|
|
{
|
|
|
- List<CPoint> cPoints = new List<CPoint>();
|
|
|
- foreach (Point item in measurepoints)
|
|
|
+ if ((annotation as CPDFPolygonAnnotation).IsMeasured())
|
|
|
{
|
|
|
- cPoints.Add(DataConversionForWPF.PointConversionForCPoint(DpiHelper.StandardPointToPDFPoint(item)));
|
|
|
- }
|
|
|
+ List<CPoint> cPoints = new List<CPoint>();
|
|
|
+ foreach (Point item in measurepoints)
|
|
|
+ {
|
|
|
+ cPoints.Add(DataConversionForWPF.PointConversionForCPoint(DpiHelper.StandardPointToPDFPoint(item)));
|
|
|
+ }
|
|
|
(annotation as CPDFPolygonAnnotation).SetPoints(cPoints);
|
|
|
- (annotation as CPDFPolygonAnnotation).GetAreaMeasure().UpdateAnnotMeasure();
|
|
|
- PostMeasureInfo(this, annotation);
|
|
|
+ (annotation as CPDFPolygonAnnotation).GetAreaMeasure().UpdateAnnotMeasure();
|
|
|
+ PostMeasureInfo(this, annotation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ annotation.RemoveAnnot();
|
|
|
+ annotation = null;
|
|
|
+ viewerTool.ClearDrawAnnot();
|
|
|
+ return;
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
break;
|
|
|
case C_ANNOTATION_TYPE.C_ANNOTATION_POLYLINE:
|
|
|
{
|
|
|
- if ((annotation as CPDFPolylineAnnotation).IsMeasured())
|
|
|
+ if(measurepoints.Count>=3)
|
|
|
{
|
|
|
- List<CPoint> cPoints = new List<CPoint>();
|
|
|
- foreach (Point item in measurepoints)
|
|
|
+ if ((annotation as CPDFPolylineAnnotation).IsMeasured())
|
|
|
{
|
|
|
- cPoints.Add(DataConversionForWPF.PointConversionForCPoint(DpiHelper.StandardPointToPDFPoint(item)));
|
|
|
+ List<CPoint> cPoints = new List<CPoint>();
|
|
|
+ foreach (Point item in measurepoints)
|
|
|
+ {
|
|
|
+ cPoints.Add(DataConversionForWPF.PointConversionForCPoint(DpiHelper.StandardPointToPDFPoint(item)));
|
|
|
+ }
|
|
|
+ (annotation as CPDFPolylineAnnotation).SetPoints(cPoints);
|
|
|
+ (annotation as CPDFPolylineAnnotation).GetPerimeterMeasure().UpdateAnnotMeasure();
|
|
|
+ PostMeasureInfo(this, annotation);
|
|
|
}
|
|
|
- (annotation as CPDFPolylineAnnotation).SetPoints(cPoints);
|
|
|
- (annotation as CPDFPolylineAnnotation).GetPerimeterMeasure().UpdateAnnotMeasure();
|
|
|
- PostMeasureInfo(this, annotation);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ annotation.RemoveAnnot();
|
|
|
+ annotation = null;
|
|
|
+ viewerTool.ClearDrawAnnot();
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
break;
|