コード例 #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);
        }
コード例 #2
0
ファイル: EngineAPI.cs プロジェクト: zshankang/OpenHalcon
        internal static int StoreObjectVector(HObjectVector inVector, IntPtr vectorHandle)
        {
            int dimension = inVector.Dimension;
            int length    = inVector.Length;

            if (dimension == 1)
            {
                for (int index = length - 1; index >= 0; --index)
                {
                    EngineAPI.HCkE(EngineAPI.SetObjectVectorObject(vectorHandle, index, inVector[index].O.Key));
                }
            }
            else
            {
                for (int index = length - 1; index >= 0; --index)
                {
                    IntPtr vectorHandle1;
                    EngineAPI.HCkE(EngineAPI.CreateObjectVector(inVector[index], out vectorHandle1));
                    EngineAPI.HCkE(EngineAPI.SetObjectVectorVector(vectorHandle, index, vectorHandle1));
                    EngineAPI.HCkE(EngineAPI.DestroyObjectVector(vectorHandle1));
                }
            }
            GC.KeepAlive((object)inVector);
            return(2);
        }
コード例 #3
0
        /// <summary>Sets input control parameter for procedure call</summary>
        public void SetInputIconicParamVector(string name, HObjectVector vector)
        {
            IntPtr vectorHandle;

            HDevProcedureCall.HCkE(EngineAPI.CreateObjectVector(vector, out vectorHandle));
            HDevProcedureCall.HCkE(EngineAPI.SetInputIconicParamVector(this.call, name, vectorHandle));
            GC.KeepAlive((object)this);
            HDevProcedureCall.HCkE(EngineAPI.DestroyObjectVector(vectorHandle));
        }
コード例 #4
0
ファイル: HDevEngine.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>Sets the value of a global iconic variable</summary>
        public void SetGlobalIconicVarVector(string name, HObjectVector vector)
        {
            IntPtr vectorHandle;

            HDevEngine.HCkE(EngineAPI.CreateObjectVector(vector, out vectorHandle));
            HDevEngine.HCkE(EngineAPI.SetGlobalIconicVarVector(this.engine, name, vectorHandle));
            GC.KeepAlive((object)this);
            HDevEngine.HCkE(EngineAPI.DestroyObjectVector(vectorHandle));
        }
コード例 #5
0
ファイル: EngineAPI.cs プロジェクト: zshankang/OpenHalcon
        internal static HObjectVector GetAndDestroyObjectVector(IntPtr vectorHandle)
        {
            int dimension;

            EngineAPI.HCkE(EngineAPI.GetObjectVectorDimension(vectorHandle, out dimension));
            HObjectVector outVector = new HObjectVector(dimension);

            EngineAPI.HCkE(EngineAPI.LoadObjectVector(outVector, vectorHandle));
            EngineAPI.HCkE(EngineAPI.DestroyObjectVector(vectorHandle));
            return(outVector);
        }