Ejemplo n.º 1
0
        private void sourceSelection_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (sourceSelection.SelectedIndex)
            {
            case 0:
                view = sl.VIEW.LEFT;
                break;

            case 1:
                view = sl.VIEW.RIGHT;
                break;

            case 2:
                view = sl.VIEW.SIDE_BY_SIDE;
                break;

            case 3:
                view = sl.VIEW.DEPTH;
                break;

            case 4:
                view = sl.VIEW.CONFIDENCE;
                break;

            case 5:
                view = sl.VIEW.NORMALS;
                break;

            case 6:
                view = sl.VIEW.LEFT_UNRECTIFIED;
                break;
            }
        }
Ejemplo n.º 2
0
        private void view_Click(object sender, EventArgs e)
        {
            VIEW view = new VIEW();

            this.Hide();
            view.Show();
        }
Ejemplo n.º 3
0
        public ActionResult Index(int?page, VIEW v)
        {
            if (Session["VisitorsCount"] != null)
            {
                DateTime today = DateTime.Now.Date;
                var      v1    = data.VIEWs.Where(a => a.Ngay == today).FirstOrDefault();
                if (v1 == null)
                {
                    v.Ngay   = today;
                    v.View1 += 1;
                    data.VIEWs.InsertOnSubmit(v);
                    data.SubmitChanges();
                }
                else
                {
                    VIEW sp = data.VIEWs.SingleOrDefault(n => n.Ngay == today);
                    sp.View1 += 1;
                    UpdateModel(sp);
                    data.SubmitChanges();
                }
            }

            var list = data.NhaSanXuats.OrderBy(n => n.TenNSX).ToList();

            ViewBag.nhasan = list;
            int pageSize = 8;
            int pageNum  = (page ?? 1);

            var xemoi = Layxemoi(10);

            return(View(xemoi.ToPagedList(pageNum, pageSize)));
        }
Ejemplo n.º 4
0
    void initVars()
    {
        rotating = ROTATION.NONE;
        view     = VIEW.FRONT;

        platformPos    = new Vector3[platforms.Length];
        oldPlatformPos = new Vector3[platforms.Length];
        newPlatformPos = new Vector3[platforms.Length];
        int i = 0;

        foreach (GameObject platform in platforms)
        {
            platformPos[i] = platform.transform.position;
            platform.GetComponent <PlatformID>().ID = i;
            ++i;
        }

        modPos    = new Vector3[mods.Length];
        oldModPos = new Vector3[mods.Length];
        newModPos = new Vector3[mods.Length];
        i         = 0;
        foreach (GameObject mod in mods)
        {
            modPos[i] = mod.transform.position;
            ++i;
        }
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Copies the given ZEDMat to a given OpenCV mat, creating either or both mats if necessary, then calls an ImageUpdatedEvent with them.
    /// Used in OnZEDGrabbed to call different events, and to make it easy to add more kinds of images/events by just adding more calls to this method.
    /// </summary>
    /// <param name="cam">Unity Camera object that represents the ZED camera. Usually from ZEDManager.GetLeftCamera() or ZEDManager.GetRightCamera().</param>
    /// <param name="zedmat">ZEDMat used to get the ZED image. Passing an empty one is okay - it'll get filled appropriately.</param>
    /// <param name="view">Type of image requested, like LEFT or LEFT_GRAY.</param>
    /// <param name="mattype">Data type and channel of required ZEDMat. See summaries over each enum entry to know which is correct for your image type.</param>
    /// <param name="cvMat">OpenCV mat to copy to. Passing an empty one is okay - it'll get filled appropriately.</param>
    /// <param name="updateevent">Event to call if the method retrieves the image successfully.</param>
    private void DeployGrabbedEvent(Camera cam, ref ZEDMat zedmat, VIEW view, ZEDMat.MAT_TYPE mattype, ref Mat cvMat, ImageUpdatedEvent updateevent,
                                    OpenCVConversion conversionatend = OpenCVConversion.NONE)
    {
        if (zedmat == null)
        {
            zedmat = new ZEDMat((uint)zedCam.ImageWidth, (uint)zedCam.ImageHeight, mattype);
        }

        /*if (cvMat == null)
         * {
         *  cvMat = SLMat2CVMat(zedmat, mattype);
         * }*/

        ERROR_CODE err = zedManager.zedCamera.RetrieveImage(zedmat, view, ZEDMat.MEM.MEM_CPU, zedmat.GetResolution());

        if (err == ERROR_CODE.SUCCESS)
        {
            Mat buffermat = GetOpenCVBufferMat(zedCam.ImageHeight, zedCam.ImageWidth, SLMatType2CVMatType(mattype));

            //copyToMat(zedmat.GetPtr(), cvMat);
            Utils.copyToMat(zedmat.GetPtr(), buffermat);

            ConvertColorSpace(buffermat, ref cvMat, conversionatend);
            //Mat convertedmat = ConvertColorSpace(buffermat, conversionatend);

            //updateevent.Invoke(cam, camMat, cvMat);
            updateevent.Invoke(cam, camMat, cvMat);
        }
    }
Ejemplo n.º 6
0
        public static void toggle_camera()
        {
            VIEW cam = (Config.config_tst_d(Config.CONFIG_CAMERA, (int)VIEW.VIEW_MANUAL) != 0 ?
                        VIEW.VIEW_CHASE : VIEW.VIEW_MANUAL);

            set_camera(cam);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Sự kiện onChange
 /// </summary>
 /// <param name="sender"></param>
 public void onChange(VIEW view)
 {
     if (view.getID() == R.id.CHANGE_COUNT_PRODUCT_OF_BILL)
     {
         updateBill(false);
     }
 }
Ejemplo n.º 8
0
        private void button2_Click(object sender, EventArgs e)
        {
            VIEW V = new VIEW();

            this.Hide();
            V.ShowDialog();
        }
Ejemplo n.º 9
0
        public Image <Bgra, byte> FetchImage(VIEW view)
        {
            if (mats.Count < matIndex + 1)
            {
                mats.Add(new ZEDMat());
            }
            var mat = mats[matIndex++];

            camera.RetrieveImage(mat, view);
            //Console.WriteLine("GetInfos:{0}", mat.GetInfos());
            return(new Image <Bgra, byte>(camera.ImageWidth, camera.ImageHeight, stride, mat.GetPtr()));
        }
Ejemplo n.º 10
0
    // sets view to the correct view after performing a rotation
    void setNewView()
    {
        switch (view)
        {
        case VIEW.FRONT:
            if (rotating == ROTATION.RIGHT)
            {
                view = VIEW.RIGHT;
            }
            else
            {
                view = VIEW.LEFT;
            }
            break;

        case VIEW.RIGHT:
            if (rotating == ROTATION.RIGHT)
            {
                view = VIEW.BACK;
            }
            else
            {
                view = VIEW.FRONT;
            }
            break;

        case VIEW.BACK:
            if (rotating == ROTATION.RIGHT)
            {
                view = VIEW.LEFT;
            }
            else
            {
                view = VIEW.RIGHT;
            }
            break;

        case VIEW.LEFT:
            if (rotating == ROTATION.RIGHT)
            {
                view = VIEW.FRONT;
            }
            else
            {
                view = VIEW.BACK;
            }
            break;
        }
    }
Ejemplo n.º 11
0
        public static string view_to_str(VIEW v)
        {
            switch (v)
            {
            case VIEW.VIEW_CHASE: return("Chase");

            case VIEW.VIEW_LAZY: return("Lazy");

            case VIEW.VIEW_MANUAL: return("Manual");

            case VIEW.VIEW_TOPDOWN: return("Top-Down");

            default: return("Unknown");
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Create or retrieve a texture of type Image (from Camera::retrieveImage()). Create the texture if needed.
        /// </summary>
        /// <param name="mode"></param>
        /// <returns></returns>
        public Texture2D CreateTextureImageType(VIEW mode)
        {
            if (HasTexture((int)TYPE_VIEW.RETRIEVE_IMAGE, (int)mode))
            {
                return textures[(int)TYPE_VIEW.RETRIEVE_IMAGE][(int)mode];
            }
            if (!cameraIsReady)
                return null;

            Texture2D m_Texture;
            if (mode == VIEW.LEFT_GREY || mode == VIEW.RIGHT_GREY || mode == VIEW.LEFT_UNRECTIFIED_GREY || mode == VIEW.RIGHT_UNRECTIFIED_GREY)
            {
                m_Texture = new Texture2D(ImageWidth, ImageHeight, TextureFormat.Alpha8, false);

            }
            else if (mode == VIEW.SIDE_BY_SIDE)
            {
                m_Texture = new Texture2D(ImageWidth * 2, ImageHeight, TextureFormat.RGBA32, false);
            }
            else
            {
                m_Texture = new Texture2D(ImageWidth, ImageHeight, TextureFormat.RGBA32, false);
            }
            m_Texture.filterMode = FilterMode.Trilinear;
            //m_Texture.anisoLevel = 1;
            m_Texture.Apply();

            IntPtr idTexture = m_Texture.GetNativeTexturePtr();
            int error = dllz_register_texture_image_type((int)mode, idTexture);
            if (error != 0)
            {
                throw new Exception("Error Cuda " + error + " if the problem appears again, please contact the support");
            }
            if (!textures.ContainsKey((int)TYPE_VIEW.RETRIEVE_IMAGE))
            {
                textures.Add((int)TYPE_VIEW.RETRIEVE_IMAGE, new Dictionary<int, Texture2D>());
            }
            RegisterTexture(m_Texture, (int)TYPE_VIEW.RETRIEVE_IMAGE, (int)mode);

            return m_Texture;
        }
        public bool AddAnonymousView(int bookid, int userid = -1)
        {
            try
            {
                VIEW view = new VIEW();

                view.BOOKID = bookid;
                if (userid != -1)
                {
                    view.USERID = userid;
                }

                dataAccess.VIEWs.InsertOnSubmit(view);
                dataAccess.SaveChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 14
0
 // sets view to the correct view after performing a rotation
 void setNewView()
 {
     switch(view) {
         case VIEW.FRONT:
             if( rotating == ROTATION.RIGHT )
                 view = VIEW.RIGHT;
             else
                 view = VIEW.LEFT;
             break;
         case VIEW.RIGHT:
             if( rotating == ROTATION.RIGHT )
                 view = VIEW.BACK;
             else
                 view = VIEW.FRONT;
             break;
         case VIEW.BACK:
             if( rotating == ROTATION.RIGHT )
                 view = VIEW.LEFT;
             else
                 view = VIEW.RIGHT;
             break;
         case VIEW.LEFT:
             if( rotating == ROTATION.RIGHT )
                 view = VIEW.FRONT;
             else
                 view = VIEW.BACK;
             break;
         }
 }
Ejemplo n.º 15
0
 public static void set_camera(VIEW c)
 {
     Config.config_set_d(Config.CONFIG_CAMERA, (int)c);
     hud.hud_view_pulse((int)c);
 }
Ejemplo n.º 16
0
 private void OnLeftButtonClick(object sender, RoutedEventArgs e)
 {
     view = sl.VIEW.LEFT;
 }
Ejemplo n.º 17
0
 private void OnDepthButtonClick(object sender, RoutedEventArgs e)
 {
     view = sl.VIEW.DEPTH;
 }
Ejemplo n.º 18
0
 private void OnNormalsButtonClick(object sender, RoutedEventArgs e)
 {
     view = sl.VIEW.NORMALS;
 }
 // Switch from Topdown camera to Overthe soulder
 void EnterViewOTS()
 {
     _view = VIEW.OTS;
     OTS_CAMERA.SetActive(true);
     TD_CAMERA.SetActive(false);
 }
 //Switch from Over the shoulder camera to top down
 void EnterViewTD()
 {
     _view = VIEW.TD;
     OTS_CAMERA.SetActive(false);
     TD_CAMERA.SetActive(true);
 }
Ejemplo n.º 21
0
    void initVars()
    {
        rotating = ROTATION.NONE;
        view = VIEW.FRONT;

        platformPos = new Vector3[platforms.Length];
        oldPlatformPos = new Vector3[platforms.Length];
        newPlatformPos = new Vector3[platforms.Length];
        int i = 0;
        foreach(GameObject platform in platforms) {
            platformPos[i] = platform.transform.position;
            platform.GetComponent<PlatformID>().ID = i;
            ++i;
        }

        modPos = new Vector3[mods.Length];
        oldModPos = new Vector3[mods.Length];
        newModPos = new Vector3[mods.Length];
        i = 0;
        foreach(GameObject mod in mods) {
            modPos[i] = mod.transform.position;
            ++i;
        }
    }
Ejemplo n.º 22
0
        /// <summary>
        /// Sự kiện onClick
        /// </summary>
        /// <param name="sender"></param>
        public void onClick(VIEW view)
        {
            if (view.getID() == R.layout.CATEGORY_SAMPLES)
            {
                vax = dataManager.findProductFollowCategory(((tabCategorySamples)view.obj).danhMuc.Loai);
                asyncShowProductTask(view.obj);
            }
            else if (view.getID() == R.layout.PRODUCT_SAMPLES)
            {
                showDetailsProducts(view.obj);
            }
            else if (view.getID() == R.layout.TAB_GOOD)
            {
                if (((tabGood)view.obj).isRemove)
                {
                    billManager.deleteBill(((tabGood)view.obj).sanPham);
                }
                updateBill(true);
            }
            else if (view.getID() == R.layout.TAB_ORDER)
            {
                orderChoosedBillList();
            }

            else if (view.getID() == R.id.CHOOSE_TO_BUY_PRODUCT)
            {
                buyChoosedProduct();
            }
            else if (view.getID() == R.id.CHOOSE_HOME_PAGE)
            {
                pageProducts.BringToFront();
            }
            else if (view.getID() == R.id.CONFIRM_INFO_CUSTOMER)
            {
                tabChoosePayMethod.BringToFront();
            }
            else if (view.getID() == R.id.CHOOSE_PAY_METHOD_BUY)
            {
                tabThankyou1.BringToFront();
            }
            else if (view.getID() == R.id.CHOOSE_HOME_PAGE)
            {
                pageProducts.BringToFront();
            }
            else if (view.getID() == R.id.REGISTER_USER)
            {
                formRegister = new frmRegister();
                formRegister.setOnClickListener(this);
                formRegister.Show();
            }
            else if (view.getID() == R.id.REQUEST_LOGIN)
            {
                //Kiểm tra đăng nhập tại đây
                pageLogin pl = (pageLogin)view.obj;
                handleLogin(pl.userName, pl.password);
            }
            else if (view.getID() == R.id.REQUEST_UPDATE_INFO_USER)
            {
                handleUpdateCustomer(((tabInfoUser)view.obj).customer);
            }
            else if (view.getID() == R.id.FILTER_PRICE_LOW_TO_HIGTH)
            {
                showPriceProductLowToHight(view.obj);
            }
            else if (view.getID() == R.id.FILTER_PRICE_HIGH_TO_LOW)
            {
                showPriceProductHightToLow(view.obj);
            }

            //Đoạn này cần xử lý với dữ liệu, tao bắt sự kiện sẵn rồi
            else if (view.getID() == R.id.FILTER_FOLLOW_RATE)
            {
                FilterProduct filterProduct = ((tabFilterProducts)view.obj).filterProduct;
                //Xử lý lọc theo sao tại đây
                int rate = filterProduct.rate;
                showProductFollowRate(view.obj, rate);
            }
            else if (view.getID() == R.id.FILTER_FOLLOW_ABOUT_PRICE)
            {
                FilterProduct filterProduct = ((tabFilterProducts)view.obj).filterProduct;
                //Xử lý lọc theo khoảng giá tại đây
                double from = filterProduct.price1;
                double to   = filterProduct.price2;
                showProductAboutPrice(from + to, from, to);
            }
            else if (view.getID() == R.id.FILTER_FOLLOW_TEXT)
            {
                FilterProduct filterProduct = ((pageProducts)view.obj).filterProduct;
                string        content       = filterProduct.Content;
                //Xử lý lọc theo hàng theo nội dung tìm kiếm tại đây với nôi dung
                //là biến content ở trên
                showProductFollowText(content, content);
            }
            else if (view.getID() == R.id.FILTER_FOLLOW_HOT_PRODUCT)
            {
                //Xử lý lọc theo hàng bán chạy tại đây
            }
            else if (view.getID() == R.id.FILTER_FOLLOW_NEW_PRODUCT)
            {
                //Xử lý lọc theo hàng mới tại đây
            }
            else if (view.getID() == R.id.FILTER_FOLLOW_SALE_PRODUCT)
            {
                //Xử lý lọc theo hàng giảm giá nhiều tại đây
                showProductFollowSale(view.obj);
            }
            else if (view.getID() == R.id.SEARCH_BY_CODE)
            {
                //Xử lý tìm sản phẩm theo mã code với mã
                string stringCode = ((tabInfoUser)view.obj).stringCode;
            }
            else if (view.getID() == R.id.SEARCH_BY_IMAGE_CODE ||
                     view.getID() == R.id.SEARCH_BY_CAMERA_CODE)
            {
                string stringCode = null;
                while (stringCode == null)
                {
                    stringCode = ((tabInfoUser)view.obj).stringCode;
                }

                MessageBox.Show(stringCode);
                //Xử lý tìm sản phẩm theo mã code với mã
                //PictureBox imageCode = ((tabInfoUser)view.obj).imageCode;
            }
        }
Ejemplo n.º 23
0
        public static void game_update_view(float dt)
        {
            float dc = view_dc * (jump_b != 0 ? 2.0f * System.Math.Abs(jump_dt - 0.5f) : 1.0f);
            float da = input_get_r() * dt * 90.0f;
            float k;

            float[] M = new float[16];
            float[] v = new float[3];
            float[] Y = new float[3] {
                0.0f, 1.0f, 0.0f
            };

            /* Center the view about the ball. */

            Vec3.v_cpy(view_c, file.m_uv[0].m_p);

            view_v[0] = -file.m_uv[0].m_v[0];
            view_v[1] = 0.0f;
            view_v[2] = -file.m_uv[0].m_v[2];

            /* Restore usable vectors. */

            if (game_update_view_view_prev == VIEW.VIEW_TOPDOWN)
            {
                /* View basis. */

                Vec3.v_inv(view_e[2], view_e[1]);
                Vec3.v_cpy(view_e[1], Y);

                /* View position. */

                Vec3.v_scl(v, view_e[1], view_dp);
                Vec3.v_mad(v, v, view_e[2], view_dz);
                Vec3.v_add(view_p, v, file.m_uv[0].m_p);
            }

            game_update_view_view_prev = (VIEW)input_get_c();

            switch (input_get_c())
            {
            case (int)VIEW.VIEW_LAZY:     /* Viewpoint chases the ball position. */

                Vec3.v_sub(view_e[2], view_p, view_c);

                break;

            case (int)VIEW.VIEW_MANUAL:      /* View vector is given by view angle. */
            case (int)VIEW.VIEW_TOPDOWN:     /* Crude top-down view. */

                view_e[2][0] = (float)System.Math.Sin(MathHelper.DegreesToRadians(view_a));
                view_e[2][1] = 0;
                view_e[2][2] = (float)System.Math.Cos(MathHelper.DegreesToRadians(view_a));

                break;

            case (int)VIEW.VIEW_CHASE:     /* View vector approaches the ball velocity vector. */

                Vec3.v_sub(view_e[2], view_p, view_c);
                Vec3.v_nrm(view_e[2], view_e[2]);
                Vec3.v_mad(view_e[2], view_e[2], view_v, Vec3.v_dot(view_v, view_v) * dt / 4);

                break;
            }

            /* Apply manual rotation. */

            Vec3.m_rot(M, Y, MathHelper.DegreesToRadians(da));
            Vec3.m_vxfm(view_e[2], M, view_e[2]);

            /* Orthonormalize the new view reference frame. */

            Vec3.v_crs(view_e[0], view_e[1], view_e[2]);
            Vec3.v_crs(view_e[2], view_e[0], view_e[1]);
            Vec3.v_nrm(view_e[0], view_e[0]);
            Vec3.v_nrm(view_e[2], view_e[2]);

            /* Compute the new view position. */

            k = 1.0f + Vec3.v_dot(view_e[2], view_v) / 10.0f;

            view_k = view_k + (k - view_k) * dt;

            if (view_k < 0.5)
            {
                view_k = 0.5f;
            }

            Vec3.v_scl(v, view_e[1], view_dp * view_k);
            Vec3.v_mad(v, v, view_e[2], view_dz * view_k);
            Vec3.v_add(view_p, v, file.m_uv[0].m_p);

            /* Compute the new view center. */

            Vec3.v_cpy(view_c, file.m_uv[0].m_p);
            Vec3.v_mad(view_c, view_c, view_e[1], dc);

            /* Note the current view angle. */

            view_a = MathHelper.RadiansToDegrees(System.Math.Atan2(view_e[2][0], view_e[2][2]));

            /* Override vectors for top-down view. */

            if (input_get_c() == (int)VIEW.VIEW_TOPDOWN)
            {
                Vec3.v_inv(view_e[1], view_e[2]);
                Vec3.v_cpy(view_e[2], Y);

                Vec3.v_cpy(view_c, file.m_uv[0].m_p);
                Vec3.v_mad(view_p, view_c, view_e[2], view_dz * 1.5f);
            }

            game_cmd_updview();
        }