[Chameleon] How to register function for ROI_CHANGED event?

Delfos, Jacob Jacob.Delfos at maunsell.com
Sun Jul 9 20:12:40 EDT 2006


Hi Julien,

Thanks for your reply. I have done a lot of debugging, and narrowed it
down to what I think is a bug in the event mechanism of the ROI manager
(incorrect 'eval' syntax). I have filed a bug for it:
http://bugzilla.maptools.org/show_bug.cgi?id=1522

Can you tell me why cwc_roi and cwc_jsapi use their own event code? It
seems like cwc_events doesn't get used at all. I just removed the entire
content of the file, and chameleon still loads. It would be beneficial
if the events were all handled by the same code, because it looks like
this code has been written better than the event handlers in cwc_jsapi
and cwc_roi. The cwc_jsapi eval code appears to ignore arguments, so
could also result in problems.

Lastly: is there any chance someone could look at
http://bugzilla.maptools.org/show_bug.cgi?id=1135 ?
I'd really appreciate it if it could get resolved, because then I can
use proper CVS code with my ROIArea widget. In short, the problem is
that the javascript polygon objects gets destroyed, preventing further
use of it.

Regards,

Jacob



 

> -----Original Message-----
> From: Julien-Samuel Lacroix [mailto:jlacroix at mapgears.com] 
> Sent: 7 July 2006 21:03
> To: Delfos, Jacob
> Cc: Chameleon-users
> Subject: Re: [Chameleon] How to register function for 
> ROI_CHANGED event?
> 
> Hi Jacob,
> 
> There's a ONROICHANGED attribute in the ROIManager widget. I 
> don't know 
> if it may help. For your problem, does the 
> ROIAreaRegisterForEvent and 
> updateArea functions are printed in your result html page? 
> And does the 
> ROIAreaRegisterForEvent get called in the OnLoad function?
> 
> You can maybe put some alert(); in the cwc_event.js file 
> around line 151 
> (in the CWCEventManager_TriggerEvent) to see what happen.
> 
> Julien
> 
> Delfos, Jacob wrote:
> > Hi List,
> > 
> > I'm trying to write a widget that displays the area of a 
> ROI in a label, 
> > similar to the ruler widget. It all works, except I can't get it to 
> > respond to the ROI_CHANGED event, which gets triggered 
> around line 242 
> > of cwc_roi.js. By manually calling the function at that point, 
> > everything works fine. But obviously I'd prefer to use the event.
> > 
> > I have pasted the relevant bits from my widget, hoping 
> someone can see 
> > something I did wrong.
> > 
> > Thanks in advance,
> > 
> > Jacob
> > 
> > 
> > ------------------------------Inside 
> > "GetJavascriptFunctions"------------------------------
> > 
> > $szJsFunctionName = "ROIAreaRegisterForEvent";
> > $szFunction = <<<EOT
> > 
> > function {$szJsFunctionName}()
> > {
> >     goCWCROIManager.RegisterEvent(ROI_CHANGED, "updateArea");
> > }
> > EOT;
> > 
> >        $aReturn[$szJsFunctionName] = $szFunction;
> > 
> >        $szJsFunctionName = "updateArea";
> >         $szFunction = <<<EOT
> > 
> > function {$szJsFunctionName}()
> > {
> > [...]
> > }
> > EOT;
> > 
> > $aReturn[$szJsFunctionName] = $szFunction;
> > return $aReturn;
> > 
> --------------------------------------------------------------
> ----------------------------------------------------------
> > 
> > 
> > 
> > 
> ------------------------------------GetJavascriptOnLoadFunctio
ns------------------------------------ 
> > 
> > 
> >     function GetJavascriptOnLoadFunctions()
> >     {
> >         $aReturn = array();
> > 
> >         $aReturn = parent::GetJavascriptOnLoadFunctions();
> > 
> >         $szJsFunctionName = "ROIAreaRegisterForEvent";
> >         $szFunction = "$szJsFunctionName();\n";
> >         $aReturn[$szJsFunctionName] = $szFunction;
> > 
> > 
> >         return $aReturn;
> >     }
> > 
> --------------------------------------------------------------
> ---------------------------------------------- 
> > 
> > 
> > 
> > 
> > 
> > *JACOB DELFOS
> > GIS ANALYST
> > *Maunsell Australia Pty Ltd
> > 629 Newcastle Street, Leederville, WA 6007
> > PO Box 81, Leederville, WA 6902
> > Western Australia
> > ABN 20 093 846 925
> > 
> > Tel     + 61 8 9281 6185
> > Fax    + 61 8 9281 6297
> > _jacob.delfos at maunsell.com_
> > 
> > 
> > 
> --------------------------------------------------------------
> ----------
> > 
> > _______________________________________________
> > Chameleon mailing list
> > Chameleon at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/chameleon
> 
> -- 
> Julien-Samuel Lacroix
> Mapgears
> http://www.mapgears.com/
> 



More information about the Chameleon mailing list