/MapPanelBean

It's Alive

Primary LanguageJavaEclipse Public License 1.0EPL-1.0


---

The main goals of this Map Panel Bean:

  1. Be easy to integrate in to any java application
  2. Be orginized and will structured
  3. Be Well Commented and Documentated

How do I implement this MapPanel?

1. Download and import the zip file 2. Do something like this
import mappanel.window.MapPanel;
import javax.swing.JFrame;

public class someClass
{
    String title = "Some Title";
    MapPanel map = new MapPanel();
    public static void main()
    {
        JFrame frame = new JFrame(title);
        frame.add(map);
	frame.pack();
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.setResizable(true);
    	frame.setLocationRelativeTo(null);
	frame.setVisible(true);
	map.start();
    }
}

Tutorial

This is the part where you learn

How do I add a point to the Map?

After starting the map, do something like this ```java public void initPoint() { double someLon = 10; double someLat = 10; MapPoint point = MapPoint(ObjectID.Point,someLon,someLat); map.addPoint(point); } ``` This will create an X on to that lon/lat. the X is the default picture

How do I add a Shape to the Map?

public void initShape()
{
    ArrayList<Double> Lons = new ArrayList<Double>();
    ArrayList<Double> Lats = new ArrayList<Double>();
    Lons.add(10d);
    Lats.add(10d);
    Lons.add(-10d);
    Lats.add(10d);
    Lons.add(-10d);
    Lats.add(-10d);
    Lons.add(10d);
    Lats.add(-10d);
    map.addShape(new MapShape(ObjectID.Shape,Lons,Lats,Color.BLACK));
}

Some of the Class explained

Map Objects

The Base of all the Objects on the map
Methods proved by this abstart class
  • set/get name - the name of the object
  • set/get zoom - the current zoom level of the object
  • set/get x and y - the x and y of that object in the map panel
  • set/get id - this is a way to tell the differents between tiles and everything else
<dt><h3>MapPoint</h3></dt>
<dd>The Base for all the points</dd>

<dt><h3>MapShape</h3></dt>
<dd>The Base for all the shapes</dd>

Screen Shots

<dt><h3>this is the Map Panel</h3></dt>
<dd><img src="https://github.com/Megamanjoker/MapPanelBean/blob/master/Pictures%20of%20the%20MapPanel/MapPanelScreenShot.png?raw=true" alt="Map Panel Screen Shot with no shapes or points" height="250" width="400"></dd>

<dt><h3>You can add points!</h3></dt>
<dd><img src="https://github.com/Megamanjoker/MapPanelBean/blob/master/Pictures%20of%20the%20MapPanel/MapPanelScreenShotWithPoint.png?raw=true" alt="Map Panel Screen Shot with a point" height="250" width="400"></dd>

<dt><h3>You can add shapes!</h3></dt>
<dd><img src="https://github.com/Megamanjoker/MapPanelBean/blob/master/Pictures%20of%20the%20MapPanel/MapPanelScreenShotWithAShape.png?raw=true" alt="Map Panel Screen Shot with a shape" height="250" width="400"></dd>

<dt><h3>You want both, go right a head!</h3></dt>
<dd><img src="https://github.com/Megamanjoker/MapPanelBean/blob/master/Pictures%20of%20the%20MapPanel/MapPanelScreenShotWithPointAndShape.png?raw=true" alt="Map Panel Screen Shot with a shape and point" height="250" width="400"></dd>