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"; }
function criaToponimia($item, $position, $partials, $offsetx, $offsety, $minfeaturesize, $mindistance, $force, $shadowcolor, $shadowsizex, $shadowsizey, $outlinecolor, $cor, $sombray, $sombrax, $sombra, $fundo, $angulo, $tamanho, $fonte, $tipo, $wrap, $novotema = "sim") { error_reporting(0); if (!$this->layer) { return "erro"; } $this->removeToponimia(); if (!isset($tipo)) { $tipo = ""; } if ($item != "") { if ($novotema == "sim") { $nome = pegaNome($this->layer); $novolayer = ms_newLayerObj($this->mapa, $this->layer); $nomer = nomeRandomico(); $novolayer->set("name", $nomer); $novolayer->set("group", ""); $novolayer->set("type", $this->layer->type); $nclasses = $novolayer->numclasses; for ($i = 0; $i < $nclasses; ++$i) { $c = $novolayer->getclass($i); $c->set("status", MS_DELETE); } $novac = ms_newClassObj($novolayer); $novolayer->set("status", MS_DEFAULT); $novolayer->setmetadata("tema", "texto de " . $nome); $novolayer->setmetadata("tip", ""); $novolayer->setmetadata("tiles", "nao"); $novolayer->setmetadata("identifica", "nao"); $novolayer->set("labelitem", $item); } else { $nomer = $this->layer->name; $novolayer = $this->mapa->getlayerbyname($nomer); } $novolayer->setmetadata("cache", ""); $this->layer = $novolayer; } else { //$novac = $this->layer->getclass(0); $nomer = $this->layer->name; } if (!($this->vi >= 60200)) { $this->layer->set("labelitem", $item); } $nclasses = $this->layer->numclasses; for ($i = 0; $i < $nclasses; ++$i) { $novac = $this->layer->getclass($i); if ($this->vi >= 60200) { //$indiceLabel = $novac->addLabel(new labelObj()); $s = "CLASS LABEL TEXT '[" . $item . "]' END END"; $novac->updateFromString($s); $label = $novac->getLabel($indiceLabel); } else { $label = $novac->label; } if ($wrap != "") { $label->set("maxlength", 1); $s = $novac->getTextString; $s = "CLASS LABEL WRAP '{$wrap}' END END"; $novac->updateFromString($s); } if ($this->vi >= 60200) { $label = $novac->getLabel($indiceLabel); } else { $label = $novac->label; } if ($fonte != "bitmap") { //$label->set("type",MS_TRUETYPE); $label->updatefromstring("LABEL TYPE TRUETYPE END"); $label->set("font", $fonte); $label->set("size", $tamanho); } else { //$label->set("type",MS_BITMAP); $label->updatefromstring("LABEL TYPE BITMAP END"); //$label->set("font",$fonte); $t = MS_TINY; if ($tamanho > 5) { $t = MS_TINY; } if ($tamanho >= 7) { $t = MS_SMALL; } if ($tamanho >= 10) { $t = MS_MEDIUM; } if ($tamanho >= 12) { $t = MS_LARGE; } if ($tamanho >= 14) { $t = MS_GIANT; } $label->set("size", $t); } if ($angulo > 0) { $label->set("angle", $angulo); } if ($angulo == "AUTO") { $label->updatefromstring("LABEL ANGLE AUTO END"); } if (strtoupper($angulo) == "CURVO" || strtoupper($angulo) == "FOLLOW") { $label->updatefromstring("LABEL ANGLE FOLLOW END"); } corE($label, $cor, "color"); corE($label, $fundo, "backgroundcolor"); corE($label, $sombra, "backgroundshadowcolor", $sombrax, $sombray); //$label->set("backgroundshadowsizex",$sombrax); //$label->set("backgroundshadowsizey",$sombray); corE($label, $outlinecolor, "outlinecolor"); corE($label, $shadowcolor, "shadowcolor"); $label->set("shadowsizex", $shadowsizex); $label->set("shadowsizey", $shadowsizey); $label->set("force", $force); $label->set("mindistance", $mindistance); $label->set("minfeaturesize", $minfeaturesize); $label->set("offsetx", $offsetx); $label->set("offsety", $offsety); $label->set("partials", $partials); $p = array("MS_AUTO" => MS_AUTO, "MS_UL" => MS_UL, "MS_LR" => MS_LR, "MS_UR" => MS_UR, "MS_LL" => MS_LL, "MS_CR" => MS_CR, "MS_CL" => MS_CL, "MS_UC" => MS_UC, "MS_LC" => MS_LC, "MS_CC" => MS_CC); $label->set("position", $p[$position]); } if ($tipo == "teste") { $i = gravaImagemMapa($this->mapa); return $i["url"]; } else { return $nomer; } }
function adicionaLabel($novac, $wrap, $fonte, $tamanho, $angulo, $fundo, $sombra, $cor, $outlinecolor, $shadowcolor, $shadowsizex, $shadowsizey, $force, $mindistance, $minfeaturesize, $offsetx, $offsety, $partials, $position, $texto = "") { if ($this->vi >= 60300) { while ($novac->numlabels > 0) { $novac->removeLabel(0); } } if ($texto == "") { if ($this->vi >= 60300) { $indiceLabel = $novac->addLabel(new labelObj()); $label = $novac->getLabel($indiceLabel); } else { $label = $novac->label; } } elseif ($this->vi >= 60300 && $novac->numlabels == 0) { if ($wrap != "") { $s = "CLASS LABEL WRAP '{$wrap}' TEXT '" . $texto . "' END END"; $novac->updateFromString($s); } else { $s = "CLASS LABEL TEXT '" . $texto . "' END END"; $novac->updateFromString($s); } } if ($this->vi >= 60300) { $label = $novac->getLabel(0); } else { $label = $novac->label; } if ($wrap != "") { $label->set("maxlength", 1); } if ($fonte != "bitmap") { //para funcionar na versao 7 do mapserver $label->updateFromString("LABEL type truetype END"); $label->set("font", $fonte); $label->set("size", $tamanho); } else { //para funcionar na versao 7 do mapserver $label->updateFromString("LABEL type bitmap END"); $t = MS_TINY; if ($tamanho > 5) { $t = MS_TINY; } if ($tamanho >= 7) { $t = MS_SMALL; } if ($tamanho >= 10) { $t = MS_MEDIUM; } if ($tamanho >= 12) { $t = MS_LARGE; } if ($tamanho >= 14) { $t = MS_GIANT; } $label->set("size", $t); } $label->set("angle", $angulo); corE($label, $fundo, "backgroundcolor"); corE($label, $sombra, "backgroundshadowcolor", $sombrax, $sombray); corE($label, $cor, "color"); corE($label, $outlinecolor, "outlinecolor"); corE($label, $shadowcolor, "shadowcolor"); $label->set("shadowsizex", $shadowsizex); $label->set("shadowsizey", $shadowsizey); $label->set("force", $force); $label->set("mindistance", $mindistance); $label->set("minfeaturesize", $minfeaturesize); $label->set("offsetx", $offsetx); $label->set("offsety", $offsety); $label->set("partials", $partials); $p = array("MS_AUTO" => MS_AUTO, "MS_UL" => MS_UL, "MS_LR" => MS_LR, "MS_UR" => MS_UR, "MS_LL" => MS_LL, "MS_CR" => MS_CR, "MS_CL" => MS_CL, "MS_UC" => MS_UC, "MS_LC" => MS_LC, "MS_CC" => MS_CC); $label->set("position", $p[$position]); if ($this->layer) { $this->layer->setMetaData("cache", ""); } }
function alterarEstilo() { global $codigoMap, $codigoLayer, $locaplic; $dados = array(); $mapfile = $locaplic . "/temas/" . $codigoMap . ".map"; $mapa = ms_newMapObj($mapfile); $layer = $mapa->getlayerbyname($codigoLayer); if (strtoupper($layer->getmetadata("metaestat")) === "SIM") { return "erro. Layer METAESTAT"; } $nclasses = $layer->numclasses; $classe = $layer->getclass($_GET["indiceClasse"]); $estilo = $classe->getstyle($_GET["indiceEstilo"]); if (!empty($_GET["symbolname"])) { $estilo->set("symbolname", $_GET["symbolname"]); } if (empty($_GET["symbolname"])) { $estilo->set("symbolname", " "); } corE($estilo, $color, "color"); $estilo->set("size", $_GET["size"]); $estilo->set("minsize", $_GET["minsize"]); $estilo->set("maxsize", $_GET["maxsize"]); $estilo->set("offsetx", $_GET["offsetx"]); $estilo->set("offsety", $_GET["offsety"]); $estilo->set("antialias", $_GET["antialias"]); corE($estilo, $_GET["backgroundcolor"], "backgroundcolor"); corE($estilo, $_GET["outlinecolor"], "outlinecolor"); $estilo->set("width", $_GET["width"]); $estilo->set("minwidth", $_GET["minwidth"]); $estilo->set("maxwidth", $_GET["maxwidth"]); $estilo->set("angle", $_GET["angle"]); //$estilo->set("opacity",$opacity); $mapa->save($mapfile); removeCabecalho($mapfile); return "ok"; }