Exemplo n.º 1
0
        private void ApplyShapeLabelStrategy(D2DShape shape)
        {
            if (this.shapeLabelLayoutStrategyCache == null)
            {
                return;
            }

            var context = new MapShapeLabelLayoutContext()
            {
                Shape                = shape.Model as IMapShape,
                ZoomLevel            = this.Owner.ZoomLevel,
                Label                = shape.Label.Text,
                Center               = this.Owner.Center,
                RenderLocationOrigin = new Point(0.5, 0.5)
            };

            this.shapeLabelLayoutStrategyCache.Process(context, this);

            shape.LabelVisibility = context.Visibility;
            if (context.RenderLocation.HasValue)
            {
                var position = this.Owner.ConvertGeographicToPixelCoordinate(context.RenderLocation.Value);
                shape.LabelRenderPosition = position;
            }
            if (context.RenderLocationOrigin.HasValue)
            {
                shape.LabelRenderPositionOrigin = context.RenderLocationOrigin.Value;
            }
        }
 /// <summary>
 /// Performs the core logic behind the <see cref="Process"/> routine.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="container"></param>
 protected virtual void ProcessCore(MapShapeLabelLayoutContext context, MapShapeLayer container)
 {
 }
 /// <summary>
 /// Applies the custom layout logic given the provided layout context and layer.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="container"></param>
 public void Process(MapShapeLabelLayoutContext context, MapShapeLayer container)
 {
     this.ProcessCore(context, container);
 }