Beruflich Dokumente
Kultur Dokumente
End Set
End Property
Public Property Width() As Integer
Get
Return FWidth
End Get
Set(ByVal Value As Integer)
FWidth = Value
Changed()
End Set
End Property
Public Property Depth() As Integer
Get
Return FDepth
End Get
Set(ByVal Value As Integer)
FDepth = Value
Changed()
End Set
End Property
Public Property Center() As Point
Get
Return FCenter
End Get
Set(ByVal Value As Point)
FCenter = Value
Changed()
End Set
End Property
Public ReadOnly Property Path() As GraphicsPath
Get
Return FPath
End Get
End Property
Public Property RotateX() As RotateHorizontal
Get
Return FRotateX
End Get
Set(ByVal Value As RotateHorizontal)
FRotateX = Value
Changed()
End Set
End Property
Public Property RotateY() As RotateVertical
Get
Return FRotateY
End Get
Set(ByVal Value As RotateVertical)
FRotateY = Value
Changed()
End Set
End Property
Public ReadOnly Property X() As Integer
Get
Return FLocation.X
End Get
End Property
Public ReadOnly Property Y() As Integer
Get
Return FLocation.Y
End Get
End Property
'Return the rectangle that bounds the entire polygon
'representing the cube
Public ReadOnly Property BoundsRect() As Rectangle
Get
If (FPath Is Nothing) Then
Return New Rectangle(0, 0, 0, 0)
Else
Dim r As RectangleF = Path.GetBounds()
' Implicit conversion from single to integer,
' really only available in VB
Return New Rectangle(r.X, r.Y, r.Width, r.Height)
End If
End Get
End Property
End Get
End Property
Public ReadOnly Property Left() As Point()
Get
Return GetLeft(Location, Height, Width, Depth, _
RotateX, RotateY)
End Get
End Property
Public ReadOnly Property Right() As Point()
Get
Return GetRight(Location, Height, Width, Depth, _
RotateX, RotateY)
End Get
End Property
Public ReadOnly Property Front() As Point()
Get
Return GetFront(Location, Height, Width, Depth, _
RotateX, RotateY)
End Get
End Property
Public ReadOnly Property Back() As Point()
Get
Return GetBack(Location, Height, Width, Depth, _
RotateX, RotateY)
End Get
End Property
Public Sub New(ByVal x As Integer, ByVal Y As Integer, _
ByVal height As Integer, ByVal width As Integer, _
ByVal depth As Integer, ByVal rotateX As RotateHorizontal, _
ByVal rotateY As RotateVertical)
FPath = New GraphicsPath
FLocation = New Point(x, Y)
FHeight = height
FWidth = width
FDepth = depth
FRotateX = rotateX
FRotateY = rotateY
FCenter = New Point(Location.X + (width + depth / 2 * _
rotateX) / 2, _
Location.Y + (height + depth / 2 * rotateY) / 2)
ConstructPath()
End Sub
Public Sub New(ByVal x As Integer, ByVal Y As Integer, _
ByVal height As Integer, ByVal width As Integer, _
ByVal depth As Integer)
FPath = New GraphicsPath
FLocation = New Point(x, Y)
FHeight = height
FWidth = width
FDepth = depth
FRotateX = RotateHorizontal.Right
FRotateY = RotateVertical.Up
FCenter = New Point(Location.X + (width + depth / 2 * _
RotateX) / 2, _
Location.Y + (height + depth / 2 * RotateY) / 2)
ConstructPath()
End Sub
Public Sub New(ByVal point As Point, _
ByVal height As Integer, ByVal width As Integer, _
ByVal depth As Integer)
FPath = New GraphicsPath
FLocation = point
FHeight = height
FWidth = width
FDepth = depth
FRotateX = RotateHorizontal.Right
FRotateY = RotateVertical.Up
FCenter = New Point(Location.X + (width + depth / 2 * _
RotateX) / 2, _
Location.Y + (height + depth / 2 * RotateY) / 2)
ConstructPath()
End Sub
Private Sub Changed()
ConstructPath()
End Sub
Private Sub ConstructPath()
FPath = New GraphicsPath
Path.AddLines(GetBack(Location, Height, Width, Depth, _
RotateX, RotateY))
Path.AddLines(GetFront(Location, Height, Width, Depth, _
RotateX, RotateY))
Path.AddLines(GetTop(Location, Height, Width, Depth, _
RotateX, RotateY))
Path.AddLines(GetBottom(Location, Height, Width, Depth, _
RotateX, RotateY))
Path.AddLines(GetLeft(Location, Height, Width, Depth, _
RotateX, RotateY))
Path.AddLines(GetRight(Location, Height, Width, Depth, _
RotateX, RotateY))
End Sub
Private Function GetXFromCenter(ByVal newCenter As Point) _
As Integer
Return newCenter.X - (FWidth + FDepth / 2 * FRotateX) / 2
End Function
Private Function GetYFromCenter(ByVal newCenter As Point) _
As Integer
Return newCenter.Y - (FHeight + FDepth / 2 * FRotateY) / 2
End Function