Hi
The current scale can be easily accessed via the public function
getCurrentScale in coreplugin Location
you can also use the public function isLayerVisibleAtCurrentScale in
coreplugin Layers which should pretty much do already what you want.
regards
Oliver
----- Original Message -----
From: "Simon ORTET" <[EMAIL PROTECTED]>
To: "Oliver Christen" <[EMAIL PROTECTED]>
Cc: "cartoweb" <[email protected]>
Sent: Tuesday, August 28, 2007 11:13 AM
Subject: Re: [Cartoweb-users] Get layers icon in LayerReorder plugin
Hello Oliver,
One more thing about the layerReoder modification. I try to get the layer
visibility in order to prevent layerReorder to show layers that are not
visible at current scale.
The thing is with a $plugin->getLayers() i get a maxscale and minscale
informations about the layer, but how can i get current scale (to make the
comparison). Or is there a simpler way to get one's layer visibility? I
didn't find a function that can do that in Layers.php.
Thanks
Simon Ortet
Oliver Christen a écrit :
Hi
It should be allright.
getLayersInit() is used in the layers plugin because everything is based
on the original list of plugin and it is used as a basic references for
all treatments in that coreplugin.
(beside, I have the feeling $plugin->getLayersInit()->layers are string
when $plugin->getLayers() are objects, maybe that was your problem)
Since you are using the layers from another plugin, you can simple
suppose the layers plugin has it right and dont worry about it.
regards
Oliver
Hello
It was to check the values i got.
But finally i found a way :
In getCwLayerIds and my new function getCwLayerIcons i make a
foreach ($plugin->getLayers() as $layer) {
instead of
foreach ($plugin->getLayersInit()->layers as $layer)
so i can get $layer->icon
Seems to work fine, i just hope i didn't create a mess by modifing
getCwLayerIds function...
Simon Ortet
Silogic
Oliver Christen a écrit :
hi
whats the output of the print_r($element); you added?
regards
Oliver
Hi,
I'm trying to add the layer icon just before the radio button in
LayerReorder form. So here's what i did :
- in ClientLayerReorder.php, I created a getCwLayerIcons() function
just like getCwLayerIds() wich looks like this
/ public function getCwLayerIcons() {
$cwLayerIcons = array();
$plugin =
$this->cartoclient->getPluginManager()->getPlugin('layers');
foreach ($plugin->getLayersInit()->layers as $layer) {
if ($layer instanceof Layer) {
$cwLayerIcons[$layer->id] =
$plugin->getLayerIcon($layer);
}
}
return $cwLayerIcons;
}/
- The getLayerIcon() function in ClientLayers.php looks like this
/public function getLayerIcon($layer) {
$element = $this->fetchLayer($layer);
/*$children = $this->getLayerChildren($layer);
$this->fetchLayerIcon($layer,$children);
if (empty($element['layerIcon'])) {
$iconUrl = '';
} else {
$resourceHandler =
$this->getCartoclient()->getResourceHandler();
$iconUrl =
$resourceHandler->getFinalUrl($element['layerIcon'], false);
}*/
echo($layer->id.": ");
print_r($element);
echo "<br><br>\n";
return $element['layerIcon'];
}/
My problem is that i can't get the icon filename of my layers. I
always get an empty string.
Where am I doing something wrong?
Thanks
Simon Ortet
_______________________________________________
Cartoweb-users mailing list
[email protected]
http://lists.maptools.org/mailman/listinfo/cartoweb-users
_______________________________________________
Cartoweb-users mailing list
[email protected]
http://lists.maptools.org/mailman/listinfo/cartoweb-users