From 736d8d6b4359b5b916288fe8a53ee4d2995b8fae Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Tue, 20 Nov 2012 19:31:29 +0000 Subject: [PATCH] Inclusão de temas baseados no sistema METAESTAT na árvore do catálogo --- admin/admin.db | Bin 155648 -> 0 bytes admin/js/core.js | 30 +++++++++++++++++++++--------- admin/js/editormapfile.js | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------- admin/js/estat_variavel.js | 6 +++--- admin/php/classe_metaestat.php | 4 ++-- classesjs/classe_arvoredetemas.js | 67 +++++++++++++++++++++++++++++++++++++++++++------------------------ classesjs/classe_php.js | 10 ++++++++++ classesphp/classe_temas.php | 20 +++++++++++++++++++- classesphp/mapa_controle.php | 18 ++++++++++++++++++ ferramentas/metaestat/dicionario.js | 7 +++++++ ferramentas/metaestat/index.js | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------- temas/testemetaestat.map | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 337 insertions(+), 95 deletions(-) create mode 100644 temas/testemetaestat.map diff --git a/admin/admin.db b/admin/admin.db index bf7dda2..dab6ac4 100644 Binary files a/admin/admin.db and b/admin/admin.db differ diff --git a/admin/js/core.js b/admin/js/core.js index a721107..a7f2e2f 100644 --- a/admin/js/core.js +++ b/admin/js/core.js @@ -909,11 +909,16 @@ selecionados - array com os valores marcados target - objeto para receber o resultado -record - objeto record +record - objeto record (utilize "" para escapar) -key - chave (nome do item) +key - chave (nome do item) (utilize "" para escapar) + +unico - sim|nao indicando se apenas um pode ser escolhido */ -function core_menuCheckBox(valores,textos,selecionados,target,record,key){ +function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico){ + if(!unico){ + unico = "nao"; + } function on_menuCheckBoxChange(p_oEvent){ var cks,i, ins = []; @@ -925,7 +930,7 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key){ ins.push(cks[i].value); } } - if(record){ + if(record && record != ""){ target.innerHTML = "

"+ins.toString()+"

"; record.setData(key,ins.toString()); } @@ -942,18 +947,20 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key){ novoel.id = "core_menuCK"; ndiv = document.createElement("div"); ndiv.className= "yui-dt-editor"; + ndiv.style.backgroundColor = "white"; ndiv.style.height = "144px"; ndiv.style.overflow = "auto"; - ndiv.innerHTML = "
"; + ndiv.innerHTML = "

" + + "
"; novoel.appendChild(ndiv); document.body.appendChild(novoel); - og_core = new YAHOO.widget.ButtonGroup({id:"okcancel_checkbox_id", name:"okcancel_checkbox_id", container:"core_menuCK_bd" }); + og_core = new YAHOO.widget.ButtonGroup({id:"okcancel_checkbox_id", name:"okcancel_checkbox_id", container:"core_botoesCabecalho" }); og_core.addButtons([ { label: "OK", value: "OK", checked: false}, - { label: "Cancel", value: "CANCEL", checked: false } + { label: "Fecha", value: "CANCEL", checked: false } ]); og_core.on("checkedButtonChange", on_menuCheckBoxChange); - YAHOO.admin.container.panelCK = new YAHOO.widget.Overlay("core_menuCK", { zindex:"100",close:false,underlay:false,width:"300px", height:"200px",overflow:"auto", visible:false,constraintoviewport:false } ); + YAHOO.admin.container.panelCK = new YAHOO.widget.Panel("core_menuCK", { draggable:false,modal:true,zindex:"100",close:false,underlay:false,width:"168px", height:"158px",overflow:"auto", visible:false,constraintoviewport:false } ); YAHOO.admin.container.panelCK.render(); } onde = $i("core_menuCK_bd"); @@ -966,7 +973,12 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key){ if(selecionados[j] == valores[i]) ck = "CHECKED"; } - ins.push(""+textos[i]+"
"); + if(unico === "nao"){ + ins.push(""+textos[i]+"
"); + } + else{ + ins.push(""+textos[i]+"
"); + } } ins.push("
"); novoCK.innerHTML = ins.join(" "); diff --git a/admin/js/editormapfile.js b/admin/js/editormapfile.js index c66604c..141340c 100644 --- a/admin/js/editormapfile.js +++ b/admin/js/editormapfile.js @@ -1446,41 +1446,42 @@ function montaEditorDispo(dados) function montaEditorDados(dados) { - var idsForms = ["connection","data","tileitem","tileindex","type","tipooriginal","metaestat_id_medida_variavel"]; - var idsMetaestat = ["connection","data","tileitem","tileindex","tipooriginal"]; - var param = { - "linhas":[ - {ajuda:"Indica se as definições da camada estão relacionadas ao sistema de metadados estatísticos. Se estiver, alguns parâmetros são obtidos de forma automática, como a conexão e o SQL de acesso aos dados.", - titulo:"Esse mapfile está integrado ao sistema de metadados estatísticos?",id:"",value:dados.metaestat,tipo:"text",div:"
"}, - //TODO colocar icone para escolher o id - {ajuda:"ID da medida da variável que relaciona a camada ao sistema de metadados estatísticos. Só deve ser definido se o mapfile for integrado a esse sistema.", - titulo:"ID da variável no sistema de metadados estatísticos",id:"metaestat_id_medida_variavel",value:dados.metaestat_id_medida_variavel,tipo:"text",div:""}, - {ajuda:"Type of connection. Default is local.", - titulo:"Connectiontype",id:"",value:"",div:"
",tipo:"text"}, - {ajuda:"Aplica a conversão de caracteres nas ferramentas que obtém os dados descritivos referentes aos elementos do LAYER. Em alguns casos, a conversão pode provocar problemas de acentuação. Se isso ocorrer, na ferramenta tabela por exemplo, experimente marcar essa opção como 'nao'", - titulo:"Conversão de caracteres (METADATA: CONVCARACTER)",id:"",value:dados.convcaracter,tipo:"text",div:"
"}, - {ajuda:"Database connection string to retrieve remote data.An SDE connection string consists of a hostname, instance name, database name, username and password separated by commas.A PostGIS connection string is basically a regular PostgreSQL connection string, it takes the form of 'user=nobody password=****** dbname=dbname host=localhost port=5432' An Oracle connection string: user/pass[@db] . Se vc tiver problemas com acentuação, experimente algo como: user=postgres password=postgres dbname=pgutf8 host=localhost port=5432 options='-c client_encoding=LATIN1'", - titulo:"Connection",id:"connection",value:dados.connection,tipo:"text"}, - {ajuda:"Full filename of the spatial data to process. No file extension is necessary for shapefiles. Can be specified relative to the SHAPEPATH option from the Map Object.If this is an SDE layer, the parameter should include the name of the layer as well as the geometry column, i.e. 'mylayer,shape,myversion'.If this is a PostGIS layer, the parameter should be in the form of ' from ', where 'columnname' is the name of the column containing the geometry objects and 'tablename' is the name of the table from which the geometry data will be read.For Oracle, use 'shape FROM table' or 'shape FROM (SELECT statement)' or even more complex Oracle compliant queries! Note that there are important performance impacts when using spatial subqueries however. Try using MapServer's FILTER whenever possible instead. You can also see the SQL submitted by forcing an error, for instance by submitting a DATA parameter you know won't work, using for example a bad column name. Exemplo postgis: the_geom FROM (select * FROM biomas) as foo USING UNIQUE gid USING SRID=4291 . Exemplo shapefile: c://ms4w/Apache/htdocs/geodados/brasil/limitespol/localidades.shp", - titulo:"Data",id:"data",value:dados.data,tipo:"text"}, - {ajuda:"Specifies how the data should be drawn. Need not be the same as the shapefile type. For example, a polygon shapefile may be drawn as a point layer, but a point shapefile may not be drawn as a polygon layer. Common sense rules. Annotation means that a label point will be calculated for the features, but the feature itself will not be drawn although a marker symbol can be optionally drawn. this allows for advanced labeling like numbered highway shields. Points are labeled at that point. Polygons are labeled first using a centroid, and if that doesn't fall in the polygon a scanline approach is used to guarantee the label falls within the feature. Lines are labeled at the middle of the longest arc in the visible portion of the line. Query only means the layer can be queried but not drawn.In order to differentiate between POLYGONs and POLYLINEs (which do not exist as a type), simply respectively use or ommit the COLOR keyword when classifying. If you use it, it's a polygon with a fill color, otherwise it's a polyline with only an OUTLINECOLOR.For CHART layers, see the Dynamic Charting howto.A circle must be defined by a a minimum bounding rectangle. That is, 2 points that define the smallest square that can contain it. These 2 points are the two opposite corners of said box", - titulo:"Type",id:"",value:dados.type,tipo:"text",div:"
"}, - {ajuda:"Ativa ou não a manutenção de um cache para armazenar as imagens geradas para montar o mapa. Essa opção afeta apenas as interfaces do i3Geo que utilizam o modo TILE (como a interface OpenLayers). O cache é mantido no diretório temporário utilizado pelo i3Geo, na pasta chamada cache. Para cada camada é criada uma sub-pasta. Para limpar o cache, utilize a opção existente junto ao nó principal desse mapfile", - titulo:"Cache de mapas. Camadas WMS são acessadas diretamente do servidor de origem quando o cache estiver inativo. (CACHE)",id:"",value:dados.cache,tipo:"text",div:"
"}, - {ajuda:"Projeção", - titulo:"Projection",id:"projection",value:dados.projection,tipo:"text"}, - {ajuda:"This parameter allows for data specific attribute filtering that is done at the same time spatial filtering is done, but before any CLASS expressions are evaluated. For OGR and shapefiles the string is simply a mapserver regular expression. For spatial databases the string is a SQL WHERE clause that is valid with respect to the underlying database.For example: FILTER type='road' and size <2", - titulo:"Filter",id:"filter",value:dados.filter,tipo:"text"}, - {ajuda:"Item to use with simple FILTER expressions. OGR and shapefiles only.", - titulo:"Filteritem",id:"filteritem",value:dados.filteritem,tipo:"text"}, - {ajuda:"Item that contains the location of an individual tile, default is 'location'.", - titulo:"tileitem",id:"tileitem",value:dados.tileitem,tipo:"text"}, - {ajuda:"Name of the tileindex file or layer. A tileindex is similar to an ArcInfo library index. The tileindex contains polygon features for each tile. The item that contains the location of the tiled data is given using the TILEITEM parameter. When a file is used as the tileindex for shapefile or raster layers, the tileindex should be a shapefile. For CONNECTIONTYPE OGR layers, any OGR supported datasource can be a tileindex. Normally the location should contain the path to the tile file relative to the shapepath, not relative to the tileindex itself. If the DATA parameter contains a value then it is added to the end of the location. When a tileindex layer is used, it works similarly to directly referring to a file, but any supported feature source can be used (ie. postgres, oracle).NOTE: All files in the tileindex should have the same coordinate system, and for vector files the same set of attributes in the same order.", - titulo:"tileindex",id:"tileindex",value:dados.tileindex,tipo:"text"}, - {ajuda:"Tipo de representação das feições mostradas da camada. É importante definir esse parâmetro para que as funções de geração de SLD funcionem corretamente.", - titulo:"Tipo de representação (tipooriginal) - para temas do tipo WMS",id:"",value:dados.tipooriginal,tipo:"text",div:"
"} - ] - }; + var idsForms = ["connection","data","tileitem","tileindex","type","tipooriginal","metaestat_id_medida_variavel"], + idsMetaestat = ["connection","data","tileitem","tileindex","tipooriginal"], + limg=i3GEO.configura.locaplic+"/imagens/crialeg.jpg", + param = { + "linhas":[ + {ajuda:"Indica se as definições da camada estão relacionadas ao sistema de metadados estatísticos. Se estiver, alguns parâmetros são obtidos de forma automática, como a conexão e o SQL de acesso aos dados.", + titulo:"Esse mapfile está integrado ao sistema de metadados estatísticos?",id:"",value:dados.metaestat,tipo:"text",div:"
"}, + //TODO colocar icone para escolher o id + {ajuda:"ID da medida da variável que relaciona a camada ao sistema de metadados estatísticos. Só deve ser definido se o mapfile for integrado a esse sistema.", + titulo:"ID da variável no sistema de metadados estatísticos ",id:"metaestat_id_medida_variavel",value:dados.metaestat_id_medida_variavel,tipo:"text",div:""}, + {ajuda:"Type of connection. Default is local.", + titulo:"Connectiontype",id:"",value:"",div:"
",tipo:"text"}, + {ajuda:"Aplica a conversão de caracteres nas ferramentas que obtém os dados descritivos referentes aos elementos do LAYER. Em alguns casos, a conversão pode provocar problemas de acentuação. Se isso ocorrer, na ferramenta tabela por exemplo, experimente marcar essa opção como 'nao'", + titulo:"Conversão de caracteres (METADATA: CONVCARACTER)",id:"",value:dados.convcaracter,tipo:"text",div:"
"}, + {ajuda:"Database connection string to retrieve remote data.An SDE connection string consists of a hostname, instance name, database name, username and password separated by commas.A PostGIS connection string is basically a regular PostgreSQL connection string, it takes the form of 'user=nobody password=****** dbname=dbname host=localhost port=5432' An Oracle connection string: user/pass[@db] . Se vc tiver problemas com acentuação, experimente algo como: user=postgres password=postgres dbname=pgutf8 host=localhost port=5432 options='-c client_encoding=LATIN1'", + titulo:"Connection",id:"connection",value:dados.connection,tipo:"text"}, + {ajuda:"Full filename of the spatial data to process. No file extension is necessary for shapefiles. Can be specified relative to the SHAPEPATH option from the Map Object.If this is an SDE layer, the parameter should include the name of the layer as well as the geometry column, i.e. 'mylayer,shape,myversion'.If this is a PostGIS layer, the parameter should be in the form of ' from ', where 'columnname' is the name of the column containing the geometry objects and 'tablename' is the name of the table from which the geometry data will be read.For Oracle, use 'shape FROM table' or 'shape FROM (SELECT statement)' or even more complex Oracle compliant queries! Note that there are important performance impacts when using spatial subqueries however. Try using MapServer's FILTER whenever possible instead. You can also see the SQL submitted by forcing an error, for instance by submitting a DATA parameter you know won't work, using for example a bad column name. Exemplo postgis: the_geom FROM (select * FROM biomas) as foo USING UNIQUE gid USING SRID=4291 . Exemplo shapefile: c://ms4w/Apache/htdocs/geodados/brasil/limitespol/localidades.shp", + titulo:"Data",id:"data",value:dados.data,tipo:"text"}, + {ajuda:"Specifies how the data should be drawn. Need not be the same as the shapefile type. For example, a polygon shapefile may be drawn as a point layer, but a point shapefile may not be drawn as a polygon layer. Common sense rules. Annotation means that a label point will be calculated for the features, but the feature itself will not be drawn although a marker symbol can be optionally drawn. this allows for advanced labeling like numbered highway shields. Points are labeled at that point. Polygons are labeled first using a centroid, and if that doesn't fall in the polygon a scanline approach is used to guarantee the label falls within the feature. Lines are labeled at the middle of the longest arc in the visible portion of the line. Query only means the layer can be queried but not drawn.In order to differentiate between POLYGONs and POLYLINEs (which do not exist as a type), simply respectively use or ommit the COLOR keyword when classifying. If you use it, it's a polygon with a fill color, otherwise it's a polyline with only an OUTLINECOLOR.For CHART layers, see the Dynamic Charting howto.A circle must be defined by a a minimum bounding rectangle. That is, 2 points that define the smallest square that can contain it. These 2 points are the two opposite corners of said box", + titulo:"Type",id:"",value:dados.type,tipo:"text",div:"
"}, + {ajuda:"Ativa ou não a manutenção de um cache para armazenar as imagens geradas para montar o mapa. Essa opção afeta apenas as interfaces do i3Geo que utilizam o modo TILE (como a interface OpenLayers). O cache é mantido no diretório temporário utilizado pelo i3Geo, na pasta chamada cache. Para cada camada é criada uma sub-pasta. Para limpar o cache, utilize a opção existente junto ao nó principal desse mapfile", + titulo:"Cache de mapas. Camadas WMS são acessadas diretamente do servidor de origem quando o cache estiver inativo. (CACHE)",id:"",value:dados.cache,tipo:"text",div:"
"}, + {ajuda:"Projeção", + titulo:"Projection",id:"projection",value:dados.projection,tipo:"text"}, + {ajuda:"This parameter allows for data specific attribute filtering that is done at the same time spatial filtering is done, but before any CLASS expressions are evaluated. For OGR and shapefiles the string is simply a mapserver regular expression. For spatial databases the string is a SQL WHERE clause that is valid with respect to the underlying database.For example: FILTER type='road' and size <2", + titulo:"Filter",id:"filter",value:dados.filter,tipo:"text"}, + {ajuda:"Item to use with simple FILTER expressions. OGR and shapefiles only.", + titulo:"Filteritem",id:"filteritem",value:dados.filteritem,tipo:"text"}, + {ajuda:"Item that contains the location of an individual tile, default is 'location'.", + titulo:"tileitem",id:"tileitem",value:dados.tileitem,tipo:"text"}, + {ajuda:"Name of the tileindex file or layer. A tileindex is similar to an ArcInfo library index. The tileindex contains polygon features for each tile. The item that contains the location of the tiled data is given using the TILEITEM parameter. When a file is used as the tileindex for shapefile or raster layers, the tileindex should be a shapefile. For CONNECTIONTYPE OGR layers, any OGR supported datasource can be a tileindex. Normally the location should contain the path to the tile file relative to the shapepath, not relative to the tileindex itself. If the DATA parameter contains a value then it is added to the end of the location. When a tileindex layer is used, it works similarly to directly referring to a file, but any supported feature source can be used (ie. postgres, oracle).NOTE: All files in the tileindex should have the same coordinate system, and for vector files the same set of attributes in the same order.", + titulo:"tileindex",id:"tileindex",value:dados.tileindex,tipo:"text"}, + {ajuda:"Tipo de representação das feições mostradas da camada. É importante definir esse parâmetro para que as funções de geração de SLD funcionem corretamente.", + titulo:"Tipo de representação (tipooriginal) - para temas do tipo WMS",id:"",value:dados.tipooriginal,tipo:"text",div:"
"} + ] + }; var ins = ""; ins += " "; @@ -1585,6 +1586,34 @@ function montaEditorDados(dados) $i("connectiontype").onchange.call(); } } +function selIdMedidaVariavel(idEleValue,idEleCodigoConexao){ + var eleValue = $i(idEleValue), + eleCodigoConexao = $i(idEleCodigoConexao), + callback = { + success:function(o){ + try { + var dados = YAHOO.lang.JSON.parse(o.responseText), + n = dados.length, + i, + valores = [], + textos = [], + selecionados = [eleValue.value]; + for(i=0;iesquemaadmin."i3geoestat_variavel "; $sql .= "JOIN ".$this->esquemaadmin."i3geoestat_medida_variavel "; $sql .= "ON i3geoestat_variavel.codigo_variavel = i3geoestat_medida_variavel.codigo_variavel "; @@ -1154,7 +1154,7 @@ class Metaestat{ $sql .= "AND i3geoestat_medida_variavel.id_medida_variavel = $id_medida_variavel "; } } - else{ + elseif($id_medida_variavel != "") { $sql .= "WHERE i3geoestat_medida_variavel.id_medida_variavel = $id_medida_variavel "; } return $this->execSQL($sql,$id_medida_variavel); diff --git a/classesjs/classe_arvoredetemas.js b/classesjs/classe_arvoredetemas.js index b4cc20b..7f91873 100644 --- a/classesjs/classe_arvoredetemas.js +++ b/classesjs/classe_arvoredetemas.js @@ -1762,36 +1762,55 @@ i3GEO.arvoreDeTemas = { // //verifica se o tema ja existe no mapa // - if(tsl.length === 1 && i3GEO.arvoreDeCamadas.pegaTema(tsl[0]) !== ""){ + if(i3GEO.arvoreDeCamadas.pegaTema(tsl[0]) !== ""){ temp = window.confirm("O tema existe no mapa. Adiciona novamente?"); if(!temp){return;} } if(tsl.length > 0){ - temp = function(retorno){ - i3GEO.atualiza(); - // - //verifica se deve ser ativada uma outra guia que nao a atual - // - if(i3GEO.arvoreDeTemas.RETORNAGUIA !== ""){ - if(i3GEO.arvoreDeTemas.RETORNAGUIA !== i3GEO.guias.ATUAL){ - i3GEO.guias.escondeGuias(); - i3GEO.guias.mostra(i3GEO.arvoreDeTemas.RETORNAGUIA); + //verifica se o tema esta vinculado ao sistema de metadados estatisticos + temp = i3GEO.arvoreDeTemas.ARVORE.getNodeByProperty("idtema",tsl[0]); + if(temp && temp.data.tipoa_tema === "META"){ + //obtem os parametros do tema + temp = function(retorno){ + var id = retorno.data[tsl[0]]["METAESTAT_ID_MEDIDA_VARIAVEL"]; + i3GEO.util.dialogoFerramenta( + "i3GEO.mapa.dialogo.metaestat()", + "metaestat", + "metaestat", + "index.js", + "i3GEOF.metaestat.inicia('flutuanteSimples','',"+id+")" + ); + + }; + i3GEO.php.pegaMetaData(temp,tsl[0]); + } + else{ + temp = function(retorno){ + i3GEO.atualiza(); + // + //verifica se deve ser ativada uma outra guia que nao a atual + // + if(i3GEO.arvoreDeTemas.RETORNAGUIA !== ""){ + if(i3GEO.arvoreDeTemas.RETORNAGUIA !== i3GEO.guias.ATUAL){ + i3GEO.guias.escondeGuias(); + i3GEO.guias.mostra(i3GEO.arvoreDeTemas.RETORNAGUIA); + } } - } - // - //verifica se a janela da ferramenta identifica esta ativa para atualizar a lista de temas - // - try{ - if($i("i3GEOidentificalistaTemas")){ - i3GEOF.identifica.listaTemas(); - g_tipoacao = "identifica"; + // + //verifica se a janela da ferramenta identifica esta ativa para atualizar a lista de temas + // + try{ + if($i("i3GEOidentificalistaTemas")){ + i3GEOF.identifica.listaTemas(); + g_tipoacao = "identifica"; + } } - } - catch(r){ - if(typeof(console) !== 'undefined'){console.error(r);} - } - }; - i3GEO.php.adtema(temp,tsl.toString()); + catch(r){ + if(typeof(console) !== 'undefined'){console.error(r);} + } + }; + i3GEO.php.adtema(temp,tsl.toString()); + } } }, /* diff --git a/classesjs/classe_php.js b/classesjs/classe_php.js index 844f619..da5ebf6 100644 --- a/classesjs/classe_php.js +++ b/classesjs/classe_php.js @@ -1387,6 +1387,16 @@ i3GEO.php = { cpJSON.call(p,"pegadata",funcao,par); }, /* + Function: pegaMetaData + + + */ + pegaMetaData: function(funcao,tema){ + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php", + par = "g_sid="+i3GEO.configura.sid+"&funcao=pegametadata&tema="+tema; + cpJSON.call(p,"pegametadata",funcao,par); + }, + /* Function: alteraData diff --git a/classesphp/classe_temas.php b/classesphp/classe_temas.php index 9db3b30..63052b5 100644 --- a/classesphp/classe_temas.php +++ b/classesphp/classe_temas.php @@ -122,7 +122,6 @@ $ext - (opcional) extensão geográfica que será aplicada ao { $this->mapa = ms_newMapObj($map_file); $this->arquivo = $map_file; - if($tema != "") { $listaTemas = str_replace(" ",",",$tema); @@ -162,6 +161,25 @@ Salva o mapfile atual if (connection_aborted()){exit();} $this->mapa->save($this->arquivo); } +/* + function: pegaMetadata + +Pega os metadata do tema + +parameter: + +*/ + function pegaMetadata(){ + if(!$this->layer){return "erro";} + $buscar = array("METAESTAT","METAESTAT_ID_MEDIDA_VARIAVEL"); + $meta = array(); + foreach($buscar as $b){ + $meta[$b] = $this->layer->getmetadata($b); + } + return array( + $this->layer->name => $meta + ); + } /* function: aplicaProcessos diff --git a/classesphp/mapa_controle.php b/classesphp/mapa_controle.php index 8899069..83f2745 100644 --- a/classesphp/mapa_controle.php +++ b/classesphp/mapa_controle.php @@ -777,6 +777,24 @@ Obtém o nome de um layer e de seu arquivo mapfile original. $m = new Temas($map_file,$tema); $retorno = $m->peganomelayer(); break; + /* + Valor: PEGAMETADATA + + Obtém os metadados de um tema + + Tema pode ser um mapfile existente em i3geo/temas + + pegametadata> + */ + case "PEGAMETADATA": + include_once("classe_temas.php"); + //pode pegar os metadata de um mapfile existente em i3geo/temas + if(file_exists(__DIR__."/../temas/".$tema.".map")){ + $map_file = __DIR__."/../temas/".$tema.".map"; + } + $m = new Temas($map_file,$tema); + $retorno = $m->pegametadata(); + break; /* Valor: PEGADATA diff --git a/ferramentas/metaestat/dicionario.js b/ferramentas/metaestat/dicionario.js index e25f806..56ff99a 100644 --- a/ferramentas/metaestat/dicionario.js +++ b/ferramentas/metaestat/dicionario.js @@ -117,5 +117,12 @@ pt:"Região", en:"", es:"", it:"" +}], +"17":[ +{ +pt:"Escolha um tipo de região (limites utilizados para representar os valores) e o tipo de classificação dos dados, depois escolha os valores para os parâmetros , se houver. Para adicionar a camada ao mapa, clique no botão de adição e feche a janela para continuar usando o mapa.", +en:"", +es:"", +it:"" }] }; \ No newline at end of file diff --git a/ferramentas/metaestat/index.js b/ferramentas/metaestat/index.js index 2a3e0c3..5179817 100644 --- a/ferramentas/metaestat/index.js +++ b/ferramentas/metaestat/index.js @@ -41,6 +41,10 @@ i3GEOF.metaestat = { * Tipo de interface utilizada para construcao dos parametros */ INTERFACE: "flutuante", + //codigo da variavel definido na inicializacao (opcional) + CODIGO_VARIAVEL: "", + //id da medida da variavel definido na inicializacao (opcional) + ID_MEDIDA_VARIAVEL: "", CONEXAODEFAULT: 0, TOP: 50, LEFT: 100, @@ -54,7 +58,16 @@ i3GEOF.metaestat = { criaJanelaFlutuante: function(){ i3GEOF.metaestat.inicia(); }, - inicia: function(){ + inicia: function(Interface,codigo_variavel,id_medida_variavel){ + if(Interface && Interface != ""){ + i3GEOF.metaestat.INTERFACE = Interface; + } + if(codigo_variavel && codigo_variavel != ""){ + i3GEOF.metaestat.CODIGO_VARIAVEL = codigo_variavel; + } + if(id_medida_variavel && id_medida_variavel != ""){ + i3GEOF.metaestat.ID_MEDIDA_VARIAVEL = id_medida_variavel; + } i3GEOF.metaestat.comum.iniciaDicionario(); }, analise: { @@ -553,11 +566,16 @@ i3GEOF.metaestat = { } if(i3GEOF.metaestat.INTERFACE == "flutuante"){ i3GEOF.metaestat.classes.abreJanela(); + $i(iddiv).innerHTML = i3GEOF.metaestat.classes.html(); + i3GEOF.metaestat.classes.comboTipoRep(); + i3GEOF.metaestat.classes.comboTipoClassificacao(); + i3GEOF.metaestat.classes.comboRegiao(); + } + if(i3GEOF.metaestat.INTERFACE == "flutuanteSimples"){ + i3GEOF.metaestat.classes.abreJanela(); + $i(iddiv).innerHTML = i3GEOF.metaestat.classes.html(); + i3GEOF.metaestat.classes.comboTipoClassificacao(); } - $i(iddiv).innerHTML = i3GEOF.metaestat.classes.html(); - i3GEOF.metaestat.classes.comboTipoRep(); - i3GEOF.metaestat.classes.comboTipoClassificacao(); - i3GEOF.metaestat.classes.comboRegiao(); }, abreJanela: function(){ var cabecalho,minimiza,imagemxy,janela; @@ -720,22 +738,22 @@ i3GEOF.metaestat = { i3GEOF.metaestat.analise.comboCamadas(); }; i3GEO.php.adtema(atualiza,retorno.mapfile); - } }; if(v != true){ i3GEO.janela.tempoMsg("erro: "+v); + return; } i3GEO.php.mapfileMedidaVariavel( - temp, - $i("i3geoCartoComboMedidasVariavel").value, - i3GEOF.metaestat.comum.defineFiltro(), - 0, - $i("i3geoCartoComboTipoRep").value, - i3GEOF.metaestat.comum.defineTitulo(), - $i("i3geoCartoComboTipoClassificacao").value, - i3GEOF.metaestat.comum.defineAgruparPor(), - $i("i3geoCartoComboRegioesMedidasVariavel").value + temp, + $i("i3geoCartoComboMedidasVariavel").value, + i3GEOF.metaestat.comum.defineFiltro(), + 0, + $i("i3geoCartoComboTipoRep").value, + i3GEOF.metaestat.comum.defineTitulo(), + $i("i3geoCartoComboTipoClassificacao").value, + i3GEOF.metaestat.comum.defineAgruparPor(), + $i("i3geoCartoComboRegioesMedidasVariavel").value ); }, ativaCamada: function(camada){ @@ -747,7 +765,7 @@ i3GEOF.metaestat = { }, defineTitulo: function(){ //se nao tiver parametros, filtro e vazio - if(i3GEOF.metaestat.parametros.dados.length == 0){ + if(i3GEOF.metaestat.parametros.dados.length == 0 || i3GEOF.metaestat.INTERFACE === "flutuanteSimples"){ return ""; } //se tiver parametro e todos estiverem vazios, aborta @@ -1440,29 +1458,52 @@ i3GEOF.metaestat = { if(!iddiv || !$i(iddiv)){ iddiv = "i3geoCartoParametros_corpo"; } + //interface default if(i3GEOF.metaestat.INTERFACE == "flutuante"){ i3GEOF.metaestat.principal.abreJanela(); + $i(iddiv).innerHTML = i3GEOF.metaestat.principal.html(); + i3GEOF.metaestat.principal.opcoesVariaveis(); + } + //interface qd a medida da variavel ja tiver sido definida + if(i3GEOF.metaestat.INTERFACE == "flutuanteSimples"){ + i3GEOF.metaestat.principal.abreJanela(); + $i(iddiv).innerHTML = i3GEOF.metaestat.principal.html(); + //i3GEOF.metaestat.principal.opcoesVariaveis(); + $i("i3geoCartoVariaveis").innerHTML = "Aguarde..."; + $i("i3geoCartoVariaveis").innerHTML = '' + + "

" + + "" + + "" + + "
" + + "
" + + "
" + + "

"+$trad(17,i3GEOF.metaestat.dicionario) + "

"; + i3GEOF.metaestat.classes.botaoAdicionarCamada(); + i3GEOF.metaestat.classes.comboRegiao(i3GEOF.metaestat.ID_MEDIDA_VARIAVEL); + i3GEOF.metaestat.classes.comboTipoClassificacao(); + i3GEOF.metaestat.parametros.lista(i3GEOF.metaestat.ID_MEDIDA_VARIAVEL); } - $i(iddiv).innerHTML = i3GEOF.metaestat.principal.html(); - i3GEOF.metaestat.principal.opcoesVariaveis(); }, abreJanela: function(){ - var cabecalho,minimiza,imagemxy,janela; + var cabecalho,minimiza,imagemxy,janela,modal = false; if (!$i("i3geoCartoParametros")){ cabecalho = function(){ }; minimiza = function(){ i3GEO.janela.minimiza("i3geoCartoParametros"); }; + if(i3GEOF.metaestat.INTERFACE == "flutuanteSimples"){ + modal = true; + } janela = i3GEO.janela.cria( - i3GEOF.metaestat.LARGURA+"px", + i3GEOF.metaestat.LARGURA+10+"px", i3GEOF.metaestat.ALTURA+"px", "", "", "", $trad("x57"), "i3geoCartoParametros", - false, + modal, "hd", cabecalho, minimiza diff --git a/temas/testemetaestat.map b/temas/testemetaestat.map new file mode 100644 index 0000000..1d46658 --- /dev/null +++ b/temas/testemetaestat.map @@ -0,0 +1,88 @@ +MAP + FONTSET "../symbols/fontes.txt" + IMAGECOLOR 255 255 255 + IMAGETYPE "png" + NAME "MS" + SIZE -1 -1 + STATUS ON + SYMBOLSET "../symbols/simbolosv6.sym" + UNITS METERS + + OUTPUTFORMAT + NAME "png" + MIMETYPE "image/png" + DRIVER "AGG/PNG" + EXTENSION "png" + IMAGEMODE RGB + TRANSPARENT FALSE + END # OUTPUTFORMAT + + LEGEND + IMAGECOLOR 255 255 255 + KEYSIZE 20 10 + KEYSPACING 5 5 + LABEL + SIZE MEDIUM + COLOR 0 0 0 + OFFSET 0 0 + SHADOWSIZE 1 1 + TYPE BITMAP + END # LABEL + STATUS OFF + END # LEGEND + + QUERYMAP + COLOR 255 255 0 + SIZE -1 -1 + STATUS OFF + STYLE HILITE + END # QUERYMAP + + SCALEBAR + COLOR 0 0 0 + IMAGECOLOR 255 255 255 + INTERVALS 4 + LABEL + SIZE MEDIUM + COLOR 0 0 0 + OFFSET 0 0 + SHADOWSIZE 1 1 + TYPE BITMAP + END # LABEL + SIZE 200 3 + STATUS OFF + UNITS MILES + END # SCALEBAR + + WEB + END # WEB + + LAYER + CONNECTION "" + CONNECTIONTYPE POSTGIS + DATA "" + METADATA + "METAESTAT_ID_MEDIDA_VARIAVEL" "1" + "cache" "" + "CLASSE" "SIM" + "METAESTAT" "SIM" + "convcaracter" "" + "TEMA" "Teste de tema baseado no METAESTAT" + END # METADATA + NAME "testemetaestat" + STATUS OFF + TEMPLATE "none.htm" + TILEITEM "location" + TYPE POLYGON + UNITS METERS + CLASS + NAME "" + STYLE + ANGLE 0 + COLOR 0 0 0 + OFFSET 0 0 + END # STYLE + END # CLASS + END # LAYER + +END # MAP -- libgit2 0.21.2