VintaSoft Annotation .NET Plug-in Discussions

Questions, comments and suggestions concerning VintaSoft Annotation .NET Plug-in.

Board index < VintaSoft Imaging < VintaSoft Annotation .NET Plug-in Discussions

We are migrating to new forums engine, no new registration or posting currently available. TIA for your patience.

Annotation outline disappearing



Annotation outline disappearing

Post by missionRoom »

I'm saving the current annotation data to an object, and restoring it at a later date. But sometimes the outline is disappearing, it is part of the object when I save it but, but when I restore it, it's sometimes null. Any idea why this might be happening?

Thanks for any help,

Saving
public void AnnotationsChanged(AnnotationDataController annotationDataController)
{
    this._annotationDatas = new List<AnnotationDataCollection>();

    for (int i = 0; i < annotationDataController.Images.Count; i++)
    {
        AnnotationDataCollection annotatonDataCollection = annotationDataController.GetAnnotations(i);
        this._annotationDatas.Add((AnnotationDataCollection)annotatonDataCollection.Clone());
    }
}
Restoring
private void LoadAnnotationsFromDisk()
{
    try
    {
        if (DataManager.Instance.AnnotationDatas != null && DataManager.Instance.AnnotationDatas.Count > this.annotationViewer.FocusedIndex)
        {
            if (DataManager.Instance.AnnotationDatas[this.annotationViewer.FocusedIndex].Count > 0)
            {
                foreach(AnnotationData annotationData in DataManager.Instance.AnnotationDatas[this.annotationViewer.FocusedIndex])
                {
                    try
                    {
                        if (!this.annotationViewer.AnnotationDataCollection.Contains(annotationData))
                            this.annotationViewer.AnnotationDataCollection.Add(annotationData);
                    }
                    catch(Exception ex)
                    { }
                }
            }
        }
    }
    catch (Exception ex)
    { }
}


Re: Annotation outline disappearing

Post by Alex »

Hello,

Unfortunately, provided code does not allow to understand the problem.

How do you serialize annotations? If you are saving annotation into XMP packet, please analyze saved XMP packet and check if annotation contains information about outline. If you are saving annotation not into XMP packet, please save annotation in XMP packet and analyze saved XMP packet.

Please send us (to support@vintasoft.com) a small project, which allows to reproduce the problem, if you cannot solve the problem by yourself.

Best regards, Alexander


Re: Annotation outline disappearing

Post by missionRoom »

I'm actually not saving the annotation to a file (it's a poorly named method). I'm just saving it in memory, changing the image collection on the viewer, then changing it back to the original image collection and restoring the annotations from the AnnotationDataCollection. Somewhere in that, the outline is disappearing, all other properties are still there.


Re: Annotation outline disappearing

Post by missionRoom »

I've sent a simple example project to the support email. Thanks


Re: Annotation outline disappearing

Post by Alex »

Hello,

Thank you for sample project, we reproduced the problem.

When you adding annotation to the annotation collection of annotation viewer, annotation viewer takes control over annotation.
When you closing images in annotation viewer, annotation viewer disposes images and annotations.
Disposed annotation does not have Outline.

For solving the problem you need to clone annotation before adding it to the annotation collection of annotation viewer.

Please change code:
if (!this.annotationViewer1.AnnotationDataCollection.Contains(annotationData) && annotationData.Outline != null)
В  В this.annotationViewer1.AnnotationDataCollection.Add(annotationData);
to the following code:
this.annotationViewer1.AnnotationDataCollection.Add((AnnotationData)annotationData.Clone());
Best regards, Alexander


Page 1 from 1: 1