Ejemplo n.º 1
0
  protected void handleAddRoute(HashMap routeMap) {
    Object routeArray = routeMap.get("points");
    if (routeArray instanceof Object[]) {
      Object[] routes = (Object[]) routeArray;
      MapPoint[] pointsType = new MapPoint[routes.length];
      for (int i = 0; i < routes.length; i++) {

        if (routes[i] instanceof HashMap) {
          HashMap tempRoute = (HashMap) routes[i];
          MapPoint mp =
              new MapPoint(
                  TiConvert.toDouble(tempRoute, "latitude"),
                  TiConvert.toDouble(tempRoute, "longitude"));
          pointsType[i] = mp;
        }
      }

      MapRoute mr =
          new MapRoute(
              pointsType,
              TiConvert.toColor(routeMap, "color"),
              TiConvert.toInt(routeMap, "width"),
              TiConvert.toString(routeMap, "name"));

      if (mapView == null) {
        this.routes.add(mr);
      } else {
        mapView.addRoute(mr);
      }
    }
  }
Ejemplo n.º 2
0
  private double getMax() {
    Object value = proxy.getProperty("max");
    if (value == null) {
      return 0;
    }

    return TiConvert.toDouble(value);
  }
Ejemplo n.º 3
0
  private double getValue() {
    Object value = proxy.getProperty(TiC.PROPERTY_VALUE);
    if (value == null) {
      return 0;
    }

    return TiConvert.toDouble(value);
  }
Ejemplo n.º 4
0
  public Double optDouble(String key, Double defaultValue) {
    Double result = defaultValue;

    if (containsKey(key)) {
      result = TiConvert.toDouble(get(key), defaultValue);
    }
    return result;
  }
Ejemplo n.º 5
0
  public double getDuration() {
    if (proxy.getDynamicValue("duration") != null) {
      return TiConvert.toDouble(proxy.getDynamicValue("duration"));
    }

    if (images != null) {
      return images.length * 33;
    }
    return 100;
  }
Ejemplo n.º 6
0
  public double getDuration() {
    if (proxy.getProperty(TiC.PROPERTY_DURATION) != null) {
      double duration = TiConvert.toDouble(proxy.getProperty(TiC.PROPERTY_DURATION));
      if (duration < MIN_DURATION) {
        return MIN_DURATION;
      } else {
        return duration;
      }
    }
    proxy.setProperty(TiC.PROPERTY_DURATION, DEFAULT_DURATION);

    return DEFAULT_DURATION;
  }
  public double getDuration() {
    if (proxy.getProperty(TiC.PROPERTY_DURATION) != null) {
      double duration = TiConvert.toDouble(proxy.getProperty(TiC.PROPERTY_DURATION));
      if (duration < MIN_DURATION) {
        return MIN_DURATION;
      } else {
        return duration;
      }
    }

    if (images != null) {
      return images.length * 33;
    }
    return 100;
  }
Ejemplo n.º 8
0
 public Double getDouble(String key) {
   return TiConvert.toDouble(get(key));
 }