Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Core/Document.cs @ 2768

Last change on this file since 2768 was 2768, checked in by mkommend, 14 years ago

added solution folders and sources for the netron library (ticket #867)

File size: 4.1 KB
Line 
1//To localize the descriptions see http://groups.google.be/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/3bb6895b49d7cbe/e3241b7fa085ba90?lnk=st&q=csharp+attribute+resource+file&rnum=4#e3241b7fa085ba90
2using System;
3using System.Collections.Generic;
4using System.Text;
5using System.Drawing;
6using System.ComponentModel;
7using System.Runtime.Serialization;
8using System.Xml.Serialization;
9namespace Netron.Diagramming.Core
10{
11    // ----------------------------------------------------------------------
12    /// <summary>
13    /// The document class represents the root of the controls' data
14    /// hierarchy. The document is the root of the serialization graph and
15    /// contains both the data of the diagram(s) and the metadata (or user
16    /// information).
17    /// </summary>
18    // ----------------------------------------------------------------------
19    public partial class Document : IVersion
20    {
21        #region Fields
22
23        // ------------------------------------------------------------------
24        /// <summary>
25        /// Implementation of IVersion - the current version of
26        /// Document.
27        /// </summary>
28        // ------------------------------------------------------------------
29        protected const double documentVersion = 1.0;
30
31        // ------------------------------------------------------------------
32        /// <summary>
33        /// Pointer to the model.
34        /// </summary>       
35        // ------------------------------------------------------------------
36        protected IModel mModel;
37
38        // ------------------------------------------------------------------
39        /// <summary>
40        /// The Information field.
41        /// </summary>
42        // ------------------------------------------------------------------
43        protected DocumentInformation mInformation;
44
45        #endregion
46
47        #region Properties
48
49        // ------------------------------------------------------------------
50        /// <summary>
51        /// Gets the current version.
52        /// </summary>
53        // ------------------------------------------------------------------
54        public virtual double Version
55        {
56            get
57            {
58                return documentVersion;
59            }
60        }
61
62        /// <summary>
63        /// Gets or sets the Information
64        /// </summary>
65        public DocumentInformation Information
66        {
67            get
68            {
69                return mInformation;
70            }
71            set
72            {
73                mInformation = value;
74            }
75        }
76
77
78        /// <summary>
79        /// Gets the model.
80        /// </summary>
81        /// <value>The model.</value>
82        public IModel Model
83        {
84            get
85            {
86                return mModel;
87            }
88        }
89
90        #endregion
91
92        #region Constructor
93        ///<summary>
94        ///Default constructor. Creates a new document and, hence, a new model with one default page and one default layer.
95        ///</summary>
96        public Document()
97        {
98            mModel = new Model();
99            mInformation = new DocumentInformation();
100        }
101
102   
103        #endregion
104
105        #region Methods
106
107        // ------------------------------------------------------------------
108        /// <summary>
109        /// Loops through all pages and returns ALL entities that belong to
110        /// this Document.
111        /// </summary>
112        /// <returns>CollectionBase</returns>
113        // ------------------------------------------------------------------
114        public CollectionBase<IDiagramEntity> GetAllEntities()
115        {
116            CollectionBase<IDiagramEntity> entities =
117                    new CollectionBase<IDiagramEntity>();
118            foreach (IPage page in this.mModel.Pages)
119            {
120                foreach (ILayer layer in page.Layers)
121                {
122                    entities.AddRange(layer.Entities);
123                }
124            }
125            return entities;
126        }
127
128        #endregion
129           
130    }
131}
Note: See TracBrowser for help on using the repository browser.