Changeset 4068 for trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Core/Document.cs
- Timestamp:
- 07/22/10 00:44:01 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Core/Document.cs
r2768 r4068 1 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 2 using System; 3 using System.Collections.Generic; 4 using System.Text; 5 using System.Drawing; 6 using System.ComponentModel; 7 using System.Runtime.Serialization; 8 using System.Xml.Serialization; 9 namespace Netron.Diagramming.Core 10 { 11 // ---------------------------------------------------------------------- 2 namespace Netron.Diagramming.Core { 3 // ---------------------------------------------------------------------- 4 /// <summary> 5 /// The document class represents the root of the controls' data 6 /// hierarchy. The document is the root of the serialization graph and 7 /// contains both the data of the diagram(s) and the metadata (or user 8 /// information). 9 /// </summary> 10 // ---------------------------------------------------------------------- 11 public partial class Document : IVersion { 12 #region Fields 13 14 // ------------------------------------------------------------------ 12 15 /// <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). 16 /// Implementation of IVersion - the current version of 17 /// Document. 17 18 /// </summary> 18 // ---------------------------------------------------------------------- 19 public partial class Document : IVersion 20 { 21 #region Fields 19 // ------------------------------------------------------------------ 20 protected const double documentVersion = 1.0; 22 21 23 // ------------------------------------------------------------------ 24 /// <summary> 25 /// Implementation of IVersion - the current version of 26 /// Document. 27 /// </summary> 28 // ------------------------------------------------------------------ 29 protected const double documentVersion = 1.0; 22 // ------------------------------------------------------------------ 23 /// <summary> 24 /// Pointer to the model. 25 /// </summary> 26 // ------------------------------------------------------------------ 27 protected IModel mModel; 30 28 31 32 33 /// Pointer to the model.34 /// </summary>35 36 protected IModel mModel;29 // ------------------------------------------------------------------ 30 /// <summary> 31 /// The Information field. 32 /// </summary> 33 // ------------------------------------------------------------------ 34 protected DocumentInformation mInformation; 37 35 38 // ------------------------------------------------------------------ 39 /// <summary> 40 /// The Information field. 41 /// </summary> 42 // ------------------------------------------------------------------ 43 protected DocumentInformation mInformation; 36 #endregion 44 37 45 #endregion38 #region Properties 46 39 47 #region Properties 40 // ------------------------------------------------------------------ 41 /// <summary> 42 /// Gets the current version. 43 /// </summary> 44 // ------------------------------------------------------------------ 45 public virtual double Version { 46 get { 47 return documentVersion; 48 } 49 } 48 50 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 } 51 /// <summary> 52 /// Gets or sets the Information 53 /// </summary> 54 public DocumentInformation Information { 55 get { 56 return mInformation; 57 } 58 set { 59 mInformation = value; 60 } 61 } 76 62 77 63 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 } 64 /// <summary> 65 /// Gets the model. 66 /// </summary> 67 /// <value>The model.</value> 68 public IModel Model { 69 get { 70 return mModel; 71 } 72 } 73 74 #endregion 75 76 #region Constructor 77 ///<summary> 78 ///Default constructor. Creates a new document and, hence, a new model with one default page and one default layer. 79 ///</summary> 80 public Document() { 81 mModel = new Model(); 82 mInformation = new DocumentInformation(); 83 } 84 85 86 #endregion 87 88 #region Methods 89 90 // ------------------------------------------------------------------ 91 /// <summary> 92 /// Loops through all pages and returns ALL entities that belong to 93 /// this Document. 94 /// </summary> 95 /// <returns>CollectionBase</returns> 96 // ------------------------------------------------------------------ 97 public CollectionBase<IDiagramEntity> GetAllEntities() { 98 CollectionBase<IDiagramEntity> entities = 99 new CollectionBase<IDiagramEntity>(); 100 foreach (IPage page in this.mModel.Pages) { 101 foreach (ILayer layer in page.Layers) { 102 entities.AddRange(layer.Entities); 88 103 } 104 } 105 return entities; 106 } 89 107 90 108 #endregion 91 109 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 } 110 } 131 111 }
Note: See TracChangeset
for help on using the changeset viewer.