Ich hab eine Liste von vielen unterschiedlichen Grafikobjekten mit unterschiedlichen Properties. Die published Werte markierter Objekte sollen nun editiert werden können. Die Frage wäre, wie macht man das denn am besten?
Beispielklasse:
Delphi-Quellcode:
TCadRect = class(TPersistent)
private
FP1: TCadFloatPoint;
FP2: TCadFloatPoint;
FTyp: TGraphicObjectTyp;
FPenMMWidth: double;
FPenColor: TColor;
FPenStyle: TColor;
FBrushColor: TColor;
FBrushStyle: TColor;
FDesigning: boolean;
FEnabled: boolean;
FComment: string;
FCrossRect: boolean;
FSnapPoints: TFloatPoints;
FRegion: TPolygon;
FProp: TPropBooleanArray;
FAction: TActionBooleanArray;
FSelected: boolean;
FPropertySelected: boolean;
function GetScale: TScale;
function GetScalemX1: double;
function GetScalemY1: double;
function GetScalemX2: double;
function GetScalemY2: double;
function GetAngle: double;
function GetScalemWidth: double;
function GetScalemHeight: double;
function GetProp(Index: TProp): boolean;
function GetAction(Index: TAction): boolean;
procedure SetScale(const Value: TScale);
procedure SetNewScale(const Value: TScale);
procedure SetScalemX1(const Value: double);
procedure SetScalemY1(const Value: double);
procedure SetScalemX2(const Value: double);
procedure SetScalemY2(const Value: double);
procedure SetAngle(const Value: double);
procedure SetScalemWidth(const Value: double);
procedure SetScalemHeight(const Value: double);
function ClipRect: TFloatRectEx;
procedure Flip(const A, B: TFloatPoint);
public
function MovePtInRegion(const MovePt: TFloatPoint): boolean;
function CenterRegionPtInSelectRect(const SelectRect: TFloatRectEx): boolean;
function Compare(Value: TCadRect): boolean;
procedure Assign(Value: TCadRect);
procedure LoadFromFile(Ini: TIniDatei; const Section: string);
procedure SaveToFile(Ini: TIniDatei; const Section: string);
procedure Draw(Canvas: TCanvas; const Plot: TPlotDevice);
procedure DrawRegion(Canvas: TCanvas; const Plot: TPlotDevice);
procedure SetRegion(const Plot: TPlotDevice);
procedure SetSnapPoints(SnapPoints: TFloatPoints);
procedure Rotate(const R: TFloatPoint; const Alpha: double);
procedure Shift(const ValueX, ValueY, Alpha: double);
procedure FlipHorz(const Y: double);
procedure FlipVert(const X: double);
procedure Duplicate(Value: TCadRect; const Order: TModifyOrder);
procedure Modify(const Order: TModifyOrder);
procedure Clear;
property SnapPoints: TFloatPoints read FSnapPoints;
property P1: TCadFloatPoint read FP1;
property P2: TCadFloatPoint read FP2;
property Typ: TGraphicObjectTyp read FTyp write FTyp;
property Prop[Index: TProp]: boolean read GetProp;
property Action[Index: TAction]: boolean read GetAction;
property Selected: boolean read FSelected;
property PropertySelected: boolean read FPropertySelected write FPropertySelected;
constructor Create;
destructor Destroy; override;
published
property PenMMWidth: double read FPenMMWidth write FPenMMWidth;
property PenColor: TColor read FPenColor write FPenColor;
property PenStyle: TColor read FPenStyle write FPenStyle;
property BrushColor: TColor read FBrushColor write FBrushColor;
property BrushStyle: TColor read FBrushStyle write FBrushStyle;
property Scale: TScale read GetScale write SetScale;
property NewScale: TScale write SetNewScale;
property Designing: boolean read FDesigning write FDesigning;
property Enabled: boolean read FEnabled write FEnabled;
property Comment: string read FComment write FComment;
property CrossRect: boolean read FCrossRect write FCrossRect;
property ScalemX1: double read GetScalemX1 write SetScalemX1;
property ScalemY1: double read GetScalemY1 write SetScalemY1;
property ScalemX2: double read GetScalemX2 write SetScalemX2;
property ScalemY2: double read GetScalemY2 write SetScalemY2;
property ScalemWidth: double read GetScalemWidth write SetScalemWidth;
property ScalemHeight: double read GetScalemHeight write SetScalemHeight;
property Angle: double read GetAngle write SetAngle;
end;