/// <summary> /// Plot /// </summary> /// <param name="dc"></param> /// <param name="fin"></param> /// <param name="penne"></param> public void Plot(Graphics dc, Finestra fin, Pen[] penne) { foreach (DisplayListElement dle in dl) { dle.Plot(dc, fin, penne); } }
public Lente01() { InitializeComponent(); lente = new Lente(); // Crea nuovi oggetti sorgente = new SorgenteOttica(); finestra = new Finestra(); nomefile = "-"; displayList = new DisplayList(); singolo = new Ambiente(); completo = new Ambiente(); ambienteAttivo = singolo; penne = new Pen[4]; penne[0] = new Pen(Color.Blue,2); penne[1] = new Pen(Color.Red,1); penne[2] = new Pen(Color.Green,1); penne[3] = new Pen(Color.Gray,1); angolo = 0; this.gradiprimi.Value = angolo; percentodiam = 110; this.percdiam.Value = percentodiam; RidimensionaFinestra(); // Richiede primo ricalcolo della finestra }
/// <summary> /// Plot /// </summary> /// <param name="dc"></param> /// <param name="fin"></param> /// <param name="penne"></param> public void Plot(Graphics dc, Finestra fin, Pen[] penne) { foreach(DisplayListElement dle in dl) { dle.Plot(dc, fin, penne); } }
/// <summary> /// Plot /// </summary> /// <param name="dc"></param> /// <param name="fin"></param> /// <param name="penne"></param> public void Plot(Graphics dc, Finestra fin, Pen[] penne) { if ((penna >= penne.Length) || (penna < 0)) { return; } tratto.Plot(dc, fin, penne[penna]); }
/// <summary> /// Disegna /// </summary> /// <param name="dc"></param> /// <param name="fin"></param> /// <param name="penna"></param> public override void Plot(Graphics dc, Finestra fin, Pen penna) { if(IsValid) { Point start, end; start = fin.Get(this.pStart); end = fin.Get(this.pEnd); dc.DrawLine(penna,start,end); } }
/// <summary> /// Plot /// </summary> /// <param name="dc"></param> /// <param name="fin"></param> /// <param name="penna"></param> public void Plot(Graphics dc, Finestra fin, Pen penna) { this.Tratto.Plot(dc,fin,penna); }
/// <summary> /// Plot /// </summary> /// <param name="dc"></param> /// <param name="fin"></param> /// <param name="penna"></param> public override void Plot(Graphics dc, Finestra fin, Pen penna) { if(IsValid) { Point2D bassosx, altodx, diag_meta; float alfini, alffin, alfswp; diag_meta = new Point2D( this.Radius, this.Radius); bassosx = this.Center - diag_meta; altodx = this.Center + diag_meta; if(IsCircle) { Point bsx, adx; bsx = fin.Get(bassosx); adx = fin.Get(altodx); int xm,ym,xM,yM; xm = Math.Min(bsx.X, adx.X); xM = Math.Max(bsx.X, adx.X); ym = Math.Min(bsx.Y, adx.Y); yM = Math.Max(bsx.Y, adx.Y); Rectangle rct = new Rectangle(new Point(xm,ym), new Size(xM-xm,yM-ym)); dc.DrawEllipse(penna,rct); } else { Point start, end, center, bsx, adx; start = fin.Get(this.pStart); end = fin.Get(this.pEnd); center = fin.Get( this.Center); bsx = fin.Get(bassosx); adx = fin.Get(altodx); int xm,ym,xM,yM; xm = Math.Min(bsx.X, adx.X); xM = Math.Max(bsx.X, adx.X); ym = Math.Min(bsx.Y, adx.Y); yM = Math.Max(bsx.Y, adx.Y); Rectangle rct = new Rectangle(new Point(xm,ym), new Size(xM-xm,yM-ym)); // Cambiati segni e scambiati ini con fin... alffin = (float)(-this.AlfaIni*180/Math.PI); alfini = (float)(-this.AlfaFin*180/Math.PI); if(alfini < 0.0) alfini = 360.0F + alfini; if(alffin < 0.0) alffin = 360.0F + alffin; // alfaini e alfafin corretti e concordi if(alffin >= alfini) // calcolo sweep alfswp = alffin - alfini; else alfswp = 360.0F-alfini + alffin; dc.DrawArc(penna,rct,alfini,alfswp); } } }
/// <summary> /// Plot /// </summary> /// <param name="dc"></param> /// <param name="fin"></param> /// <param name="penne"></param> public void Plot(Graphics dc, Finestra fin, Pen[] penne) { if((penna >= penne.Length) || (penna<0)) return; tratto.Plot(dc,fin,penne[penna]); }
/// <summary> /// Plot /// </summary> /// <param name="dc"></param> /// <param name="fin"></param> /// <param name="penna"></param> public override void Plot(Graphics dc, Finestra fin, Pen penna) { foreach(Contorno cn in contorni) { cn.Plot(dc,fin,penna); } }
/// <summary> /// Plot (non fa nulla) /// </summary> /// <param name="dc"></param> /// <param name="fin"></param> /// <param name="penna"></param> public override void Plot(Graphics dc, Finestra fin, Pen penna) {} // Non fa nulla
public abstract void Plot(Graphics dc, Finestra fin, Pen penna);
/// <summary> /// Plot /// </summary> /// <param name="dc"></param> /// <param name="fin"></param> /// <param name="penna"></param> public void Plot(Graphics dc, Finestra fin, Pen penna) { foreach(OggettoOttico ogg in oggetti) { ogg.Plot(dc,fin,penna); } }
/// <summary> /// Da completare /// </summary> /// <param name="dc"></param> /// <param name="fin"></param> /// <param name="penna"></param> public override void Plot(Graphics dc, Finestra fin, Pen penna) { #warning SorgenteOttica.Plot da provare ! if(IsValid) { Point start, end; Point2D vettore = lineaRaggio.Vector(); // Direzione //double alfa = vettore.Alfa(); // Angolo Point2D normale = vettore.Normal(); // Normale Point2D vmeta = normale * diametro * 0.5; // Vettore di meta` lunghezza Point2D pp, pm; pp = lineaRaggio.P1 + vmeta; // Origini pm = lineaRaggio.P1 - vmeta; start = fin.Get(pp); end = fin.Get(pm); dc.DrawLine(penna,start,end); dc.DrawLine(penna,start,end); } }