DeleteAnnotations question
Posted: Thu Feb 28, 2019 9:53 pm
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
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