lazmapviewer: Add new downloadengine based on Synapse. Register download engines as new components. Publish property Downloadengine of the MapViewer.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6797 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-01-23 18:07:52 +00:00
parent 0a3e34cd0b
commit 06d1c3c0bf
7 changed files with 109 additions and 22 deletions

View File

@ -25,7 +25,7 @@ This is a fork of MapViewer by ti_dic (https://sourceforge.net/p/roadbook/code/c
</Item2>
<Item3>
<Filename Value="source/mvdragobj.pas"/>
<UnitName Value="mvdragobj"/>
<UnitName Value="mvDragObj"/>
</Item3>
<Item4>
<Filename Value="source/mvengine.pas"/>
@ -37,7 +37,7 @@ This is a fork of MapViewer by ti_dic (https://sourceforge.net/p/roadbook/code/c
</Item5>
<Item6>
<Filename Value="source/mvgpsobj.pas"/>
<UnitName Value="mvgpsobj"/>
<UnitName Value="mvGpsObj"/>
</Item6>
<Item7>
<Filename Value="source/mvjobqueue.pas"/>
@ -53,15 +53,15 @@ This is a fork of MapViewer by ti_dic (https://sourceforge.net/p/roadbook/code/c
</Item9>
<Item10>
<Filename Value="source/mvtypes.pas"/>
<UnitName Value="mvtypes"/>
<UnitName Value="mvTypes"/>
</Item10>
<Item11>
<Filename Value="source/mvmapviewer.pas"/>
<UnitName Value="mvmapviewer"/>
<UnitName Value="mvMapViewer"/>
</Item11>
<Item12>
<Filename Value="source/mvextradata.pas"/>
<UnitName Value="mvextradata"/>
<UnitName Value="mvExtraData"/>
</Item12>
<Item13>
<Filename Value="source/mvdlefpc.pas"/>
@ -73,13 +73,10 @@ This is a fork of MapViewer by ti_dic (https://sourceforge.net/p/roadbook/code/c
<UnitName Value="mvMapViewerReg"/>
</Item14>
</Files>
<RequiredPkgs Count="2">
<RequiredPkgs Count="1">
<Item1>
<PackageName Value="LCLBase"/>
</Item1>
<Item2>
<PackageName Value="FCL"/>
</Item2>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<Package Version="4">
<PathDelim Value="\"/>
<Name Value="lazMapViewer_Synapse"/>
<Type Value="RunAndDesignTime"/>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\"/>
</SearchPaths>
</CompilerOptions>
<Files Count="1">
<Item1>
<Filename Value="mvdlesynapse.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="mvDLESynapse"/>
</Item1>
</Files>
<RequiredPkgs Count="3">
<Item1>
<PackageName Value="lazMapViewerPkg"/>
</Item1>
<Item2>
<PackageName Value="laz_synapse"/>
</Item2>
<Item3>
<PackageName Value="FCL"/>
</Item3>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
</Package>
</CONFIG>

View File

@ -0,0 +1,22 @@
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit lazMapViewer_Synapse;
{$warn 5023 off : no warning about unused units}
interface
uses
mvDLESynapse, LazarusPackageIntf;
implementation
procedure Register;
begin
RegisterUnit('mvDLESynapse', @mvDLESynapse.Register);
end;
initialization
RegisterPackage('lazMapViewer_Synapse', @Register);
end.

View File

@ -14,7 +14,7 @@
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA.
}
unit mvDLESynapse;
@ -23,13 +23,13 @@ unit mvDLESynapse;
interface
uses
mvDownloadEngine,SysUtils, Classes, httpsend;
mvDownloadEngine, SysUtils, Classes, httpsend;
type
{ TMVDESynapse }
TMVDESynapse = class(TCustomDownloadEngine)
TMVDESynapse = class(TMvCustomDownloadEngine)
private
FProxyHost: string;
FProxyPassword: string;
@ -40,15 +40,26 @@ type
procedure DownloadFile(const Url: string; str: TStream); override;
published
property UseProxy: Boolean read FUseProxy write FUseProxy;
property UseProxy: Boolean read FUseProxy write FUseProxy default false;
property ProxyHost: string read FProxyHost write FProxyHost;
property ProxyPort: Integer read FProxyPort write FProxyPort;
property ProxyPort: Integer read FProxyPort write FProxyPort default 0;
property ProxyUsername: string read FProxyUsername write FProxyUsername;
property ProxyPassword: string read FProxyPassword write FProxyPassword;
end;
procedure Register;
implementation
uses
mvTypes;
procedure Register;
begin
RegisterComponents(PALETTE_PAGE, [TMVDESynapse]);
end;
{ TMVDESynapse }
procedure TMVDESynapse.DownloadFile(const Url: string; str: TStream);

View File

@ -46,6 +46,7 @@ Type
TMapView = class(TCustomControl)
private
FDownloadEngine: TMvCustomDownloadEngine;
FBuiltinDownloadEngine: TMvCustomDownloadEngine;
FEngine: TMapViewerEngine;
{$IFDEF USE_RGBGRAPHICS}
Buffer: TRGB32Bitmap;
@ -67,6 +68,7 @@ Type
function GetCacheOnDisk: boolean;
function GetCachePath: String;
function GetCenter: TRealPoint;
function GetDownloadEngine: TMvCustomDownloadEngine;
function GetMapProvider: String;
function GetOnCenterMove: TNotifyEvent;
function GetOnChange: TNotifyEvent;
@ -77,6 +79,7 @@ Type
procedure SetCacheOnDisk(AValue: boolean);
procedure SetCachePath(AValue: String);
procedure SetCenter(AValue: TRealPoint);
procedure SetDownloadEngine(AValue: TMvCustomDownloadEngine);
procedure SetInactiveColor(AValue: TColor);
procedure SetMapProvider(AValue: String);
procedure SetOnCenterMove(AValue: TNotifyEvent);
@ -115,7 +118,6 @@ Type
procedure ZoomOnObj(obj: TGPSObj);
procedure WaitEndOfRendering;
property Center: TRealPoint read GetCenter write SetCenter;
property DownloadEngine: TMvCustomDownloadEngine read FDownloadEngine;
property Engine: TMapViewerEngine read FEngine;
property GPSItems: TGPSObjectList read FGPSItems;
published
@ -123,6 +125,7 @@ Type
property Align;
property CacheOnDisk: boolean read GetCacheOnDisk write SetCacheOnDisk;
property CachePath: String read GetCachePath write SetCachePath;
property DownloadEngine: TMvCustomDownloadEngine read FDownloadEngine write FDownloadEngine;
property Height default 150;
property InactiveColor: TColor read FInactiveColor write SetInactiveColor;
property MapProvider: String read GetMapProvider write SetMapProvider;
@ -335,6 +338,14 @@ begin
Result := Engine.Center;
end;
function TMapView.GetDownloadEngine: TMvCustomDownloadEngine;
begin
if FDownloadEngine = nil then
Result := FBuiltinDownloadEngine
else
Result := FDownloadEngine;
end;
function TMapView.GetMapProvider: String;
begin
result := Engine.MapProvider;
@ -380,6 +391,12 @@ begin
Engine.Center := AValue;
end;
procedure TMapView.SetDownloadEngine(AValue: TMvCustomDownloadEngine);
begin
FDownloadEngine := AValue;
FEngine.DownloadEngine := GetDownloadEngine;
end;
procedure TMapView.SetInactiveColor(AValue: TColor);
begin
if FInactiveColor = AValue then
@ -736,7 +753,7 @@ begin
FGPSItems.OnModified := @OnGPSItemsModified;
FInactiveColor := clWhite;
FEngine := TMapViewerEngine.Create(self);
FdownloadEngine := TMvDEFpc.Create(self);
FBuiltinDownloadEngine := TMvDEFpc.Create(self);
{$IFDEF USE_RGBGRAPHICS}
Buffer := TRGB32Bitmap.Create(Width,Height);
{$ENDIF}
@ -747,7 +764,7 @@ begin
Engine.CacheOnDisk := true;
Engine.OnDrawTile := @DoDrawTile;
Engine.DrawTitleInGuiThread := false;
Engine.DownloadEngine := FDownloadengine;
Engine.DownloadEngine := FBuiltinDownloadEngine;
inherited Create(AOwner);
Width := 150;
Height := 150;

View File

@ -14,14 +14,13 @@ implementation
{$R mvmapviewer_icons.res}
uses
mvGeoNames, mvMapViewer;
mvTypes, mvGeoNames, mvMapViewer, mvDLEFpc;
procedure Register;
const
PALETTE = 'Misc';
begin
RegisterComponents(PALETTE, [TMapView]);
RegisterComponents(PALETTE, [TMvGeoNames]);
RegisterComponents(PALETTE_PAGE, [TMapView]);
RegisterComponents(PALETTE_PAGE, [TMvGeoNames]);
RegisterComponents(PALETTE_PAGE, [TMvDEFpc]);
end;
end.

View File

@ -29,6 +29,7 @@ uses
const
TILE_SIZE = 256;
PALETTE_PAGE = 'Misc';
Type
{ TArea }