Re: [OpenMap Users] Whats the right way to rotate a label

From: JR Andreassen <janrune_at_io.com>
Date: Sun, 28 Jan 2007 11:52:09 -0600

Hi Don...

I figured it out...
So I have it working.
I put it in the setLocation(int[] xptr, int[] ypts)...
It seams to work, which also acomplished some of the things I wanted to
do with the
handle to the Labeled object.
I had to run a prepforRender since the setRotation caused it to loose
the path.
I also may have found a bug in the rotation. Though it may be a
incorrect sequence of events.
I'll share the code if intrested.
   It finds the midpoint of the longest visible segment of the line,
finds the slope of the line and rotates between +/-90.

 The tracing labels works pretty good on polylines(the only ones I've
tried it on so far).
Combined with the Spatial indexing it makes it perform pretty good with
streetmaps.

Next question:
Now that I have the labels following the roads, I'm trying to hide it if
the length of the line segment is shorter than
the text. I tried adding a condition to isVisible(), but I guess it was
too late(after setLocation()).
What would be the appropriate time/way to prevent drawing the label
between seLocation and Render ?
   Thanks
     JR

> Hi JR,
>
> On Jan 26, 2007, at 2:35 PM, JR Andreassen wrote:
>
>> Hi...
>>
>> I'm back to trying to rotate Text labels to follow a OMGraphic.
>> What is the correct way to get it done?
>
>
> You can figure out the points you want the text to align itself with,
> and then find the azimuth between them using the
> com.bbn.openmap.proj.GreatCircle class method.
>
>> Any samples anywhere ??
>
>
> No, none in the OpenMap package itself.
>
>
>>
>> My goal is to put in Road/Street names, but make it follow a segment.
>> Also, at the same time I can ask the question again
>> What are the possibilities of adding a couple of methods to the
>> OMLabeler interface.
>>
>> /**
>> * Set the Object beeing labeled by this OMLabeler
>> * _at_param omg The Object beeing labeled
>> */
>> public void setLabeledObject(OMGraphic omg);
>>
>> /**
>> * Get the Object beeing labeled by this OMLabeler
>> * _at_return OMGraphic The Object beeing labeled
>> */
>> public OMGraphic getLabeledObject();
>>
>> It would convinient for the labler to know what it was labeling.
>> We could find the size the Graphic beeing labeled, was smaller than
>> the Label.
>> Don't label(Until it was)
>> .In the case of roads or other plylines you can find out the path
>> and label along it
>> (Hopefully. I'm currenty trying to acomplish that)
>
>
> I can see how you would use this in an OMLabeler, but it also seems
> like something a specific labeler implementation would use
> internally. I think you could put these methods in any
> implementation of OMLabeler, or subclass of OMTextLabeler, without
> having to add them to the OMLabeler interface itself.
>
> Regards,
>
> Don
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Don Dietrick, dietrick_at_bbn.com
> BBN Technologies, Cambridge, MA
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Sun Jan 28 2007 - 13:45:47 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:08 EDT