This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
firamax  
#1 Posted : Sunday, April 15, 2007 9:21:23 PM(UTC)
firamax

Rank: Member

Groups: Guest
Joined: 4/15/2007(UTC)
Posts: 25

Dear Sirs,

we are using trial version of GM 4.0 for .NET, in order to test it for a new VB .NET application. According to help file and samples it looks like GM 4.0 .NET is very close to what we need. The main scope of the application is that we need a viewer and we need annotations on images.

We did a sample with a bitmapViewer control and a VObjectsRubberband object. We have also a toolbar button and when pressed, user can make a Rectangle exactly as Multilayer Image Editor Demo does.

What we want to do is to get informations about this Rectangle(x and z position, width and height) immediately after its creation and also after its size or posizion changed, so we can programmatically draw it again later.

Any ideas how to get those informations?

fir

Andrew  
#2 Posted : Sunday, April 15, 2007 10:09:41 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Guest
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
Take a look at GetVObjectBounds method of the RectangleVObject (in fact all VObjects have this method). The Changed event allows to determine its size every time the user resizes the rectangle.

If you have problems with it, please post here. We will make a code snippet demonstrating this.

P.S. By the way, I did not get why it is necessary to draw it programmatically. Vector Objects module does all the painting itself. Could you give some details on this so that we could advise the best solution?

Edited by user Tuesday, January 1, 2008 4:45:30 AM(UTC)  | Reason: Not specified

firamax  
#3 Posted : Monday, April 16, 2007 2:22:29 AM(UTC)
firamax

Rank: Member

Groups: Guest
Joined: 4/15/2007(UTC)
Posts: 25

The main idea, is that we need to put some annotations(rectangle, line and text) on the image. What we need to do is to save those informations(like x, y, width, height, text etc.) for each one annotation into a database. When we close the viewer and re-open it again to see the initial image, we need to show or programmatically draw, the same annotations that was created before. In order to do that we use the following script :

Code:
'Here is what happens when toolbar button for rectangle is pressed
Private Sub tbrRectancleAnnotation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbrRectancleAnnotation.Click
        ClearAddObjectToggle(tbrRectancleAnnotation)
        AddNewObject(New Aurigma.GraphicsMill.WinControls.RectangleVObjectCreateDesigner)
End Sub 

Private Sub ClearAddObjectToggle(ByVal exceptOfObject As ToolStripButton)
        Dim buttons() As ToolStripButton = {tbrRectancleAnnotation}
        For Each obj As ToolStripButton In buttons
            If Not obj Is exceptOfObject Then
                obj.Checked = False
            Else
                obj.Checked = True
            End If
        Next
End Sub

Private Sub AddNewObject(ByVal designer As Aurigma.GraphicsMill.WinControls.IDesigner)
        If TypeOf designer Is Aurigma.GraphicsMill.WinControls.ImageVObjectCreateDesigner Then
            Dim imageDesigner As Aurigma.GraphicsMill.WinControls.ImageVObjectCreateDesigner = CType(designer, _
                Aurigma.GraphicsMill.WinControls.ImageVObjectCreateDesigner)
            ClearAddObjectToggle(Nothing)
        End If       
        VObjectsRubberband1.CurrentDesigner = designer
End Sub

 Private Sub VObjectsRubberband1_CurrentLayerChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles  
        VObjectsRubberband1.CurrentLayerChanged
        MsgBox("current layer changed")
End Sub

Since here everything works fine and annotation is created and be changed. We noticed that all changes(moving, resizing, etc) activates VObjectsRubberband1_CurrentLayerChanged event.

Is there any idea hot to get those informations we need for each one annotation?

fir

Edited by user Tuesday, December 18, 2007 4:00:23 AM(UTC)  | Reason: Not specified

firamax  
#4 Posted : Monday, April 16, 2007 3:43:15 PM(UTC)
firamax

Rank: Member

Groups: Guest
Joined: 4/15/2007(UTC)
Posts: 25

We have noticed that in MultiLayer Image Demo there are two very usefull operations, File->Open and File->Save that saves and loads a .dat file which contains all informations for all annotations. This way GM 4 makes it very easy to save and load all annotations. The sample uses a multiLayerImage control and what we need is a sample like this for one layer only and BitmapViewer control instead of multiLayerImage.

Our problem is that the way we did it, we can save annotations to .dat file, but we cannot load them. We send you attached this small project, hoping that we will finally be able to save and load the annotations, since we have problem while loading the .dat file....

Any idea what to change on this small project while running Load .dat command?

Thanks in advance

fir

Alex Kon  
#5 Posted : Tuesday, April 17, 2007 3:02:04 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Guest
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hello,

Everything is correct in your code, except one moment - you shouldn't serialize and deserialize workspace dimensions while working with BitmapViewer. Workspace size of BitmapViewer is always equal to the size of the loaded bitmap. Because of that you cannot change values of the WorkspaceWith or WorkspaceHeight properties in contrast to MultiLayerViewer.

firamax  
#6 Posted : Tuesday, April 17, 2007 3:31:04 PM(UTC)
firamax

Rank: Member

Groups: Guest
Joined: 4/15/2007(UTC)
Posts: 25

Thanks Alex,

after commenting those 2 lines about WorkspaceWidth and WorkspaceHeight i opened an image, put some annotations on it and then saved its .dat file. Then i closed project and re-run it again, opened the same image as before and i tried to load the .dat file but i am getting this error in VObjectsRubberband1.Layers.Deserialize(file) command.

Error.message = {"Binary reader data is incorrect.Parameter name: br"}

Is there something else that i do wrong ?

Thanks in advance

fir

Alex Kon  
#7 Posted : Tuesday, April 17, 2007 4:29:09 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Guest
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hello Fir,

You should also comment out 2 corresponding lines in SaveTemplateToFile() method. Otherwise this additional bytes will cause error during layers deserialization.

firamax  
#8 Posted : Wednesday, April 18, 2007 1:35:20 AM(UTC)
firamax

Rank: Member

Groups: Guest
Joined: 4/15/2007(UTC)
Posts: 25

Hi Alex,

well, after commenting i can load the .dat file and it works as i need. But do you have any idea why after loading the .dat file, i cannot move the annotations that are loaded or when i press toolbar button to create a new rectangle, it does not create it?

Thanks so much anyway,

fir

Alex Kon  
#9 Posted : Thursday, April 19, 2007 10:35:24 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Guest
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hello Fir,

The matter is that after deserialization VObjectsRubberband has no selected layer. So you should add the following lines of code in your OpenTemplateFromFile() method:

Code:
If VObjectsRubberband1.Layers.Count > 0 Then
     VObjectsRubberband1.CurrentLayerIndex = 0
End If

Edited by user Tuesday, December 18, 2007 4:01:34 AM(UTC)  | Reason: Not specified

firamax  
#10 Posted : Friday, April 20, 2007 1:06:42 AM(UTC)
firamax

Rank: Member

Groups: Guest
Joined: 4/15/2007(UTC)
Posts: 25

Thanks Alex, is works perfect!!!
Dmitry  
#11 Posted : Friday, April 20, 2007 12:01:16 PM(UTC)
Dmitry

Rank: Advanced Member

Groups: Guest
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
Hello Fir,

Just curiously, why don't you use MultiLayerViewer object?

Sincerely yours,

Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!

Users browsing this topic
Guest (4)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.