UNIT TTransporters;
INTERFACE
{$R TTransporters.dcr}
{$REALCOMPATIBILITY ON}
USES
TMasses,
TAxles,
TPoints,
TAngles,
TGeometrys,
TitanConstants,
Classes,
Graphics;
TYPE
//----------------------------------------------------------------------------//
// TO KNOW THEM ALL //
//----------------------------------------------------------------------------//
TTransporterItem =
CLASS;
TTransporterItemClass =
CLASS OF TTransporterItem;
TTransporterItems =
CLASS;
TTransporterItemsPtr = ^TTransporterItems;
TTransporter =
CLASS;
//----------------------------------------------------------------------------//
// TTransporterItem = CLASS(TCollectionItem) //
//----------------------------------------------------------------------------//
TTransporterItem =
CLASS(TCollectionItem)
PRIVATE
FItem : TTransporter;
PROTECTED
PROCEDURE DoOnChangeInt(Sender:TObject);
PUBLIC
CONSTRUCTOR Create(ACollection: TCollection);
OVERRIDE;
DESTRUCTOR Destroy;
OVERRIDE;
PROCEDURE SetItem(Item:TTransporter);
PUBLISHED
PROPERTY Index;
PROPERTY Item:TTransporter
READ FItem
WRITE SetItem;
END;
//----------------------------------------------------------------------------//
// TTransporterItems = CLASS(TCollection) //
//----------------------------------------------------------------------------//
TTransporterItems =
CLASS(TCollection)
PRIVATE
FOwner : TPersistent;
FOnChangeInt : TNotifyEvent;
FUNCTION GetItem(
Index:Integer):TTransporterItem;
PROCEDURE SetItem(
Index:Integer;Value:TTransporterItem);
PROTECTED
FUNCTION GetOwner: TPersistent;
PROCEDURE Update(Item: TCollectionItem);
OVERRIDE;
PROCEDURE SubmitChangeInternal(Sender:TObject);
PUBLIC
// Whole Class //
CLASS PROCEDURE SetInternalNotificationOnly(
VAR porter:TTransporterItems;Notifi:TNotifyEvent);
// This Instance //
CONSTRUCTOR Create(AOwner: TPersistent; ItemClass: TTransporterItemClass);
DESTRUCTOR Destroy;
OVERRIDE;
FUNCTION Add:TTransporterItem;
PROCEDURE CreateAddSet(AOwner:TComponent;
VAR Porter:TTransporter);
PROCEDURE UpdateOnBoundsChange;
PROPERTY Items[
Index:Integer]:TTransporterItem
READ GetItem
WRITE SetItem;
//default;
PUBLISHED
END;
//----------------------------------------------------------------------------//
// TTransporter = CLASS(TComponent) //
//----------------------------------------------------------------------------//
TTransporter =
CLASS(TComponent)
PRIVATE
//-- For Handeling The Collection In TPoles ------------------------------//
FCollection : TCollection;
FIndex : INTEGER;
//-- PUBLISHED PROPERTIES
FAngle : TGlobalAngleClass;
FAxles : TAxleItems;
FCenter : TGlobalPointClass;
FDriveMode : TDriveMode;
FShow : BOOLEAN;
FWidth : WORD;
FLength : WORD;
FPoleType : TPoleType;
FRelativMin : TFloat;
FRelativMax : TFloat;
FFramePaint : TFramePaint;
FFinitSize : INTEGER;
FMasses : TMassItems;
FSteerAxle : INTEGER;
// SOME VARS
FLastSelectedPnt : TNearestPoint;
FDirVect : TDirectionVect;
FSelectedAxle : Smallint;
FShape : TShapeArray;
FHalf : TGlobalPoint;
FSelPoint : TShapePoint;
FSelectedPnt : TShapePoint;
FHoverPnt : TShapePoint;
FLastChangedItem : TLastChangeingItem;
FInternalCall : BOOLEAN;
FIsMaster : BOOLEAN;
// FINIT VARS
FFinitX : INTEGER;
FFinitY : INTEGER;
FFinitForces : TFinitArray;
FFinitForcesCol : TFinitForceColorArray;
FFinitPoints : TFinitPointsArray;
FDidFinitPoints : BOOLEAN;
FDidFinitDist : BOOLEAN;
FMaxFinitForce : TFloat;
FMinFinitForce : TFloat;
FFinitMode : TFinitMode;
FColorMode : TColorMode;
// COG VARS (NEEDS FINIT)
FCOG : TTriplePoint;
FHeights : THeightsArray;
// NOTIFICATIONS
FBeforeChangeInt : TNotifyEvent;
FBeforeChangeExt : TNotifyEvent;
FAfterChangeInt : TNotifyEvent;
FAfterChangeExt : TNotifyEvent;
FDoNotify : BOOLEAN;
PROTECTED
// NOTIFICATIONS
FUNCTION GetBeforeChange:TNotifyEvent;
PROCEDURE SetBeforeChange(Proc:TNotifyEvent);
FUNCTION GetAfterChange:TNotifyEvent;
PROCEDURE SetAfterChange(Proc:TNotifyEvent);
PROCEDURE DoBeforeChangeNotifications;
PROCEDURE DoAfterChangeNotifications;
// PROPERTIES
PROCEDURE SetPorterWidth(w:WORD);
PROCEDURE SetPorterLength(l:WORD);
PROCEDURE SetDriveMode(mode:TDriveMode);
PROCEDURE SetSelectedAxle(axno:SMALLINT);
PROCEDURE SetRelativMin(min:TFloat);
PROCEDURE SetRelativMax(max:TFloat);
PROCEDURE SetShow(bool:BOOLEAN);
PROCEDURE SetFramePaint(FramePaintType:TFramePaint);
PROCEDURE SetFinitSize(Size:INTEGER);
PROCEDURE SetColorMode(mode:TColorMode);
PROCEDURE SetFinitMode(mode:TFinitMode);
FUNCTION GetHeights(group:TPressureGroup):TFloat;
PROCEDURE SetHeights(group:TPressureGroup;Value:TFloat);
PROCEDURE SetHeightA(Value:TFloat);
PROCEDURE SetHeightB(Value:TFloat);
PROCEDURE SetHeightC(Value:TFloat);
PROCEDURE SetHeightD(Value:TFloat);
// OTHER
PROCEDURE SetVirginInternal;
// FINIT CALCULATIONS
PROCEDURE CalcFinit;
PROCEDURE CalcAxleLoads;
PROCEDURE CalcAxleMoments;
PROCEDURE CalcFinitPointsArray;
PROCEDURE CalcFinitDistanceArray(
VAR AArray:TFinitArray;FromDistance:TGlobalPoint;
VAR MaxDistance,SumDistance:EXTENDED);
PROCEDURE CalcFinitForceArrayAxles;
PROCEDURE CalcFinitForceArraySurface;
PROCEDURE CalcFinitForceArrayCOG;
PROCEDURE SearchMinMaxFinitForce;
PROCEDURE DoFinitForceColors;
// COG CALCULATIONS
PROCEDURE CalcCOG;
PROCEDURE CalcFrameTilt;
// NOTIFICATION RECEIVE
PROCEDURE TransporterRotationBeforeChange(Sender:TObject);
PROCEDURE TransporterRotationAfterChange(Sender:TObject);
PROCEDURE TransporterCenterBeforeChange(Sender:TObject);
PROCEDURE TransporterCenterAfterChange(Sender:TObject);
PROCEDURE AxleBeforeChange(Sender:TObject);
PROCEDURE AxleAfterChange(Sender:TObject);
PROCEDURE ForcePositionBeforeChange(Sender:TObject);
PROCEDURE ForcePositionAfterChange(Sender:TObject);
PROCEDURE LoadChanged(Sender:TObject);
PUBLIC
// FOR FINT
FUNCTION IsFinit(val:Integer):BOOLEAN;
PROCEDURE FindNextFinitSize;
PROCEDURE FindPreviousFinitSize;
// Whole Class //
CLASS PROCEDURE InternalNotificationOnly(bool:BOOLEAN);
CLASS PROCEDURE EnableInternalNotification;
CLASS PROCEDURE DisableInternalNotification;
// This Instance //
CONSTRUCTOR Create(AOwner:TComponent);
OVERRIDE;
DESTRUCTOR Destroy;
OVERRIDE;
PROCEDURE SetVirgin;
PROCEDURE Reincarnate;
PROCEDURE UpdateOnBoundsChange;
PROCEDURE SetRotation(Degree:TFloat);
FUNCTION GetAxle(
CONST AxleIndex:INTEGER):TAxleItem;
OVERLOAD;
FUNCTION GetAxle(
CONST AxleIndex:INTEGER;
VAR AAxle:TAxleItem):BOOLEAN;
OVERLOAD;
FUNCTION GetMass(
CONST MassIndex:INTEGER):TMassItem;
OVERLOAD;
FUNCTION GetMass(
CONST MassIndex:INTEGER; AMass:TMassItem):BOOLEAN;
OVERLOAD;
FUNCTION RunThroughAxles(
VAR indexax:INTEGER;
VAR AAxle:TAxleItem):BOOLEAN;
FUNCTION RunThroughMasses(
VAR indexm:INTEGER;
VAR AMass:TMassItem):BOOLEAN;
FUNCTION AddAxle(x,y:TFloat):TAxleItem;
PROCEDURE CloneAxle(x,y:TFloat;CloneAxleNr:INTEGER);
PROCEDURE CreateAxleGroup(x,y:TFloat;off:TTransOffset);
PROCEDURE AllAxlesSameDegree(deg:TFloat);
PROCEDURE GetMinMaxAxlePositions(
VAR minx,maxx,miny,maxy:TFloat);
PROCEDURE SteerToPoint(steer:TGlobalPoint);
FUNCTION CalcAxleRepalcementPointFromPressuregroup(gr:TPressureGroup):TGlobalPoint;
PROCEDURE AutoGroupAxles;
PROCEDURE SetMaster(Sender:TObject;bool:BOOLEAN);
PROCEDURE SetSteerAxle(AAxle:TAxleItem);
OVERLOAD;
PROCEDURE SetSteerAxle(indexax:INTEGER);
OVERLOAD;
// For The Area //
PROPERTY LastSelectedPoint:TNearestPoint
READ FLastSelectedPnt
WRITE FLastSelectedPnt ;
PROPERTY FinitPoints:TFinitPointsArray
READ FFinitPoints;
PROPERTY FinitForces:TFinitArray
READ FFinitForces;
PROPERTY FinitForcesColors:TFinitForceColorArray
READ FFinitForcesCol;
// For Myself //
PROPERTY Shape:TShapeArray
READ FShape;
//WRITE FShape;
PROPERTY SelectedPoint:TShapePoint
READ FSelectedPnt
WRITE FSelectedPnt;
PROPERTY HoveredPoint:TShapePoint
READ FHoverPnt
WRITE FHoverPnt;
PROPERTY DirectionVector:TDirectionVect
READ FDirVect
WRITE FDirVect;
PROPERTY LastChangedItem:TLastChangeingItem
READ FLastChangedItem;
PROPERTY Heights[group:TPressureGroup]:TFloat
READ GetHeights
WRITE SetHeights;
PROPERTY Master:BOOLEAN
READ FIsMaster;
PROPERTY CollectionIndex:INTEGER
READ FIndex;
PUBLISHED
PROPERTY Angle:TGlobalAngleClass
READ FAngle
WRITE FAngle;
PROPERTY Axles:TAxleItems
READ FAxles
WRITE FAxles;
PROPERTY TPorterWidth:WORD
READ FWidth
WRITE SetPorterWidth;
PROPERTY TPorterLength:WORD
READ FLength
WRITE SetPorterLength;
PROPERTY Center:TGlobalPointClass
READ FCenter
WRITE FCenter;
PROPERTY PoleType:TPoleType
READ FPoleType
WRITE FPoleType;
PROPERTY DriveMode:TDriveMode
READ FDriveMode
WRITE SetDriveMode;
PROPERTY SelectedAxle:SMALLINT
READ FSelectedAxle
WRITE SetSelectedAxle;
PROPERTY AxleMinDegree:TFloat
READ FRelativMin
WRITE SetRelativMin;
PROPERTY AxleMaxDegree:TFloat
READ FRelativMax
WRITE SetRelativMax;
PROPERTY Show:BOOLEAN
READ FShow
WRITE SetShow;
PROPERTY FramePaint:TFramePaint
READ FFramePaint
WRITE SetFramePaint;
PROPERTY FinitSize:INTEGER
READ FFinitSize
WRITE SetFinitSize;
PROPERTY Masses:TMassItems
READ FMasses
WRITE FMasses;
PROPERTY COG:TTriplePoint
READ FCOG
WRITE FCOG;
PROPERTY FinitColorMode:TColorMode
READ FColorMode
WRITE SetColorMode;
PROPERTY FinitMode:TFinitMode
READ FFinitMode
WRITE SetFinitMode;
PROPERTY HeightA:TFloat
READ FHeights[pgA]
WRITE SetHeightA;
PROPERTY HeightB:TFloat
READ FHeights[pgB]
WRITE SetHeightB;
PROPERTY HeightC:TFloat
READ FHeights[pgC]
WRITE SetHeightC;
PROPERTY HeightD:TFloat
READ FHeights[pgD]
WRITE SetHeightD;
// NOTIFICATIONS
PROPERTY BeforeChange:TNotifyEvent
READ GetBeforeChange
WRITE SetBeforeChange;
PROPERTY AfterChange:TNotifyEvent
READ GetAfterChange
WRITE SetAfterChange;
END;