Esempio n. 1
0
    void Start()
    {
        VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);
        VuforiaARController.Instance.RegisterOnPauseCallback(OnVuforiaPaused);
        DeviceTrackerARController.Instance.RegisterTrackerStartedCallback(OnTrackerStarted);
        DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged);

        this.planeFinder.HitTestMode = HitTestMode.AUTOMATIC;

        this.productPlacement = FindObjectOfType <ProductPlacement>();
        this.touchHandler     = FindObjectOfType <TouchHandler>();
        this.groundPlaneUI    = FindObjectOfType <GroundPlaneUI>();

        this.planeAnchor     = this.planeAugmentation.GetComponentInParent <AnchorBehaviour>();
        this.midAirAnchor    = this.midAirAugmentation.GetComponentInParent <AnchorBehaviour>();
        this.placementAnchor = this.placementAugmentation.GetComponentInParent <AnchorBehaviour>();

        UtilityHelper.EnableRendererColliderCanvas(this.planeAugmentation, false);
        UtilityHelper.EnableRendererColliderCanvas(this.midAirAugmentation, false);
        UtilityHelper.EnableRendererColliderCanvas(this.placementAugmentation, false);

        // Setup a timer to restart the DeviceTracker if tracking does not receive
        // status change from StatusInfo.RELOCALIZATION after 10 seconds.
        this.timer           = new Timer(10000);
        this.timer.Elapsed  += TimerFinished;
        this.timer.AutoReset = false;
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        m_planeManagerA = ARContentA.GetComponentInChildren <PlaneManager>();
        m_planeManagerB = ARContentB.GetComponentInChildren <PlaneManager>();

        m_anchorInputListenerBehaviourA = ARContentA.GetComponentInChildren <AnchorInputListenerBehaviour>();
        m_anchorInputListenerBehaviourB = ARContentB.GetComponentInChildren <AnchorInputListenerBehaviour>();

        m_planeFinderBehaviourA = ARContentA.GetComponentInChildren <PlaneFinderBehaviour>();
        m_planeFinderBehaviourB = ARContentB.GetComponentInChildren <PlaneFinderBehaviour>();

        m_contentPositioningBehaviourA = ARContentA.GetComponentInChildren <ContentPositioningBehaviour>();
        m_contentPositioningBehaviourB = ARContentB.GetComponentInChildren <ContentPositioningBehaviour>();

        m_anchorBehaviourA = ARContentA.GetComponentInChildren <AnchorBehaviour>();
        m_anchorBehaviourB = ARContentB.GetComponentInChildren <AnchorBehaviour>();

        m_productPlacementA = ARContentA.GetComponentInChildren <ProductPlacement>();
        m_productPlacementB = ARContentB.GetComponentInChildren <ProductPlacement>();

        m_touchHandlerA = ARContentA.GetComponentInChildren <TouchHandler>();
        m_touchHandlerB = ARContentB.GetComponentInChildren <TouchHandler>();

        TurnOffBehaviour(false);
        TurnOffBehaviour(true);
        TurnOffBehaviour(false);
    }
Esempio n. 3
0
 void Start()
 {
     m_AugmentationObject       = GameObject.Find("CopyShoe").transform;
     cachedAugmentationScale    = m_AugmentationObject.localScale.x;
     cachedAugmentationRotation = m_AugmentationObject.localEulerAngles;
     m_ProductPlacement         = FindObjectOfType <ProductPlacement>();
 }
        public static void DrawProduct(Canvas canvas, ProductPlacement placement)
        {
            //Haal de bestandsnaam van de foto op of gebruik de default
            Product product = placement.Product;
            int     x       = placement.X;
            int     y       = placement.Y;

            string?photo        = product.Photo ?? "placeholder.png";
            int    actualWidth  = placement.Rotation % 180 == 0 ? product.Width : product.Length;
            int    actualLength = placement.Rotation % 180 == 0 ? product.Length : product.Width;
            // Veranderd de rotatie van het product
            TransformedBitmap tempBitmap = new TransformedBitmap();

            tempBitmap.BeginInit();
            BitmapImage source = new BitmapImage(new Uri(Environment.CurrentDirectory + $"/Resources/Images/{photo}"));

            tempBitmap.Source = source;
            RotateTransform transform = new RotateTransform(placement.Rotation, source.Width / 2, source.Height / 2);

            tempBitmap.Transform = transform;
            tempBitmap.EndInit();

            Image image = new Image {
                Source = tempBitmap,
                Height = actualLength,
                Width  = actualWidth
            };

            Canvas.SetTop(image, y);
            Canvas.SetLeft(image, x);
            // Voeg product toe aan canvas
            canvas.Children.Add(image);
        }
    void Start()
    {
        this.title.text = TitleProductPlacement;

        this.productPlacement = FindObjectOfType <ProductPlacement>();
        this.touchHandler     = FindObjectOfType <TouchHandler>();
        this.graphicRayCaster = FindObjectOfType <GraphicRaycaster>();
        this.eventSystem      = FindObjectOfType <EventSystem>();

        DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged);
    }
Esempio n. 6
0
    void Start()
    {
        m_ProductPlacement  = FindObjectOfType <ProductPlacement>();
        m_GraphicRayCasters = FindObjectsOfType <GraphicRaycaster>();
        m_EventSystem       = FindObjectOfType <EventSystem>();

        m_ProductPlacement.enabled = true;
        shoePuttingSound           = GameObject.Find("ShoeParent").GetComponent <AudioSource>();
        shadowPlane = GameObject.Find("ShadowPlane");

        InitializeButtons();
        ChangeButtonStatus();
    }
        /// <summary>
        /// Fyller listan med redan existerande placeringar
        /// </summary>
        private void LoadExistingPlacements()
        {
            foreach (Employee e in EmployeeList)
            {
                foreach (ProductPlacement pp in ProductManagement.Instance.GetProductPlacementsByEmployeeAndDepartment(e, DepartmentID))
                {
                    foreach (DataItemProduct DIP in MyList)
                    {
                        if (DIP.EmployeeID.Equals(e.EmployeeID))
                        {
                            DIP.DataList.Add(pp);

                            //Create column if it doesn't exist
                            if (!ColumnExists(pp.Product.ProductName))
                            {
                                DataGridTextColumn productColumn = new DataGridTextColumn {
                                    Header = pp.Product.ProductName
                                };
                                productColumn.Binding = new Binding("DataList[" + dgProductPlacements.Columns.Count + "].ProductAllocate");
                                dgProductPlacements.Columns.Add(productColumn);
                                SelectedProducts.Add(pp.Product);
                            }
                        }
                    }
                }
            }

            foreach (DataItemProduct DIP in MyList)
            {
                foreach (DataGridTextColumn DGTC in dgProductPlacements.Columns)
                {
                    ProductPlacement tempPP = DIP.DataList.SingleOrDefault(p => p.Product.ProductName.Equals(DGTC.Header.ToString()));

                    if (tempPP == null)
                    {
                        Product          tempProd     = ProductManagement.Instance.GetProductByName(DGTC.Header.ToString());
                        ProductPlacement newPlacement = new ProductPlacement
                        {
                            EmployeeID      = DIP.EmployeeID,
                            Product         = tempProd,
                            ProductID       = tempProd.ProductID,
                            ExpenseBudgetID = DateTime.Now.Year,
                            ProductAllocate = 0
                        };
                        DIP.DataList.Add(newPlacement);
                        ProductPlacementList.Add(newPlacement);
                    }
                }
            }
        }
        private void CreateColumn(Product p)
        {
            DataGridTextColumn productColumn = new DataGridTextColumn {
                Header = p.ProductName
            };

            foreach (DataItemProduct di in MyList)
            {
                ProductPlacement pp = new ProductPlacement {
                    EmployeeID = di.EmployeeID, ProductID = p.ProductID, ProductAllocate = 0
                };
                di.DataList.Add(pp);
                ProductPlacementList.Add(pp);
            }
            productColumn.Binding = new Binding("DataList[" + dgProductPlacements.Columns.Count + "].ProductAllocate");
            dgProductPlacements.Columns.Add(productColumn);
        }
    void Start()
    {
        //m_ResetButton.interactable = /*m_MidAirToggle.interactable =
        //  m_GroundToggle.interactable =*/ m_PlacementToggle.interactable = false;

        //m_Title.text = TITLE_PLACEMENT;
        //m_TrackerStatus.text = "";
        //m_TrackerStatusImage = m_TrackerStatus.GetComponentInParent<Image>();

        m_ProductPlacement = FindObjectOfType <ProductPlacement>();
        m_TouchHandler     = FindObjectOfType <TouchHandler>();

        m_GraphicRayCaster = FindObjectOfType <GraphicRaycaster>();
        m_EventSystem      = FindObjectOfType <EventSystem>();

        //Vuforia.DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged);
    }
    void Start()
    {
        VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);
        VuforiaARController.Instance.RegisterOnPauseCallback(OnVuforiaPaused);
        DeviceTrackerARController.Instance.RegisterTrackerStartedCallback(OnTrackerStarted);
        DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged);

        m_PlaneFinder.HitTestMode = HitTestMode.AUTOMATIC;

        m_ProductPlacement = m_PlacementAugmentation.GetComponentInChildren <ProductPlacement>();
        m_TouchHandler     = m_PlacementAugmentation.GetComponentInChildren <TouchHandler>();
        m_PlacementAnchor  = m_PlacementAugmentation.GetComponentInParent <AnchorBehaviour>();

        m_GroundPlaneUI = FindObjectOfType <GroundPlaneUI>();

        arRCM = GameObject.FindGameObjectWithTag("FXCanvas").GetComponent <ARRenderedCanvasManager>();

        UtilityHelper.EnableRendererColliderCanvas(m_PlacementAugmentation, false);
    }
Esempio n. 11
0
    static bool anchorExists; // backs public AnchorExists property
    #endregion                // PRIVATE_MEMBERS


    #region MONOBEHAVIOUR_METHODS

    void Start()
    {
        VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);
        VuforiaARController.Instance.RegisterOnPauseCallback(OnVuforiaPaused);
        DeviceTrackerARController.Instance.RegisterTrackerStartedCallback(OnTrackerStarted);
        DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged);

        m_ProductPlacement = FindObjectOfType <ProductPlacement>();
        m_TouchHandler     = FindObjectOfType <TouchHandler>();
        m_GroundPlaneUI    = FindObjectOfType <GroundPlaneUI>();

        m_MidAirAnchor = m_MidAirAugmentation.GetComponentInParent <AnchorBehaviour>();
        Debug.Log("MID AIR ANCHOR:   " + m_MidAirAnchor.ToString());

        UtilityHelper.EnableRendererColliderCanvas(m_MidAirAugmentation, false);

        if (planeMode == PlaneMode.MIDAIR)
        {
            m_MidAirPositioner.enabled = true;
        }
    }
Esempio n. 12
0
    void Start()
    {
        VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);
        VuforiaARController.Instance.RegisterOnPauseCallback(OnVuforiaPaused);
        DeviceTrackerARController.Instance.RegisterTrackerStartedCallback(OnTrackerStarted);
        DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged);

        m_PlaneFinderBehaviour.HitTestMode = HitTestMode.AUTOMATIC;

        m_ProductPlacement = FindObjectOfType <ProductPlacement>();
        m_TouchHandler     = FindObjectOfType <TouchHandler>();
        m_GroundPlaneUI    = FindObjectOfType <GroundPlaneUI>();

        copyShoe.transform.SetParent(m_ProductPlacement.gameObject.transform);
        #if (UNITY_IOS || !UNITY_ANDROID)
        copyShoe.GetComponentInChildren <Transform>().transform.localScale = new Vector3(2.5f, 2.5f, 2.5f);
        #elif UNITY_ANDROID
        copyShoe.GetComponentInChildren <Transform>().transform.localScale = new Vector3(6f, 6f, 6f);
        #endif
        copyShoe.GetComponentsInChildren <Transform>()[1].localRotation = Quaternion.Euler(0, 0, 0);

        m_PlacementAugmentation = copyShoe.transform.parent.gameObject;

        m_PlacementAnchor = m_PlacementAugmentation.GetComponentInParent <AnchorBehaviour>();

        UtilityHelper.EnableRendererColliderCanvas(m_PlacementAugmentation, false);
        m_PlaneFinder.SetActive(false);
        shadowPlane = GameObject.Find("ShadowPlane");
        shadowPlane.transform.SetParent(copyShoe.transform);
        shadowPlane.transform.localPosition = new Vector3(0, 0, 0);
        #if (UNITY_IOS || !UNITY_ANDROID)
        shadowPlane.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
        shadowPlane.transform.position  -= Vector3.up * 0.2f;
        #elif UNITY_ANDROID
        shadowPlane.transform.localScale = new Vector3(0.22f, 0.22f, 0.22f);
        shadowPlane.transform.position  -= Vector3.up * 0.4f;
        #endif
        shadowPlane.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
        m_ProductPlacement.SetProductAnchor(null);
    }
Esempio n. 13
0
    static bool anchorExists; // backs public AnchorExists property
    #endregion                // PRIVATE_MEMBERS


    #region MONOBEHAVIOUR_METHODS

    void Start()
    {
        VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);
        VuforiaARController.Instance.RegisterOnPauseCallback(OnVuforiaPaused);
        DeviceTrackerARController.Instance.RegisterTrackerStartedCallback(OnTrackerStarted);
        DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged);

        m_PlaneFinder.HitTestMode = HitTestMode.AUTOMATIC;

        m_ProductPlacement = FindObjectOfType <ProductPlacement>();
        m_TouchHandler     = FindObjectOfType <TouchHandler>();
        m_GroundPlaneUI    = FindObjectOfType <GroundPlaneUI>();

        m_PlaneAnchor     = m_PlaneAugmentation.GetComponentInParent <AnchorBehaviour>();
        m_MidAirAnchor    = m_MidAirAugmentation.GetComponentInParent <AnchorBehaviour>();
        m_PlacementAnchor = m_PlacementAugmentation.GetComponentInParent <AnchorBehaviour>();

        UtilityHelper.EnableRendererColliderCanvas(m_PlaneAugmentation, false);
        UtilityHelper.EnableRendererColliderCanvas(m_MidAirAugmentation, false);
        UtilityHelper.EnableRendererColliderCanvas(m_PlacementAugmentation, false);

        SetNoneMode();
    }
Esempio n. 14
0
        /**
         * Loopt alle mogelijke plaatsingen door om vervolgens de kamer zo vol mogelijk te krijgen
         */
        public static void GenerateLayout(this DesignEditor designer)
        {
            Polygon room = designer.Design.Room.GetPoly();
            //TODO Pakt momententeel nog het eerste product om te plaatsen
            Product product = designer.Products.First();

            //Pakt de minimale en maximale punten
            Position min = room.Min();
            Position max = room.Max();

            //Berekend de afstand per stap door middel van de afstand tussen de 2 boudning hoeken punten,
            //als dit te groot wordt pakt die de product lengte of hoogte ligt er aan welke kleiner is
            int accuracy = Math.Min((int)min.Distance(max) / 200, Math.Min(product.Length, product.Width));

            //Maakt een nieuwe thread aan waar de dingen gecontrolleerd worden zodat je live de producten ziet plaatsen
            new Thread(
                () => {
                //Loopt door alle coordinaten binnen de ruimte boudning box heen met stappen van accuracy
                for (int y = min.Y + 1; y < max.Y; y += accuracy)
                {
                    for (int x = min.X + 1; x < max.X; x += accuracy)
                    {
                        Position position = new Position(x, y);

                        //Als het punt binnen de ruimte zit controlleerd die of deze genoeg afstand heeft van alles
                        if (room.Inside(product.GetPoly().Offset(position)))
                        {
                            ProductPlacement placement = new ProductPlacement(position, product, null);
                            bool success = true;
                            //Loopt alle plaatsingen langs om te kijken of die veilig is om te plaatsen
                            for (int i = 0; i < designer.ProductPlacements.Count; i++)
                            {
                                ProductPlacement place = designer.ProductPlacements[i];
                                if (place.GetPoly().IsSafe(placement.GetPoly()))
                                {
                                    continue;
                                }

                                success = false;
                                break;
                            }

                            //Kijkt of die ver genoeg van de lijn is
                            if (success && designer._route != null && designer._route.Count >= 2)
                            {
                                (Position p1, Position p2) = placement.GetPoly().MinDistance(designer._route);
                                if (p1.Distance(p2) < 150)
                                {
                                    success = false;
                                }
                            }

                            //Als dit allemaal klopt voegd die het product toe;
                            if (success)
                            {
                                designer.ProductPlacements.Add(placement);

                                designer.AddToOverview(placement.Product);

                                designer.Editor.Dispatcher.Invoke(
                                    () => {
                                    designer.DrawProduct(placement, designer.ProductPlacements.IndexOf(placement));
                                }
                                    );
                            }
                        }
                    }
                }

                designer.OnPropertyChanged();
            }
                ).Start();
        }