RE: [OpenMap Users] How do I rotate an OMPoly?

From: Benito, Robert P. <rbenito_at_mitre.org>
Date: Tue, 27 Jan 2009 14:35:58 -0500

Thanks - I tried your suggestion with the following code and it had some success. The OMPoly rotates, but it puts it at random locations on the map. (I tried to clone Graphics g, but I get an error saying that method is protected). polyLat and polyLon are the latitude and longitude of the OMPoly. Am I missing something?

-Pat

    _at_Override
    public void render(Graphics g){
        Graphics2D image = (Graphics2D) g;
        AffineTransform transform = image.getTransform();
        transform.rotate(Math.toRadians(45),polyLat,polyLon);
        image.transform(transform);
        super.render((Graphics) image);
    }






-----Original Message-----
From: Don Dietrick [mailto:dietrick_at_bbn.com]
Sent: Monday, January 26, 2009 6:22 PM
To: Benito, Robert P.
Cc: openmap-users_at_bbn.com
Subject: Re: [OpenMap Users] How do I rotate an OMPoly?

Hi Pat,

There's really no support built-in for rotating OMPolys, but you can
do that easily by extending OMPoly and overriding the render(Graphics)
method. Create a clone of the Graphics object, rotate it, and then
call super.render(Graphics). Don't forget to dispose of the clone
when you are done.

The only other thing you'll have to decide is where to center the
rotation of the Graphics object, and you can use the location of the
poly for that.

Hope this helps,

Don

On Jan 21, 2009, at 2:11 PM, SlikWilly wrote:

>
> Hi,
>
> I'm drawing a series of OMPoly objects on the map, and I'd like to
> be
> able to rotate them x number of degrees or radians. Is there a way
> to do
> this?
>
> Thanks,
> Pat
> --
> View this message in context: http://www.nabble.com/How-do-I-rotate-an-OMPoly--tp21590099p21590099.html
> Sent from the OpenMap mailing list archive at Nabble.com.
>
> --
> [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"]

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, openmap_at_bbn.com
BBN Technologies, Cambridge MA, USA
http://openmap.bbn.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


--
[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 Jan 27 2009 - 14:37:08 EST

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