本文整理汇总了PHP中ms_newClassObj函数的典型用法代码示例。如果您正苦于以下问题:PHP ms_newClassObj函数的具体用法?PHP ms_newClassObj怎么用?PHP ms_newClassObj使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ms_newClassObj函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gml2wkt
function gml2wkt($gml)
{
// Parse GML file
include "funcoes_gerais.php";
$k = array_keys($_GET);
session_name("i3GeoPHP");
session_id($_GET[$k[0]]);
session_start();
//var_dump($_SESSION);exit;
$nome = $_SESSION["dir_tmp"] . "/gml_" . nomeRandomico();
$nomegml = $nome . ".gml";
$nomemap = $_SESSION["map_file"];
$gml = str_replace("xsi:schemaLocation", "erro", $gml);
gravaDados(array($gml), $nomegml);
$map = new mapObj($nomemap);
$layer = ms_newLayerObj($map);
$layer->setConnectionType(MS_OGR);
$layer->set("connection", $nomegml);
$layer->set("template", "none.html");
$layer->set("type", MS_LAYER_POLYGON);
$layer->set("name", $nome);
$layer->set("status", MS_DEFAULT);
$layer->setmetadata("tema", $nome);
$classe = ms_newClassObj($layer);
$novoestilo = ms_newStyleObj($classe);
$ncor = $novoestilo->color;
$ncor->setrgb(255, 255, 255);
//$map->save($nomemap);
//exit;
$layer->queryByrect($map->extent);
$sopen = $layer->open();
$shape = $layer->getShape($layer->getResult(0));
$wkt = $shape->towkt();
return json_encode(array($wkt));
}
示例2: draw_header
function draw_header($map, $img, $width, $height)
{
/*
* Draw the black bar at the top of the screen
*/
$layer = ms_newLayerObj($map);
$layer->set("status", MS_ON);
$layer->set("type", MS_LAYER_POLYGON);
$layer->set("transform", MS_OFF);
$wkt = "POLYGON((0 0, 0 {$height}, {$width} {$height}, {$width} 0, 0 0))";
$layer->addFeature(ms_shapeObjFromWkt($wkt));
$layerc0 = ms_newClassObj($layer);
$layerc0s0 = ms_newStyleObj($layerc0);
$layerc0s0->color->setRGB(0, 0, 0);
$layer->draw($img);
}
示例3: mktitle
function mktitle($map, $imgObj, $titlet, $subtitle = "", $width = 640)
{
$height = $subtitle == "" ? 36 : 53;
$layer = ms_newLayerObj($map);
$layer->set("status", MS_ON);
$layer->set("type", MS_LAYER_POLYGON);
$layer->set("transform", MS_OFF);
$wkt = "POLYGON((0 0, 0 {$height}, {$width} {$height}, {$width} 0, 0 0))";
$layer->addFeature(ms_shapeObjFromWkt($wkt));
$layerc0 = ms_newClassObj($layer);
$layerc0s0 = ms_newStyleObj($layerc0);
$layerc0s0->color->setRGB(0, 0, 0);
$layer->draw($imgObj);
$tlayer = $map->getLayerByName("iem_headerbar_title");
$point = ms_newpointobj();
$point->setXY(82, 22);
$point->draw($map, $tlayer, $imgObj, 0, $titlet);
if ($subtitle != "") {
$point = ms_newpointobj();
$point->setXY(82, 39);
$point->draw($map, $tlayer, $imgObj, 1, $subtitle);
}
}
示例4: criaToponimia
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");
//.........这里部分代码省略.........
示例5: autoClasses
function autoClasses(&$nlayer, $mapa, $locaplic = null)
{
$postgis_mapa = "";
$substituicon = "nao";
include dirname(__FILE__) . "/../ms_configura.php";
if ($nlayer->connectiontype == MS_POSTGIS) {
if ($nlayer->connection == " ") {
$nlayer->set("connection", $postgis_mapa);
$substituicon = "sim";
}
}
//
//gera classes automaticamente (temas vetoriais)
if ($nlayer->getmetadata("classesitem") != "") {
$itemnome = $nlayer->getmetadata("classesnome");
$itemid = $nlayer->getmetadata("classesitem");
$itemcor = $nlayer->getmetadata("classescor");
$itemsimbolo = $nlayer->getmetadata("classesimbolo");
$itemtamanho = $nlayer->getmetadata("classestamanho");
$classeoriginal = $nlayer->getclass(0);
//
//pega a extensao geografica que devera ser utilizada
//
$prjMapa = $mapa->getProjection();
$prjTema = $nlayer->getProjection();
$ret = $nlayer->getmetadata("extensao");
if ($ret == "") {
$ret = $nlayer->getextent();
//reprojeta o retangulo
if ($prjTema != "" && $prjMapa != $prjTema) {
$projInObj = ms_newprojectionobj($prjTema);
$projOutObj = ms_newprojectionobj($prjMapa);
$ret->project($projInObj, $projOutObj);
}
} else {
$temp = explode(" ", $ret);
$ret = ms_newRectObj();
$ret->setextent($temp[0], $temp[1], $temp[2], $temp[3]);
}
//
$sopen = $nlayer->open();
if ($sopen == MS_FAILURE) {
return "erro";
}
$status = $nlayer->whichShapes($ret);
$parametrosClasses = array();
if ($status == 0) {
while ($shape = $nlayer->nextShape()) {
$id = trim($shape->values[$itemid]);
if (!$parametrosClasses[$id]) {
$nome = "";
if ($itemnome != "") {
$nome = trim($shape->values[$itemnome]);
}
$cor = "";
if ($itemcor != "") {
$cor = explode(",", trim($shape->values[$itemcor]));
}
if (count($cor) != 3) {
$cor = explode(" ", trim($shape->values[$itemcor]));
}
$tamanho = "";
if ($itemtamanho != "") {
$tamanho = trim($shape->values[$itemtamanho]);
}
$simbolo = "";
if ($itemsimbolo != "") {
$simbolo = trim($shape->values[$itemsimbolo]);
}
$parametrosClasses[$id] = array("nome" => $nome, "cor" => $cor, "tamanho" => $tamanho, "simbolo" => $simbolo);
}
}
$fechou = $nlayer->close();
//echo "<pre>";var_dump($parametrosClasses);
if (count($parametrosClasses) > 0) {
$ids = array_keys($parametrosClasses);
for ($i = 0; $i < count($parametrosClasses); ++$i) {
$p = $parametrosClasses[$ids[$i]];
//echo "<pre>";var_dump($p);
$nclasse = ms_newClassObj($nlayer, $classeoriginal);
if ($p["nome"] != "") {
$nclasse->set("name", $p["nome"]);
}
$estilo = $nclasse->getstyle(0);
if ($p["cor"] != "") {
$cor = $p["cor"];
$ncor = $estilo->color;
if ($ncor == "") {
$ncor = $estilo->outlinecolor;
}
$ncor->setrgb($cor[0], $cor[1], $cor[2]);
}
if ($p["tamanho"] != "") {
$estilo->set("size", $p["tamanho"]);
}
if ($p["simbolo"] != "") {
$estilo->set("symbolname", $p["simbolo"]);
}
$strE = "('[" . $itemid . "]'eq'" . $ids[$i] . "')";
$nclasse->setexpression($strE);
//.........这里部分代码省略.........
示例6: labelObj
$datalc0->addLabel(new labelObj());
$datalc0->getLabel(0)->color->setrgb(255, 255, 0);
$datalc0->getLabel(0)->set("type", MS_TRUETYPE);
$datalc0->getLabel(0)->set("font", "liberation");
$datalc0->getLabel(0)->set("size", 12);
$datalc0->getLabel(0)->set("force", MS_TRUE);
$datalc0->getLabel(0)->set("partials", MS_TRUE);
//$datalc0->getLabel(0)->set("antialias", MS_TRUE);
$datalc0->getLabel(0)->set("position", MS_UR);
$datalc0->getLabel(0)->set("angle", 0);
$datalc0->getLabel(0)->set("wrap", 0x57);
$datalc0s0 = ms_newStyleObj($datalc0);
$datalc0s0->color->setrgb(0, 0, 0);
$datalc0s0->set("symbolname", "circle");
$datalc0s0->set("size", 3);
$datalc1 = ms_newClassObj($datal, $datalc0);
$datalc1->setExpression("([yrs] < 80)");
$datalc1s0 = $datalc1->getStyle(0);
$datalc1s0->color->setrgb(255, 0, 0);
$img = $map->prepareImage();
$tpos = array("all" => array(-95.40000000000001, 40.2), "ne" => array(-92.90000000000001, 43.7), "se" => array(-92.90000000000001, 40.3), "sw" => array(-96.40000000000001, 40.4), "nw" => array(-96.7, 43.65));
$ts = mktime(0, 0, 0, $month, $day, 2000);
$plotDate = strftime('%b %d', $ts);
$var = array("max_precip" => "Record Daily Precip [in]", "precip" => "Average Precipitation [in]", "low" => "Average Low Temp [F]", "max_low" => "Record Max Low Temp [F]", "max_high" => "Record Max High Temp [F]", "min_low" => "Record Min Low Temp [F]", "min_high" => "Record Min High Temp [F]", "high" => "Average High Temp [F]");
$dbdate = "2000-" . $month . "-" . $day;
if (strcmp($area, 'all') != 0) {
$dbarray = array("high" => "round(high::numeric, 0)::int", "low" => "round(low::numeric, 0)::int", "max_low" => "round(max_low::numeric, 0)::int ||'W'|| max_low_yr ", "max_high" => "round(max_high::numeric, 0)::int ||'W'|| max_high_yr ", "min_high" => "round(min_high::numeric, 0)::int ||'W'|| min_high_yr ", "min_low" => "round(min_low::numeric, 0)::int ||'W'|| min_low_yr ", "max_precip" => "to_char(max_precip, '99.99') ||'W'|| max_precip_yr ", "precip" => "round(precip::numeric, 2)");
} else {
$dbarray = array("high" => "round(high::numeric, 0)::int", "low" => "round(low::numeric, 0)::int", "max_low" => "round(max_low::numeric, 0)::int", "max_high" => "round(max_high::numeric, 0)::int", "min_high" => "round(min_high::numeric, 0)::int", "min_low" => "round(min_low::numeric, 0)::int", "max_precip" => "to_char(max_precip, '99.99') ", "precip" => "round(precip::numeric, 2)");
}
$sql = "SELECT station, years as yrs, " . $dbarray[$plot] . " as d \n from climate WHERE valid = '" . $dbdate . "'\n and substr(station,1,2) = 'IA'";
示例7: data2layer
function data2layer($oLayer, $dataLayer)
{
$oLayer->set("name", basename($this->arquivoGvp) . "_" . $oLayer->index);
//$this->nomeRandomico());
$this->nomesLayersAdicionados[] = $oLayer->name;
$oLayer->set("data", $dataLayer["data"]);
if ($dataLayer["connectiontype"] != "") {
$oLayer->setConnectionType($dataLayer["connectiontype"]);
}
if ($dataLayer["connection"] != "") {
$oLayer->set("connection", $dataLayer["connection"]);
}
if ($dataLayer["proj"] != "") {
$oLayer->setProjection($dataLayer["proj"]);
}
$oLayer->set("status", MS_DEFAULT);
if ($dataLayer["visible"] == "false") {
$oLayer->set("status", MS_OFF);
}
if (!empty($dataLayer["transparency"])) {
$opacidade = $dataLayer["transparency"] * 100 / 255;
$oLayer->set("opacity", $opacidade);
}
if ($dataLayer["minScale"] > 0) {
$oLayer->set("minscaledenom", $dataLayer["minScale"]);
}
if ($dataLayer["maxScale"] > 0) {
$oLayer->set("maxscaledenom", $dataLayer["maxScale"]);
}
$tipo = $dataLayer["legenda"]["classes"][0]["className"];
$oLayer->set("type", 1);
if ($tipo == "com.iver.cit.gvsig.fmap.core.symbols.SimpleMarkerSymbol") {
$oLayer->set("type", 0);
}
if ($tipo == "com.iver.cit.gvsig.fmap.core.symbols.SimpleFillSymbol") {
$oLayer->set("type", 2);
}
foreach ($dataLayer["legenda"]["classes"] as $data) {
//var_dump($data);
$classe = ms_newClassObj($oLayer);
$classe->set("name", $data["nome"]);
$estilo = ms_newStyleObj($classe);
if ($oLayer->type == 0) {
$estilo->set("symbolname", "ponto");
}
if (!empty($data["color"])) {
if ($data["hasFill"] == "true") {
$ncor = explode(",", $data["color"]);
$cor = $estilo->color;
$cor->setrgb($ncor[0], $ncor[1], $ncor[2]);
}
if ($data["hasOutline"] == "true" && $data["outline"] != "") {
$ncor = explode(",", $data["outline"]);
$cor = $estilo->outlinecolor;
$cor->setrgb($ncor[0], $ncor[1], $ncor[2]);
}
if ($data["hasFill"] == "" && $data["hasOutline"] == "") {
$ncor = explode(",", $data["color"]);
$cor = $estilo->color;
$cor->setrgb($ncor[0], $ncor[1], $ncor[2]);
}
}
if ($data["size"] != false) {
$estilo->set("size", $data["size"]);
}
if ($data["exp"] != false) {
$classe->setExpression($data["exp"]);
}
}
return $oLayer;
}
示例8: lcls_drawlayer
function lcls_drawlayer($drawlayer)
{
global $zMap, $zImage, $userlayers, $ext, $sizex, $sizey;
if ($userlayers["{$drawlayer}"]["layertype"] == 'point') {
$layertype = MS_LAYER_POINT;
$shapetype = MS_SHAPE_POINT;
} elseif ($userlayers["{$drawlayer}"]["layertype"] == 'line') {
$layertype = MS_LAYER_LINE;
$shapetype = MS_SHAPE_LINE;
}
$zUser = ms_newLayerObj($zMap);
$zUser->set("status", MS_ON);
$zUser->set("type", $layertype);
$zUser->set("classitem", "item");
$zUser->set("name", $userlayers["{$drawlayer}"]["layername"]);
#$zUser->set("group", $userlayers["$drawlayer"]["layergroup"]);
$zUclass = ms_newClassObj($zUser);
$zUclass->set("name", $userlayers["{$drawlayer}"]["layername"]);
if ($userlayers[$drawlayer][layercolor]) {
list($r, $v, $b) = split(' ', $userlayers[$drawlayer][layercolor]);
$zUclass->set("color", $zMap->addColor($r, $v, $b));
}
if ($userlayers["{$drawlayer}"]["layersymbol"]) {
$zUclass->set("symbolname", $userlayers["{$drawlayer}"]["layersymbol"]);
}
$zUclass->set("size", $userlayers["{$drawlayer}"]["layersize"]);
$zUclass->set("outlinecolor", "-1");
$listlines = listlines($drawlayer, $ext);
if (is_array($listlines)) {
foreach ($listlines as $o => $l) {
if (is_array($l[1])) {
$zUclass->set("status", MS_ON);
$zUshape = ms_newShapeObj($shapetype);
foreach ($l[1] as $drawpoint) {
$zUline = ms_newLineObj();
$zUline->addXY($drawpoint[E], $drawpoint[N], 0);
$imgx = geo2pix($drawpoint[E], $ext[0], $ext[2], $sizex);
$imgy = $sizey - geo2pix($drawpoint[N], $ext[1], $ext[3], $sizey);
$pointslist["{$imgx}/{$imgy}"] = array($o, $l[0]);
$zUshape->add($zUline);
}
}
if (is_object($zUshape)) {
$zUshape->draw($zMap, $zUser, $zImage, 1, "test");
}
}
}
return $pointslist;
}
示例9: ms_newClassObj
$cp->set("type", MS_SHAPE_POINT);
$cp->set("status", MS_ON);
$cp->set("labelcache", MS_ON);
$cl = ms_newClassObj($cp);
$lbl = new labelObj();
$cl->addLabel($lbl);
$cl->getLabel(0)->set("type", MS_TRUETYPE);
$cl->getLabel(0)->set("size", 10);
$cl->getLabel(0)->set("position", MS_CR);
$cl->getLabel(0)->set("font", "liberation-bold");
$cl->getLabel(0)->set("force", MS_ON);
$cl->getLabel(0)->set("offsetx", 6);
$cl->getLabel(0)->set("offsety", 0);
$cl->getLabel(0)->outlinecolor->setRGB(255, 255, 255);
$cl->getLabel(0)->color->setRGB(0, 0, 0);
$cl2 = ms_newClassObj($cp);
$lbl = new labelObj();
$cl2->addLabel($lbl);
$cl2->getLabel(0)->set("type", MS_TRUETYPE);
$cl2->getLabel(0)->set("size", "10");
$cl2->getLabel(0)->set("font", "esri34");
$cl2->getLabel(0)->set("position", MS_CC);
$cl2->getLabel(0)->set("force", MS_ON);
$cl2->getLabel(0)->set("partials", MS_ON);
$cl2->getLabel(0)->outlinecolor->setRGB(0, 0, 0);
$cl2->getLabel(0)->color->setRGB(255, 255, 255);
//$sl = ms_newStyleObj($cl);
//$sl->set("symbolname", "arrow");
//$sl->set("size", 8);
//$sl->color->setRGB(255, 255, 255);
//$sl = ms_newStyleObj($cl);
示例10: ms_newLineObj
$oLayerPoints3->set("transform", MS_FALSE);
$oCoordList3 = ms_newLineObj();
$oPointShape3 = ms_newShapeObj(MS_SHAPE_POINT);
$oCoordList3->addXY($nMapWidth - $heightMaxLogo - 5, $nMapHeight - 5);
$oPointShape3->add($oCoordList3);
$oPointShape3->set("text", $auteurNom);
$oLayerPoints3->addFeature($oPointShape3);
$oLabelObj3 = new labelObj();
$oLabelObj3->set("position", MS_CL);
$oLabelObj3->set("size", 7);
$oLabelObj3->set("type", MS_TRUETYPE);
$oLabelObj3->set("font", "arial");
$oLabelObj3->set("align", MS_ALIGN_LEFT);
$oLabelObj3->color->setRGB(0, 0, 0);
$oLabelObj3->outlinecolor->setRGB(255, 255, 255);
$oMapClass3 = ms_newClassObj($oLayerPoints3);
$oMapClass3->addLabel($oLabelObj3);
}
}
// If the vecteurs parameter is present, print the vecteurs!
if (isset($_POST['vecteurs']) && $_POST['vecteurs'] != null) {
// Create a random file name for temporary kml and map file.
$randomFileName = uniqid();
$vecteurFilePath = $GLOBALS['apps_config']['impression']['imagepath'] . $randomFileName . ".kml";
$vecteurMapFilePath = $GLOBALS['apps_config']['impression']['imagepath'] . $randomFileName . ".map";
$vecteurTemplateMapFilePath = $GLOBALS['apps_config']['impression']['map_template'];
$mapTemplateFileHandler = fopen($vecteurTemplateMapFilePath, 'r') or die("can't open file");
$mapTemplateFileContent = fread($mapTemplateFileHandler, filesize($vecteurTemplateMapFilePath));
$kml = $_POST['vecteurs'];
//Check SVG
if (preg_match_all('/<Icon><href>([^<]+\\.svg)<\\/href><\\/Icon>/', $kml, $matches)) {
示例11: ms_newClassObj
$wcc0 = ms_newClassObj($wc);
$wcc0s0 = ms_newStyleObj($wcc0);
$wcc0s0->color->setRGB(255, 255, 255);
$wcc0s0->set("width", 2);
$wcc0s0->set("symbol", 'circle');
$wc->draw($img);
$map->drawLabelCache($img);
$wc = ms_newLayerObj($map);
$wc->setConnectionType(MS_POSTGIS);
$wc->set("connection", $_DATABASES["postgis"]);
$wc->set("status", MS_ON);
$sql = sprintf("geom from (select oid, geom from sbw_{$year} WHERE oid = " . $row["oid"] . ") as foo using unique oid using SRID=4326");
$wc->set("data", $sql);
$wc->set("type", MS_LAYER_LINE);
$wc->setProjection("init=epsg:4326");
$wcc0 = ms_newClassObj($wc);
$wcc0->set("name", $row["area"] . " sq km [" . intval($row["area"] / $sz0 * 100) . "%]");
$wcc0s0 = ms_newStyleObj($wcc0);
$wcc0s0->color->setRGB(255, 0, 0);
$wcc0s0->set("width", 3);
$wcc0s0->set("symbol", 'circle');
$wc->draw($img);
$map->drawLabelCache($img);
$bar640t = $map->getLayerByName("bar640t");
$bar640t->set("status", 1);
$bar640t->draw($img);
$tlayer = $map->getLayerByName("bar640t-title");
$point = ms_newpointobj();
$point->setXY(2, 8);
$point->draw($map, $tlayer, $img, 0, $vtec_status[$row["status"]]);
$point = ms_newpointobj();
示例12: criarNovaClasse
function criarNovaClasse()
{
global $codigoMap, $codigoLayer, $locaplic;
$mapfile = $locaplic . "/temas/" . $codigoMap . ".map";
$mapa = ms_newMapObj($mapfile);
$nl = $mapa->getlayerbyname($codigoLayer);
$dados = array();
if (strtoupper($nl->getmetadata("metaestat")) === "SIM") {
return "erro";
}
$nclasses = $nl->numclasses;
$classe = ms_newClassObj($nl);
$mapa->save($mapfile);
removeCabecalho($mapfile);
$dados[] = array("indice" => $nclasses, "nome" => "");
return $dados;
}
示例13: createMSObj
/**
* Create class and style object
*/
private function createMSObj($type, $pObj)
{
switch ($type) {
case "class":
return ms_newClassObj($pObj);
case "style":
return ms_newStyleObj($pObj);
}
}
示例14: pmap_addResultLayer
//.........这里部分代码省略.........
$cList = preg_split('/@/', $cStr);
$xcoord = $cList[0];
$ycoord = $cList[1];
$resLine = ms_newLineObj();
// needed to use a line because only a line can be added to a shapeObj
$resLine->addXY($xcoord, $ycoord);
$resShape = ms_newShapeObj(1);
$resShape->add($resLine);
$newResLayer->addFeature($resShape);
}
//# specific for PG layers <==== required for MS >= 5.6 !!!
} elseif ($qLayer->connectiontype == 6) {
$newResLayer->set("connection", $qLayer->connection);
if (method_exists($newResLayer, "setConnectionType")) {
$newResLayer->setConnectionType($qLayer->connectiontype);
} else {
$newResLayer->set("connectiontype", $qLayer->connectiontype);
}
$data = $qLayer->data;
// use layers with complex queries that are too long to select results
// cause maxscaledenom is not used...
if ($qLayer->getMetaData("PM_RESULT_DATASUBSTITION") != "") {
$data = $qLayer->getMetaData("PM_RESULT_DATASUBSTITION");
}
$newResLayer->set("data", $data);
if ($qLayerProjStr) {
$newResLayer->setProjection($qLayerProjStr);
}
$glList = PMCommon::returnGroupGlayer($reslayer);
$glayer = $glList[1];
$layerDbProperties = $glayer->getLayerDbProperties();
$uniqueField = $layerDbProperties['unique_field'];
$indexesStr = implode(",", $shpindexes);
$idFilter = "({$uniqueField} IN ({$indexesStr}))";
$newResLayer->setFilter($idFilter);
//# 'normal' layers
} else {
// Add selected shape to new layer
// Modified by Thomas RAFFIN (SIRAP)
// use layers with complex queries that are too long to select results
// cause maxscaledenom is not used...
$olddata = false;
if ($qLayer->getMetaData("PM_RESULT_DATASUBSTITION") != "") {
$olddata = $qLayer->data;
$qLayer->set("data", $qLayer->getMetaData("PM_RESULT_DATASUBSTITION"));
}
$qLayer->open();
foreach ($shpindexes as $resShpIdx) {
if (preg_match("/@/", $resShpIdx)) {
$idxList = explode("@", $resShpIdx);
$resTileShpIdx = $idxList[0];
$resShpIdx = $idxList[1];
} else {
$resTileShpIdx = $resulttilelayer[$resShpIdx];
}
$resShape = PMCommon::resultGetShape($this->msVersion, $qLayer, null, $resShpIdx, $resTileShpIdx);
// changed for compatibility with PG layers and MS >= 5.6
// Change projection to map projection if necessary
if ($changeLayProj) {
// If error appears here for Postgis layers, then DATA is not defined properly as:
// "the_geom from (select the_geom, oid, xyz from layer) AS new USING UNIQUE oid USING SRID=4258"
if ($resShape) {
$resShape->project($qLayerProjObj, $mapProjObj);
}
}
if ($resShape) {
$newResLayer->addFeature($resShape);
}
}
$qLayer->close();
// Modified by Thomas RAFFIN (SIRAP)
// use layers with complex queries that are too long to select results
// cause maxscaledenom is not used...
// reset data tag
if ($olddata) {
$qLayer->set("data", $olddata);
}
}
$newResLayer->set("status", MS_ON);
$newResLayerIdx = $newResLayer->index;
if ($hlDynLayer) {
// SELECTION COLOR
$iniClrStr = trim($_SESSION["highlightColor"]);
$iniClrList = preg_split('/[\\s,]+/', $iniClrStr);
$iniClr0 = $iniClrList[0];
$iniClr1 = $iniClrList[1];
$iniClr2 = $iniClrList[2];
// CREATE NEW CLASS
$resClass = ms_newClassObj($newResLayer);
$clStyle = ms_newStyleObj($resClass);
$clStyle->color->setRGB($iniClr0, $iniClr1, $iniClr2);
$clStyle->set("symbolname", "circle");
$symSize = $qlayType < 1 ? 10 : 5;
$clStyle->set("size", $symSize);
}
// Move layer to top (is it working???)
while ($newResLayerIdx < $layNum - 1) {
$this->map->moveLayerUp($newResLayerIdx);
}
}
示例15: generate
//.........这里部分代码省略.........
$json_provinsi["results"][] = array("batas_bawah" => $myrow[$nama_kolom], "R" => 255 - ($i + 1) * 70, "G" => 141 - ($i + 1) * 20, "B" => 100 - ($i + 1) * 25);
$i++;
}
$sama = 0;
$query = "SELECT {$namaprovkabkec},{$idp}.{$layer}, {$nama_kolom} FROM " . $idp . " INNER JOIN {$layerdatabase} ON {$idp}.{$layer}::varchar={$layerdatabase}.{$layer}::varchar {$wherepulau} GROUP BY {$nama_kolom} ,{$namaprovkabkec},{$idp}.{$layer} ORDER BY {$idp}.{$layer}";
$command = $connection->createCommand($query);
$dataReader = $command->query();
$rows = $dataReader->readAll();
$json_provinsi["jumlah2"] = $dataReader->rowCount;
$i = 0;
$w = array();
foreach ($rows as $myrow) {
//$datam[$i][$layer] =$myrow[$layer];
$w[$i] = $myrow[$nama_kolom];
$json_provinsi["results2"][] = array("nama" => $myrow[$namaprovkabkec], "jumlah" => $myrow[$nama_kolom]);
for ($x = 0; $x < $num_rows; $x++) {
if ($w[$i] == $json_provinsi["results"][$x]["batas_bawah"]) {
$datam[$i][$layer] = $myrow[$layer];
$datam[$i]['R'] = $json_provinsi["results"][$x]["R"];
$datam[$i]['G'] = $json_provinsi["results"][$x]["G"];
$datam[$i]['B'] = $json_provinsi["results"][$x]["B"];
}
}
$i++;
}
echo json_encode($json_provinsi, JSON_PRETTY_PRINT);
//$datam[$i]['R']=$json_provinsi["results"][$x]["R"];
// $datam[$i]['G']=$json_provinsi["results"][$x]["G"];
//$datam[$i]['B']=$json_provinsi["results"][$x]["B"];
}
$objMap = ms_NewMapObj("");
$objMap->Set("name", "Kab");
$objMap->setSize(384, 204);
$objMap->setExtent(92.59, -19.443566666, 142.88, 14.1298);
$objMap->Set("units", MS_DD);
// derajat
$objMap->imagecolor->SetRGB(210, 233, 255);
//$objMap->SetSymbolSet ("C:\ms4w\apps\latihan\simbol\simbol.sym");
$objMap->SetFontSet("C:/ms4w/apps/latihan/mapsederhana/font/font.dat");
//$objMap->outputformat->set("transparent",1);
// $objMap->outputformat->set("imagemode", MS_GD_ALPHA);
$objMap->setProjection("init=epsg:4326");
$projInObj = ms_newprojectionobj("init=epsg:4326");
// objek web di mapfile
$objMap->web->set("imagepath", "C:/ms4w/Apache/htdocs/temp/");
$objMap->web->set("imageurl", "/temp/");
$objMap->web->set("template", "C:/ms4w/apps/latihan/html/tmplb.html");
$objMap->setMetaData("ows_title", "Peta wilayah Indonesia");
$objMap->setMetaData("ows_onlineresource", "http://localhost/wms?");
$objMap->setMetaData("wms_srs", "EPSG:4326 EPSG:3857");
$objMap->setMetaData("wms_abstract", "WMS");
$objMap->setMetaData("wms_enable_request", "*");
$objMap->setMetaData("wms_encoding", "utf-8");
$objMap->setMetaData("wfs_getfeature_formatlist", "json");
//
// objek layer
$objLayerJbr = ms_newLayerObj($objMap);
$objLayerJbr->set("name", "provinsi");
$objLayerJbr->setConnectionType(MS_POSTGIS);
$dbpgsql = Yii::$app->message->dbpgsql();
$objLayerJbr->set('connection', $dbpgsql);
$objLayerJbr->set('data', "geom from (select geom ,gid," . $layer . "," . $namaprovkabkec . " from " . $layerdatabase . " ) as subquery using unique gid using srid=43266");
$objLayerJbr->set("classitem", $layer);
$objLayerJbr->set("type", MS_LAYER_POLYGON);
$objLayerJbr->set("status", MS_ON);
$objLayerJbr->set("opacity", 85);
// $objLayerJbr->set ("labelitem",$namaprovkabkec); // label layer
//$objLayerJbr->set("labelcache",MS_ON);// field kelas
//$objLayerJbr->setprocessing("LABEL_NO_CLIP=on");
//
// objek class & style jabar
for ($x = 0; $x < $i; $x++) {
$objClassJbr[] = ms_newClassObj($objLayerJbr);
// echo "<br/>".$datam[$x][$layer]." >>".$datam[$x]['R']." ".$datam[$x]['G']." ".$datam[$x]['B'];
$objClassJbr[$x]->SetExpression($datam[$x][$layer]);
$objClassJbr[$x]->Set("name", "batas_prov");
// kodeprop=1
$objStyleJbr[] = ms_newStyleObj($objClassJbr[$x]);
//echo $datam[$x]['R']." ".$datam[$x]['G']." ".$datam[$x]['B']."<br/>";
$objStyleJbr[$x]->color->setRGB($datam[$x]['R'], $datam[$x]['G'], $datam[$x]['B']);
//echo "warna : ".$datam[$x][$layer]." ".$datam[$x]['R']." ".$datam[$x]['G']." ".$datam[$x]['B']."<br/>";
$objStyleJbr[$x]->outlinecolor->SetRGB(0, 0, 0);
$objClassJbr[$x]->label->Set("font", "arialbold");
$objClassJbr[$x]->label->Set("type", MS_TRUETYPE);
$objClassJbr[$x]->label->Set("encoding", "utf-8");
$objClassJbr[$x]->label->Set("size", 8);
$objClassJbr[$x]->label->Set("buffer", 7);
$objClassJbr[$x]->label->Set("partials", TRUE);
$objClassJbr[$x]->label->Set("align", center);
$objClassJbr[$x]->label->Set("position", MS_CC);
$objClassJbr[$x]->label->color->SetRGB(3, 3, 3);
$objClassJbr[$x]->label->outlinecolor->SetRGB(242, 236, 230);
//
}
$objLayerJbr->setProjection("init=epsg:4326");
//
$clonefullpath = Yii::$app->message->clonefullpath();
$objMap->save($clonefullpath);
//
}