コード例 #1
0
  @Override
  public void type(
      Resource type,
      List<Pair<Resource, XSDDatatype>> simpleProperties,
      List<Pair<Resource, Object>> linkProperties,
      List<Pair<Resource, String>> geometryProperties)
      throws IOException {
    requestResponse.setFeatureIri(type);

    log.debug("[fe] registering (generic) output type for " + type);

    /*
     * List<String> layerSelectedProperties = layer
     * .getSelectedFeatureParams(session.getLanguage());
     */
    selectedProperties.add(0, "__fid");
    log.debug("- Property:" + "__fid" + " as 0");
    for (Pair<Resource, XSDDatatype> prop : simpleProperties) {

      log.debug("- Property:" + prop.getKey() + " as " + selectedProperties.size());
      selectedPropertiesIndex.put(prop.getKey(), selectedProperties.size());
      selectedProperties.add(prop.getKey().getLocalPart());
    }
    selectedProperties.add("__centerX");
    log.debug("- Property:" + "__centerX" + " as " + selectedProperties.size());
    selectedProperties.add("__centerY");
    log.debug("- Property:" + "__centerY" + " as " + selectedProperties.size());
  }
コード例 #2
0
  public void vertex(
      Resource iri,
      Resource type,
      List<Pair<Resource, Object>> simpleProperties,
      List<Pair<Resource, Object>> linkProperties,
      List<Pair<Resource, Geometry>> geometryProperties)
      throws IOException {

    SimpleFeatureBuilder sfb = getAndSetFeatureBuilder(type);
    List<SimpleFeature> sfc = getAndSetListSimpleFeature(type);

    for (Pair<Resource, Geometry> geomPair : geometryProperties) {
      Geometry geom = geomPair.getValue();

      try {
        geom = JTS.transform(geom, transform);
      } catch (MismatchedDimensionException e) {

        throw new IOException(e);
      } catch (TransformException e) {

        throw new IOException(e);
      }

      sfb.add(geom);

      SimpleFeature f = sfb.buildFeature(iri.toString());

      sfc.add(f);
    }

    if (!(type.getNs().equals(requestResponse.getFeatureIri().getNs())
        && type.getLocalPart().equals(requestResponse.getFeatureIri().getLocalPart()))) {
      log.debug(
          "[fe] type mismatch for Transport regd "
              + requestResponse.getFeatureIri()
              + " vs added "
              + type
              + " -> properties discarded");
      return;
    }

    if (selectedProperties != null && selectedProperties.size() > 0) {
      ArrayList<Object> props = new ArrayList<Object>(selectedProperties.size());
      for (String field : selectedProperties) {
        props.add(null);
      }
      props.set(0, iri.toString());
      for (Pair<Resource, ?> pair : simpleProperties) {
        Integer keyIndex = selectedPropertiesIndex.get(pair.getKey());
        if (keyIndex == null) {
          /*
           * log.debug("KEY INDEX FOR " + pair.getKey() +
           * " not found");
           */
          continue;
        }
        props.set(keyIndex, pair.getValue());
      }

      list.add(props);
    }
  }