Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, August 2, 2007 7:06:01 PM(UTC)
themidnightwill

Groups: Registered
Posts: 21


Hello,

I'm knew to annotations - I love the feature so far. I've read most of the documentation, but if I missed something pleae forgive me.

What I am trying to do is limit the user to one type of annotation object per image. (Ex: one rectangle. If they draw another rectangle, the existing one is deleted).

I have been trying to find a way to access objects that have been drawn, but have not found a way to yet. Could anyone put me in the right direction? My plan is to search through the currently drawn objects, and if it matches the type of object the user is attempting to draw, it will be deleted.

Any advice would be greatly appreciated.


Thanks,

Will
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, August 6, 2007 6:03:47 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

Hello,

The following code searches for the last drawn Annotation rectangle object and keep it. Then it removes all other Annotation rectangle objects from the Container:
+---------------------+
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click

Dim i As Integer = 0
Dim found = 0
Dim TempAnnObj As AnnObject = Nothing

For i = AutomationAnn.Container.Objects.Count - 1 To 0 Step -1

If TypeOf (AutomationAnn.Container.Objects(i)) Is Ann RectangleObject Then

If found = 0 Then
TempAnnObj = AutomationAnn.Container.Objects(i).Clone()
found = 1
End If

AutomationAnn.Container.Objects.RemoveAt(i)

End If
           
Next

AutomationAnn.Container.Objects.Add(TempAnnObj.Clone())
 
End Sub
+---------------------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Wednesday, August 8, 2007 12:23:47 PM(UTC)
themidnightwill

Groups: Registered
Posts: 21


Hi Maen,

Thank you for the response.

This is somewhat like what I am trying to accomplish, however, I would like to do it when they start to draw a new object in the container. Right now I can get it to delete all previous objects (of any type), but I am having problems getting it to delete a specific type.

Do you have any suggestions? I am using C# by the way, and have implemented what I mentioned in the above paragraph in an event handler for Container.AfterDrawingObjects

Any help would be greatly appreciated.

Thanks,

Will
 
#4 Posted : Sunday, August 12, 2007 2:30:11 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

Hello,

The following code checks if you are drawing an AnnEllipseObject, it deletes all other AnnEllipseObject in the container and keeps the last drawn AnnEllipse Object:
+-----------+
private void container_AfterDrawingObjects(object sender, AnnPaintEventArgs e)
{
AnnEditDesigner EditDesigner = null;
AnnObject Object, TempAnnObj = null;
int found = 0;

if (AutomationAnn.CurrentDesigner is AnnEditDesigner)
EditDesigner = (AnnEditDesigner) AutomationAnn.CurrentDesigner;

if (!(EditDesigner == null))
{
Object = EditDesigner.EditObject;

for (int i = AutomationAnn.Container.Objects.Count - 1; i >= 0; i--)
{
if (Object is AnnEllipseObject)
{
if (found == 0)
{
TempAnnObj = AutomationAnn.Container.Objects[i];
found = 1;
}
AutomationAnn.Container.Objects.RemoveAt(i);
}

if (!(TempAnnObj == null) && TempAnnObj is AnnEllipseObject)                    
                        AutomationAnn.Container.Objects.Add(TempAnnObj);                    

}
+-----------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#5 Posted : Monday, August 13, 2007 6:22:03 AM(UTC)
themidnightwill

Groups: Registered
Posts: 21


Thanks! I got it working now.
 
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.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.137 seconds.