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/BaseClasses/ShapeMaterialBase.cs @ 3757

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

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

File size: 6.7 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Drawing;
5namespace Netron.Diagramming.Core
6{
7    /// <summary>
8    /// Abstract base class for shape materials
9    /// </summary>
10    public abstract partial class ShapeMaterialBase : IShapeMaterial
11    {
12        #region Fields
13
14        // ------------------------------------------------------------------
15        /// <summary>
16        /// Implementation of IVersion - the current version of
17        /// ShapeMaterialBase.
18        /// </summary>
19        // ------------------------------------------------------------------
20        protected double shapeMaterialBaseVersion = 1.0;
21
22        // ------------------------------------------------------------------
23        /// <summary>
24        /// the Gliding field
25        /// </summary>
26        // ------------------------------------------------------------------
27        private bool mGliding = true;
28
29        // ------------------------------------------------------------------
30        /// <summary>
31        /// the Resizable field
32        /// </summary>
33        // ------------------------------------------------------------------
34        private bool mResizable = true;
35
36        // ------------------------------------------------------------------
37        /// <summary>
38        /// the Rectangle field
39        /// </summary>
40        // ------------------------------------------------------------------
41        private Rectangle mRectangle = Rectangle.Empty;
42
43        // ------------------------------------------------------------------
44        /// <summary>
45        /// the Shape field
46        /// </summary>
47        // ------------------------------------------------------------------
48        private IShape mShape;
49
50        // ------------------------------------------------------------------
51        /// <summary>
52        /// the Visible field
53        /// </summary>
54        // ------------------------------------------------------------------
55        private bool mVisible = true;
56
57        protected ITextStyle myTextStyle = new TextStyle(
58            Color.Black,
59            new Font("Arial", 10),
60            StringAlignment.Near,
61            StringAlignment.Near);
62
63        #endregion
64
65        #region Properties
66
67        // ------------------------------------------------------------------
68        /// <summary>
69        /// Gets the current version.
70        /// </summary>
71        // ------------------------------------------------------------------
72        public virtual double Version
73        {
74            get
75            {
76                return shapeMaterialBaseVersion;
77            }
78        }
79
80        // ------------------------------------------------------------------
81        /// <summary>
82        /// Gets or sets the TextStyle.
83        /// </summary>
84        // ------------------------------------------------------------------
85        public virtual ITextStyle TextStyle
86        {
87            get
88            {
89                return myTextStyle;
90            }
91            set
92            {
93                myTextStyle = value;
94            }
95        }
96
97        // ------------------------------------------------------------------
98        /// <summary>
99        /// Gets or sets the Gliding
100        /// </summary>
101        // ------------------------------------------------------------------
102        public bool Gliding
103        {
104            get { return mGliding; }
105            set { mGliding = value; }
106        }
107
108        // ------------------------------------------------------------------
109        /// <summary>
110        /// Gets or sets the Resizable
111        /// </summary>
112        // ------------------------------------------------------------------
113        public bool Resizable
114        {
115            get { return mResizable; }
116            set { mResizable = value; }
117        }
118
119        // ------------------------------------------------------------------
120        /// <summary>
121        /// Gets or sets the Rectangle
122        /// </summary>
123        // ------------------------------------------------------------------
124        public virtual Rectangle Rectangle
125        {
126            get { return mRectangle; }
127            internal set
128            {
129                mRectangle = value;
130            }
131        }
132
133        // ------------------------------------------------------------------
134        /// <summary>
135        /// Gets or sets the Shape
136        /// </summary>
137        // ------------------------------------------------------------------
138        public virtual IShape Shape
139        {
140            get { return mShape; }
141            set { mShape = value; }
142        }
143
144        // ------------------------------------------------------------------
145        /// <summary>
146        /// Gets or sets if this material is visible.
147        /// </summary>
148        // ------------------------------------------------------------------
149        public bool Visible
150        {
151            get { return mVisible; }
152            set { mVisible = value; }
153        }
154        #endregion
155
156        #region Constructor
157        ///<summary>
158        ///Default constructor
159        ///</summary>
160        protected ShapeMaterialBase()
161        {
162        }
163        #endregion
164
165        #region Methods
166
167        // ------------------------------------------------------------------
168        /// <summary>
169        /// Calculates the min size needed to fit this material in.
170        /// </summary>
171        /// <param name="g">Graphics</param>
172        /// <returns>Size</returns>
173        // ------------------------------------------------------------------
174        public abstract Size CalculateMinSize(Graphics g);
175
176        /// <summary>
177        /// Transforms the specified rectangle.
178        /// </summary>
179        /// <param name="rectangle">The rectangle.</param>
180        public virtual void Transform(Rectangle rectangle)
181        {
182            this.mRectangle = rectangle;
183        }
184
185        /// <summary>
186        /// Paints the entity using the given graphics object
187        /// </summary>
188        /// <param name="g"></param>
189        public abstract void Paint(Graphics g);
190
191
192        /// <summary>
193        /// Gets the service object of the specified type.
194        /// </summary>
195        /// <param name="serviceType">An object that specifies the type of service object to get.</param>
196        /// <returns>
197        /// A service object of type serviceType.-or- null if there is no service object of type serviceType.
198        /// </returns>
199        public virtual object GetService(Type serviceType)
200        {
201            return null;
202        }
203
204        #endregion
205
206    }
207}
Note: See TracBrowser for help on using the repository browser.