Exemplo n.º 1
0
  public void draw() {
    background(0);

    for (Map map : maps) {
      map.draw();
    }

    debugDisplay.draw();
  }
Exemplo n.º 2
0
  public void setup() {
    size(800, 600, GLConstants.GLGRAPHICS);

    map1 = new Map(this, "map1", 10, 10, 385, 580, true, false, new Microsoft.AerialProvider());
    map1.setTweening(false);
    map2 =
        new Map(
            this,
            "map2",
            405,
            10,
            385,
            580,
            true,
            false,
            new OpenStreetMap.CloudmadeProvider(MapDisplayFactory.OSM_API_KEY, 30635));
    map2.setTweening(false);
    MapUtils.createDefaultEventDispatcher(this, map1, map2);
  }
  public void setup() {
    size(1900, 1000, GLConstants.GLGRAPHICS);
    smooth();
    gfx = new ToxiclibsSupport(this);
    font = createFont("Arial", 30);
    textFont(font);
    String line;
    numbers = new ArrayList<String>();

    try {
      BufferedReader br =
          new BufferedReader(
              new FileReader(
                  Constants.RESULT_PATH
                      + File.separator
                      + "11_home_work_lat_long"
                      + File.separator
                      + "home_2_work"));
      while ((line = br.readLine()) != null) {
        String[] tokens = line.split("\t");
        String number = tokens[0];
        numbers.add(number);

        String home = tokens[1];
        num2home.put(number, home);
        String work = tokens[2];
        num2work.put(number, work);
      }
    } catch (Exception e) {
      logger.error("not happend", e);
    }

    map = new Map(this, new Google.GoogleMapProvider());
    // map = new Map(this, new Microsoft.RoadProvider());
    // map = new Map(this, new Yahoo.HybridProvider());

    map.zoomAndPanTo(new Location(41.387628f, 2.1698f), 13); // lat-long
    MapUtils.createDefaultEventDispatcher(this, map);

    try {
      BufferedReader br = new BufferedReader(new FileReader(Constants.BARCELONA_CELL_INFO_PATH));
      while ((line = br.readLine()) != null) {
        if (line.startsWith("cell")) continue; // skip the first line of column description
        Cell cell = new Cell(line);
        String btsID = cell.getBTSID();
        BTS2Location.put(
            btsID, new Location((float) cell.getLatitude(), (float) cell.getLongitude()));
      }
    } catch (IOException e) {
      logger.error(e);
    } catch (ParseException e) {
      logger.error(e);
    }
    loadIndividualMarkov();
  }
Exemplo n.º 4
0
  public void setup() {
    size(1200, 600, GLConstants.GLGRAPHICS);
    smooth();

    // Creates non-default dispatcher to register own broadcasters and listeners.
    eventDispatcher = new EventDispatcher();

    // Creates default mapDisplay
    Map map1 = new Map(this, "map1", 10, 10, 400, 400);
    maps.add(map1);
    Map map2 = new Map(this, "map2", 420, 10, 400, 400);
    maps.add(map2);
    Map map3 = new Map(this, "map3", 830, 10, 400, 400);
    maps.add(map3);

    debugDisplay = new DebugDisplay(this, map1.mapDisplay, 10, 390, 250, 150);

    MouseHandler mouseHandler = new MouseHandler(this, maps);
    eventDispatcher.addBroadcaster(mouseHandler);
    KeyboardHandler keyboardHandler = new KeyboardHandler(this, maps);
    eventDispatcher.addBroadcaster(keyboardHandler);

    // See class description for detailed explanation of these registrations.
    eventDispatcher.register(map1, "pan");
    eventDispatcher.register(map1, "zoom");
    eventDispatcher.register(map2, "pan", map1.getId(), map2.getId());
    eventDispatcher.register(map2, "zoom", map1.getId(), map2.getId());
    map2.setActive(true); // only map2 gets keyboard (non hit test) events
    eventDispatcher.register(map3, "pan", map1.getId(), map2.getId());
    eventDispatcher.register(map3, "zoom", map2.getId());

    // Prints all listeners
    log.debug("pan=" + eventDispatcher.typedScopedListeners.size());
    List<ScopedListeners> scopedListenersList = eventDispatcher.typedScopedListeners.get("pan");
    log.debug("pan-scopes=" + scopedListenersList.size());
    for (ScopedListeners scopedListeners : scopedListenersList) {
      log.debug(
          scopedListeners.scopeIds + " has + " + scopedListeners.listeners.size() + " listeners");
    }
  }
 public void draw() {
   map.draw();
   interactiveMode();
 }
Exemplo n.º 6
0
  public void draw() {
    background(0);

    map1.draw();
    map2.draw();
  }