Example #1
0
        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);
        }
Example #2
0
        internal static int LoadTupleVector(HTupleVector outVector, IntPtr vectorHandle)
        {
            int dimension;

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

            EngineAPI.HCkE(EngineAPI.GetTupleVectorLength(vectorHandle, out length));
            if (dimension == 1)
            {
                for (int index = length - 1; index >= 0; --index)
                {
                    IntPtr element_handle;
                    EngineAPI.HCkE(EngineAPI.GetTupleVectorTuple(vectorHandle, index, out element_handle));
                    outVector[index].T = HalconAPI.LoadTuple(element_handle);
                }
            }
            else
            {
                for (int index = length - 1; index >= 0; --index)
                {
                    IntPtr element_handle;
                    EngineAPI.HCkE(EngineAPI.GetTupleVectorVector(vectorHandle, index, out element_handle));
                    EngineAPI.HCkE(EngineAPI.LoadTupleVector(outVector[index], element_handle));
                    EngineAPI.HCkE(EngineAPI.DestroyTupleVector(element_handle));
                }
            }
            return(2);
        }
Example #3
0
        internal static int StoreTupleVector(HTupleVector inVector, IntPtr vectorHandle)
        {
            int dimension = inVector.Dimension;
            int length    = inVector.Length;

            if (dimension == 1)
            {
                for (int index = length - 1; index >= 0; --index)
                {
                    IntPtr tuple;
                    EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple));
                    HalconAPI.StoreTuple(tuple, inVector[index].T);
                    EngineAPI.HCkE(EngineAPI.SetTupleVectorTuple(vectorHandle, index, tuple));
                    EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple));
                }
            }
            else
            {
                for (int index = length - 1; index >= 0; --index)
                {
                    IntPtr vectorHandle1;
                    EngineAPI.HCkE(EngineAPI.CreateTupleVector(inVector[index], out vectorHandle1));
                    EngineAPI.HCkE(EngineAPI.SetTupleVectorVector(vectorHandle, index, vectorHandle1));
                    EngineAPI.HCkE(EngineAPI.DestroyTupleVector(vectorHandle1));
                }
            }
            GC.KeepAlive((object)inVector);
            return(2);
        }
Example #4
0
        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);
        }
Example #5
0
        internal static void GetProgramInfo(
            IntPtr program,
            out string name,
            out bool loaded,
            out HTuple varNamesIconic,
            out HTuple varNamesCtrl,
            out HTuple varDimsIconic,
            out HTuple varDimsCtrl)
        {
            IntPtr tuple1;

            EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple1));
            IntPtr tuple2;

            EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple2));
            IntPtr tuple3;

            EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple3));
            IntPtr tuple4;

            EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple4));
            IntPtr name1;

            EngineAPI.HCkE(EngineAPI.HCenGetProgramInfo(program, out name1, out loaded, tuple1, tuple2, tuple3, tuple4));
            name           = Marshal.PtrToStringAnsi(name1);
            varNamesIconic = HalconAPI.LoadTuple(tuple1);
            varNamesCtrl   = HalconAPI.LoadTuple(tuple2);
            varDimsIconic  = HalconAPI.LoadTuple(tuple3);
            varDimsCtrl    = HalconAPI.LoadTuple(tuple4);
            EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple1));
            EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple2));
            EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple3));
            EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple4));
        }
Example #6
0
        internal static int CreateTupleVector(HTupleVector inVector, out IntPtr vectorHandle)
        {
            IntPtr vector_handle;

            EngineAPI.HCkE(EngineAPI.CreateTupleVector(inVector.Dimension, out vector_handle));
            EngineAPI.HCkE(EngineAPI.StoreTupleVector(inVector, vector_handle));
            GC.KeepAlive((object)inVector);
            vectorHandle = vector_handle;
            return(2);
        }
Example #7
0
        internal static HTupleVector GetAndDestroyTupleVector(IntPtr vectorHandle)
        {
            int dimension;

            EngineAPI.HCkE(EngineAPI.GetTupleVectorDimension(vectorHandle, out dimension));
            HTupleVector outVector = new HTupleVector(dimension);

            EngineAPI.HCkE(EngineAPI.LoadTupleVector(outVector, vectorHandle));
            EngineAPI.HCkE(EngineAPI.DestroyTupleVector(vectorHandle));
            return(outVector);
        }
 public HDevOperatorWrapper(HDevEngine engine, IHDevOperators implementation)
 {
     this.implementation              = implementation;
     this.delegateDevOpenWindow       = new DevOpenWindowDelegate(this.DevOpenWindow);
     this.delegateDevCloseWindow      = new DevCloseWindowDelegate(this.DevCloseWindow);
     this.delegateDevSetWindow        = new DevSetWindowDelegate(this.DevSetWindow);
     this.delegateDevGetWindow        = new DevGetWindowDelegate(this.DevGetWindow);
     this.delegateDevSetWindowExtents = new DevSetWindowExtentsDelegate(this.DevSetWindowExtents);
     this.delegateDevSetPart          = new DevSetPartDelegate(this.DevSetPart);
     this.delegateDevClearWindow      = new DevClearWindowDelegate(this.DevClearWindow);
     this.delegateDevDisplay          = new DevDisplayDelegate(this.DevDisplay);
     this.delegateDevDispText         = new DevDispTextDelegate(this.DevDispText);
     this.delegateDevSetDraw          = new DevSetDrawDelegate(this.DevSetDraw);
     this.delegateDevSetShape         = new DevSetShapeDelegate(this.DevSetShape);
     this.delegateDevSetColored       = new DevSetColoredDelegate(this.DevSetColored);
     this.delegateDevSetColor         = new DevSetColorDelegate(this.DevSetColor);
     this.delegateDevSetLut           = new DevSetLutDelegate(this.DevSetLut);
     this.delegateDevSetPaint         = new DevSetPaintDelegate(this.DevSetPaint);
     this.delegateDevSetLineWidth     = new DevSetLineWidthDelegate(this.DevSetLineWidth);
     EngineAPI.HCkE(EngineAPI.CreateImplementation(out this.implHandle, this.delegateDevOpenWindow, this.delegateDevCloseWindow, this.delegateDevSetWindow, this.delegateDevGetWindow, this.delegateDevSetWindowExtents, this.delegateDevSetPart, this.delegateDevClearWindow, this.delegateDevDisplay, this.delegateDevDispText, this.delegateDevSetDraw, this.delegateDevSetShape, this.delegateDevSetColored, this.delegateDevSetColor, this.delegateDevSetLut, this.delegateDevSetPaint, this.delegateDevSetLineWidth));
     GC.KeepAlive((object)this);
 }
Example #9
0
 internal static void HCkE(int err)
 {
     EngineAPI.HCkE(err);
 }
Example #10
0
        internal static void GetProcedureInfo(
            IntPtr procedure,
            out string name,
            out string shortDescription,
            out bool loaded,
            out HTuple parNamesIconicInput,
            out HTuple parNamesIconicOutput,
            out HTuple parNamesCtrlInput,
            out HTuple parNamesCtrlOutput,
            out HTuple parDimsIconicInput,
            out HTuple parDimsIconicOutput,
            out HTuple parDimsCtrlInput,
            out HTuple parDimsCtrlOutput)
        {
            IntPtr tuple1;

            EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple1));
            IntPtr tuple2;

            EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple2));
            IntPtr tuple3;

            EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple3));
            IntPtr tuple4;

            EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple4));
            IntPtr tuple5;

            EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple5));
            IntPtr tuple6;

            EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple6));
            IntPtr tuple7;

            EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple7));
            IntPtr tuple8;

            EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple8));
            IntPtr name1;
            IntPtr shortDescription1;

            EngineAPI.HCkE(EngineAPI.HCenGetProcedureInfo(procedure, out name1, out shortDescription1, out loaded, tuple1, tuple2, tuple3, tuple4, tuple5, tuple6, tuple7, tuple8));
            name                 = Marshal.PtrToStringAnsi(name1);
            shortDescription     = Marshal.PtrToStringAnsi(shortDescription1);
            parNamesIconicInput  = HalconAPI.LoadTuple(tuple1);
            parNamesIconicOutput = HalconAPI.LoadTuple(tuple2);
            parNamesCtrlInput    = HalconAPI.LoadTuple(tuple3);
            parNamesCtrlOutput   = HalconAPI.LoadTuple(tuple4);
            parDimsIconicInput   = HalconAPI.LoadTuple(tuple5);
            parDimsIconicOutput  = HalconAPI.LoadTuple(tuple6);
            parDimsCtrlInput     = HalconAPI.LoadTuple(tuple7);
            parDimsCtrlOutput    = HalconAPI.LoadTuple(tuple8);
            EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple1));
            EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple2));
            EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple3));
            EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple4));
            EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple5));
            EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple6));
            EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple7));
            EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple8));
        }