/// <summary> /// Add join point into context. If join point with given pointKey /// is already defined for owningDrawing, existing join point definition /// is returned. /// </summary> /// <param name="owningDrawing">Reference to drawing definition containing drawed join point.</param> /// <param name="pointKey">Key, providing access to join point.</param> /// <returns>Created or existing join point for given pointKey.</returns> public ConnectorDefinition DrawJoinPoint(DrawingReference owningDrawing, object pointKey) { JoinPointDefinitions joins; if (!_joinPointDefintions.TryGetValue(owningDrawing.DefinitionID, out joins)) { joins = new JoinPointDefinitions(); _joinPointDefintions[owningDrawing.DefinitionID] = joins; } ConnectorDefinition result; if (!joins.TryGetValue(pointKey, out result)) { result = new ConnectorDefinition(owningDrawing); joins[pointKey] = result; } return(result); }
/// <summary> /// Initializes a new instance of the <see cref="ConnectorDrawing" /> class. /// </summary> /// <param name="definition">The definition.</param> /// <param name="align">The align.</param> /// <param name="owningItem">The owning item.</param> public ConnectorDrawing(ConnectorDefinition definition, ConnectorAlign align, DiagramItem owningItem) { Align = align; Definition = definition; OwningItem = owningItem; var halfMargin = 10; switch (Align) { case ConnectorAlign.Top: case ConnectorAlign.Bottom: Margin = new Thickness(halfMargin, 0, halfMargin, 0); break; case ConnectorAlign.Left: case ConnectorAlign.Right: Margin = new Thickness(0, halfMargin, 0, halfMargin); break; } }
/// <summary> /// Initializes a new instance of the <see cref="JoinDefinition" /> class. /// </summary> /// <param name="from">From connector definition.</param> /// <param name="to">To connector definition.</param> public JoinDefinition(ConnectorDefinition from, ConnectorDefinition to) { From = from; To = to; }
/// <summary> /// Get <see cref="DiagramItem"/> that are referenced by given <see cref="ConnectorDefinition"/> /// </summary> /// <param name="connectorDefinition">Definition of connector</param> /// <returns>Referenced <see cref="DiagramItem"/> objects</returns> internal IEnumerable <DiagramItem> DefiningItems(ConnectorDefinition connectorDefinition) { return(_items.Get(connectorDefinition.Reference.DefinitionID)); }
/// <summary> /// Gets the connector. /// </summary> /// <param name="point">The point.</param> /// <returns>ConnectorDrawing.</returns> internal ConnectorDrawing GetConnector(ConnectorDefinition point) { return _connectors[point]; }
/// <summary> /// Creates the connector according to given definition. /// </summary> /// <param name="definition">The connector definition.</param> /// <param name="owningItem">The owning item.</param> /// <returns>Created drawing.</returns> public abstract ConnectorDrawing CreateConnector(ConnectorDefinition definition, DiagramItem owningItem);