[Chameleon] re: javascrips ROI tool

Bart van den Eijnden BEN at Syncera-ITSolutions.NL
Wed Jun 22 10:16:06 EDT 2005


Hi Gerry,

I am cc-ing the list, maybe someone else is interested so I don't have to repeat myself :-)

What I did is:

1)

add ROIManager and ROICircle tool to the HTML template:

<cwc2 type="ROIManager" mode="normal" />

<cwc2 type="ROICircleTool" visible="false" styleresource="NavButtons" image="images/icon_roi_ellipse.png" imagetip="Define a circular ROI" toolset="Navigation" numberofpoints="0">
        <image state="normal"/>
        <image state="selected"/>
        <image state="hover"/>
      </cwc2>

2)

Plug in my own query mechanism like described on the Chameleon Wiki:

  goEventManager.registerForEvent('ON_QUERY', 'stragiswebquery');

3) Create the javascript which draws the ROI

function stragiswebquery( nX, nY )
{
  if ((document.forms[0].RADIUS) && (document.forms[0].RADIUS.value != ""))
  {
    iRadiusGeo = document.forms[0].RADIUS.value;
    iRadiusPix = (iRadiusGeo/(goCWCJSAPI.oMap.maxx-goCWCJSAPI.oMap.minx))*gMapWiWidth;

    if ((parseInt(document.forms[0].RADIUS.value) >= 0) && (parseInt(document.forms[0].RADIUS.value) <= 1000))
    {
      ROICircleToolInitObjects();
      ROICircleToolStartZoomBox();
      goROICircleObj.centerX = nX;
      goROICircleObj.centerY = nY;
      goROICircleObj.radius = iRadiusPix;
      goROICircleObj.edgeColor = '0000FF';
      goROICircleObj.edgeWidth = 5;
      goROICircleObj.fillOpacity = 1;
      goCWCROIManager.Add(goROICircleObj);
  }
}

Hope this helps.

Best regards,
Bart

Bart van den Eijnden
Syncera IT Solutions
Postbus 270
2600 AG  DELFT

tel.nr.: 015-7512436
email: BEN at Syncera-ITSolutions.nl

>>> Gerry Creager N5JXS <gerry.creager at tamu.edu> 06/22/05 04:10pm >>>
Bart,

Yes, I would appreciate a copy of your ROI tool.

Thanks!
gerry
-- 
Gerry Creager -- gerry.creager at tamu.edu 
Texas Mesonet -- AATLT, Texas A&M University	
Cell: 979.229.5301 Office: 979.458.4020 FAX: 979.847.8578
Page: 979.228.0173
Office: 903A Eller Bldg, TAMU, College Station, TX 77843




More information about the Chameleon mailing list