Page 1 of 1

Annotation top,left from/to text

Posted: Wed Feb 06, 2013 12:24 pm
by Chess

I'am trying to save annotation top/left and size to xml file. When I'am loading values (top/left/size) from xml files and convert to float, values are still same as they write in xml file. But after create annotation, top / left values change. Why ?

Save step are :
- Load an TIFF 300 DPI in gdViewer.
- Design an anotation using "AddRectangleHighlighterAnnotInteractive"
- Saving annotation to XML file. Values look like :
<nom>Zone 1</nom>

Load step are :
- Load an TIFF 300 DPI in gdViewer (the same use for save step).
- Load values top/left/size from XML files and convert it to float. Resulting converted values are same as saved values :

Code: Select all

float zoneLeft = float.Parse(zleft.Value); // 0,9935212
float zoneTop = float.Parse(ztop.Value); // 1,37816441
- Create annotation not using interrative mode :

Code: Select all

AnnotationRectangleHighlighter nvano = mgr.AddRectangleHighlighterAnnot(acolor, zoneLeft, zoneTop,                     zoneWidth, zoneHeight);
But after annotation creation :
nvano.Top = 1,51946652 instead of 1,37816441
nvano.Left = 1,1249162 instead of 0,9935212

So why top/left value change and are not the same after using it with AddAnnotation ?

I try this with the lastest version : 9.3.17
Dev tools : MS Vs2010 pro, Win 7 Pro x64

Re: Annotation top,left from/to text

Posted: Wed Feb 06, 2013 1:26 pm
by Chess

The top/left get from existing annotation is the middle point of the bounding box of the annotation but when create a new one using AnnotationManager, we provide the real top/left. So, if need to recreate an annotation using existing top/left, the "new" top/left need to be compute as :

Code: Select all

float new_annot_left = existing_annot.Left  - (existing_annot.Width / 2.0f);
float new_annot_top = existing_annot.Top    - (existing_annot.Height / 2.0f);