I am loading a gdViewer with a TIF and creating many annotations.
the GdViewer is connected to an annotation manager. Annotations are created through the annotation manager
_annotMgr.InitFromGdViewer(gdViewer1);
Then I have tried the following steps to delete all annotations
int qtyAnnotations = _annotMgr.GetAnnotationCount();
if (qtyAnnotations > 0)
{
for (int i = qtyAnnotations - 1; i >= 0; i--)
{
_annotMgr.DeleteAnnotation(i);
}
gdViewer1.Redraw();
}
I can confirm the annotations are deleted, because _annotMgr.GetAnnotationCount() here returns 0.
But the annotation remains displayed in the gdViewer.
Then I have added this code to remove the annotation from gdviewer
qtyAnnotations = gdViewer1.GetAnnotationCount();
if (qtyAnnotations > 0)
{
for (int i = qtyAnnotations - 1; i >= 0; i--)
{
gdViewer1.DeleteAnnotation(i);
}
gdViewer1.Redraw();
}
I thought only the first block of code,iterating and deleting all annotations using the annotation manager would be enough, but is not. I am missing some line?
thanks in advance
Robson Reis
DeleteAnnotations question
Re: DeleteAnnotations question
Hello Robson,
The solution here is quite simple. You are just using the wrong way, how to initialize the AnnotationManager object.
You need to replace this line:
_annotMgr.InitFromGdViewer(gdViewer1);
with this line:
AnnotationManager _annotMgr = gdViewer1.GetAnnotationManager();
Now, you don't have to use the second part of your code.
Best regards,
Kamil Dubík
GdPicture Support Team
The solution here is quite simple. You are just using the wrong way, how to initialize the AnnotationManager object.
You need to replace this line:
_annotMgr.InitFromGdViewer(gdViewer1);
with this line:
AnnotationManager _annotMgr = gdViewer1.GetAnnotationManager();
Now, you don't have to use the second part of your code.
Best regards,
Kamil Dubík
GdPicture Support Team
Re: DeleteAnnotations question
Kamil, many thanks
Who is online
Users browsing this forum: Bing [Bot] and 1 guest