Re: Object boundaries [message #40205] |
Tue, 27 July 2004 16:08  |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
Michael Wallace wrote:
> Is it possible to determine the boundaries of an object in an object
> graphics view? For example, say that I wanted the coordinates of an
> IDLgrAxis with it's annotations included. I'd like to get the
> coordinates which describe the bounding box of the axis and everything
> else associated with it (title, tick labels, tick marks, etc).
>
> I have some other annotations in this view, and I want to make sure that
> there is sufficient spacing between these annotations and the
> annotations automatically created for the axis. I am currently
> positioning the other annotations at exact locations and most of the
> time they're fine, but if my axis gets some long tick labels which
> causes the axis title to get pushed out, the title can collide with the
> other annotations. I'm just searching for a way to position my other
> stuff relative to boundary of the axis annotation to ensure that there
> won't be any overlap. Ideas?
>
> -Mike
Graphics objects normally have XRANGE, YRANGE and ZRANGE properties that
tell you the coordinates of the object's bounding rectangle.
Unfortunately, for an IDLgrAxis this does not include the tick text and
title, but you can get those separately. Consider the following code...
oaxis = obj_new('idlgraxis')
xobjview, oaxis
oaxis->GetProperty, XRANGE=xr, YRANgE=yr, ZRANgE=zr
print, xr, yr, zr
; 0.00000000 1.0000000
; 0.00000000 0.20000000
; 0.00000000 0.00000000
oaxis->GetProperty, TICKTEXT=ott
ott->GetProperty, XRANGE=xr_tt, YRANGE=yr_tt, ZRANGE=zr_tt
print, xr_tt, yr_tt, zr_tt
; -0.047485654 1.0474857
; -0.081563380 -0.020111518
; 0.00000000 0.00000000
;; Ditto for the TITLE object, but you'll have to check if it is
;; valid first.
--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
|
|
|