forked from iesmatauw/StackBuilder
/
CylinderProperties.cs
82 lines (76 loc) · 2.29 KB
/
CylinderProperties.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
#endregion
namespace TreeDim.StackBuilder.Basics
{
public class CylinderProperties : ItemBase
{
#region Data members
protected double _radius, _height;
private double _weight;
private Color _colorTop;
private Color _colorWall;
#endregion
#region Constructor
public CylinderProperties(Document document)
: base(document)
{
}
public CylinderProperties(Document document, string name, string description
, double radius, double height, double weight, Color colorTop, Color colorWall)
: base(document, name, description)
{
_radius = radius;
_height = height;
_weight = weight;
_colorTop = colorTop;
_colorWall = colorWall;
}
#endregion
#region Public properties
public double Radius
{
get { return _radius; }
set { _radius = value; Modify(); }
}
public double Height
{
get { return _height; }
set { _height = value; Modify(); }
}
public double Volume
{
get { return _height * Math.PI * _radius * _radius; }
}
public virtual double Weight
{
get { return _weight; }
set { _weight = value; Modify(); }
}
public Color TopColor
{
get { return _colorTop; }
set { _colorTop = value; Modify(); }
}
public Color WallColor
{
get { return _colorWall; }
set { _colorWall = value; Modify(); }
}
#endregion
#region Public methods
#endregion
#region Object override
public override string ToString()
{
StringBuilder sBuilder = new StringBuilder();
sBuilder.Append(base.ToString());
sBuilder.Append(string.Format("Cylinder => Radius = {0} Height = {1} Weight = {2}", _radius, _height, _weight) );
return sBuilder.ToString();
}
#endregion
}
}