コード例 #1
0
ファイル: EngineAPI.cs プロジェクト: zshankang/OpenHalcon
        internal static int LoadObjectVector(HObjectVector outVector, IntPtr vectorHandle)
        {
            int dimension;

            EngineAPI.HCkE(EngineAPI.GetObjectVectorDimension(vectorHandle, out dimension));
            int length;

            EngineAPI.HCkE(EngineAPI.GetObjectVectorLength(vectorHandle, out length));
            if (dimension == 1)
            {
                for (int index = length - 1; index >= 0; --index)
                {
                    IntPtr key;
                    EngineAPI.HCkE(EngineAPI.GetObjectVectorObject(vectorHandle, index, out key));
                    outVector[index].O = new HObject(key, false);
                }
            }
            else
            {
                for (int index = length - 1; index >= 0; --index)
                {
                    IntPtr sub_vector_handle;
                    EngineAPI.HCkE(EngineAPI.GetObjectVectorVector(vectorHandle, index, out sub_vector_handle));
                    EngineAPI.HCkE(EngineAPI.LoadObjectVector(outVector[index], sub_vector_handle));
                    EngineAPI.HCkE(EngineAPI.DestroyObjectVector(sub_vector_handle));
                }
            }
            return(2);
        }