java - How do I load an image in a particular coordinate in JMapViewer? -
I am trying to load an image in a special coordinate in JMapViewer. Anyone can recommend which class I have to use or give some examples?
import java .awt.Graphics; Import java.awt.Image; Import java.awt.Point; Import org.openstreetmap.gui.jmapviewer.Coordinate; Import org.openstreetmap.gui.jmapviewer.MapMarkerCircle; Import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker; / ** * Author @ velentos @ @ @sureed 18/09/2014 * / Public Class IconMarker applies MapMarkerCircle MapMarker {Personal image image; Public icon manager (coordination coordination, image image) {This (coordinate, 1, image); } Public IconMarker (Coordination Coordination, Double Radius, Image Image) {Super (Coordination, Radius); This.image = image; } @ Override Public Wide Paint (Graphics G, Point Position, Int Radio) {Double R = It. Tridius (); Int width = (int) (this.image.getWidth (zero) * r); Int height = (int) (this.image.getHeight (empty) * r); Int w2 = width / 2; Int h2 = height / 2; G.drawImage (this.image, position.x - w2, position.y - h2, width, height, zero); This Paint Text (G, Status); } Public image getImage () {return this.image; } Public Zero Set Image (Image Image) {this.image = image; }} // ...... Main JMapViewer mapViewer = new JMapViewer (); This.setLayout (new border layout ()); This.add (this.mapViewer, BorderLayout.CENTER); & Lt; MapMarker & gt; MapMarkerList = New Arrestists & lt; MapMarker & gt; (); MapMarkerList.add (new markmarker (new coordinate (0.5, 0.5), this.image)); This.mapViewer.setMapMarkerList (mapMarkerList);
Comments
Post a Comment