Пример #1
0
  /**
   * Finds texture data.
   *
   * @return texture data
   */
  private TextureData getTexture() {

    String highway = way.get("highway");
    if (highway == null) {
      highway = "unknown";
    }

    String surface = way.get("surface");
    if (surface == null) {
      surface = "unknown";
    }

    String file = null;

    String highwayTexture =
        metadataCacheService.getPropertites("roads.highway_" + highway + ".texture.file", null);
    Double highwayTextureLenght =
        metadataCacheService.getPropertitesDouble(
            "roads.highway_" + highway + ".texture.lenght", 1d);
    String surfaceTexture =
        metadataCacheService.getPropertites("roads.surface_" + surface + ".texture.file", null);
    Double surfaceTextureLenght =
        metadataCacheService.getPropertitesDouble(
            "roads.surface_" + surface + ".texture.lenght", 1d);

    double lenght = 1;
    // finds known texture
    if (!"unknown".equals(surface) && surfaceTexture != null) {
      file = surfaceTexture;
      lenght = surfaceTextureLenght;
    } else if (!"unknown".equals(highway) && highwayTexture != null) {
      file = highwayTexture;
      lenght = highwayTextureLenght;
    }

    if (file == null) {
      // finds unknown texture
      if (surfaceTexture != null) {
        file = surfaceTexture;
        lenght = surfaceTextureLenght;
      } else if (highwayTexture != null) {
        file = highwayTexture;
        lenght = highwayTextureLenght;
      }
    }

    return new TextureData(file, lenght);
  }
Пример #2
0
  /**
   * Finds road width.
   *
   * @return road width
   */
  private double getRoadWidth() {

    String highway = way.get("highway");
    if (highway == null) {
      highway = "unknown";
    }

    String widthStr = way.get("width");
    if (widthStr != null) {
      try {
        return Long.parseLong(widthStr);
      } catch (Exception e) {
        log.error(e, e);
      }
    }

    Double paramWidth =
        metadataCacheService.getPropertitesDouble(
            "roads.highway_" + highway + ".width", DEFAULT_ROAD_WIDTH);

    return paramWidth;
  }