Page 1 of 1

fkRectangle

Posted: 29.08.2016 16:45
by nyce
need help with DrawMapArea proc, the fkRectangle isnt drawing. My points are incorrect?

also, whats the diff between fcWorld and fcScreen?

Thanks.

Code: Select all

Procedure DrawMap(X, Y: Integer);
Var
Figure: TMapFigure;
Begin
  Figure.kind := fkText;
  //fkLine, fkEllipse, fkRectangle,fkDirection,fkText
  Figure.coord := fcWorld;
  //fcWorld, fcScreen
  Figure.x1 := X;
  Figure.y1 := Y;
  Figure.x2 := 0;
  Figure.y2 := 0;
  Figure.brushStyle := bsClear;
  //bsSolid, bsClear, bsHorizontal, bsVertical, bsFDiagonal, bsBDiagonal, bsCross, bsDiagCross
  Figure.brushColor := $000000;
  Figure.color := $FFFF00;
  Figure.text := '*';
  AddFigure(Figure);
End;

Procedure DrawMapArea(X, Y: Integer);
Var
Figure: TMapFigure;
Begin
  Figure.kind := fkRectangle;
  //fkLine, fkEllipse, fkRectangle,fkDirection,fkText
  Figure.coord := fcWorld;
  //fcWorld, fcScreen
  Figure.x1 := X-10;
  Figure.y1 := Y-10;
  DrawMap(Figure.x1, Figure.y1);
  Figure.x2 := X+10;
  Figure.y2 := Y+10;
  DrawMap(Figure.x2, Figure.y2);
  AddToSystemJournal('x1: ' + IntToStr(Figure.x1) + ' y1: ' + IntToStr(Figure.y1) + ' x2: ' + IntToStr(Figure.x2) + ' y2: ' + IntToStr(Figure.y2));
  Figure.brushStyle := bsClear;
  //bsSolid, bsClear, bsHorizontal, bsVertical, bsFDiagonal, bsBDiagonal, bsCross, bsDiagCross
  Figure.brushColor := $000000;
  Figure.color := $FFFF00;
  Figure.text := '';
  AddFigure(Figure);
End;

begin
  DrawMapArea(GetX(self), GetY(self));
end.

Re: fkRectangle

Posted: 29.08.2016 20:46
by Vizit0r

Code: Select all

Figure.kind := fkRectangle;
  //fkLine, fkEllipse, fkRectangle,fkDirection,fkText
  Figure.coord := fcWorld;
  //fcWorld, fcScreen
  Figure.x1 := X-20;
  Figure.y1 := Y;
  DrawMap(Figure.x1, Figure.y1);
  Figure.x2 := X+20;
  Figure.y2 := Y;
also, whats the diff between fcWorld and fcScreen?
fcWorld - coordinates calculates according to current zoom, map size etc
fcScreen - draws by absolute coordinates from user.