You've already forked lina-components
mirror of
https://bitbucket.org/Dennis07/lina-components.git
synced 2025-08-24 21:49:04 +02:00
Version 1.0 DEV 1.16f
Signed-off-by: Dennis07 <den.goehlert@t-online.de>
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -22,6 +22,7 @@ type
|
||||
EInvalidParamChar = class(Exception);
|
||||
EInvalidParamIdentifier = class(Exception);
|
||||
EInvalidParamFormat = class(Exception);
|
||||
EInvalidDiagramValueCollection = class(Exception);
|
||||
EInvalidDiagramGap = class(Exception);
|
||||
|
||||
{ Hilfsklassen }
|
||||
@@ -480,17 +481,29 @@ type
|
||||
property Axis: Integer read FAxis write SetAxis default 0;
|
||||
end;
|
||||
|
||||
TDiagramValueData = record
|
||||
Name: ShortString;
|
||||
Color: TColor;
|
||||
Value: Integer;
|
||||
Visible: Boolean;
|
||||
BorderStyle: TBorderStyle;
|
||||
BorderWidth: Integer;
|
||||
BorderColor: TColor;
|
||||
end;
|
||||
|
||||
TDiagramValue = class(TCollectionItem)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
FName: String;
|
||||
FColor: TColor;
|
||||
FValue: Integer;
|
||||
FVIsible: Boolean;
|
||||
FVisible: Boolean;
|
||||
FBorderStyle: TBorderStyle;
|
||||
FBorderWidth: Integer;
|
||||
FBorderColor: TColor;
|
||||
{ Methoden }
|
||||
function GetData: TDiagramValueData;
|
||||
procedure SetData(Value: TDiagramValueData);
|
||||
procedure SetName(Value: String);
|
||||
procedure SetColor(Value: TColor);
|
||||
procedure SetValue(Value: Integer);
|
||||
@@ -503,6 +516,7 @@ type
|
||||
{ Public-Deklarationen }
|
||||
constructor Create(Collection: TCollection); override;
|
||||
destructor Destroy; override;
|
||||
property Data: TDiagramValueData read GetData write SetData;
|
||||
published
|
||||
{ Published-Deklarationen }
|
||||
property Name: String read FName write SetName;
|
||||
@@ -532,6 +546,7 @@ type
|
||||
{ Public-Deklarationen }
|
||||
constructor Create(ADiagram: TDiagram);
|
||||
destructor Destroy; override;
|
||||
function AddData(Data: TDiagramValueData): TDiagramValue;
|
||||
property MinValue: Integer read GetMinValue;
|
||||
property MaxValue: Integer read GetMaxValue;
|
||||
property MidValue: Integer read GetMidValue;
|
||||
@@ -649,7 +664,7 @@ type
|
||||
property Visible: Boolean read FVisible write SetVisible default False;
|
||||
property Dotted: Boolean read FDotted write SetDotted default False;
|
||||
property Lines: TDiagramGridLines read FLines write SetLines default dglBoth;
|
||||
property Color: TColor read FColor write SetColor default clGray;
|
||||
property Color: TColor read FColor write SetColor default clSilver;
|
||||
property Width: Integer read FWidth write SetWidth default 1;
|
||||
property Gap: Word read FGap write SetGap default 10;
|
||||
end;
|
||||
@@ -2312,6 +2327,10 @@ end;
|
||||
|
||||
constructor TDiagramValue.Create(Collection: TCollection);
|
||||
begin
|
||||
if not (Collection is TDiagramValues) then
|
||||
begin
|
||||
raise EInvalidDiagramValueCollection.Create('Collection must be a TDiagramValues object');
|
||||
end;
|
||||
inherited;
|
||||
FName := 'Value' + IntToStr(ID);
|
||||
FColor := clNone;
|
||||
@@ -2328,6 +2347,28 @@ begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TDiagramValue.GetData: TDiagramValueData;
|
||||
begin
|
||||
Result.Name := Name;
|
||||
Result.Color := Color;
|
||||
Result.Value := Value;
|
||||
Result.Visible := Visible;
|
||||
Result.BorderStyle := BorderStyle;
|
||||
Result.BorderWidth := BorderWidth;
|
||||
Result.BorderColor := BorderColor;
|
||||
end;
|
||||
|
||||
procedure TDiagramValue.SetData(Value: TDiagramValueData);
|
||||
begin
|
||||
Name := Value.Name;
|
||||
Color := Value.Color;
|
||||
Self.Value := Value.Value;
|
||||
Visible := Value.Visible;
|
||||
BorderStyle := Value.BorderStyle;
|
||||
BorderWidth := Value.BorderWidth;
|
||||
BorderColor := Value.BorderColor;
|
||||
end;
|
||||
|
||||
procedure TDiagramValue.SetName(Value: String);
|
||||
begin
|
||||
FName := Value;
|
||||
@@ -2495,6 +2536,11 @@ begin
|
||||
FDiagram.Repaint;
|
||||
end;
|
||||
|
||||
function TDiagramValues.AddData(Data: TDiagramValueData): TDiagramValue;
|
||||
begin
|
||||
(Add as TDiagramValue).Data := Data;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TDiagramScaleValueArtLines
|
||||
---------------------------------------------------------------------------- }
|
||||
@@ -2647,7 +2693,7 @@ begin
|
||||
FVisible := False;
|
||||
FDotted := False;
|
||||
FLines := dglBoth;
|
||||
FColor := clGray;
|
||||
FColor := clSilver;
|
||||
FWidth := 1;
|
||||
FGap := 10;
|
||||
end;
|
||||
@@ -2726,7 +2772,7 @@ end;
|
||||
|
||||
procedure TDiagramScaleValues.SetFont(Value: TFont);
|
||||
begin
|
||||
FFont := Value;
|
||||
FFont.Assign(Value);
|
||||
FDiagram.Repaint;
|
||||
end;
|
||||
|
||||
@@ -2788,7 +2834,7 @@ end;
|
||||
|
||||
procedure TDiagramCaption.SetFont(Value: TFont);
|
||||
begin
|
||||
FFont := Value;
|
||||
FFont.Assign(Value);
|
||||
FDiagram.Repaint;
|
||||
end;
|
||||
|
||||
@@ -2973,15 +3019,6 @@ var
|
||||
begin
|
||||
inherited;
|
||||
DrawBackground;
|
||||
DrawCaption;
|
||||
with Canvas do
|
||||
begin
|
||||
if Scale.Bar.RulerNumbers then
|
||||
begin
|
||||
Font.Color := Scale.Bar.Color;
|
||||
Font.Height := Scale.Bar.RulerGap;
|
||||
end;
|
||||
end;
|
||||
if Scale.FGrid.Visible then
|
||||
begin
|
||||
DrawGrid;
|
||||
@@ -3047,6 +3084,7 @@ begin
|
||||
begin
|
||||
DrawTrendLine;
|
||||
end;
|
||||
DrawCaption;
|
||||
if Scale.ArtLines.Cursor.Visible then
|
||||
begin
|
||||
DrawCursorArtLines;
|
||||
@@ -3064,6 +3102,7 @@ procedure TDiagram.DrawBackground;
|
||||
begin
|
||||
with Canvas do
|
||||
begin
|
||||
Brush.Style := bsSolid;
|
||||
Brush.Color := Color;
|
||||
FillRect(Rect(0,0,Width,Height))
|
||||
end;
|
||||
@@ -3078,6 +3117,7 @@ begin
|
||||
with Canvas do
|
||||
begin
|
||||
Font.Assign(Caption.Font);
|
||||
Brush.Style := bsClear;
|
||||
case Caption.VerticalAlignment of
|
||||
taAlignTop: Top := 0;
|
||||
taAlignBottom: Top := Height - TextHeight(Caption.Text);
|
||||
@@ -3127,6 +3167,9 @@ begin
|
||||
LineTo(Width,ZeroHeight);
|
||||
if Scale.Bar.RulerNumbers then
|
||||
begin
|
||||
Font.Assign(TFont.Create);
|
||||
Font.Color := Scale.Bar.Color;
|
||||
Font.Height := Scale.Bar.RulerGap;
|
||||
Index := ZeroHeight + Scale.Bar.RulerGap;
|
||||
while Index < Height do
|
||||
begin
|
||||
@@ -3260,7 +3303,7 @@ begin
|
||||
Canvas.Pen.Width := Scale.ArtLines.Cursor.Width;
|
||||
GetCursorPos(CursorPos);
|
||||
CursorPos := ScreenToClient(CursorPos);
|
||||
if (CursorPos.Y <> ZeroHeight) and (CursorPos.X >= 0) and (CursorPos.X < Width) and (CursorPos.Y >= 0) and (CursorPos.Y < Height) then
|
||||
if (CursorPos.Y <> ZeroHeight) and (CursorPos.X > ZeroWidth) and (CursorPos.X < Width) and (CursorPos.Y >= 0) and (CursorPos.Y < Height) then
|
||||
begin
|
||||
MoveTo(ZeroWidth,CursorPos.Y);
|
||||
LineTo(CursorPos.X,CursorPos.Y);
|
||||
@@ -3352,6 +3395,7 @@ begin
|
||||
Pen.Width := (Values.Items[Index] as TDiagramValue).BorderWidth;
|
||||
Pen.Color := (Values.Items[Index] as TDiagramValue).BorderColor;
|
||||
Pen.Style := psSolid;
|
||||
Brush.Style := bsSolid;
|
||||
if AutoColors.Enabled then
|
||||
begin
|
||||
if (Values.Items[Index] as TDiagramValue).Value > 0 then
|
||||
@@ -3376,6 +3420,7 @@ begin
|
||||
Pen.Width := (Values.Items[Index] as TDiagramValue).BorderWidth;
|
||||
Pen.Color := (Values.Items[Index] as TDiagramValue).BorderColor;
|
||||
Pen.Style := psSolid;
|
||||
Brush.Style := bsSolid;
|
||||
if AutoColors.Enabled then
|
||||
begin
|
||||
if (Values.Items[Index] as TDiagramValue).Value = 0 then
|
||||
@@ -3406,6 +3451,7 @@ begin
|
||||
Pen.Width := (Values.Items[Index] as TDiagramValue).BorderWidth;
|
||||
Pen.Color := (Values.Items[Index] as TDiagramValue).Color;
|
||||
Pen.Style := psSolid;
|
||||
Brush.Style := bsSolid;
|
||||
if Index = 0 then
|
||||
begin
|
||||
MoveTo(ZeroWidth + Padding.Left,ValueHeight((Values.Items[Index] as TDiagramValue).Value));
|
||||
@@ -3425,6 +3471,12 @@ begin
|
||||
begin
|
||||
if Scale.Bar.RulerNumbers then
|
||||
begin
|
||||
with Canvas do
|
||||
begin
|
||||
Font.Assign(TFont.Create);
|
||||
Font.Color := Scale.Bar.Color;
|
||||
Font.Height := Scale.Bar.RulerGap;
|
||||
end;
|
||||
MaxWidth := Canvas.TextWidth('1');
|
||||
for Index := Values.MinValue to Values.MaxValue do
|
||||
begin
|
||||
|
@@ -24,6 +24,7 @@ type
|
||||
EWinUserInformation = class(Exception);
|
||||
EStringCharAccess = class(Exception);
|
||||
EInvalidBFCommand = class(Exception);
|
||||
EIntersection = class(Exception);
|
||||
|
||||
{ Hilfsklassen }
|
||||
TLinePosition = (lpAnyPosition,lpBeginning); //Mutter-Hilfsklasse f�r s�mtliche Enums
|
||||
@@ -204,11 +205,13 @@ type
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create(AOffset: Integer; ASlope: Extended); overload;
|
||||
constructor Create(A: TPoint; ASlope: Extended); overload;
|
||||
constructor Create(A,B: TPoint); overload;
|
||||
destructor Destroy; override;
|
||||
procedure LoadFromPoints(A,B: TPoint);
|
||||
function Contains(Point: TPoint): Boolean;
|
||||
function Subtends(Line: TLine): Boolean;
|
||||
function Intersection(Line: TLine): TPoint;
|
||||
function Intersects(Line: TLine): Boolean;
|
||||
function Equals(Line: TLine): Boolean;
|
||||
function Parallel(Line: TLine): Boolean;
|
||||
property Offset: Integer read FOffset write FOffset default 0;
|
||||
@@ -216,21 +219,31 @@ type
|
||||
property Y[X: Integer]: Integer read GetY; default;
|
||||
end;
|
||||
|
||||
TCycle = class
|
||||
TCicle = class
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
FRadius: Extended;
|
||||
FCenter: TPoint;
|
||||
FRadius: Integer;
|
||||
{ Methoden }
|
||||
function GetDiameter: Extended;
|
||||
procedure SetDiameter(Value: Extended);
|
||||
function GetDiameter: Integer;
|
||||
procedure SetDiameter(Value: Integer);
|
||||
function GetCircumference: Extended;
|
||||
procedure SetCircumference(Value: Extended);
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create;
|
||||
constructor Create(ACenter: TPoint; ARadius: Integer); overload;
|
||||
constructor Create(ACenter,ABorder: TPoint); overload;
|
||||
destructor Destroy; override;
|
||||
property Radius: Extended read FRadius write FRadius;
|
||||
property Diameter: Extended read GetDiameter write SetDiameter;
|
||||
function Contains(Point: TPoint): Boolean; overload;
|
||||
function Contains(Cicle: TCicle): Boolean; overload;
|
||||
function Intersection(Line: TLine): TPoint; overload;
|
||||
function Intersection(Cicle: TCicle): TPoint; overload;
|
||||
function Intersects(Line: TLine): Boolean; overload;
|
||||
function Intersects(Cicle: TCicle): Boolean; overload;
|
||||
function Equals(Cicle: TCicle): Boolean;
|
||||
property Center: TPoint read FCenter write FCenter;
|
||||
property Radius: Integer read FRadius write FRadius;
|
||||
property Diameter: Integer read GetDiameter write SetDiameter;
|
||||
property Circumference: Extended read GetCircumference write SetCircumference;
|
||||
end;
|
||||
|
||||
@@ -500,6 +513,10 @@ type
|
||||
function Prime(X: Integer): Boolean; overload;
|
||||
function Prime(X: Cardinal): Boolean; overload;
|
||||
{ Sonstige }
|
||||
function PointAdd(A,B: TPoint): TPoint;
|
||||
function PointSub(A,B: TPoint): TPoint;
|
||||
function Diagonal(A,B: TPoint): Extended;
|
||||
function Distance(A,B: TPoint): Cardinal;
|
||||
function Congruent(A,B,Divisor: Integer): Boolean; overload;
|
||||
function Congruent(A,B,Divisor: Extended): Boolean; overload;
|
||||
procedure ExtEuclideanAlg(A,B: Integer; var D,S,T: Integer);
|
||||
@@ -1952,6 +1969,26 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function PointAdd(A,B: TPoint): TPoint;
|
||||
begin
|
||||
Result := Point(A.X + B.X,A.Y + B.Y);
|
||||
end;
|
||||
|
||||
function PointSub(A,B: TPoint): TPoint;
|
||||
begin
|
||||
Result := Point(A.X - B.X,A.Y - B.Y);
|
||||
end;
|
||||
|
||||
function Diagonal(A,B: TPoint): Extended;
|
||||
begin
|
||||
Result := Sqrt(Sqr(B.X - A.X) + Sqr(B.Y - A.Y));
|
||||
end;
|
||||
|
||||
function Distance(A,B: TPoint): Cardinal;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
function Congruent(A,B,Divisor: Integer): Boolean;
|
||||
begin
|
||||
Result := (A mod Divisor) = (B mod Divisor);
|
||||
@@ -3563,6 +3600,11 @@ begin
|
||||
FSlope := ASlope;
|
||||
end;
|
||||
|
||||
constructor TLine.Create(A: TPoint; ASlope: Extended);
|
||||
begin
|
||||
Create(Round(A.Y - A.X * ASlope),ASlope);
|
||||
end;
|
||||
|
||||
constructor TLine.Create(A,B: TPoint);
|
||||
begin
|
||||
inherited Create;
|
||||
@@ -3591,9 +3633,27 @@ begin
|
||||
Result := Y[Point.X] = Point.Y;
|
||||
end;
|
||||
|
||||
function TLine.Subtends(Line: TLine): Boolean;
|
||||
function TLine.Intersection(Line: TLine): TPoint;
|
||||
begin
|
||||
if Intersects(Line) then
|
||||
begin
|
||||
Result.X := Round((Line.Offset - Offset) / (Slope - Line.Slope));
|
||||
Result.Y := Y[Result.X];
|
||||
end else
|
||||
begin
|
||||
if Equals(Line) then
|
||||
begin
|
||||
raise EIntersection.Create('The two lines are identical');
|
||||
end else
|
||||
begin
|
||||
raise EIntersection.Create('The two lines are parallel');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLine.Intersects(Line: TLine): Boolean;
|
||||
begin
|
||||
Result := not Parallel(Line);
|
||||
end;
|
||||
|
||||
function TLine.Equals(Line: TLine): Boolean;
|
||||
@@ -3610,36 +3670,77 @@ end;
|
||||
TCycle
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
constructor TCycle.Create;
|
||||
constructor TCicle.Create(ACenter: TPoint; ARadius: Integer);
|
||||
begin
|
||||
inherited;
|
||||
FRadius := 0;
|
||||
inherited Create;
|
||||
FCenter := ACenter;
|
||||
FRadius := ARadius;
|
||||
end;
|
||||
|
||||
destructor TCycle.Destroy;
|
||||
constructor TCicle.Create(ACenter,ABorder: TPoint);
|
||||
begin
|
||||
//Create(ACenter,);
|
||||
end;
|
||||
|
||||
destructor TCicle.Destroy;
|
||||
begin
|
||||
//...
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TCycle.GetDiameter: Extended;
|
||||
function TCicle.GetDiameter: Integer;
|
||||
begin
|
||||
Result := Radius * 2;
|
||||
end;
|
||||
|
||||
procedure TCycle.SetDiameter(Value: Extended);
|
||||
procedure TCicle.SetDiameter(Value: Integer);
|
||||
begin
|
||||
Radius := Value / 2;
|
||||
Radius := Round(Value / 2);
|
||||
end;
|
||||
|
||||
function TCycle.GetCircumference: Extended;
|
||||
function TCicle.GetCircumference: Extended;
|
||||
begin
|
||||
Result := 2 * Pi * Radius;
|
||||
end;
|
||||
|
||||
procedure TCycle.SetCircumference(Value: Extended);
|
||||
procedure TCicle.SetCircumference(Value: Extended);
|
||||
begin
|
||||
FRadius := Value / 2 / Pi;
|
||||
FRadius := Round(Value / 2 / Pi);
|
||||
end;
|
||||
|
||||
function TCicle.Contains(Point: TPoint): Boolean;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
function TCicle.Contains(Cicle: TCicle): Boolean;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
function TCicle.Intersection(Line: TLine): TPoint;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
function TCicle.Intersection(Cicle: TCicle): TPoint;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
function TCicle.Intersects(Line: TLine): Boolean;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
function TCicle.Intersects(Cicle: TCicle): Boolean;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
function TCicle.Equals(Cicle: TCicle): Boolean;
|
||||
begin
|
||||
Result := (Cicle.Center = Center) and (Cicle.Radius = Radius);
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user