Einzelnen Beitrag anzeigen

brechi

Registriert seit: 30. Jan 2004
823 Beiträge
 
#12

AW: Brauche Denkanstoß für Zeichnung mit Gauß Krügerkoordinaten

  Alt 2. Apr 2018, 16:27
Ich blick zwar gerade nicht mehr komplett durch, aber:

Delphi-Quellcode:
procedure TForm1.Zeichnen;
var x1,x2,y1,y2,a,i:integer;
begin
image1.Picture.assign(nil);
SortStringGrid(StringGrid1, 3);
min1:=strtofloat(stringgrid1.Cells[3, 1]);
max1:=strtofloat(stringgrid1.Cells[3, stringgrid1.RowCount-1]);
SortStringGrid(StringGrid1, 2);
min2:=strtofloat(stringgrid1.Cells[4, 1]);
max2:=strtofloat(stringgrid1.Cells[4, stringgrid1.RowCount-1]);

label1.Caption:=inttostr(round((max2-min2+5)*20))+' '+inttostr(round((max1-min1+5)*20));

image1.Height:=abs(round((max2-min2)*20) + 40); // geaendert!
image1.Width:=abs(round((max1-min1)*20)) + 40); // geaendert!

// hier auf "+ 40" gaendert, da unten y2/x2 .. bei der 2. Koordinate + 40 addiert wird
// ggf. noch wegen der Textausgabe vergrößern mit z.B. Canvas.GetTextHeight bzw. Canvas.GetTextWidth und die zusätzlichen "+ 25"

for a := stringgrid1.RowCount-1 downto 1 do
begin
x1:=round((strtofloat(stringgrid1.Cells[3, a])-min1)*20);
y1:=round((max2-strtofloat(stringgrid1.Cells[4, a]))*20);
x2:=x1+40;
y2:=y1+40;
image1.canvas.brush.Style:=(bsclear);
image1.canvas.pen.color:=clblack;
image1.canvas.Ellipse(x1,y1,x2,y2);
image1.Canvas.TextOut(x1+25,y1+25,stringgrid1.Cells[0, a]);
end;
end;
  Mit Zitat antworten Zitat