Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
undead80  
#1 Posted : Monday, January 7, 2008 11:23:52 PM(UTC)
undead80

Rank: Member

Groups: Member
Joined: 1/7/2008(UTC)
Posts: 28

Hi,

We are using multilayerviewer and create some VObject (For Image) in the design. Is that possible for us to know what is the "actual printing size" of the vObject in "Inch" (And this value should be the same when we zoom in and out of the design)?

For the multilayerViewer, we do have workspace size, what about those vObject?
Alex Kon  
#2 Posted : Tuesday, January 8, 2008 1:51:37 PM(UTC)
Alex Kon

Rank: Advanced Member

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

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

It depends on what "actual size" do you need. If you need just bounding rectangle of the object in points - you should use VObject.GetTransformedVObjectBounds() method.

If you need linear size of the object in design - there are two possible cases. If you are applying only scale/move operations to the object - you may use VObject.GetTransformedVObjectBounds() here too. But if you are using skew/rotation - you should use more complicated way:

Code:
Aurigma.GraphicsMill.WinControls.IVObject obj = GetObjectFromSomewhere(...);
System.Drawing.RectangleF baseRect = obj.GetVObjectBounds();

System.Drawing.PointF[] points = new System.Drawing.PointF[] { 
	baseRect.Location, 
	new System.Drawing.PointF(baseRect.Right, baseRect.Top), 
	new System.Drawing.PointF(baseRect.Left, baseRect.Bottom) };
obj.Transform.TransformPoints(points);

float width = CalcDistance(points[0], points[1]);
float height = CalcDistance(points[0], points[2]);


where CalcDistance() method simply returns Euclid distance between 2 points, something like that:

Code:
private static float CalcDistance(System.Drawing.PointF p0, System.Drawing.PointF p1)
{
	return (float)System.Math.Sqrt((p0.X - p1.X) * (p0.X - p1.X) + (p0.Y - p1.Y) * (p0.Y - p1.Y));
}


All width/heights are measured in points. To convert them into inches just divide them by 72.
undead80  
#3 Posted : Wednesday, January 16, 2008 6:13:48 PM(UTC)
undead80

Rank: Member

Groups: Member
Joined: 1/7/2008(UTC)
Posts: 28

Thanks !!!
Users browsing this topic
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.