This project is read-only.

GetColor from PyramidImage

Aug 24, 2011 at 10:29 AM
Edited Aug 24, 2011 at 10:31 AM

Hello!

Can you tell me, How can I get pixel color from PyramidImage object?

I'm trying to do this:

 

PyramidImage raster = (PyramidImage)map1.Layers[0].DataSet;
raster.GetColor(0, 0);

 

but I have an exception:


System.NullReferenceException was unhandled
  Message = Object reference not set to an instance of an object.
  
Source = DotSpatial.Data
  
StackTrace:
       
in DotSpatial.Data.ImageData.GetColor (Int32 row, Int32 column) in C: \ dev \ DotSpatial \ DotSpatial.Data \ DotSpatial.Data \ ImageData.cs: line 269
       
in gdal_test1.Form1.map1_MouseClick (Object sender, MouseEventArgs e) in C: \ Documents and Settings \ Administrator \ Desktop \ MapWindow_Orlando \ _Component \ gdal_test2 \ gdal_test1 \ Form1.cs: line 57
       
in System.Windows.Forms.Control.OnMouseClick (MouseEventArgs e)
       
in System.Windows.Forms.Control.WmMouseUp (Message & m, MouseButtons button, Int32 clicks)
       
in System.Windows.Forms.Control.WndProc (Message & m)
       
in System.Windows.Forms.ScrollableControl.WndProc (Message & m)
       
in System.Windows.Forms.UserControl.WndProc (Message & m)
       
in System.Windows.Forms.Control.ControlNativeWindow.OnMessage (Message & m)
       
in System.Windows.Forms.Control.ControlNativeWindow.WndProc (Message & m)
       
in System.Windows.Forms.NativeWindow.DebuggableCallback (IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       
in System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW (MSG & msg)
       
in dwComponentID, Int32 reason, Int32 pvLoopData)
       
in System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner (Int32 reason, ApplicationContext context)
       
in System.Windows.Forms.Application.ThreadContext.RunMessageLoop (Int32 reason, ApplicationContext context)
       
in System.Windows.Forms.Application.Run (Form mainForm)
       
in gdal_test1.Program.Main () in C: \ Documents and Settings \ Administrator \ Desktop \ MapWindow_Orlando \ _Component \ gdal_test2 \ gdal_test1 \ Program.cs: line 18
       
in System.AppDomain._nExecuteAssembly (RuntimeAssembly assembly, String [] args)
       
in System.AppDomain.ExecuteAssembly (String assemblyFile, Evidence assemblySecurity, String [] args)
       
in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly ()
       
in System.Threading.ThreadHelper.ThreadStart_Context (Object state)
       
in System.Threading.ExecutionContext.Run (ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       
in System.Threading.ExecutionContext.Run (ExecutionContext executionContext, ContextCallback callback, Object state)
       
in System.Threading.ThreadHelper.ThreadStart ()
  
InnerException:

I'm using that release from Feb 5 2011.

Can you tell me where I have mistaken?