using System;
using System.Drawing;
namespace Netron.Diagramming.Core {
///
/// Abstract base class for shape materials
///
public abstract partial class ShapeMaterialBase : IShapeMaterial {
#region Fields
// ------------------------------------------------------------------
///
/// Implementation of IVersion - the current version of
/// ShapeMaterialBase.
///
// ------------------------------------------------------------------
protected double shapeMaterialBaseVersion = 1.0;
// ------------------------------------------------------------------
///
/// the Gliding field
///
// ------------------------------------------------------------------
private bool mGliding = true;
// ------------------------------------------------------------------
///
/// the Resizable field
///
// ------------------------------------------------------------------
private bool mResizable = true;
// ------------------------------------------------------------------
///
/// the Rectangle field
///
// ------------------------------------------------------------------
private Rectangle mRectangle = Rectangle.Empty;
// ------------------------------------------------------------------
///
/// the Shape field
///
// ------------------------------------------------------------------
private IShape mShape;
// ------------------------------------------------------------------
///
/// the Visible field
///
// ------------------------------------------------------------------
private bool mVisible = true;
protected ITextStyle myTextStyle = new TextStyle(
Color.Black,
new Font("Arial", 10),
StringAlignment.Near,
StringAlignment.Near);
#endregion
#region Properties
// ------------------------------------------------------------------
///
/// Gets the current version.
///
// ------------------------------------------------------------------
public virtual double Version {
get {
return shapeMaterialBaseVersion;
}
}
// ------------------------------------------------------------------
///
/// Gets or sets the TextStyle.
///
// ------------------------------------------------------------------
public virtual ITextStyle TextStyle {
get {
return myTextStyle;
}
set {
myTextStyle = value;
}
}
// ------------------------------------------------------------------
///
/// Gets or sets the Gliding
///
// ------------------------------------------------------------------
public bool Gliding {
get { return mGliding; }
set { mGliding = value; }
}
// ------------------------------------------------------------------
///
/// Gets or sets the Resizable
///
// ------------------------------------------------------------------
public bool Resizable {
get { return mResizable; }
set { mResizable = value; }
}
// ------------------------------------------------------------------
///
/// Gets or sets the Rectangle
///
// ------------------------------------------------------------------
public virtual Rectangle Rectangle {
get { return mRectangle; }
internal set {
mRectangle = value;
}
}
// ------------------------------------------------------------------
///
/// Gets or sets the Shape
///
// ------------------------------------------------------------------
public virtual IShape Shape {
get { return mShape; }
set { mShape = value; }
}
// ------------------------------------------------------------------
///
/// Gets or sets if this material is visible.
///
// ------------------------------------------------------------------
public bool Visible {
get { return mVisible; }
set { mVisible = value; }
}
#endregion
#region Constructor
///
///Default constructor
///
protected ShapeMaterialBase() {
}
#endregion
#region Methods
// ------------------------------------------------------------------
///
/// Calculates the min size needed to fit this material in.
///
/// Graphics
/// Size
// ------------------------------------------------------------------
public abstract Size CalculateMinSize(Graphics g);
///
/// Transforms the specified rectangle.
///
/// The rectangle.
public virtual void Transform(Rectangle rectangle) {
this.mRectangle = rectangle;
}
///
/// Paints the entity using the given graphics object
///
///
public abstract void Paint(Graphics g);
///
/// Gets the service object of the specified type.
///
/// An object that specifies the type of service object to get.
///
/// A service object of type serviceType.-or- null if there is no service object of type serviceType.
///
public virtual object GetService(Type serviceType) {
return null;
}
#endregion
}
}