public override void Draw(GlRectangle Border) { if (Border == null || !ActivateDrawStart()) { return; } ActivateDrawing(); GlPointR2[] I = this.getIntersection(Border); switch (I.Length) { case 0: if (OnDrawed != null) { OnDrawed.Invoke(this); } return; case 1: new GlLineSegment(I[0], I[0]).Draw(); break; case 2: new GlLineSegment(I[0], I[1]).Draw(); break; } ActivateDrawed(); }
public GlRectangle(GlRectangle copyRectangle) : this(copyRectangle == null ? new GlPointR2(float.NaN, float.NaN) : copyRectangle.leftTopPoint, copyRectangle == null ? 0 : copyRectangle.Width, copyRectangle == null ? 0 : copyRectangle.Height, copyRectangle == null ? new GlVectorR2(0, 0) : copyRectangle.directVector) { }
public void Draw(GlRectangle Border, GlColor drawColor, float drawWidth) { float curWidth = this.getCurrentGlWidth(); Gl.glLineWidth(drawWidth); this.Draw(Border, drawColor); Gl.glLineWidth(curWidth); }
/// <summary> /// Draw the point if it is inside the border rectangle /// </summary> public override void Draw(GlRectangle Border) { if (Border == null || !Border.isPointInside(this)) { return; } this.Draw(); }
public override void Draw(GlRectangle Border) { if (Border == null) { return; } this.DrawFigures((F) => { F.Draw(Border); }); }
public void DrawFill(GlRectangle Border, GlColor drawColor) { GlColor curColor = this.getCurrentGlColor(); if (drawColor != null) { Gl.glColor3f(drawColor.R, drawColor.G, drawColor.B); } this.DrawFill(Border); Gl.glColor3f(curColor.R, curColor.G, curColor.B);; }
private void DrawFigures(FigureDrawBorder DrawMethod, GlRectangle Border) { if (!ActivateDrawStart()) { return; } ActivateDrawing(); foreach (GlFigure F in this.figuresAmount) { DrawMethod.Invoke(F, Border); } ActivateDrawed(); }
/// <summary> /// Draw the point if it is inside the border rectangle /// </summary> public override void DrawFill(GlRectangle Border) { this.Draw(Border); }
public override void DrawFill(GlRectangle Border) { this.DrawFigures((F) => { F.DrawFill(Border); }); }
/// <summary> /// Draws filled a part of the figure that is inside the border rectangle /// </summary> /// <param name="Border">border rectangle</param> public abstract void DrawFill(GlRectangle Border);
private void DrawPoints(GlRectangle Border, int GlDrawMode) { if (Border == null || !ActivateDrawStart()) { return; } ActivateDrawing(); bool isInside = Border.isPointInside(this[0]); GlPolygon ToDraw = new GlPolygon(this.Center); if (Border.isPointInside(this[this.CountOfPoints - 1]) != isInside) { if (!isInside) { ToDraw.AddVertex(this[this.CountOfPoints - 1]); } GlPointR2[] I = new GlLineR2(this[0], new GlVectorR2(this[0].X - this[this.CountOfPoints - 1].X, this[0].Y - this[this.CountOfPoints - 1].Y)).getIntersection(Border); if (I.Length == 2) { ToDraw.AddVertex(new GlLineSegment(this[this.CountOfPoints - 1], this[0]).isPointBelongs(I[0]) ? I[0] : I[1]); } else if (I.Length == 1 && new GlLineSegment(this[this.CountOfPoints - 1], this[0]).isPointBelongs(I[0])) { ToDraw.AddVertex(I[0]); } } for (int i = 0; i < this.CountOfPoints - 1; i++) { if (isInside) { ToDraw.AddVertex(this[i]); } if (Border.isPointInside(this[i + 1]) != isInside) { GlPointR2[] I = new GlLineR2(this[i], new GlVectorR2(this[i + 1].X - this[i].X, this[i + 1].Y - this[i].Y)).getIntersection(Border); if (I.Length == 2) { ToDraw.AddVertex(new GlLineSegment(this[i], this[i + 1]).isPointBelongs(I[0]) ? I[0] : I[1]); } else if (I.Length == 1 && new GlLineSegment(this[i], this[i + 1]).isPointBelongs(I[0])) { ToDraw.AddVertex(I[0]); } isInside = !isInside; } } Gl.glBegin(GlDrawMode); for (int i = 0; i < ToDraw.CountOfPoints; i++) { if (ToDraw[i] != null) { Gl.glVertex2f(ToDraw[i].X, ToDraw[i].Y); } } Gl.glEnd(); ActivateDrawed(); }
public override void DrawFill(GlRectangle Border) { DrawPoints(Border, Gl.GL_POLYGON); }
public override void Draw(GlRectangle Border) { DrawPoints(Border, Gl.GL_LINE_STRIP); }