Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/BaseClasses/ShapeMaterialBase.cs @ 17243

Last change on this file since 17243 was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

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