[Chameleon] MapTips and JSAPI
Bart van den Eijnden (OSGIS)
bartvde at xs4all.nl
Mon Apr 17 08:00:59 EDT 2006
Hi Pierre,
I can imagine it is frustrating.
What also can help in general is to open up a bug report, and attach
your code or patch to the bug report. All bug reports are e-mailed to
the chameleon-dev e-mail list, and so all people with Chameleon CVS
access (including me) will see it, and can try to incorporate it into
Chameleon CVS if it makes sense to do so.
Are you willing to open up a bug report and attach your patch to it? Thanks.
Best regards,
Bart
Paul Spencer wrote:
> Hi Pierre,
>
> I emailed you back in December asking you to forward the code to Julien.
>
> Cheers
>
> Paul
>
> On 16-Apr-06, at 10:42 AM, Pierre Racine wrote:
>
>> Hi Bart,
>>
>> I'have done this work of adapting MapTips to JSAPI last summer. It
>> works pretty fine using also AJAX and everything. I'have sent my
>> code to Paul Spencer many months ago so he could integrate it in the
>> next release. But I never got any answer after two or three emails.
>> I'have wrote to Juilien-Samuel Lacroix three weeks ago to see if
>> this code would be in the upcoming release. No news since then.
>> Amazingly this guy is working 250km from me... Or people at
>> DMSolution to busy to integrate stuff or they do retain some
>> informations. I would not be surprised if this mail do not reach the
>> newsgroup.
>>
>> Anyway this is a strange Open Source project and this is very
>> frustrating. Many people are rebuiding the wheel because of a lack
>> of coordination.
>>
>> Probably there is something I haven't yet understand...
>>
>> Pierre Racine
>>
>>> From: "Eijnden, B. van den (Bart)" <b.vdeijnden at agi.rws.minvenw.nl>
>>> To: "Eijnden, B. van den (Bart)"
>>> <b.vdeijnden at agi.rws.minvenw.nl>,
>>> "'chameleon at lists.maptools.org'" <chameleon at lists.maptools.org>
>>> Subject: RE: [Chameleon] MapTips and JSAPI
>>> Date: Thu, 6 Apr 2006 09:01:19 +0200
>>>
>>> Okay, gotten a little progress on this one.
>>>
>>> I have written a litter wrapper script around the MapTips widget
>>> (based on
>>> UpdateMap.php), called maptips.php.
>>>
>>> Using the JSAPI event manager, I do an AJAX call to this script
>>> whenever the
>>> map extent changes. For this I had to adapt the MapTips widget not to
>>> include the <map> and </map> HTML tag when generating the ImageMap,
>>> since
>>> the content is set using innerHTML. I'll suggest a fix for this in
>>> bugzilla,
>>> i.e. the GenerateImageMap function should not add the <map> header
>>> but the
>>> DrawPublish function should do that.
>>>
>>> So basically in the HTML template:
>>>
>>> 1) at the onload, register the event:
>>> goCWCJSAPI.RegisterEvent(MAP_EXTENT_CHANGED, "GetImageMap")
>>>
>>> 2) GetImageMap function does a AJAX call to maptips.php:
>>> function GetImageMap()
>>> {
>>> call('/chameleon/widgets/MapTips/maptips.php?sid=[$gszSessId$]
>>> &minx=' +
>>> goCWCJSAPI.oMap.minx +
>>> '&miny='+goCWCJSAPI.oMap.miny + '&maxx=' + goCWCJSAPI.oMap.maxx +
>>> '&maxy='+goCWCJSAPI.oMap.maxy, null, processAjax);
>>> }
>>>
>>> 3) when the browser receives the content from maptips.php, it will
>>> trigger
>>> the processAjax function which sets the innerHTML (IE specific btw):
>>> function processAjax(szResults)
>>> {
>>> if (document.all)
>>> document.all.maptips_imagemap6.innerHTML= "'"+szResults+"'";
>>> }
>>>
>>> 4) don't forget to add the imagemap to your HTML template:
>>> <map name="maptips_imagemap6"></map>
>>>
>>> The maptips.php wrapper script does the necessary processing to
>>> generate the
>>> image map based on the MapTips widget, an excerpt is:
>>>
>>> $oMap = $oMapSession->oMap;
>>> $oMap->setExtent($_GET['minx'], $_GET['miny'], $_GET['maxx'],
>>> $_GET['maxy']);
>>> $_SESSION["gszCurrentState"] = $oMapSession->saveState();
>>> include_once("MapTips.widget.php");
>>> $oWidget = new MapTips();
>>> $oWidget->maParams["LAYER"] = 'werkzaamheden';
>>> $oWidget->maParams["ATTRIBUTES"] = 'WEGNUMMER,STT_NAAM,GME_NAAM';
>>> $oWidget->maParams["ONMOUSEOVER"] = 'myMaptipsOver';
>>> $oWidget->maParams["ONMOUSEOUT"] = 'myMaptipsOut';
>>> $oWidget->maParams["VISIBLE"] = 'false';
>>> $oWidget->InitDefaults();
>>> $oWidget->SetMap($oMapSession);
>>> echo $oWidget->GenerateImageMap();
>>>
>>> This shows the advantages of using AJAX in combination with
>>> Chameleon JSAPI,
>>> maybe not everybody knows but starting Chameleon 2.4 there is a
>>> small ajax
>>> library in chameleon/htdocs/common/ajax/xhr.js which has the call
>>> javascript
>>> function in it which I use in GetImageMap.
>>>
>>> Best regards,
>>> Bart
>>>
>>> -----Oorspronkelijk bericht-----
>>> Van: chameleon-bounces at lists.maptools.org
>>> [mailto:chameleon-bounces at lists.maptools.org]Namens Eijnden, B. van
>>> den
>>> (Bart)
>>> Verzonden: woensdag 5 april 2006 13:13
>>> Aan: 'chameleon at lists.maptools.org'
>>> Onderwerp: [Chameleon] MapTips and JSAPI
>>>
>>>
>>> Hi list,
>>>
>>> did anyone ever attempt to adapt the MapTips widget to work in
>>> JSAPI mode?
>>>
>>> Would this even be possible? I.e. can the current generation of
>>> browsers
>>> handle an imagemap which is not embedded in the HTML page?
>>>
>>> Best regards,
>>> Bart
>>>
>>>
>>> Disclaimer
>>> *********************************************************************
>>> ***
>>> Aan dit bericht kunnen geen rechten worden ontleend. Dit bericht is
>>> uitsluitend bestemd voor de geadresseerde. Als u dit bericht per abuis
>>> hebt ontvangen, wordt u verzocht het te vernietigen en de afzender te
>>> informeren. Wij adviseren u om bij twijfel over de juistheid of de
>>> volledigheid van de mail contact met afzender op te nemen.
>>>
>>> This message shall not constitute any rights or obligations.
>>> This message is intended solely for the addressee.
>>> If you have received this message in error, please delete it and
>>> notify the sender immediately. When in doubt whether this message
>>> is correct or complete, please contact the sender.
>>> *********************************************************************
>>> ***
>>>
>>> _______________________________________________
>>> Chameleon mailing list
>>> Chameleon at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/chameleon
>>>
>>>
>>> Disclaimer
>>> *********************************************************************
>>> ***
>>> Aan dit bericht kunnen geen rechten worden ontleend. Dit bericht is
>>> uitsluitend bestemd voor de geadresseerde. Als u dit bericht per abuis
>>> hebt ontvangen, wordt u verzocht het te vernietigen en de afzender te
>>> informeren. Wij adviseren u om bij twijfel over de juistheid of de
>>> volledigheid van de mail contact met afzender op te nemen.
>>>
>>> This message shall not constitute any rights or obligations.
>>> This message is intended solely for the addressee.
>>> If you have received this message in error, please delete it and
>>> notify the sender immediately. When in doubt whether this message
>>> is correct or complete, please contact the sender.
>>> *********************************************************************
>>> ***
>>>
>>> _______________________________________________
>>> Chameleon mailing list
>>> Chameleon at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/chameleon
>>
>>
>>
>> _______________________________________________
>> Chameleon mailing list
>> Chameleon at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/chameleon
>
>
> +-----------------------------------------------------------------+
> |Paul Spencer pspencer at dmsolutions.ca |
> +-----------------------------------------------------------------+
> |Applications & Software Development |
> |DM Solutions Group Inc http://www.dmsolutions.ca/|
> +-----------------------------------------------------------------+
>
>
>
>
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
>
>
--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl
More information about the Chameleon
mailing list