Exemplo n.º 1
0
 function gradeCoord($intervalo, $corlinha = "200,200,200", $larguralinha = 1, $tipolinha = "linha", $tamanhotexto = MS_TINY, $fonte = "bitmap", $cortexto = "0,0,0", $incluitexto = "sim", $mascara = "-1,-1,-1", $shadowcolor = "-1,-1,-1", $shadowsizex = 0, $shadowsizey = 0)
 {
     //echo $corlinha;exit;
     //if (file_exists($this->qyfile))
     //{unlink ($this->qyfile);}
     //tem erro na versão 6 do Mapserver. Já abri um ticket no trac da OSGEO
     $nlayer = criaLayer($this->mapa, MS_LAYER_LINE, MS_DEFAULT, "Grade de coordenadas", "SIM");
     ms_newgridobj($nlayer);
     $nlayer->grid->set("labelformat", "DDMMSS");
     $nlayer->grid->set("maxinterval", $intervalo);
     $classe = $nlayer->getclass(0);
     $classe->set("name", "");
     $estilo = $classe->getstyle(0);
     $estilo->set("maxsize", 100);
     $estilo->set("minsize", 1);
     $estilo->set("size", $larguralinha);
     $estilo->set("symbolname", $tipolinha);
     $cor = $estilo->color;
     if ($corlinha != "") {
         $corlinha = explode(",", $corlinha);
         $cor->setrgb($corlinha[0], $corlinha[1], $corlinha[2]);
     }
     if ($incluitexto == "sim") {
         if ($this->vi >= 60300) {
             //$classe->addLabel(new labelObj());
             //$label = $classe->getLabel(0);
             $s = "CLASS LABEL  END END";
             $classe->updateFromString($s);
             $label = $classe->getLabel($indiceLabel);
         } else {
             $label = $classe->label;
         }
         $label->set("size", $tamanhotexto);
         $label->set("type", MS_BITMAP);
         if ($fonte != "bitmap") {
             $label->set("type", MS_TRUETYPE);
             $label->set("font", $fonte);
             $label->set("size", $tamanhotexto);
         } else {
             $label->set("type", MS_BITMAP);
             $t = MS_TINY;
             if ($tamanhotexto > 5) {
                 $t = MS_TINY;
             }
             if ($tamanhotexto >= 7) {
                 $t = MS_SMALL;
             }
             if ($tamanhotexto >= 10) {
                 $t = MS_MEDIUM;
             }
             if ($tamanhotexto >= 12) {
                 $t = MS_LARGE;
             }
             if ($tamanhotexto >= 14) {
                 $t = MS_GIANT;
             }
             $label->set("size", $t);
         }
         $label->set("buffer", 0);
         $label->set("force", MS_FALSE);
         $label->set("partials", MS_FALSE);
         $label->set("position", MS_CC);
         $corl = $label->color;
         if ($cortexto != "") {
             $cortexto = explode(",", $cortexto);
             $corl->setrgb($cortexto[0], $cortexto[1], $cortexto[2]);
         }
         $label->set("offsetx", 0);
         $label->set("offsety", 0);
         if ($mascara != "") {
             corE($label, $mascara, "outlinecolor");
         }
         if ($shadowcolor != "") {
             corE($label, $shadowcolor, "shadowcolor");
             $label->set("shadowsizex", $shadowsizex);
             $label->set("shadowsizey", $shadowsizey);
         }
     }
     return "ok";
 }
Exemplo n.º 2
0
function corrigeLayerGrid($layerOrigem, $layerDestino)
{
    if ($layerOrigem->connectiontype == MS_GRATICULE) {
        ms_newgridobj($layerDestino);
        $layerDestino->grid->set("labelformat", $layerOrigem->grid->labelformat);
        $layerDestino->grid->set("mininterval", $layerOrigem->grid->mininterval);
        $layerDestino->grid->set("maxinterval", $layerOrigem->grid->maxinterval);
        $layerDestino->grid->set("minsubdivide", $layerOrigem->grid->minsubdivide);
        $layerDestino->grid->set("maxsubdivide", $layerOrigem->grid->maxsubdivide);
        $layerDestino->grid->set("minarcs", $layerOrigem->grid->minarcs);
        $layerDestino->grid->set("maxarcs", $layerOrigem->grid->maxarcs);
        //$layerDestino->updatefromstring("LAYER GRID LABELFORMAT '" . $layerOrigem->grid->labelformat . "' END END");
    }
}