Jump to content

Change the UniMap MapLayers by code


ElCherchu

Recommended Posts

Hi, in my application I'm starting using UniMap, the case is that I don't want to show the MapLayers in map, instead of that I want to do it by code, but I don't Know how to do it,

Anyone can help me?, in other case how can I show the compass in map and change the direction?

Thanks..

I'm using:

Delphi 10.2

Unigui: FMSoft_uniGUI_Complete_Professional_1.90.0.1555

TUniMap

 

 

Link to comment
Share on other sites

unimap_websocket.thumb.gif.2324f087bbadaf5b0924737607729a2e.gifTUniMap.png.fcb58eff0a92c46140cc27aa581673cb.png

I think you can setup a custom MapLayer , and use custom img as base background map;

procedure TMainForm.UniMapMapLayers0CustomLayerUrl(Sender: TObject; var TileLayerUrl: string);
begin
  TileLayerUrl := '/files/clear.png'; //custom  image
end;

Then darw you vectors and markers by code.

 

About compass and direction ? I dont know now.

 

Link to comment
Share on other sites

To remove UniMap control


  with UniMap1, JSInterface do
  begin
    JSCallGlobal(JSName+'_uniControl.remove', []);
  end;

To add UniMap control

  with UniMap1, JSInterface do
  begin
    JSCall('uniMap.addControl', [JSStatement(JSName+'_uniControl')]);
  end;

To change position, 

with UniMap1, JSInterface do
  begin
    JSCallGlobal(JSName+'_uniControl.remove', []);
    JSCode(JSName+'_uniControl.options.position="'+UniMapControlPositionStr[mpTopLeft]+'";');
    JSCall('uniMap.addControl', [JSStatement(JSName+'_uniControl')]);
  end;

 

Link to comment
Share on other sites

On 11/29/2021 at 9:41 AM, Hayri ASLAN said:

To remove UniMap control


  with UniMap1, JSInterface do
  begin
    JSCallGlobal(JSName+'_uniControl.remove', []);
  end;

To add UniMap control

  with UniMap1, JSInterface do
  begin
    JSCall('uniMap.addControl', [JSStatement(JSName+'_uniControl')]);
  end;

To change position, 

with UniMap1, JSInterface do
  begin
    JSCallGlobal(JSName+'_uniControl.remove', []);
    JSCode(JSName+'_uniControl.options.position="'+UniMapControlPositionStr[mpTopLeft]+'";');
    JSCall('uniMap.addControl', [JSStatement(JSName+'_uniControl')]);
  end;

 

Thank Hayri

This realy work.

 

Link to comment
Share on other sites

  • 7 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...