Example #1
0
  /**
   * Gets the current point object.
   *
   * @return
   * @throws NumberFormatException
   */
  protected MapPoint getCurrentPoint() throws NumberFormatException {
    EditText xInput = (EditText) findViewById(R.id.xText);
    EditText yInput = (EditText) findViewById(R.id.yText);

    // Gets the map coordinate.
    try {
      float x = Float.parseFloat(xInput.getText().toString());
      float y = Float.parseFloat(yInput.getText().toString());

      return map.getPoint(x, y);
    } catch (Exception e) {
      throw e;
    }
  }
Example #2
0
  /** Load initial chart data from map object. */
  public void loadChartData() {
    // Clear data table.
    TableLayout table = (TableLayout) findViewById(R.id.dataTable);
    table.removeViews(1, table.getChildCount() - 1);

    // Show data from all map points.
    if (getChartScope() == R.id.allPoints) {
      for (MapPoint p : map.getPoints()) addToGraph(p);
    }

    // Show data from the current point only
    // (the tapped point or the point informed in X,Y text fields).
    else {
      addToGraph(getCurrentPoint());
    }

    refreshCharts();
  }