function insereFeature($marca, $tipo, $xy, $texto, $position, $partials, $offsetx, $offsety, $minfeaturesize, $mindistance, $force, $shadowcolor, $shadowsizex, $shadowsizey, $outlinecolor, $cor, $sombray, $sombrax, $sombra, $fundo, $angulo, $tamanho, $fonte, $wrap, $wkt = false, $nomeTema = "") { //verifica se ja existe um layer criado anteriormente com o mesmo nome e apaga se existir if ($tipo == "limpaponto") { if ($this->layer) { $this->layer->set("status", MS_DELETE); $this->layer->set("name", "pindelete"); $tipo = "POINT"; } } if (!$this->layer) { $pinlayer = criaLayer($this->mapa, MS_LAYER_LINE, MS_DEFAULT, "Ins", $metaClasse = "SIM"); $c = $pinlayer->getclass(0); $c->set("name", ""); $e = $c->getstyle(0); $e->set("size", 1); $e->set("symbol", "ponto"); $core = $e->color; $core->setrgb(255, 0, 0); if (!isset($cor)) { $cor = "255 0 0"; } switch ($tipo) { case "GRAFICOPIZZA": if (!isset($tamanho)) { $tamanho = 5; } $e->set("size", $tamanho); $pinlayer->setmetadata("tema", "Pontos inseridos"); $pinlayer->set("type", MS_LAYER_POINT); break; case "POINT": if (!isset($marca) || $marca == "") { $marca = "marca"; } if (!isset($tamanho)) { $tamanho = 5; } $e->set("size", $tamanho); $e->set("symbolname", $marca); corE($e, $cor, "color"); $pinlayer->setmetadata("tema", "Pontos inseridos"); $pinlayer->set("type", MS_LAYER_POINT); break; case "LINE": if (!isset($marca) || $marca == "") { $marca = "linha"; } if (!isset($tamanho)) { $tamanho = 2; } $e->set("size", $tamanho); $e->set("symbol", $marca); if (isset($cor) && $cor != "") { corE($e, $cor, "color"); } if (isset($texto) && $texto != "") { $pinlayer->setmetadata("TEMA", $texto); } else { $pinlayer->setmetadata("tema", "Linhas inseridas"); } $pinlayer->set("type", MS_LAYER_LINE); break; case "POLYGON": if (!isset($marca)) { $marca = "p9"; } if (!isset($tamanho)) { $tamanho = 5; } $e->set("size", $tamanho); $e->set("symbol", $marca); $pinlayer->setmetadata("tema", "Poligonos inseridos"); $pinlayer->set("type", MS_LAYER_POLYGON); $pinlayer->set("opacity", "50"); break; case "ANNOTATION": //$c->set("status",MS_DELETE); $pinlayer->setmetadata("TEMA", $texto); $pinlayer->setmetadata("tiles", "nao"); $pinlayer->set("type", MS_LAYER_POINT); $pinlayer->set("opacity", "100"); break; } } switch ($tipo) { case "ANNOTATION": $shp = ms_newshapeobj(MS_SHAPE_POINT); break; case "POINT": $shp = ms_newshapeobj(MS_SHAPE_POINT); break; case "LINE": $shp = ms_newshapeobj(MS_SHAPE_LINE); break; case "POLYGON": $shp = ms_newshapeobj(MS_SHAPE_POLYGON); break; } if ($wkt == false) { $apt = explode(" ", $xy); $lin = ms_newlineobj(); for ($i = 0; $i < count($apt); $i = $i + 2) { $lin->addxy($apt[$i], $apt[$i + 1]); } $shp->add($lin); } else { $shp = ms_shapeObjFromWkt($xy); } if ($texto != "") { $texto = str_replace("*", "&", $texto); $texto = str_replace("|", ";", $texto); $shp->set("text", $texto); //caso nao seja do tipo annotation if ($pinlayer->numclasses == 1) { $novac = $pinlayer->getclass(0); } else { $novac = ms_newclassobj($pinlayer); } $this->adicionaLabel($novac, $wrap, $fonte, $tamanho, $angulo, $fundo, $sombra, $cor, $outlinecolor, $shadowcolor, $shadowsizex, $shadowsizey, $force, $mindistance, $minfeaturesize, $offsetx, $offsety, $partials, $position, ""); } $pinlayer->addfeature($shp); if ($nomeTema != "") { $pinlayer->setmetadata("tema", $nomeTema); } //verifica a projecao $c = $shp->getCentroid(); $c = $c->x; if ($c > -181 && $c < 181) { $pinlayer->setprojection(pegaProjecaoDefault("proj4")); } else { $pinlayer->setprojection($this->mapa->getProjection()); } return "ok"; }
$cwa = $map->getlayerbyname("cwas"); $cwa->set("status", 1); $st_cl = ms_newclassobj($stlayer); $st_cl->set("status", MS_ON); $img = $map->prepareImage(); $namer->draw($img); $lakes->draw($img); $goes_east1V->draw($img); $goes_west1V->draw($img); $goes_east04I4->draw($img); $goes_west04I4->draw($img); $ly = ms_newlayerobj($map); $ly->set("status", MS_ON); $ly->set("type", MS_LAYER_POINT); $ly->setProjection("init=epsg:4326"); $cl = ms_newclassobj($ly); $cl->set("status", MS_ON); $cl->set("name", "ccc"); //$cl->set("symbol", 1); //$cl->set("size", 10); //$cl->set("color", $green); //$cl->set("backgroundcolor", $green); $cl->addLabel(new labelObj()); $lbl = $cl->getLabel(0); $lbl->set("type", MS_TRUETYPE); $lbl->set("font", "liberation"); $lbl->set("size", 18); //$lbl->set("color", $black); $lbl->set("position", MS_AUTO); $lbl->set("force", MS_ON); $ly2 = $map->getLayerByName("pointonly");
} $counties = $map->getlayerbyname("uscounties"); $counties->set("status", MS_ON); $namer = $map->getLayerByName("namerica"); $namer->set("status", MS_ON); $stlayer = $map->getlayerbyname("states"); $stlayer->set("status", 1); $dot = $map->getlayerbyname("pointonly"); $dot->set("status", MS_ON); $dot->setProjection("init=epsg:4326"); $site = $map->getlayerbyname("site"); $site->set("status", MS_ON); $radar = $map->getlayerbyname(substr($rad, 0, 3)); $radar->set("status", MS_ON); //$radar->setProjection($projs[substr($rad,0,3)]); $st_cl = ms_newclassobj($stlayer); //$st_cl->set("outlinecolor", $green); $st_cl->set("status", MS_ON); $img = $map->prepareImage(); $namer->draw($img); $counties->draw($img); $stlayer->draw($img); $radar->draw($img); $precip = array(); $now = time(); foreach ($stbl as $key => $value) { if (!array_key_exists($key, $data)) { continue; } $pt = ms_newPointObj(); $pt->setXY($stbl[$key]["lon"], $stbl[$key]["lat"], 0);