/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.28
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.gdal.ogr;

import org.gdal.osr.SpatialReference;

public class Layer {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  protected Layer(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(Layer obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  public void delete() {
    if(swigCPtr != 0 && swigCMemOwn) {
      swigCMemOwn = false;
      throw new UnsupportedOperationException("C++ destructor does not have public access");
    }
    swigCPtr = 0;
  }

  protected static long getCPtrAndDisown(Layer obj) {
    if (obj != null) obj.swigCMemOwn= false;
    return getCPtr(obj);
  }

  public int GetRefCount() {
    return ogrJNI.Layer_GetRefCount(swigCPtr);
  }

  public void SetSpatialFilter(Geometry filter) {
    ogrJNI.Layer_SetSpatialFilter(swigCPtr, Geometry.getCPtr(filter));
  }

  public void SetSpatialFilterRect(double minx, double miny, double maxx, double maxy) {
    ogrJNI.Layer_SetSpatialFilterRect(swigCPtr, minx, miny, maxx, maxy);
  }

  public Geometry GetSpatialFilter() {
    long cPtr = ogrJNI.Layer_GetSpatialFilter(swigCPtr);
    return (cPtr == 0) ? null : new Geometry(cPtr, false);
  }

  public int SetAttributeFilter(String filter_string) {
    return ogrJNI.Layer_SetAttributeFilter(swigCPtr, filter_string);
  }

  public void ResetReading() {
    ogrJNI.Layer_ResetReading(swigCPtr);
  }

  public String GetName() {
    return ogrJNI.Layer_GetName(swigCPtr);
  }

  public Feature GetFeature(int fid) {
    long cPtr = ogrJNI.Layer_GetFeature(swigCPtr, fid);
    return (cPtr == 0) ? null : new Feature(cPtr, true);
  }

  public Feature GetNextFeature() {
    long cPtr = ogrJNI.Layer_GetNextFeature(swigCPtr);
    return (cPtr == 0) ? null : new Feature(cPtr, true);
  }

  public int SetNextByIndex(int new_index) {
    return ogrJNI.Layer_SetNextByIndex(swigCPtr, new_index);
  }

  public int SetFeature(Feature feature) {
    return ogrJNI.Layer_SetFeature(swigCPtr, Feature.getCPtr(feature));
  }

  public int CreateFeature(Feature feature) {
    return ogrJNI.Layer_CreateFeature(swigCPtr, Feature.getCPtr(feature));
  }

  public int DeleteFeature(int fid) {
    return ogrJNI.Layer_DeleteFeature(swigCPtr, fid);
  }

  public int SyncToDisk() {
    return ogrJNI.Layer_SyncToDisk(swigCPtr);
  }

  public FeatureDefn GetLayerDefn() {
    long cPtr = ogrJNI.Layer_GetLayerDefn(swigCPtr);
    return (cPtr == 0) ? null : new FeatureDefn(cPtr, false);
  }

  public int GetFeatureCount(int force) {
    return ogrJNI.Layer_GetFeatureCount(swigCPtr, force);
  }

  public int GetExtent(double[] argout, int force) {
    return ogrJNI.Layer_GetExtent(swigCPtr, argout, force);
  }

  public boolean TestCapability(String cap) {
    return ogrJNI.Layer_TestCapability(swigCPtr, cap);
  }

  public int CreateField(FieldDefn field_def, int approx_ok) {
    return ogrJNI.Layer_CreateField(swigCPtr, FieldDefn.getCPtr(field_def), approx_ok);
  }

  public int StartTransaction() {
    return ogrJNI.Layer_StartTransaction(swigCPtr);
  }

  public int CommitTransaction() {
    return ogrJNI.Layer_CommitTransaction(swigCPtr);
  }

  public int RollbackTransaction() {
    return ogrJNI.Layer_RollbackTransaction(swigCPtr);
  }

  public SpatialReference GetSpatialRef() {
    long cPtr = ogrJNI.Layer_GetSpatialRef(swigCPtr);
    return (cPtr == 0) ? null : new SpatialReference(cPtr, false);
  }

  public SWIGTYPE_p_GIntBig GetFeatureRead() {
    return new SWIGTYPE_p_GIntBig(ogrJNI.Layer_GetFeatureRead(swigCPtr), true);
  }

}
