public static ImageDoc.Annotation Translate(BaseAnnotation imagingAnnotation)
        {
            ImageDoc.Annotation annotation = new ImageDoc.Annotation();
            annotation.AnnotationType = AnnotationClassToType(imagingAnnotation).ToString() ;
            annotation.FillColor = ColorToSimpleType(imagingAnnotation.FillColor);
            annotation.FillOpacity = imagingAnnotation.FillOpacity;
            annotation.LineColor = ColorToSimpleType(imagingAnnotation.LineColor);
            annotation.LineThickness = imagingAnnotation.LineThickness;
            //annotation.Outline = imagingAnnotation.Outline;
            annotation.Points = PointsToSimpleType(imagingAnnotation.Points);
            annotation.Rect = RectToSimpleType(imagingAnnotation.Rect);
            if (imagingAnnotation is TextAnnotation) {
                annotation.Text = (imagingAnnotation as TextAnnotation).Text;
                annotation.TextColor = ColorToSimpleType((imagingAnnotation as TextAnnotation).TextColor);
                annotation.Font = new ImageDoc.SimpleFont((imagingAnnotation as TextAnnotation).TextFont);
            }

            if (imagingAnnotation is SvgAnnotation) {
                annotation.SvgImageName = (imagingAnnotation as SvgAnnotation).ImageName;
            }
            if (imagingAnnotation is PolygonAnnotation) {
                annotation.SvgImageName = (imagingAnnotation as PolygonAnnotation).ShapeName;
            }
            return annotation;
        }
 private static ImageDoc.ImagingAnnotationTypes AnnotationClassToType(BaseAnnotation imagingAnnotation)
 {
     if (imagingAnnotation is FreeLineAnnotation) return ImageDoc.ImagingAnnotationTypes.FreeLine;
     if (imagingAnnotation is StraightLineAnnotation) return ImageDoc.ImagingAnnotationTypes.StraightLine;
     if (imagingAnnotation is SvgAnnotation) return ImageDoc.ImagingAnnotationTypes.Svg;
     if (imagingAnnotation is TextAnnotation) return ImageDoc.ImagingAnnotationTypes.TextAnnotation;
     if (imagingAnnotation is StampAnnotation) return ImageDoc.ImagingAnnotationTypes.Stamp;
     if (imagingAnnotation is PolygonAnnotation) return ImageDoc.ImagingAnnotationTypes.Polygon;
     if (imagingAnnotation is PolygonAnnotation && imagingAnnotation.FillOpacity == 128)
         return ImageDoc.ImagingAnnotationTypes.Highlighter;
     return ImageDoc.ImagingAnnotationTypes.FreeLine;
 }