|
@@ -682,7 +682,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
lineSegment.IsSmoothJoin = true;
|
|
lineSegment.IsSmoothJoin = true;
|
|
pathFigure.Segments.Add(lineSegment);
|
|
pathFigure.Segments.Add(lineSegment);
|
|
}
|
|
}
|
|
- if(annotLine.Dash!=null && annotLine.Dash.Length>0)
|
|
|
|
|
|
+ if (annotLine.Dash != null && annotLine.Dash.Length > 0)
|
|
{
|
|
{
|
|
DashStyle dash = new DashStyle();
|
|
DashStyle dash = new DashStyle();
|
|
foreach (var offset in annotLine.Dash)
|
|
foreach (var offset in annotLine.Dash)
|
|
@@ -1041,7 +1041,6 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
|
|
|
MeasureChanged?.Invoke(this, measureEvent);
|
|
MeasureChanged?.Invoke(this, measureEvent);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void DrawPolygonMeasure(DrawingContext drawingContext)
|
|
private void DrawPolygonMeasure(DrawingContext drawingContext)
|
|
@@ -1101,212 +1100,256 @@ namespace ComPDFKit.Tool.DrawTool
|
|
}
|
|
}
|
|
if (points.Count > 0)
|
|
if (points.Count > 0)
|
|
{
|
|
{
|
|
- PathGeometry drawPath = new PathGeometry();
|
|
|
|
- PathFigure drawFigure = new PathFigure();
|
|
|
|
|
|
+ CPDFBorderEffector borderEffector = polyLine.GetAnnotBorderEffector();
|
|
|
|
+ if (borderEffector != null && borderEffector.BorderIntensity != C_BORDER_INTENSITY.C_INTENSITY_ZERO && borderEffector.BorderType != C_BORDER_TYPE.C_BORDER_TYPE_STRAIGHT && points.Count > 1)
|
|
|
|
+ {
|
|
|
|
+ //Draw the example line connected by the start point and the end point.
|
|
|
|
+ if (points.Count == 1)
|
|
|
|
+ {
|
|
|
|
+ Pen dashedPen = new Pen(Brushes.Gray, 1);
|
|
|
|
+ dashedPen.DashStyle = new DashStyle(new double[] { 2, 2 }, 0);
|
|
|
|
|
|
- drawFigure.StartPoint = points[0];
|
|
|
|
- PolyLineSegment polySegment = new PolyLineSegment();
|
|
|
|
|
|
+ drawingContext?.DrawLine(dashedPen, points[0], checkPoint);
|
|
|
|
+ }
|
|
|
|
|
|
- for (int i = 1; i < points.Count; i++)
|
|
|
|
- {
|
|
|
|
- polySegment.Points.Add(points[i]);
|
|
|
|
- }
|
|
|
|
|
|
+ CPDFPolygonAnnotation polygonAnnot = cPDFAnnotation as CPDFPolygonAnnotation;
|
|
|
|
+
|
|
|
|
+ drawPoints.Add(checkPoint);
|
|
|
|
+ List<Point> measurePoint = new List<Point>();
|
|
|
|
+
|
|
|
|
+ measurePoint = GetMeasureDrawPoints();
|
|
|
|
+
|
|
|
|
+ List<CPoint> cPoints = new List<CPoint>();
|
|
|
|
+ foreach (Point item in measurePoint)
|
|
|
|
+ {
|
|
|
|
+ cPoints.Add(DataConversionForWPF.PointConversionForCPoint(DpiHelper.StandardPointToPDFPoint(item)));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ (cPDFAnnotation as CPDFPolygonAnnotation).SetPoints(cPoints);
|
|
|
|
+
|
|
|
|
+ drawPoints.RemoveAt(drawPoints.Count - 1);
|
|
|
|
+
|
|
|
|
+ polygonAnnot.UpdateAp();
|
|
|
|
+ cPDFViewer.UpdateAnnotFrame();
|
|
|
|
|
|
- if (defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
|
|
- {
|
|
|
|
- polySegment.Points.Add(points[0]);
|
|
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- //Add the current point during the movement.
|
|
|
|
- polySegment.Points.Add(checkPoint);
|
|
|
|
- }
|
|
|
|
|
|
+ PathGeometry drawPath = new PathGeometry();
|
|
|
|
+ PathFigure drawFigure = new PathFigure();
|
|
|
|
|
|
- if (polySegment.Points.Count > 0)
|
|
|
|
- {
|
|
|
|
- drawFigure.Segments.Add(polySegment);
|
|
|
|
- }
|
|
|
|
- if (drawFigure.Segments.Count > 0)
|
|
|
|
- {
|
|
|
|
- drawPath.Figures.Add(drawFigure);
|
|
|
|
- }
|
|
|
|
|
|
+ drawFigure.StartPoint = points[0];
|
|
|
|
+ PolyLineSegment polySegment = new PolyLineSegment();
|
|
|
|
|
|
- //Draw the line segment.
|
|
|
|
- drawingContext?.DrawGeometry(null, DrawPen, drawPath);
|
|
|
|
|
|
+ for (int i = 1; i < points.Count; i++)
|
|
|
|
+ {
|
|
|
|
+ polySegment.Points.Add(points[i]);
|
|
|
|
+ }
|
|
|
|
|
|
- //Draw the example line connected by the start point and the end point.
|
|
|
|
- if (points.Count > 1)
|
|
|
|
- {
|
|
|
|
if (defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
if (defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
{
|
|
{
|
|
- drawingContext?.DrawLine(DrawPen, points[0], polySegment.Points.Last());
|
|
|
|
|
|
+ polySegment.Points.Add(points[0]);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- drawingContext?.DrawLine(EndDrawPen, points[0], polySegment.Points.Last());
|
|
|
|
|
|
+ //Add the current point during the movement.
|
|
|
|
+ polySegment.Points.Add(checkPoint);
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- //Calculate the length.
|
|
|
|
- double totalInch = 0;
|
|
|
|
- if (points.Count > 1)
|
|
|
|
- {
|
|
|
|
- for (int i = 0; i < points.Count - 1; i++)
|
|
|
|
|
|
+ if (polySegment.Points.Count > 0)
|
|
{
|
|
{
|
|
- totalInch += measureSetting.GetMeasureLength(points[i], points[i + 1], zoomFactor);
|
|
|
|
|
|
+ drawFigure.Segments.Add(polySegment);
|
|
}
|
|
}
|
|
- }
|
|
|
|
- double currentInch = measureSetting.GetMeasureLength(points[points.Count - 1], checkPoint, zoomFactor);
|
|
|
|
- if (defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
|
|
- {
|
|
|
|
- currentInch = measureSetting.GetMeasureLength(points[points.Count - 1], points[0], zoomFactor);
|
|
|
|
- }
|
|
|
|
- totalInch += currentInch;
|
|
|
|
-
|
|
|
|
- Point closePoint = points[points.Count - 1];
|
|
|
|
- Vector movevector = checkPoint - closePoint;
|
|
|
|
|
|
|
|
- FormattedText moveText = new FormattedText(
|
|
|
|
- string.Format("{0} {1}", measureSetting.GetPrecisionData(currentInch), measureSetting.RulerTranslateUnit),
|
|
|
|
- CultureInfo.GetCultureInfo("en-us"),
|
|
|
|
- FlowDirection.LeftToRight,
|
|
|
|
- new Typeface("YaHei"),
|
|
|
|
- 16,
|
|
|
|
- TextBrush);
|
|
|
|
-
|
|
|
|
- FormattedText totalText = new FormattedText(
|
|
|
|
- string.Format("{0} {1}", measureSetting.GetPrecisionData(totalInch), measureSetting.RulerTranslateUnit),
|
|
|
|
- CultureInfo.GetCultureInfo("en-us"),
|
|
|
|
- FlowDirection.LeftToRight,
|
|
|
|
- new Typeface("YaHei"),
|
|
|
|
- 16,
|
|
|
|
- TextBrush);
|
|
|
|
-
|
|
|
|
- //Judge the text display form.
|
|
|
|
- if (movevector.Length > moveText.Width + textPadding || defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
|
|
- {
|
|
|
|
- if (checkPoint.X >= closePoint.X)
|
|
|
|
|
|
+ if (drawFigure.Segments.Count > 0)
|
|
{
|
|
{
|
|
- Point linePoint = new Point(closePoint.X + movevector.Length, closePoint.Y);
|
|
|
|
- Point drawPoint = new Point(
|
|
|
|
- linePoint.X - moveText.Width - textPadding,
|
|
|
|
- linePoint.Y - moveText.Height);
|
|
|
|
-
|
|
|
|
- Vector anglevector = linePoint - closePoint;
|
|
|
|
|
|
+ drawPath.Figures.Add(drawFigure);
|
|
|
|
+ }
|
|
|
|
|
|
- RotateTransform transform = new RotateTransform();
|
|
|
|
- transform.CenterX = closePoint.X;
|
|
|
|
- transform.CenterY = closePoint.Y;
|
|
|
|
- double angle = Vector.AngleBetween(movevector, anglevector);
|
|
|
|
- transform.Angle = -angle;
|
|
|
|
|
|
+ //Draw the line segment.
|
|
|
|
+ drawingContext?.DrawGeometry(null, DrawPen, drawPath);
|
|
|
|
|
|
- drawingContext?.PushTransform(transform);
|
|
|
|
- if (!defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
|
|
|
|
+ //Draw the example line connected by the start point and the end point.
|
|
|
|
+ if (points.Count > 1)
|
|
|
|
+ {
|
|
|
|
+ if (defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
{
|
|
{
|
|
- drawingContext?.DrawText(moveText, drawPoint);
|
|
|
|
|
|
+ drawingContext?.DrawLine(DrawPen, points[0], polySegment.Points.Last());
|
|
}
|
|
}
|
|
- if (totalInch > currentInch)
|
|
|
|
|
|
+ else
|
|
{
|
|
{
|
|
- drawingContext?.DrawText(totalText, new Point(
|
|
|
|
- drawPoint.X + moveText.Width + textPadding * 2,
|
|
|
|
- drawPoint.Y
|
|
|
|
- ));
|
|
|
|
|
|
+ drawingContext?.DrawLine(EndDrawPen, points[0], polySegment.Points.Last());
|
|
}
|
|
}
|
|
- drawingContext.Pop();
|
|
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+
|
|
|
|
+ //Calculate the length.
|
|
|
|
+ double totalInch = 0;
|
|
|
|
+ if (points.Count > 1)
|
|
{
|
|
{
|
|
- Point linePoint = new Point(closePoint.X - movevector.Length, closePoint.Y);
|
|
|
|
- Point drawPoint = new Point(
|
|
|
|
- linePoint.X + textPadding,
|
|
|
|
- linePoint.Y - moveText.Height);
|
|
|
|
|
|
+ for (int i = 0; i < points.Count - 1; i++)
|
|
|
|
+ {
|
|
|
|
+ totalInch += measureSetting.GetMeasureLength(points[i], points[i + 1], zoomFactor);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ double currentInch = measureSetting.GetMeasureLength(points[points.Count - 1], checkPoint, zoomFactor);
|
|
|
|
+ if (defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
|
|
+ {
|
|
|
|
+ currentInch = measureSetting.GetMeasureLength(points[points.Count - 1], points[0], zoomFactor);
|
|
|
|
+ }
|
|
|
|
+ totalInch += currentInch;
|
|
|
|
|
|
- Vector anglevector = linePoint - closePoint;
|
|
|
|
|
|
+ Point closePoint = points[points.Count - 1];
|
|
|
|
+ Vector movevector = checkPoint - closePoint;
|
|
|
|
|
|
- RotateTransform transform = new RotateTransform();
|
|
|
|
- transform.CenterX = closePoint.X;
|
|
|
|
- transform.CenterY = closePoint.Y;
|
|
|
|
- double angle = Vector.AngleBetween(movevector, anglevector);
|
|
|
|
- transform.Angle = -angle;
|
|
|
|
|
|
|
|
- drawingContext?.PushTransform(transform);
|
|
|
|
- if (!defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
|
|
- {
|
|
|
|
- drawingContext?.DrawText(moveText, drawPoint);
|
|
|
|
- }
|
|
|
|
- if (totalInch > currentInch)
|
|
|
|
|
|
+
|
|
|
|
+ if (polyLine.IsMeasured())
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ FormattedText moveText = new FormattedText(
|
|
|
|
+ string.Format("{0} {1}", measureSetting.GetPrecisionData(currentInch), measureSetting.RulerTranslateUnit),
|
|
|
|
+ CultureInfo.GetCultureInfo("en-us"),
|
|
|
|
+ FlowDirection.LeftToRight,
|
|
|
|
+ new Typeface("YaHei"),
|
|
|
|
+ 16,
|
|
|
|
+ TextBrush);
|
|
|
|
+
|
|
|
|
+ FormattedText totalText = new FormattedText(
|
|
|
|
+ string.Format("{0} {1}", measureSetting.GetPrecisionData(totalInch), measureSetting.RulerTranslateUnit),
|
|
|
|
+ CultureInfo.GetCultureInfo("en-us"),
|
|
|
|
+ FlowDirection.LeftToRight,
|
|
|
|
+ new Typeface("YaHei"),
|
|
|
|
+ 16,
|
|
|
|
+ TextBrush);
|
|
|
|
+
|
|
|
|
+ //Judge the text display form.
|
|
|
|
+ if (movevector.Length > moveText.Width + textPadding || defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
{
|
|
{
|
|
- drawingContext?.DrawText(totalText,
|
|
|
|
- new Point(
|
|
|
|
- drawPoint.X - totalText.Width - textPadding * 2,
|
|
|
|
- drawPoint.Y
|
|
|
|
- ));
|
|
|
|
|
|
+ if (checkPoint.X >= closePoint.X)
|
|
|
|
+ {
|
|
|
|
+ Point linePoint = new Point(closePoint.X + movevector.Length, closePoint.Y);
|
|
|
|
+ Point drawPoint = new Point(
|
|
|
|
+ linePoint.X - moveText.Width - textPadding,
|
|
|
|
+ linePoint.Y - moveText.Height);
|
|
|
|
+
|
|
|
|
+ Vector anglevector = linePoint - closePoint;
|
|
|
|
+
|
|
|
|
+ RotateTransform transform = new RotateTransform();
|
|
|
|
+ transform.CenterX = closePoint.X;
|
|
|
|
+ transform.CenterY = closePoint.Y;
|
|
|
|
+ double angle = Vector.AngleBetween(movevector, anglevector);
|
|
|
|
+ transform.Angle = -angle;
|
|
|
|
+
|
|
|
|
+ drawingContext?.PushTransform(transform);
|
|
|
|
+ if (!defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
|
|
+ {
|
|
|
|
+ drawingContext?.DrawText(moveText, drawPoint);
|
|
|
|
+ }
|
|
|
|
+ if (totalInch > currentInch)
|
|
|
|
+ {
|
|
|
|
+ drawingContext?.DrawText(totalText, new Point(
|
|
|
|
+ drawPoint.X + moveText.Width + textPadding * 2,
|
|
|
|
+ drawPoint.Y
|
|
|
|
+ ));
|
|
|
|
+ }
|
|
|
|
+ drawingContext.Pop();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ Point linePoint = new Point(closePoint.X - movevector.Length, closePoint.Y);
|
|
|
|
+ Point drawPoint = new Point(
|
|
|
|
+ linePoint.X + textPadding,
|
|
|
|
+ linePoint.Y - moveText.Height);
|
|
|
|
+
|
|
|
|
+ Vector anglevector = linePoint - closePoint;
|
|
|
|
+
|
|
|
|
+ RotateTransform transform = new RotateTransform();
|
|
|
|
+ transform.CenterX = closePoint.X;
|
|
|
|
+ transform.CenterY = closePoint.Y;
|
|
|
|
+ double angle = Vector.AngleBetween(movevector, anglevector);
|
|
|
|
+ transform.Angle = -angle;
|
|
|
|
+
|
|
|
|
+ drawingContext?.PushTransform(transform);
|
|
|
|
+ if (!defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
|
|
+ {
|
|
|
|
+ drawingContext?.DrawText(moveText, drawPoint);
|
|
|
|
+ }
|
|
|
|
+ if (totalInch > currentInch)
|
|
|
|
+ {
|
|
|
|
+ drawingContext?.DrawText(totalText,
|
|
|
|
+ new Point(
|
|
|
|
+ drawPoint.X - totalText.Width - textPadding * 2,
|
|
|
|
+ drawPoint.Y
|
|
|
|
+ ));
|
|
|
|
+ }
|
|
|
|
+ drawingContext.Pop();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- drawingContext.Pop();
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
- double left = drawPoints.AsEnumerable().Select(x => x.X).Min();
|
|
|
|
- double right = drawPoints.AsEnumerable().Select(x => x.X).Max();
|
|
|
|
- double top = drawPoints.AsEnumerable().Select(x => x.Y).Min();
|
|
|
|
- double bottom = drawPoints.AsEnumerable().Select(x => x.Y).Max();
|
|
|
|
- DPIRect = new Rect(left, top, right - left, bottom - top);
|
|
|
|
- if (defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
|
|
- {
|
|
|
|
- double deleft = points.AsEnumerable().Select(x => x.X).Min();
|
|
|
|
- double deright = points.AsEnumerable().Select(x => x.X).Max();
|
|
|
|
- double detop = points.AsEnumerable().Select(x => x.Y).Min();
|
|
|
|
- double debottom = points.AsEnumerable().Select(x => x.Y).Max();
|
|
|
|
|
|
|
|
- DPIRect = new Rect(deleft, detop, deright - deleft, debottom - detop);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- MeasureEventArgs measureEvent = new MeasureEventArgs();
|
|
|
|
- if (points.Count < 2)
|
|
|
|
- {
|
|
|
|
- measureEvent.Angle = 0;
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- Vector standVector = points[points.Count - 1] - points[points.Count - 2];
|
|
|
|
- Vector endvector = closePoint - checkPoint;
|
|
|
|
- measureEvent.Angle = (int)Math.Abs(Vector.AngleBetween(endvector, standVector));
|
|
|
|
|
|
+ double left = drawPoints.AsEnumerable().Select(x => x.X).Min();
|
|
|
|
+ double right = drawPoints.AsEnumerable().Select(x => x.X).Max();
|
|
|
|
+ double top = drawPoints.AsEnumerable().Select(x => x.Y).Min();
|
|
|
|
+ double bottom = drawPoints.AsEnumerable().Select(x => x.Y).Max();
|
|
|
|
+ DPIRect = new Rect(left, top, right - left, bottom - top);
|
|
if (defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
if (defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
{
|
|
{
|
|
- measureEvent.Angle = 90;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ double deleft = points.AsEnumerable().Select(x => x.X).Min();
|
|
|
|
+ double deright = points.AsEnumerable().Select(x => x.X).Max();
|
|
|
|
+ double detop = points.AsEnumerable().Select(x => x.Y).Min();
|
|
|
|
+ double debottom = points.AsEnumerable().Select(x => x.Y).Max();
|
|
|
|
|
|
- List<Point> pon = new List<Point>();
|
|
|
|
- if (!defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
|
|
- {
|
|
|
|
- points.Add(checkPoint);
|
|
|
|
- }
|
|
|
|
- foreach (Point drawPoint in points)
|
|
|
|
- {
|
|
|
|
- Point savePoint = new Point(
|
|
|
|
- (drawPoint.X - pageBound.Left) + cropPoint.X,
|
|
|
|
- (drawPoint.Y - pageBound.Top) + cropPoint.Y);
|
|
|
|
- pon.Add(DpiHelper.StandardPointToPDFPoint(new Point(
|
|
|
|
- (float)drawPoint.X / zoomFactor,
|
|
|
|
- (float)drawPoint.Y / zoomFactor
|
|
|
|
- )));
|
|
|
|
- }
|
|
|
|
|
|
+ DPIRect = new Rect(deleft, detop, deright - deleft, debottom - detop);
|
|
|
|
+ }
|
|
|
|
|
|
- double area = measureSetting.ComputePolygonArea(pon.ToList());
|
|
|
|
- double ratio = measureSetting.GetMeasureAreaRatio();
|
|
|
|
- double rate = measureSetting.RulerTranslate / measureSetting.RulerBase;
|
|
|
|
- double inch = area * ratio * ratio * rate * rate;
|
|
|
|
|
|
+ MeasureEventArgs measureEvent = new MeasureEventArgs();
|
|
|
|
+ if (points.Count < 2)
|
|
|
|
+ {
|
|
|
|
+ measureEvent.Angle = 0;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ Vector standVector = points[points.Count - 1] - points[points.Count - 2];
|
|
|
|
+ Vector endvector = closePoint - checkPoint;
|
|
|
|
+ measureEvent.Angle = (int)Math.Abs(Vector.AngleBetween(endvector, standVector));
|
|
|
|
+ if (defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
|
|
+ {
|
|
|
|
+ measureEvent.Angle = 90;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- measureEvent.RulerTranslateUnit = measureSetting.RulerTranslateUnit;
|
|
|
|
- measureEvent.RulerTranslate = measureSetting.RulerTranslate;
|
|
|
|
- measureEvent.RulerBase = measureSetting.RulerBase;
|
|
|
|
- measureEvent.RulerBaseUnit = measureSetting.RulerBaseUnit;
|
|
|
|
- measureEvent.Precision = measureSetting.Precision;
|
|
|
|
- measureEvent.Type = CPDFMeasureType.CPDF_AREA_MEASURE;
|
|
|
|
- measureEvent.Distance = totalText.Text;
|
|
|
|
- measureEvent.Area = string.Format("{0} sq {1}", measureSetting.GetPrecisionData(inch), measureSetting.RulerTranslateUnit);
|
|
|
|
|
|
+ List<Point> pon = new List<Point>();
|
|
|
|
+ if (!defaultSettingParam.IsCreateSquarePolygonMeasure)
|
|
|
|
+ {
|
|
|
|
+ points.Add(checkPoint);
|
|
|
|
+ }
|
|
|
|
+ foreach (Point drawPoint in points)
|
|
|
|
+ {
|
|
|
|
+ Point savePoint = new Point(
|
|
|
|
+ (drawPoint.X - pageBound.Left) + cropPoint.X,
|
|
|
|
+ (drawPoint.Y - pageBound.Top) + cropPoint.Y);
|
|
|
|
+ pon.Add(DpiHelper.StandardPointToPDFPoint(new Point(
|
|
|
|
+ (float)drawPoint.X / zoomFactor,
|
|
|
|
+ (float)drawPoint.Y / zoomFactor
|
|
|
|
+ )));
|
|
|
|
+ }
|
|
|
|
|
|
- MeasureChanged?.Invoke(this, measureEvent);
|
|
|
|
|
|
+ double area = measureSetting.ComputePolygonArea(pon.ToList());
|
|
|
|
+ double ratio = measureSetting.GetMeasureAreaRatio();
|
|
|
|
+ double rate = measureSetting.RulerTranslate / measureSetting.RulerBase;
|
|
|
|
+ double inch = area * ratio * ratio * rate * rate;
|
|
|
|
+
|
|
|
|
+ //measureEvent.RulerTranslateUnit = measureSetting.RulerTranslateUnit;
|
|
|
|
+ //measureEvent.RulerTranslate = measureSetting.RulerTranslate;
|
|
|
|
+ //measureEvent.RulerBase = measureSetting.RulerBase;
|
|
|
|
+ //measureEvent.RulerBaseUnit = measureSetting.RulerBaseUnit;
|
|
|
|
+ //measureEvent.Precision = measureSetting.Precision;
|
|
|
|
+ //measureEvent.Type = CPDFMeasureType.CPDF_AREA_MEASURE;
|
|
|
|
+ //measureEvent.Distance = totalText.Text;
|
|
|
|
+ // measureEvent.Area = string.Format("{0} sq {1}", measureSetting.GetPrecisionData(inch), measureSetting.RulerTranslateUnit);
|
|
|
|
+
|
|
|
|
+ MeasureChanged?.Invoke(this, measureEvent);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1510,7 +1553,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
{
|
|
{
|
|
dashCollection.Add(num);
|
|
dashCollection.Add(num);
|
|
}
|
|
}
|
|
- textBorder?.DrawDashBorder(true, drawWidth,rawWidth, dashCollection);
|
|
|
|
|
|
+ textBorder?.DrawDashBorder(true, drawWidth, rawWidth, dashCollection);
|
|
}
|
|
}
|
|
|
|
|
|
textui.BorderThickness = new Thickness(0);
|
|
textui.BorderThickness = new Thickness(0);
|
|
@@ -1557,7 +1600,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
CPDFAnnotation currentAnnot = textui.GetValue(PopupTextAttachDataProperty) as CPDFAnnotation;
|
|
CPDFAnnotation currentAnnot = textui.GetValue(PopupTextAttachDataProperty) as CPDFAnnotation;
|
|
AnnotParam annotParam = ParamConverter.AnnotConverter(cPDFViewer.GetDocument(), currentAnnot);
|
|
AnnotParam annotParam = ParamConverter.AnnotConverter(cPDFViewer.GetDocument(), currentAnnot);
|
|
if (currentAnnot != null && currentAnnot.IsValid())
|
|
if (currentAnnot != null && currentAnnot.IsValid())
|
|
- {
|
|
|
|
|
|
+ {
|
|
CPDFFreeTextAnnotation updateFreeText = currentAnnot as CPDFFreeTextAnnotation;
|
|
CPDFFreeTextAnnotation updateFreeText = currentAnnot as CPDFFreeTextAnnotation;
|
|
if (textui.Text != string.Empty || updateFreeText.GetBorderWidth() != 0)
|
|
if (textui.Text != string.Empty || updateFreeText.GetBorderWidth() != 0)
|
|
{
|
|
{
|
|
@@ -1576,7 +1619,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
));
|
|
));
|
|
updateFreeText.UpdateAp();
|
|
updateFreeText.UpdateAp();
|
|
FreeTextAnnotHistory freeTextAnnotHistory = new FreeTextAnnotHistory();
|
|
FreeTextAnnotHistory freeTextAnnotHistory = new FreeTextAnnotHistory();
|
|
- annotParam = ParamConverter.AnnotConverter(cPDFViewer.GetDocument(), currentAnnot);
|
|
|
|
|
|
+ annotParam = ParamConverter.AnnotConverter(cPDFViewer.GetDocument(), currentAnnot);
|
|
annotParam.AnnotIndex = currentAnnot.Page.GetAnnotCount() - 1;
|
|
annotParam.AnnotIndex = currentAnnot.Page.GetAnnotCount() - 1;
|
|
freeTextAnnotHistory.CurrentParam = (FreeTextParam)annotParam;
|
|
freeTextAnnotHistory.CurrentParam = (FreeTextParam)annotParam;
|
|
freeTextAnnotHistory.PDFDoc = cPDFViewer.GetDocument();
|
|
freeTextAnnotHistory.PDFDoc = cPDFViewer.GetDocument();
|
|
@@ -1753,7 +1796,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
{
|
|
{
|
|
dashCollection.Add(num);
|
|
dashCollection.Add(num);
|
|
}
|
|
}
|
|
- dashBorder.DrawDashBorder(true, drawWidth,rawWidth, dashCollection);
|
|
|
|
|
|
+ dashBorder.DrawDashBorder(true, drawWidth, rawWidth, dashCollection);
|
|
}
|
|
}
|
|
|
|
|
|
string fontName = string.Empty;
|
|
string fontName = string.Empty;
|