C# Class CityGeneratorWPF.Service.DrawService

Handles Drawing to a canvas
Show file Open project: TobieD/City-Generator Class Usage Examples

Public Properties

Property Type Description
OnClick ClickOnCanvas

Public Methods

Method Description
ClearCanvas ( ) : void

Clear the entire canvas

DrawCell ( Cell cell, Color c, bool bFill = true, bool bBorder = false ) : void
DrawCircle ( Circle cr, Color c ) : void
DrawCircle ( Point p, double radius, Color c ) : void
DrawDistrict ( District district, Color c, bool bDrawRoads, bool bDrawCells ) : void
DrawLine ( Point p1, Point p2, Color c, int thick = 1 ) : void

Draw a line from point 1 to point 2

DrawLine ( Voronoi line, Color c, int thick = 1 ) : void
DrawPoint ( Point p, double radius, Color c ) : void

Add a point to the canvas

DrawPolygon ( IList points, Color c ) : void
DrawPolygon ( Triangle t, Color c ) : void
DrawRectangle ( Point p, int width, int height, Color c ) : void

Draw Rectangle from a point and width and height

DrawRectangle ( Rectangle rect, Color c ) : void
DrawRoad ( Road road, Color linecolor, Color startColor, Color endColor, bool drawStartEnd = true, int width = 1 ) : void
DrawService ( Canvas drawCanvas ) : System.Collections.Generic

Create a new DrawService and hook up the events

DrawText ( string text, Color c, Point position ) : void
DrawTriangle ( Point p1, Point p2, Point p3, Color c ) : void
DrawTriangle ( Triangle t, Color c ) : void

Private Methods

Method Description
OnCanvasMouseDown ( object sender, System e ) : void

On mouse Down event

Method Details

ClearCanvas() public method

Clear the entire canvas
public ClearCanvas ( ) : void
return void

DrawCell() public method

public DrawCell ( Cell cell, Color c, bool bFill = true, bool bBorder = false ) : void
cell Voronoi.Cell
c System.Windows.Media.Color
bFill bool
bBorder bool
return void

DrawCircle() public method

public DrawCircle ( Circle cr, Color c ) : void
cr Voronoi.Circle
c System.Windows.Media.Color
return void

DrawCircle() public method

public DrawCircle ( Point p, double radius, Color c ) : void
p Voronoi.Point
radius double
c System.Windows.Media.Color
return void

DrawDistrict() public method

public DrawDistrict ( District district, Color c, bool bDrawRoads, bool bDrawCells ) : void
district CityGenerator.District
c System.Windows.Media.Color
bDrawRoads bool
bDrawCells bool
return void

DrawLine() public method

Draw a line from point 1 to point 2
public DrawLine ( Point p1, Point p2, Color c, int thick = 1 ) : void
p1 Voronoi.Point
p2 Voronoi.Point
c System.Windows.Media.Color
thick int
return void

DrawLine() public method

public DrawLine ( Voronoi line, Color c, int thick = 1 ) : void
line Voronoi
c System.Windows.Media.Color
thick int
return void

DrawPoint() public method

Add a point to the canvas
public DrawPoint ( Point p, double radius, Color c ) : void
p Voronoi.Point
radius double
c System.Windows.Media.Color
return void

DrawPolygon() public method

public DrawPolygon ( IList points, Color c ) : void
points IList
c System.Windows.Media.Color
return void

DrawPolygon() public method

public DrawPolygon ( Triangle t, Color c ) : void
t Voronoi.Triangle
c System.Windows.Media.Color
return void

DrawRectangle() public method

Draw Rectangle from a point and width and height
public DrawRectangle ( Point p, int width, int height, Color c ) : void
p Voronoi.Point
width int
height int
c Color
return void

DrawRectangle() public method

public DrawRectangle ( Rectangle rect, Color c ) : void
rect Voronoi.Rectangle
c Color
return void

DrawRoad() public method

public DrawRoad ( Road road, Color linecolor, Color startColor, Color endColor, bool drawStartEnd = true, int width = 1 ) : void
road Road
linecolor Color
startColor Color
endColor Color
drawStartEnd bool
width int
return void

DrawService() public method

Create a new DrawService and hook up the events
public DrawService ( Canvas drawCanvas ) : System.Collections.Generic
drawCanvas Canvas
return System.Collections.Generic

DrawText() public method

public DrawText ( string text, Color c, Point position ) : void
text string
c Color
position Voronoi.Point
return void

DrawTriangle() public method

public DrawTriangle ( Point p1, Point p2, Point p3, Color c ) : void
p1 Voronoi.Point
p2 Voronoi.Point
p3 Voronoi.Point
c Color
return void

DrawTriangle() public method

public DrawTriangle ( Triangle t, Color c ) : void
t Triangle
c Color
return void

Property Details

OnClick public property

public ClickOnCanvas OnClick
return ClickOnCanvas