public override void Berechnung() { if (AnschlussGleis != null) { PositionRaster = AnschlussGleis.GetRasterPosition(this, Gleisposition); } Matrix matrix = new Matrix(); matrix.Translate(PositionRaster.X * Zoom, PositionRaster.Y * Zoom); matrix.Scale(Zoom, Zoom); //this.graphicsPathHintergrund.Reset(); this._graphicsPathText = new GraphicsPath(); this._graphicsPathText.AddString(_txt, new FontFamily("Arial"), 0, 0.6f, new PointF(-0.5f, -0.36f), this._stringFormat); RectangleF rechteck = _graphicsPathText.GetBounds(); if (_lage) { float l = rechteck.Width; this._graphicsPathText = new GraphicsPath(); this._graphicsPathText.AddString(_txt, new FontFamily("Arial"), 0, 0.6f, new PointF(-l, -0.36f), this._stringFormat); rechteck = _graphicsPathText.GetBounds(); } rechteck.Inflate(0.1f, 0f); this._graphicsPathText.Transform(matrix); this._graphicsPathHintergrund = new GraphicsPath(); this._graphicsPathHintergrund.AddRectangle(rechteck); this._graphicsPathHintergrund.Transform(matrix); }
public override bool GleisElementAustragen() { if (AnschlussGleis != null) { AnschlussGleis.GleisElementAustragen(this); this.AnschlussGleis = null; return(true); } return(false); }
/// <summary> /// berechnet die Grafik zum Zeichnen /// </summary> public override void Berechnung() { if (AnschlussGleis != null) { PositionRaster = AnschlussGleis.GetRasterPosition(this, Gleisposition); } Matrix matrix = new Matrix(); matrix.Translate(PositionRaster.X * Zoom, PositionRaster.Y * Zoom); matrix.Scale(Zoom, Zoom); this._graphicsPath.Reset(); this._graphicsPath.AddRectangle(new RectangleF(-0.4f, -0.4f, 0.8f, 0.8f)); this._graphicsPath.Transform(matrix); }
/// <summary> /// berechnet die Grafik /// </summary> public override void Berechnung() { //Stopwatch watch = new Stopwatch(); //watch.Start(); if (AnschlussGleis != null) { PositionRaster = AnschlussGleis.GetRasterPosition(this, Gleisposition); } int winkel = 0; if (AnschlussGleis != null) { winkel = AnschlussGleis.GetDirection(InZeichenRichtung) * 45; } Matrix matrix = new Matrix(); matrix.Translate(this.PositionRaster.X * this.Zoom, this.PositionRaster.Y * this.Zoom); matrix.Scale(this.Zoom, this.Zoom); matrix.Rotate(-winkel); this._graphicsPathHintergrund.Reset(); this._graphicsPathHintergrund.AddEllipse(new RectangleF(-0.5f, -0.5f, 1f, 1f)); this._graphicsPathHintergrund.Transform(matrix); this._graphicsPathKreis.Reset(); this._graphicsPathKreis.AddEllipse(new RectangleF(0f, 0f, 0.5f, 0.5f)); this._graphicsPathKreis.Transform(matrix); this._graphicsPathLinien.Reset(); this._graphicsPathLinien.AddLines(new PointF[] { new PointF(0.0f, 0.25f), new PointF(-0.5f, 0.25f), new PointF(-0.5f, 0.5f), new PointF(-0.5f, 0.0f) }); this._graphicsPathLinien.Transform(matrix); if (this.AnzeigenTyp == AnzeigeTyp.Bedienen) { Matrix matrixText = new Matrix(); matrixText.Translate(this.PositionRaster.X * this.Zoom, this.PositionRaster.Y * this.Zoom); matrixText.Scale(this.Zoom, this.Zoom); this._graphicsPathText.Reset(); this._graphicsPathText.AddString(ID.ToString(), new FontFamily("Arial"), 0, 0.5f, this.DrehenUmPunkt(new PointF(0, 0), new PointF(0, -0.25f), winkel), this._stringFormat); this._graphicsPathText.Transform(matrixText); } //watch.Stop(); //double diff = watch.Elapsed.TotalMilliseconds; }
public override void Berechnung() { if (AnschlussGleis != null) { PositionRaster = AnschlussGleis.GetRasterPosition(this, Gleisposition); } Matrix matrix = new Matrix(); matrix.Translate(this.PositionRaster.X * this.Zoom, this.PositionRaster.Y * this.Zoom); matrix.Scale(this.Zoom, this.Zoom); this._aktivZeichen = new GraphicsPath(); this._aktivZeichen.AddLines(new PointF[] { new PointF(-0.45f, 0), new PointF(0.45f, 0), new PointF(0, -0.45f) }); this._aktivZeichen.CloseFigure(); this._passivZeichen = (GraphicsPath)this._aktivZeichen.Clone(); this._aktivZeichen.Transform(matrix); matrix.Rotate(180); this._passivZeichen.Transform(matrix); }
public override bool AusgangToggeln() { return(AnschlussGleis.AusgangToggeln()); }