Exemple #1
0
        /// <summary>
        /// Set map positions to graphics in clustering layer by spiral
        /// </summary>
        /// <param name="count"></param>
        private void _SetSpiraledPositionsToExpandedClusterGraphics()
        {
            int    count   = _clusteringLayer.MapLayer.Graphics.Count;
            double radius  = MINIMAL_EXPANDED_CLUSTER_RADIUS;
            double dRadius = START_DELTA_RADIUS;

            double angle  = START_ANGLE;
            double dAngle = START_DELTA_ANGLE;

            for (int index = 0; index < count; index++)
            {
                double            dx      = radius * Math.Cos(angle);
                double            dy      = radius * Math.Sin(angle);
                DataGraphicObject graphic = (DataGraphicObject)_clusteringLayer.MapLayer.Graphics[index];
                MarkerSymbol      symbol  = (MarkerSymbol)graphic.Symbol;

                System.Windows.Point symbolPoint = _mapctrl.map.MapToScreen((MapPoint)graphic.Geometry);

                symbol.OffsetX = -(dx + _clusterCenter.Value.X - symbolPoint.X);
                symbol.OffsetY = -(dy + _clusterCenter.Value.Y - symbolPoint.Y);

                graphic.SetZIndex(ObjectLayer.FRONTZINDEX);

                radius  += dRadius;
                dRadius *= DELTA_RADIUS_MULTIPLIER;

                angle  += dAngle;
                dAngle *= DELTA_ANGLE_MULTIPLIER;
            }

            _expandedAreaRadius = radius + ADDITIONAL_EXPANDED_AREA;
        }
Exemple #2
0
        /// <summary>
        /// Set map positions to graphics in clustering layer by circle
        /// </summary>
        private void _SetCircledPositionsToExpandedClusterGraphics()
        {
            int count = _clusteringLayer.MapLayer.Graphics.Count;

            // do visual expand
            double sinus  = Math.Sin(Math.PI / count);
            double radius = DIST_BETWEEN_EXPANDED_SYMBOLS / (2 * sinus);

            if (radius < MINIMAL_EXPANDED_CLUSTER_RADIUS)
            {
                radius = MINIMAL_EXPANDED_CLUSTER_RADIUS;
            }

            _expandedAreaRadius = radius + ADDITIONAL_EXPANDED_AREA;

            for (int index = 0; index < count; index++)
            {
                double            angle   = (2 * Math.PI / count) * index;
                double            dx      = radius * Math.Cos(angle);
                double            dy      = radius * Math.Sin(angle);
                DataGraphicObject graphic = (DataGraphicObject)_clusteringLayer.MapLayer.Graphics[index];
                MarkerSymbol      symbol  = (MarkerSymbol)graphic.Symbol;

                System.Windows.Point symbolPoint = _mapctrl.map.MapToScreen((MapPoint)graphic.Geometry);

                symbol.OffsetX = dx - _clusterCenter.Value.X + symbolPoint.X;
                symbol.OffsetY = dy - _clusterCenter.Value.Y + symbolPoint.Y;

                graphic.SetZIndex(ObjectLayer.FRONTZINDEX);
            }
        }