Exemple #1
0
        /// <summary>
        /// Initializes the image dimension, mouse delegation, and the
        /// graphical context setup of the instance.
        /// </summary>
        /// <param name="view"> HALCON window </param>
        protected internal HWndCtrl(HWindowControl view)
        {
            viewPort     = view;
            stateView    = MODE_VIEW_NONE;
            windowWidth  = viewPort.Size.Width;
            windowHeight = viewPort.Size.Height;

            zoomWndFactor = (double)imageWidth / viewPort.Width;
            zoomAddOn     = Math.Pow(0.9, 5);
            zoomWndSize   = 150;

            /*default*/
            CompRangeX = new int[] { 0, 100 };
            CompRangeY = new int[] { 0, 100 };

            prevCompX = prevCompY = 0;

            dispROI = MODE_INCLUDE_ROI;//1;

            viewPort.HMouseUp    += new HalconDotNet.HMouseEventHandler(this.mouseUp);
            viewPort.HMouseDown  += new HalconDotNet.HMouseEventHandler(this.mouseDown);
            viewPort.HMouseWheel += new HalconDotNet.HMouseEventHandler(this.HMouseWheel);
            viewPort.HMouseMove  += new HalconDotNet.HMouseEventHandler(this.mouseMoved);

            addInfoDelegate    = new FuncDelegate(dummyV);
            NotifyIconObserver = new IconicDelegate(dummy);

            // graphical stack
            HObjImageList      = new ArrayList(20);
            mGC                = new GraphicsContext();
            mGC.gcNotification = new GCDelegate(exceptionGC);
        }
        //-------------------------↑公共变量或参数↑--------------------------------------------//

        /// <summary>
        /// Initializes the image dimension, mouse delegation,
        /// and the graphical context setup of the instance.
        /// </summary>
        /// <param name="hwndctrl"></param>
        public HWndCtrller(HalconDotNet.HWindowControl hwndctrl)
        {
            this._hWindowControl = hwndctrl;
            this._viewMode       = MODE_VIEW_NONE;
            this._windowWidth    = this._hWindowControl.Size.Width;
            this._windowHeight   = this._hWindowControl.Size.Height;

            this._zoomWndFactor = (double)this._imageWidth / this._hWindowControl.Width;
            this._zoomAddOn     = System.Math.Pow(0.9, 5);
            this._zoomWndSize   = 150;

            this._ROIDispMode = MODE_INCLUDE_ROI;

            this._hWindowControl.HMouseUp    += new HalconDotNet.HMouseEventHandler(MouseUp);
            this._hWindowControl.HMouseDown  += new HalconDotNet.HMouseEventHandler(MouseDown);
            this._hWindowControl.HMouseMove  += new HalconDotNet.HMouseEventHandler(MouseMove);
            this._hWindowControl.HMouseWheel += new HalconDotNet.HMouseEventHandler(MouseWheel);

            this.NotifyInfo   = new InformationDelegate(DummyS);
            this.NotifyIconic = new IconicDelegate(DummyI);

            /* Graphical Stack */
            this._hObjList = new System.Collections.ArrayList(20);
            this._GC       = new GraphicContext();
            this._GC.NotifyGraphicContext += new GraphicContextDelegate(ExceptionGC);

            /*GUI绘制窗口用参数的初始值*/
            this._compRangeX = new int[] { 0, 100 };
            this._compRangeY = new int[] { 0, 100 };
            this._prevCompX  = this._prevCompY = 0;
        }
Exemple #3
0
        /// <summary>
        /// Initializes the image dimension, mouse delegation, and the
        /// graphical context setup of the instance.
        /// </summary>
        /// <param name="view"> HALCON window </param>
        public HWndCtrl(HWindowControlWPF view)
        {
            viewPort     = view;
            stateView    = MODE_VIEW_NONE;
            windowWidth  = viewPort.ActualWidth;
            windowHeight = viewPort.ActualHeight;

            zoomWndFactor = (double)imageWidth / viewPort.ActualWidth;
            zoomAddOn     = Math.Pow(0.9, 5);
            zoomWndSize   = 150;

            /*default*/
            CompRangeX = new int[] { 0, 100 };
            CompRangeY = new int[] { 0, 100 };

            prevCompX = prevCompY = 0;

            dispROI = MODE_INCLUDE_ROI;//1;

            //viewPort.HMouseUp += ViewPort_HMouseUp;
            //viewPort.HMouseDown += ViewPort_HMouseDown;
            //viewPort.HMouseMove += ViewPort_HMouseMove;
            viewPort.HMouseWheel += ViewPort_HMouseWheel;

            viewPort.SizeChanged += ViewPort_SizeChanged;


            addInfoDelegate    = new FuncDelegate(dummyV);
            NotifyIconObserver = new IconicDelegate(dummy);

            // graphical stack
            HObjList           = new ArrayList(20);
            mGC                = new GraphicsContext();
            mGC.gcNotification = new GCDelegate(exceptionGC);
        }
        /// <summary>
        /// Initializes the image dimension, mouse delegation, and the
        /// graphical context setup of the instance.
        /// </summary>
        /// <param name="view"> HALCON window </param>
        public HWndCtrl(HWindowControl view)
        {
            viewPort     = view;
            stateView    = MODE_VIEW_NONE;
            windowWidth  = viewPort.Size.Width;
            windowHeight = viewPort.Size.Height;

            // initialize the image part to window size
            initializeDisplayImagePart();
            resetImagePart(widthImagePart, heightImagePart);


            if (widthImagePart > 0)
            {
                zoomWndFactor = (double)widthImagePart / viewPort.Width;
            }
            else
            {
                zoomWndFactor = 1;
            }

            zoomAddOn   = Math.Pow(0.9, 5);
            zoomWndSize = 150;

            /*Set the boundaries and steps for changes for the GUI elements*/
            /*default*/
            CompRangeX = new int[] { 0, 100 };
            CompRangeY = new int[] { 0, 100 };

            prevCompX = prevCompY = 0;
            initValX  = initValY = 0;

            /* Initialize the values for value range, step for
             * some GUI elements */
            setGUICompRangeX(CompRangeX, prevCompX);
            setGUICompRangeY(CompRangeY, prevCompY);

            //displayMode = MODE_VIEW_NONE;

            dispROI = MODE_INCLUDE_ROI;//1;

            viewPort.HMouseUp    += new HalconDotNet.HMouseEventHandler(this.mouseUp);
            viewPort.HMouseDown  += new HalconDotNet.HMouseEventHandler(this.mouseDown);
            viewPort.HMouseMove  += new HalconDotNet.HMouseEventHandler(this.mouseMoved);
            viewPort.HMouseWheel += new HalconDotNet.HMouseEventHandler(this.mouseWheel);

            addInfoDelegate    = new FuncDelegate(dummyV);
            NotifyIconObserver = new IconicDelegate(dummy);

            // graphical stack
            HObjList           = new ArrayList(20);
            mGC                = new GraphicsContext();
            mGC.gcNotification = new GCDelegate(exceptionGC);

            // set the variable bufferWindow to null for repaint-Method
            bufferWindow = null;
        }
Exemple #5
0
 /// <summary>Constructor</summary>
 public ROIController()
 {
     stateROI         = MODE_ROI_NONE;
     ROIList          = new ArrayList();
     activeROIidx     = -1;
     ModelROI         = new HRegion();
     NotifyRCObserver = new IconicDelegate(dummyI);
     deletedIdx       = -1;
     currX            = currY = -1;
 }
 public ROICtrller()
 {
     _signROI        = SIGN_ROI_NONE;
     ROIList         = new System.Collections.ArrayList();
     ActiveROIIndex  = -1;
     ModelROI        = new HalconDotNet.HRegion();
     NotifyIconic    = new IconicDelegate(DummyI);
     DeletedROIIndex = -1;
     _currX          = _currY = -1;
 }
        /// <summary> 
        /// Initializes the image dimension, mouse delegation, and the 
        /// graphical context setup of the instance.
        /// </summary>
        /// <param name="view"> HALCON window </param>
        public HWndCtrl(HWindowControl view)
        {
            viewPort = view;
              stateView = MODE_VIEW_NONE;
              windowWidth = viewPort.Size.Width;
              windowHeight = viewPort.Size.Height;

              // initialize the image part to window size
              initializeDisplayImagePart();
              resetImagePart(widthImagePart, heightImagePart);

              if (widthImagePart > 0)
            zoomWndFactor = (double)widthImagePart / viewPort.Width;
              else
            zoomWndFactor = 1;

              zoomAddOn = Math.Pow(0.9, 5);
              zoomWndSize = 150;

              /*Set the boundaries and steps for changes for the GUI elements*/
              /*default*/
              CompRangeX = new int[] { 0, 100 };
              CompRangeY = new int[] { 0, 100 };

              prevCompX = prevCompY = 0;
              initValX  = initValY  = 0;

              /* Initialize the values for value range, step for
               * some GUI elements */
              setGUICompRangeX(CompRangeX, prevCompX);
              setGUICompRangeY(CompRangeY, prevCompY);

              //displayMode = MODE_VIEW_NONE;

              dispROI = MODE_INCLUDE_ROI;//1;

              viewPort.HMouseUp += new HalconDotNet.HMouseEventHandler(this.mouseUp);
              viewPort.HMouseDown += new HalconDotNet.HMouseEventHandler(this.mouseDown);
              viewPort.HMouseMove += new HalconDotNet.HMouseEventHandler(this.mouseMoved);
              viewPort.HMouseWheel += new HalconDotNet.HMouseEventHandler(this.mouseWheel);

              addInfoDelegate = new FuncDelegate(dummyV);
              NotifyIconObserver = new IconicDelegate(dummy);

              // graphical stack
              HObjList = new ArrayList(20);
              mGC = new GraphicsContext();
              mGC.gcNotification = new GCDelegate(exceptionGC);

              // set the variable bufferWindow to null for repaint-Method
              bufferWindow = null;
        }
        /// <summary> 
        /// Initializes the image dimension, mouse delegation, and the 
        /// graphical context setup of the instance.
        /// </summary>
        /// <param name="view"> HALCON window </param>
        public HWndCtrl(HWindowControl view)
        {
            _viewPort = view;
            _stateView = MODE_VIEW_NONE;
            windowWidth = _viewPort.Size.Width;
            windowHeight = _viewPort.Size.Height;

            zoomWndFactor = (double)imageWidth / _viewPort.Width;
            zoomAddOn = Math.Pow(0.9, 5);
            zoomWndSize = 150;

            /*default*/
            CompRangeX = new int[] { 0, 100 };
            CompRangeY = new int[] { 0, 100 };

            prevCompX = prevCompY = 0;

            _dispROI = MODE_INCLUDE_ROI;//1;

            _viewPort.HMouseUp += new HalconDotNet.HMouseEventHandler(this.mouseUp);
            _viewPort.HMouseDown += new HalconDotNet.HMouseEventHandler(this.mouseDown);
            _viewPort.HMouseMove += new HalconDotNet.HMouseEventHandler(this.mouseMoved);

            addInfoDelegate = new FuncDelegate(dummyV);
            NotifyIconObserver = new IconicDelegate(dummy);

            // graphical stack
            HObjList = new ArrayList(20);
            mGC = new GraphicsContext();
            mGC.gcNotification = new GCDelegate(exceptionGC);
        }
 /// <summary>Constructor</summary>
 public ROIController()
 {
     stateROI = MODE_ROI_NONE;
     ROIList = new ArrayList();
     activeROIidx = -1;
     ModelROI = new HRegion();
     NotifyRCObserver = new IconicDelegate(dummyI);
     deletedIdx = -1;
     currX = currY = -1;
 }