예제 #1
0
 public void setMiscState(Main main, Logic logic) {
   main.setImageFileName(savedImageFileName);
   logic.setLastComments(savedLastComments);
   logic.setLastSources(savedLastSources);
   Application.setTaskNotifications(main, savedTaskNotifications);
   Application.setOsmDataNotifications(main, savedOsmDataNotifications);
 }
예제 #2
0
 public void setSelected(Logic logic) {
   logic.setMode(savedMode == null ? Mode.MODE_MOVE : savedMode);
   Log.d("EditState", "savedMode " + savedMode);
   if (savedNodes != null) {
     for (Node n : savedNodes) {
       Node nodeInStorage =
           (Node) Application.getDelegator().getOsmElement(Node.NAME, n.getOsmId());
       if (nodeInStorage != null) {
         logic.addSelectedNode(nodeInStorage);
       }
     }
   }
   if (savedWays != null) {
     for (Way w : savedWays) {
       Way wayInStorage = (Way) Application.getDelegator().getOsmElement(Way.NAME, w.getOsmId());
       if (wayInStorage != null) {
         logic.addSelectedWay(wayInStorage);
       }
     }
   }
   if (savedRelations != null) {
     for (Relation r : savedRelations) {
       Relation relationInStorage =
           (Relation) Application.getDelegator().getOsmElement(Relation.NAME, r.getOsmId());
       if (relationInStorage != null) {
         logic.addSelectedRelation(relationInStorage);
       }
     }
   }
   //
   logic.setSelectedBug(savedBug);
 }
예제 #3
0
  /** Implicit assumption that the list will be short and that it is OK to read in synchronously */
  DiscardedTags() {
    Log.d("DiscardedTags", "Parsing configuration file");

    AssetManager assetManager = Application.getCurrentApplication().getAssets();

    try {
      InputStream is = assetManager.open("discarded.json");
      JsonReader reader = new JsonReader(new InputStreamReader(is, "UTF-8"));
      try {

        try {
          reader.beginArray();
          while (reader.hasNext()) {
            redundantTags.add(reader.nextString());
          }
          reader.endArray();
          Log.d("DiscardedTags", "Found " + redundantTags.size() + " tags.");
        } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      } finally {
        reader.close();
      }
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
예제 #4
0
 public EditState(
     Context context, Logic logic, TileLayerServer osmts, String imageFileName, BoundingBox box) {
   savedMode = logic.getMode();
   savedNodes = logic.getSelectedNodes();
   savedWays = logic.getSelectedWays();
   savedRelations = logic.getSelectedRelations();
   savedBug = logic.getSelectedBug();
   savedTileServerID = osmts.getId();
   savedOffsets = osmts.getOffsets();
   savedMinZoom = osmts.getMinZoomLevel();
   savedImageFileName = imageFileName;
   savedBox = box;
   savedLastComments = logic.getLastComments();
   savedLastSources = logic.getLastSources();
   savedTaskNotifications = Application.getTaskNotifications(context);
   savedOsmDataNotifications = Application.getOsmDataNotifications(context);
 }