📄 treetransit.pas
字号:
{***********************************************}
{ TTree Component - Transit Shapes }
{ Copyright (c) 2001-2002 by David Berneda }
{***********************************************}
{$I TeeDefs.inc}
unit TreeTransit;
{ Several custom shapes used in streets and roads... }
interface
Uses {$IFNDEF LINUX}
Windows,
{$ENDIF}
Classes,
{$IFDEF CLX}
QGraphics, Types, QControls,
{$ELSE}
Graphics, Controls,
{$ENDIF}
TeeTree, TreeFlow, TeCanvas;
type TTransitShape=class(TCustomTreeShape);
TStopShape=class(TOctagonShape)
public
Constructor Create(AOwner: TComponent); override;
Procedure RecalcSize(ACanvas:TCanvas3D); override;
published
property Color default clRed;
end;
TYieldShape=class(TTransitShape)
public
Constructor Create(AOwner: TComponent); override;
published
property Color default clYellow;
property Style default tssTriangleBottom;
end;
TSlowShape=class(TTransitShape)
public
Constructor Create(AOwner: TComponent); override;
published
property Color default clYellow;
property Style default tssDiamond;
end;
TDangerShape=class(TTransitShape)
public
Constructor Create(AOwner: TComponent); override;
published
property Color default clRed;
property Style default tssDiamond;
end;
implementation
Uses TreeConst;
{ TStopShape }
constructor TStopShape.Create(AOwner: TComponent);
begin
inherited;
Color:=clRed;
Border.Color:=clWhite;
Font.Color:=clWhite;
Font.Style:=[fsBold];
Text.Clear;
Text.Add('STOP');
end;
procedure TStopShape.RecalcSize(ACanvas:TCanvas3D);
var tmp : Integer;
begin
inherited;
tmp:=Width;
tmp:=Round(1.1*tmp);
Height:=tmp;
Width:=tmp;
ChangeAutoSize(True);
end;
{ TYieldShape }
constructor TYieldShape.Create(AOwner: TComponent);
begin
inherited;
Border.Color:=clBlack;
Border.Visible:=True;
Color:=clYellow;
Style:=tssTriangleBottom;
Text.Clear;
Text.Add('YIELD');
end;
{ TSlowShape }
constructor TSlowShape.Create(AOwner: TComponent);
begin
inherited;
Color:=clYellow;
Style:=tssDiamond;
Font.Style:=[fsBold];
Text.Clear;
Text.Add('SLOW');
end;
{ TDangerShape }
constructor TDangerShape.Create(AOwner: TComponent);
begin
inherited;
Color:=clRed;
Style:=tssDiamond;
Font.Color:=clWhite;
Text.Clear;
Text.Add('DANGER');
end;
initialization
RegisterCustomTreeShape(TeeTree_tabTransit, 'Stop', TStopShape);
RegisterCustomTreeShape(TeeTree_tabTransit, 'Yield', TYieldShape);
RegisterCustomTreeShape(TeeTree_tabTransit, 'Slow', TSlowShape);
RegisterCustomTreeShape(TeeTree_tabTransit, 'Danger', TDangerShape);
finalization
UnRegisterCustomTreeShapes([ TStopShape, TYieldShape, TSlowShape,
TDangerShape ]);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -