示例#1
0
        /// <summary> Performs transition from one space to another. </summary>
        private void DoTransition(Space from, Space to)
        {
            bool isFromTopSpace      = from.TileController.LodRange.Maximum < to.TileController.LodRange.Maximum;
            bool hadRunningAnimation = from.Animator.IsRunningAnimation;
            var  coordinate          = from.TileController.Coordinate;

            // exit from old space
            from.Leave();

            // make transition
            if (isFromTopSpace)
            {
                to.EnterTop(coordinate);
            }
            else
            {
                to.EnterBottom(coordinate);
            }

            // continue old space animation if it is running
            if (hadRunningAnimation)
            {
                to.Animator.ContinueFrom(from.Animator);
            }
            // otherwise make instant transition
            else
            {
                var zoom = isFromTopSpace
                    ? to.TileController.LodRange.Minimum
                    : to.TileController.LodRange.Maximum + 0.99f;
                to.Animator.AnimateTo(coordinate, zoom, TimeSpan.Zero, new LinearInterpolator());
            }
        }
示例#2
0
        /// <summary> Performs initial space transition based on zoom level and lod ranges. </summary>
        private void DoTransition(GeoCoordinate coordinate, float zoom)
        {
            for (int i = 0; i < _lods.Count; ++i)
            {
                if (_lods[i].Contains((int)zoom))
                {
                    _currentSpaceIndex = i;
                    break;
                }
            }

            Space to = _spaces[_currentSpaceIndex];

            // enter from top by default
            to.EnterTop(coordinate);
            // make instant animation
            to.Animator.AnimateTo(coordinate, zoom, TimeSpan.Zero, new LinearInterpolator());
        }