Jump to content

Google Maps for uniGUI


lema

Recommended Posts

Some times, The map corner come empty. Gmap frame aling is client.

 

If i change zoom level, The map is to be diffrent dimention.

 

Is it a bug? What can i do?

 

Thank you Lema for help.

 

attachicon.gifAdsız.jpg

 

 

Yes , I am aware of it.

The use of UniGMap1.ResizeMap in UniFormResize event is not correct.

 

 

You can use the following:

procedure TMapForm.UniFormCreate(Sender: TObject);
begin
  UniGMap1.ClientEvents.ExtEvents.Values['resize'] :=
    'function (sender, width, height, oldWidth, oldHeight, eOpts)' +
    '{ if (typeof gm_MapForm_UniGMap1 != ''undefined'') { ' +
    ' google.maps.event.trigger(gm_MapForm_UniGMap1, ''resize''); }}';
end;

The code above will add a client event in UniGMap1 component.

Thus, whenever the UniGMap1 resizes , the internal google maps objects resizes too.

 

Please give your attention to the object naming (gm_MapForm_UniGMap1)

Link to comment
Share on other sites

Hi,

 

My project with UniGMap is not firing the AjaxEvent. I create marks for the map, make a click on the mark and drag, and does not fire any Ajax Event.

 

I checked the settings in the UniGmap Demo and there is nothing different, where the Demo events are fired.

 

Any idea what could be?

 

Delphi XE6 UniGui 0.97
Link to comment
Share on other sites

 

Hi,
 
My project with UniGMap is not firing the AjaxEvent. I create marks for the map, make a click on the mark and drag, and does not fire any Ajax Event.
 
I checked the settings in the UniGmap Demo and there is nothing different, where the Demo events are fired.
 
Any idea what could be?
 
Delphi XE6 UniGui 0.97

 

 

If you just left click on map , do you get the mapclick event ?

Link to comment
Share on other sites

Thank you Lema,

 

Everythings is good. Now.

 

Can we load PostGis or MySql Spatial Table with any query on the map?

What do you think about?

 

You can use your database to display objects on map (markers , polylines , etc).

You can also use the map to get coordinates and store them to database.

What exactly do you want to do ?

Link to comment
Share on other sites

Hi Lema,

 

ı want to add direct all geometric data from database.

 

For example, like QGIS programs can read different data formats..(look at the pic.)

 

Loading step by step is very slowly you know.

 

Can gmap read *.shp, *.json, *.dxf ? 

 

Thanks for all.

 

post-2269-0-56188100-1420705969_thumb.jpg

Link to comment
Share on other sites

Hi Lema,

 

ı want to add direct all geometric data from database.

 

For example, like QGIS programs can read different data formats..(look at the pic.)

 

Loading step by step is very slowly you know.

 

Can gmap read *.shp, *.json, *.dxf ? 

 

Thanks for all.

 

 

Can you convert your shapefiles into KML ?

The unigmap can load only KML files.

Link to comment
Share on other sites

Strange..

Try debugging using Firebug and look what events are coming.

 

Hello Lema,

 

I believe to have found the problem, which can be a possible bug.
 
I debug and found that the ajax events are fired in the UniGMap MainForm component, not the component that is in the frame, which is the object that should respond to map events.
 
It is probable that this possible bug occurs when using the Frames that are loaded in the main form, and for some reason, the events are captured by the object(UniGmap) of the main form of the application.
 
Another thing, there is a way to report to the Title property of the mark to contain concatenated two words, one under the other?
 
Ex:
I tried Title: = varName1 + '<br>' + varName2 + '</br>';
but he gets everything as a single string.
 
Thanks again!

 

 

 

Link to comment
Share on other sites

 

Hello Lema,

 

I believe to have found the problem, which can be a possible bug.
 
I debug and found that the ajax events are fired in the UniGMap MainForm component, not the component that is in the frame, which is the object that should respond to map events.
 
It is probable that this possible bug occurs when using the Frames that are loaded in the main form, and for some reason, the events are captured by the object(UniGmap) of the main form of the application.
 
 
Yes , there is a bug. I will fix it asap !
 

 
Another thing, there is a way to report to the Title property of the mark to contain concatenated two words, one under the other?
 
Ex:
I tried Title: = varName1 + '<br>' + varName2 + '</br>';
but he gets everything as a single string.
 
Thanks again!

 

Try using TMarkerEx instead TMarker.

TMarkerEx accepts HTML syntax and has more styling capabilities.

 

Be careful ! TMarkerEx and MarkerWithLabel Library is not intended for heavy usage.

 

 

 

Link to comment
Share on other sites

 

 

Hello Lema,

 

I believe to have found the problem, which can be a possible bug.
 
I debug and found that the ajax events are fired in the UniGMap MainForm component, not the component that is in the frame, which is the object that should respond to map events.
 
It is probable that this possible bug occurs when using the Frames that are loaded in the main form, and for some reason, the events are captured by the object(UniGmap) of the main form of the application.
 
 
Yes , there is a bug. I will fix it asap !
 
Thanks!

 
Another thing, there is a way to report to the Title property of the mark to contain concatenated two words, one under the other?
 
Ex:
I tried Title: = varName1 + '<br>' + varName2 + '</br>';
but he gets everything as a single string.
 
Thanks again!

 

Try using TMarkerEx instead TMarker.

TMarkerEx accepts HTML syntax and has more styling capabilities.

 

Be careful ! TMarkerEx and MarkerWithLabel Library is not intended for heavy usage.

 

Ok!  Something like add on map 50 /100 marks  would be too much?

 

 

 

 

 

 

 

Lema, 

 

There is another situation:

 

I need to get the Left and Top of the mark in relation the Form/Frame Parent when the user clicks on the mark for me to display a UniPanel just below the mark with some information about the mark.
I thought I'd add in markerExClick Listener two more variables that could return to the parameters in ajax event, something like:
 
'xpos =' + e.ClientX, '+
'ypos =' + e.ClientY '
 
Could you add something like this for me to have the position of the mark in relation to its Parent component for  above purpose?

 

Thanks!

Link to comment
Share on other sites

 

Lema, 

 

There is another situation:

 

I need to get the Left and Top of the mark in relation the Form/Frame Parent when the user clicks on the mark for me to display a UniPanel just below the mark with some information about the mark.
I thought I'd add in markerExClick Listener two more variables that could return to the parameters in ajax event, something like:
 
'xpos =' + e.ClientX, '+
'ypos =' + e.ClientY '
 
Could you add something like this for me to have the position of the mark in relation to its Parent component for  above purpose?

 

Thanks!

 

 

I added in the markerExClick Listener the variables xpos , ypos.

(They are showing the marker X,Y point in map control instead of the mouse point).

 

Another good approach is to use the ClientEvents to get mouse X,Y position.

(You can see an example in uniGMapDemo , form "Map Options")

Link to comment
Share on other sites

Hi Lema,

have you implemented getCurrentPosition or watchPosition in component?

Thanks,

Stefano

 

Hello Stefano.

You can easily implement getCurrentPosition.

 

 

One way is the following:

procedure TGeolocationAPIForm.UniButton2Click(Sender: TObject);
begin
  UniSession.AddJS(
    'if (navigator.geolocation) { ' +
    '  navigator.geolocation.getCurrentPosition( function(position) { ' +
    '    ajaxRequest(GeolocationAPIForm.UniButton2, "CurrentPosition" ,' +
    '      ["lat=" + position.coords.latitude, ' +
    '       "lng=" + position.coords.longitude, ' +
    '       "acc=" + position.coords.accuracy, ' +
    '       "alt=" + position.coords.altitude, ' +
    '       "altacc=" + position.coords.altitudeAccuracy, ' +
    '       "head=" + position.coords.heading, ' +
    '       "ts=" + position.coords.timestamp ' +
    '      ]);' +
    '    })' +
    '}');
end;

and get the response :

procedure TGeolocationAPIForm.UniButton2AjaxEvent(Sender: TComponent; EventName: string; Params: TStrings);
begin

  if EventName = 'CurrentPosition' then
  begin
    // add a map marker or...
  end;

end;

I updated the unigmap demo and you can see it live at :

http://79.143.178.31/lema/uniGMapDemo.dll

 

 

I didn't try the geolocation.watchPosition , I suppose it works like getCurrentPosition.

Link to comment
Share on other sites

Hi Lema,

 

KML file loading is good working your demo. When i run it my pc with local kml file don't load. 

 

Can i load local kml file on lan? When i run with local kml , i will try run script other formats. ( Json, shp, dxf etc.)

 

Thank you again. Good work.

Link to comment
Share on other sites

Hi Lema,

 

KML file loading is good working your demo. When i run it my pc with local kml file don't load. 

 

Can i load local kml file on lan? When i run with local kml , i will try run script other formats. ( Json, shp, dxf etc.)

 

Thank you again. Good work.

 

Hello , please see at

http://forums.unigui.com/index.php?/topic/2363-google-maps-for-unigui/page-3&do=findComment&comment=11108

Link to comment
Share on other sites

I added in the markerExClick Listener the variables xpos , ypos.

(They are showing the marker X,Y point in map control instead of the mouse point).

 

Another good approach is to use the ClientEvents to get mouse X,Y position.

(You can see an example in uniGMapDemo , form "Map Options")

 

Thanks Lema!!  Great!

Link to comment
Share on other sites

Hi Lema,

 

How we can Google Map InfoWindow Form design and add to object properties? 

 

If We can click object on the map, we can see its properties that we make any properties like JSON objects.

 

Other side, if we can write spatial function how we can attach with the map. For example, i want to relation beetween map object and DBase.

 

Thank you help.

Link to comment
Share on other sites

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...