public void Draw( Graphics g, int x, int y )
{
switch (markerType_)
{
case MarkerType.Cross1:
g.DrawLine( pen_, x-h_, y+h_, x+h_, y-h_ );
g.DrawLine( pen_, x+h_, y+h_, x-h_, y-h_ );
break;
case MarkerType.Cross2:
g.DrawLine( pen_, x, y-h_, x, y+h_ );
g.DrawLine( pen_, x-h_, y, x+h_, y );
break;
case MarkerType.Circle:
g.DrawEllipse( pen_, x-h_, y-h_, size_, size_ );
if ( this.filled_ )
{
g.FillEllipse( brush_, x-h_, y-h_, size_, size_ );
}
break;
case MarkerType.Square:
g.DrawRectangle( pen_, x-h_, y-h_, size_, size_ );
if ( this.filled_ )
{
g.FillRectangle( brush_, x-h_, y-h_, size_, size_ );
}
break;
case MarkerType.Triangle:
case MarkerType.TriangleDown:
{
Point p1 = new Point( x-h_, y-h_ );
Point p2 = new Point( x, y+h_ );
Point p3 = new Point( x+h_, y-h_ );
Point [] pts = new Point [3] { p1, p2, p3 };
GraphicsPath gp = new GraphicsPath();
gp.AddPolygon( pts );
g.DrawPath( pen_, gp );
if (this.filled_)
{
g.FillPath( brush_, gp );
}
break;
}
case MarkerType.TriangleUp:
{
Point p1 = new Point( x-h_, y+h_ );
Point p2 = new Point( x, y-h_ );
Point p3 = new Point( x+h_, y+h_ );
Point [] pts = new Point [3] { p1, p2, p3 };
GraphicsPath gp = new GraphicsPath();
gp.AddPolygon( pts );
g.DrawPath( pen_, gp );
if (this.filled_)
{
g.FillPath( brush_, gp );
}
break;
}
case MarkerType.FilledCircle:
g.DrawEllipse( pen_, x-h_, y-h_, size_, size_ );
g.FillEllipse( brush_, x-h_, y-h_, size_, size_ );
break;
case MarkerType.FilledSquare:
g.DrawRectangle( pen_, x-h_, y-h_, size_, size_ );
g.FillRectangle( brush_, x-h_, y-h_, size_, size_ );
break;
case MarkerType.FilledTriangle:
{
Point p1 = new Point( x-h_, y-h_ );
Point p2 = new Point( x, y+h_ );
Point p3 = new Point( x+h_, y-h_ );
Point [] pts = new Point [3] { p1, p2, p3 };
GraphicsPath gp = new GraphicsPath();
gp.AddPolygon( pts );
g.DrawPath( pen_, gp );
g.FillPath( brush_, gp );
break;
}
case MarkerType.Diamond:
{
Point p1 = new Point( x-h_, y );
Point p2 = new Point( x, y-h_ );
Point p3 = new Point( x+h_, y );
Point p4 = new Point( x, y+h_ );
Point [] pts = new Point [4] { p1, p2, p3, p4 };
GraphicsPath gp = new GraphicsPath();
gp.AddPolygon( pts );
g.DrawPath( pen_, gp );
if (this.filled_)
{
g.FillPath( brush_, gp );
}
break;
}
case MarkerType.Flag:
case MarkerType.FlagUp:
{
Point p1 = new Point( x, y );
Point p2 = new Point( x, y-size_ );
Point p3 = new Point( x+size_, y-size_+size_/3 );
Point p4 = new Point( x, y-size_+2*size_/3 );
g.DrawLine( pen_, p1, p2 );
Point [] pts = new Point [3] { p2, p3, p4 };
GraphicsPath gp = new GraphicsPath();
gp.AddPolygon( pts );
g.DrawPath( pen_, gp );
if (this.filled_)
{
g.FillPath( brush_, gp );
}
break;
}
case MarkerType.FlagDown:
{
Point p1 = new Point( x, y );
Point p2 = new Point( x, y+size_ );
Point p3 = new Point( x+size_, y+size_-size_/3 );
Point p4 = new Point( x, y+size_-2*size_/3 );
g.DrawLine( pen_, p1, p2 );
Point [] pts = new Point [3] { p2, p3, p4 };
GraphicsPath gp = new GraphicsPath();
gp.AddPolygon( pts );
g.DrawPath( pen_, gp );
if (this.filled_)
{
g.FillPath( brush_, gp );
}
break;
}
case MarkerType.None:
break;
}
}