Ejemplo n.º 1
0
 public AttachSubject(SubjectBase subject)
 {
     this.Width = 63;
     this.Height = 30;
     this.MarginWidth = 10;
     this.MarginHeight = 5;
     this.BackColor = Color.LightYellow;
     this.ForeColor = Color.DimGray;
     this.BorderColor = Color.Orange;
     this.Font = new Font("΢���ź�", 10.0f);
     this.Title = "��ע";
     //�����ֵ�����
     SubjectBase fatherSubject = subject.ParentSubject;
     if (fatherSubject != null)
     {
         this.relateSubject = subject;
         int index = fatherSubject.ChildSubjects.IndexOf(subject);
         fatherSubject.InsertSubject(this, index); //Ĭ�ϲ��뵽�������������
     }
 }
Ejemplo n.º 2
0
        private void RenderSubjectRelateLink(Graphics g, Rectangle r, SubjectBase subject)
        {
            if (subject.LinkSubject == null) return;
            g.Clip = new System.Drawing.Region(r);

            RenderLinkRelate(g, r, subject);
        }
Ejemplo n.º 3
0
        public static string SaveSubject(SubjectBase centerSubject, List<SubjectBase> floatSubjects,MapTheme theme,MapViewModel viewmodel)
        {
            XmlDocument doc = new XmlDocument();
            XmlElement root = doc.CreateElement("JmMap");

            CreateObjectAttribute(doc, root, "Theme", theme.ToString());
            CreateObjectAttribute(doc, root, "ViewModel", viewmodel.ToString());

            SaveSubjectInfo(doc,root, centerSubject);
            foreach(SubjectBase floatSubject in floatSubjects)
            {
                SaveSubjectInfo(doc, root, floatSubject);
            }

            doc.AppendChild(root);
            string ss = doc.InnerXml;
            return ss;
        }
Ejemplo n.º 4
0
 public void RelateSubjectLink()
 {
     openLinkSubject = true;
     linkSubject = null;
 }
Ejemplo n.º 5
0
 public void AddAttachNote(SubjectBase subject)
 {
     SubjectBase attachSubject = new AttachSubject(subject);
     this.subjectNodes.Add(attachSubject);
 }
Ejemplo n.º 6
0
        protected override void SetTitleStyleLevel3(SubjectBase subject)
        {
            subject.MarginWidth = 5;
            subject.MarginHeight = 2;

            subject.BackColor = Color.Transparent;
            subject.ForeColor = Color.DimGray;
            subject.BorderColor = Color.Transparent;
            subject.Font = new Font("΢���ź�", 8.0f);

            subject.LineStyle = MapLinkStyle.RectLine;

            subject.Title = (subject.Title == "����" || subject.Title == "������") ? "������" : subject.Title;
        }
Ejemplo n.º 7
0
        protected override void SetTitleStyleLevel1(SubjectBase subject)
        {
            subject.MarginWidth = 20;
            subject.MarginHeight = 6;

            subject.BackColor = Color.YellowGreen;
            subject.ForeColor = Color.WhiteSmoke;
            subject.BorderColor = Color.Gray;
            subject.Font = new Font("΢���ź�", 12.0f, FontStyle.Bold);
            subject.LineStyle = MapLinkStyle.RectLine;

            subject.Title = (subject.Title == "����" || subject.Title == "������") ? "����" : subject.Title;
        }
Ejemplo n.º 8
0
        protected override void SetCenterSubjectStyle(SubjectBase subject)
        {
            subject.MarginWidth = 20;
            subject.MarginHeight = 10;

            subject.BackColor = Color.LimeGreen;
            subject.ForeColor = Color.WhiteSmoke;
            subject.BorderColor = Color.DarkGreen;
            subject.Font = new Font("΢���ź�", 14.0f, FontStyle.Bold);

            subject.BranchLinkWidth = 20;
            subject.BranchSplitHeight = 24;

            subject.EqualWidth = false;
            subject.LineStyle = MapLinkStyle.RectLine;

            subject.Title = subject.Title == "����" ? "��������" : subject.Title;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// �Ƴ�����
        /// </summary>
        /// <param name="subject"></param>
        public void RemoveSubject(SubjectBase subject)
        {
            if (this.ChildSubjects.Contains(subject))
            {
                this.ChildSubjects.Remove(subject);
                this.AdjustPosition();

                SubjectBase parentSubject = this.ParentSubject;
                while (parentSubject != null)
                {
                    parentSubject.AdjustPosition();
                    parentSubject = parentSubject.ParentSubject;
                }

                //SubjectBase topSubject = this.GetTopSubect();
                //if (topSubject != null)
                //{
                //    topSubject.AdjustPosition();
                //}
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// �ƶ�����λ��
        /// </summary>
        /// <param name="movePoint">�ƶ��������λ��</param>
        public virtual void MoveSubjectPosition(Point movePoint)
        {
            SubjectBase parentSubject = this.ParentSubject;

            int dX = movePoint.X - this.centerPoint.X;
            int dY = movePoint.Y - this.centerPoint.Y;
            //�ϳ�����
            if (this.DragOut)
            {
                SubjectBase topSubject = this.GetTopSubect();
                this.ParentSubject = null;
                FloatSubjects.Add(this);
                this.SetTitleStyle();

                this.CenterPoint = new Point(movePoint.X, movePoint.Y);

                foreach (SubjectBase childSub in this.childSubjects)
                {
                    childSub.moveX = -10000;
                    childSub.moveY = -10000;
                }
                this.moveX = 0;
                this.moveY = 0;

                this.AdjustPosition();
                while (parentSubject != null)
                {
                    parentSubject.AdjustPosition();
                    parentSubject = parentSubject.ParentSubject;
                }

                this.DragOut = false;
                return;
            }

            //�ƶ���Χ
            if (this.parentSubject != null)
            {
                if (viewMode == MapViewModel.Structure && this.Level == 1)  //��֯�ṹͼ��һ������
                {
                    int y = this.parentSubject.CenterPoint.Y + (this.parentSubject.height / 2) + this.parentSubject.BranchLinkWidth + this.height / 2 + this.leftBuffer;
                    if (y > movePoint.Y)
                    {
                        movePoint.Y = y;
                    }

                    bool bLeft = movePoint.X < this.centerPoint.X;
                    for (int i = 0; i < this.parentSubject.childSubjects.Count; i++)
                    {
                        SubjectBase subject = this.parentSubject.childSubjects[i];

                        if (subject != this)
                        {

                            if (movePoint.X < subject.centerPoint.X)
                            {
                                if (bLeft)
                                {
                                    this.parentSubject.childSubjects.Remove(this);
                                    this.parentSubject.childSubjects.Insert(i, this);
                                }
                                else
                                {
                                    this.parentSubject.childSubjects.Remove(this);
                                    this.parentSubject.childSubjects.Insert(i - 1, this);
                                }

                                break;
                            }
                            //�ƶ������
                            if (i == this.parentSubject.childSubjects.Count - 1)
                            {
                                if (movePoint.X > subject.centerPoint.X)
                                {
                                    this.parentSubject.childSubjects.Remove(this);
                                    this.parentSubject.childSubjects.Add(this);
                                }
                            }
                        }
                    }

                }
                else
                {
                    if (this.direction == 1)
                    {
                        int x = this.parentSubject.CenterPoint.X + (this.parentSubject.Width / 2) + this.parentSubject.BranchLinkWidth + this.width / 2 + this.leftBuffer;
                        if (x > movePoint.X)
                        {
                            movePoint.X = x;
                        }
                    }
                    else if (direction == -1)
                    {
                        int x = this.parentSubject.CenterPoint.X - (this.parentSubject.Width / 2) - this.parentSubject.BranchLinkWidth - this.width / 2 - this.leftBuffer;
                        if (x < movePoint.X)
                        {
                            movePoint.X = x;
                        }
                    }

                    bool bUp = movePoint.Y < this.centerPoint.Y;
                    for (int i = 0; i < this.parentSubject.childSubjects.Count; i++)
                    {
                        SubjectBase subject = this.parentSubject.childSubjects[i];

                        if (subject != this && subject.direction == this.direction)
                        {
                            if (movePoint.Y < subject.centerPoint.Y)
                            {
                                if (bUp)
                                {
                                    this.parentSubject.childSubjects.Remove(this);
                                    this.parentSubject.childSubjects.Insert(i, this);
                                }
                                else
                                {
                                    this.parentSubject.childSubjects.Remove(this);
                                    this.parentSubject.childSubjects.Insert(i - 1, this);
                                }

                                break;
                            }
                        }

                        //�ƶ������
                        if (i == this.parentSubject.childSubjects.Count - 1)
                        {
                            //�ҵ�ͬ�������һ������

                            for (int l = this.parentSubject.childSubjects.Count - 1; l >= 0; l--)
                            {
                                SubjectBase lastSubject = this.parentSubject.childSubjects[l];
                                if (lastSubject.direction == this.direction)
                                {
                                    if (movePoint.Y > lastSubject.centerPoint.Y)
                                    {
                                        this.parentSubject.childSubjects.Remove(this);
                                        this.parentSubject.childSubjects.Add(this);
                                    }
                                }
                            }
                        }
                    }

                    if (this.GetType() == typeof(TitleSubject))
                    {
                        movePoint.Y = this.CenterPoint.Y;
                    }
                }
            }
            dX = movePoint.X - this.centerPoint.X;
            dY = movePoint.Y - this.centerPoint.Y;
            this.CenterPoint = new Point(movePoint.X, movePoint.Y);

            foreach (SubjectBase childSub in this.childSubjects)
            {
                childSub.moveX = dX;
                childSub.moveY = dY;
            }
            this.moveX = 0;
            this.moveY = 0;
            this.AdjustPosition();

            while (parentSubject != null)
            {
                parentSubject.AdjustPosition();
                parentSubject = parentSubject.ParentSubject;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// ��������
        /// </summary>
        /// <param name="subject"></param>
        public void InsertSubject(SubjectBase subject, int position)
        {
            subject.parentSubject = this;
            subject.SetTitleStyle();

            if (!this.childSubjects.Contains(subject))
            {
                if (this.expanded == false)
                {
                    this.expanded = true;
                }
                if (this.childSubjects.Count == 0 || position >= this.childSubjects.Count || position < 0)
                {
                    this.childSubjects.Add(subject);
                }
                else
                {
                    this.childSubjects.Insert(position, subject);
                }
                this.AdjustPosition();

                SubjectBase parentSubject = this.ParentSubject;
                while (parentSubject != null)
                {
                    parentSubject.AdjustPosition();
                    parentSubject = parentSubject.ParentSubject;
                }

                //SubjectBase topSubject = this.GetTopSubect();
                //if (topSubject != null)
                //{
                //    topSubject.AdjustPosition();
                //}
            }
        }
Ejemplo n.º 12
0
 private bool TitleInArea(MouseEventArgs e, SubjectBase taskEvent)
 {
     Rectangle r = taskEvent.RectTitle;
     if (r.Left <= e.X && r.Left + r.Width >= e.X
             && r.Top <= e.Y && r.Top + r.Height >= e.Y)
     {
         return true;
     }
     return false;
 }
Ejemplo n.º 13
0
        private void RendrBranchLink(Graphics g, Rectangle r, SubjectBase subject, int x1, int y1, int x2, int y2)
        {
            Color penColor = subject.BorderColor.A==0 ? subject.ForeColor : subject.BorderColor;
            Pen penLine = new Pen(penColor, 1.0f);
            //���Ʒ�֧����
            g.DrawLine(penLine, x1, y1, x2, y2);

            //�����۵���ť
            Color colorCollapseF = penColor;
            Color colorCollapseB = Color.White;
            if (collapseSubject == subject)
            {
                colorCollapseF = Color.Blue;
                colorCollapseB = Color.LightSteelBlue;
            }

            int collaspradius = subject.CollapseRadius;
            Rectangle srCollaspe = new Rectangle(x2 - collaspradius, y2 - collaspradius, collaspradius * 2, collaspradius * 2);
            subject.RectCollapse = srCollaspe;
            g.FillEllipse(new SolidBrush(colorCollapseB), srCollaspe);
            g.DrawEllipse(new Pen(colorCollapseF, 1.0f), srCollaspe);

            g.DrawLine(new Pen(Color.DimGray, 2.0f), srCollaspe.Left + 3, srCollaspe.Top + srCollaspe.Height / 2, srCollaspe.Right - 3, srCollaspe.Top + srCollaspe.Height / 2);

            if (subject.Expanded == false)
            {
                g.DrawLine(new Pen(Color.DimGray, 2.0f), srCollaspe.Left + srCollaspe.Width / 2, srCollaspe.Top + 3, srCollaspe.Left + srCollaspe.Width / 2, srCollaspe.Bottom - 3);
            }
        }
Ejemplo n.º 14
0
        protected virtual void SetTitleStyleLevel2(SubjectBase subject)
        {
            subject.MarginWidth = 15;
            subject.MarginHeight = 3;

            subject.BackColor = Color.Honeydew;
            subject.ForeColor = Color.DimGray;
            subject.BorderColor = Color.Green;
            subject.Font = new Font("΢���ź�", 10.0f);
            subject.LineStyle = MapLinkStyle.RoundLine;

            subject.Title = (subject.Title == "����" || subject.Title == "������") ? "������" : subject.Title;
        }
Ejemplo n.º 15
0
        private void RenderSubjectTitle(Graphics g, Rectangle r, SubjectBase subject)
        {
            string title = subject.Title;
            Font f = subject.Font;
            Pen p = new Pen(subject.BorderColor, 1.0f);
            Rectangle sr = subject.RectAreas;
            g.Clip = new Region(new Rectangle(sr.Left - (int)(10 * SubjectBase.zoomValue), sr.Top - (int)(10 * SubjectBase.zoomValue), sr.Width + (int)(20 * SubjectBase.zoomValue) + subject.BranchLinkWidth, sr.Height + (int)(20 * SubjectBase.zoomValue)));

            int radius = subject.Height / 6;
            if (selectedSubject == subject)  //����ѡ��߿����չ
            {
                Rectangle activeArea = new Rectangle(sr.Left - (int)(3 * SubjectBase.zoomValue), sr.Top - (int)(6 * SubjectBase.zoomValue), sr.Width + (int)(7 * SubjectBase.zoomValue), sr.Height + (int)(10 * SubjectBase.zoomValue));

                //������չ
                RenderPlus(g, activeArea, subject);

                //���Ʊ߿�ͱ���
                FillRoundRectangle(g, new SolidBrush(subject.SelectColor), activeArea, radius);
                g.FillRectangle(Brushes.White, sr.Left - 1, sr.Top - 1, sr.Width + 2, sr.Height + 2);

            }
            else if (activeSubject == subject) //����ѡ�б߿�
            {
                Rectangle activeArea = new Rectangle(sr.Left - (int)(3 * SubjectBase.zoomValue), sr.Top - (int)(6 * SubjectBase.zoomValue), sr.Width + (int)(7 * SubjectBase.zoomValue), sr.Height + (int)(10 * SubjectBase.zoomValue));

                FillRoundRectangle(g, new SolidBrush(subject.ActiveColor), activeArea, radius);
                g.FillRectangle(Brushes.White, sr.Left - 1, sr.Top - 1, sr.Width + 2, sr.Height + 2);
            }

            if (subject.GetType() == typeof(AttachSubject))
            {
                FillAttachRectangle(g, new SolidBrush(subject.BackColor), sr, radius);
                DrawAttachRectangle(g, p, sr, radius);
            }
            else
            {
                if (theme == MapTheme.Bubble && subject.GetType() == typeof(CenterSubject))
                {
                    g.FillEllipse(new SolidBrush(subject.BackColor), sr);
                    g.DrawEllipse(p, sr);
                }
                else
                {
                    FillRoundRectangle(g, new SolidBrush(subject.BackColor), sr, radius);
                    DrawRoundRectangle(g, p, sr, radius);
                }
            }

            //����ͼ��
            int lb = subject.MarginWidth;
            for (int i = 0; i < subject.SubjectPictures.Count; i++)
            {
                Image img = subject.SubjectPictures[i].SubjectImage;

                g.DrawImage(img, (float)(sr.Left + lb), (float)(sr.Top + sr.Height / 2 - img.Height / 2 + 1));
                lb += (img.Width + subject.ImageSplitWidth);
            }

            SizeF size = g.MeasureString(title, f);
            //�����ı�
            float x_title = (float)(sr.Left + sr.Width / 2 - size.Width / 2); //�����
            float y_title = (float)(sr.Top + sr.Height / 2 - Math.Floor(size.Height) / 2 + 1);
            if (lb != subject.MarginWidth)
            {
                x_title = (float)(sr.Left + lb);//��ͼ������
            }

            g.DrawString(title, f, new SolidBrush(subject.ForeColor), x_title, y_title);
            Rectangle srTitle = new Rectangle((int)x_title, (int)y_title, (int)size.Width, (int)size.Height);
            subject.RectTitle = srTitle;
        }
Ejemplo n.º 16
0
        protected override void SetCenterSubjectStyle(SubjectBase subject)
        {
            subject.MarginWidth = 20;
            subject.MarginHeight = 10;

            subject.BackColor = Color.LightSteelBlue;
            subject.ForeColor = Color.DimGray;
            subject.BorderColor = Color.LightGray;
            subject.Font = new Font("΢���ź�", 14.0f, FontStyle.Bold);

            subject.BranchLinkWidth = 20;
            subject.BranchSplitHeight = 24;

            subject.EqualWidth = false;
            subject.LineStyle = MapLinkStyle.Curve;

            subject.Title = subject.Title == "����" ? "��������" : subject.Title;
        }
Ejemplo n.º 17
0
        protected override void SetTitleStyleLevel1(SubjectBase subject)
        {
            subject.MarginWidth = 20;
            subject.MarginHeight = 6;

            subject.BackColor = Color.FromArgb(65, Color.LightSteelBlue);
            subject.ForeColor = Color.DimGray;
            subject.BorderColor = Color.Gray;
            subject.Font = new Font("΢���ź�", 12.0f, FontStyle.Bold);
            subject.LineStyle = MapLinkStyle.Curve;

            subject.Title = (subject.Title == "����" || subject.Title == "������") ? "����" : subject.Title;
        }
Ejemplo n.º 18
0
        private int GetSubjectMaxHeight(SubjectBase subject, int max)
        {
            int maxHeight = max;
            if (subject.Expanded)
            {
                foreach (SubjectBase n in subject.ChildSubjects)
                {
                    if (n.Expanded)
                    {
                        maxHeight = GetSubjectMaxHeight(n, maxHeight);
                    }
                    else
                    {
                        if ((viewMode == MapViewModel.TreeMap || viewMode == MapViewModel.Structure) && n.childSubjects.Count > 0)
                        {
                            maxHeight = n.CenterPoint.Y + n.Height / 2 + n.branchLinkWidth + n.CollapseRadius;
                        }
                    }

                    if (n.CenterPoint.Y + n.Height / 2 > maxHeight)
                    {
                        maxHeight = n.CenterPoint.Y + n.Height / 2;
                    }
                }
            }
            else
            {
                if ((viewMode == MapViewModel.TreeMap || viewMode == MapViewModel.Structure) && subject.childSubjects.Count > 0)
                {
                    maxHeight = subject.CenterPoint.Y + subject.Height / 2 + subject.branchLinkWidth + subject.collapseRadius;
                }
            }

            if (subject.CenterPoint.Y + subject.Height / 2 > maxHeight)
            {
                maxHeight = subject.CenterPoint.Y + subject.Height / 2;
            }
            return maxHeight;
        }
Ejemplo n.º 19
0
        protected override void SetTitleStyleLevel0(SubjectBase subject)
        {
            subject.MarginWidth = 20;
            subject.MarginHeight = 10;

            subject.BackColor = Color.FromArgb(102, 205, 0);
            subject.ForeColor = Color.DimGray;
            subject.BorderColor = Color.DimGray;
            subject.Font = new Font("΢���ź�", 12.0f);
            subject.LineStyle = MapLinkStyle.RectLine;

            subject.Title = (subject.Title == "����" || subject.Title == "������") ? "��������" : subject.Title;
        }
Ejemplo n.º 20
0
 private int GetSubjectMaxWidth(SubjectBase subject, int max)
 {
     int maxWidth = max;
     if (subject.Expanded)
     {
         foreach (SubjectBase n in subject.ChildSubjects)
         {
             if (n.Expanded)
             {
                 maxWidth = GetSubjectMaxWidth(n, maxWidth);
             }
             if (n.CenterPoint.X + n.Width / 2 > maxWidth)
             {
                 maxWidth = n.CenterPoint.X + n.Width / 2;
             }
         }
     }
     if (subject.CenterPoint.X + subject.Width / 2 > maxWidth)
     {
         maxWidth = subject.CenterPoint.X + subject.Width / 2;
     }
     return maxWidth;
 }
Ejemplo n.º 21
0
        private int GetSubjectMinHeight(SubjectBase subject, int min)
        {
            int minHeight = min;
            if (subject.Expanded)
            {
                foreach (SubjectBase n in subject.ChildSubjects)
                {
                    if (n.Expanded)
                    {
                        minHeight = GetSubjectMinHeight(n, minHeight);
                    }

                    if (n.CenterPoint.Y - n.Height / 2 < minHeight)
                    {
                        minHeight = n.CenterPoint.Y - n.Height / 2;
                    }
                }
            }

            if (subject.CenterPoint.Y - subject.Height / 2 < minHeight)
            {
                minHeight = subject.CenterPoint.Y - subject.Height / 2;
            }
            return minHeight;
        }
Ejemplo n.º 22
0
        private int GetSubjectMinWidth(SubjectBase subject, int min)
        {
            int minWidth = min;
            if (subject.Expanded)
            {
                foreach (SubjectBase n in subject.ChildSubjects)
                {
                    if (n.Expanded)
                    {
                        minWidth = GetSubjectMinWidth(n, minWidth);
                    }

                    if (n.CenterPoint.X - n.Width / 2 < minWidth)
                    {
                        minWidth = n.CenterPoint.X - n.Width / 2;
                    }
                }
            }

            if (subject.CenterPoint.X - subject.Width / 2 < minWidth)
            {
                minWidth = subject.CenterPoint.X - subject.Width / 2;
            }
            return minWidth;
        }
Ejemplo n.º 23
0
        public MindDocView()
            : base()
        {
            subjectNodes = new List<SubjectBase>();

            centerProject = new CenterSubject();
            centerProject.CenterPoint = new Point(this.Width / 2, this.Height / 2);
            subjectNodes.Add(centerProject);

            txtNode = new TextBox();
            txtNode.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            txtNode.MouseDown += txtNode_MouseDown;
            txtNode.MouseUp += txtNode_MouseUp;
            txtNode.MouseMove += txtNode_MouseMove;
            txtNode.KeyDown += txtNode_KeyDown;
            txtNode.Leave += txtNode_Leave;

            timerTxt = new Timer();
            timerTxt.Interval = 1000;
            timerTxt.Enabled = false;
            timerTxt.Tick += timerTxt_Tick;
            imgRender = new Bitmap(100, 100);

            // Use reflection to load the
            // embedded bitmaps for the
            // styles plus and minus icons
            //Assembly myAssembly = Assembly.GetAssembly(Type.GetType("JsmMind.MindDocView"));
            //System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MindDocView));
            //// bmpMinus = ((System.Drawing.Bitmap)(resources.GetObject("tv_minus.bmp")));
        }
Ejemplo n.º 24
0
        protected override void SetCenterSubjectStyle(SubjectBase subject)
        {
            subject.MarginWidth = 20;
            subject.MarginHeight = 10;

            subject.BackColor = Color.DarkOrange;
            subject.ForeColor = Color.SaddleBrown;
            subject.BorderColor = Color.OrangeRed;
            subject.Font = new Font("΢���ź�", 14.0f, FontStyle.Bold);

            subject.BranchLinkWidth = 20;
            subject.BranchSplitHeight = 24;

            subject.EqualWidth = true;
            subject.LineStyle = MapLinkStyle.Curve;

            subject.Title = subject.Title == "����" ? "��������" : subject.Title;
        }
Ejemplo n.º 25
0
        public void ClearSubject()
        {
            subjectNodes.Clear();
            SubjectBase.FloatSubjects.Clear();

            centerProject = new CenterSubject();
            centerProject.CenterPoint = new Point(this.Width / 2, this.Height / 2);
            subjectNodes.Add(centerProject);
            Invalidate();
        }
Ejemplo n.º 26
0
        /// <summary>
        /// ��ʼ������
        /// </summary>
        /// <param name="subject">�������</param>
        /// <param name="plus">�������(1,2,3,4�ֱ��ʾ���ϣ��ң���)</param>
        public TitleSubject(SubjectBase subject, int plus)
        {
            if (subject.GetType() == typeof(CenterSubject))
            {
                if (viewMode == MapViewModel.ExpandTwoSides)
                {
                    this.Direction = plus == 1 ? -1 : 1;
                }
                this.ParentSubject = subject;
            }
            else if (subject.GetType() == typeof(TitleSubject))
            {
                //�Ƿ�������
                bool bAddChild = true;
                int insertPos = 0; //�����

                if (viewMode == MapViewModel.Structure)
                {
                    bAddChild = plus == 2 || plus == 4; //�������������
                    insertPos = plus == 1 ? 0 : 1;
                }
                else
                {
                    bAddChild = plus == 1 || plus == 3; //�������������
                    insertPos = plus == 2 ? 0 : 1;

                }

                if (bAddChild)  //������
                {
                    this.ParentSubject = subject;
                }
                else  //�ֵ�����
                {
                    SubjectBase brotherSubject = subject;
                    SubjectBase fatherSubject = brotherSubject.ParentSubject;
                    if (fatherSubject == null)
                    {
                        return;
                    }
                    if (fatherSubject.GetType() == typeof(CenterSubject))
                    {
                        this.Direction = brotherSubject.Direction;
                    }

                    int index = fatherSubject.ChildSubjects.IndexOf(brotherSubject);
                    fatherSubject.InsertSubject(this, index + insertPos);
                }
            }
        }
Ejemplo n.º 27
0
 public void SetXml(string xml)
 {
     ClearSubject();
     List<SubjectBase> floatSubjects = new List<SubjectBase>();
     MapTheme mapTheme = MapTheme.Default;
     MapViewModel mapViewModel = MapViewModel.ExpandRightSide;
     SubjectBase subject = XmlManage.ReadSubject(xml, floatSubjects, out mapTheme, out mapViewModel);
     centerProject = subject;
     SubjectBase.FloatSubjects = floatSubjects;
     Theme = mapTheme;
     ViewModel = mapViewModel;
     subjectNodes.Clear();
     AddSubjectNode(centerProject);
     foreach (SubjectBase floatSubject in SubjectBase.FloatSubjects)
     {
         AddSubjectNode(floatSubject);
     }
     Invalidate();
 }
Ejemplo n.º 28
0
 /// <summary>
 /// ��ʼ������
 /// </summary>
 /// <param name="brotherSubject">ͬ������</param>
 /// <param name="insertUp">�Ƿ����ϲ���</param>
 public TitleSubject(SubjectBase brotherSubject, bool insertUp)
 {
 }
Ejemplo n.º 29
0
        private static void SaveSubjectInfo(XmlDocument doc, XmlElement root, SubjectBase subject)
        {
            //Create Subject Element
            XmlElement nodeSubject = CreateObjectElement(doc, subject);

            //Subject'PictureInfo
            XmlElement nodePictures= doc.CreateElement("SujectPictrues");
            foreach(SubjectPicture subjectPicture in subject.SubjectPictures)
            {
                XmlElement nodePicture = CreateObjectElement(doc, subjectPicture);
                nodePictures.AppendChild(nodePicture);
            }
            nodeSubject.AppendChild(nodePictures);

            //Save Subject'ChildSubject
            XmlElement nodeChildSubjects = doc.CreateElement("ChildSubjects");
            foreach(SubjectBase childSubject in subject.ChildSubjects)
            {
                SaveSubjectInfo(doc, nodeChildSubjects, childSubject);
            }
            nodeSubject.AppendChild(nodeChildSubjects);

            root.AppendChild(nodeSubject);
        }
Ejemplo n.º 30
0
        private void RenderSubjectParentLink(Graphics g, Rectangle r, SubjectBase subject)
        {
            if (subject.ParentSubject == null) return;
            g.Clip = new System.Drawing.Region(r);

            if (subject.GetType() == typeof(AttachSubject))
            {
                RenderLinkAttach(g, r, subject);
            }
            else
            {
                RenderLinkBranch(g, r, subject);
            }
        }