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


using System;
using System.Runtime.InteropServices;

public class Layer : IDisposable {
  private HandleRef swigCPtr;
  protected bool swigCMemOwn;

  internal Layer(IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(Layer obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  public virtual void Dispose() {
    if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
      swigCMemOwn = false;
      throw new MethodAccessException("C++ destructor does not have public access");
    }
    swigCPtr = new HandleRef(null, IntPtr.Zero);
    GC.SuppressFinalize(this);
  }

  public int Reference() {
    int ret = ogrPINVOKE.Layer_Reference(swigCPtr);
    return ret;
  }

  public int Dereference() {
    int ret = ogrPINVOKE.Layer_Dereference(swigCPtr);
    return ret;
  }

  public int GetRefCount() {
    int ret = ogrPINVOKE.Layer_GetRefCount(swigCPtr);
    return ret;
  }

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

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

  public Geometry GetSpatialFilter() {
    IntPtr cPtr = ogrPINVOKE.Layer_GetSpatialFilter(swigCPtr);
    Geometry ret = (cPtr == IntPtr.Zero) ? null : new Geometry(cPtr, true);
    return ret;
  }

  public int SetAttributeFilter(string filter_string) {
    int ret = ogrPINVOKE.Layer_SetAttributeFilter(swigCPtr, filter_string);
    return ret;
  }

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

  public string GetName() {
    string ret = ogrPINVOKE.Layer_GetName(swigCPtr);
    return ret;
  }

  public Feature GetFeature(int fid) {
    IntPtr cPtr = ogrPINVOKE.Layer_GetFeature(swigCPtr, fid);
    Feature ret = (cPtr == IntPtr.Zero) ? null : new Feature(cPtr, false);
    return ret;
  }

  public Feature GetNextFeature() {
    IntPtr cPtr = ogrPINVOKE.Layer_GetNextFeature(swigCPtr);
    Feature ret = (cPtr == IntPtr.Zero) ? null : new Feature(cPtr, false);
    return ret;
  }

  public int SetNextByIndex(int new_index) {
    int ret = ogrPINVOKE.Layer_SetNextByIndex(swigCPtr, new_index);
    return ret;
  }

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

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

  public int DeleteFeature(int fid) {
    int ret = ogrPINVOKE.Layer_DeleteFeature(swigCPtr, fid);
    return ret;
  }

  public int SyncToDisk() {
    int ret = ogrPINVOKE.Layer_SyncToDisk(swigCPtr);
    return ret;
  }

  public FeatureDefn GetLayerDefn() {
    IntPtr cPtr = ogrPINVOKE.Layer_GetLayerDefn(swigCPtr);
    FeatureDefn ret = (cPtr == IntPtr.Zero) ? null : new FeatureDefn(cPtr, false);
    return ret;
  }

  public int GetFeatureCount(int force) {
    int ret = ogrPINVOKE.Layer_GetFeatureCount(swigCPtr, force);
    return ret;
  }

  public void GetExtent(int force) {
    ogrPINVOKE.Layer_GetExtent(swigCPtr, force);
  }

  public int TestCapability(string cap) {
    int ret = ogrPINVOKE.Layer_TestCapability(swigCPtr, cap);
    return ret;
  }

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

  public int StartTransaction() {
    int ret = ogrPINVOKE.Layer_StartTransaction(swigCPtr);
    return ret;
  }

  public int CommitTransaction() {
    int ret = ogrPINVOKE.Layer_CommitTransaction(swigCPtr);
    return ret;
  }

  public int RollbackTransaction() {
    int ret = ogrPINVOKE.Layer_RollbackTransaction(swigCPtr);
    return ret;
  }

  public SWIGTYPE_p_OSRSpatialReferenceShadow GetSpatialRef() {
    IntPtr cPtr = ogrPINVOKE.Layer_GetSpatialRef(swigCPtr);
    SWIGTYPE_p_OSRSpatialReferenceShadow ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_OSRSpatialReferenceShadow(cPtr, false);
    return ret;
  }

  public SWIGTYPE_p_GIntBig GetFeatureRead() {
    SWIGTYPE_p_GIntBig ret = new SWIGTYPE_p_GIntBig(ogrPINVOKE.Layer_GetFeatureRead(swigCPtr), true);
    return ret;
  }

}