Re: [OpenMap Users] adding OMGraphics on the fly

From: Don Dietrick <dietrick_at_bbn.com>
Date: Tue, 7 Dec 2004 14:40:00 -0500

On Dec 7, 2004, at 2:30 PM, SteveC wrote:

> * Don Dietrick (dietrick_at_bbn.com) wrote:
>> You need to call generate(Projection) on the OMGraphic, the other
>> OMGraphics should be OK if the map isn't changing.
>
> So this *should* work (see below). Its what I'm using, it lives in my
> Layer class. When a line is added that layer disappears. resizing the
> window makes it come back with the added line.
>
> TIA
>
> public void setLine(LatLonPoint a, LatLonPoint b)
> {
> System.out.println("adding line "+
> +a.getLatitude()+","
> +a.getLongitude() + " "
> +b.getLatitude() + ","
> +b.getLongitude());
>
>
>
> OMLine l = new OMLine(
> a.getLatitude(),
> a.getLongitude(),
> b.getLatitude(),
> b.getLongitude(),
>
> com.bbn.openmap.omGraphics.geom.BasicGeometry.LINETYPE_STRAIGHT
> );
>
>
> graphics.add( l);
>
> graphics.generate( getProjection(), true);

instead do:

        l.generate(getProjection());
        graphics.add(l);

but what you have should work, too. What are you doing in
projectionChanged()?

- Don

> repaint();
>
> System.out.println(graphics.size());
>
> } // setLine
>
>
>
> have fun,
>
> SteveC steve_at_fractalus.com http://www.fractalus.com/steve/
>
>


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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 Tue Dec 07 2004 - 14:40:50 EST

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