I recently experimented with ScalarType.alias() to get spaces within my
RealTypes for display purposes, but alias() also calls validateName and
so won't allow them. However, there may be a way to do it with which I
If not, perhaps a better solution might be to provide a way to translate
certain characters when printing MathType strings inside a VisAD display
(I'd guess that 99% of the time that what people want is to show
"prettier" type names for axes labels and cursor value labels). One
simple way to do it would be to have a method such as
GraphicsModeControl.showUnderscoresAsSpaces(boolean), which is respected
whenever type names are drawn to a display. A more flexible method might
allow specification of a set of characters to be translated into another
set of characters, enabling the programmer to substitute in periods and
parentheses as well (or whatever else is needed). Such an addition would
not break anything, as it would represent only a cosmetic change. I
would be willing to add such a feature if anyone is interested (and if
there isn't already a way to accomplish it).
Bill Hibbard wrote:
Some of our user data comes in tagged with human readable names (eg.,
with spaces) which we'd like to maintain as is, but which causes
problems for RealType/ScalarType objects when they hit validateName().
I guess the question is why are there "reserved" characters for the
RealType/ScalarType name String's, or alternatively, what would break if
a name were just any String?
Would this work and are there hidden effects???
This wouldn't work: it would break the code that parses more
general MathType expressions like:
(time -> ((x, y, z) -> (t, p)))
I recommend using underscore "_" in place of spaces in RealType
names. I really dislike the use of spaces in Windows file names,
because of all the trouble they cause with programs that need
file names as arguments.
I believe VisAD includes methods that let you alias RealType
names to other strings that do include special characters.
Perhaps someone who uses these methods can fill you in.