error in new loadrectifiedlayer
Hi all,
I try to load a rectified layer but I receive an error and in debug I fing my list of GCPs become null. Please let me know what I am doing wrong.
LastGMError = GlobalMapperDLL.GM_LoadRectifiedLayer(m_strImgLayer,out pLayer, GlobalMapperDLL.GM_LoadFlags_t32.GM_LoadFlags_HideAllPrompts, gcps, 4, aproj);
Wrapper function:
[DllImport(DLLFileName, EntryPoint = "GM_LoadRectifiedLayer")]
public static extern GM_Error_t32 GM_LoadRectifiedLayer
(
string aFilename,
out GM_LayerHandle_t32 aLayer,
GM_LoadFlags_t32 aLoadFlags,
GM_GroundControlPoint_t[] aGCPList,
UInt32 aNumGCPs,
GM_Projection_t aProj
);
Thanks in advance,
Florian
I try to load a rectified layer but I receive an error and in debug I fing my list of GCPs become null. Please let me know what I am doing wrong.
LastGMError = GlobalMapperDLL.GM_LoadRectifiedLayer(m_strImgLayer,out pLayer, GlobalMapperDLL.GM_LoadFlags_t32.GM_LoadFlags_HideAllPrompts, gcps, 4, aproj);
Wrapper function:
[DllImport(DLLFileName, EntryPoint = "GM_LoadRectifiedLayer")]
public static extern GM_Error_t32 GM_LoadRectifiedLayer
(
string aFilename,
out GM_LayerHandle_t32 aLayer,
GM_LoadFlags_t32 aLoadFlags,
GM_GroundControlPoint_t[] aGCPList,
UInt32 aNumGCPs,
GM_Projection_t aProj
);
Thanks in advance,
Florian
Comments
-
Florian,
A see a couple of problems. First of all, you'll need to pass your GCP list as an IntPtr and create your in-memory array and pass in the address of it. You can't use a C# style array to pass directly to a C-style pointer like that.
Also, your 'aProj' parameter should be declared as a 'ref' parameter so that the address of it will be passed.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Sorry Mike I am not a C developer. please you can tell me how I can receive a pointer of a GM structure, in that case GM_GroundControlPoint_t[] array.
Many thanks,
Florian -
If you check the end of the Form1.cs file from the attached C# sample application you will find an example of calling the GM_AddAreaToVectorLayer function. The setup just before that sets up a mPointList value that is an IntPtr for an array of GM_Point_t structure. You can use the same technique for the GM_ControlPoint_t list.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Sorry Mike,
Maybe I dont undestand very well, in your example:
GM_Point_t theVertex = new GM_Point_t();
for (UInt32 i = 0; i < theLineFeature.mNumPoints; i++)
{
IntPtr theVtxPtr = (IntPtr)( (UInt32)theLineFeature.mPointList + i * sizeof(GM_Point_t) );
theVertex = (GM_Point_t)Marshal.PtrToStructure(theVtxPtr, typeof(GM_Point_t));
}
you receive a start IntPtr from theLineFeature.MpointList and after that you move in structure to find elements. I constract an array GM_GroundControlPoint_t[] and I dont know how to read
the IntPtr of this array to pass it to a LoadRectifiedLayer function.
Thanks,
Florian
I -
Florian,
You are looking at the wrong part of the sample code. Look at the bottom where 'theAreaPoints' array is setup, then assigned to an IntPtr in the line:
theBuilding.mPointList = (IntPtr)thePointList;
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Thank you very much for your time.
Florian
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website