示例#1
0
    /** Gets the child Hotspots data from the XML file. */
    @SuppressWarnings("unchecked")
    private synchronized void readXML() throws DocumentException {
      List<Element> list = mission.xmlMissionNode.selectNodes("hotspots/hotspot");

      int j = 0;
      for (Iterator<Element> i = list.iterator(); i.hasNext(); ) {
        Element hotspot = i.next();
        try {
          HotspotOld newHotspot = HotspotOld.create(mission, hotspot);
          newHotspot.addHotspotListener(MapOverview.this);
          hotspots.add(newHotspot);
          // new hotspots are not added to myMapView.getOverlays();
          // this would course a crash in nonmain thread;
          // readxmlHandler will add them later
        } catch (HotspotOld.IllegalHotspotNodeException exception) {
          Log.e("MapOverview.readXML", exception.toString());
        }

        Message msg = mHandler.obtainMessage();
        Bundle b = new Bundle();
        b.putInt("progress", ++j);
        b.putInt("max", list.size());
        msg.setData(b);
        mHandler.sendMessage(msg);
      }
    }
示例#2
0
  /**
   * adds hard-coded POIs to the intent
   *
   * @param intent the intent
   */
  private void addPois(WikitudeARIntent intent) {
    List<WikitudePOI> pois = new ArrayList<WikitudePOI>();
    WikitudePOI poi;

    for (Entry<String, HotspotOld> hotspotEntry : HotspotOld.getAllHotspots()) {
      HotspotOld curHotspot = hotspotEntry.getValue();
      GeoPoint gp = curHotspot.getPosition();
      double latitude = (double) (gp.getLatitudeE6()) / 1E6;
      double longitude = (double) (gp.getLongitudeE6()) / 1E6;

      String name = curHotspot.getName();
      String description = curHotspot.getDescription();
      // String iconRessource = curHotspot.getIconRessource();

      poi = new WikitudePOI(latitude, longitude, 0.0d, name, description);
      pois.add(poi);
    }
    intent.addPOIs(pois);
  }
示例#3
0
        public void handleMessage(Message msg) {
          int progress = msg.getData().getInt("progress");
          int max = msg.getData().getInt("max");
          boolean finish = msg.getData().getBoolean("finish");

          if (progress != 0) readxmlDialog.setProgress(progress);
          if (max != 0) readxmlDialog.setMax(max);

          if (finish) {
            // new hotspots were not added to myMapView.getOverlays();
            // this would cause a crash in nonmain thread; so this is done
            // here
            List<Overlay> mapOverlays = myMapView.getOverlays();
            for (Iterator<HotspotOld> iterator = hotspots.iterator(); iterator.hasNext(); ) {
              HotspotOld hotspot = (HotspotOld) iterator.next();
              mapOverlays.add(hotspot.getGoogleOverlay());
            }
            // mapOverlays.addAll(hotspots);

            dismissDialog(READXML_DIALOG);
            readxml_completed = true;
          }
        }
示例#4
0
 public void onClick(View v) {
   HotspotOld h = (HotspotOld) v.getTag();
   h.runOnTapEvent();
 }