Results 1 to 4 of 4
  1. #1
    T-Pane is offline Member
    Join Date
    Sep 2009
    Posts
    2
    Rep Power
    0

    Default Java 2D GPS Waypoint

    Hello all,

    I have a bit of a problem. I am working with some mapping technologies need to draw a GPS waypoint/marker on it, exactly like the ones you would see in GoogleMaps. So the little red and blue dot things.


    However, I have no idea about Graphics so doing this is easier said that done. Can anyone give a code snippet on how to draw one of these way points using Graphics2D?

    I know it should look something like this:
    public boolean paintWaypoint(Graphics2D g, JXMapViewer map, Waypoint wp)
    {
    g.setStroke(new BasicStroke(3f));
    g.setColor(Color.BLUE);
    g.drawOval(20,20,20,20);

    return true;
    }

    But not look like a blue circle as I have drawn?

  2. #2
    mrmatt1111's Avatar
    mrmatt1111 is offline Senior Member
    Join Date
    Aug 2009
    Location
    San Jose, CA, USA
    Posts
    320
    Rep Power
    6

    Default

    Are you trying to fill the oval?

    Java Code:
    g.fillOval(20,20,20,20);
    My Hobby Project: LegacyClone

  3. #3
    T-Pane is offline Member
    Join Date
    Sep 2009
    Posts
    2
    Rep Power
    0

    Default

    Hey Matt,

    No I trying to get my graphic to look like a google GPS marker. I'm pretty bad at graphics so all I can do is draw simple shapes.

    The google markers look like this:

    h t t p : / / danielmclaren.net/files/public/2008/gneditor/gps_keypoints02.jpg

  4. #4
    mrmatt1111's Avatar
    mrmatt1111 is offline Senior Member
    Join Date
    Aug 2009
    Location
    San Jose, CA, USA
    Posts
    320
    Rep Power
    6

    Default

    i would first create an image in a drawing program (gimp, photoshop, whatever) then loaded it as a BufferedImage into java, then paint that image in your draw method.

    i would spend some time playing around with the tutorials: Java 2d
    My Hobby Project: LegacyClone

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •