Вот такой набросок юнита:
- Код: Выделить всё
unit SasTar;
interface
uses Windows, Classes, TarWriter;
type
TDoubleRect = record
X1,Y1:Double;
X2,Y2:Double;
end;
ISimpleTileProcessor = interface
procedure ProcessTile(APos: Tpoint; Azoom: byte; ALonLatRect: TDoubleRect; ATileSize: Cardinal; ATileBuf: Pointer);
end;
IExportSimpleToFile = interface
function GetSupportedContentTypes: WideString;
function GetFileFilters: WideString;
function GetFileExtDefault: WideString;
function StartExport(ASourceContentType: WideString; AFileName: WideString): ISimpleTileProcessor;
end;
TExportSimpleToFile = class (TInterfacedObject, IExportSimpleToFile)
public
function GetSupportedContentTypes: WideString;
function GetFileFilters: WideString;
function GetFileExtDefault: WideString;
function StartExport(ASourceContentType: WideString; AFileName: WideString): ISimpleTileProcessor;
end;
TSimpleTileProcessor = class (TInterfacedObject, ISimpleTileProcessor)
private
FTarWriter : TTarWriter;
FStream : TMemoryStream;
public
procedure ProcessTile(APos: Tpoint; Azoom: byte; ALonLatRect: TDoubleRect; ATileSize: Cardinal; ATileBuf: Pointer);
constructor Create (ArcName:string);
destructor Destroy; OVERRIDE;
end;
function GetIExportSimpleToFile: IExportSimpleToFile;
implementation
function GetIExportSimpleToFile: IExportSimpleToFile;
begin
result := TExportSimpleToFile.Create;
end;
{ TExportSimpleToFile }
function TExportSimpleToFile.GetSupportedContentTypes: WideString;
begin
result := '*';
end;
function TExportSimpleToFile.GetFileFilters: WideString;
begin
result := '*.*';
end;
function TExportSimpleToFile.GetFileExtDefault: WideString;
begin
result := 'tar';
end;
function TExportSimpleToFile.StartExport(ASourceContentType: WideString; AFileName: WideString): ISimpleTileProcessor;
begin
result := TSimpleTileProcessor.Create(AFileName);
end;
{ TSimpleTileProcessor }
constructor TSimpleTileProcessor.Create (ArcName:string);
begin
INHERITED Create;
FTarWriter := TTarWriter.Create(ArcName);
FStream := TMemoryStream.Create;
end;
destructor TSimpleTileProcessor.Destroy;
begin
FTarWriter.Free;
FStream.Free;
INHERITED Destroy;
end;
procedure TSimpleTileProcessor.ProcessTile(APos: Tpoint; Azoom: byte; ALonLatRect: TDoubleRect; ATileSize: Cardinal; ATileBuf: Pointer);
begin
// запись в архив
end;
end.