Atalasoft
Welcome to Atalasoft Community Sign in | Join | Help
in

Help with custom IAnnotate interface

Last post 06 Dec 2007, 11:50 AM by AndyB. 3 replies.
Sort Posts: Previous Next
  •  26 Nov 2007, 12:05 PM 12799

    Help with custom IAnnotate interface

    Hi guys!

    I'm hoping I can put this across in a way that is meaningful and clear to you, but please let me know otherwise.

    We are writing a document management system which uses a custom, bespoke viewer to allow the display of images and other document files (such as office documents, PDFs etc). The annotation features are enabled by an AnnotationController component say on the main viewer form. So far we have successfully implemented loading, saving and display routines which are based on the code from an older version of our program, mainly for backwards compatibility.

    I have recently started work on the user-annotation interaction side of the project, which includes functionality such as creating new annotations and amending existing ones. The main problem we have at the moment is that if we drop the Annotation Controller into the Author interaction mode, we get an exception when we click an annotation to select it. The basic exception message is:

    Value was either too large or too small for an Int32

    The full detail of the exception is as follows:

    1. Exception Information
    ===============================
    Exception Type: System.OverflowException
    Message: Value was either too large or too small for an Int32.
    Data: System.Collections.ListDictionaryInternal
    TargetSite: Int32 ToInt32(Double)
    HelpLink: NULL
    Source: mscorlib

    StackTrace Information
    ===============================
       at System.Convert.ToInt32(Double value)
       at Atalasoft.Annotate.Renderer.AnnotationRenderingEngine.RenderGrips(IAnnotationGrips grips, AnnotationData annotation, RenderEnvironment e, PointF scale)
       at Atalasoft.Annotate.Renderer.AnnotationRenderingEngine.RenderGrips(IAnnotationGrips grips, AnnotationData annotation, RenderEnvironment e)
       at Atalasoft.Annotate.UI.AnnotationController.OnPaint(PaintEventArgs e)
       at Atalasoft.Annotate.UI.AnnotationController.a(Object A_0, PaintEventArgs A_1)
       at System.Windows.Forms.PaintEventHandler.Invoke(Object sender, PaintEventArgs e)
       at System.Windows.Forms.Control.OnPaint(PaintEventArgs e)
       at Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe)
       at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
       at System.Windows.Forms.Control.WmPaint(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    From our investigations we are almost certain that the IAnnotate interface class is to blame; more especially the 'Transform()' property on this interface. As things stand at the moment we are passing an empty matrix object back through this property as we didn't think we needed anything else unless we were physically changing the annotation. It would seem that we were wrong.

    Could you give us any clues about what we should be returning through the Transform property in order to simply get an annotation to select itself and fire the Click event on the annotation controller? We don't currently have any other transform properties that we can clone or reflect, so my assumption is that we will have to build and populate a matrix object from a collection of other properties.

    Any assistance or clues would be much appreciated.

    Thanks.

    Filed under: ,
  •  27 Nov 2007, 11:39 AM 12811 in reply to 12799

    Re: Help with custom IAnnotate interface

    I forgot to add that the grips on the annotations do not render at all before the exception occurs!

    After doing a search on these forums for IAnnotate, I did find one post which claimed to have an explanation and an attached example. However when I visited the post there were no attached examples, and the post suggested looking in the DotAnnotate source. I did a string search on all files under "C:\PROGRAM FILES\ATALASOFT" and none of them contain any references to a custom IAnnotate implementation.

    Am I missing the source example?

  •  29 Nov 2007, 11:57 AM 12820 in reply to 12811

    Re: Help with custom IAnnotate interface

    This may be a bug in DotAnnotate.  I was able to get the same exception using one of our demos by playing with the zoom level.  The next update will fix this.

    The code where this happens performs a calculation using the Transform scaling, grip position and grip size.  If you are returning a new Matrix object for the Transform property, there will not be any scaling so I'm not sure how you could get this exception.  If you can provide a test project which duplicates this error it will let us test with our internal build to see if the fix we made solves your problem.


    Glenn Chittenden Jr.
    Atalasoft Development Team
  •  06 Dec 2007, 11:50 AM 12840 in reply to 12820

    Re: Help with custom IAnnotate interface

    Thanks for your response Glenn.

    As a result of matters beyond my control, the decision has been made to use the Atalasoft image viewer in our products instead of our own bespoke viewer. This now means that we don't need to implement the custom IAnnotate interface unless the need arises in one form or another.

    I've tried reproducing the problem in a small-scale project but unfortunately time and investment doesn't allow me to complete this. However it's interesting that you managed to replicate the issue, so I suppose all is not necessarily lost.

View as RSS news feed in XML