コード例 #1
0
 Wgs84Position getPosition(int index) {
   Double x, y;
   String indexKey = getPositionCount() > 1 ? Integer.toString(index) : "";
   String xValue = Transfer.trim(get(X_POSITION + indexKey));
   String yValue = Transfer.trim(get(Y_POSITION + indexKey));
   String comment = getPositionCount() == 1 ? Transfer.trim(getText()) : null;
   // for the strange format of EasyGPS
   if (yValue == null && xValue != null) {
     Matcher matcher = EASY_GPS_PATTERN.matcher(xValue);
     if (matcher.matches()) {
       xValue = Transfer.trim(matcher.group(1));
       yValue = Transfer.trim(matcher.group(2));
     }
   }
   x = Transfer.parseDouble(xValue);
   y = Transfer.parseDouble(yValue);
   return new Wgs84Position(x, y, null, null, null, comment);
 }
コード例 #2
0
  protected int getBoundsZoomLevel(List<BaseNavigationPosition> positions) {
    if ((positions == null) || (positions.size() < 1)) return 0;

    Wgs84Position northEast = Positions.northEast(positions);
    Wgs84Position southWest = Positions.southWest(positions);

    StringBuffer buffer = new StringBuffer();
    buffer
        .append("return map.getBoundsZoomLevel(new GLatLngBounds(")
        .append("new GLatLng(")
        .append(northEast.getLatitude())
        .append(",")
        .append(northEast.getLongitude())
        .append("),")
        .append("new GLatLng(")
        .append(southWest.getLatitude())
        .append(",")
        .append(southWest.getLongitude())
        .append(")")
        .append("));");

    String zoomLevel = executeScriptWithResult(buffer.toString());
    return zoomLevel != null ? Transfer.parseDouble(zoomLevel).intValue() : 1;
  }
コード例 #3
0
 protected int getCurrentZoomLevel() {
   String zoomLevel = executeScriptWithResult("return map.getZoom();");
   return zoomLevel != null ? Transfer.parseDouble(zoomLevel).intValue() : 1;
 }