Exemplo n.º 1
0
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Returns the graphic parts (drawing and z-order) of the visual depiction of this representation, plus any others needed to make it comprehensive.
        /// For example, a Relationship only is meaningful if, appart of showing its main-symbol and connectors, it also includes the connected symbols.
        /// </summary>
        public override IDictionary <Drawing, int> CreateIntegralGraphic()
        {
            var Result = new Dictionary <Drawing, int>();

            // Generate the connected symbols
            var Connectors       = this.VisualParts.CastAs <VisualConnector, VisualElement>();
            var ConnectedSymbols = Connectors.Where(conn => conn.OriginSymbol != conn.TargetSymbol)
                                   .Select(conn => (conn.OriginSymbol == this.MainSymbol
                                                         ? conn.TargetSymbol : conn.OriginSymbol));

            foreach (var AssociatedSymbol in ConnectedSymbols)
            {
                Result.Add(AssociatedSymbol.CreateDraw(null, false), AssociatedSymbol.ZOrder);
            }

            // Generate the relationship parts
            foreach (var Part in this.VisualParts.OrderBy(part => !(part is VisualSymbol)))
            {
                Result.Add(Part.CreateDraw(null, false), Part.ZOrder);
            }

            // Generate complements
            foreach (var Complement in this.MainSymbol.AttachedComplements)
            {
                Result.Add(Complement.CreateDraw(false), Complement.ZOrder);
            }

            return(Result);
        }
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Returns the graphic parts (drawing and z-order) of the visual depiction of this representation, plus any others needed to make it comprehensive.
        /// For example, a Relationship only is meaningful if, appart of showing its main-symbol and connectors, it also includes the connected symbols.
        /// </summary>
        public override IDictionary <Drawing, int> CreateIntegralGraphic()
        {
            var Result     = new Dictionary <Drawing, int>();
            var SourceView = this.MainSymbol.GetDisplayingView();

            // Generate the symbol
            Result.Add(this.MainSymbol.CreateDraw(null, false), this.MainSymbol.ZOrder);

            // Generate complements
            foreach (var Complement in this.MainSymbol.AttachedComplements)
            {
                Result.Add(Complement.CreateDraw(false), Complement.ZOrder);
            }

            return(Result);
        }