Option Explicit
Sub DrawSoccerField()
'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
'// Code to draw Soccerfield done by Greg Truby, March 2007
'// This subroutine requires Aaron Blood's class modules for
'// clsVector, clsArc and clsShape as well as his
'// Kill_Shapes routine.
Const x As Double = 10
Const y As Double = 20
Const c_dblLen As Double = 115
Const c_dblWid As Double = 75
Const c_dScalar As Double = 6.25
Dim vctGoalLineTop As clsVector, _
vctGoalLineBott As clsVector, _
vctSideLineRight As clsVector, _
vctSideLineLeft As clsVector, _
vctLineMidField As clsVector
Dim shpCircMidField As clsShape, _
shpDotMidField As clsShape
Dim vctPos As New clsVector, _
vctPos2 As New clsVector, _
vctPos3 As New clsVector
Dim vctGoalBoxTopLeft As New clsVector, _
vctGoalBoxTopRight As New clsVector, _
vctGoalBoxTopCross As New clsVector, _
vctGoalBoxBottLeft As New clsVector, _
vctGoalBoxBottRight As New clsVector, _
vctGoalBoxBottCross As New clsVector
Dim vctPenaltyTopLeft As New clsVector, _
vctPenaltyTopRight As New clsVector, _
vctPenaltyTopCross As New clsVector, _
vctPenaltyBottLeft As New clsVector, _
vctPenaltyBottRight As New clsVector, _
vctPenaltyBottCross As New clsVector
Dim vctGoalTop As New clsVector, _
vctGoalBott As New clsVector, _
vctPKLineTop As New clsVector, _
vctPKLineBott As New clsVector, _
arcTopPenBox As New clsArc, _
arcBottPenBox As New clsArc
Dim arcCorner1 As New clsArc, _
arcCorner2 As New clsArc, _
arcCorner3 As New clsArc, _
arcCorner4 As New clsArc
Dim vctHash1 As New clsVector, _
vctHash2 As New clsVector, _
vctHash3 As New clsVector, _
vctHash4 As New clsVector
Dim fn As WorksheetFunction
Call Kill_Shapes
Set vctGoalLineTop = New clsVector
Set vctGoalLineBott = New clsVector
Set vctSideLineLeft = New clsVector
Set vctSideLineRight = New clsVector
Set vctLineMidField = New clsVector
Set shpCircMidField = New clsShape
Set shpDotMidField = New clsShape
Set fn = WorksheetFunction
'// Field
With vctGoalLineTop
.x1 = x
.y1 = y
.Scalar = c_dScalar
.Length = c_dblWid
.Degrees = 90
.ArrowHeadEnd = msoArrowheadNone
.ArrowHeadBeg = msoArrowheadNone
.LineWeight = 1.5
.ShapeName = "<GoalLineTop"
End With
With vctSideLineRight
.x1 = vctGoalLineTop.x2
.y1 = vctGoalLineTop.y2
.Scalar = c_dScalar
.Length = c_dblLen
.Degrees = 180
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 1.5
.ShapeName = "<SideLineRight"
End With
With vctSideLineLeft
.x1 = vctGoalLineTop.x1
.y1 = vctGoalLineTop.y1
.Scalar = c_dScalar
.Length = c_dblLen
.Degrees = 180
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 1.5
.ShapeName = "<SideLineLeft"
End With
With vctGoalLineBott
.x1 = vctSideLineLeft.x2
.y1 = vctSideLineRight.y2
.Scalar = c_dScalar
.Length = c_dblWid
.Degrees = 90
.ArrowHeadEnd = msoArrowheadNone
.ArrowHeadBeg = msoArrowheadNone
.LineWeight = 1.5
.ShapeName = "<GoalLineBott"
End With
'// middle of the field
With vctLineMidField
.x1 = vctSideLineLeft.x1
.y1 = fn.Average(vctSideLineLeft.y1, vctSideLineLeft.y2)
.Scalar = c_dScalar
.Length = c_dblWid
.Degrees = 90
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 1
.ShapeName = "<MidFieldLine"
End With
With shpCircMidField
.y1 = vctLineMidField.y1
.x1 = fn.Average(vctLineMidField.x1, vctLineMidField.x2)
.Scalar = c_dScalar
.Radius = 10
.ShapeType = office.msoShapeOval
.FillColor = Color.White
.zOrder = MsoZOrderCmd.msoSendToBack
.LineWeight = 1
.ShapeName = "<MidFieldCircle"
End With
With shpDotMidField
.x1 = shpCircMidField.x1
.y1 = shpCircMidField.y1
.Scalar = c_dScalar
.Radius = 0.3
.ShapeType = office.msoShapeOval
.FillColor = Color.Black
.zOrder = MsoZOrderCmd.msoBringForward
.ShapeName = "<MidFieldDot"
End With
'// top goal box
With vctPos
.x1 = x
.y1 = y
.Scalar = c_dScalar
.Length = c_dblWid / 2 - 10
.Degrees = 90
End With
With vctGoalBoxTopLeft
.x1 = vctPos.x2
.y1 = y
.Scalar = c_dScalar
.Length = 6
.Degrees = 180
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 0.8
.ShapeName = "<GoalTopLeft"
End With
With vctGoalBoxTopCross
.x1 = vctGoalBoxTopLeft.x1
.y1 = vctGoalBoxTopLeft.y2
.Scalar = c_dScalar
.Length = 20
.Degrees = 90
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 0.8
.ShapeName = "<GoalTopCross"
End With
With vctGoalBoxTopRight
.x1 = vctGoalBoxTopCross.x2
.y1 = y
.Scalar = c_dScalar
.Length = 6
.Degrees = 180
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 0.8
.ShapeName = "<GoalTopRight"
End With
'// Bottom Goal Box
With vctGoalBoxBottLeft
.x1 = vctGoalBoxTopLeft.x1
.y1 = vctGoalLineBott.y1
.Scalar = c_dScalar
.Length = 6
.Degrees = 0
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 0.8
.ShapeName = "<GoalBottLeft"
End With
With vctGoalBoxBottCross
.x1 = vctGoalBoxTopLeft.x1
.y1 = vctGoalBoxBottLeft.y2
.Scalar = c_dScalar
.Length = 20
.Degrees = 90
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 0.8
.ShapeName = "<GoalBottCross"
End With
With vctGoalBoxBottRight
.x1 = vctGoalBoxBottCross.x2
.y1 = vctGoalBoxBottLeft.y1
.Scalar = c_dScalar
.Length = 6
.Degrees = 0
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 0.8
.ShapeName = "<GoalBottRight"
End With
'// top penalty box
With vctPos
.x1 = x
.y1 = y
.Scalar = c_dScalar
.Length = c_dblWid / 2 - 22
.Degrees = 90
End With
With vctPenaltyTopLeft
.x1 = vctPos.x2
.y1 = y
.Scalar = c_dScalar
.Length = 18
.Degrees = 180
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 1
.ShapeName = "<PenaltyTopLeft"
End With
With vctPenaltyTopCross
.x1 = vctPos.x2
.y1 = vctPenaltyTopLeft.y2
.Scalar = c_dScalar
.Length = 44
.Degrees = 90
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 1
.ShapeName = "<PenaltyTopCross"
End With
With vctPenaltyTopRight
.x1 = vctPenaltyTopCross.x2
.y1 = y
.Scalar = c_dScalar
.Length = 18
.Degrees = 180
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 1
.ShapeName = "<PenaltyTopRight"
End With
'// Bottom Penalty Box
With vctPenaltyBottLeft
.x1 = vctPos.x2
.y1 = vctGoalLineBott.y1
.Scalar = c_dScalar
.Length = 18
.Degrees = 0
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 1
.ShapeName = "<PenaltyBottLeft"
End With
With vctPenaltyBottCross
.x1 = vctPos.x2
.y1 = vctPenaltyBottLeft.y2
.Scalar = c_dScalar
.Length = 44
.Degrees = 90
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 1
.ShapeName = "<PenaltyBottCross"
End With
With vctPenaltyBottRight
.x1 = vctPenaltyBottCross.x2
.y1 = vctPenaltyBottCross.y2
.Scalar = c_dScalar
.Length = 18
.Degrees = 180
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 1
.ShapeName = "<PenaltyBottRight"
End With
'/ Top PK Line & Arc
With vctPos
.x1 = x
.y1 = y
.Length = c_dblWid / 2 - 0.5
.Degrees = 90
End With
With vctPos2
.x1 = vctPos.x2
.y1 = y
.Scalar = c_dScalar
.Length = 12
.Degrees = 180
End With
With vctPKLineTop
.x1 = vctPos2.x2
.y1 = vctPos2.y2
.Scalar = c_dScalar
.Length = 1
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.Degrees = 90
End With
With arcTopPenBox
.x1 = fn.Average(vctPKLineTop.x1, vctPKLineTop.x2)
.y1 = vctPKLineTop.y1
.Radius = 10
.Scalar = c_dScalar
.Deg1 = 127
.Deg2 = 233
.Weight = 0.01
.Transparency = 0
.zOrder = MsoZOrderCmd.msoSendToBack
.ColorIndex = Color.Black
End With
With vctPos
.x1 = x
.y1 = y
.Length = c_dblWid / 2 - 4
.Degrees = 90
End With
With vctPos2
.x1 = vctPos.x2
.y1 = y
.Length = 0.5
.Degrees = 0
End With
With vctGoalTop
.x1 = vctPos.x2
.y1 = vctPos2.y2
.Scalar = c_dScalar
.Length = 8
.Degrees = 90
.LineWeight = 2
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
End With
'/ Bott PK Line & Arc
With vctPos
.x1 = x
.y1 = vctGoalLineBott.y1
.Length = c_dblWid / 2 - 0.5
.Degrees = 90
End With
With vctPos2
.x1 = vctPos.x2
.y1 = vctPos.y2
.Scalar = c_dScalar
.Length = 12
.Degrees = 0
End With
With vctPKLineBott
.x1 = vctPos2.x2
.y1 = vctPos2.y2
.Scalar = c_dScalar
.Length = 1
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.Degrees = 90
End With
With arcBottPenBox
.x1 = fn.Average(vctPKLineBott.x1, vctPKLineBott.x2)
.y1 = vctPKLineBott.y1
.Radius = 10
.Scalar = c_dScalar
.Deg1 = 307
.Deg2 = 53
.Weight = 0.01
.Transparency = 0
.zOrder = MsoZOrderCmd.msoSendToBack
.ColorIndex = Color.Black
End With
With vctPos
.x1 = x
.y1 = vctGoalLineBott.y1
.Length = c_dblWid / 2 - 4
.Degrees = 90
End With
With vctPos2
.x1 = vctPos.x2
.y1 = vctPos.y1
.Length = 0.5
.Degrees = 180
End With
With vctGoalBott
.x1 = vctPos.x2
.y1 = vctPos2.y2
.Scalar = c_dScalar
.Length = 8
.Degrees = 90
.LineWeight = 2
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
End With
'// Corner Arcs
With arcCorner1
.x1 = x
.y1 = y
.Radius = 1.25
.Scalar = c_dScalar
.Deg1 = 90
.Deg2 = 180
.Weight = 0.08
.Transparency = 0
.zOrder = MsoZOrderCmd.msoSendToBack
.ColorIndex = Color.Black
End With
With arcCorner2
.x1 = vctGoalLineTop.x2
.y1 = y
.Radius = 1.25
.Scalar = c_dScalar
.Deg1 = 180
.Deg2 = 270
.Weight = 0.08
.Transparency = 0
.zOrder = MsoZOrderCmd.msoSendToBack
.ColorIndex = Color.Black
End With
With arcCorner3
.x1 = x
.y1 = vctSideLineLeft.y2
.Radius = 1.25
.Scalar = c_dScalar
.Deg1 = 0
.Deg2 = 90
.Weight = 0.08
.Transparency = 0
.zOrder = MsoZOrderCmd.msoSendToBack
.ColorIndex = Color.Black
End With
With arcCorner4
.x1 = vctGoalLineBott.x2
.y1 = vctSideLineLeft.y2
.Radius = 1.25
.Scalar = c_dScalar
.Deg1 = 270
.Deg2 = 0
.Weight = 0.08
.Transparency = 0
.zOrder = MsoZOrderCmd.msoSendToBack
.ColorIndex = Color.Black
End With
'// Hash Marks
With vctPos
.x1 = x
.y1 = y
.Length = 11
.Degrees = 90
End With
With vctHash1
.x1 = vctPos.x2
.y1 = y
.Scalar = c_dScalar
.Length = 1
.Degrees = 0
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 2
End With
With vctPos2
.x1 = vctGoalLineTop.x2
.y1 = y
.Length = 11
.Degrees = 270
End With
With vctHash2
.x1 = vctPos2.x2
.y1 = y
.Scalar = c_dScalar
.Length = 1
.Degrees = 0
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 2
End With
With vctHash3
.x1 = vctHash1.x1
.y1 = vctSideLineLeft.y2
.Scalar = c_dScalar
.Length = 1
.Degrees = 180
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 2
End With
With vctHash4
.x1 = vctHash2.x1
.y1 = vctSideLineLeft.y2
.Scalar = c_dScalar
.Length = 1
.Degrees = 180
.ArrowHeadBeg = msoArrowheadNone
.ArrowHeadEnd = msoArrowheadNone
.LineWeight = 2
End With
'// Draw Sequence
vctGoalLineTop.Draw
vctSideLineRight.Draw
vctSideLineLeft.Draw
vctGoalLineBott.Draw
vctLineMidField.Draw
shpCircMidField.Draw
shpDotMidField.Draw
vctGoalBoxTopLeft.Draw
vctGoalBoxTopCross.Draw
vctGoalBoxTopRight.Draw
vctGoalBoxBottLeft.Draw
vctGoalBoxBottCross.Draw
vctGoalBoxBottRight.Draw
vctPenaltyTopLeft.Draw
vctPenaltyTopCross.Draw
vctPenaltyTopRight.Draw
vctPenaltyBottLeft.Draw
vctPenaltyBottCross.Draw
vctPenaltyBottRight.Draw
vctPKLineTop.Draw
arcTopPenBox.Draw
vctGoalTop.Draw
vctPKLineBott.Draw
arcBottPenBox.Draw
vctGoalBott.Draw
arcCorner1.Draw
arcCorner2.Draw
arcCorner3.Draw
arcCorner4.Draw
vctHash1.Draw
vctHash2.Draw
vctHash3.Draw
vctHash4.Draw
End Sub