コード例 #1
0
 protected String asDesc(String comment, String description) {
   if (comment != null) {
     int index = comment.indexOf(';');
     if (index != -1) {
       description = comment.substring(index);
       if (description.startsWith("; ")) description = description.substring(2);
     } else return null;
   }
   return Transfer.trim(description);
 }
コード例 #2
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);
 }
コード例 #3
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;
  }
コード例 #4
0
 private static String parseForNmn5(String string) {
   String result = Transfer.trim(string);
   if (result != null && "-".equals(result)) result = null;
   if (result != null && result.length() > 2) result = toMixedCase(result);
   return result;
 }
コード例 #5
0
 private static String formatComment(String string) {
   return string != null ? Transfer.escape(string, SEPARATOR, ';') : "-";
 }
コード例 #6
0
 protected int getCurrentZoomLevel() {
   String zoomLevel = executeScriptWithResult("return map.getZoom();");
   return zoomLevel != null ? Transfer.parseDouble(zoomLevel).intValue() : 1;
 }
コード例 #7
0
 protected String asName(String comment) {
   if (comment == null) return null;
   int index = comment.indexOf(';');
   if (index != -1) comment = comment.substring(0, index);
   return Transfer.trim(comment);
 }