C# Класс CityGeneratorWPF.Service.DrawService

Handles Drawing to a canvas
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
OnClick ClickOnCanvas

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
OnCanvasMouseDown ( object sender, System e ) : void

On mouse Down event

Описание методов

ClearCanvas() публичный Метод

Clear the entire canvas
public ClearCanvas ( ) : void
Результат void

DrawCell() публичный Метод

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
Результат void

DrawCircle() публичный Метод

public DrawCircle ( Circle cr, Color c ) : void
cr Voronoi.Circle
c System.Windows.Media.Color
Результат void

DrawCircle() публичный Метод

public DrawCircle ( Point p, double radius, Color c ) : void
p Voronoi.Point
radius double
c System.Windows.Media.Color
Результат void

DrawDistrict() публичный Метод

public DrawDistrict ( District district, Color c, bool bDrawRoads, bool bDrawCells ) : void
district CityGenerator.District
c System.Windows.Media.Color
bDrawRoads bool
bDrawCells bool
Результат void

DrawLine() публичный Метод

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
Результат void

DrawLine() публичный Метод

public DrawLine ( Voronoi line, Color c, int thick = 1 ) : void
line Voronoi
c System.Windows.Media.Color
thick int
Результат void

DrawPoint() публичный Метод

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
Результат void

DrawPolygon() публичный Метод

public DrawPolygon ( IList points, Color c ) : void
points IList
c System.Windows.Media.Color
Результат void

DrawPolygon() публичный Метод

public DrawPolygon ( Triangle t, Color c ) : void
t Voronoi.Triangle
c System.Windows.Media.Color
Результат void

DrawRectangle() публичный Метод

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
Результат void

DrawRectangle() публичный Метод

public DrawRectangle ( Rectangle rect, Color c ) : void
rect Voronoi.Rectangle
c Color
Результат void

DrawRoad() публичный Метод

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
Результат void

DrawService() публичный Метод

Create a new DrawService and hook up the events
public DrawService ( Canvas drawCanvas ) : System.Collections.Generic
drawCanvas Canvas
Результат System.Collections.Generic

DrawText() публичный Метод

public DrawText ( string text, Color c, Point position ) : void
text string
c Color
position Voronoi.Point
Результат void

DrawTriangle() публичный Метод

public DrawTriangle ( Point p1, Point p2, Point p3, Color c ) : void
p1 Voronoi.Point
p2 Voronoi.Point
p3 Voronoi.Point
c Color
Результат void

DrawTriangle() публичный Метод

public DrawTriangle ( Triangle t, Color c ) : void
t Triangle
c Color
Результат void

Описание свойств

OnClick публичное свойство

public ClickOnCanvas OnClick
Результат ClickOnCanvas