textbaseline property not inherited by IDLgrText when specified in IDLgrAxis? [message #78925] |
Tue, 10 January 2012 08:02  |
Brian Daniel
Messages: 80 Registered: July 2009
|
Member |
|
|
Hi all,
I'm relatively new to object graphics. I've been playing with Michael
Galloy's mg_show_axes.pro routine and I wanted to extend his ability
to reorient the labels to be readable when the user has rotated the
axes. I wanted to extend that to the text labels on the axes
themselves.
Mike uses the textbaseline property of the axis object to do this.
xaxis->setProperty, textbaseline=[(newTransform[2, 2] gt 0 ? 1 : -1),
0, 0]
yaxis->setProperty, textbaseline=[0, (newTransform[2, 2] gt 0 ? 1 :
-1), 0]
zaxis->setProperty, textbaseline=[0, 0, (newTransform[1, 2] gt 0 ?
-1 : 1)]
where newTransform is the output of the trackball widget. Considering
the text object is inherited by the axis object, I thought that this
property would apply to the text object as well. Unfortunately, that
is not the case. Therefore, in the same location as Mike applies the
above transformation, I explicitly change the baseline property of the
text object via:
xaxis->getProperty, title=xText
yaxis->getProperty, title=yText
zaxis->getProperty, title=zText
xText->setProperty, baseline=[(newTransform[2, 2] gt 0 ? 1 : -1), 0,
0]
yText->setProperty, baseline=[0, (newTransform[2, 2] gt 0 ? 1 : -1),
0]
zText->setProperty, baseline=[0, 0, (newTransform[1, 2] gt 0 ? -1 :
1)]
xaxis->setProperty, title=xText
yaxis->setProperty, title=yText
zaxis->setProperty, title=zText
This doesn't work either. Does anyone (cough, Dr. Galloy, cough) have
any suggestions? Thanks.
-Brian
|
|
|
Re: textbaseline property not inherited by IDLgrText when specified in IDLgrAxis? [message #78998 is a reply to message #78925] |
Thu, 12 January 2012 12:09  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 1/10/12 9:02 AM, Brian J. Daniel wrote:
> I'm relatively new to object graphics. I've been playing with Michael
> Galloy's mg_show_axes.pro routine and I wanted to extend his ability
> to reorient the labels to be readable when the user has rotated the
> axes. I wanted to extend that to the text labels on the axes
> themselves.
>
> Mike uses the textbaseline property of the axis object to do this.
> xaxis->setProperty, textbaseline=[(newTransform[2, 2] gt 0 ? 1 : -1),
> 0, 0]
> yaxis->setProperty, textbaseline=[0, (newTransform[2, 2] gt 0 ? 1 :
> -1), 0]
> zaxis->setProperty, textbaseline=[0, 0, (newTransform[1, 2] gt 0 ?
> -1 : 1)]
>
> where newTransform is the output of the trackball widget. Considering
> the text object is inherited by the axis object, I thought that this
> property would apply to the text object as well. Unfortunately, that
> is not the case. Therefore, in the same location as Mike applies the
> above transformation, I explicitly change the baseline property of the
> text object via:
>
> xaxis->getProperty, title=xText
> yaxis->getProperty, title=yText
> zaxis->getProperty, title=zText
> xText->setProperty, baseline=[(newTransform[2, 2] gt 0 ? 1 : -1), 0,
> 0]
> yText->setProperty, baseline=[0, (newTransform[2, 2] gt 0 ? 1 : -1),
> 0]
> zText->setProperty, baseline=[0, 0, (newTransform[1, 2] gt 0 ? -1 :
> 1)]
This works for me (at least in the same manner as for the tick mark
value text, see below).
> xaxis->setProperty, title=xText
> yaxis->setProperty, title=yText
> zaxis->setProperty, title=zText
No need to do these lines though, [xyz]Text variables are references.
> This doesn't work either. Does anyone (cough, Dr. Galloy, cough) have
> any suggestions? Thanks.
Now make sure you understand that this example is somewhat limited in
that it makes the text read in the correct direction, but does not
swivel the text around so that it is right-side up. You would need to
play around with the UPDIR property as well to make the text fully readable.
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
|
|
|