Esempio n. 1
0
        //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
        //\ 
        //\ OTHER
        //\ 
        //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

        /// <summary>
        /// _gets the rect for all trackable objects.
        ///
        /// NOTE:   POSSIBLE OPTIMIZATION --STORE THIS RECT AND ONLY
        ///         UPDATE UPON CHANGES TO _trackableObjectComponents_list
        ///
        ///
        /// NOTE:   WHEN _trackableObjectComponents_list.Count == 0, THE CAMERA
        ///         WILL LOOK AT 0,0 BECAUSE OF ' new Rect();' and that is acceptable
        ///
        ///
        /// </summary>
        /// <returns>The rect for all trackable objects.</returns>
        private Rect _getRectForAllTrackableObjects(TrackingPriority aMinimumPriority)
        {
            //
            Bounds allTrackableObjects_bounds;
            Rect   allTrackableObjects_rect = new Rect();

            //********************************
            //MAKE A FILTERED LIST (ASSUME PRIORITY = NONE BY DEFAULT)
            //********************************
            List <TrackableObjectComponent> _prioritizedTrackableObjectComponents_list = _trackableObjectComponents_list;

            switch (aMinimumPriority)
            {
            case TrackingPriority.Low:
                _prioritizedTrackableObjectComponents_list = (List <TrackableObjectComponent>)_trackableObjectComponents_list.Where(
                    trackableObjectComponent => trackableObjectComponent.trackingPriority == TrackingPriority.Low || trackableObjectComponent.trackingPriority == TrackingPriority.High).ToList();
                break;

            case TrackingPriority.High:
                _prioritizedTrackableObjectComponents_list = (List <TrackableObjectComponent>)_trackableObjectComponents_list.Where(
                    trackableObjectComponent => trackableObjectComponent.trackingPriority == aMinimumPriority).ToList();
                break;
            }

            //********************************
            //CREATE A BOUNDS THAT ENCAPSULATES ALL OBJECTS OF INTEREST
            //********************************
            if (_prioritizedTrackableObjectComponents_list.Count > 0)
            {
                //ENCAPSULATE NEEDS US TO START WITH A NON-'EMPTY' INSTANCE
                allTrackableObjects_bounds = _prioritizedTrackableObjectComponents_list[0].getBoundsWithProjection(camera);
                //
                foreach (TrackableObjectComponent trackableObjectComponent in _prioritizedTrackableObjectComponents_list)
                {
                    allTrackableObjects_bounds.Encapsulate(trackableObjectComponent.getBoundsWithProjection(camera));
                }
                allTrackableObjects_rect = RectHelper.ConvertBoundsToRect(allTrackableObjects_bounds, _zPlaneCoordinate_float);
            }

            //
            return(RectHelper.Expand(allTrackableObjects_rect, _borderPadding_float));
        }