コード例 #1
0
  /**
   * @param index
   * @param featureType
   * @return
   * @throws ReadException
   */
  protected FeatureProvider getFeatureProviderByIndex(long index, FeatureType featureType)
      throws DataException {
    this.open();
    this.resourcesBegin();
    try {

      FeatureProvider featureProvider = super.getFeatureProviderByIndex(index, featureType);
      featureProvider.setDefaultEnvelope(this.shpFile.getBoundingBox(index));
      return featureProvider;
    } catch (DataException e) {
      throw e;
    } catch (CreateEnvelopeException e) {
      throw new org.gvsig.fmap.dal.feature.exception.CreateGeometryException(e);
    } finally {
      this.resourcesEnd();
    }
  }
コード例 #2
0
  /**
   * @param featureProvider
   * @throws DataException
   */
  protected void loadFeatureProviderByIndex(FeatureProvider featureProvider) throws DataException {
    this.open();
    this.resourcesBegin();
    try {
      long index = ((Long) featureProvider.getOID()).longValue();
      super.loadFeatureProviderByIndex(featureProvider);
      if (featureProvider
              .getType()
              .getIndex(featureProvider.getType().getDefaultGeometryAttributeName())
          >= 0) {
        try {
          featureProvider.setDefaultGeometry(this.shpFile.getGeometry(index));
        } catch (CreateGeometryException e) {
          throw new ReadException(getName(), e);
        }
      }

    } finally {
      this.resourcesEnd();
    }
  }