public void LoadDiagramFromXml( System.Xml.XmlNode node)
 {
     GOMLib.GOM_Diagram diagram = new GOMLib.GOM_Diagram();
     diagram.LoadFromXML(node, null);
     this.m_rgObjects = diagram.Objects;
     this.m_rgLinks = diagram.Links;
     DrawObjectsOnCanvas();
 }
        public DrawingForm(string templatePath)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            m_LButtonPressed	= false;
            m_CtrlPressed		= false;
            m_bRedoing			= false;

            m_selectingRect	= new System.Drawing.Rectangle(0, 0, 0, 0);
            m_selectedPen	= new Pen(System.Drawing.Color.FromArgb(150, 0, 0, 255), 1);
            m_groupSelPen	= new Pen(System.Drawing.Color.FromArgb(255, 200, 200, 200), 1);
            m_selectingPen	= new Pen(System.Drawing.Color.FromArgb(100, 0, 0, 0), 1);
            m_groupSelPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
            m_selectingPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;

            m_frmColor					= new ColorForm();
            m_frmColor.TopLevel			= false;
            m_frmColor.FormBorderStyle	= FormBorderStyle.None;
            m_frmColor.Visible			= false;
            m_frmColor.DrawingStyleChanged	+= new DrawingStyleChangedEvent(m_frmColor_DrawingStyleChanged);
            m_frmColor.FillingStyleChanged	+= new FillingStyleChangedEvent(m_frmColor_FillingStyleChanged);

            m_frmEdit					= new EditForm();
            m_frmEdit.TopLevel			= false;
            m_frmEdit.FormBorderStyle	= FormBorderStyle.None;
            m_frmEdit.Visible			= false;
            m_frmEdit.CommandSelected	+= new CommandSelectedEvent(m_frmEdit_CommandSelected);

            m_frmLink					= new LinkForm();
            m_frmLink.TopLevel			= false;
            m_frmLink.FormBorderStyle	= FormBorderStyle.None;
            m_frmLink.Visible			= false;
            m_frmLink.LinkStyleChanged	+= new LinkStyleChangedEvent(m_frmLink_LinkStyleChanged);
            m_frmLink.RemoveLink		+= new RemoveLinkEvent(m_frmLink_RemoveLink);

            m_frmInfo = new InfoForm();
            m_frmInfo.TopLevel = false;
            m_frmInfo.FormBorderStyle = FormBorderStyle.None;
            m_frmInfo.Visible = false;
            m_frmInfo.DrawingInfoChanged += new DrawingInfoChanged(m_frmInfo_DrawingInfoChanged);
            tagInfo.TagControl = m_frmInfo;
            //m_frmLink.LoadLinkStyle(Environment.CurrentDirectory + "\\Links");

            tagColor.TagControl	= m_frmColor;
            tagEdit.TagControl	= m_frmEdit;
            tagLink.TagControl	= m_frmLink;

            m_clipBoard	= new GOMLib.GOM_Objects();
            m_selObjs	= new GOMLib.GOM_Objects();
            m_rgObjects	= new GOMLib.GOM_Objects();
            m_bitmap	= new Bitmap(plDraw.Width, plDraw.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

            m_preprocess = new PreprocessQueue();
            m_preprocess.m_bDebugging	= false;
            m_preprocess.UpdateRequired += new PreprocessOverEvent(m_preprocess_UpdateRequired);
            m_preprocess.StartPreprocessThread();

            m_recognition = new RecognitionQueue(templatePath);
            m_recognition.m_bDebugging		= false;
            m_recognition.RecognitionStart	+= new RecognitionEvent(m_recognition_RecognitionStart);
            m_recognition.RecognitionEnd	+= new RecognitionEvent(m_recognition_RecognitionEnd);
            m_recognition.RecognitionOver	+= new RecognitionOverEvent(m_recognition_RecognitionOver);
            m_recognition.StartRecognitionThread();

            m_rgRedoList= new ArrayList();
            m_rgLinks	= new GOMLib.GOM_Links();
            m_rgStroke	= null;
            m_sketch	= null;

            m_selectedPoint	= null;
            m_selectedLink	= null;
            m_selectedLinkKeyPoint = null;

            m_tracker = new MouseTrackerLib.CTrackerClass();

            Graphics.FromImage(m_bitmap).FillRectangle(System.Drawing.Brushes.White, 0, 0, plDraw.Width, plDraw.Height);
        }
 /// <summary>
 /// Gets the links connecting to the given LinkNode.
 /// </summary>
 /// <param name="linkNode">The given LinkNode.</param>
 /// <returns>The links collection which connects to the given LinkNode.</returns>
 public GOMLib.GOM_Links GetLinks(GOMLib.GOM_Object_LinkNode linkNode)
 {
     GOMLib.GOM_Links links = new GOMLib.GOM_Links();
     for( int i=0; i<m_rgLinks.Count; i++ )
     {
         if ( m_rgLinks[i].m_startPt == linkNode.LinkPoint || m_rgLinks[i].m_endPt == linkNode.LinkPoint )
         {
             links.Add(m_rgLinks[i]);
         }
     }
     return links;
 }