Changeset 238 for trunk/UMap.pas
- Timestamp:
- Sep 21, 2018, 12:15:23 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UMap.pas
r233 r238 155 155 Areas: TMapAreas; 156 156 Cyclic: Boolean; 157 procedure DrawArrow(Canvas: TCanvas; Pos: TPoint; Angle: Double;158 Text: string; Zoom: Double);159 157 function IsOutsideShape(Coord: TPoint): Boolean; virtual; 160 158 function IsCellsNeighbor(Cell1, Cell2: TCell): Boolean; virtual; … … 549 547 end; 550 548 551 procedure TMap.DrawArrow(Canvas: TCanvas; Pos: TPoint;552 Angle: Double; Text: string; Zoom: Double);553 var554 Points: array of Classes.TPoint;555 FPoints: array of TPointF;556 I: Integer;557 ArrowSize: TPoint;558 begin559 Canvas.Brush.Color := clWhite;560 Canvas.Pen.Color := clBlack;561 SetLength(Points, 8);562 SetLength(FPoints, 8);563 ArrowSize := TPoint.Create(Trunc(DefaultCellSize.X / 3 * Zoom),564 Trunc(DefaultCellSize.Y / 3 * Zoom));565 FPoints[0] := TPointF.Create(+0.5 * ArrowSize.X, +0 * ArrowSize.Y);566 FPoints[1] := TPointF.Create(+0 * ArrowSize.X, +0.5 * ArrowSize.Y);567 FPoints[2] := TPointF.Create(+0 * ArrowSize.X, +0.25 * ArrowSize.Y);568 FPoints[3] := TPointF.Create(-0.5 * ArrowSize.X, +0.25 * ArrowSize.Y);569 FPoints[4] := TPointF.Create(-0.5 * ArrowSize.X, -0.25 * ArrowSize.Y);570 FPoints[5] := TPointF.Create(+0 * ArrowSize.X, -0.25 * ArrowSize.Y);571 FPoints[6] := TPointF.Create(+0 * ArrowSize.X, -0.5 * ArrowSize.Y);572 FPoints[7] := TPointF.Create(+0.5 * ArrowSize.X, 0 * ArrowSize.Y);573 // Rotate574 for I := 0 to Length(Points) - 1 do575 FPoints[I] := TPointF.Create(FPoints[I].X * Cos(Angle) - FPoints[I].Y * Sin(Angle),576 FPoints[I].X * Sin(Angle) + FPoints[I].Y * Cos(Angle));577 // Shift578 for I := 0 to Length(Points) - 1 do579 Points[I] := Point(Trunc(FPoints[I].X + Pos.X), Trunc(FPoints[I].Y + Pos.Y));580 with Canvas do begin581 Brush.Style := bsSolid;582 Polygon(Points);583 Brush.Style := bsClear;584 Font.Color := clBlack;585 Font.Size := Trunc(26 * Zoom);586 TextOut(Pos.X - TextWidth(Text) div 2,587 Pos.Y - TextHeight(Text) div 2, Text);588 Pen.Width := 1;589 end;590 end;591 592 549 function TMap.IsCellsNeighbor(Cell1, Cell2: TCell): Boolean; 593 550 begin
Note:
See TracChangeset
for help on using the changeset viewer.