public void addNode(StrokeGroup sg)
        {
            /*
             * 1.	如果SKContextDG为空,创建关于s新节点nodeS,算法结束;
             * 2.	创建新节点nodeS,计算笔迹s与前一输入笔迹s’的输入时间差deltTime;
             * 3.	如果deltTime < ThresholdTime,将前一输入笔迹s所对应的节点的tPointer指针指向nodeS;
             * 4.	顺次遍历SKContextDG的历史节点,计算nodeS与历史节点的空间距离dist,根据dist’值判断二者之间的空间关系R;
             * 5.	如果R= ST,在两个节点之间建立空间关联链接,重复步骤4直至遍历完所有节点。
             */

            nodeIndex++;
            SKContextDGNode node = new SKContextDGNode(sg, sg.StartTime, nodeIndex);

            DGNodeList.Add(node);
            node.groupID = sg.groupID;


            double thresholdTime    = 1.2;    //TODO::阈值的确定
            double thresholdSpatial = 1000;   //TODO::阈值的确定


            //空间邻近关系建立
            double dist = -1;

            dist = distance(sg, lastNode.strokeGroup);
            if ((dist > thresholdSpatial) && (!DGHeadList.Contains(node)))
            {
                newHead(node);
            }

            foreach (SKContextDGNode preNode in DGNodeList)
            {
                if (preNode != node)
                {
                    StrokeGroup preSg = null;
                    preSg = preNode.strokeGroup;
                    dist  = distance(sg, preSg);
                    if ((dist < thresholdSpatial) && (!node.sPointer.Contains(preNode)))
                    {
                        node.sPointer.Add(preNode);
                    }
                }
            }


            //时间邻近关系建立
            double delta = (long)((TimeSpan)(sg.StartTime - lastNode.timeStamp)).TotalSeconds;

            if (delta < thresholdTime)
            {
                //时间邻近
                lastNode.tPointer = node;
            }
            else if (!DGHeadList.Contains(node))
            {
                newHead(node);
            }

            lastNode = node;
        }
 public void newHead(SKContextDGNode node)
 {
     DGHeadList.Add(node);
     DGNodeList.Add(node);
 }