[Cartoweb-users] how to refresh legendlayersaftermapoverlayoperation?

Oliver Christen oliver.christen at camptocamp.com
Wed Apr 30 06:44:07 EDT 2008


you can access a plugin object this way on server side:
$mapOverlay = $this->serverContext->getPluginManager()->mapOverlay;
or
$mapOverlay = 
$this->serverContext->getPluginManager()->getPlugin('mapOverlay');

though, calling getInit(); at that level may have unexpected results, as 
there are quite some operation behind that beside icon generation.

regards
Oliver

>
>
> I see, is there a way to access the instance of the ServerLayers plugin 
> from
> another one,
> so i could something like :
>
> $mapOverlay->updateMap($layer);
> $myServerLayersInstance->getInit();
>
> ?
>
> Thanx alot
>
>
>
> Oliver Christen wrote:
>>
>> the getInit stage is only listed in the latest cvs version of the 
>> workflow
>> chart http://www.cartoweb.org/doc/misc/plugins_diagram.pdf
>>
>>> Another possibility is the icones are generated before the mapOverlay
>>> transformation.
>>>>From what I see, the call is initiated in getInit in
>>>>LayersInitProvider.php
>>> (getInit>fillDynamicLayers>fillDynamicLayer>getClassIcon).
>>> This is a bit annoying as it is the most early stage on server side.
>>>
>>> So you can try to do the mapoverlay transformation at that stage too and
>>> pray it will work, ortherwise you would need to find a way to regenerate
>>> the related layer's icon image after applying the mapoverlay
>>> transformation.
>>>
>>> regards
>>> Oliver
>>>
>>>>
>>>> I don't think it has to do with the cache, cause i already have a 
>>>> custom
>>>> profile with :
>>>>
>>>> profile = custom
>>>> noMapResultCache = true
>>>>
>>>> on server_conf/server.ini in my project..
>>>>
>>>> Should i delve into the details of the layers plugin?
>>>>
>>>>
>>>>
>>>> Oliver Christen wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> I presume the map cache is not refreshed.
>>>>> Maybe you could try to force a map cache refresh. See this post on how
>>>>> to
>>>>> test that:
>>>>> http://lists.maptools.org/pipermail/cartoweb-users/2008-February/003297.html
>>>>> though in your case you would need to set some public variable or
>>>>> function
>>>>> in your mapoverlay plugin and access that from the getMap function 
>>>>> from
>>>>> MapResultCache.php
>>>>>
>>>>> A proper mecanism to force map cache refresh is not implemented yet, 
>>>>> we
>>>>> are
>>>>> still thinking about how to do it in a clean way.
>>>>>
>>>>> regards
>>>>> Oliver
>>>>>
>>>>>>
>>>>>> hi,
>>>>>>
>>>>>> in layer.ini i set autolayerlegend = true, and it works for the 
>>>>>> static
>>>>>> map
>>>>>> file.
>>>>>> Now i have a server plugin in which i redefine some layers color like
>>>>>> this
>>>>>> :
>>>>>>
>>>>>>  public function handlePreDrawing($requ) {
>>>>>>    $color = new ColorOverlay();
>>>>>>    $color->red = 255;
>>>>>>    $color->green = 0;
>>>>>>    $color->blue = 0;
>>>>>>    $style = new StyleOverlay();
>>>>>>    $style->index = 0;
>>>>>>    $style->color = $color;
>>>>>>    $label = new LabelOverlay();
>>>>>>    $label->outlineColor = $color;
>>>>>>    $class = new ClassOverlay();
>>>>>>    //$class->action = BasicOverlay::ACTION_INSERT;
>>>>>>    $class->action = BasicOverlay::ACTION_UPDATE;
>>>>>>    $class->name = 'tombe';
>>>>>>    $class->styles = array($style);
>>>>>>    $class->label = $label;
>>>>>>    $layer1 = new LayerOverlay();
>>>>>>    $layer1->name = 'tombe';
>>>>>>    $layer1->classes = array($class);
>>>>>>
>>>>>>    $mapOverlay = 
>>>>>> $this->serverContext->getPluginManager()->mapOverlay;
>>>>>>    $mapOverlay->updateMap($layer1);
>>>>>>    $this->serverContext->getMapObj()->save('debug.map');
>>>>>>
>>>>>>  }
>>>>>>
>>>>>> Now the color changes correctly, but the color of the icons stays the
>>>>>> one
>>>>>> of
>>>>>> the static
>>>>>> map file.
>>>>>>
>>>>>> Any idea?
>>>>>> thanx
>>>>>>
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/how-to-refresh-legend-layers-after-mapoverlay-operation--tp16964245p16964245.html
>>>>>> Sent from the cartoweb-users mailing list archive at Nabble.com.
>>>>>>
>>>>>> _______________________________________________
>>>>>> Cartoweb-users mailing list
>>>>>> Cartoweb-users at lists.maptools.org
>>>>>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Cartoweb-users mailing list
>>>>> Cartoweb-users at lists.maptools.org
>>>>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/how-to-refresh-legend-layers-after-mapoverlay-operation--tp16964245p16979232.html
>>>> Sent from the cartoweb-users mailing list archive at Nabble.com.
>>>>
>>>> _______________________________________________
>>>> Cartoweb-users mailing list
>>>> Cartoweb-users at lists.maptools.org
>>>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>>>
>>>
>>> _______________________________________________
>>> Cartoweb-users mailing list
>>> Cartoweb-users at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>>
>>
>> _______________________________________________
>> Cartoweb-users mailing list
>> Cartoweb-users at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>
>>
>
> -- 
> View this message in context: 
> http://www.nabble.com/how-to-refresh-legend-layers-after-mapoverlay-operation--tp16964245p16979668.html
> Sent from the cartoweb-users mailing list archive at Nabble.com.
>
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
> 



More information about the Cartoweb-users mailing list