Ejemplo n.º 1
0
        /// <summary>
        /// Return the bounds (relative to the diagram) for the specified person.
        /// </summary>
        public Rect GetNodeBounds(Shape person)
        {
            Rect bounds = Rect.Empty;

            if (person != null && personLookup.ContainsKey(person))
            {
                DiagramConnectorNode connector = personLookup[person];
                bounds = new Rect(connector.TopLeft.X, connector.TopLeft.Y,
                                  connector.Node.ActualWidth, connector.Node.ActualHeight);
            }

            return(bounds);
        }
Ejemplo n.º 2
0
        public MarriedDiagramConnector(bool isMarried,
                                       DiagramConnectorNode startConnector, DiagramConnectorNode endConnector) :
            base(startConnector, endConnector)
        {
            // Store if curretnly married or former.
            married = isMarried;

            // Get resources used to draw text.
            connectionTextSize  = (double)Application.Current.TryFindResource("ConnectionTextSize");
            connectionTextColor = (Color)Application.Current.TryFindResource("ConnectionTextColor");
            connectionTextFont  = (FontFamily)Application.Current.TryFindResource("ConnectionTextFont");

            // Get resourced used to draw the connection line.
            this.ResourcePen = (Pen)Application.Current.TryFindResource(
                married ? "MarriedConnectionPen" : "FormerConnectionPen");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Add the spouses to the specified row and group.
        /// </summary>
        private void AddSpouseNodes(Shape person, DiagramRow row,
                                    DiagramGroup group, Collection <Shape> spouses,
                                    NodeType nodeType, double scale, bool married)
        {
            foreach (Shape spouse in spouses)
            {
                if (!personLookup.ContainsKey(spouse))
                {
                    // Spouse node.
                    DiagramNode node = CreateNode(spouse, nodeType, true, scale);
                    group.Add(node);

                    // Add connection.
                    DiagramConnectorNode connectorNode = new DiagramConnectorNode(node, group, row);
                    personLookup.Add(node.Shape, connectorNode);
                    connections.Add(new MarriedDiagramConnector(married, personLookup[person], connectorNode));
                }
            }
        }
Ejemplo n.º 4
0
 public ChildDiagramConnector(DiagramConnectorNode startConnector,
                              DiagramConnectorNode endConnector) : base(startConnector, endConnector)
 {
     // Get the pen that is used to draw the connection line.
     this.ResourcePen = (Pen)Application.Current.TryFindResource("ChildConnectionPen");
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Consturctor that specifies the two nodes that are connected.
 /// </summary>
 protected DiagramConnector(DiagramConnectorNode startConnector,
                            DiagramConnectorNode endConnector)
 {
     this.start = startConnector;
     this.end   = endConnector;
 }