A better World Map?

I'm trying to map a 3D world ... at present, I'm looking into the possibility of using
an EnumMap as my Grid reference ....
allowing me to add zones according to the three co-ordinates
then adding the zones to a HashMap which uses the EnumKey as it's Key,
and the zone as the value.
I'm trying to enable lookups by Level, then Row, then Cell ... which would lead to Zone
I have the EnumMap working, but I'm not sure how to create the HashMap from the
EnumMap references
// presume something like this
private static EnumMap<Axis,Integer> map =
   new EnumMap<Axis,Integer>(Axis.class);
public HashMap<Axis,Zone> refAdex =
   new HashMap<Axis,Zone>();
refAdex.put(Axis.Y,new Zone();Axis.Y is the last co-ordinate entry.
Edited by: kcstingel on 29/07/2009 19:42
(shortened the code line width)

While I don't do 3D mapping in Java, I do it in C++ at work quite frequently, and I'll admit, I'm perplexed by your suggestion. I see your logic behind it, but I would like to present an alternative that you may find to be more efficient.
Now, you didn't really say how you plan to display this. If you don't need double precision, consider taking them to floats. If you only need integer precision, consider using ints. I use doubles because memory is cheap, processing is cheap, and doubles are precise, and I optimize if I must.
If you're in for some heavy reading, consider JOGL - it lets you use OpenGL in Java for rendering. Otherwise, you can write some paint methods that do some sorting and iterating of your object vector to determine what to display, where, and when (yes, when is important in 3d graphics!)
If I were doing something in 3D in Java, this is where I would start. Hope this helps!
/** Base class for anything that I will put in my world
public class MyObject {
   private double x_pos, y_pos, z_pos; // could make a 3d point class, unnecessary though
   private String name; // something to reference this object by
   private OtherData data; // other things you want this object to hold/know/contain
   public MyObject(double x, double y, double z, String n, MyModel m){
      x_pos = x;
      y_pos = y;
      z_pos = z;
      name = n;
      model = m;
   // assume accessor methods apply
/** The world where things go
public class MyWorld {
   private Vector<MyObject> population; // the things in my world
   public MyWorld() {
      population = new Vector<MyObject>();
   public void add(MyObject obj) {
      if(obj == null) return; // should throw exception, lazy for example :-)
      // consider bounds checking, like
      // if(obj.x() > MAX_X || obj.x() < MIN_X || ... do for x,y,z, define MIN and MAX somewhere
      //    return; // because it didn't match the bounds
      population.add(obj); // assume if it got here it's okay to add it
public class WorldMain {
   public static void main(String[] args) {
      MyWorld world = new MyWorld();
      MyObject home = new MyObject(0,0,0,"Home Sweet Home");
      MyWorld.add(home);
   } // end main
} I would also consider using a map if we need to, to make it speedier (only if necessary)
// replace this
   private Vector<MyObject> population; // the things in my world
   public MyWorld() {
      population = new Vector<MyObject>();
// with this
   private Map<String, MyObject> population; // the things in my world
   public MyWorld() {
      population = new TreeMap<String, MyObject>();
// and the add method here:
   population.add(obj); // assume if it got here it's okay to add it
// with this
   population.put(obj.name(), obj);

Similar Messages

  • [CS4/JS] Where Am I!? A World Map script

    Here's one I originally wrote for InDesign, but Illustrators may like it as well!
    This is a Javascript implementation of a program I had on the hard disc of several consecutive computers, going back to the late '80s. This version was an implementation in C, which in turn was based upon a Pascal program: CARTOG.PAS, accompanying "Mapping the World in Pascal" by Robert Miller and Francis Reddy, BYTE, December 1987, page 329
    What does it do? It draws a world map. That's all
    Written for CS4 (but it might work other versions). Simply run the script and enter stuff into the dialog -- it ought to do the rest automatically. If you want to see your own location from outer space, go to LATITUDE et LONGITUDE de quelques Villes (which was the first comprehensive listing I found; there are lots of others) and see if your hamlet is listed. You can enter coordinates either as positive/negative values, or follow them with "E" or "W" and "N" or "S". Only decimal notation is supported; minutes & seconds was too much work.
    The image is grouped into one and consists of the background circle, all land masses in a group of their own, and optionally the meridians, also grouped. If you ungroup once, you can color and move the land and meridians around. Ungroup again to get ten zillion tiny objects, so you can play Tectonics 1-0-1 and shift the continents around the globe.
    Note: the calculations for the larger continents, in particular Asia, sometimes clash with my math. If so, you'll see stray lines and a messed up image ... No cure for that, except trying with slightly different coordinates.
    Download Instructions:
    Download from my website: http://www.jongware.com/binaries/whereami.zip
    The package contains the script, which you can move into your Illustrator Scripts folder to be able to run it from File -> Scripts, and three icons; these you should put in your own Documents folder. Sorry about that -- it seems there is no good way to make sure the script can find the images otherwise! If you forgot that or just don't want to mess up your documents, it'll still work, but with a nagging message "Wot no img!?".

    After you got a nice view of the world, you can ungroup, scale, move, and size all elements at will. It may be necessary to use the Pathfinder to combine all loose islets and stuff into one solid object -- otherwise, you might see the dividing line between Europe and Asia. It also gets easier to fill stuff.
    This image, inspired on a classic, took me a couple o'minutes of tinkering ... And of course the world is centered on the place where I live

  • Is there an App for the iPad that will show my GPS position on a world map, even if I'm at sea?

    Is there and App for the iPad that will show mu GPS position on a world map, even if I'm at sea?
    Thanks,
    Tomac

    BobTheFisherman wrote:
    GPS will show your position anywhere if your device has unobstructed view of the GPS satellites. The issue is that you must find a maps/charts that include all areas of the sea.
    There is no mobile data connection required to use GPS on land or sea. Once again your issue is the availability of downloadable maps/charts for the areas you will be traveling.
    Sorry, but you can't install an app like NAVIGON on an iPad without 3G cellular data connection:
    copied from NAVIGON app:
    ...can be installed on any iPhone3GS, iPhone4, iPhone4S, iPhone5 or iPad device (the navigation function is only available on the iPad WiFi+3G)
    Can I navigate with my mobile phone?
    Answer:In principle yes. For mobile phones there are both Onboardnavigation solutions and Offboardnavigation solutions.
    The following requirements must be fulfilled:
    •     The software must support the mobile phone. NAVIGON software
          always comes with a compatibility list. The software is guaranteed
          to work only for the mobile phones on this list.
    •     The mobile phone must have a GPS receiver. Many new mobile
           phones come with a built-in GPS receiver. Otherwise you can use
           an external GPS receiver which is connected to the mobile phone
           by cable or Bluetooth.
    •     It should be noted that an offboard solution incurs costs for using
          the mobile phone network to communicate with the provider's server.
    Message was edited by: Ingo2711

  • Plotting Senderbase Information on a World Map

    Greetings,
    I have whipped up a quick script some of you may find useful.
    ip2mapplot.py is a Python script for resolving a number of IP addresses to latitude / longitude coordinates and plotting them on a world map
    Below is an image generated from one days worth of Senderbase drops on our Ironport MGAs:
    [img:f531ef1b7c]http://insecure.io/images/a/a6/Map_sbrs_small.jpg[/img:f531ef1b7c]
    Source code is available here: http://research.mince.ac.nz/ip2mapplot.py
    Further instructions here: http://insecure.io/index.php/Code/ip2mapplot
    Cheers,
    si

    Here's what our map looks like with one week's worth of data on hosts with a SBRS of -10 to -4.
    [img:c91b0e4b2a]http://web.acd.ccac.edu/~bpoyner/ironport/ironport-map-small.jpg[/img:c91b0e4b2a]
    [+] Found 691344 unique IP addresses
    [+] Determining unique latitude / longitude points
    [+] Plotting 15037 discrete points on map
    [-] Plotting 14098 points for x < 100
    [-] Plotting 772 points for 100 < x < 500
    [-] Plotting 131 points for 500 < x <2500> 2500
    I don't know if anybody else ran into this issue, but as-is the script provided by si doesn't work with python 2.3. You'll get the following error message:
    [+] Determining unique latitude / longitude points
    Traceback (most recent call last):
    File "./ip2mapplot.py", line 41, in ?
    latlon = count.partition(',')
    AttributeError: 'str' object has no attribute 'partition'
    You have to change partition to split, and change the latlon array reference accordingly.

  • I want to show world map in regions using mapbuilder

    Hi,
    I have uploaded obiee_navteq dump in our database.could you please let me know to spilt in world map in different regions like Europe,Africa,Middle East,Australia,Nroth America....In one map.
    Thanks
    VB

    Do you really need to post three messages with identical topic?
    You have an edit button, you know? That's the icon with a pencil, next to the envelope icon, on the top-right corner of your message (only for the last message of a thread).
    You also have a CODE button above your edit area, it will make code you post much more readable, as asterisks and plus signs are interpreted by the forum...
    i don't know about the differrence between javafx 1.1 and javafx 1.2See [JavaFX 1.2: Features and Enhancements|http://javafx.com/docs/articles/javafx1-2.jsp] for a good start.
    (Funny, I just noticed they write "Java FX" (with a space) in all the titles of the site. Bad for consistency...)

  • Possible to add Multiple Destinations on WORLD MAP?

    Can I add multiple destinations in 1 world map in imovie? Or only the Start and End location? Thanks

    You cannot have multiple destinations in a single map, but you can go from point A to point B to point C to point D, etc. You do this by putting several maps adjacent to each other. So the first map is A to B. The second is B to C. The third is C to D, etc.

  • How to highlight result set data on world map

    Hi,
    I want to show the graphical representation of world map to highlight the countries which having the maximum booking of hotels of our client xyz.
    All the values are coming from the mysql db .
    I want the library which will draw the world map on the Jpanel for the respective result set
    Plz help me for this .
    I generally use the JFreeChart for drawing the other graphs but the Jfreechart don't have the library for the World Map or Destination Graph etc.
    Hint: ( Google Analytic's map is the best example )
    Thanks In Advanced
    Mahesh

    This isn't what you want, but it will get you on the right track. I chose the most complex image I could find so give it a few seconds to read the image and build the paths. The parser is catered to the image I chose, but in general you can probably expect the "path" element to delineate the boundaries for any map svg. The particular image I chose grouped the paths with country ID so I added a little mouse interaction to the GUI. Forgive me for any dumbly coded stuff. I didn't put much effort into streamlining it.
    import org.xml.sax.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.helpers.DefaultHandler;
    import java.awt.geom.Path2D;
    import java.util.StringTokenizer;
    import java.net.URL;
    public class WorldMapTest {
        public static void main(String[] args) throws Exception {
            SAXParserFactory factory = SAXParserFactory.newInstance();
            SAXParser saxParser = factory.newSAXParser();
            SimpletonPathExtractor handler = new SimpletonPathExtractor();
            saxParser.parse(new URL("http://upload.wikimedia.org/wikipedia/commons/b/b7/World98.svg").openStream(), handler);
            createAndShowGUI(handler.locations);
        public static void createAndShowGUI(final java.util.List<Location> locations) {
            JFrame frame = new JFrame();
            JPanel p = new JPanel() {
                @Override
                public Color getBackground() {
                    return Color.white;
                public void paintComponent(java.awt.Graphics g) {
                    super.paintComponent(g);
                    Graphics2D g2 = (Graphics2D) g;
                    g2.scale(getWidth() / 8000.0, getHeight() / 3859.0);
                    g2.setColor(Color.black);
                    Point p = getMousePosition();
                    if(p != null) {
                        p.x = (int) (p.x * 8000/getWidth());
                        p.y = (int) (p.y * 3859/getHeight());
                    String placeID = null;
                    for (Location loc : locations) {
                        if(p != null && placeID == null && loc.boundry.contains(p)){
                            g2.setColor(Color.LIGHT_GRAY);
                            g2.fill(loc.boundry);
                            placeID = loc.id == null?"Unkown":loc.id;
                            g2.setColor(Color.black);
                        g2.draw(loc.boundry);
                    if (placeID != null) {
                        g2.setColor(Color.green.darker());
                        Font f = g2.getFont();
                        f = f.deriveFont(Font.BOLD,(f.getSize() * 8000f / getWidth()));
                        g2.setFont(f);
                        g2.drawString(placeID, p.x, p.y);
                public java.awt.Dimension getPreferredSize() {
                    return new Dimension(1000,482);
            p.addMouseMotionListener(new java.awt.event.MouseAdapter() {
                @Override
                public void mouseMoved(java.awt.event.MouseEvent e) {
                    ((JComponent) e.getSource()).repaint();
            frame.setContentPane(new JScrollPane(p));
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
        public static class SimpletonPathExtractor extends DefaultHandler {
            java.util.List<Location> locations = new java.util.ArrayList<>();
            String recentID;
            @Override
            public void startElement(String uri, String localName, String qName, Attributes attr) throws SAXException {
                if("g".equals(qName)) {
                    recentID = attr.getValue("id");
                if ("path".equals(qName)) {
                    int length = attr.getLength();
                    for (int i = 0; i < length; i++) {
                        String attrN = attr.getQName(i);
                        String val = attr.getValue(attrN);
                        if ("d".equals(attrN)) { //path data
                            Path2D path = new Path2D.Double();
                            //assume simple polygonal path
                            StringTokenizer tk = new StringTokenizer(val, "MLzZ ");
                            try {
                                path.moveTo(Double.parseDouble(tk.nextToken()),
                                            Double.parseDouble(tk.nextToken()));
                                while (tk.hasMoreTokens()) {
                                    path.lineTo(Double.parseDouble(tk.nextToken()),
                                                Double.parseDouble(tk.nextToken()));
                                path.closePath();
                            } catch (Exception e) {
                                throw new Error("I'm a simple parser. I can only do "
                                        + "'LineTo' paths!", e);
                            locations.add(new Location(path,recentID));;
            public void endElement(String uri, String localName, String qName) throws SAXException {
                if("g".equals(qName)) {
                    recentID = null;
        public static class Location {
            Path2D boundry;
            String id;
            public Location(Path2D boundry, String id) {
                this.boundry = boundry; this.id = id;
    }

  • World Map used in the 2012 WWDC  Keynote?

    Hello.  I'm trying to find the World Map graphic used by Tim Cook in the 2012 WWDC Keynote.  Visible about 5:46 into the keynote video here (http://www.youtube.com/watch?v=bkRUE7S8pQI).
    Specifically, he animates or uses 'magic move' to highlight certain countries he is talking about.  Does anyone know where I can find a world map that would do this in Keynote?
    Thanks in advance.

    iMovie includes some fairly high resolution world maps.
    Go to Applications > iMovie > (Right Click) Show Package Contents > Contents > Resources > Map-*.jpg
    Hold Option (alt) as you drag-and-drop the files you want to use, so it will move a copy.

  • Why don't they have a world map in photos anymore

    Why do they change a good photo location system ie take away the world map. It was so easy to look up photos before. Not at all happy with the latest upgrade!

    Send your feedback to Apple at http://www.apple.com/feedback/iphone.html

  • World Map of Oracle XE Users?

    What about starting a world map of Oracle XE users at http://www.frappr.com ?
    There is already one on HTML DB : http://www.frappr.com/htmldbusers and JDeveloper: http://www.frappr.com/jdeveloperusers.
    See the ongoing thread in the HTML DB forum regarding this issue: World Map of HTML DB Users?
    I guess it will make it easier to connect with people in the same area who share the same interest in XE.
    Greetinx from Germany,
    ~Dietmar.

    OK - we have a Frappr-group now!!!
    http://www.frappr.com/oraclexe
    It's easy to use, you can even add yourself to the map without registering!
    So don't hesitate to add yourself to the map!
    I've taken the OracleXE logo from Technet. If this is not appropriate, please let me know, I'll remove it then.
    Also, I've added the following tags: oracle xe database web htmldb xml sql
    We're pretty easy to find through frappr.
    Any comments / changes are welcome.
    ~Dietmar.

  • Since I have downloaded FF 29, it continually comes up with a world map and wants me to answer some survey.

    When I log into FF29 the home web page gives me a world map which then requires me to answer a survey which I have done once but it keeps repeating. I have had to go to Google Chrome because of the nuisance and wasted time.
    Also FF29 does not seem to recognize PDF forms for printing when they are attachments to emails that I want to print out.

    Gingerbread Man,
    "snippets" are below the Search Bar, like
    <pre><nowiki>What kind of Web do you want? Join Firefox users around the world shaping its future.</nowiki></pre>
    That "map" replaces the Firefox "brandLogo" currently. IIRC, that is either new or something that hasn't been messed with before. I'm not sure though, in most Profiles I use a different Homepage.

  • Here Drive+ Beta & Here Maps do not activate on my...

    Hi,
     I have installed Here Drive + Beta and Here Maps on my Nokia 620, when I click on them to activate they just return to the app list. I have un-installed and re-installed several times over various days and it still does not load. Important to note, Here Transit and other navigation apps work but not Here Drive + Beta and Here Maps! It's very frustrating, can anyone suggest what's going on?
    Thank you
    Kram
    Solved!
    Go to Solution.

    In the end I gave up and proceeded to do a hard re-set back to initial factory settings – low and behold it now works fine, although I haven’t fully tested it on the road.
    For information - kramtheman

  • Tell me about an application of world map that doesn't require internet connection, Nor GPS

    I need  good & updated maps that do not require internet connection .Do you know @ an application ?

    Have you tried searching the app store or doing a google search?
    In the time it took you to register here and post your question, you could have already found an answer.    

  • Bootcamp on tiger in a post beta world

    A few days back the public beta program for bootcamp ended and leapord (with bootcamp built in) was announced.
    Starting from scratch on tiger (I do not have any previous bootcamp intalls or downloads), is there a way to run bootcamp on tiger today?
    I'm motivated for such because I have just purchased a new mac, but I would rather run tiger until leapord has a revision or two under its belt.

    Are you sure it is expired TODAY?
    This document says, "The license to use Boot Camp Beta version 1.3, 1.4 expires when Mac OS X 10.5 Leopard is released."
    http://docs.info.apple.com/article.html?artnum=303572
    Leopard is going to be released on 10/26/07. It seems to me that you have 9 more days to do what you want.

  • New World Map for Apex services: Consultants, Developers, Hosting Services

    As Matt suggested in this recent thread: " ApEx / HTML DB - are there actually any developers in the Marketplace (UK) " ApEx / HTML DB - are there actually any developers in the Marketplace (UK)
    we might need an overview of available consultants, developers, hosting providers, available products and additional services.
    Thus I have started a new group on Frappr: http://www.frappr.com/oracleapplicationexpressservices
    Since each "service provider" (can also be a person) may fit into several of the described categories, I have chosen to provide only one category (marker).
    We can use the shoutouts to make clear which service will be provided.
    Please put yourself on the map!
    Cheers,
    ~Dietmar.

    Maybe new users of APEX would like to join the map of APEX users?
    http://www.frappr.com/oracleapplicationexpress
    Happy New Year 2007!
    Cheers!
    AB

Maybe you are looking for

  • Previewing Pages via Testing Server Unusable???

    Hello, I typically set up a local testing server during development. When hitting F12, Dw uploads the current page to the testing server, and then correctly shows that page in my browser. However, Dw DOES NOT update the CSS file, and since most chang

  • JMenuItem painting Problem

    Hi, I have painting problem with adding the JMenuItems dynamically. In the screen1 figure shown below, Menu 2 has has total 10 items, but initially we will show only three items. When the user clicks on the menu item ">>" all the Ten Items in Menu 2

  • HT5295 What are the basics of creating and distributing Podcasts?

    What are the basics of creating and distributing Podcasts?

  • MS SQL Server License has expired

    Hi Guys,                  We have installed CRM 5.0 Development and Production servers and these server were working  fine for few months. Suddenly Our MS SQL database server evaluation period has got expired already . Can anyone suggest me to how to

  • System is not considering open reservations at the time of next MRP Run

    Hi, In our business process, subcontractors are defind as Vendors in the SAP system and materials will be provided / transfered to these subcontractors in the SAP system through Subcontracting route (541 movement type). Now, business wants to 'Monito