📄 ezentities.pas
字号:
Property PointsInCurve: Word {$IFDEF BCB} Read GetPointsInCurve {$ElSE} Read FPointsInCurve {$ENDIF} Write SetPointsInCurve;
Property CenterX: Double {$IFDEF BCB} Read GetCenterX Write SetCenterX {$ElSE} Read FCenterX Write FCenterX {$ENDIF};
Property CenterY: Double {$IFDEF BCB} Read GetCenterY Write SetCenterY {$ElSE} Read FCenterY Write FCenterY {$ENDIF};
Property Radius: Double {$IFDEF BCB} Read GetRadius Write SetRadius {$ElSE} Read FRadius Write FRadius {$ENDIF};
End;
{-------------------------------------------------------------------------------}
{ TEzEllipse2D }
{-------------------------------------------------------------------------------}
TEzEllipse = Class( TEzClosedEntity )
Private
FRotangle: Double;
Procedure SetRotangle( Const Value: Double );
Procedure MoveAndRotateControlPts( Var MovePt, RotatePt: TEzPoint; Grapher: TEzGrapher );
{$IFDEF BCB}
function GetPointsInCurve: Integer;
function GetRotangle: Double;
{$ENDIF}
Protected
FPointsInCurve: Integer;
FCurvePoints: TEzVector;
Function GetDrawPoints: TEzVector; Override;
Procedure SetPointsInCurve( N: Integer );
Function GetEntityID: TEzEntityID; Override;
Function BasicInfoAsString: string; Override;
Public
Constructor CreateEntity( Const P1, P2: TEzPoint );
Destructor Destroy; Override;
Procedure Initialize; Override;
Procedure LoadFromStream( Stream: TStream ); Override;
Procedure SaveToStream( Stream: TStream ); Override;
Procedure UpdateExtension; Override;
Procedure UpdateControlPoint( Index: Integer; Const Value: TEzPoint; Grapher: TEzGrapher=Nil ); Override;
Function GetControlPoints(TransfPts: Boolean; Grapher: TEzGrapher=Nil): TEzVector; Override;
Function GetControlPointType( Index: Integer ): TEzControlPointType; Override;
Procedure ApplyTransform; Override;
Function IsEqualTo( Entity: TEzEntity; IncludeAttribs: Boolean = false): Boolean; Override;
Procedure Draw( Grapher: TEzGrapher; Canvas: TCanvas; Const Clip: TEzRect;
DrawMode: TEzDrawMode; Data: Pointer = Nil ); Override;
Procedure MakeCurvePoints;
Property PointsInCurve: Integer {$IFDEF BCB} Read GetPointsInCurve {$ELSE} Read FPointsInCurve {$ENDIF} Write SetPointsInCurve;
Property Rotangle: Double {$IFDEF BCB} Read GetRotangle {$ELSE} Read FRotangle {$ENDIF} Write SetRotangle;
End;
{-------------------------------------------------------------------------------}
{ TEzPictureRef a picture referenced }
{-------------------------------------------------------------------------------}
TEzPictureRef = Class( TEzRectangle )
Private
FFileName: String;
FGraphicLink: TEzGraphicLink;
FAlphaChannel: Byte;
{ assigned temporarily }
FStream: TStream;
Function DoReadFile: Boolean;
Function GetGraphicLink: TEzGraphicLink;
{$IFDEF BCB}
function GetAlphaChannel: byte;
function GetFileName: String;
function GetStream: TStream;
procedure SetAlphaChannel(const Value: byte);
procedure SetFileName(const Value: String);
procedure SetStream(const Value: TStream);
{$ENDIF}
Protected
Function GetEntityID: TEzEntityID; Override;
Function BasicInfoAsString: string; Override;
Public
Constructor CreateEntity( Const P1, P2: TEzPoint; Const FileName: String );
Destructor Destroy; Override;
Procedure Initialize; Override;
Procedure LoadFromStream( Stream: TStream ); Override;
Procedure SaveToStream( Stream: TStream ); Override;
Procedure Draw( Grapher: TEzGrapher; Canvas: TCanvas; Const Clip: TEzRect;
DrawMode: TEzDrawMode; Data: Pointer = Nil ); Override;
Function StorageSize: Integer; Override;
Function IsEqualTo( Entity: TEzEntity; IncludeAttribs: Boolean = false): Boolean; Override;
{ This property determines the AlphaChannel of the image
0= opaque, 255= transparent }
Property AlphaChannel: byte {$IFDEF BCB} Read GetAlphaChannel Write SetAlphaChannel {$ELSE} Read FAlphaChannel Write FAlphaChannel {$ENDIF};
Property FileName: String {$IFDEF BCB} Read GetFileName Write SetFileName {$ELSE} Read FFileName Write FFileName {$ENDIF};
{ When this property is defined, instead of loading the bitmap from a
disk file, the bitmap is loaded from this stream.
If the source of the bitmap is a blob field in a c/s database, then you
can use the property Filename as a key to the corresponding record on the
c/s database.
You can set the Stream property on event OnBeforPaintEntity
and when this class is destroyed, the FStream will also be freed
automatically if FStream<>nil }
Property Stream: TStream {$IFDEF BCB} Read GetStream Write SetStream {$ELSE} Read FStream Write FStream {$ENDIF};
End;
{-------------------------------------------------------------------------------}
{ TEzPersistBitmap - this is saved to the file }
{-------------------------------------------------------------------------------}
TEzPersistBitmap = Class( TEzRectangle )
Private
FBitmap: TBitmap;
FTransparent: Boolean;
{$IFDEF BCB}
function GetBitmap: TBitmap;
function GetTransparent: Boolean;
procedure SetTransparent(const Value: Boolean);
{$ENDIF}
Protected
Function GetEntityID: TEzEntityID; Override;
Public
Constructor CreateEntity( Const P1, P2: TEzPoint; Const FileName: String );
Destructor Destroy; Override;
Procedure LoadFromStream( Stream: TStream ); Override;
Procedure SaveToStream( Stream: TStream ); Override;
Procedure Draw( Grapher: TEzGrapher; Canvas: TCanvas; Const Clip: TEzRect;
DrawMode: TEzDrawMode; Data: Pointer = Nil ); Override;
Function StorageSize: Integer; Override;
Property Transparent: Boolean {$IFDEF BCB} Read GetTransparent Write SetTransparent {$ELSE} Read FTransparent Write FTransparent {$ENDIF};
Property Bitmap: TBitmap {$IFDEF BCB} Read GetBitmap {$ELSE} Read FBitmap {$ENDIF};
End;
{---------------------------------------------------------------------------}
{ TEzBandsBitmap - banded bitmap and BIL reader entity }
{---------------------------------------------------------------------------}
TEzImageFormat = (ifBitmap, ifTiff, ifBIL);
TEzBandsBitmap = Class( TEzClosedEntity )
Private
FFileName: String;
FAlphaChannel: Byte;
FVector: TEzVector;
{ temporarily assigned only (in events mainly) }
FStream: TStream;
{$IFDEF BCB}
function GetAlphaChannel: Byte;
function GetFileName: String;
function GetStream: TStream;
procedure SetAlphaChannel(const Value: Byte);
procedure SetFileName(const Value: String);
procedure SetStream(const Value: TStream);
{$ENDIF}
Protected
Function GetDrawPoints: TEzVector; Override;
Function GetEntityID: TEzEntityID; Override;
Function BasicInfoAsString: string; Override;
Public
Constructor CreateEntity( Const P1, P2: TEzPoint; Const FileName: String );
Destructor Destroy; Override;
Procedure Initialize; Override;
function GetFormat: TEzImageFormat;
Procedure LoadFromStream( Stream: TStream ); Override;
Procedure SaveToStream( Stream: TStream ); Override;
Procedure Draw( Grapher: TEzGrapher; Canvas: TCanvas; Const Clip: TEzRect;
DrawMode: TEzDrawMode; Data: Pointer = Nil ); Override;
Function StorageSize: Integer; Override;
Procedure UpdateExtension; Override;
Procedure UpdateControlPoint( Index: Integer; Const Value: TEzPoint; Grapher: TEzGrapher=Nil ); Override;
Function GetControlPoints(TransfPts: Boolean; Grapher: TEzGrapher=Nil): TEzVector; Override;
Function GetControlPointType( Index: Integer ): TEzControlPointType; Override;
Function IsEqualTo( Entity: TEzEntity; IncludeAttribs: Boolean = false): Boolean; Override;
Property FileName: String {$IFDEF BCB} Read GetFileName Write SetFileName {$ELSE} Read FFileName Write FFileName {$ENDIF};
{ When this property is defined, instead of loading the bitmap from a
disk file, the bitmap is loaded from this stream.
If the source of the bitmap is a blob field in a c/s database, then you
can use the property Filename as a key to the corresponding record on the
c/s database.
You can set the Stream property on event OnBeforPaintEntity
and when this class is destroyed, the FStream will also be freed
automatically if FStream<>nil }
Property Stream: TStream {$IFDEF BCB} Read GetStream Write SetStream {$ELSE} Read FStream Write FStream {$ENDIF};
{ This property determines the percent of AlphaChannel of the image
0= opaque, 255= transparent }
Property AlphaChannel: Byte {$IFDEF BCB} Read GetAlphaChannel Write SetAlphaChannel {$ELSE} Read FAlphaChannel Write FAlphaChannel {$ENDIF};
End;
{ a custom picture - in event OnBeforePaintEntity you must assign a picture
(bitmap, metafile, icon, etc. ) to draw here. Example, you can use this
entity in order to draw a Tee Chart or any other image }
TEzCustomPicture = Class( TEzClosedEntity )
Private
FPicture: TPicture;
FTransparent: Boolean;
FVector: TEzVector;
{$IFDEF BCB}
function GetPicture: TPicture;
function GetTransparent: Boolean;
procedure SetPicture(const Value: TPicture);
procedure SetTransparent(const Value: Boolean);
{$ENDIF}
Protected
Function GetDrawPoints: TEzVector; Override;
Function GetEntityID: TEzEntityID; Override;
Function BasicInfoAsString: string; Override;
Public
Constructor CreateEntity( Const P1, P2: TEzPoint );
Destructor Destroy; Override;
Procedure Initialize; Override;
Procedure LoadFromStream( Stream: TStream ); Override;
Procedure SaveToStream( Stream: TStream ); Override;
Procedure Draw( Grapher: TEzGrapher; Canvas: TCanvas; Const Clip: TEzRect;
DrawMode: TEzDrawMode; Data: Pointer = Nil ); Override;
Procedure UpdateExtension; Override;
Procedure UpdateControlPoint( Index: Integer; Const Value: TEzPoint; Grapher: TEzGrapher=Nil ); Override;
Function GetControlPoints(TransfPts: Boolean; Grapher: TEzGrapher=Nil): TEzVector; Override;
Function GetControlPointType( Index: Integer ): TEzControlPointType; Override;
Property Transparent: Boolean {$IFDEF BCB} Read GetTransparent Write SetTransparent {$ELSE} Read FTransparent Write FTransparent {$ENDIF};
Property Picture: TPicture {$IFDEF BCB} Read GetPicture Write SetPicture {$ELSE} Read FPicture Write FPicture {$ENDIF};
End;
{-------------------------------------------------------------------------------}
{ TEzSpline }
{-------------------------------------------------------------------------------}
TEzSpline = Class( TEzPolyline )
private
{$IFDEF BCB}
function GetOrder: Byte;
function GetPointsInCurve: Word;
procedure SetOrder(const Value: Byte);
procedure SetPointsInCurve(const Value: Word);
{$ENDIF}
Protected
FPointsInCurve: Word;
FOrder: Byte;
FCurvePoints: TEzVector;
Function GetDrawPoints: TEzVector; Override;
Function GetEntityID: TEzEntityID; Override;
Function BasicInfoAsString: string; Override;
Public
Destructor Destroy; Override;
Procedure Initialize; Override;
Procedure LoadFromStream( Stream: TStream ); Override;
Procedure SaveToStream( Stream: TStream ); Override;
Procedure GetCurvePoints;
Procedure Draw( Grapher: TEzGrapher; Canvas: TCanvas; Const Clip: TEzRect;
DrawMode: TEzDrawMode; Data: Pointer = Nil ); Override;
Property PointsInCurve: Word {$IFDEF BCB} Read GetPointsInCurve Write SetPointsInCurve {$ELSE} Read FPointsInCurve Write FPointsInCurve {$ENDIF};
Property Order: Byte {$IFDEF BCB} Read GetOrder Write SetOrder {$ELSE} Read FOrder Write FOrder {$ENDIF};
End;
{------------------------------------------------------------------------------}
{ TEzTrueTypeText }
{------------------------------------------------------------------------------}
TEzTrueTypeText = Class( TEzClosedEntity )
Private
FText: String;
FAlignment: TAlignment;
FFontTool: TEzFontTool;
Function GetBasePoint: TEzPoint;
Procedure SetBasePoint( Const Value: TEzPoint );
Procedure DoPolyPoints( Const XY: TEzPoint; ByCenter: Boolean;
Grapher: TEzGrapher = Nil );
function GetFontTool: TEzFontTool;
{$IFDEF BCB}
function GetAlignment: TAlignment;
function GetText: String;
procedure SetAlignment(const Value: TAlignment);
procedure SetText(const Value: String);
{$ENDIF}
Protected
Function GetEntityID: TEzEntityID; Override;
Function BasicInfoAsString: string; Override;
Function AttribsAsString: string; Override;
Public
Constructor CreateEntity( Const Pt: TEzPoint;
Const Text: String; Const Height, Angle: Double );
Destructor Destroy; Override;
Procedure Initialize; Override;
Procedure LoadFromStream( Stream: TStream ); Override;
Procedure SaveToStream( Stream: TStream ); Override;
Procedure UpdateExtension; Override;
Procedure Draw( Grapher: TEzGrapher; Canvas: TCanvas; Const Clip: TEzRect;
DrawMode: TEzDrawMode; Data: Pointer = Nil ); Override;
Function StorageSize: Integer; Override;
Procedure UpdateControlPoint( Index: Integer; Const Value: TEzPoint; Grapher: TEzGrapher=Nil ); Override;
Procedure ApplyTransform; Override;
Procedure ShowDirection( Grapher: TEzGrapher; Canvas: TCanvas; Const Clip: TEzRect;
DrawMode: TEzDrawMode; DirectionPos: TEzDirectionpos;
Const DirectionPen: TEzPenStyle; Const DirectionBrush: TEzBrushStyle;
RevertDirection: Boolean ); Override;
Procedure MakePolyPoints(Grapher: TEzGrapher = Nil);
Procedure MakePolyPointsByCenter( Const XY: TEzPoint; Grapher: TEzGrapher = Nil );
Function GetControlPoints(TransfPts: Boolean; Grapher: TEzGrapher=Nil): TEzVector; Override;
Function GetControlPointType( Index: Integer ): TEzControlPointType; Override;
Function IsEqualTo( Entity: TEzEntity; IncludeAttribs: Boolean = false): Boolean; Override;
Property Text: String {$IFDEF BCB} Read GetText Write SetText {$ELSE} Read FText Write FText {$ENDIF};
{ angle in radians }
Property FontTool: TEzFontTool Read GetFontTool ;
Property Alignment: TAlignment {$IFDEF BCB} Read GetAlignment Write SetAlignment {$ELSE} Read FAlignment Write FAlignment {$ENDIF};
Property BasePoint: TEzPoint Read GetBasePoint Write SetBasePoint;
End;
{------------------------------------------------------------------------------}
{ TEzGroupEntity - container for grouping entities }
{------------------------------------------------------------------------------}
{ The type of grouping actually done }
TEzGroupType = ( gtNone, gtFitToPath );
TEzGroupEntity = Class( TEzEntity )
Private
FGroupType: TEzGroupType;
FEntities: TList;
Function GetEntities( Index: Integer ): TEzEntity;
Procedure MoveAndRotateControlPts( Var MovePt, RotatePt: TEzPoint; Grapher: TEzGrapher );
{$IFDEF BCB}
function GetGroupType: TEzGroupType;
procedure SetGroupType(const Value: TEzGroupType);
{$ENDIF}
Protected
Function GetEntityID: TEzEntityID; Override;
Function BasicInfoAsString: string; Override;
Public
Constructor CreateEntity;
Destructor Destroy; Override;
Procedure Initialize; Override;
Procedure Clear;
Procedure Add( Ent: TEzEntity );
Function Count: Integer;
Procedure LoadFromStream( Stream: TStream ); Override;
Procedure SaveToStream( Stream: TStream ); Override;
Function StorageSize: Integer; Override;
Procedure UpdateExtension; Override;
Procedure ApplyTransform; Override;
Procedure Draw( Grapher: TEzGrapher; Canvas: TCanvas; Const Clip: TEzRect;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -