Re: [OpenMap Users] Adding OMText to Layer

From: CBSpatial <support_at_cbspatial.com>
Date: Tue, 22 Mar 2005 22:42:39 +0200

> OMText textLabel = new OMText(30f, -80f, "Hello",
MText.JUSTIFY_CENTER);
> textLabel.setVisible(true);
      Proj proj =....; // get projection from
mapBean.getProjection();
      textLabel.generate(proj); // add this line and try again..you
      .
      .
---- Original Message -----
From: "Thomas Lepkowksi" <javarun_at_gmail.com>
To: <openmap-users_at_bbn.com>
Sent: Tuesday, March 22, 2005 8:57 PM
Subject: [OpenMap Users] Adding OMText to Layer


> Hello,
>
> I have a Layer that works as expected, except for the part where I
> want to display "Hello"
> when the mouse is clicked. The mouseClicked method below prints "button"
> on the console, but the OMText is not displayed on the map.
>
> I have successfully changed the color of an existing OMGraphic
> in another mouse even method, but I can't seem to add an OMGraphic to my
> omgraphic list.
>
> Can somebody give a tip on how to make the OMText be displayed?
>
> Code snippet:
>
> public class UnitLocationLayer extends Layer
> implements MapMouseListener {
>
> ... do stuff
>
> public boolean mouseClicked(MouseEvent e) {
>
> OMGraphic obj = omgraphics.findClosest(e.getX(), e.getY(), 4);
>
> if (obj != null) {
>
> System.out.println("button");
>
> // Display information
>
> OMText textLabel = new OMText(30f, -80f, "Hello",
MText.JUSTIFY_CENTER);
> textLabel.setVisible(true);
>
> // omgraphics is the global OMGraphicsList
> omgraphics.add(textLabel);
> repaint();
>
> }
>
> ...
> }
>
> Thanks.
> -Thomas
>
> --
> [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"]
>

--
[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 Tue Mar 22 2005 - 15:44:07 EST

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