예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <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;
            }
        }
예제 #3
0
 /// <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;
 }
예제 #4
0
 /// <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));
 }
예제 #5
0
 /// <summary>
 /// Gets the connector.
 /// </summary>
 /// <param name="point">The point.</param>
 /// <returns>ConnectorDrawing.</returns>
 internal ConnectorDrawing GetConnector(ConnectorDefinition point)
 {
     return _connectors[point];
 }
예제 #6
0
 /// <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);