//! Заполняет граф диалога нужными узлами
        void fillDialogGraphView(CDialog root)
        {
            // Initialize, and create a layer for the edges (always underneath the nodes)
            this.DialogShower.Layer.RemoveAllChildren();
            nodeLayer = new PNodeList();
            edgeLayer = new PLayer();

            this.DialogShower.Root.AddChild(edgeLayer);
            this.DialogShower.Camera.AddLayer(0, edgeLayer);

            // Show root node
            float rootx    = (float)(this.ClientSize.Width / 5);
            float rooty    = (float)(this.ClientSize.Height / 5);
            SizeF size     = CalcEllipsisSizeForNode(root.DialogID);
            PNode rootNode = PPath.CreateEllipse(rootx, rooty, size.Width, size.Height);

            rootNode.Brush = Brushes.Green;

            PText rootText = new PText(root.DialogID.ToString());

            rootText.Pickable = false;
            rootText.X        = rootNode.X + 15;
            rootText.Y        = rootNode.Y + 10;
            rootNode.Tag      = new ArrayList();

            //          ((ArrayList)rootNode.Tag).Add(root.DialogID);
            rootNode.AddChild(rootText);
            nodeLayer.Add(rootNode);
            if (!graphs.Keys.Contains(rootNode))
            {
                graphs.Add(rootNode, new GraphProperties(root.DialogID));
            }
            this.fillDialogSubgraphView(root, rootNode, 1, ref edgeLayer, ref nodeLayer, false);//, rootNode, edgeLayer);
            this.DialogShower.Layer.AddChildren(nodeLayer);
        }
 /// <summary>
 /// Constructs a new PSelectionEventHandler that will handle selection for the
 /// children of the given selectable parent node.
 /// </summary>
 /// <param name="marqueeParent">
 /// The node to which the event handler dynamically adds a marquee (temporarily)
 /// to represent the area being selected.
 /// </param>
 /// <param name="selectableParent">
 /// The node whose children will be selected by this event handler.
 /// </param>
 public PSelectionEventHandler(PNode marqueeParent, PNode selectableParent)
 {
     this.marqueeParent = marqueeParent;
     selectableParents  = new PNodeList();
     selectableParents.Add(selectableParent);
     Init();
 }
Exemple #3
0
        /// <summary>
        /// Gets the nearest neighbor in the specified direction.
        /// </summary>
        /// <param name="aDirection">
        /// The direction in which to find the nearest neighbor.
        /// </param>
        /// <returns>The nearest neighbor in the specified direction.</returns>
        public virtual PNode GetNeighborInDirection(Direction aDirection)
        {
            if (focusNode == null)
            {
                return(null);
            }

            NODE_TO_GLOBAL_NODE_CENTER_MAPPING.Clear();

            PointF highlightCenter = PUtil.CenterOfRectangle(focusNode.GlobalFullBounds);

            NODE_TO_GLOBAL_NODE_CENTER_MAPPING.Add(focusNode, highlightCenter);

            PNodeList l = GetNeighbors();

            SortNodesByDistanceFromPoint(l, highlightCenter);

            foreach (PNode each in l)
            {
                if (NodeIsNeighborInDirection(each, aDirection))
                {
                    return(each);
                }
            }

            return(null);
        }
Exemple #4
0
 public override void RemoveChildren(PNodeList childrenNodes)
 {
     base.RemoveChildren(childrenNodes);
     foreach (PNode child in childrenNodes)
     {
         RemoveChildReference(child);
     }
 }
Exemple #5
0
        public void RotateNodes()
        {
            PNodeList nodes = Canvas.Layer.ChildrenReference;

            foreach (PNode each in nodes)
            {
                each.RotateBy(2);
            }
        }
        /// <summary>
        /// This method paints the bounds and full bounds of nodes when the appropriate debug
        /// flags are set.
        /// </summary>
        /// <param name="paintContext">
        /// The paint context to use for painting debug information.
        /// </param>
        /// <remarks>
        /// Setting debugBounds and/or debugFullBounds flags is useful for visual debugging.
        /// </remarks>
        protected virtual void PaintDebugInfo(PPaintContext paintContext)
        {
            if (PDebug.DebugBounds || PDebug.DebugFullBounds)
            {
                Graphics2D g = paintContext.Graphics;

                PNodeList  nodes      = new PNodeList();
                RectangleF nodeBounds = RectangleF.Empty;

                for (int i = 0; i < LayerCount; i++)
                {
                    GetLayer(i).GetAllNodes(null, nodes);
                }

                GetAllNodes(null, nodes);

                foreach (PNode each in nodes)
                {
                    if (PDebug.DebugBounds)
                    {
                        nodeBounds = each.Bounds;

                        if (!nodeBounds.IsEmpty)
                        {
                            nodeBounds = each.LocalToGlobal(nodeBounds);
                            nodeBounds = GlobalToLocal(nodeBounds);
                            if (each == this || each.IsDescendentOf(this))
                            {
                                nodeBounds = LocalToView(nodeBounds);
                            }
                            g.DrawRectangle(boundsPen, nodeBounds.X, nodeBounds.Y, nodeBounds.Width, nodeBounds.Height);
                        }
                    }

                    if (PDebug.DebugFullBounds)
                    {
                        nodeBounds = each.FullBounds;

                        if (!nodeBounds.IsEmpty)
                        {
                            if (each.Parent != null)
                            {
                                nodeBounds = each.Parent.LocalToGlobal(nodeBounds);
                            }
                            nodeBounds = GlobalToLocal(nodeBounds);
                            if (each == this || each.IsDescendentOf(this))
                            {
                                nodeBounds = LocalToView(nodeBounds);
                            }
                            //g.FillRectangle(fullBoundsBrush, nodeBounds);
                            g.DrawRectangle(fullBoundsPen, nodeBounds);
                        }
                    }
                }
            }
        }
Exemple #7
0
        /// <summary>
        /// Step activities and update all associated canvases immediately.
        /// </summary>
        protected void ProcessActivitiesNow()
        {
            ProcessInputs();

            PNodeList nodes = GetAllNodes(PUtil.CAMERA_WITH_CANVAS_FILTER, null);

            foreach (PCamera each in nodes)
            {
                each.Canvas.PaintImmediately();
            }
        }
Exemple #8
0
        /// <summary>
        /// This method paints the bounds and full bounds of nodes when the appropriate debug
        /// flags are set.
        /// </summary>
        /// <param name="paintContext">
        /// The paint context to use for painting debug information.
        /// </param>
        /// <remarks>
        /// Setting debugBounds and/or debugFullBounds flags is useful for visual debugging.
        /// </remarks>
        protected virtual void PaintDebugInfo(PPaintContext paintContext)
        {
            if (PDebug.DebugBounds || PDebug.DebugFullBounds)
            {
                PNodeList   nodes      = new PNodeList();
                RectangleFx nodeBounds = RectangleFx.Empty;

                for (int i = 0; i < LayerCount; i++)
                {
                    GetLayer(i).GetAllNodes(null, nodes);
                }

                GetAllNodes(null, nodes);

                foreach (PNode each in nodes)
                {
                    if (PDebug.DebugBounds)
                    {
                        nodeBounds = each.Bounds;

                        if (!nodeBounds.IsEmpty)
                        {
                            nodeBounds = each.LocalToGlobal(nodeBounds);
                            nodeBounds = GlobalToLocal(nodeBounds);
                            if (each == this || each.IsDescendentOf(this))
                            {
                                nodeBounds = LocalToView(nodeBounds);
                            }
                            PaintDebugBounds(paintContext, boundsPen, nodeBounds);
                        }
                    }

                    if (PDebug.DebugFullBounds)
                    {
                        nodeBounds = each.FullBounds;

                        if (!nodeBounds.IsEmpty)
                        {
                            if (each.Parent != null)
                            {
                                nodeBounds = each.Parent.LocalToGlobal(nodeBounds);
                            }
                            nodeBounds = GlobalToLocal(nodeBounds);
                            if (each == this || each.IsDescendentOf(this))
                            {
                                nodeBounds = LocalToView(nodeBounds);
                            }
                            PaintDebugFullBounds(paintContext, fullBoundsBrush, nodeBounds);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Flips this bounds handle or any if it's siblings if necessary.
        /// </summary>
        /// <param name="flipX">
        /// True if bounds handles should be flipped in the x-direction.
        /// </param>
        /// <param name="flipY">
        /// True if bounds handles should be flipped in the y-direction.
        /// </param>
        /// <remarks>
        /// While dragging the bounds handles, the node being resized may cross over itself and
        /// become reversed (if it is dragged through zero-width or zero-height).  In this case,
        /// the locators for some of the bounds handles will have to be flipped to the opposite
        /// side.
        /// </remarks>
        public virtual void FlipSiblingBoundsHandles(bool flipX, bool flipY)
        {
            PNodeList list = Parent.ChildrenReference;

            foreach (PNode each in list)
            {
                if (each is PBoundsHandle)
                {
                    ((PBoundsHandle)each).FlipHandleIfNeeded(flipX, flipY);
                }
            }
        }
Exemple #10
0
            public override void LayoutChildren()
            {
                float xOffset = 0;
                float yOffset = 0;

                PNodeList children = this.ChildrenReference;

                foreach (PNode each in children)
                {
                    each.SetOffset(xOffset - each.X, yOffset);
                    xOffset += each.Width;
                }
            }
        /// <summary>
        /// Update the marquee bounds based on the given event data.
        /// </summary>
        /// <param name="e">A PInputEventArgs that contains the event data.</param>
        protected virtual void UpdateMarquee(PInputEventArgs e)
        {
            RectangleF r = RectangleF.Empty;

            if (marqueeParent is PCamera)
            {
                r = PUtil.AddPointToRect(r, canvasPressPt);
                r = PUtil.AddPointToRect(r, e.CanvasPosition);
            }
            else
            {
                r = PUtil.AddPointToRect(r, presspt);
                r = PUtil.AddPointToRect(r, e.Position);
            }

            r = marquee.GlobalToLocal(r);
            marquee.Reset();
            SetSafeMarqueePen(r.Width, r.Height);
            marquee.AddRectangle(r.X, r.Y, r.Width, r.Height);

            r = RectangleF.Empty;
            r = PUtil.AddPointToRect(r, presspt);
            r = PUtil.AddPointToRect(r, e.Position);

            allItems.Clear();
            PNodeFilter filter = CreateNodeFilter(r);

            foreach (PNode parent in selectableParents)
            {
                PNodeList items;
                if (parent is PCamera)
                {
                    items = new PNodeList();
                    PCamera cameraParent = (PCamera)parent;
                    for (int i = 0; i < cameraParent.LayerCount; i++)
                    {
                        cameraParent.GetLayer(i).GetAllNodes(filter, items);
                    }
                }
                else
                {
                    items = parent.GetAllNodes(filter, null);
                }

                foreach (PNode node in items)
                {
                    allItems.Add(node, true);
                }
            }
        }
        public override void Initialize()
        {
            Canvas.RemoveInputEventListener(Canvas.PanEventHandler);

            // Create a decorator group that is NOT volatile
            DecoratorGroup dg = new DecoratorGroup();

            dg.Brush = Brushes.Magenta;

            // Put some nodes under the group for it to decorate
            PPath p1 = PPath.CreateEllipse(25, 25, 75, 75);

            p1.Brush = Brushes.Red;
            PPath p2 = PPath.CreateRectangle(125, 75, 50, 50);

            p2.Brush = Brushes.Blue;

            // Add everything to the Piccolo hierarchy
            dg.AddChild(p1);
            dg.AddChild(p2);
            Canvas.Layer.AddChild(dg);

            // Create a decorator group that IS volatile
            VolatileDecoratorGroup vdg = new VolatileDecoratorGroup(Canvas.Camera);

            vdg.Brush = Brushes.Cyan;

            // Put some nodes under the group for it to decorate
            PPath p3 = PPath.CreateEllipse(275, 175, 50, 50);

            p3.Brush = Brushes.Blue;
            PPath p4 = PPath.CreateRectangle(175, 175, 75, 75);

            p4.Brush = Brushes.Green;

            // Add everything to the Piccolo hierarchy
            vdg.AddChild(p3);
            vdg.AddChild(p4);
            Canvas.Layer.AddChild(vdg);

            // Create a selection handler so we can see that the decorator actually works
            PNodeList selectableParents = new PNodeList();

            selectableParents.Add(dg);
            selectableParents.Add(vdg);

            PSelectionEventHandler ps = new PSelectionEventHandler(Canvas.Layer, selectableParents);

            Canvas.AddInputEventListener(ps);
        }
        /// <summary>
        /// Removes bounds handles from the given node.
        /// </summary>
        /// <param name="aNode">The node to remove the bounds handles from.</param>
        public static void RemoveBoundsHandlesFrom(PNode aNode)
        {
            PNodeList handles  = new PNodeList();
            PNodeList children = aNode.ChildrenReference;

            foreach (PNode each in children)
            {
                if (each is PBoundsHandle)
                {
                    handles.Add(each);
                }
            }
            aNode.RemoveChildren(handles);
        }
Exemple #14
0
        /// <summary>
        /// Wait for all scheduled activities to finish before returning from
        ///	this method. This will freeze out user input, and so it is generally
        /// recommended that you use <c>PActivity.StartTime</c> and
        /// <c>PActivity.StartAfter</c> to offset activities instead of using
        /// this method.
        /// </summary>
        public virtual void WaitForActivities()
        {
            CameraWithCanvasFilter cameraWithCanvas = new CameraWithCanvasFilter();

            while (activityScheduler.ActivitiesReference.Count > 0)
            {
                ProcessInputs();

                PNodeList nodes = GetAllNodes(cameraWithCanvas, null);
                foreach (PCamera each in nodes)
                {
                    each.Canvas.PaintImmediately();
                }
            }
        }
Exemple #15
0
        public static void RemoveShiftLeftMullion(Mullion mullion)
        {
            if (mullion == null || mullion.PreviousSurface() == null)
            {
                throw new ArgumentException("Invalid argument provided.");
            }

            if (mullion.Parent.ChildrenCount == 3)
            {
                mullion.Parent.RemoveAllChildren();
                return;
            }
            Surface previousSurface = mullion.PreviousSurface();
            Surface nextSurface     = mullion.NextSurface();

            float x      = nextSurface.Model.X;
            float y      = nextSurface.Model.Y;
            float width  = nextSurface.Model.Width;
            float height = nextSurface.Model.Height;

            if (mullion.Model.Orientation == Domain.Entities.Orientation.Vertical)
            {
                x = previousSurface.Model.X;
            }
            else if (mullion.Model.Orientation == Domain.Entities.Orientation.Horizontal)
            {
                y = previousSurface.Model.Y;
            }
            PNodeList nodeList = new PNodeList();

            nodeList.Add(mullion);
            nodeList.Add(previousSurface);
            mullion.Parent.RemoveChildren(nodeList);

            nextSurface.Model.Bounds = new System.Drawing.RectangleF(x, y, width, height);
            nextSurface.ParentBoundsChanged();
            Mullion nextMullion = nextSurface.NextMullion();
            Mullion prevMullion = nextSurface.PreviousMullion();

            if (nextMullion != null)
            {
                nextMullion.ParentBoundsChanged();
            }
            else if (prevMullion != null)
            {
                prevMullion.ParentBoundsChanged();
            }
        }
        /// <summary>
        /// Called by the constructors to perform some common initialization tasks.
        /// </summary>
        protected virtual void Init()
        {
            float[] dash = { DASH_WIDTH, DASH_WIDTH };
            pens = new Pen[NUM_PENS];
            for (int i = 0; i < NUM_PENS; i++)
            {
                pens[i]             = new Pen(Color.Black, 1);
                pens[i].DashPattern = dash;
                pens[i].DashOffset  = i;
            }

            selection    = new Hashtable();
            allItems     = new Hashtable();
            unselectList = new PNodeList();
            marqueeMap   = new Hashtable();
        }
Exemple #17
0
        protected void ActivityStepped(PActivity activity)
        {
            PRoot root = Canvas.Root;

            if (root.PaintInvalid || root.ChildPaintInvalid)
            {
                PNodeList cameraChildren = Canvas.Camera.ChildrenReference;
                foreach (PNode each in cameraChildren)
                {
                    if (each is PHandle)
                    {
                        PHandle handle = (PHandle)each;
                        handle.RelocateHandle();
                    }
                }
            }
        }
Exemple #18
0
        protected PNode currentPosition;                        // Visual indicator of current position
        #endregion

        #region Initialization
        /// <summary>
        /// Constructs a new slideviewer control.
        /// </summary>
        public SlideViewer()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            slides          = new PNodeList();
            slideBar        = new PNode();
            slideBar.Brush  = Brushes.DarkGray;
            slideBar.Bounds = new RectangleF(0, 0, Width, SLIDE_BAR_HEIGHT);

            // Add the navigation event handlers and set the keyboard focus.
            Camera.MouseDown += new PInputEventHandler(Camera_MouseDown);
            Camera.KeyDown   += new PInputEventHandler(Camera_KeyDown);
            Camera.MouseMove += new PInputEventHandler(Camera_MouseMove);
            Root.DefaultInputManager.KeyboardFocus = Camera.ToPickPath();

            // Remove the default zoom and pan event handlers.
            ZoomEventHandler = null;
            PanEventHandler  = null;

            this.HandleCreated += new EventHandler(SlideViewer_HandleCreated);
        }
Exemple #19
0
        /// <summary>
        /// Get a list of all neighbors (parent, siblings and children).
        /// </summary>
        /// <returns>A list of all neighbors.</returns>
        public virtual PNodeList GetNeighbors()
        {
            PNodeList result = new PNodeList();

            if (focusNode == null)
            {
                return(result);
            }
            if (focusNode.Parent == null)
            {
                return(result);
            }

            PNode focusParent = focusNode.Parent;

            PNodeList focusParentChildren = focusParent.ChildrenReference;

            foreach (PNode each in focusParentChildren)
            {
                if (each != focusNode && each.Pickable)
                {
                    result.Add(each);
                }
            }

            result.Add(focusParent);

            PNodeList focusChildren = focusNode.ChildrenReference;

            foreach (PNode each in focusChildren)
            {
                result.Add(each);
            }

            return(result);
        }
 /// <summary>
 /// Constructs a new PSelectionEventHandler that will handle selection for the
 /// children of the given list of selectable parent nodes.
 /// </summary>
 /// <param name="marqueeParent">
 /// The node to which the event handler dynamically adds a marquee (temporarily)
 /// to represent the area being selected.
 /// </param>
 /// <param name="selectableParents">
 /// A list of nodes whose children will be selected by this event handler.
 /// </param>
 public PSelectionEventHandler(PNode marqueeParent, PNodeList selectableParents)
 {
     this.marqueeParent     = marqueeParent;
     this.selectableParents = selectableParents;
     Init();
 }
        //! @brief Отображает все дочерние узлы на графе диалогов
        //! @param root Старший диалог, экземпляр CDialog
        //! @param rootNode Старший узел, экземпляр PNode
        //! @param level Уровень наследования узлов
        //! @param edgeLayer
        //! @param nodeLayer
        //! @param stopAfterThat
        void fillDialogSubgraphView(CDialog root, PNode rootNode, float level, ref PLayer edgeLayer, ref PNodeList nodeLayer, bool stopAfterThat)//, PLayer main,  PLayer edge)
        {
            float ix         = rootNode.X;
            float iy         = rootNode.Y;
            float i          = 1;//Number of elements in string
            float localLevel = level;

            //System.Console.WriteLine("dialogID:" + root.DialogID + " toDialog:" + root.Actions.ToDialog);
            if (root.Actions.ToDialog != 0)
            {
                //System.Console.WriteLine("To dialog ID:"+root.Actions.ToDialog+" of "+root.DialogID);
                PNode toDialogNode = getNodeOnDialogID(root.Actions.ToDialog);

                if (toDialogNode == null)
                {
                    System.Console.WriteLine("Node is miss.");
                }
                else
                {
                    PPath edge = new PPath();
                    edge.Pickable = false;
                    ((ArrayList)toDialogNode.Tag).Add(edge);
                    ((ArrayList)rootNode.Tag).Add(edge);
                    edge.Tag = new ArrayList();
                    ((ArrayList)edge.Tag).Add(toDialogNode);
                    ((ArrayList)edge.Tag).Add(rootNode);
                    edgeLayer.AddChild(edge);
                    updateEdge(edge);
                    nodeLayer.Add(toDialogNode);
                    if (!stopAfterThat)
                    {
                        if (!isRoot(root.Actions.ToDialog))
                        {
                            if (this.dialogs.dialogs[currentNPC][root.Actions.ToDialog].Nodes.Any())
                            {
                                localLevel++;
                                this.fillDialogSubgraphView(this.dialogs.dialogs[currentNPC][root.Actions.ToDialog], toDialogNode, localLevel, ref edgeLayer, ref nodeLayer, false);
                            }
                            else if (this.dialogs.dialogs[currentNPC][root.Actions.ToDialog].Actions.ToDialog != 0)
                            {
                                this.fillDialogSubgraphView(this.dialogs.dialogs[currentNPC][root.Actions.ToDialog], toDialogNode, localLevel, ref edgeLayer, ref nodeLayer, true);
                            }
                        }
                    }
                }
            }
            else
            {
                foreach (int subdialogs in root.Nodes)
                {
                    PNode node = getNodeOnDialogID(subdialogs);

                    i++;
                    float x = (float)(ix) + (120 * i) - 40 * root.Nodes.Count - 100 * level;
                    float y = (float)(iy + 60) + 100 * level;

                    if (node == null)
                    {
                        SizeF size = CalcEllipsisSizeForNode(subdialogs);
                        node = PPath.CreateEllipse(x, y, size.Width, size.Height);
                        PText text = new PText(subdialogs.ToString());
                        text.Pickable = false;
                        text.X        = node.X + 15;
                        text.Y        = node.Y + 10;
                        node.Tag      = new ArrayList();
                        //((CMainDialog)node).DialogID = subdialogs;
                        //((ArrayList)node.Tag).Add(subdialogs);
                        node.AddChild(text);
                    }

                    PPath edge = new PPath();
                    edge.Pickable = false;
                    ((ArrayList)node.Tag).Add(edge);
                    ((ArrayList)rootNode.Tag).Add(edge);
                    edge.Tag = new ArrayList();
                    ((ArrayList)edge.Tag).Add(node);
                    ((ArrayList)edge.Tag).Add(rootNode);
                    edgeLayer.AddChild(edge);
                    updateEdge(edge);
                    nodeLayer.Add(node);
                    if (!graphs.Keys.Contains(node))
                    {
                        graphs.Add(node, new GraphProperties(subdialogs));
                    }
                    if (!stopAfterThat)
                    {
                        if (this.dialogs.dialogs[currentNPC][subdialogs].Nodes.Any())
                        {
                            localLevel++;
                            this.fillDialogSubgraphView(this.dialogs.dialogs[currentNPC][subdialogs], node, localLevel, ref edgeLayer, ref nodeLayer, false);
                        }
                        else if (this.dialogs.dialogs[currentNPC][subdialogs].Actions.ToDialog != 0)
                        {
                            this.fillDialogSubgraphView(this.dialogs.dialogs[currentNPC][subdialogs], node, localLevel, ref edgeLayer, ref nodeLayer, true);
                        }
                    }
                }
            }
        }
Exemple #22
0
 /// <summary>
 /// Sorts the given list of nodes by their distance from the given point.  Nodes
 /// closest to the point will be placed first in the list.
 /// </summary>
 /// <param name="aNodesList">The list to sort.</param>
 /// <param name="aPoint">The point to use for the comparison.</param>
 public virtual void SortNodesByDistanceFromPoint(PNodeList aNodesList, PointF aPoint)
 {
     aNodesList.Sort(new DistanceFromPointComparer(aPoint));
 }
 /// <summary>
 /// Unselects each node in the list, if the node is currently selected.
 /// </summary>
 /// <param name="items">The list of items to unselect.</param>
 /// <remarks>
 /// This method will remove the handles from the selected nodes in the
 /// list and post a SELECTION_CHANGED_NOTIFICATION if the selection has
 /// changed.
 /// </remarks>
 public virtual void Unselect(PNodeList items)
 {
     Unselect((ICollection)items);
 }
        void fillNPCLinkView()
        {
            // Initialize, and create a layer for the edges (always underneath the nodes)
            this.npcLinkShower.Layer.RemoveAllChildren();
            nodeNPClinkLayer = new PNodeList();
            edgeNPClinkLayer = new PLayer();

            this.npcLinkShower.Root.AddChild(edgeNPClinkLayer);
            this.npcLinkShower.Camera.AddLayer(0, edgeNPClinkLayer);
            //////Image iBackground = Image.FromFile("source/map.jpg");

            //////this.npcLinkShower.BackgroundImage = iBackground;
            bool  bNumOfIter = false;
            float rootx      = (float)(this.ClientSize.Width / 5);
            float rooty      = (float)(this.ClientSize.Height / 5);

            foreach (KeyValuePair <int, CQuest> quest in quests.quest)
            {
                foreach (Dictionary <int, CDialog> dialog in dialogs.dialogs.Values)
                {
                    foreach (KeyValuePair <int, CDialog> dial in dialog)
                    {
                        if (dial.Value.Actions.CompleteQuests.Contains(quest.Key) && !dial.Value.Holder.Equals(quest.Value.Additional.Holder) &&
                            !dial.Value.Holder.Equals("") && !quest.Value.Additional.Holder.Equals(""))
                        {
                            //System.Console.WriteLine("------");
                            //System.Console.WriteLine(dial.Value.Holder);
                            //System.Console.WriteLine(quest.Value.QuestInformation.NameOfHolder);
                            //System.Console.WriteLine("------");

                            string sQuestHolder  = quest.Value.Additional.Holder;
                            string sDialogHolder = dial.Value.Holder;

                            PNode dialogHolder;
                            PNode questHolder;

                            if (mapGraphs.Keys.Contains(sQuestHolder))
                            {
                                questHolder = mapGraphs[sQuestHolder];
                            }
                            else
                            {
                                questHolder = PPath.CreateRectangle(rootx, rooty, 180, 33);
                                if (bNumOfIter)
                                {
                                    rootx     += 120.0f;
                                    rooty     += 120.0f;
                                    bNumOfIter = false;
                                }
                                else
                                {
                                    rootx     += 120.0f;
                                    rooty     -= 120.0f;
                                    bNumOfIter = true;
                                }
                                PText rootText = new PText(sQuestHolder);
                                rootText.Pickable = false;
                                rootText.X        = questHolder.X;
                                rootText.Y        = questHolder.Y;
                                questHolder.AddChild(rootText);
                                questHolder.Tag = new ArrayList();
                                mapGraphs.Add(sQuestHolder, questHolder);
                            }

                            if (mapGraphs.Keys.Contains(sDialogHolder))
                            {
                                dialogHolder = mapGraphs[sDialogHolder];
                            }
                            else
                            {
                                dialogHolder = PPath.CreateRectangle(rootx, rooty, 180, 33);
                                if (bNumOfIter)
                                {
                                    rootx     += 120.0f;
                                    rooty     += 120.0f;
                                    bNumOfIter = false;
                                }
                                else
                                {
                                    rootx     += 120.0f;
                                    rooty     -= 120.0f;
                                    bNumOfIter = true;
                                }
                                PText rootText = new PText(sDialogHolder);
                                rootText.Pickable = false;
                                rootText.X        = dialogHolder.X;
                                rootText.Y        = dialogHolder.Y;
                                dialogHolder.AddChild(rootText);
                                dialogHolder.Tag = new ArrayList();
                                mapGraphs.Add(sDialogHolder, dialogHolder);
                            }

                            PPath edge = new PPath();
                            edge.Pickable = false;
                            ((ArrayList)dialogHolder.Tag).Add(edge);
                            ((ArrayList)questHolder.Tag).Add(edge);
                            edge.Tag = new ArrayList();
                            ((ArrayList)edge.Tag).Add(dialogHolder);
                            ((ArrayList)edge.Tag).Add(questHolder);
                            edgeNPClinkLayer.AddChild(edge);
                            updateEdge(edge);
                            if (!nodeNPClinkLayer.Contains(dialogHolder))
                            {
                                nodeNPClinkLayer.Add(dialogHolder);
                            }
                            if (!nodeNPClinkLayer.Contains(questHolder))
                            {
                                nodeNPClinkLayer.Add(questHolder);
                            }
                        }
                    }
                }
            }
            npcLinkShower.Layer.AddChildren(nodeNPClinkLayer);
        }