コード例 #1
0
    public TempFile(File tempFile, PJsonObject jsonSpec, OutputFormat format) {
      super(tempFile.getAbsolutePath());
      creationTime = System.currentTimeMillis();
      this.outputFileName = jsonSpec.optString(Constants.OUTPUT_FILENAME_KEY);
      this.printedLayoutName = jsonSpec.optString(Constants.JSON_LAYOUT_KEY, null);

      this.suffix = format.getFileSuffix();
      this.contentType = format.getContentType();
    }
コード例 #2
0
ファイル: VectorMapReader.java プロジェクト: pmauduit/GeoBI
  public VectorMapReader(RenderingContext context, PJsonObject params) {
    super(params);
    this.context = context;

    final PJsonObject geoJson = params.getJSONObject("geoJson");
    final String styleProperty = params.optString("styleProperty", "_style");
    final PJsonObject styles = params.optJSONObject("styles");
    try {
      final MfGeoJSONReader reader =
          new MfGeoJSONReader(new StyledMfGeoFactory(styles, styleProperty));
      //noinspection deprecation
      geo = reader.decode(geoJson.getInternalObj());
    } catch (JSONException e) {
      throw new InvalidJsonValueException(params, "geoJson", geoJson.toString(), e);
    }
    name = params.optString("name", "vector");
  }
コード例 #3
0
  private WMTSMapReader(String layer, RenderingContext context, PJsonObject params) {
    super(context, params);
    this.layer = layer;
    this.capabilitiesInfo = WMTSServiceInfo.getLayerInfo(baseUrl, layer, context);
    // Optional (but mandatory if matrixIds is not provided)
    PJsonArray maxExtent = params.optJSONArray(TILE_FULL_EXTENT, params.optJSONArray(MAX_EXTENT));
    // Optional (but mandatory if matrixIds is not provided)
    PJsonArray tileSize = params.optJSONArray(TILE_SIZE);
    opacity = params.optFloat(OPACITY, 1.0F);
    version = params.optString(VERSION, "1.0.0");
    requestEncoding =
        WMTSRequestEncoding.valueOf(
            params.optString(REQUEST_ENCODING, WMTSRequestEncoding.REST.name()));

    // Optional (but mandatory if matrixIds is not provided)
    tileOrigin = params.optJSONArray(TILE_ORIGIN);
    style = params.optString(STYLE, "");
    // Optional
    dimensions = params.optJSONArray(DIMENSIONS);
    // Optional
    dimensionsParams = params.optJSONObject(PARAMS);
    matrixSet = params.getString(MATRIX_SET);
    // Optional (but mandatory if matrixIds is not provided)
    zoomOffset = params.optInt(ZOOM_OFFSET);
    // Optional
    matrixIds = params.optJSONArray(MATRIX_IDS);
    // Optional (but mandatory if matrixIds is not provided)
    formatSuffix = params.optString(FORMAT_SUFFIX, params.optString(EXTENSION));

    // Optional (but mandatory if matrixIds is provided and requestEncoding is KVP)
    format = params.optString(FORMAT);

    if (tileOrigin == null && matrixIds == null) {
      throw new IllegalArgumentException(
          "Either " + TILE_ORIGIN + " or " + MATRIX_IDS + " is required.");
    }
    if (zoomOffset == null && matrixIds == null) {
      throw new IllegalArgumentException(
          "Either " + ZOOM_OFFSET + " or " + MATRIX_IDS + " is required.");
    }
    if (formatSuffix == null && matrixIds == null) {
      throw new IllegalArgumentException(
          "Either " + EXTENSION + " (or " + FORMAT_SUFFIX + ") or " + MATRIX_IDS + " is required.");
    }
    if (matrixIds == null) {
      tileCacheLayerInfo =
          new WMTSLayerInfo(
              params.getJSONArray(RESOLUTIONS),
              tileSize.getInt(0),
              tileSize.getInt(1),
              maxExtent.getFloat(0),
              maxExtent.getFloat(1),
              maxExtent.getFloat(2),
              maxExtent.getFloat(3),
              formatSuffix);
    }
  }