It is a fact that MapInfo Pro user interface supports the ability to rotate
existing
text objects in a map layer. Specifically if you double-click on a text
object in an
editable layer then the Text Object dialog appears, displaying StartX,
StartY, and Rotation Angle properties of the text object in addition to the
text string itself. If you key in a new number in the Rotation Angle
control
and click OK then MapInfo rotates the text as expected around its top
left-hand corner and its size is preserved. This procedure works equally
well if the initial Rotation Angle is zero or if it's greater than zero.
However if you try to use the MapBasic statement
alter Object objText GEOGRAPHY, OBJ_GEO_TEXTANGLE, newAngle
to change the rotation angle of a rotated text object (not a horizontal one)
then the result is very disappointing.
The text rotates to the new angle ok BUT THE TEXT SIZE IS GREATLY INCREASED
AND THE TOP-LEFT-HAND CORNER POSITION MOVES.
Here's a demonstration of the problem.
1. Create a Long/Lat table called "t1" containing a single text object by
importing a MIF file containing:
Text
"MAPINFO"
0 -0.1 1.0 0.0
Font ("Arial",0,0,0)
Angle 45
This text object is 1.0 degrees wide by 0.1 degrees high, rotated 45 degrees
anti-clockwise
about the point (0,0).
2. open t1 in Mapinfo Pro and double-click on the object to confirm the
above properties in the Text Object dialog
3. in the Mapbasic window type:
dim objText as object
fetch first from t1
objText=t1.obj
alter object objText Geography 7,0
update t1 set obj=objText
and watch the text get screwed up. The resultant text is 0.707.. degrees
high, not 0.1 degrees high!
Q1. why can MapInfo get it right through the Text Object dialog but not
through the Mapbasic "alter object" statement?
Q2. is there a known work-around to the problem of changing text rotation
angles programatically, other than exporting the table to MIF (where the
creation properties of text objects are exposed correctly) and editing this
stuff?
Q3. How does one recover in Mapbasic the "creation coordinates" for a
rotated text object?
By that I mean the coordinates that appear in a MIF file or a create text
statement .
Because of the above problem, using "alter object" to set the rotation angle
to zero and then using ObjectGeography(OBJ_GEO_MINX) etc is useless.
PS. What I'm really trying to do is programatically re-size all the text in
a Map layer, but my program fails for all text objects that have a rotation
angle other than zero. :o(
Thanks in anticipation.
David M Haycraft
Information Analysis Associates Pty Ltd
ABN 47 085 516 105
1 Cumming Place, Wanniassa, 2903
Aust Capital Territory, Australia
Phone/Fax: 61 + 2 + 6231 8104
Mobile: 0412 001 134
Email: [EMAIL PROTECTED]
Web : www.acslink.aone.net.au/actaa/iaa.htm
A MapInfo Technology Partner
_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.