コード例 #1
0
ファイル: GCP.cs プロジェクト: diegowald/intellitrack
 public static HandleRef getCPtrAndSetReference(GCP obj, object parent) {
   if (obj != null)
   {
     obj.swigParentRef = parent;
     return obj.swigCPtr;
   }
   else
   {
     return new HandleRef(null, IntPtr.Zero);
   }
 }
コード例 #2
0
        internal static GCP __ReadCArrayItem_GDAL_GCP(IntPtr carray, int index)
        {
            IntPtr cPtr = GdalPINVOKE.__ReadCArrayItem_GDAL_GCP(carray, index);
            GCP    ret  = (cPtr == IntPtr.Zero) ? null : new GCP(cPtr, false, ThisOwn_false());

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #3
0
ファイル: GCP.cs プロジェクト: VisualAwarenessTech/gdal-2.2.1
 public static HandleRef getCPtrAndSetReference(GCP obj, object parent)
 {
     if (obj != null)
     {
         obj.swigParentRef = parent;
         return(obj.swigCPtr);
     }
     else
     {
         return(new HandleRef(null, IntPtr.Zero));
     }
 }
コード例 #4
0
ファイル: GCP.cs プロジェクト: diegowald/intellitrack
 public static HandleRef getCPtrAndDisown(GCP obj, object parent) {
   if (obj != null)
   {
     obj.swigCMemOwn = false;
     obj.swigParentRef = parent;
     return obj.swigCPtr;
   }
   else
   {
     return new HandleRef(null, IntPtr.Zero);
   }
 }
コード例 #5
0
ファイル: GCP.cs プロジェクト: VisualAwarenessTech/gdal-2.2.1
 public static HandleRef getCPtrAndDisown(GCP obj, object parent)
 {
     if (obj != null)
     {
         obj.swigCMemOwn   = false;
         obj.swigParentRef = parent;
         return(obj.swigCPtr);
     }
     else
     {
         return(new HandleRef(null, IntPtr.Zero));
     }
 }
コード例 #6
0
ファイル: Dataset.cs プロジェクト: MattLatt/GDAL_2.0.x_VC
        public GCP[] GetGCPs()
        {
            /*hello*/
            IntPtr cPtr   = __GetGCPs();
            int    length = GetGCPCount();

            GCP[] ret = null;
            if (cPtr != IntPtr.Zero && length > 0)
            {
                ret = new GCP[length];
                for (int i = 0; i < length; i++)
                {
                    ret[i] = __ReadCArrayItem_GDAL_GCP(cPtr, i);
                }
            }
            GC.KeepAlive(this);
            return(ret);
        }
コード例 #7
0
ファイル: Gdal.cs プロジェクト: diegowald/intellitrack
 public static int GCPsToGeoTransform(GCP[] pGCPs, double[] argout, int bApproxOK) {
   int ret = 0;
   if (pGCPs != null && pGCPs.Length > 0)
    {
        IntPtr cPtr = __AllocCArray_GDAL_GCP(pGCPs.Length);
        if (cPtr == IntPtr.Zero)
           throw new ApplicationException("Error allocating CArray with __AllocCArray_GDAL_GCP");
           
        try {   
            for (int i=0; i < pGCPs.Length; i++)
               __WriteCArrayItem_GDAL_GCP(cPtr, i, pGCPs[i]);
            
            ret = GCPsToGeoTransform(pGCPs.Length, cPtr, argout, bApproxOK);
        }
        finally
        {
           __FreeCArray_GDAL_GCP(cPtr);
        }
    }
    return ret;
  }
コード例 #8
0
ファイル: Gdal.cs プロジェクト: wangfeilong321/vdpm
 internal static void __WriteCArrayItem_GDAL_GCP(IntPtr carray, int index, GCP value)
 {
     GdalPINVOKE.__WriteCArrayItem_GDAL_GCP(carray, index, GCP.getCPtr(value));
     if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #9
0
ファイル: Gdal.cs プロジェクト: wangfeilong321/vdpm
 public static double GDAL_GCP_get_GCPZ(GCP gcp)
 {
     double ret = GdalPINVOKE.GDAL_GCP_get_GCPZ(GCP.getCPtr(gcp));
     if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
コード例 #10
0
ファイル: Dataset.cs プロジェクト: diegowald/intellitrack
 private void __WriteCArrayItem_GDAL_GCP(IntPtr carray, int index, GCP value) {
   GdalPINVOKE.Dataset___WriteCArrayItem_GDAL_GCP(swigCPtr, carray, index, GCP.getCPtr(value));
   if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #11
0
ファイル: GCP.cs プロジェクト: diegowald/intellitrack
 public static HandleRef getCPtr(GCP obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
コード例 #12
0
ファイル: Dataset.cs プロジェクト: diegowald/intellitrack
public GCP[] GetGCPs() {
      /*hello*/
      IntPtr cPtr = __GetGCPs();
      int length = GetGCPCount();
      GCP[] ret = null;
      if (cPtr != IntPtr.Zero && length > 0)
      {
          ret = new GCP[length];
          for (int i=0; i < length; i++)
              ret[i] = __ReadCArrayItem_GDAL_GCP(cPtr, i);
      }
      GC.KeepAlive(this);
      return ret;
  }
コード例 #13
0
ファイル: Dataset.cs プロジェクト: diegowald/intellitrack
public CPLErr SetGCPs(GCP[] pGCPs, string pszGCPProjection) {
     CPLErr ret = 0;
     if (pGCPs != null && pGCPs.Length > 0)
     {
         IntPtr cPtr = __AllocCArray_GDAL_GCP(pGCPs.Length);
         if (cPtr == IntPtr.Zero)
            throw new ApplicationException("Error allocating CArray with __AllocCArray_GDAL_GCP");
            
         try {
             for (int i=0; i < pGCPs.Length; i++)
                __WriteCArrayItem_GDAL_GCP(cPtr, i, pGCPs[i]);
             
             ret = __SetGCPs(pGCPs.Length, cPtr, pszGCPProjection);
         }
         finally
         {
            __FreeCArray_GDAL_GCP(cPtr);
         }
     }
     GC.KeepAlive(this);
     return ret;
  }
コード例 #14
0
ファイル: GDALWrite.cs プロジェクト: nextgis-borsch/lib_gdal
    public static void Main(string[] args)
    {
        if (args.Length < 1) usage();

        // Using early initialization of System.Console
        Console.WriteLine("Writing sample: " + args[0]);

        int bXSize, bYSize;
        int w, h;

        w = 100;
        h = 100;

        if (args.Length > 1)
            w = int.Parse(args[1]);

        if (args.Length > 2)
            h = int.Parse(args[2]);

        bXSize = w;
        bYSize = 1;

        //try
        {
            /* -------------------------------------------------------------------- */
            /*      Register driver(s).                                             */
            /* -------------------------------------------------------------------- */
            Gdal.AllRegister();

            /* -------------------------------------------------------------------- */
            /*      Get driver                                                      */
            /* -------------------------------------------------------------------- */
            Driver drv = Gdal.GetDriverByName("GTiff");

            if (drv == null)
            {
                Console.WriteLine("Can't get driver.");
                System.Environment.Exit(-1);
            }

            Console.WriteLine("Using driver " + drv.LongName);

            /* -------------------------------------------------------------------- */
            /*      Open dataset.                                                   */
            /* -------------------------------------------------------------------- */
            string[] options = new string [] {"BLOCKXSIZE=" + bXSize, "BLOCKYSIZE=" + bYSize};
            Dataset ds = drv.Create(args[0], w, h, 1, DataType.GDT_Byte, options);

            if (ds == null)
            {
                Console.WriteLine("Can't open " + args[0]);
                System.Environment.Exit(-1);
            }

            /* -------------------------------------------------------------------- */
            /*      Setting corner GCPs.                                            */
            /* -------------------------------------------------------------------- */
            GCP[] GCPs = new GCP[] {
                new GCP(44.5, 27.5, 0, 0, 0, "info0", "id0"),
                new GCP(45.5, 27.5, 0, 100, 0, "info1", "id1"),
                new GCP(44.5, 26.5, 0, 0, 100, "info2", "id2"),
                new GCP(45.5, 26.5, 0, 100, 100, "info3", "id3")
            };
            ds.SetGCPs(GCPs, "");

            Band ba = ds.GetRasterBand(1);

            byte [] buffer = new byte [w * h];

            for (int i = 0; i < w; i++)
            {
                for (int j = 0; j < h; j++)
                {
                    buffer[i * w + j] = (byte)(i * 256 / w);
                }
            }

            ba.WriteRaster(0, 0, w, h, buffer, w, h, 0, 0);

            ba.FlushCache();
            ds.FlushCache();

        }
        /*catch (Exception e)
        {
            Console.WriteLine("Application error: " + e.Message);
        }*/
    }
コード例 #15
0
ファイル: GCP.cs プロジェクト: VisualAwarenessTech/gdal-2.2.1
 public static HandleRef getCPtr(GCP obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
コード例 #16
0
ファイル: Gdal.cs プロジェクト: wangfeilong321/vdpm
 public static void GDAL_GCP_set_Info(GCP gcp, string pszInfo)
 {
     GdalPINVOKE.GDAL_GCP_set_Info(GCP.getCPtr(gcp), pszInfo);
     if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #17
0
ファイル: Gdal.cs プロジェクト: wangfeilong321/vdpm
 public static void GDAL_GCP_set_GCPZ(GCP gcp, double dfGCPZ)
 {
     GdalPINVOKE.GDAL_GCP_set_GCPZ(GCP.getCPtr(gcp), dfGCPZ);
     if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #18
0
ファイル: Gdal.cs プロジェクト: wangfeilong321/vdpm
 public static string GDAL_GCP_Info_get(GCP gcp)
 {
     string ret = GdalPINVOKE.GDAL_GCP_Info_get(GCP.getCPtr(gcp));
     if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }