Yeah, math isn't my greatest strength :) Sounds good, but is it possible to remove the properties that doesn't make sense? Perhaps throw an exception for properties that doesn't make sense, or but it in a list of blocked properties and override __getattribute__ to disallow these based on shape type?
I think setting the length of a line should be possible and change only endpoint (x2/y2) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ed Leafe Sent: 12. juli 2007 15:51 To: Dabo Users list Subject: Re: [dabo-users] Text DrawObject.Width On Jul 12, 2007, at 9:30 AM, Simen Haugen wrote: > It seems natural that the Rect will mark the entire shape from the > topleft to bottomright point. Yes. > Having one DrawObject supporting all these shapes makes some of the > properties a bit difficult to get consistent. To get the entire width > for a circle, I have do Width*2. No, it would be Radius*2. And I've already added that in my working copy. > For polygons I have to go thru the points and calculate it myself..? Again, I've added that. > The shapes have quite different characteristics.. > All: rect, points > > Circle: centerposition, radius, diameter > What should width and hight return? Radius? Diameter? The width and height of a circle is the diameter. > Polygons: centerposition No, this is not used for polygons. Center is only used to define circles. Polygons (and the soon-to-be-added polylines) are defined as a collection of points, period. > For polygons width and height doesn't make sense, but if you need the > bounding box, you can use the rect property. Width and Height do make sense; they are the same as the width and height of the associated Rect. Again, I've added that for polygon/ line shapes. > Line: startPosition, stopPosition, length (longest difference between > points), width (penwidth). Rect for a line will of course give a very > large rect if it's a diagonal line, but as long as rect always > gives the > bounding box this is ok. There is no Length property for lines. I thought about adding it as a read-only property, but it would seem natural to set that property to change the length of a line, right? And it would be unclear which endpoint to change (or to change both). > Rect, Bmp, Text: width, height, position (topleft) > > This is taken from the top of my head, but I think it will be very > difficult to support everything you want/need in a single class. The > different behaviours will give subtle bugs and cause confusion. I don't think so. If you were to create a polygon and then try to specify the Radius, it really isn't up to Dabo to teach you geometry. ;-) In this case, nothing will happen, since polygon drawing doesn't use the Radius property. -- Ed Leafe -- http://leafe.com -- http://dabodev.com [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]
