Re: [OpenMap Users] adding OMGraphics on the fly

From: SteveC <steve_at_fractalus.com>
Date: Tue, 7 Dec 2004 19:30:13 +0000

* 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);


    repaint();

    System.out.println(graphics.size());

} // setLine



have fun,

SteveC steve_at_fractalus.com http://www.fractalus.com/steve/
--
[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:35:51 EST

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