Example #1
0
  /**
   * If this layers has been setup to reproject data, skipReproject = true will disable
   * reprojection. This method is build especially for the rendering subsystem that should be able
   * to perform a full reprojection on its own, and do generalization before reprojection (thus
   * avoid to reproject all of the original coordinates)
   */
  public FeatureSource<? extends FeatureType, ? extends Feature> getFeatureSource(
      boolean skipReproject) throws IOException {
    if (type != TYPE_VECTOR) {
      throw new IllegalArgumentException("Layer type is not vector");
    }

    // ask for enabled() instead of isEnabled() to account for disabled resource/store
    if (!layerInfo.enabled()) {
      throw new IOException(
          "featureType: " + getName() + " does not have a properly configured " + "datastore");
    }

    FeatureTypeInfo resource = (FeatureTypeInfo) layerInfo.getResource();

    if (resource.getStore() == null || resource.getStore().getDataStore(null) == null) {
      throw new IOException(
          "featureType: " + getName() + " does not have a properly configured " + "datastore");
    }

    Hints hints = new Hints(ResourcePool.REPROJECT, Boolean.valueOf(!skipReproject));

    return resource.getFeatureSource(null, hints);
  }
 @Override
 public boolean canHandle(Object obj) {
   boolean canHandle = false;
   if (obj instanceof FeatureTypeInfo) {
     FeatureTypeInfo fti = (FeatureTypeInfo) obj;
     for (String st : getSupportedTypes()) {
       if (fti.getStore().getType().equals(st)) {
         canHandle = true;
         break;
       }
     }
   }
   return canHandle;
 }