//************************************************************************* // Constructor: NodeXLVisual() // /// <summary> /// Initializes a new instance of the <see cref="NodeXLVisual" /> class. /// </summary> //************************************************************************* public NodeXLVisual() { m_oGraphDrawer = new GraphDrawer(this); AssertValid(); }
//************************************************************************* // Constructor: NodeXLVisual() // /// <summary> /// Initializes a new instance of the <see cref="NodeXLVisual" /> class. /// </summary> //************************************************************************* public NodeXLVisual() { m_oGraphDrawer = new GraphDrawer(this); AssertValid(); }
//************************************************************************* // Constructor: NodeXLControl() // /// <summary> /// Initializes a new instance of the <see cref="NodeXLControl" /> class. /// </summary> //************************************************************************* public NodeXLControl() { m_oGraph = new Graph(); m_oGraphDrawer = new GraphDrawer(this); m_oAsyncLayout = new FruchtermanReingoldLayout(); OnNewLayout(m_oAsyncLayout); m_oLastLayoutContext = new LayoutContext(System.Drawing.Rectangle.Empty); m_oLastGraphDrawingContext = null; m_eLayoutState = LayoutState.Stable; m_eMouseMode = MouseMode.Select; m_bMouseAlsoSelectsIncidentEdges = true; m_bAllowVertexDrag = true; m_oVerticesBeingDragged = null; m_oMarqueeBeingDragged = null; m_oTranslationBeingDragged = null; m_oSelectedVertices = new HashSet<IVertex>(); m_oSelectedEdges = new HashSet<IEdge>(); m_oCollapsedGroups = new Dictionary<String, IVertex>(); m_oDoubleClickedVertexInfo = null; m_bShowVertexToolTips = false; m_oLastMouseMoveLocation = new Point(-1, -1); // Create a helper object for displaying vertex tooltips. CreateVertexToolTipTracker(); m_oVertexToolTip = null; m_bGraphZoomCentered = false; this.AddLogicalChild(m_oGraphDrawer.VisualCollection); CreateTransforms(); // Prevent a focus rectangle from being drawn around the control when // it captures keyboard focus. The focus rectangle does not behave // properly when the layout and render transforms are applied -- // sometimes the rectangle disappears, and sometimes it gets magnified // by the render layout. this.FocusVisualStyle = null; // AssertValid(); }
//************************************************************************* // Method: TransferToGraphDrawer() // /// <summary> /// Transfers the settings to a <see cref="GraphDrawer" />. /// </summary> /// /// <param name="graphDrawer"> /// Graph drawer to transfer the settings to. /// </param> //************************************************************************* public void TransferToGraphDrawer( GraphDrawer graphDrawer ) { Debug.Assert(graphDrawer != null); AssertValid(); this.LabelUserSettings.TransferToGraphDrawer(graphDrawer); graphDrawer.BackColor = WpfGraphicsUtil.ColorToWpfColor(this.BackColor); EdgeDrawer oEdgeDrawer = graphDrawer.EdgeDrawer; VertexDrawer oVertexDrawer = graphDrawer.VertexDrawer; EdgeWidthConverter oEdgeWidthConverter = new EdgeWidthConverter(); AlphaConverter oAlphaConverter = new AlphaConverter(); oEdgeDrawer.Width = oEdgeWidthConverter.WorkbookToGraph(this.EdgeWidth); oEdgeDrawer.SelectedWidth = oEdgeWidthConverter.WorkbookToGraph(this.SelectedEdgeWidth); oEdgeDrawer.Color = WpfGraphicsUtil.ColorToWpfColor( Color.FromArgb(oAlphaConverter.WorkbookToGraphAsByte( this.EdgeAlpha), this.EdgeColor) ); oEdgeDrawer.SelectedColor = WpfGraphicsUtil.ColorToWpfColor( this.SelectedEdgeColor); oEdgeDrawer.RelativeArrowSize = this.RelativeArrowSize; oVertexDrawer.Shape = this.VertexShape; oVertexDrawer.Radius = ( new VertexRadiusConverter() ).WorkbookToGraph( this.VertexRadius); oVertexDrawer.Color = WpfGraphicsUtil.ColorToWpfColor( Color.FromArgb(oAlphaConverter.WorkbookToGraphAsByte( this.VertexAlpha), this.VertexColor) ); oVertexDrawer.SelectedColor = WpfGraphicsUtil.ColorToWpfColor( this.SelectedVertexColor); }