gpt4 book ai didi

org.geoserver.wfs.WFSGetFeatureOutputFormat类的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 17:39:05 26 4
gpt4 key购买 nike

本文整理了Java中org.geoserver.wfs.WFSGetFeatureOutputFormat类的一些代码示例,展示了WFSGetFeatureOutputFormat类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WFSGetFeatureOutputFormat类的具体详情如下:
包路径:org.geoserver.wfs.WFSGetFeatureOutputFormat
类名称:WFSGetFeatureOutputFormat

WFSGetFeatureOutputFormat介绍

[英]Base class for a response to a WFS GetFeature operation.

The result of a GetFeature operation is an instance of FeatureCollectionResponse. Subclasses are responsible for serializing an instance of this type in #write(FeatureCollectionResponse,OutputStream,Operation).

Subclasses also need declare the mime-type in which the format is encoded.
[中]

代码示例

代码示例来源:origin: org.geoserver/gs-wfs

/**
 * Subclasses can delegate to this method if they want the full list of valid output format
 * element names to be returned in the WFS 1.0 capabilities
 */
protected List<String> getAllCapabilitiesElementNames() {
  List<String> result = new ArrayList<String>();
  for (String name : getOutputFormats()) {
    if (XML_ELEMENT.matcher(name).matches()) {
      result.add(name);
    }
  }
  // have the output order be independent of the used JDK
  Collections.sort(result);
  return result;
}

代码示例来源:origin: org.geoserver.extension/ogr

@Override
public boolean canHandle(Operation operation) {
  // we can't handle anything if the ogr2ogr configuration failed
  if(formats.size() == 0) {
    return false;
  } else {
    return super.canHandle(operation);
  }
}

代码示例来源:origin: org.geoserver/gs-wfs

/**
 * Returns the list of output format names generated by this format, for inclusion in the WFS
 * 1.0 capabilities document as XML element names
 */
public List<String> getCapabilitiesElementNames() {
  String name = getCapabilitiesElementName();
  if (name == null) {
    return Collections.emptyList();
  } else {
    return Arrays.asList(name);
  }
}

代码示例来源:origin: org.geoserver/gs-wfs

protected boolean getForcedDecimal(
    List featureCollections, GeoServer geoServer, Catalog catalog) {
  boolean forcedDecimal = false;
  for (int i = 0; i < featureCollections.size(); i++) {
    Boolean forced =
        getFeatureTypeInfoProperty(
            catalog,
            (FeatureCollection) featureCollections.get(i),
            fti -> fti.getForcedDecimal());
    if (Boolean.TRUE.equals(forced)) {
      forcedDecimal = true;
    }
  }
  return forcedDecimal;
}

代码示例来源:origin: org.geoserver/gs-wfs

/**
 * Capabilities output format string. Something that's a valid XML element name. This should be
 * overriden in each outputformat subclass, and if it's not a warning will be issued.
 */
public String getCapabilitiesElementName() {
  String of = getOutputFormat();
  if (of == null) {
    return null;
  }
  // wfs 1.1 form is not a valid xml element, do a check
  if (XML_ELEMENT.matcher(of).matches()) {
    return of;
  } else {
    LOGGER.severe(
        "ERROR IN "
            + this.getClass()
            + " IMPLEMENTATION.  getCapabilitiesElementName() should return a"
            + "valid XML element name string for use in the WFS 1.0.0 capabilities document.");
    String name = this.getClass().getName();
    if (name.indexOf('.') != -1) {
      name = name.substring(name.lastIndexOf('.') + 1);
    }
    return name;
  }
}

代码示例来源:origin: org.geoserver/gs-wfs

/**
 * Ensures that the operation being executed is a GetFeature operation.
 *
 * <p>Subclasses may implement
 */
public boolean canHandle(Operation operation) {
  // GetFeature operation?
  if ("GetFeature".equalsIgnoreCase(operation.getId())
      || "GetFeatureWithLock".equalsIgnoreCase(operation.getId())) {
    // also check that the resultType is "results"
    GetFeatureRequest req = GetFeatureRequest.adapt(operation.getParameters()[0]);
    if (req.isResultTypeResults()) {
      // call subclass hook
      return canHandleInternal(operation);
    }
  }
  return false;
}

代码示例来源:origin: org.geoserver/gs-wfs

for (Iterator i = featureProducers.iterator(); i.hasNext(); ) {
  WFSGetFeatureOutputFormat format = (WFSGetFeatureOutputFormat) i.next();
  for (String name : format.getCapabilitiesElementNames()) {
    if (!dupes.containsKey(name)) {
      element(name, null);

代码示例来源:origin: org.geoserver/gs-wfs

protected boolean getPadWithZeros(
    List featureCollections, GeoServer geoServer, Catalog catalog) {
  boolean padWithZeros = false;
  for (int i = 0; i < featureCollections.size(); i++) {
    Boolean pad =
        getFeatureTypeInfoProperty(
            catalog,
            (FeatureCollection) featureCollections.get(i),
            fti -> fti.getPadWithZeros());
    if (Boolean.TRUE.equals(pad)) {
      padWithZeros = true;
    }
  }
  return padWithZeros;
}

代码示例来源:origin: org.geoserver.community/gs-qos

@Override
  protected List<String> getOutputFormats() {
    List<WFSGetFeatureOutputFormat> formats =
        GeoServerExtensions.extensions(WFSGetFeatureOutputFormat.class);
    List<String> result = new ArrayList<>();
    for (WFSGetFeatureOutputFormat format : formats) {
      result.addAll(format.getOutputFormats());
    }
    return result;
  }
}

代码示例来源:origin: org.geoserver.extension/gs-ogr-wfs

@Override
public boolean canHandle(Operation operation) {
  // we can't handle anything if the ogr2ogr configuration failed
  if (formats.size() == 0) {
    return false;
  } else {
    return super.canHandle(operation);
  }
}

代码示例来源:origin: org.geoserver/gs-wfs

@Test
public void testOutputFormats() throws Exception {
  Document doc = getAsDOM("wfs?service=WFS&request=getCapabilities&version=1.0.0");
  Element outputFormats = getFirstElementByTagName(doc, "ResultFormat");
  NodeList formats = outputFormats.getChildNodes();
  TreeSet s1 = new TreeSet();
  for (int i = 0; i < formats.getLength(); i++) {
    String format = formats.item(i).getNodeName();
    s1.add(format);
  }
  List extensions = GeoServerExtensions.extensions(WFSGetFeatureOutputFormat.class);
  TreeSet s2 = new TreeSet();
  for (Iterator e = extensions.iterator(); e.hasNext(); ) {
    WFSGetFeatureOutputFormat extension = (WFSGetFeatureOutputFormat) e.next();
    s2.add(extension.getCapabilitiesElementName());
  }
  assertEquals(s1, s2);
}

代码示例来源:origin: org.geoserver/gs-wfs

/**
 * Helper method that checks if coordinates measured values should be encoded for the provided
 * feature collections. By default coordinates measures are not encoded.
 *
 * @param featureCollections features collections
 * @param catalog GeoServer catalog
 * @return TRUE if coordinates measures should be encoded, otherwise FALSE
 */
protected boolean encodeMeasures(List featureCollections, Catalog catalog) {
  boolean encodeMeasures = true;
  for (int i = 0; i < featureCollections.size(); i++) {
    Boolean measures =
        getFeatureTypeInfoProperty(
            catalog,
            (FeatureCollection) featureCollections.get(i),
            fti -> fti.getEncodeMeasures());
    if (Boolean.FALSE.equals(measures)) {
      // no measures should be encoded
      encodeMeasures = false;
    }
  }
  return encodeMeasures;
}

代码示例来源:origin: org.geoserver/gs-wfs

protected String[] getAvailableOutputFormatNames(String first) {
  List<String> oflist = new ArrayList<String>();
  Collection featureProducers =
      GeoServerExtensions.extensions(WFSGetFeatureOutputFormat.class);
  for (Iterator i = featureProducers.iterator(); i.hasNext(); ) {
    WFSGetFeatureOutputFormat format = (WFSGetFeatureOutputFormat) i.next();
    for (Iterator f = format.getOutputFormats().iterator(); f.hasNext(); ) {
      oflist.add(f.next().toString());
    }
  }
  Collections.sort(oflist);
  if (oflist.contains(first)) {
    oflist.remove(first);
    oflist.add(0, first);
  }
  return (String[]) oflist.toArray(new String[oflist.size()]);
}

代码示例来源:origin: org.geoserver/xslt

@Override
public boolean canHandle(Operation operation) {
  // if we don't have formats configured, we cannot respond
  if(formats.isEmpty()) {
    System.out.println("Empty formats");
    return false;
  }
  
  if(!super.canHandle(operation)) {
    return false;
  }
  
  // check the format matches, the Dispatcher just does a case insensitive match,
  // but WFS is supposed to be case sensitive and so is the XSLT code
  Request request = Dispatcher.REQUEST.get();
  if(request != null && (request.getOutputFormat() == null || !formats.containsKey(request.getOutputFormat()))) {
    System.out.println("Formats are: " + formats);
    return false;
  } else {
    return true;
  }
}

代码示例来源:origin: org.geoserver/gs-wfs

protected int getNumDecimals(List featureCollections, GeoServer geoServer, Catalog catalog) {
  int numDecimals = -1;
  for (int i = 0; i < featureCollections.size(); i++) {
    Integer ftiDecimals =
        getFeatureTypeInfoProperty(
            catalog,
            (FeatureCollection) featureCollections.get(i),
            fti -> fti.getNumDecimals());
    // track num decimals, in cases where the query has multiple types we choose the max
    // of all the values (same deal as above, might not be a vector due to GetFeatureInfo
    // reusing this)
    if (ftiDecimals != null && ftiDecimals > 0) {
      numDecimals = numDecimals == -1 ? ftiDecimals : Math.max(numDecimals, ftiDecimals);
    }
  }
  SettingsInfo settings = geoServer.getSettings();
  if (numDecimals == -1) {
    numDecimals = settings.getNumDecimals();
  }
  return numDecimals;
}

代码示例来源:origin: org.geoserver.web/gs-web-demo

private List<String> getAvailableWFSFormats() {
  List<String> formats = new ArrayList<String>();
  final GeoServerApplication application = getGeoServerApplication();
  for (WFSGetFeatureOutputFormat producer :
      application.getBeansOfType(WFSGetFeatureOutputFormat.class)) {
    for (String format : producer.getOutputFormats()) {
      formats.add(format);
    }
  }
  prepareFormatList(formats, new FormatComparator("format.wfs."));
  return formats;
}

代码示例来源:origin: org.geoserver/gs-wfs

@Test
public void testOutputFormats() throws Exception {
  Document doc = getAsDOM("wfs?service=WFS&request=getCapabilities&version=2.0.0");
  // print(doc);
  // let's look for the outputFormat parameter values inside of the GetFeature operation
  // metadata
  XpathEngine engine = XMLUnit.newXpathEngine();
  NodeList formats =
      engine.getMatchingNodes(
          "//ows:Operation[@name=\"GetFeature\"]/ows:Parameter[@name=\"outputFormat\"]/ows:AllowedValues/ows:Value",
          doc);
  Set<String> s1 = new TreeSet<String>();
  for (int i = 0; i < formats.getLength(); i++) {
    String format = formats.item(i).getFirstChild().getNodeValue();
    s1.add(format);
  }
  List<WFSGetFeatureOutputFormat> extensions =
      GeoServerExtensions.extensions(WFSGetFeatureOutputFormat.class);
  Set<String> s2 = new TreeSet<String>();
  for (Iterator e = extensions.iterator(); e.hasNext(); ) {
    WFSGetFeatureOutputFormat extension = (WFSGetFeatureOutputFormat) e.next();
    s2.addAll(extension.getOutputFormats());
  }
  assertEquals(s1, s2);
}

代码示例来源:origin: org.geoserver/gs-wfs

@Test
public void testOutputFormats() throws Exception {
  Document doc = getAsDOM("wfs?service=WFS&request=getCapabilities&version=1.1.0");
  // print(doc);
  // let's look for the outputFormat parameter values inside of the GetFeature operation
  // metadata
  XpathEngine engine = XMLUnit.newXpathEngine();
  NodeList formats =
      engine.getMatchingNodes(
          "//ows:Operation[@name=\"GetFeature\"]/ows:Parameter[@name=\"outputFormat\"]/ows:Value",
          doc);
  Set<String> s1 = new TreeSet<String>();
  for (int i = 0; i < formats.getLength(); i++) {
    String format = formats.item(i).getFirstChild().getNodeValue();
    s1.add(format);
  }
  List<WFSGetFeatureOutputFormat> extensions =
      GeoServerExtensions.extensions(WFSGetFeatureOutputFormat.class);
  Set<String> s2 = new TreeSet<String>();
  for (Iterator e = extensions.iterator(); e.hasNext(); ) {
    WFSGetFeatureOutputFormat extension = (WFSGetFeatureOutputFormat) e.next();
    s2.addAll(extension.getOutputFormats());
  }
  assertEquals(s1, s2);
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com