Einzelnen Beitrag anzeigen

Bjoerk

Registriert seit: 28. Feb 2011
Ort: Mannheim
1.384 Beiträge
 
Delphi 10.4 Sydney
 
#5

AW: Doppel schnell aus Lise löschen.

  Alt 7. Dez 2014, 22:16
Ok. Hier:
Delphi-Quellcode:
  TFloatPoint = record
    X, Y: double;
    procedure Clear;
  end;

  TFloatPoints = class
  private
    FItems: array of TFloatPoint;
..
 

function TFloatPoints.Add(const Value: TFloatPoint): integer;
begin
  Result := FCount;
  if Assigned(FOnFloatPointsAdd) then // TSnapPointsFinderThread;
    FOnFloatPointsAdd(Value)
  else
    Ins(Result, Value);
end;

procedure TFloatPoints.Ins(const Index: integer; const Value: TFloatPoint);
begin
  if (Index >= 0) and (Index <= FCount) then
  begin
    if FCount = FCapacity then
      SetCapacity(FCapacity + DeltaCapacity);
    if Index < FCount then
    begin
      Move(FItems[Index], FItems[Index + 1], (FCount - Index) * SizeOf(TFloatPoint));
      FillChar(FItems[Index], SizeOf(TFloatPoint), 0);
    end;
    FItems[Index] := Value;
    Inc(FCount);
  end;
end;

procedure TFloatPoints.Delete(const Index: integer);
begin
  if (Index >= 0) and (Index < FCount) then
  begin
    Dec(FCount);
    if Index < FCount then
    begin
      Move(FItems[Index + 1], FItems[Index], (FCount - Index) * SizeOf(TFloatPoint));
      FillChar(FItems[FCount], SizeOf(TFloatPoint), 0);
    end;
    FItems[FCount].Clear;
  end;
end;

Geändert von Bjoerk ( 7. Dez 2014 um 22:25 Uhr) Grund: Code ergänzt
  Mit Zitat antworten Zitat