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, January 29, 2009 5:37:43 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


Hello,
I'm trying to modify the AnnRulerObject so the measures text never comes out of the image bounds.

I looked at the help and it explains how to create a "MyTriangleObject" and a "MyCheckBoxObject" with DrawDesigners, RunDesigners, and EditDesigners etc... I tried them and they work perfectly.

But when I tried to create a CustomRulerObject inheriting AnnRulerObject or as a field of my Object,
and I create it, the InvalidRectangle of the ruler is Null, and generates a NullReferenceException.

Even if I do:
AnnRulerObjet ruler = new AnnRulerObject();
the InvalidRectangle is null.

Can you give some help about this?
Thank you.

Tiga.
 

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 : Friday, January 30, 2009 4:17:06 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


The InvalidRectangle property can't have any meaning until the AnnObject has actually been added to the container because until that point there is no coordinate system for the rectangle to be based off of.  Once you add the AnnObject to the AnnContainer the InvalidRectangle property will no longer be null.
 
#3 Posted : Friday, January 30, 2009 4:42:52 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


ok. Thank you.

But why don't we have to do this using the original ruler?
When you click into the RasterViewer, automatically the ruler is added and its invalid rectangle is not null.

Why do I have to add it to the container? And, when can I do that? On the mouse down?
Do you have some example?

Thank you.
Tiga.

 
#4 Posted : Monday, February 2, 2009 3:39:17 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


When you use Automated annotations and use the mouse to draw the annotations, they are getting added to the container.

The InvalidRectangle is used for painting purposes.  If an object isn't in an AnnContainer, it's never going to get painted so this property has no meaning.

If you're trying manually add an annotation, you have to call AnnContainer.Objects.Add.

If this doesn't answer your question, please explain your problem and goal in more detail.
 
#5 Posted : Monday, February 2, 2009 6:03:03 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


I'll explain it as best as I can.

I have a RasterViewer with an AnnAutomationManager. When I want to add a basic annotation, it's very simple, it works perfectly. I just have to change the CurrentObjectId of the automationManager
and the type of object used is automatically updated in it, so when I click into the viewer and move the mouse it draws the annotation automatically.

When I try to make an AnnCustomObject, based on AnnRulerObject, creating in the automationManager a custom id for my Object (UserObjectID) , I don't know why the InvalidRectangle of my Ruler is allways null. I think it's because I use basic DrawDesigner, EditDesigner and RunDesigner.
What I want to do is an Object that contains a Ruler and a Text. An AnnObject that contains an AnnRulerObject and an AnnTextObject or an AnnRulerObject that contains an AnnTextObject.
Why do I want to do that?

Because with the simple RulerObject, the measurement text goes out of the viewer without any control. So if I have an AnnCustomRulerObject for example, I could control the location of the TextObject while moving the ruler.
I also could move the TextObject around the RulerObject, do you know what I mean?
So what I did, is an AnnCustomRulerObject with an AnnTextObject field. And then I have two possibilites:
1) Implement the DrawObject method... but the InvalidRectangle is not the intersection of the InvalidRectangle of the AnnTextObject and the Ruler, so the Refresh is not good.
2) Implement the DrawDesigner, EditDesigner and RunDesigner for my custom object... what I also did but I found the problem of the InvalidRectangle in the Ruler that generates me a NullReferenceException when it tries to paint itself.

I don't know if it's clear enough...
 
#6 Posted : Tuesday, February 3, 2009 6:48:47 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


This seems like a good feature to add to the SDK so I went ahead and reported a feature request with the reference number 7800IDT.  If chosen for implementation, most feature requests are added at major releases (16, 17 etc.).

If this is an urgent need, please contact our custom development department by visiting http://www.leadtools.com/devservices/ for a quote.

As for creating your custom annotation, I'll have to take a look at what you're doing.  Please send a small sample project (NOT your entire application) that isolates this problem so I can try to reproduce it here.

NOTE: If you are attaching a project or file to the forums...
1.) Zip the file(s) up.
2.) Make sure it is less than 5 MB.  If it is larger, please send an email to support@leadtools.com and we'll send you FTP instructions.
3.) Remove ANY AND ALL unlock codes and LEADTOOLS DLLs.
4.) Do not click the preview button, the attachment will not show up when you post it.

If you do not wish to post your file(s) on the forum since they are publically viewable, please send an email to support@leadtools.com and make sure that you include a link to this forum post.
 
#7 Posted : Tuesday, February 3, 2009 7:07:07 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


Thank very much.
It didn't seem so hard to do, but with the ruler problem I can't do the rest.

I'll send you the project as simpler as possible when I'll have cleaned it.

If you think it's too complicated to do, tell me.

Thank you again.
Tiga.
 
#8 Posted : Wednesday, February 4, 2009 3:37:28 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


Custom annotations can be tricky, but what you are trying to do should be possible.  Another thing that I just thought of regarding the error is to check to make sure the AnnObject is in a valid container before trying to do any of the operations that require the InvalidRectangle property.  Each AnnObject has a Container property, so if your object hasn't yet been added to an AnnContainer, this should be null.  Therefore you could do something like this:

if (myCustomObject.Container != null)
{
    // Do stuff with the InvalidRectangle
}
 
#9 Posted : Tuesday, February 10, 2009 8:25:01 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


Hi again,
I've done another custom object based on AnnObject.

This is a ProtractorObject without CenterPoint.
What I mean is that I give 4 points (two lines)
and I calculate what would be the intersection of the two lines, and from that I can get an Angle that I can display.

I've done an AnnObject (custom) with 4 points and one TextObject, I draw my TextObject at the location of a fifth Point.

But, why when I draw the TextObject it doesn't draw itself where expected?
I mean, when I move the entire object, all the control points move, but the "location" of them don't change, so when I draw the TextObject at the location of the FifthPoint, it stays where it was before.

Was I clear enough? Can somebody help me again?
Thank you.
Tiga
 
#10 Posted : Wednesday, February 11, 2009 4:55:41 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


OK, I found the problem, but now I have another one...

When I translate my Object it's ok, all the points move together AND the measurement text too.

When I rotate the entire object, how can I independently not rotate the text but draw it on the good location, the PhysicalTransform changes for my five points, and I want to draw the text always at the location of the fifthPoint without rotating it.

Thank you.

 
#11 Posted : Wednesday, February 11, 2009 5:54:19 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


I will need to see this problem in action in order to diagnose it.  Please send a small sample project (NOT your entire application) that isolates this problem so I can try to reproduce it here.
 
#12 Posted : Thursday, February 19, 2009 10:14:00 PM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


Hello again,
it's not necessary I could do it finally.

For the AnnRulerObject, I just needed to override the InvalidRectangle.

For the custom Protractor the measure text rotates with the object. I can't do nothing about it from now.
Thank you for support.

Here's some other question:
How can I set the RotateCenter and the RotateGripper of an AnnObject to visible = false?
 
#13 Posted : Monday, February 23, 2009 11:25:47 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


You can do this by setting the UseRotateControlPoints property to false.
 
#14 Posted : Tuesday, February 24, 2009 1:12:37 AM(UTC)

tigana  
tigana

Groups: Registered
Posts: 21


Thank you very much.
 
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.290 seconds.