public ViewerEdge(ViewerQueryNode startNode, ViewerQueryNode endNode)
 {
     StartNodeID = startNode.ID;
     EndNodeID = endNode.ID;
     StartLocation = new Point(-1, -1);
     EndLocation = new Point(-1, -1);
     CaculateLine(startNode, endNode);
 }
        private void CaculateLine(ViewerQueryNode startNode, ViewerQueryNode endNode)
        {
            double radius = ViewerConfig.NodeRadius;
            if (AnalyticGeometryService.PointDistance(startNode.Center, endNode.Center) < radius)
            {
                return;
            }

            if (endNode.OutLinkList.Contains(startNode.ID) == false)
            {
                //single link
                SingleLink(startNode, endNode);
            }
            else
            {
                //double link
                DoubleLink(startNode, endNode);
            }
        }
 public ViewerResultNode(ViewerQueryNode vqn, long matchID)
     : base(vqn)
 {
     m_MatchID = matchID;
 }
        private void DoubleLink(ViewerQueryNode startNode, ViewerQueryNode endNode)
        {
            Point startCenter = startNode.Center;
            Point endCenter = endNode.Center;
            double radius = ViewerConfig.NodeRadius;

            int relativeX, relativeY;
            relativeX = endCenter.X - startCenter.X;
            relativeY = endCenter.Y - startCenter.Y;
            double delta = radius / 3 * 2;
            delta = 0;
            if(relativeX >= 0 && relativeY < 0)
            {
                CoreCaluteEdge(startCenter.X + delta, startCenter.Y, endCenter.X + delta, endCenter.Y, startCenter, endCenter, radius);
            }
            else if (relativeX > 0 && relativeY >= 0)
            {
                if (relativeY == 0)
                {
                    CoreCaluteEdge(startCenter.X, startCenter.Y + delta, endCenter.X, endCenter.Y + delta, startCenter, endCenter, radius);
                }
                else
                {
                    CoreCaluteEdge(startCenter.X - delta, startCenter.Y, endCenter.X - delta, endCenter.Y, startCenter, endCenter, radius);
                }
            }
            else if (relativeX <= 0 && relativeY > 0)
            {
                CoreCaluteEdge(startCenter.X - delta, startCenter.Y, endCenter.X - delta, endCenter.Y, startCenter, endCenter, radius);
            }
            else
            {
                if (relativeY == 0)
                {
                    CoreCaluteEdge(startCenter.X, startCenter.Y - delta, endCenter.X, endCenter.Y - delta, startCenter, endCenter, radius);
                }
                else
                {
                    CoreCaluteEdge(startCenter.X + delta, startCenter.Y, endCenter.X + delta, endCenter.Y, startCenter, endCenter, radius);
                }
            }
        }
 public ViewerQueryNode(ViewerQueryNode vqn)
 {
     m_ID = vqn.ID;
     m_Center = vqn.Center;
     m_Label = vqn.Label;
     m_OutLinkList = new HashSet<int>(vqn.OutLinkList);
     m_InLinkList = new HashSet<int>(vqn.InLinkList);
 }
 public bool AddNode(Point location)
 {
     if (NodeOverlap(location) == true)
     {
         return false;
     }
     m_IDIndex += 1;
     ViewerQueryNode vqn = new ViewerQueryNode(m_IDIndex, location);
     m_AllNodes.Add(m_IDIndex, vqn);
     UpdateRegion();
     return true;
 }
 private void SingleLink(ViewerQueryNode startNode, ViewerQueryNode endNode)
 {
     Point startCenter = startNode.Center;
     Point endCenter = endNode.Center;
     double radius = ViewerConfig.NodeRadius;
     CoreCaluteEdge(startCenter.X, startCenter.Y, endCenter.X, endCenter.Y, startCenter, endCenter, radius);
 }