Class TNetworkRequestQueue

Unit

Declaration

type TNetworkRequestQueue = class(TObject)

Description

Queuer of network requests. Under the hood uses multiple background threads to execute several blocking requests at the same time.

Hierarchy

Overview

Methods

Public constructor Create(MaxTasksPerThread, MaxThreads: Cardinal; RequestProc: TBlockingNetworkRequestProc; TilesProvider: TTilesProvider);
Public destructor Destroy; override;
Public procedure RequestTile(const Tile: TTile);
Public procedure SetCurrentViewRect(const ViewRect: TRect);

Properties

Public property RequestProps: THttpRequestProps read FRequestProps write FRequestProps;
Public property DumbQueueOrder: Boolean read FDumbQueueOrder write FDumbQueueOrder;
Public property OnGotTileBgThr: TGotTileCallbackBgThr read FGotTileCb write FGotTileCb;

Description

Methods

Public constructor Create(MaxTasksPerThread, MaxThreads: Cardinal; RequestProc: TBlockingNetworkRequestProc; TilesProvider: TTilesProvider);

Constructor

Parameters
MaxTasksPerThread
- if number of tasks becomes more than MaxTasksPerThread*%currentThreadCount%, add one more thread
MaxThreads
- limit of the number of threads
RequestProc
- implementator of network request
TilesProvider
- object holding properties of current tile provider. Object takes ownership on this object and destroys it on release.
Public destructor Destroy; override;

This item has no description.

Public procedure RequestTile(const Tile: TTile);

Add request for an image for Tile to the request queue

Public procedure SetCurrentViewRect(const ViewRect: TRect);

Set current view rect in absolute map coords. If smart ordering facilities are enabled, tiles inside current view have priority when extracted from request queue.

Properties

Public property RequestProps: THttpRequestProps read FRequestProps write FRequestProps;

Common network request props applied to all requests in current queue. Changing the properties won't take effect until queue gets empty. URL field is ignored.

Public property DumbQueueOrder: Boolean read FDumbQueueOrder write FDumbQueueOrder;

If set: disable all smart ordering facilities. Queue will retrieve all added tiles one by one. If not set (default):

  • When RequestTile adds a tile, all queued items with another zoom level are cancelled (use case: user quickly zooms in/out by multiple steps - no sense to wait for all of them to download)

  • If current view area is set via SetCurrentViewRect, the tiles inside this rect are downloaded first (priority of visible area)

Public property OnGotTileBgThr: TGotTileCallbackBgThr read FGotTileCb write FGotTileCb;

Handler to call when request is completed (executed in the context of background thread!)


Generated by PasDoc 0.16.0.