[Chameleon] RE: switching mapfiles at runtime

McGraw, Joanne mcgrawj at AGR.GC.CA
Fri Jun 10 14:08:47 EDT 2005


More info:

 

I've realized I've said this part wrong:

After I've initialized the new map, the KeyMap object is empty. I can't
figure out where its values are supposed to be coming from, but when the
KeyMap constructor is run after I've initialized the new map, everything
is empty.

 

When I CWCInitialize() the new map, a new KeyMap is constructed and has
the values sent within the HTML. At the end of its SetMap function, the
properties are all set properly. Where it appears "empty", is in
"drawmap.php" when it comes time to DrawKeyMap(). None of the
$http_form_vars are set (if (isset($http_form_vars['nWidth'])...), so
the second block of code is run. That is, the following code is run to
DrawKeyMap():

 

    elseif (isset( $_SESSION["KEYMAP_SRS"] ) )

    {

        /*

        echo "drawReferenceMap:<BR>";

        print_r($oMapSession->oMap);

        print_r($oMapSession->oMap->reference);

        */

        $oRef = $oMapSession->oMap->reference;

        DrawKeyMap( $oMapSession, $oRef->width, $oRef->height,

                    $oRef->image, $oRef->extent->minx,
$oRef->extent->miny,

                    $oRef->extent->maxx, $oRef->extent->maxy,

                    $_SESSION["KEYMAP_SRS"],

                    ($oRef->color->red)." ".($oRef->color->green)."
".($oRef->color->blue),

                    ($oRef->outlinecolor->red)."
".($oRef->outlinecolor->green)." ".($oRef->outlinecolor->blue) );

        return;

    }

 

It is here that the Map object's reference is empty. There is an object
in the reference property, there is just no data stored in it besides
its defaults (like width and height = 0). So, the KeyMap object is being
created properly, it's just not being linked to the current
oMapSession/oMap in drawmap.php, somehow.

 

I hope this makes the problem I am having clearer.

 

jtm

 

-----Original Message-----
From: McGraw, Joanne 
Sent: Friday, June 10, 2005 11:13 AM
To: 'chameleon at lists.maptools.org'
Subject: switching mapfiles at runtime

 

Good day All,

 

I have hit the 50 layer limitation in a MapServer application I am
currently working on. While I realize I can recompile MapServer to
increase this value, I've found that in approaching 50 layers I have
noticed a reduction in performance (not drastic, but enough) during
loading and re-drawing, etc., so I would prefer to split up the layers
into separate maps based on categories of data. Depending on what data
the user wishes to review, the appropriate map will be loaded up.

 

I've created a widget that appears as a drop-down SELECT and within the
ParseURL am trying to change the application's map. I can do this by
calling CWCInitialize on the current application:

 

$oApp = GetChameleonApplication();

$oApp->CWCInitialize($oApp->mszTemplate, $szFullPath2NewMapFile);

 

Understandably, this does not reset things in all the other Chameleon
widgets. For example, I can easily get the current map's extents before
initializing the new map and reset them on the new map afterwards but,
the KeyMap (and, I'm sure others as well) is trickier. After I've
initialized the new map, the KeyMap object is empty. I can't figure out
where its values are supposed to be coming from, but when the KeyMap
constructor is run after I've initialized the new map, everything is
empty.

 

So, I've come to the conclusion that simply calling CWCInitialize in the
middle of a process is not a good idea. What is a better approach for a
person to go about changing the map within the running of an
application?

 

Cheers,

jtm

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20050610/54a11aae/attachment.html


More information about the Chameleon mailing list