[Cartoweb-users] legend automatic update

Florian MRVA florian.mrva at scribe-is.fr
Mon Feb 21 09:47:33 EST 2011


Hello the list

I'm back to my project cartoweb.

I have a problem updating display of the legend.

I will explain in detail this problem.

I have a layer "PARCELLE" in a basic blue color.

I developed a plugin that based on elements will perform classification.
All this is achieved by mapscript with this function:


$msMap = $this->serverContext->getMapObj();

//on test en premier lieu le fait que l'on affiche les parcelles ou pas
if (!($this->couchesConnexions[0]== '')){
$layerParcelle = $msMap->getLayerByName($this->couchesConnexions[0]);

$classFondCarte = $layerParcelle->getClass(0);

$nombreClassSelection = sizeof($this->listeSelectionParcelles);
if (!($nombreClassSelection ==0)){

for($i=0;$i<$nombreClassSelection;$i++)
{
$classSelection = ms_newClassObj($layerParcelle);

$objetSelection = $this->listeSelectionParcelles[$i];

$classSelection->set('name',$objetSelection->libelleSelection);
$classSelection->set('status',MS_ON);
$classSelection->set('title',$objetSelection->libelleSelection);

$labelSelection = $classSelection->label;
$labelSelection->set('font','vera');

$labelSelection->set('type','TRUETYPE');
$labelSelection->set('size',8);
$labelSelection->color->setRGB(255, 255, 255);
$labelSelection->outlinecolor->setRGB(0, 0, 0);

$styleSelection = ms_newStyleObj($classSelection);
$styleSelection->color->setRGB($objetSelection->couleurFond->rouge, 
$objetSelection->couleurFond->vert, $objetSelection->couleurFond->bleu);
$styleSelection->outlinecolor->setRGB($objetSelection->couleurCadre->rouge, 
$objetSelection->couleurCadre->vert, $objetSelection->couleurCadre->bleu);

$nombreParcelles = sizeof($objetSelection->listeId);

if ($nombreParcelles == 0){
return;
}
else{
$filtreSelection = '(';
$operateurOu ='';

for($j=0;$j<$nombreParcelles;$j++)
{
$filtreSelection .= $operateurOu;
$filtreSelection .= '( "['. $objetSelection->listeRubriquesFiltre[$j] 
.']" eq "'. $objetSelection->listeId[$j] .'" )';
$operateurOu = ' OR ';
}
$filtreSelection .= ')';

$classSelection->setexpression($filtreSelection);

$layerParcelle->moveclassup($i+1);
}
}
}
}


The map is correctly updated, but i want to update the legend 
automatically, but !!!! Idon't know do that!!

Thank alot

Regards,
Florian





More information about the Cartoweb-users mailing list