Example #1
0
 /// <summary>
 /// Create a new instance that decorates the <paramref name="coreImpl"/>
 /// </summary>
 /// <param name="coreImpl">The core indicator that is again decorated by this instance</param>
 public BezierSelectionIndicatorInstaller([CanBeNull] ISelectionIndicatorInstaller coreImpl)
 {
     this.coreImpl = coreImpl;
     decorator     = new EdgeStyleDecorationInstaller {
         EdgeStyle = SelectionDecoratorStyle, ZoomPolicy = StyleDecorationZoomPolicy.ViewCoordinates
     };
 }
Example #2
0
        private void InitializeDecoration()
        {
            nodeDecorationInstaller = new NodeStyleDecorationInstaller
            {
                NodeStyle = new ShapeNodeStyle {
                    Shape = ShapeNodeShape.Rectangle, Pen = Pens.DeepSkyBlue, Brush = Brushes.Transparent
                },
                Margins = new InsetsD(10.0)
            };
            edgeDecorationInstaller = new EdgeStyleDecorationInstaller
            {
                EdgeStyle = new PolylineEdgeStyle {
                    Pen = new Pen(Brushes.DeepSkyBlue, 3)
                }
            };
            labelDecorationInstaller = new LabelStyleDecorationInstaller
            {
                LabelStyle = new NodeStyleLabelStyleAdapter(
                    new ShapeNodeStyle {
                    Shape = ShapeNodeShape.RoundRectangle, Pen = Pens.DeepSkyBlue, Brush = Brushes.Transparent
                },
                    VoidLabelStyle.Instance),
                Margins = new InsetsD(5.0)
            };

            styleDecorationZoomPolicies = new[]
            {
                StyleDecorationZoomPolicy.Mixed,
                StyleDecorationZoomPolicy.WorldCoordinates,
                StyleDecorationZoomPolicy.ViewCoordinates
            };
            zoomModeComboBox.ComboBox.DataSource = styleDecorationZoomPolicies;
            zoomModeComboBox.SelectedIndex       = 0;
        }
        private void InitializeHighlightStyles()
        {
            // we want to create a non-default nice highlight styling
            // for the hover highlight, create semi transparent orange stroke first
            var orangeRed = Colors.OrangeRed;
            var orangePen = new Pen(new SolidColorBrush(Color.FromArgb(220, orangeRed.R, orangeRed.G, orangeRed.B)), 3);

            // freeze it for slightly improved performance
            orangePen.Freeze();

            // now decorate the nodes and edges with custom hover highlight styles
            var decorator = graphControl.Graph.GetDecorator();

            // nodes should be given a rectangular orange rectangle highlight shape
            var highlightShape = new ShapeNodeStyle {
                Shape = ShapeNodeShape.RoundRectangle,
                Pen   = orangePen,
                Brush = null
            };

            var nodeStyleHighlight = new NodeStyleDecorationInstaller {
                NodeStyle = highlightShape,
                // that should be slightly larger than the real node
                Margins = new InsetsD(5),
                // but have a fixed size in the view coordinates
                ZoomPolicy = StyleDecorationZoomPolicy.ViewCoordinates
            };

            // register it as the default implementation for all nodes
            decorator.NodeDecorator.HighlightDecorator.SetImplementation(nodeStyleHighlight);

            // a similar style for the edges, however cropped by the highlight's insets
            var dummyCroppingArrow = new Arrow {
                Type       = ArrowType.None,
                CropLength = 5
            };
            var edgeStyle = new PolylineEdgeStyle {
                Pen         = orangePen,
                TargetArrow = dummyCroppingArrow,
                SourceArrow = dummyCroppingArrow
            };
            var edgeStyleHighlight = new EdgeStyleDecorationInstaller {
                EdgeStyle  = edgeStyle,
                ZoomPolicy = StyleDecorationZoomPolicy.ViewCoordinates
            };

            decorator.EdgeDecorator.HighlightDecorator.SetImplementation(edgeStyleHighlight);
        }