Commit a972231d2006fc4cffcf2fd12e99e1b06b70fb64
1 parent
6ce78a46
Exists in
master
and in
7 other branches
$1
Showing
14 changed files
with
1766 additions
and
47 deletions
Show diff stats
ferramentas/saiku/cartograma.php
| @@ -22,10 +22,14 @@ $opcoes = (array) json_decode($_POST["opcoes"],true); | @@ -22,10 +22,14 @@ $opcoes = (array) json_decode($_POST["opcoes"],true); | ||
| 22 | $metadados = (array) json_decode($_POST["metadados"],true); | 22 | $metadados = (array) json_decode($_POST["metadados"],true); |
| 23 | $nmetadados = count($metadados); | 23 | $nmetadados = count($metadados); |
| 24 | //pega o id da regiao (busca pelo posfixo geocod) | 24 | //pega o id da regiao (busca pelo posfixo geocod) |
| 25 | -$codigo_tipo_regiao = $metadados[0]["identificador"]; | ||
| 26 | -$codigo_tipo_regiao = explode("].[",$codigo_tipo_regiao); | ||
| 27 | -$codigo_tipo_regiao = str_replace(array("codigo_tipo_regiao_","[","_geocod"),"",$codigo_tipo_regiao[0]); | ||
| 28 | - | 25 | +$codigo_tipo_regiao = $metadados[0]["colName"]; |
| 26 | +$codigo_tipo_regiao = explode("#",$codigo_tipo_regiao); | ||
| 27 | +$codigo_tipo_regiao = $codigo_tipo_regiao[1]; | ||
| 28 | +/* | ||
| 29 | +echo "<pre>"; | ||
| 30 | +var_dump($metadados); | ||
| 31 | +echo $codigo_tipo_regiao;exit; | ||
| 32 | +*/ | ||
| 29 | if(empty($codigo_tipo_regiao)){ | 33 | if(empty($codigo_tipo_regiao)){ |
| 30 | echo "Nao foi possivel determinar o codigo da regiao ou localidade no sistema Metaestat"; | 34 | echo "Nao foi possivel determinar o codigo da regiao ou localidade no sistema Metaestat"; |
| 31 | exit; | 35 | exit; |
| @@ -47,7 +51,7 @@ $srid = $meta["srid"]; | @@ -47,7 +51,7 @@ $srid = $meta["srid"]; | ||
| 47 | $colunastabela = $m->colunasTabela($meta["codigo_estat_conexao"],$meta["esquemadb"],$meta["tabela"],"geometry","!="); | 51 | $colunastabela = $m->colunasTabela($meta["codigo_estat_conexao"],$meta["esquemadb"],$meta["tabela"],"geometry","!="); |
| 48 | $tipoLayer = "POLYGON"; | 52 | $tipoLayer = "POLYGON"; |
| 49 | //define a coluna geo correta | 53 | //define a coluna geo correta |
| 50 | -if($opcoes["tipo"] == "raiosProporcionais" || $opcoes["tipo"] == "circulosProporcionais"){ | 54 | +if($opcoes["tipo"] == "mapaPizzas" || $opcoes["tipo"] == "mapaBarras" || $opcoes["tipo"] == "raiosProporcionais" || $opcoes["tipo"] == "circulosProporcionais"){ |
| 51 | if($meta["colunacentroide"] != ""){ | 55 | if($meta["colunacentroide"] != ""){ |
| 52 | $colunageo = $meta["colunacentroide"]; | 56 | $colunageo = $meta["colunacentroide"]; |
| 53 | $sqlColunaGeo = $meta["colunacentroide"]; | 57 | $sqlColunaGeo = $meta["colunacentroide"]; |
| @@ -56,6 +60,9 @@ if($opcoes["tipo"] == "raiosProporcionais" || $opcoes["tipo"] == "circulosPropor | @@ -56,6 +60,9 @@ if($opcoes["tipo"] == "raiosProporcionais" || $opcoes["tipo"] == "circulosPropor | ||
| 56 | $sqlColunaGeo = "st_centroid(".$meta["colunageo"].")"; | 60 | $sqlColunaGeo = "st_centroid(".$meta["colunageo"].")"; |
| 57 | } | 61 | } |
| 58 | $tipoLayer = "POINT"; | 62 | $tipoLayer = "POINT"; |
| 63 | + if($opcoes["tipo"] == "mapaBarras" || $opcoes["tipo"] == "mapaPizzas"){ | ||
| 64 | + $tipoLayer = "CHART"; | ||
| 65 | + } | ||
| 59 | } | 66 | } |
| 60 | //var_dump($metadados);exit; | 67 | //var_dump($metadados);exit; |
| 61 | //constroi um sql que retorna os dados na forma de uma tabela inline | 68 | //constroi um sql que retorna os dados na forma de uma tabela inline |
| @@ -115,19 +122,32 @@ $l[] = ' SAIKU "'.$opcoes["tipo"].'"'; | @@ -115,19 +122,32 @@ $l[] = ' SAIKU "'.$opcoes["tipo"].'"'; | ||
| 115 | $l[] = ' TIP "'.$meta["colunanomeregiao"].','.implode(',',$nomesColunas).'"'; | 122 | $l[] = ' TIP "'.$meta["colunanomeregiao"].','.implode(',',$nomesColunas).'"'; |
| 116 | $l[] = ' METAESTAT_CODIGO_TIPO_REGIAO "'.$codigo_tipo_regiao.'"'; | 123 | $l[] = ' METAESTAT_CODIGO_TIPO_REGIAO "'.$codigo_tipo_regiao.'"'; |
| 117 | $l[] = ' END '; | 124 | $l[] = ' END '; |
| 118 | -$l = implode("",$l); | 125 | + |
| 126 | +$l = implode(PHP_EOL,$l); | ||
| 127 | + | ||
| 119 | if($opcoes["tipo"] == "raiosProporcionais"){ | 128 | if($opcoes["tipo"] == "raiosProporcionais"){ |
| 120 | - $l .= implode(" ",raiosProporcionais(1,$nomesColunas[1])); | 129 | + $l .= implode(PHP_EOL,raiosProporcionais(1,$nomesColunas[1])); |
| 121 | } | 130 | } |
| 122 | if($opcoes["tipo"] == "circulosProporcionais"){ | 131 | if($opcoes["tipo"] == "circulosProporcionais"){ |
| 123 | $l .= ' OPACITY 50'; | 132 | $l .= ' OPACITY 50'; |
| 124 | - $l .= implode(" ",circulosProporcionais(1,$nomesColunas[1])); | 133 | + $l .= implode(PHP_EOL,circulosProporcionais(1,$nomesColunas[1])); |
| 125 | } | 134 | } |
| 126 | if($opcoes["tipo"] == "coresChapadas"){ | 135 | if($opcoes["tipo"] == "coresChapadas"){ |
| 127 | $l .= ' OPACITY 50'; | 136 | $l .= ' OPACITY 50'; |
| 128 | - $l .= implode(" ",coresChapadas(1,$nomesColunas[1])); | 137 | + $l .= implode(PHP_EOL,coresChapadas(1,$nomesColunas[1])); |
| 138 | +} | ||
| 139 | +if($opcoes["tipo"] == "mapaBarras"){ | ||
| 140 | + $l .= PHP_EOL.' PROCESSING "CHART_SIZE='.$opcoes["size"].' '.$opcoes["size"].'"'; | ||
| 141 | + $l .= PHP_EOL.' PROCESSING "CHART_TYPE=bar"'; | ||
| 142 | + $l .= implode(PHP_EOL,mapaBarras($nomesColunas)); | ||
| 129 | } | 143 | } |
| 130 | -$l .= 'END'; | 144 | +if($opcoes["tipo"] == "mapaPizzas"){ |
| 145 | + $l .= PHP_EOL.' PROCESSING "CHART_SIZE='.$opcoes["size"].' '.$opcoes["size"].'"'; | ||
| 146 | + $l .= PHP_EOL.' PROCESSING "CHART_TYPE=pie"'; | ||
| 147 | + $l .= implode(PHP_EOL,mapaBarras($nomesColunas)); | ||
| 148 | +} | ||
| 149 | +$l .= PHP_EOL.'END'; | ||
| 150 | + | ||
| 131 | //echo $l;exit; | 151 | //echo $l;exit; |
| 132 | $layer->updateFromString($l); | 152 | $layer->updateFromString($l); |
| 133 | 153 | ||
| @@ -146,6 +166,28 @@ if($opcoes["tipo"] == "coresChapadas"){ | @@ -146,6 +166,28 @@ if($opcoes["tipo"] == "coresChapadas"){ | ||
| 146 | 166 | ||
| 147 | header("Location:".$opcoes["locaplic"]."/mashups/openlayers.php?temas=".$map_file."&DESLIGACACHE=sim&botoes=legenda,pan,zoombox,zoomtot,zoomin,zoomout,distancia,area,identifica&controles=navigation,layerswitcher,scaleline,mouseposition,overviewmap,keyboarddefaults&tiles=false&mapext=".$opcoes["mapext"]); | 167 | header("Location:".$opcoes["locaplic"]."/mashups/openlayers.php?temas=".$map_file."&DESLIGACACHE=sim&botoes=legenda,pan,zoombox,zoomtot,zoomin,zoomout,distancia,area,identifica&controles=navigation,layerswitcher,scaleline,mouseposition,overviewmap,keyboarddefaults&tiles=false&mapext=".$opcoes["mapext"]); |
| 148 | 168 | ||
| 169 | +function mapaBarras($colunas){ | ||
| 170 | + global $opcoes; | ||
| 171 | + //$opcoes["coreshex"] = array_reverse($opcoes["coreshex"]); | ||
| 172 | + //$valores = retornaDadosColuna($coluna); | ||
| 173 | + //$cortes = quartis($valores,$nomeColuna); | ||
| 174 | + //var_dump($opcoes["coreshex"]);exit; | ||
| 175 | + $nclasses = count($colunas); | ||
| 176 | + $classes = array(); | ||
| 177 | + for($i=1;$i<$nclasses;$i++){ | ||
| 178 | + $classes[] = PHP_EOL.'CLASS'; | ||
| 179 | + $classes[] = ' NAME "'.$colunas[$i].'"'; | ||
| 180 | + $classes[] = ' STYLE'; | ||
| 181 | + $cor = $opcoes["outlinecolor"]; | ||
| 182 | + $classes[] = ' OUTLINECOLOR '.$cor["red"].' '.$cor["green"].' '.$cor["blue"]; | ||
| 183 | + $classes[] = ' SIZE ['.$colunas[$i].']'; | ||
| 184 | + $classes[] = ' COLOR '.$opcoes["cores"][$i-1]; | ||
| 185 | + $classes[] = ' END'; | ||
| 186 | + $classes[] = 'END '; | ||
| 187 | + } | ||
| 188 | + return $classes; | ||
| 189 | +} | ||
| 190 | + | ||
| 149 | function coresChapadas($coluna,$nomeColuna){ | 191 | function coresChapadas($coluna,$nomeColuna){ |
| 150 | global $opcoes; | 192 | global $opcoes; |
| 151 | $valores = retornaDadosColuna($coluna); | 193 | $valores = retornaDadosColuna($coluna); |
| @@ -251,4 +293,21 @@ function retornaDadosColuna($coluna){ | @@ -251,4 +293,21 @@ function retornaDadosColuna($coluna){ | ||
| 251 | } | 293 | } |
| 252 | return $valores; | 294 | return $valores; |
| 253 | } | 295 | } |
| 296 | +function cHexToDec ($hexStr, $returnAsString = true, $seperator = ' ') { | ||
| 297 | + $hexStr = preg_replace("/[^0-9A-Fa-f]/", '', $hexStr); // Gets a proper hex string | ||
| 298 | + $rgbArray = array(); | ||
| 299 | + if (strlen($hexStr) == 6) { //If a proper hex code, convert using bitwise operation. No overhead... faster | ||
| 300 | + $colorVal = hexdec($hexStr); | ||
| 301 | + $rgbArray['red'] = 0xFF & ($colorVal >> 0x10); | ||
| 302 | + $rgbArray['green'] = 0xFF & ($colorVal >> 0x8); | ||
| 303 | + $rgbArray['blue'] = 0xFF & $colorVal; | ||
| 304 | + } elseif (strlen($hexStr) == 3) { //if shorthand notation, need some string manipulations | ||
| 305 | + $rgbArray['red'] = hexdec(str_repeat(substr($hexStr, 0, 1), 2)); | ||
| 306 | + $rgbArray['green'] = hexdec(str_repeat(substr($hexStr, 1, 1), 2)); | ||
| 307 | + $rgbArray['blue'] = hexdec(str_repeat(substr($hexStr, 2, 1), 2)); | ||
| 308 | + } else { | ||
| 309 | + return false; //Invalid hex color code | ||
| 310 | + } | ||
| 311 | + return $returnAsString ? implode($seperator, $rgbArray) : $rgbArray; // returns the rgb string or the associative array | ||
| 312 | +} | ||
| 254 | ?> | 313 | ?> |
ferramentas/saiku/esquemaxml.php
| @@ -87,8 +87,8 @@ for ($i=0;$i < $c;++$i){ | @@ -87,8 +87,8 @@ for ($i=0;$i < $c;++$i){ | ||
| 87 | } | 87 | } |
| 88 | } | 88 | } |
| 89 | if($codigo_tipo_regiao == ""){ | 89 | if($codigo_tipo_regiao == ""){ |
| 90 | - echo "Nenhum tema com limites ou localidades foi encontrado"; | ||
| 91 | - exit; | 90 | + //echo "Nenhum tema com limites ou localidades foi encontrado"; |
| 91 | + //exit; | ||
| 92 | } | 92 | } |
| 93 | $regiao = ""; | 93 | $regiao = ""; |
| 94 | $item = ""; | 94 | $item = ""; |
| @@ -158,7 +158,7 @@ foreach($regioes as $regiao){ | @@ -158,7 +158,7 @@ foreach($regioes as $regiao){ | ||
| 158 | nameColumn='j$i{$r["colunanomeregiao"]}' uniqueMembers='false'/> | 158 | nameColumn='j$i{$r["colunanomeregiao"]}' uniqueMembers='false'/> |
| 159 | "; | 159 | "; |
| 160 | $niveis2[] = " | 160 | $niveis2[] = " |
| 161 | - <Level name='".converte($r["nome_tipo_regiao"])." - GeoCod' | 161 | + <Level name='".converte($r["nome_tipo_regiao"])." - GeoCod #{$caminho[$i]}' |
| 162 | column='j$i{$r['identificador']}' | 162 | column='j$i{$r['identificador']}' |
| 163 | nameColumn='j$i{$r["identificador"]}' uniqueMembers='false'/> | 163 | nameColumn='j$i{$r["identificador"]}' uniqueMembers='false'/> |
| 164 | "; | 164 | "; |
| @@ -169,7 +169,7 @@ foreach($regioes as $regiao){ | @@ -169,7 +169,7 @@ foreach($regioes as $regiao){ | ||
| 169 | nameColumn='nome' uniqueMembers='true' /> | 169 | nameColumn='nome' uniqueMembers='true' /> |
| 170 | "; | 170 | "; |
| 171 | $niveis2[] = " | 171 | $niveis2[] = " |
| 172 | - <Level name='".converte($regiao["nome_tipo_regiao"])." - GeoCod' | 172 | + <Level name='".converte($regiao["nome_tipo_regiao"])." - GeoCod #{$regiao["codigo_tipo_regiao"]}' |
| 173 | column='codigo' | 173 | column='codigo' |
| 174 | nameColumn='codigo' uniqueMembers='true' /> | 174 | nameColumn='codigo' uniqueMembers='true' /> |
| 175 | "; | 175 | "; |
| @@ -327,6 +327,9 @@ header("Location:".$saikuUrl."/?nomeConexao=".$nomeConexao."&locaplic=".$_GET["l | @@ -327,6 +327,9 @@ header("Location:".$saikuUrl."/?nomeConexao=".$nomeConexao."&locaplic=".$_GET["l | ||
| 327 | 327 | ||
| 328 | function converte($texto){ | 328 | function converte($texto){ |
| 329 | $texto = str_replace("&","&",htmlentities($texto)); | 329 | $texto = str_replace("&","&",htmlentities($texto)); |
| 330 | + //$texto = htmlentities($texto); | ||
| 331 | + //$texto = mb_convert_encoding($texto, 'UTF-8', mb_detect_encoding($texto)); | ||
| 332 | + //$texto = utf8_encode($texto); | ||
| 330 | return $texto; | 333 | return $texto; |
| 331 | } | 334 | } |
| 332 | ?> | 335 | ?> |
ferramentas/saiku/saiku-server/tomcat/webapps/ROOT/index.html
| @@ -22,6 +22,7 @@ | @@ -22,6 +22,7 @@ | ||
| 22 | 22 | ||
| 23 | <!-- jQuery CSS --> | 23 | <!-- jQuery CSS --> |
| 24 | <link rel="stylesheet" href="css/jquery/jquery-ui.css" type="text/css" media="all" /> | 24 | <link rel="stylesheet" href="css/jquery/jquery-ui.css" type="text/css" media="all" /> |
| 25 | +<link rel="stylesheet" href="js/jquery/jquery.colourPicker.css" type="text/css" media="all" /> | ||
| 25 | 26 | ||
| 26 | <link rel="stylesheet" href="js/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" /> | 27 | <link rel="stylesheet" href="js/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" /> |
| 27 | <link rel="stylesheet" href="js/jquery/jquery.contextMenu.css" type="text/css" media="screen" /> | 28 | <link rel="stylesheet" href="js/jquery/jquery.contextMenu.css" type="text/css" media="screen" /> |
| @@ -56,6 +57,7 @@ | @@ -56,6 +57,7 @@ | ||
| 56 | 57 | ||
| 57 | 58 | ||
| 58 | <script type="text/javascript" src="js/fancybox/jquery.fancybox-1.3.4.pack.js"></script> | 59 | <script type="text/javascript" src="js/fancybox/jquery.fancybox-1.3.4.pack.js"></script> |
| 60 | + <script type="text/javascript" src="js/jquery/jquery.colourPicker.js"></script> | ||
| 59 | 61 | ||
| 60 | 62 | ||
| 61 | <!-- Backbone.js and deps --> | 63 | <!-- Backbone.js and deps --> |
| @@ -108,10 +110,6 @@ | @@ -108,10 +110,6 @@ | ||
| 108 | 110 | ||
| 109 | <!-- Saiku plugins --> | 111 | <!-- Saiku plugins --> |
| 110 | 112 | ||
| 111 | - | ||
| 112 | - <!-- | ||
| 113 | - <script type="text/javascript" src="js/saiku/plugins/Chart/plugin.js" defer></script> | ||
| 114 | - --> | ||
| 115 | <script type="text/javascript" src="js/saiku/plugins/Statistics/plugin.js" defer></script> | 113 | <script type="text/javascript" src="js/saiku/plugins/Statistics/plugin.js" defer></script> |
| 116 | <script type="text/javascript" src="js/saiku/plugins/I18n/plugin.js" defer></script> | 114 | <script type="text/javascript" src="js/saiku/plugins/I18n/plugin.js" defer></script> |
| 117 | <script type="text/javascript" src="js/saiku/plugins/BIServer/plugin.js" defer></script> | 115 | <script type="text/javascript" src="js/saiku/plugins/BIServer/plugin.js" defer></script> |
| @@ -125,28 +123,18 @@ | @@ -125,28 +123,18 @@ | ||
| 125 | <script type="text/javascript" src="js/saiku/plugins/CCC_Chart/jquery.tipsy.js"></script> | 123 | <script type="text/javascript" src="js/saiku/plugins/CCC_Chart/jquery.tipsy.js"></script> |
| 126 | <script type="text/javascript" src="js/saiku/plugins/CCC_Chart/tipsy.js"></script> | 124 | <script type="text/javascript" src="js/saiku/plugins/CCC_Chart/tipsy.js"></script> |
| 127 | <link type="text/css" href="js/saiku/plugins/CCC_Chart/tipsy.css" rel="stylesheet" /> | 125 | <link type="text/css" href="js/saiku/plugins/CCC_Chart/tipsy.css" rel="stylesheet" /> |
| 128 | - <!-- FUTURE FILES FOR CHART EDITOR | ||
| 129 | - <script type="text/javascript" src="js/saiku/plugins/CCC_Chart/cccProperties.js"></script> | ||
| 130 | - <script type="text/javascript" src="js/saiku/plugins/CCC_Chart/cccCharts.js"></script> | ||
| 131 | - <script type="text/javascript" src="js/saiku/plugins/CCC_Chart/ChartEditor.js"></script> | ||
| 132 | - --> | ||
| 133 | <script type="text/javascript" src="js/saiku/plugins/CCC_Chart/plugin.js"></script> | 126 | <script type="text/javascript" src="js/saiku/plugins/CCC_Chart/plugin.js"></script> |
| 134 | 127 | ||
| 135 | <script type="text/javascript" src="js/ace/ace.js" charset="utf-8"></script> | 128 | <script type="text/javascript" src="js/ace/ace.js" charset="utf-8"></script> |
| 136 | 129 | ||
| 137 | - <!--start js SaikuChartPlus--> | ||
| 138 | - <script type="text/javascript" src="js/saiku/plugins/SaikuChartPlus/plugin.js" defer></script> | ||
| 139 | - <!--<script type="text/javascript" src="https://www.google.com/jsapi"></script> | ||
| 140 | -<script type="text/javascript"> | ||
| 141 | - google.load('visualization', '1.0', {'packages':['geochart','geomap']}); | ||
| 142 | -</script> | ||
| 143 | ---> | ||
| 144 | - <!--end js SaikuChartPlus--> | 130 | + <!--start js i3GeoMap--> |
| 131 | + <script type="text/javascript" src="js/saiku/plugins/i3GeoMap/plugin.js" ></script> | ||
| 132 | + <!--end js i3GeoMap--> | ||
| 145 | 133 | ||
| 146 | <!-- i3GEO obtem o parametro passado pela url e que contem o codigo da conexao que deve ser utilizada --> | 134 | <!-- i3GEO obtem o parametro passado pela url e que contem o codigo da conexao que deve ser utilizada --> |
| 147 | <script> | 135 | <script> |
| 148 | -nomeConexao = window.location.search.replace("?",""); | ||
| 149 | -</script> | 136 | + nomeConexao = parametroUrl("nomeConexao"); |
| 137 | + </script> | ||
| 150 | <!-- Templates --> | 138 | <!-- Templates --> |
| 151 | <script type="text/x-jquery-tmpl" id="template-toolbar"> | 139 | <script type="text/x-jquery-tmpl" id="template-toolbar"> |
| 152 | <ul> | 140 | <ul> |
ferramentas/saiku/saiku-server/tomcat/webapps/ROOT/js/saiku/plugins/CCC_Chart/plugin.js
0 → 100755
| @@ -0,0 +1,705 @@ | @@ -0,0 +1,705 @@ | ||
| 1 | +/* | ||
| 2 | + * Copyright 2012 OSBI Ltd | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * Renders a chart for each workspace | ||
| 19 | + */ | ||
| 20 | +var Chart = Backbone.View.extend({ | ||
| 21 | + | ||
| 22 | + events: { | ||
| 23 | + 'click .keep' : 'keepVisible' | ||
| 24 | + }, | ||
| 25 | + | ||
| 26 | + cccOptions: { | ||
| 27 | + type: "BarChart", | ||
| 28 | + stacked: true | ||
| 29 | + }, | ||
| 30 | + | ||
| 31 | + data: null, | ||
| 32 | + hasProcessed: null, | ||
| 33 | + | ||
| 34 | + getChartProperties: function(chartName) { | ||
| 35 | + var self = this; | ||
| 36 | + var ret = []; | ||
| 37 | + _.each(ChartProperties, function(property) { | ||
| 38 | + if (property.ChartObject == chartName) { | ||
| 39 | + ret.push(property); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + }); | ||
| 43 | + return ret; | ||
| 44 | + | ||
| 45 | + }, | ||
| 46 | + | ||
| 47 | + initialize: function(args) { | ||
| 48 | + | ||
| 49 | + this.workspace = args.workspace; | ||
| 50 | + | ||
| 51 | + // Create a unique ID for use as the CSS selector | ||
| 52 | + this.id = _.uniqueId("chart_"); | ||
| 53 | + $(this.el).attr({ id: this.id }); | ||
| 54 | + //$('<div id="nav_' + this.id + '">' + "<input type='submit' class='keep' value='keep only selected' />" + '</div>').appendTo($(this.el)); | ||
| 55 | + $('<div class="canvas_wrapper" style="display:none;"><div id="canvas_' + this.id + '"></div></div>').appendTo($(this.el)); | ||
| 56 | + | ||
| 57 | + this.cccOptions.canvas = 'canvas_' + this.id; | ||
| 58 | + this.cccOptions = this.getQuickOptions(this.cccOptions); | ||
| 59 | + | ||
| 60 | + this.data = null; | ||
| 61 | + | ||
| 62 | + // Bind table rendering to query result event | ||
| 63 | + _.bindAll(this, "receive_data", "process_data", "show", "getData", "render_view", "render_chart", "render_chart_delayed", "getQuickOptions","exportChart","block_ui"); | ||
| 64 | + var self = this; | ||
| 65 | + this.workspace.bind('query:run', function() { | ||
| 66 | + if (! $(self.workspace.querytoolbar.el).find('.render_chart').hasClass('on')) { | ||
| 67 | + return false; | ||
| 68 | + } | ||
| 69 | + self.data = {}; | ||
| 70 | + self.data.resultset = []; | ||
| 71 | + self.data.metadata = []; | ||
| 72 | + $(self.el).find('.canvas_wrapper').hide(); | ||
| 73 | + return false; | ||
| 74 | + }); | ||
| 75 | + | ||
| 76 | + this.workspace.bind('query:fetch', this.block_ui); | ||
| 77 | + | ||
| 78 | + this.workspace.bind('query:result', this.receive_data); | ||
| 79 | + | ||
| 80 | + var pseudoForm = "<div id='nav" + this.id + "' style='display:none' class='nav'><form id='svgChartPseudoForm' target='_blank' method='POST'>" + | ||
| 81 | + "<input type='hidden' name='type' class='type'/>" + | ||
| 82 | + "<input type='hidden' name='svg' class='svg'/>" + | ||
| 83 | + "</form></div>"; | ||
| 84 | + if (isIE) { | ||
| 85 | + pseudoForm = "<div></div>"; | ||
| 86 | + } | ||
| 87 | + this.nav =$(pseudoForm); | ||
| 88 | + | ||
| 89 | + $(this.el).append(this.nav); | ||
| 90 | + | ||
| 91 | + /* | ||
| 92 | + // Create navigation | ||
| 93 | + var exportoptions = "<div><a class='hide' href='#charteditor' id='acharteditor' /><!--<a class='editor' href='#chart_editor'>Advanced Properties</a>-->Export to: " + | ||
| 94 | + "<a class='export' href='#png' class='i18n'>PNG</a>, " + | ||
| 95 | + "<a class='export' href='#pdf' class='i18n'>PDF</a>, " + | ||
| 96 | + //"<a class='export' href='#tiff' class='i18n'>TIFF</a>, " + | ||
| 97 | + "<a class='export' href='#svg' class='i18n'>SVG</a>, " + | ||
| 98 | + "<a class='export' href='#jpg' class='i18n'>JPG</a>" + | ||
| 99 | + "<form id='svgChartPseudoForm' target='_blank' method='POST'>" + | ||
| 100 | + "<input type='hidden' name='type' class='type'/>" + | ||
| 101 | + "<input type='hidden' name='svg' class='svg'/>" + | ||
| 102 | + "</form>"; | ||
| 103 | + | ||
| 104 | + var chartnav = exportoptions + "</div>"; | ||
| 105 | + if (typeof isIE !== "undefined") { | ||
| 106 | + chartnav = "<div></div>"; | ||
| 107 | + } | ||
| 108 | + // Create navigation | ||
| 109 | + this.nav = $(chartnav).css({ | ||
| 110 | + 'padding-bottom': '10px' | ||
| 111 | + }); | ||
| 112 | + this.nav.find('a.type').css({ | ||
| 113 | + color: '#666', | ||
| 114 | + 'margin-right': '5px', | ||
| 115 | + 'text-decoration': 'none', | ||
| 116 | + 'border': '1px solid #ccc', | ||
| 117 | + padding: '5px' | ||
| 118 | + }); | ||
| 119 | + | ||
| 120 | + this.nav.find('a.export').click(this.exportChart); | ||
| 121 | + | ||
| 122 | + | ||
| 123 | + this.nav.find('a').css({ | ||
| 124 | + color: '#666', | ||
| 125 | + 'margin-right': '5px', | ||
| 126 | + 'text-decoration': 'none', | ||
| 127 | + 'border': '1px solid #ccc', | ||
| 128 | + padding: '5px' | ||
| 129 | + }); | ||
| 130 | + */ | ||
| 131 | + /* XXX - enable again later | ||
| 132 | + $(this.nav).append('<div style="display:none;"> <div id="charteditor" class="chart_editor"></div></div>'); | ||
| 133 | + | ||
| 134 | + this.editor = new ChartEditor({ workspace : this.workspace, | ||
| 135 | + ChartProperties : ChartProperties, | ||
| 136 | + ChartTypes: ChartTypes, | ||
| 137 | + data : this.getData, | ||
| 138 | + getChartProperties : this.getChartProperties}); | ||
| 139 | + | ||
| 140 | + $(this.nav).find('.chart_editor').append($(this.editor.el)); | ||
| 141 | + */ | ||
| 142 | + | ||
| 143 | + }, | ||
| 144 | + | ||
| 145 | + | ||
| 146 | + block_ui: function() { | ||
| 147 | + if (! $(this.workspace.querytoolbar.el).find('.render_chart').hasClass('on')) { | ||
| 148 | + return; | ||
| 149 | + } | ||
| 150 | + //Saiku.ui.block("Updating chart data...."); | ||
| 151 | + }, | ||
| 152 | + | ||
| 153 | + exportChart: function(type) { | ||
| 154 | + var svgContent = new XMLSerializer().serializeToString($('svg')[0]); | ||
| 155 | + var rep = '<svg xmlns="http://www.w3.org/2000/svg" '; | ||
| 156 | + if (svgContent.substr(0,rep.length) != rep) { | ||
| 157 | + svgContent = svgContent.replace('<svg ', rep); | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + var form = $('#svgChartPseudoForm'); | ||
| 161 | + form.find('.type').val(type); | ||
| 162 | + form.find('.svg').val(svgContent); | ||
| 163 | + form.attr('action', Settings.REST_URL + this.workspace.query.url() + escape("/../../export/saiku/chart")); | ||
| 164 | + form.submit(); | ||
| 165 | + return false; | ||
| 166 | + }, | ||
| 167 | + | ||
| 168 | + render_view: function() { | ||
| 169 | + // Append chart to workspace | ||
| 170 | + $(this.workspace.el).find('.workspace_results') | ||
| 171 | + .prepend($(this.el).hide()); | ||
| 172 | + }, | ||
| 173 | + | ||
| 174 | + getData: function() { | ||
| 175 | + return this.data; | ||
| 176 | + }, | ||
| 177 | + | ||
| 178 | + show: function(event, ui) { | ||
| 179 | + /* | ||
| 180 | + if ('MODE' in Settings && Settings.MODE == 'table') { | ||
| 181 | + $(this.nav).hide(); | ||
| 182 | + } else { | ||
| 183 | + $(this.nav).show(); | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + $('a#acharteditor').fancybox( | ||
| 187 | + { | ||
| 188 | + 'autoDimensions' : false, | ||
| 189 | + 'autoScale' : false, | ||
| 190 | + 'height' : ($("body").height() - 140), | ||
| 191 | + 'width' : ($("body").width() - 100), | ||
| 192 | + 'transitionIn' : 'none', | ||
| 193 | + 'transitionOut' : 'none', | ||
| 194 | + 'type' : 'inline' | ||
| 195 | + } | ||
| 196 | + ); | ||
| 197 | + */ | ||
| 198 | + if (this.cccOptions.width <= 0) { | ||
| 199 | + this.cccOptions.width = $(this.workspace.el).find('.workspace_results').width() - 40; | ||
| 200 | + } | ||
| 201 | + if (this.cccOptions.height <= 0) { | ||
| 202 | + this.cccOptions.height = $(this.workspace.el).find('.workspace_results').height() - 40; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + $(this.el).show(); | ||
| 206 | + | ||
| 207 | + var hasRun = this.workspace.query.result.hasRun(); | ||
| 208 | + if (hasRun) { | ||
| 209 | + this.process_data({ data: this.workspace.query.result.lastresult() }); | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + }, | ||
| 213 | + | ||
| 214 | + chart_editor: function() { | ||
| 215 | + $('a#acharteditor').click(); | ||
| 216 | + return true; | ||
| 217 | + }, | ||
| 218 | + | ||
| 219 | + export_button: function(event) { | ||
| 220 | + var self = this; | ||
| 221 | + $target = $(event.target).hasClass('button') ? $(event.target) : $(event.target).parent(); | ||
| 222 | + | ||
| 223 | + var self = this; | ||
| 224 | + $body = $(document); | ||
| 225 | + //$body.off('.contextMenu .contextMenuAutoHide'); | ||
| 226 | + //$('.context-menu-list').remove(); | ||
| 227 | + $.contextMenu('destroy', '.export_button'); | ||
| 228 | + $.contextMenu({ | ||
| 229 | + selector: '.export_button', | ||
| 230 | + trigger: 'left', | ||
| 231 | + ignoreRightClick: true, | ||
| 232 | + callback: function(key, options) { | ||
| 233 | + self.workspace.chart.exportChart(key); | ||
| 234 | + }, | ||
| 235 | + items: { | ||
| 236 | + "png": {name: "PNG"}, | ||
| 237 | + "jpg": {name: "JPEG"}, | ||
| 238 | + "pdf": {name: "PDF"}, | ||
| 239 | + "svg": {name: "SVG"} | ||
| 240 | + } | ||
| 241 | + }); | ||
| 242 | + $target.contextMenu(); | ||
| 243 | + }, | ||
| 244 | + | ||
| 245 | + button: function(event) { | ||
| 246 | + $target = $(event.target).hasClass('button') ? $(event.target) : $(event.target).parent(); | ||
| 247 | + if ($target.hasClass('chartoption')) { | ||
| 248 | + $target.parent().siblings().find('.chartoption.on').removeClass('on'); | ||
| 249 | + $target.addClass('on'); | ||
| 250 | + if ($(this.workspace.querytoolbar.el).find('.render_chart').hasClass('on')) { | ||
| 251 | + $(this.el).find('.canvas_wrapper').hide(); | ||
| 252 | + } | ||
| 253 | + | ||
| 254 | + | ||
| 255 | + } | ||
| 256 | + return false; | ||
| 257 | + }, | ||
| 258 | + | ||
| 259 | + stackedBar: function() { | ||
| 260 | + this.workspace.query.setProperty('saiku.ui.render.type', 'stackedBar'); | ||
| 261 | + var options = { | ||
| 262 | + stacked: true, | ||
| 263 | + type: "BarChart" | ||
| 264 | + }; | ||
| 265 | + this.cccOptions = this.getQuickOptions(options); | ||
| 266 | + this.render_chart(); | ||
| 267 | + }, | ||
| 268 | + | ||
| 269 | + bar: function() { | ||
| 270 | + this.workspace.query.setProperty('saiku.ui.render.type', 'bar'); | ||
| 271 | + var options = { | ||
| 272 | + type: "BarChart" | ||
| 273 | + }; | ||
| 274 | + this.cccOptions = this.getQuickOptions(options); | ||
| 275 | + this.render_chart(); | ||
| 276 | + /* | ||
| 277 | + this.cccOptions.multiChartIndexes = [1]; | ||
| 278 | + this.cccOptions.dataMeasuresInColumns = true; | ||
| 279 | + this.cccOptions.orientation = 'vertical'; | ||
| 280 | + this.cccOptions.smallTitlePosition = 'left'; | ||
| 281 | + //this.cccOptions.multiChartColumnsMax = 5; | ||
| 282 | + this.cccOptions.smallWidth = 300; | ||
| 283 | + this.cccOptions.smallHeight = 100; | ||
| 284 | + */ | ||
| 285 | + }, | ||
| 286 | + | ||
| 287 | + multiplebar: function() { | ||
| 288 | + this.workspace.query.setProperty('saiku.ui.render.type', 'multiplebar'); | ||
| 289 | + var options = { | ||
| 290 | + type: "BarChart", | ||
| 291 | + multiChartIndexes: [1], | ||
| 292 | + dataMeasuresInColumns: true, | ||
| 293 | + orientation: "vertical", | ||
| 294 | + smallTitlePosition: "top", | ||
| 295 | + multiChartMax: 30, | ||
| 296 | + multiChartColumnsMax: Math.floor( this.cccOptions.width / 200), | ||
| 297 | + smallWidth: 200, | ||
| 298 | + smallHeight: 150 | ||
| 299 | + | ||
| 300 | + }; | ||
| 301 | + this.cccOptions = this.getQuickOptions(options); | ||
| 302 | + this.render_chart(); | ||
| 303 | + }, | ||
| 304 | + | ||
| 305 | + line: function() { | ||
| 306 | + this.workspace.query.setProperty('saiku.ui.render.type', 'line'); | ||
| 307 | + var options = { | ||
| 308 | + type: "LineChart" | ||
| 309 | + }; | ||
| 310 | + | ||
| 311 | + this.cccOptions = this.getQuickOptions(options); | ||
| 312 | + this.render_chart(); | ||
| 313 | + }, | ||
| 314 | + | ||
| 315 | + pie: function() { | ||
| 316 | + this.workspace.query.setProperty('saiku.ui.render.type', 'pie'); | ||
| 317 | + var options = { | ||
| 318 | + type: "PieChart", | ||
| 319 | + multiChartIndexes: [0] // ideally this would be chosen by the user (count, which) | ||
| 320 | + }; | ||
| 321 | + this.cccOptions = this.getQuickOptions(options); | ||
| 322 | + this.render_chart(); | ||
| 323 | + }, | ||
| 324 | + | ||
| 325 | + heatgrid: function() { | ||
| 326 | + this.workspace.query.setProperty('saiku.ui.render.type', 'heatgrid'); | ||
| 327 | + var options = { | ||
| 328 | + type: "HeatGridChart" | ||
| 329 | + }; | ||
| 330 | + this.cccOptions = this.getQuickOptions(options); | ||
| 331 | + this.render_chart(); | ||
| 332 | + }, | ||
| 333 | + | ||
| 334 | + stackedBar100: function() { | ||
| 335 | + this.workspace.query.setProperty('saiku.ui.render.type', 'stackedBar100'); | ||
| 336 | + var options = { | ||
| 337 | + type: "NormalizedBarChart" | ||
| 338 | + }; | ||
| 339 | + this.cccOptions = this.getQuickOptions(options); | ||
| 340 | + this.render_chart(); | ||
| 341 | + }, | ||
| 342 | + | ||
| 343 | + area: function() { | ||
| 344 | + this.workspace.query.setProperty('saiku.ui.render.type', 'area'); | ||
| 345 | + var options = { | ||
| 346 | + type: "StackedAreaChart" | ||
| 347 | + }; | ||
| 348 | + this.cccOptions = this.getQuickOptions(options); | ||
| 349 | + this.render_chart(); | ||
| 350 | + }, | ||
| 351 | + dot: function() { | ||
| 352 | + this.workspace.query.setProperty('saiku.ui.render.type', 'dot'); | ||
| 353 | + var options = { | ||
| 354 | + type: "DotChart" | ||
| 355 | + }; | ||
| 356 | + this.cccOptions = this.getQuickOptions(options); | ||
| 357 | + this.render_chart(); | ||
| 358 | + }, | ||
| 359 | + waterfall: function() { | ||
| 360 | + this.workspace.query.setProperty('saiku.ui.render.type', 'waterfall'); | ||
| 361 | + var options = { | ||
| 362 | + type: "WaterfallChart" | ||
| 363 | + }; | ||
| 364 | + this.cccOptions = this.getQuickOptions(options); | ||
| 365 | + this.render_chart(); | ||
| 366 | + }, | ||
| 367 | + | ||
| 368 | + keepVisible: function(event) { | ||
| 369 | + | ||
| 370 | + | ||
| 371 | + var chart = this.chart.root; | ||
| 372 | + var data = chart.data; | ||
| 373 | + | ||
| 374 | + data | ||
| 375 | + .datums(null, {selected: false}) | ||
| 376 | + .each(function(datum) { | ||
| 377 | + datum.setVisible(false); | ||
| 378 | + }); | ||
| 379 | + | ||
| 380 | + data.clearSelected(); | ||
| 381 | + | ||
| 382 | + chart.render(true, true, false); | ||
| 383 | + | ||
| 384 | + | ||
| 385 | + }, | ||
| 386 | + | ||
| 387 | + // Default static style-sheet | ||
| 388 | + cccOptionsDefault: { | ||
| 389 | + Base: { | ||
| 390 | + animate: false, | ||
| 391 | + selectable: true, | ||
| 392 | + valuesVisible: false, | ||
| 393 | + legend: true, | ||
| 394 | + legendPosition: "top", | ||
| 395 | + legendAlign: "right", | ||
| 396 | + legendSizeMax: "30%", | ||
| 397 | + axisSizeMax: "40%", | ||
| 398 | + plotFrameVisible : false, | ||
| 399 | + orthoAxisMinorTicks : false, | ||
| 400 | + colors: ["#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ] | ||
| 401 | +/* | ||
| 402 | +"#B12623", | ||
| 403 | +"#ff8585", | ||
| 404 | +"#009bff", | ||
| 405 | +"#1f77b4", | ||
| 406 | +"#ff5900", | ||
| 407 | +"#ffbb9e", | ||
| 408 | +"#750000", | ||
| 409 | +"#cecece", | ||
| 410 | +"#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ] | ||
| 411 | + */ | ||
| 412 | + }, | ||
| 413 | + | ||
| 414 | + HeatGridChart: { | ||
| 415 | + orientation: "horizontal", | ||
| 416 | + useShapes: true, | ||
| 417 | + shape: "circle", | ||
| 418 | + nullShape: "cross", | ||
| 419 | + colorNormByCategory: false, | ||
| 420 | + sizeRole: "value", | ||
| 421 | + legend: false, | ||
| 422 | + hoverable: true, | ||
| 423 | + axisComposite: true, | ||
| 424 | + colors: ["red", "yellow", "lightgreen", "darkgreen"], | ||
| 425 | + xAxisSize: 130, | ||
| 426 | + yAxisSize: 130 | ||
| 427 | + }, | ||
| 428 | + | ||
| 429 | + WaterfallChart: { | ||
| 430 | + orientation: "horizontal" | ||
| 431 | + }, | ||
| 432 | + | ||
| 433 | + PieChart: { | ||
| 434 | + multiChartColumnsMax: 3, | ||
| 435 | + multiChartMax: 30, | ||
| 436 | + smallTitleFont: "bold 14px sans-serif", | ||
| 437 | + valuesVisible: true, | ||
| 438 | + valuesMask: "{value.percent}", | ||
| 439 | + explodedSliceRadius: "10%", | ||
| 440 | + extensionPoints: { | ||
| 441 | + slice_innerRadiusEx: '40%', | ||
| 442 | + slice_offsetRadius: function(scene) { | ||
| 443 | + return scene.isSelected() ? '10%' : 0; | ||
| 444 | + } | ||
| 445 | + }, | ||
| 446 | + clickable: true | ||
| 447 | + //valuesLabelStyle: 'inside' | ||
| 448 | + }, | ||
| 449 | + | ||
| 450 | + LineChart: { | ||
| 451 | + extensionPoints: { | ||
| 452 | + area_interpolate: "monotone", // cardinal | ||
| 453 | + line_interpolate: "monotone" | ||
| 454 | + } | ||
| 455 | + }, | ||
| 456 | + | ||
| 457 | + StackedAreaChart: { | ||
| 458 | + extensionPoints: { | ||
| 459 | + area_interpolate: "monotone", | ||
| 460 | + line_interpolate: "monotone" | ||
| 461 | + } | ||
| 462 | + } | ||
| 463 | + }, | ||
| 464 | + | ||
| 465 | + getQuickOptions: function(baseOptions) { | ||
| 466 | + var chartType = (baseOptions && baseOptions.type) || "BarChart"; | ||
| 467 | + var workspaceResults = $(this.workspace.el).find(".workspace_results"); | ||
| 468 | + var options = _.extend({ | ||
| 469 | + type: chartType, | ||
| 470 | + canvas: 'canvas_' + this.id, | ||
| 471 | + width: workspaceResults.width() - 40, | ||
| 472 | + height: workspaceResults.height() - 40 | ||
| 473 | + }, | ||
| 474 | + this.cccOptionsDefault.Base, | ||
| 475 | + this.cccOptionsDefault[chartType], // may be undefined | ||
| 476 | + baseOptions); | ||
| 477 | + | ||
| 478 | + if(this.data != null && this.data.resultset.length > 5) { | ||
| 479 | + if(options.type === "HeatGridChart") { | ||
| 480 | + options.xAxisSize = 150; | ||
| 481 | + } else if(options.orientation !== "horizontal") { | ||
| 482 | + options.extensionPoints = _.extend(Object.create(options.extensionPoints || {}), | ||
| 483 | + { | ||
| 484 | + xAxisLabel_textAngle: -Math.PI/2, | ||
| 485 | + xAxisLabel_textAlign: "right", | ||
| 486 | + xAxisLabel_textBaseline: "middle" | ||
| 487 | + }); | ||
| 488 | + } | ||
| 489 | + } | ||
| 490 | + | ||
| 491 | + return options; | ||
| 492 | + }, | ||
| 493 | + | ||
| 494 | + render_chart: function() { | ||
| 495 | + _.delay(this.render_chart_delayed, 0, this); | ||
| 496 | + return false; | ||
| 497 | + }, | ||
| 498 | + | ||
| 499 | + render_chart_delayed: function() { | ||
| 500 | + if (!$(this.workspace.querytoolbar.el).find('.render_chart').hasClass('on') || !this.hasProcessed) { | ||
| 501 | + return; | ||
| 502 | + } | ||
| 503 | + $(this.workspace.toolbar.el).find('.i3GeoMap').removeClass('on'); | ||
| 504 | +/* DEBUGGING | ||
| 505 | +this.med = new Date().getTime(); | ||
| 506 | +$(this.el).prepend(" | chart render (" + (this.med - this.call_time) + ")" ); | ||
| 507 | +this.call_time = undefined; | ||
| 508 | +*/ | ||
| 509 | + var workspaceResults = $(this.workspace.el).find(".workspace_results"); | ||
| 510 | + var isSmall = (this.data != null && this.data.height < 80 && this.data.width < 80); | ||
| 511 | + var isMedium = (this.data != null && this.data.height < 300 && this.data.width < 300); | ||
| 512 | + var isBig = (!isSmall && !isMedium); | ||
| 513 | + var animate = false; | ||
| 514 | + var hoverable = isSmall; | ||
| 515 | + | ||
| 516 | + var runtimeChartDefinition = _.clone(this.cccOptions); | ||
| 517 | + if (isBig) { | ||
| 518 | + if (runtimeChartDefinition.hasOwnProperty('extensionPoints') && runtimeChartDefinition.extensionPoints.hasOwnProperty('line_interpolate')) | ||
| 519 | + delete runtimeChartDefinition.extensionPoints.line_interpolate; | ||
| 520 | + if (runtimeChartDefinition.hasOwnProperty('extensionPoints') && runtimeChartDefinition.extensionPoints.hasOwnProperty('area_interpolate')) | ||
| 521 | + delete runtimeChartDefinition.extensionPoints.area_interpolate; | ||
| 522 | + } | ||
| 523 | + runtimeChartDefinition = _.extend(runtimeChartDefinition, { | ||
| 524 | + width: workspaceResults.width() - 40, | ||
| 525 | + height: workspaceResults.height() - 40, | ||
| 526 | + hoverable: hoverable, | ||
| 527 | + animate: animate | ||
| 528 | + }); | ||
| 529 | + | ||
| 530 | + /* XXX - enable later | ||
| 531 | + var start = new Date().getTime(); | ||
| 532 | + this.editor.chartDefinition = _.clone(this.cccOptions); | ||
| 533 | + this.editor.set_chart("pvc." + this.cccOptions.type); | ||
| 534 | + this.editor.render_chart_properties("pvc." + this.cccOptions.type, this.editor.chartDefinition); | ||
| 535 | + */ | ||
| 536 | + | ||
| 537 | + this.chart = new pvc[runtimeChartDefinition.type](runtimeChartDefinition); | ||
| 538 | +/* DEBUGGING | ||
| 539 | +this.med3 = new Date().getTime(); | ||
| 540 | +$(this.el).prepend(" pvc (" + (this.med3 - this.med) + ")" ); | ||
| 541 | +*/ | ||
| 542 | + | ||
| 543 | + this.chart.setData(this.data, { | ||
| 544 | + crosstabMode: true, | ||
| 545 | + seriesInRows: false | ||
| 546 | + }); | ||
| 547 | + | ||
| 548 | + try { | ||
| 549 | + if (animate) { | ||
| 550 | + $(this.el).find('.canvas_wrapper').show(); | ||
| 551 | + } | ||
| 552 | + this.chart.render(); | ||
| 553 | +/* DEBUGGING | ||
| 554 | + var med2 = new Date().getTime(); | ||
| 555 | + $(this.el).prepend(" done (" + (med2 - this.med) + ")" ); | ||
| 556 | +*/ | ||
| 557 | + } catch (e) { | ||
| 558 | + $(this.el).text("Could not render chart"); | ||
| 559 | + } | ||
| 560 | + this.workspace.processing.hide(); | ||
| 561 | + this.workspace.adjust(); | ||
| 562 | + if (animate) { | ||
| 563 | + return false; | ||
| 564 | + } | ||
| 565 | + // $('#nav_' + this.id).show(); | ||
| 566 | + if (isIE || isBig) { | ||
| 567 | + $(this.el).find('.canvas_wrapper').show(); | ||
| 568 | + } else { | ||
| 569 | + $(this.el).find('.canvas_wrapper').fadeIn(400); | ||
| 570 | + } | ||
| 571 | + return false; | ||
| 572 | + }, | ||
| 573 | + | ||
| 574 | + receive_data: function(args) { | ||
| 575 | + if (! $(this.workspace.querytoolbar.el).find('.render_chart').hasClass('on')) { | ||
| 576 | + return; | ||
| 577 | + } | ||
| 578 | + return _.delay(this.process_data, 0, args); | ||
| 579 | + | ||
| 580 | + }, | ||
| 581 | + | ||
| 582 | + process_data: function(args) { | ||
| 583 | + this.data = {}; | ||
| 584 | + this.data.resultset = []; | ||
| 585 | + this.data.metadata = []; | ||
| 586 | + this.data.height = 0; | ||
| 587 | + this.data.width = 0; | ||
| 588 | + | ||
| 589 | + if (typeof args == "undefined" || typeof args.data == "undefined" || | ||
| 590 | + ($(this.workspace.el).is(':visible') && !$(this.el).is(':visible'))) { | ||
| 591 | + return; | ||
| 592 | + } | ||
| 593 | + | ||
| 594 | + if (args.data != null && args.data.error != null) { | ||
| 595 | + return this.workspace.error(args); | ||
| 596 | + } | ||
| 597 | + // Check to see if there is data | ||
| 598 | + if (args.data == null || (args.data.cellset && args.data.cellset.length === 0)) { | ||
| 599 | + return this.workspace.no_results(args); | ||
| 600 | + } | ||
| 601 | + | ||
| 602 | + var cellset = args.data.cellset; | ||
| 603 | + if (cellset && cellset.length > 0) { | ||
| 604 | +/* DEBUGGING | ||
| 605 | +var start = new Date().getTime(); | ||
| 606 | +this.call_time = start; | ||
| 607 | +$(this.el).prepend(" | chart process"); | ||
| 608 | +*/ | ||
| 609 | + var lowest_level = 0; | ||
| 610 | + var data_start = 0; | ||
| 611 | + for (var row = 0; data_start == 0 && row < cellset.length; row++) { | ||
| 612 | + this.data.metadata = []; | ||
| 613 | + for (var field = 0; field < cellset[row].length; field++) { | ||
| 614 | + var firstHeader = []; | ||
| 615 | + | ||
| 616 | + while (cellset[row][field].type == "COLUMN_HEADER" && cellset[row][field].value == "null") { | ||
| 617 | + row++; | ||
| 618 | + } | ||
| 619 | + if (cellset[row][field].type == "ROW_HEADER_HEADER") { | ||
| 620 | + | ||
| 621 | + while(cellset[row][field].type == "ROW_HEADER_HEADER") { | ||
| 622 | + firstHeader.push(cellset[row][field].value); | ||
| 623 | + field++; | ||
| 624 | + } | ||
| 625 | + | ||
| 626 | + this.data.metadata.push({ | ||
| 627 | + colIndex: 0, | ||
| 628 | + colType: "String", | ||
| 629 | + colName: firstHeader.join('/') | ||
| 630 | + }); | ||
| 631 | + lowest_level = field - 1; | ||
| 632 | + } | ||
| 633 | + if (cellset[row][field].type == "COLUMN_HEADER" && cellset[row][field].value != "null") { | ||
| 634 | + var lowest_col_header = 0; | ||
| 635 | + var colheader = []; | ||
| 636 | + while(lowest_col_header <= row) { | ||
| 637 | + colheader.push(cellset[lowest_col_header][field].value); | ||
| 638 | + lowest_col_header++; | ||
| 639 | + } | ||
| 640 | + this.data.metadata.push({ | ||
| 641 | + colIndex: field - lowest_level + 1, | ||
| 642 | + colType: "Numeric", | ||
| 643 | + colName: colheader.join('/') | ||
| 644 | + }); | ||
| 645 | + | ||
| 646 | + data_start = row+1; | ||
| 647 | + } | ||
| 648 | + } | ||
| 649 | + } | ||
| 650 | + var labelsSet = {}; | ||
| 651 | + for (var row = data_start; row < cellset.length; row++) { | ||
| 652 | + if (cellset[row][0].value !== "") { | ||
| 653 | + var record = []; | ||
| 654 | + this.data.width = cellset[row].length - lowest_level + 1; | ||
| 655 | + var label = ""; | ||
| 656 | + for (var labelCol = lowest_level; labelCol >= 0; labelCol--) { | ||
| 657 | + var lastKnownUpperLevelRow = row; | ||
| 658 | + while(cellset[lastKnownUpperLevelRow] && cellset[lastKnownUpperLevelRow][labelCol].value === 'null') { | ||
| 659 | + --lastKnownUpperLevelRow; | ||
| 660 | + } | ||
| 661 | + if(cellset[lastKnownUpperLevelRow]) { | ||
| 662 | + if (label == "") { | ||
| 663 | + label = cellset[lastKnownUpperLevelRow][labelCol].value; | ||
| 664 | + } else { | ||
| 665 | + label = cellset[lastKnownUpperLevelRow][labelCol].value + " / " + label; | ||
| 666 | + } | ||
| 667 | + } | ||
| 668 | + } | ||
| 669 | + if(label in labelsSet) { | ||
| 670 | + labelsSet[label] = labelsSet[label]+1; | ||
| 671 | + label = label + ' [' + (labelsSet[label] + 1) + ']'; | ||
| 672 | + } else { | ||
| 673 | + labelsSet[label] = 0; | ||
| 674 | + } | ||
| 675 | + record.push(label); | ||
| 676 | + | ||
| 677 | + for (var col = lowest_level + 1; col < cellset[row].length; col++) { | ||
| 678 | + var cell = cellset[row][col]; | ||
| 679 | + var value = cell.value || 0; | ||
| 680 | + // check if the resultset contains the raw value, if not try to parse the given value | ||
| 681 | + var raw = cell.properties.raw; | ||
| 682 | + if (raw && raw !== "null") { | ||
| 683 | + value = parseFloat(raw); | ||
| 684 | + } else if (typeof(cell.value) !== "number" && parseFloat(cell.value.replace(/[^a-zA-Z 0-9.]+/g,''))) { | ||
| 685 | + value = parseFloat(cell.value.replace(/[^a-zA-Z 0-9.]+/g,'')); | ||
| 686 | + } | ||
| 687 | + record.push(value); | ||
| 688 | + } | ||
| 689 | + this.data.resultset.push(record); | ||
| 690 | + } | ||
| 691 | + } | ||
| 692 | + //makeSureUniqueLabels(this.data.resultset); | ||
| 693 | + this.hasProcessed = true; | ||
| 694 | + this.data.height = this.data.resultset.length; | ||
| 695 | + this.cccOptions = this.getQuickOptions(this.cccOptions); | ||
| 696 | + this.render_chart(); | ||
| 697 | + } else { | ||
| 698 | + $(this.el).find('.canvas_wrapper').text("No results").show(); | ||
| 699 | + this.workspace.processing.hide(); | ||
| 700 | + this.workspace.adjust(); | ||
| 701 | + } | ||
| 702 | + } | ||
| 703 | +}); | ||
| 704 | + | ||
| 705 | + |
ferramentas/saiku/saiku-server/tomcat/webapps/ROOT/js/saiku/plugins/i3GeoMap/README.md
0 → 100755
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +Saiku Chart Plus | ||
| 2 | + | ||
| 3 | +Welcome to Saiku Chart Plus Project. | ||
| 4 | + | ||
| 5 | +What is Saiku Chart Plus? | ||
| 6 | + | ||
| 7 | +It is an open source project that helps Pentaho BI users to create other types of charts and maps based on Saiku Project, Highcharts and Google Maps. | ||
| 8 | + | ||
| 9 | +To learn more visit our page http://it4biz.github.com/SaikuChartPlus/ | ||
| 10 | + | ||
| 11 | +Direct link to download Saiku Chart Plus: | ||
| 12 | +http://sourceforge.net/projects/saikuchartplus/files/SaikuChartPlus2.4/saikuchartsplus-plugin-2.4-RC1.zip/download |
ferramentas/saiku/saiku-server/tomcat/webapps/ROOT/js/saiku/plugins/i3GeoMap/chart.png
0 → 100755
3.31 KB
ferramentas/saiku/saiku-server/tomcat/webapps/ROOT/js/saiku/plugins/i3GeoMap/map.png
0 → 100755
1.13 KB
ferramentas/saiku/saiku-server/tomcat/webapps/ROOT/js/saiku/plugins/i3GeoMap/mapa.png
0 → 100644
1.23 KB
ferramentas/saiku/saiku-server/tomcat/webapps/ROOT/js/saiku/plugins/i3GeoMap/plugin.js
0 → 100644
| @@ -0,0 +1,713 @@ | @@ -0,0 +1,713 @@ | ||
| 1 | +/* | ||
| 2 | + * Esse plugin e parte do software livre i3Geo | ||
| 3 | + * | ||
| 4 | + * Baseado em ChartPlus IT4biz IT Solutions Ltda | ||
| 5 | + * | ||
| 6 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 7 | + * you may not use this file except in compliance with the License. | ||
| 8 | + * You may obtain a copy of the License at | ||
| 9 | + * | ||
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 11 | + * | ||
| 12 | + * Unless required by applicable law or agreed to in writing, software | ||
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 15 | + * See the License for the specific language governing permissions and | ||
| 16 | + * limitations under the License. | ||
| 17 | + * changed by edmar.moretti@gmail.com | ||
| 18 | + */ | ||
| 19 | + | ||
| 20 | +var i3GeoMap = Backbone.View.extend({ | ||
| 21 | + opcoes: {cores:"",size:0,tipo:"",indicecoluna:"",cores:"",coluna:"",locaplic:"",outlinecolor:""}, | ||
| 22 | + coreshex: ["#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ], | ||
| 23 | + initialize: function(args) { | ||
| 24 | + this.workspace = args.workspace; | ||
| 25 | + | ||
| 26 | + // Create a unique ID for use as the CSS selector | ||
| 27 | + this.id = _.uniqueId("i3GeoMap_"); | ||
| 28 | + $(this.el).attr({ id: this.id }); | ||
| 29 | + | ||
| 30 | + // Bind map rendering to query result event | ||
| 31 | + _.bindAll(this, "render", "receive_data", "process_data", "show", | ||
| 32 | + "setOptions"); | ||
| 33 | + | ||
| 34 | + this.workspace.bind('query:result', this.receive_data); | ||
| 35 | + | ||
| 36 | + // Add chart button | ||
| 37 | + this.add_button(); | ||
| 38 | + this.workspace.toolbar.i3GeoMap = this.show; | ||
| 39 | + | ||
| 40 | + // Listen to adjust event and rerender chart | ||
| 41 | + //this.workspace.bind('workspace:adjust', this.render); | ||
| 42 | + // Create navigation | ||
| 43 | + this.nav = $("" + | ||
| 44 | + "<div style='overflow: hidden;padding: 10px 5px;' >"+ | ||
| 45 | + "<div class='fields_list' style='height:34px;'>"+ | ||
| 46 | + "<div class='fields_list_header limit'><span class='i18n_translated'>Mapa</span></div>"+ | ||
| 47 | + "<div class='fields_list_body filter' style='margin:4px 5px 5px 5px'>"+ | ||
| 48 | + //"<ul class='connectable ui-sortable' style=''>"+ | ||
| 49 | + "<input type=button name=mapaBarras value='Barras' />"+ | ||
| 50 | + "<input type=button name=mapaPizzas value='Pizzas' />"+ | ||
| 51 | + " <input type=button name=raiosProporcionais value='Raios proporcionais' />"+ | ||
| 52 | + " <input type=button name=circulosProporcionais value='Círculos proporcionais' />"+ | ||
| 53 | + " <input type=button name=coresChapadas value='Cores' />"+ | ||
| 54 | + " <input type=button name=atualizarMapa value='Atualiza' />"+ | ||
| 55 | + " <input type=button name=fecharMapa value='Fechar' />"+ | ||
| 56 | + //"</ul>"+ | ||
| 57 | + "</div>"+ | ||
| 58 | + "</div>"+ | ||
| 59 | + "</div>"+ | ||
| 60 | + "<div id='message'></div>"+ | ||
| 61 | + "<form id='formi3GeoMap' method='post' target='iframei3GeoMap' action='"+parametroUrl("locaplic")+"/ferramentas/saiku/cartograma.php' >"+ | ||
| 62 | + "<input type=hidden name=opcoes id=formi3GeoMapOpcoes value='' />"+ | ||
| 63 | + "<input type=hidden name=g_sid id=formi3GeoMapg_sid value='"+parametroUrl("g_sid")+"' />"+ | ||
| 64 | + "<input type=hidden name=dados id=formi3GeoMapdados value='' />"+ | ||
| 65 | + "<input type=hidden name=metadados id=formi3GeoMapmetadados value='' />"+ | ||
| 66 | + "</form>" + | ||
| 67 | + "<iframe id='iframei3GeoMap' name='iframei3GeoMap' style='width:100%;height:200px;display:block' />" | ||
| 68 | + ); | ||
| 69 | + this.nav.find('input').click(this.setOptions); | ||
| 70 | + | ||
| 71 | + // Append chart to workspace | ||
| 72 | + $(this.workspace.el).find('.workspace_results') | ||
| 73 | + .prepend($(this.el).hide()) | ||
| 74 | + .prepend(this.nav.hide()); | ||
| 75 | + }, | ||
| 76 | + add_button: function() { | ||
| 77 | + var $chart_button = | ||
| 78 | + $('<a href="#i3GeoMap" class="i3GeoMap button disabled_toolbar i18n" title="Mapa com i3Geo"></a>') | ||
| 79 | + .css({ 'background-image': "url('js/saiku/plugins/i3GeoMap/mapa.png')", | ||
| 80 | + 'background-repeat':'no-repeat', | ||
| 81 | + 'background-position':'20% 50%' | ||
| 82 | + }); | ||
| 83 | + | ||
| 84 | + var $chart_li = $('<li class="seperator"></li>').append($chart_button); | ||
| 85 | + $(this.workspace.toolbar.el).find("ul").append($chart_li); | ||
| 86 | + }, | ||
| 87 | + fecha: function(){ | ||
| 88 | + $(this.workspace.toolbar.el).find('.i3GeoMap').removeClass('on'); | ||
| 89 | + $(this.el).hide(); | ||
| 90 | + $(this.nav).hide(); | ||
| 91 | + this.workspace.processing.hide(); | ||
| 92 | + this.workspace.adjust(); | ||
| 93 | + $(this.workspace.el).find('.workspace_results table').show(); | ||
| 94 | + this.workspace.table.render({ data: this.workspace.query.result.lastresult() }); | ||
| 95 | + }, | ||
| 96 | + atualizarMapa: function(){ | ||
| 97 | + document.getElementById('formi3GeoMap').submit(); | ||
| 98 | + }, | ||
| 99 | + show: function(event, ui) { | ||
| 100 | + //$(this.workspace.el).find('.workspace_results table').toggle(); | ||
| 101 | + $(this.el).toggle(); | ||
| 102 | + $(this.nav).toggle(); | ||
| 103 | + $(event.target).toggleClass('on'); | ||
| 104 | + $("#message").html(""); | ||
| 105 | + this.nav.find('input').show(); | ||
| 106 | + if ($(event.target).hasClass('on')) { | ||
| 107 | + this.process_data({ data: this.workspace.query.result.lastresult() }); | ||
| 108 | + //this.render(); | ||
| 109 | + } | ||
| 110 | + }, | ||
| 111 | + | ||
| 112 | + setOptions: function(event) { | ||
| 113 | + var type = $(event.target).attr('name'); | ||
| 114 | + this.opcoes.coluna = ""; | ||
| 115 | + this.opcoes.indicecoluna = ""; | ||
| 116 | + this.opcoes.cores = ""; | ||
| 117 | + this.opcoes.outlinecolor = ""; | ||
| 118 | + this[type](this); | ||
| 119 | + return false; | ||
| 120 | + }, | ||
| 121 | + fecharMapa: function(){ | ||
| 122 | + var i = document.getElementById("iframei3GeoMap"); | ||
| 123 | + if(i){ | ||
| 124 | + i.src = ""; | ||
| 125 | + i.style.display = "none"; | ||
| 126 | + i.style.height = "0px"; | ||
| 127 | + } | ||
| 128 | + }, | ||
| 129 | + mapaPizzas: function(s){ | ||
| 130 | + this.opcoes.size = 50; | ||
| 131 | + this.opcoes.cores = coresHex2Rgb(this.coreshex); | ||
| 132 | + $.fancybox("Cor do contorno: "+this.cores("corContorno")+ | ||
| 133 | + "Tamanho das pizzas (em pixels):<br><input type=text value='"+this.opcoes.size+"' size=6 id='mapaPizzasSize' />" + | ||
| 134 | + "<br><input type=button value='OK' id='mapaPizzasOk' />" + | ||
| 135 | + " <input type=button value='Cancela' id='mapaPizzasCancela' />" | ||
| 136 | + , | ||
| 137 | + { | ||
| 138 | + 'autoDimensions' : false, | ||
| 139 | + 'autoScale' : false, | ||
| 140 | + 'height' : 250, | ||
| 141 | + 'width' : 350, | ||
| 142 | + 'transitionIn' : 'none', | ||
| 143 | + 'transitionOut' : 'none', | ||
| 144 | + 'showCloseButton' : false, | ||
| 145 | + 'modal' : false | ||
| 146 | + } | ||
| 147 | + ); | ||
| 148 | + document.getElementById("mapaPizzasOk").onclick = function(){ | ||
| 149 | + s.opcoes.tipo = "mapaPizzas"; | ||
| 150 | + s.opcoes.size = document.getElementById("mapaPizzasSize").value; | ||
| 151 | + s.opcoes.indicecoluna = []; | ||
| 152 | + var cori = $('input[name="corContorno"]').val(); | ||
| 153 | + s.opcoes.outlinecolor = hex2rgb(cori); | ||
| 154 | + s.render(); | ||
| 155 | + $.fancybox.close(); | ||
| 156 | + }; | ||
| 157 | + document.getElementById("mapaPizzasCancela").onclick = function(){ | ||
| 158 | + $.fancybox.close(); | ||
| 159 | + s.fecharMapa(); | ||
| 160 | + }; | ||
| 161 | + jQuery('select[name="corContorno"]').colourPicker({ | ||
| 162 | + ico: 'js/jquery/jquery.colourPicker.gif', | ||
| 163 | + title: false | ||
| 164 | + }); | ||
| 165 | + }, | ||
| 166 | + | ||
| 167 | + mapaBarras: function(s){ | ||
| 168 | + this.opcoes.size = 50; | ||
| 169 | + this.opcoes.cores = coresHex2Rgb(this.coreshex); | ||
| 170 | + $.fancybox("Cor do contorno: "+this.cores("corContorno")+ | ||
| 171 | + "Tamanho das barras (em pixels):<br><input type=text value='"+this.opcoes.size+"' size=6 id='mapaBarrasSize' />" + | ||
| 172 | + "<br><input type=button value='OK' id='mapaBarrasOk' />" + | ||
| 173 | + " <input type=button value='Cancela' id='mapaBarrasCancela' />" | ||
| 174 | + , | ||
| 175 | + { | ||
| 176 | + 'autoDimensions' : false, | ||
| 177 | + 'autoScale' : false, | ||
| 178 | + 'height' : 250, | ||
| 179 | + 'width' : 350, | ||
| 180 | + 'transitionIn' : 'none', | ||
| 181 | + 'transitionOut' : 'none', | ||
| 182 | + 'showCloseButton' : false, | ||
| 183 | + 'modal' : false | ||
| 184 | + } | ||
| 185 | + ); | ||
| 186 | + document.getElementById("mapaBarrasOk").onclick = function(){ | ||
| 187 | + s.opcoes.tipo = "mapaBarras"; | ||
| 188 | + s.opcoes.size = document.getElementById("mapaBarrasSize").value; | ||
| 189 | + s.opcoes.indicecoluna = []; | ||
| 190 | + var cori = $('input[name="corContorno"]').val(); | ||
| 191 | + s.opcoes.outlinecolor = hex2rgb(cori); | ||
| 192 | + s.render(); | ||
| 193 | + $.fancybox.close(); | ||
| 194 | + }; | ||
| 195 | + document.getElementById("mapaBarrasCancela").onclick = function(){ | ||
| 196 | + $.fancybox.close(); | ||
| 197 | + s.fecharMapa(); | ||
| 198 | + }; | ||
| 199 | + jQuery('select[name="corContorno"]').colourPicker({ | ||
| 200 | + ico: 'js/jquery/jquery.colourPicker.gif', | ||
| 201 | + title: false | ||
| 202 | + }); | ||
| 203 | + }, | ||
| 204 | + coresChapadas: function(s){ | ||
| 205 | + this.opcoes.size = 0; | ||
| 206 | + $.fancybox("Cor inicial: "+this.cores("corInicial")+ | ||
| 207 | + "Cor final: "+this.cores("corFinal")+ | ||
| 208 | + "Coluna com os valores:<br>"+ | ||
| 209 | + "<select id='coresChapadasColuna' style='border:1px solid #BBBBBB;'>"+this.opcoesColunas()+"</select>" + | ||
| 210 | + "<br><input type=button value='OK' id='coresChapadasOk' />" + | ||
| 211 | + " <input type=button value='Cancela' id='coresChapadasCancela' />" | ||
| 212 | + , | ||
| 213 | + { | ||
| 214 | + 'autoDimensions' : false, | ||
| 215 | + 'autoScale' : false, | ||
| 216 | + 'height' : 250, | ||
| 217 | + 'width' : 350, | ||
| 218 | + 'transitionIn' : 'none', | ||
| 219 | + 'transitionOut' : 'none', | ||
| 220 | + 'showCloseButton' : false, | ||
| 221 | + 'modal' : false | ||
| 222 | + } | ||
| 223 | + ); | ||
| 224 | + document.getElementById("coresChapadasOk").onclick = function(){ | ||
| 225 | + s.opcoes.tipo = "coresChapadas"; | ||
| 226 | + s.opcoes.size = 0; | ||
| 227 | + s.opcoes.indicecoluna = [parseInt(document.getElementById("coresChapadasColuna").value,10)]; | ||
| 228 | + var cori = $('input[name="corInicial"]').val(); | ||
| 229 | + var corf = $('input[name="corFinal"]').val(); | ||
| 230 | + s.opcoes.cores = [hex2rgb(cori),hex2rgb(corf)]; | ||
| 231 | + s.render(); | ||
| 232 | + $.fancybox.close(); | ||
| 233 | + }; | ||
| 234 | + document.getElementById("coresChapadasCancela").onclick = function(){ | ||
| 235 | + $.fancybox.close(); | ||
| 236 | + s.fecharMapa(); | ||
| 237 | + }; | ||
| 238 | + jQuery('select[name="corInicial"]').colourPicker({ | ||
| 239 | + ico: 'js/jquery/jquery.colourPicker.gif', | ||
| 240 | + title: false | ||
| 241 | + }); | ||
| 242 | + $('input[name="corInicial"]')[0].value = "ffffc7"; | ||
| 243 | + | ||
| 244 | + jQuery('select[name="corFinal"]').colourPicker({ | ||
| 245 | + ico: 'js/jquery/jquery.colourPicker.gif', | ||
| 246 | + title: false | ||
| 247 | + }); | ||
| 248 | + $('input[name="corFinal"]')[0].value = "643403"; | ||
| 249 | + }, | ||
| 250 | + raiosProporcionais: function(s){ | ||
| 251 | + this.opcoes.size = 10; | ||
| 252 | + $.fancybox("Escolha uma cor: "+this.cores()+ | ||
| 253 | + "Tamanho inicial do círculo (em pixels):<br><input type=text value='"+this.opcoes.size+"' size=6 id='raiosProporcionaisSize' />" + | ||
| 254 | + "<br>Coluna com os valores:<br>"+ | ||
| 255 | + "<select id='raiosProporcionaisColuna' style='border:1px solid #BBBBBB;'>"+this.opcoesColunas()+"</select>" + | ||
| 256 | + "<br><input type=button value='OK' id='raiosProporcionaisOk' />" + | ||
| 257 | + " <input type=button value='Cancela' id='raiosProporcionaisCancela' />" | ||
| 258 | + , | ||
| 259 | + { | ||
| 260 | + 'autoDimensions' : false, | ||
| 261 | + 'autoScale' : false, | ||
| 262 | + 'height' : 250, | ||
| 263 | + 'width' : 350, | ||
| 264 | + 'transitionIn' : 'none', | ||
| 265 | + 'transitionOut' : 'none', | ||
| 266 | + 'showCloseButton' : false, | ||
| 267 | + 'modal' : false | ||
| 268 | + } | ||
| 269 | + ); | ||
| 270 | + document.getElementById("raiosProporcionaisOk").onclick = function(){ | ||
| 271 | + s.opcoes.tipo = "raiosProporcionais"; | ||
| 272 | + s.opcoes.size = document.getElementById("raiosProporcionaisSize").value; | ||
| 273 | + s.opcoes.indicecoluna = [parseInt(document.getElementById("raiosProporcionaisColuna").value,10)]; | ||
| 274 | + var cor = $('input[name="colour"]').val(); | ||
| 275 | + s.opcoes.cores = [hex2rgb(cor)]; | ||
| 276 | + s.render(); | ||
| 277 | + $.fancybox.close(); | ||
| 278 | + }; | ||
| 279 | + document.getElementById("raiosProporcionaisCancela").onclick = function(){ | ||
| 280 | + $.fancybox.close(); | ||
| 281 | + s.fecharMapa(); | ||
| 282 | + }; | ||
| 283 | + jQuery('select[name="colour"]').colourPicker({ | ||
| 284 | + ico: 'js/jquery/jquery.colourPicker.gif', | ||
| 285 | + title: false | ||
| 286 | + }); | ||
| 287 | + }, | ||
| 288 | + circulosProporcionais: function(s){ | ||
| 289 | + this.opcoes.size = 10; | ||
| 290 | + $.fancybox("Escolha uma cor: "+this.cores()+ | ||
| 291 | + "Tamanho inicial do círculo (em pixels):<br><input type=text value='"+this.opcoes.size+"' size=6 id='circulosProporcionaisSize' />" + | ||
| 292 | + "<br>Coluna com os valores:<br>"+ | ||
| 293 | + "<select id='circulosProporcionaisColuna' style='border:1px solid #BBBBBB;'>"+this.opcoesColunas()+"</select>" + | ||
| 294 | + "<br><input type=button value='OK' id='circulosProporcionaisOk' />" + | ||
| 295 | + " <input type=button value='Cancela' id='circulosProporcionaisCancela' />" | ||
| 296 | + , | ||
| 297 | + { | ||
| 298 | + 'autoDimensions' : false, | ||
| 299 | + 'autoScale' : false, | ||
| 300 | + 'height' : 250, | ||
| 301 | + 'width' : 350, | ||
| 302 | + 'transitionIn' : 'none', | ||
| 303 | + 'transitionOut' : 'none', | ||
| 304 | + 'showCloseButton' : false, | ||
| 305 | + 'modal' : false | ||
| 306 | + } | ||
| 307 | + ); | ||
| 308 | + document.getElementById("circulosProporcionaisOk").onclick = function(){ | ||
| 309 | + s.opcoes.tipo = "circulosProporcionais"; | ||
| 310 | + s.opcoes.size = document.getElementById("circulosProporcionaisSize").value; | ||
| 311 | + s.opcoes.indicecoluna = [parseInt(document.getElementById("circulosProporcionaisColuna").value,10)]; | ||
| 312 | + var cor = $('input[name="colour"]').val(); | ||
| 313 | + s.opcoes.cores = [hex2rgb(cor)]; | ||
| 314 | + s.render(); | ||
| 315 | + $.fancybox.close(); | ||
| 316 | + }; | ||
| 317 | + document.getElementById("circulosProporcionaisCancela").onclick = function(){ | ||
| 318 | + $.fancybox.close(); | ||
| 319 | + s.fecharMapa(); | ||
| 320 | + }; | ||
| 321 | + jQuery('select[name="colour"]').colourPicker({ | ||
| 322 | + ico: 'js/jquery/jquery.colourPicker.gif', | ||
| 323 | + title: false | ||
| 324 | + }); | ||
| 325 | + }, | ||
| 326 | + | ||
| 327 | + opcoesColunas: function(){ | ||
| 328 | + var m = this.data.metadata, | ||
| 329 | + n = m.length, | ||
| 330 | + i = 0, | ||
| 331 | + ins = []; | ||
| 332 | + for(i=1;i<n;i++){ | ||
| 333 | + ins.push("<option value='"+m[i].colIndex+"' >"+m[i].colName+"</option>"); | ||
| 334 | + } | ||
| 335 | + return ins.join(""); | ||
| 336 | + }, | ||
| 337 | + cores: function(nome){ | ||
| 338 | + if(!nome){ | ||
| 339 | + nome = "colour"; | ||
| 340 | + } | ||
| 341 | + var cor = "<div id='jquery-colour-picker-example' >" + | ||
| 342 | + "<p><select name='"+nome+"'>"+ | ||
| 343 | + "<option value='ffffff' selected='selected'>#ffffff</option>"+ | ||
| 344 | + "<option value='ffccc9'>#ffccc9</option>"+ | ||
| 345 | + "<option value='ffce93'>#ffce93</option>"+ | ||
| 346 | + "<option value='fffc9e'>#fffc9e</option>"+ | ||
| 347 | + "<option value='ffffc7'>#ffffc7</option>"+ | ||
| 348 | + "<option value='9aff99'>#9aff99</option>"+ | ||
| 349 | + "<option value='96fffb'>#96fffb</option>"+ | ||
| 350 | + "<option value='cdffff'>#cdffff</option>"+ | ||
| 351 | + "<option value='cbcefb'>#cbcefb</option>"+ | ||
| 352 | + "<option value='cfcfcf'>#cfcfcf</option>"+ | ||
| 353 | + "<option value='fd6864'>#fd6864</option>"+ | ||
| 354 | + "<option value='fe996b'>#fe996b</option>"+ | ||
| 355 | + "<option value='fffe65'>#fffe65</option>"+ | ||
| 356 | + "<option value='fcff2f'>#fcff2f</option>"+ | ||
| 357 | + "<option value='67fd9a'>#67fd9a</option>"+ | ||
| 358 | + "<option value='38fff8'>#38fff8</option>"+ | ||
| 359 | + "<option value='68fdff'>#68fdff</option>"+ | ||
| 360 | + "<option value='9698ed'>#9698ed</option>"+ | ||
| 361 | + "<option value='c0c0c0'>#c0c0c0</option>"+ | ||
| 362 | + "<option value='fe0000'>#fe0000</option>"+ | ||
| 363 | + "<option value='f8a102'>#f8a102</option>"+ | ||
| 364 | + "<option value='ffcc67'>#ffcc67</option>"+ | ||
| 365 | + "<option value='f8ff00'>#f8ff00</option>"+ | ||
| 366 | + "<option value='34ff34'>#34ff34</option>"+ | ||
| 367 | + "<option value='68cbd0'>#68cbd0</option>"+ | ||
| 368 | + "<option value='34cdf9'>#34cdf9</option>"+ | ||
| 369 | + "<option value='6665cd'>#6665cd</option>"+ | ||
| 370 | + "<option value='9b9b9b'>#9b9b9b</option>"+ | ||
| 371 | + "<option value='cb0000'>#cb0000</option>"+ | ||
| 372 | + "<option value='f56b00'>#f56b00</option>"+ | ||
| 373 | + "<option value='ffcb2f'>#ffcb2f</option>"+ | ||
| 374 | + "<option value='ffc702'>#ffc702</option>"+ | ||
| 375 | + "<option value='32cb00'>#32cb00</option>"+ | ||
| 376 | + "<option value='00d2cb'>#00d2cb</option>"+ | ||
| 377 | + "<option value='3166ff'>#3166ff</option>"+ | ||
| 378 | + "<option value='6434fc'>#6434fc</option>"+ | ||
| 379 | + "<option value='656565'>#656565</option>"+ | ||
| 380 | + "<option value='9a0000'>#9a0000</option>"+ | ||
| 381 | + "<option value='ce6301'>#ce6301</option>"+ | ||
| 382 | + "<option value='cd9934'>#cd9934</option>"+ | ||
| 383 | + "<option value='999903'>#999903</option>"+ | ||
| 384 | + "<option value='009901'>#009901</option>"+ | ||
| 385 | + "<option value='329a9d'>#329a9d</option>"+ | ||
| 386 | + "<option value='3531ff'>#3531ff</option>"+ | ||
| 387 | + "<option value='6200c9'>#6200c9</option>"+ | ||
| 388 | + "<option value='343434'>#343434</option>"+ | ||
| 389 | + "<option value='680100'>#680100</option>"+ | ||
| 390 | + "<option value='963400'>#963400</option>"+ | ||
| 391 | + "<option value='986536'>#986536</option>"+ | ||
| 392 | + "<option value='646809'>#646809</option>"+ | ||
| 393 | + "<option value='036400'>#036400</option>"+ | ||
| 394 | + "<option value='34696d'>#34696d</option>"+ | ||
| 395 | + "<option value='00009b'>#00009b</option>"+ | ||
| 396 | + "<option value='303498'>#303498</option>"+ | ||
| 397 | + "<option value='000000'>#000000</option>"+ | ||
| 398 | + "<option value='330001'>#330001</option>"+ | ||
| 399 | + "<option value='643403'>#643403</option>"+ | ||
| 400 | + "<option value='663234'>#663234</option>"+ | ||
| 401 | + "<option value='343300'>#343300</option>"+ | ||
| 402 | + "<option value='013300'>#013300</option>"+ | ||
| 403 | + "<option value='003532'>#003532</option>"+ | ||
| 404 | + "<option value='010066'>#010066</option>"+ | ||
| 405 | + "<option value='340096'>#340096</option></select></p></div>"; | ||
| 406 | + return cor; | ||
| 407 | + }, | ||
| 408 | + render: function() { | ||
| 409 | + if (! $(this.workspace.toolbar.el).find('.i3GeoMap').hasClass('on')) { | ||
| 410 | + this.fecha(); | ||
| 411 | + this.fecharMapa(); | ||
| 412 | + return; | ||
| 413 | + } | ||
| 414 | + var series=[]; | ||
| 415 | + //nome das colunas | ||
| 416 | + var column=[]; | ||
| 417 | + var columnGeoCod = ""; | ||
| 418 | + var indiceColumnGeoCod = ""; | ||
| 419 | + var metadata = []; | ||
| 420 | + var indicecoluna = ""; | ||
| 421 | + for(var i=0; i < this.data.metadata.length; i++){ | ||
| 422 | + if(this.opcoes.indicecoluna == this.data.metadata[i].colIndex){ | ||
| 423 | + indicecoluna = i; | ||
| 424 | + } | ||
| 425 | + column[i] = this.data.metadata[i].colName; | ||
| 426 | + //se o usuario escolheu uma coluna, as demais sao marcadas com o nome vazio | ||
| 427 | + if(this.opcoes.indicecoluna != ""){ | ||
| 428 | + //if(this.opcoes.indicecoluna.indexOf(this.data.metadata[i].colIndex) != -1) | ||
| 429 | + if(this.opcoes.indicecoluna.indexOf(this.data.metadata[i].colIndex) != -1 || column[i].search("GeoCod") > 0){ | ||
| 430 | + metadata.push(this.data.metadata[i]); | ||
| 431 | + } | ||
| 432 | + } | ||
| 433 | + else{ | ||
| 434 | + metadata.push(this.data.metadata[i]); | ||
| 435 | + } | ||
| 436 | + //pega a coluna GeoCod | ||
| 437 | + if(column[i].search("GeoCod") > 0){ | ||
| 438 | + //verifica se tem mais de um GeoCod | ||
| 439 | + if(columnGeoCod != ""){ | ||
| 440 | + alert("Existem mais de uma coluna GeoCod!"); | ||
| 441 | + this.fecha(); | ||
| 442 | + $.fancybox.close(); | ||
| 443 | + return; | ||
| 444 | + } | ||
| 445 | + columnGeoCod = column[i]; | ||
| 446 | + indiceColumnGeoCod = i; | ||
| 447 | + } | ||
| 448 | + } | ||
| 449 | + if(columnGeoCod === ""){ | ||
| 450 | + alert("Coluna GeoCod nao existe!"); | ||
| 451 | + this.fecha(); | ||
| 452 | + $.fancybox.close(); | ||
| 453 | + //this.nav.find('input').hide(); | ||
| 454 | + return; | ||
| 455 | + } | ||
| 456 | + series[0]=column; | ||
| 457 | + var dados = []; | ||
| 458 | + if(indicecoluna != ""){ | ||
| 459 | + if (this.data.resultset.length > 0 ) { | ||
| 460 | + $.each(this.data.resultset, function(key, value) { | ||
| 461 | + dados.push([value[indiceColumnGeoCod],value[indicecoluna]]); | ||
| 462 | + }); | ||
| 463 | + } | ||
| 464 | + } | ||
| 465 | + else{ | ||
| 466 | + if (this.data.resultset.length > 0 ) { | ||
| 467 | + $.each(this.data.resultset, function(key, value) { | ||
| 468 | + var aux=value[0]+''; | ||
| 469 | + aux = aux.split(" \/ "); | ||
| 470 | + aux = aux[indiceColumnGeoCod]; | ||
| 471 | + value[0]=aux; | ||
| 472 | + dados.push(value); | ||
| 473 | + }); | ||
| 474 | + } | ||
| 475 | + } | ||
| 476 | + //preenche os dados do formulario | ||
| 477 | + this.opcoes.locaplic = parametroUrl("locaplic"); | ||
| 478 | + this.opcoes.mapext = parametroUrl("mapext"); | ||
| 479 | + document.getElementById("formi3GeoMapOpcoes").value = JSON.stringify(this.opcoes); | ||
| 480 | + document.getElementById("formi3GeoMapdados").value = JSON.stringify(dados); | ||
| 481 | + document.getElementById("formi3GeoMapmetadados").value = JSON.stringify(metadata); | ||
| 482 | + document.getElementById("iframei3GeoMap").style.height = parseInt($(this.workspace.el).find('.workspace_results')[0].style.height) - 50 +"px"; | ||
| 483 | + document.getElementById("formi3GeoMap").submit(); | ||
| 484 | + document.getElementById("iframei3GeoMap").style.display = "block"; | ||
| 485 | + }, | ||
| 486 | + receive_data: function(args) { | ||
| 487 | + if ($(this.workspace.toolbar.el).find('.i3GeoMap').hasClass('on')) { | ||
| 488 | + this.fecha(); | ||
| 489 | + this.fecharMapa(); | ||
| 490 | + return false; | ||
| 491 | + } | ||
| 492 | + return _.delay(this.process_data, 0, args); | ||
| 493 | + }, | ||
| 494 | + process_data: function(args) { | ||
| 495 | + this.data = {}; | ||
| 496 | + this.data.resultset = []; | ||
| 497 | + this.data.metadata = []; | ||
| 498 | + this.data.height = 0; | ||
| 499 | + this.data.width = 0; | ||
| 500 | + if (! $(this.workspace.toolbar.el).find('.i3GeoMap').hasClass('on')) { | ||
| 501 | + this.fecha(); | ||
| 502 | + this.fecharMapa(); | ||
| 503 | + return; | ||
| 504 | + } | ||
| 505 | + var cellset = args.data.cellset; | ||
| 506 | + var nome = ""; | ||
| 507 | + var colunaGeocod = ""; | ||
| 508 | + var colunaGeocodIndice = ""; | ||
| 509 | + if (cellset && cellset.length > 0) { | ||
| 510 | + var lowest_level = 0; | ||
| 511 | + var data_start = 0; | ||
| 512 | + for (var row = 0; data_start == 0 && row < cellset.length; row++) { | ||
| 513 | + this.data.metadata = []; | ||
| 514 | + for (var field = 0; field < cellset[row].length; field++) { | ||
| 515 | + var firstHeader = []; | ||
| 516 | + | ||
| 517 | + while (cellset[row][field].type == "COLUMN_HEADER" && cellset[row][field].value == "null") { | ||
| 518 | + row++; | ||
| 519 | + } | ||
| 520 | + nome = ""; | ||
| 521 | + //colunaGeocod = ""; | ||
| 522 | + //colunaGeocodIndice = ""; | ||
| 523 | + if (cellset[row][field].type == "ROW_HEADER_HEADER") { | ||
| 524 | + while(cellset[row][field].type == "ROW_HEADER_HEADER") { | ||
| 525 | + nome = cellset[row][field].value; | ||
| 526 | + firstHeader.push(nome); | ||
| 527 | + if(nome.search("GeoCod") > 0){ | ||
| 528 | + colunaGeocod = nome; | ||
| 529 | + colunaGeocodIndice = field; | ||
| 530 | + } | ||
| 531 | + field++; | ||
| 532 | + } | ||
| 533 | + tipo = "linha"; | ||
| 534 | + identificador = cellset[row][field-1].properties.level; | ||
| 535 | + if(firstHeader.join('/').search("GeoCod") > 0){ | ||
| 536 | + this.data.metadata.push({ | ||
| 537 | + colIndex: 0, | ||
| 538 | + colType: "String", | ||
| 539 | + colName: colunaGeocod, | ||
| 540 | + tipo: tipo, | ||
| 541 | + identificador: identificador | ||
| 542 | + }); | ||
| 543 | + lowest_level = field - 1; | ||
| 544 | + } | ||
| 545 | + | ||
| 546 | + } | ||
| 547 | + if (cellset[row][field].type == "COLUMN_HEADER" && cellset[row][field].value != "null") { | ||
| 548 | + var lowest_col_header = 0; | ||
| 549 | + var colheader = []; | ||
| 550 | + while(lowest_col_header <= row) { | ||
| 551 | + colheader.push(cellset[lowest_col_header][field].value); | ||
| 552 | + lowest_col_header++; | ||
| 553 | + } | ||
| 554 | + | ||
| 555 | + tipo = "coluna"; | ||
| 556 | + identificador = cellset[row][lowest_col_header].properties.uniquename; | ||
| 557 | + | ||
| 558 | + this.data.metadata.push({ | ||
| 559 | + colIndex: field - lowest_level + 1, | ||
| 560 | + colType: "Numeric", | ||
| 561 | + colName: colheader.join('/'), | ||
| 562 | + tipo: tipo, | ||
| 563 | + identificador: identificador | ||
| 564 | + }); | ||
| 565 | + data_start = row+1; | ||
| 566 | + } | ||
| 567 | + } | ||
| 568 | + } | ||
| 569 | + | ||
| 570 | + for (var row = data_start; row < cellset.length; row++) { | ||
| 571 | + if (cellset[row][0].value !== "") { | ||
| 572 | + var record = []; | ||
| 573 | + this.data.width = cellset[row].length - lowest_level + 1; | ||
| 574 | + var label = ""; | ||
| 575 | + if(cellset[row][colunaGeocodIndice]){ | ||
| 576 | + label = cellset[row][colunaGeocodIndice].value; | ||
| 577 | + } | ||
| 578 | + /* | ||
| 579 | + if(label in labelsSet) { | ||
| 580 | + labelsSet[label] = labelsSet[label]+1; | ||
| 581 | + label = label + ' [' + (labelsSet[label] + 1) + ']'; | ||
| 582 | + } else { | ||
| 583 | + labelsSet[label] = 0; | ||
| 584 | + } | ||
| 585 | + */ | ||
| 586 | + record.push(label); | ||
| 587 | + | ||
| 588 | + for (var col = lowest_level + 1; col < cellset[row].length; col++) { | ||
| 589 | + var cell = cellset[row][col]; | ||
| 590 | + var value = cell.value || 0; | ||
| 591 | + // check if the resultset contains the raw value, if not try to parse the given value | ||
| 592 | + var raw = cell.properties.raw; | ||
| 593 | + if (raw && raw !== "null") { | ||
| 594 | + value = parseFloat(raw); | ||
| 595 | + } else if (typeof(cell.value) !== "number" && parseFloat(cell.value.replace(/[^a-zA-Z 0-9.]+/g,''))) { | ||
| 596 | + value = parseFloat(cell.value.replace(/[^a-zA-Z 0-9.]+/g,'')); | ||
| 597 | + } | ||
| 598 | + record.push(value); | ||
| 599 | + } | ||
| 600 | + this.data.resultset.push(record); | ||
| 601 | + } | ||
| 602 | + } | ||
| 603 | + //makeSureUniqueLabels(this.data.resultset); | ||
| 604 | + this.hasProcessed = true; | ||
| 605 | + this.data.height = this.data.resultset.length; | ||
| 606 | + //this.cccOptions = this.getQuickOptions(this.cccOptions); | ||
| 607 | + //this.render(); | ||
| 608 | + } else { | ||
| 609 | + $(this.el).find('.canvas_wrapper').text("No results").show(); | ||
| 610 | + this.workspace.processing.hide(); | ||
| 611 | + this.workspace.adjust(); | ||
| 612 | + } | ||
| 613 | + } | ||
| 614 | +}); | ||
| 615 | +function hex2rgb(hex,tipo) { | ||
| 616 | + if(!tipo){ | ||
| 617 | + tipo = "array"; | ||
| 618 | + } | ||
| 619 | + if (hex[0]=="#") hex=hex.substr(1); | ||
| 620 | + if (hex.length==3) { | ||
| 621 | + var temp=hex; hex=''; | ||
| 622 | + temp = /^([a-f0-9])([a-f0-9])([a-f0-9])$/i.exec(temp).slice(1); | ||
| 623 | + for (var i=0;i<3;i++) hex+=temp[i]+temp[i]; | ||
| 624 | + } | ||
| 625 | + var triplets = /^([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i.exec(hex).slice(1); | ||
| 626 | + if(tipo == "array"){ | ||
| 627 | + return { | ||
| 628 | + red: parseInt(triplets[0],16), | ||
| 629 | + green: parseInt(triplets[1],16), | ||
| 630 | + blue: parseInt(triplets[2],16) | ||
| 631 | + }; | ||
| 632 | + } | ||
| 633 | + else{ | ||
| 634 | + return parseInt(triplets[0],16)+ " " + parseInt(triplets[1],16) + " " + parseInt(triplets[2],16); | ||
| 635 | + } | ||
| 636 | +} | ||
| 637 | +function coresHex2Rgb(lista){ | ||
| 638 | + var n = lista.length, | ||
| 639 | + i =0, | ||
| 640 | + f = []; | ||
| 641 | + for(i=0;i<n;i++){ | ||
| 642 | + f.push(hex2rgb(lista[i]," ")); | ||
| 643 | + } | ||
| 644 | + return f; | ||
| 645 | +} | ||
| 646 | +function loadCSS(file){ | ||
| 647 | + var headID = document.getElementsByTagName("head")[0]; | ||
| 648 | + var cssNode = document.createElement('link'); | ||
| 649 | + cssNode.type = 'text/css'; | ||
| 650 | + cssNode.rel = 'stylesheet'; | ||
| 651 | + cssNode.href = file; | ||
| 652 | + cssNode.media = 'screen'; | ||
| 653 | + headID.appendChild(cssNode); | ||
| 654 | +} | ||
| 655 | + | ||
| 656 | +function loadJS(file){ | ||
| 657 | + var headID = document.getElementsByTagName("head")[0]; | ||
| 658 | + var newScript = document.createElement('script'); | ||
| 659 | + newScript.type = 'text/javascript'; | ||
| 660 | + newScript.src = file; | ||
| 661 | + headID.appendChild(newScript); | ||
| 662 | +} | ||
| 663 | + | ||
| 664 | +function messageUser(msg){ | ||
| 665 | + $("#message").html(msg).show('slow'); | ||
| 666 | + setTimeout(function(){ jQuery("#message").hide('slow'); }, 2000); | ||
| 667 | +} | ||
| 668 | + | ||
| 669 | +function parametroUrl(parametro){ | ||
| 670 | + var params = window.location.search.replace("?","").split("&"), | ||
| 671 | + n = params.length, | ||
| 672 | + valor = "", | ||
| 673 | + i,param; | ||
| 674 | + for(i=0;i<n;i++){ | ||
| 675 | + param = params[i].split("="); | ||
| 676 | + if(param[0] == parametro){ | ||
| 677 | + valor = param[1]; | ||
| 678 | + } | ||
| 679 | + } | ||
| 680 | + return valor; | ||
| 681 | +} | ||
| 682 | +/** | ||
| 683 | + * Start Plugin | ||
| 684 | + */ | ||
| 685 | +Saiku.events.bind('session:new', function(session) { | ||
| 686 | + function new_workspace(args) { | ||
| 687 | + // Add stats element | ||
| 688 | + if (typeof args.workspace.i3GeoMap == "undefined") { | ||
| 689 | + args.workspace.i3GeoMap = new i3GeoMap({ workspace: args.workspace }); | ||
| 690 | + } | ||
| 691 | + } | ||
| 692 | + | ||
| 693 | + function clear_workspace(args) { | ||
| 694 | + if (typeof args.workspace.i3GeoMap != "undefined") { | ||
| 695 | + $(args.workspace.i3GeoMap.nav).hide(); | ||
| 696 | + $(args.workspace.i3GeoMap.el).parents().find('.workspace_results table').show(); | ||
| 697 | + $(args.workspace.i3GeoMap.el).hide(); | ||
| 698 | + } | ||
| 699 | + } | ||
| 700 | + | ||
| 701 | + | ||
| 702 | + // Attach stats to existing tabs | ||
| 703 | + for(var i = 0; i < Saiku.tabs._tabs.length; i++) { | ||
| 704 | + var tab = Saiku.tabs._tabs[i]; | ||
| 705 | + new_workspace({ | ||
| 706 | + workspace: tab.content | ||
| 707 | + }); | ||
| 708 | + }; | ||
| 709 | + | ||
| 710 | + // Attach stats to future tabs | ||
| 711 | + Saiku.session.bind("workspace:new", new_workspace); | ||
| 712 | + Saiku.session.bind("workspace:clear", clear_workspace); | ||
| 713 | +}); |
ferramentas/saiku/saiku-server/tomcat/webapps/ROOT/js/saiku/views/QueryToolbar.js
0 → 100755
| @@ -0,0 +1,228 @@ | @@ -0,0 +1,228 @@ | ||
| 1 | +/* | ||
| 2 | + * Copyright 2012 OSBI Ltd | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * The query toolbar, and associated actions | ||
| 19 | + */ | ||
| 20 | +var QueryToolbar = Backbone.View.extend({ | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + events: { | ||
| 25 | + 'click .options a.button': 'call', | ||
| 26 | + 'click .renderer a.button' : 'switch_render_button' | ||
| 27 | + }, | ||
| 28 | + | ||
| 29 | + chart: {}, | ||
| 30 | + | ||
| 31 | + render_mode: "table", | ||
| 32 | + spark_mode: null, | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + initialize: function(args) { | ||
| 36 | + // Keep track of parent workspace | ||
| 37 | + this.workspace = args.workspace; | ||
| 38 | + | ||
| 39 | + // Maintain `this` in callbacks | ||
| 40 | + _.bindAll(this, "call","activate_buttons", "spark_bar", "spark_line", "render_row_viz", "run_row_viz", "switch_render_button"); | ||
| 41 | + | ||
| 42 | + this.render_mode = "table"; | ||
| 43 | + this.spark_mode = null; | ||
| 44 | + | ||
| 45 | + // Activate buttons when a new query is created or run | ||
| 46 | + this.workspace.bind('query:new', this.activate_buttons); | ||
| 47 | + this.workspace.bind('query:result', this.activate_buttons); | ||
| 48 | + this.workspace.bind('table:rendered', this.run_row_viz); | ||
| 49 | + | ||
| 50 | + }, | ||
| 51 | + | ||
| 52 | + activate_buttons: function(args) { | ||
| 53 | + if (typeof args != "undefined" && args != null ) { | ||
| 54 | + $(this.el).find('a').removeClass('disabled_toolbar'); | ||
| 55 | + if (!args.data) { | ||
| 56 | + $(this.el).find('a.export_button, a.stats').addClass('disabled_toolbar'); | ||
| 57 | + } | ||
| 58 | + if (isIE) { | ||
| 59 | + $(this.el).find('a.export_button').addClass('disabled_toolbar'); | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + }, | ||
| 64 | + | ||
| 65 | + template: function() { | ||
| 66 | + var template = $("#template-query-toolbar").html() || ""; | ||
| 67 | + return _.template(template)(); | ||
| 68 | + }, | ||
| 69 | + | ||
| 70 | + render: function() { | ||
| 71 | + $(this.el).html(this.template()); | ||
| 72 | + | ||
| 73 | + $(this.el).find('render_table').addClass('on'); | ||
| 74 | + $(this.el).find('ul.table').show(); | ||
| 75 | + | ||
| 76 | + return this; | ||
| 77 | + }, | ||
| 78 | + | ||
| 79 | + switch_render_button: function(event) { | ||
| 80 | + $target = $(event.target); | ||
| 81 | + event.preventDefault(); | ||
| 82 | + if ($(event.target).hasClass('disabled_toolbar')) { | ||
| 83 | + return false; | ||
| 84 | + } | ||
| 85 | + //i3geomap | ||
| 86 | + $(this.workspace.toolbar.el).find('.i3GeoMap').removeClass('on'); | ||
| 87 | + $target.parent().siblings().find('.on').removeClass('on'); | ||
| 88 | + if ($target.hasClass('render_chart')) { | ||
| 89 | + this.switch_render('chart'); | ||
| 90 | + this.workspace.query.setProperty('saiku.ui.render.mode', 'chart'); | ||
| 91 | + var c = $(this.el).find('ul.chart li a.on:first').size() > 0 ? | ||
| 92 | + $(this.el).find('ul.chart li a.on:first').attr('href').replace('#', '') | ||
| 93 | + : null; | ||
| 94 | + if (c != null) { | ||
| 95 | + this.workspace.query.setProperty('saiku.ui.render.type', c); | ||
| 96 | + } | ||
| 97 | + } else { | ||
| 98 | + this.switch_render('table'); | ||
| 99 | + this.workspace.query.setProperty('saiku.ui.render.mode', 'table'); | ||
| 100 | + this.workspace.query.setProperty('saiku.ui.render.type', this.spark_mode); | ||
| 101 | + | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + | ||
| 105 | + }, | ||
| 106 | + switch_render: function(render_type) { | ||
| 107 | + render_type = (typeof render_type != "undefined" ? render_type.toLowerCase() : "table"); | ||
| 108 | + $(this.el).find('ul.renderer a.on').removeClass('on'); | ||
| 109 | + $(this.el).find('ul.renderer a.render_' + render_type).addClass('on'); | ||
| 110 | + if ("chart" == render_type) { | ||
| 111 | + $(this.el).find('ul.chart').show(); | ||
| 112 | + $(this.el).find('ul.table').hide(); | ||
| 113 | + this.render_mode = "chart"; | ||
| 114 | + $(this.workspace.el).find('.workspace_results').children().hide(); | ||
| 115 | + $(this.workspace.chart.el).children().hide(); | ||
| 116 | + this.workspace.chart.show(); | ||
| 117 | + } else { | ||
| 118 | + $(this.el).find('ul.chart').hide(); | ||
| 119 | + $(this.el).find('ul.table').show(); | ||
| 120 | + $(this.el).find('ul.table .stats').removeClass('on'); | ||
| 121 | + $(this.workspace.el).find('.workspace_results').children().hide(); | ||
| 122 | + $(this.workspace.el).find('.workspace_results table').show(); | ||
| 123 | + $(this.workspace.chart.el).hide().children().hide(); | ||
| 124 | + this.render_mode = "table"; | ||
| 125 | + var hasRun = this.workspace.query.result.hasRun(); | ||
| 126 | + if (hasRun) { | ||
| 127 | + this.workspace.table.render({ data: this.workspace.query.result.lastresult() }); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + } | ||
| 131 | + return false; | ||
| 132 | + }, | ||
| 133 | + | ||
| 134 | + call: function(event) { | ||
| 135 | + event.preventDefault(); | ||
| 136 | + $target = $(event.target).hasClass('button') ? $(event.target) : $(event.target).parent(); | ||
| 137 | + if (! $target.hasClass('disabled_toolbar')) { | ||
| 138 | + // Determine callback | ||
| 139 | + var callback = $target.attr('href').replace('#', ''); | ||
| 140 | + | ||
| 141 | + // Attempt to call callback | ||
| 142 | + if (this.render_mode == "table" && this[callback]) { | ||
| 143 | + this[callback](event); | ||
| 144 | + } else if (this.render_mode == "chart" && this.workspace.chart[callback]) { | ||
| 145 | + this.workspace.chart.button(event); | ||
| 146 | + this.workspace.chart[callback](event); | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + return false; | ||
| 150 | + }, | ||
| 151 | + | ||
| 152 | + spark_bar: function() { | ||
| 153 | + $(this.el).find('ul.table .spark_bar').toggleClass('on'); | ||
| 154 | + $(this.el).find('ul.table .spark_line').removeClass('on'); | ||
| 155 | + | ||
| 156 | + $(this.workspace.table.el).find('td.spark').remove(); | ||
| 157 | + if ($(this.el).find('ul.table .spark_bar').hasClass('on')) { | ||
| 158 | + this.spark_mode = "spark_bar"; | ||
| 159 | + this.workspace.query.setProperty('saiku.ui.render.type', 'spark_bar'); | ||
| 160 | + _.delay(this.render_row_viz, 10, "spark_bar"); | ||
| 161 | + } else { | ||
| 162 | + this.spark_mode = null; | ||
| 163 | + } | ||
| 164 | + }, | ||
| 165 | + | ||
| 166 | + spark_line: function() { | ||
| 167 | + $(this.el).find('ul.table .spark_line').toggleClass('on'); | ||
| 168 | + $(this.el).find('ul.table .spark_bar').removeClass('on'); | ||
| 169 | + | ||
| 170 | + $(this.workspace.table.el).find('td.spark').remove(); | ||
| 171 | + if ($(this.el).find('ul.table .spark_line').hasClass('on')) { | ||
| 172 | + this.spark_mode = "spark_line"; | ||
| 173 | + this.workspace.query.setProperty('saiku.ui.render.type', 'spark_line'); | ||
| 174 | + _.delay(this.render_row_viz, 10, "spark_line"); | ||
| 175 | + } else { | ||
| 176 | + this.spark_mode = null; | ||
| 177 | + } | ||
| 178 | + }, | ||
| 179 | + | ||
| 180 | + run_row_viz: function(args) { | ||
| 181 | + if (this.render_mode == "table" && this.spark_mode != null) { | ||
| 182 | + this.render_row_viz(this.spark_mode); | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + }, | ||
| 186 | + | ||
| 187 | + render_row_viz: function(type) { | ||
| 188 | + $(this.workspace.table.el).find('tr').each(function(index, element) { | ||
| 189 | + var rowData = []; | ||
| 190 | + $(element).find('td.data div').each(function(i,data) { | ||
| 191 | + var val = $(data).attr('alt'); | ||
| 192 | + val = (typeof val != "undefined" && val != "" && val != null && val != "undefined") ? parseFloat(val) : 0; | ||
| 193 | + rowData.push(val); | ||
| 194 | + }); | ||
| 195 | + | ||
| 196 | + $("<td class='data spark'> <div id='chart" + index + "'></div></td>").appendTo($(element)); | ||
| 197 | + | ||
| 198 | + var width = rowData.length * 9; | ||
| 199 | + | ||
| 200 | + if (rowData.length > 0) { | ||
| 201 | + var vis = new pv.Panel() | ||
| 202 | + .canvas('chart' + index) | ||
| 203 | + .height(12) | ||
| 204 | + .width(width) | ||
| 205 | + .margin(0); | ||
| 206 | + | ||
| 207 | + if (type == "spark_bar") { | ||
| 208 | + vis.add(pv.Bar) | ||
| 209 | + .data(rowData) | ||
| 210 | + .left(pv.Scale.linear(0, rowData.length).range(0, width).by(pv.index)) | ||
| 211 | + .height(pv.Scale.linear(0,_.max(rowData)).range(0, 12)) | ||
| 212 | + .width(6) | ||
| 213 | + .bottom(0); | ||
| 214 | + } else if (type == "spark_line") { | ||
| 215 | + width = width / 2; | ||
| 216 | + vis.width(width); | ||
| 217 | + vis.add(pv.Line) | ||
| 218 | + .data(rowData) | ||
| 219 | + .left(pv.Scale.linear(0, rowData.length - 1).range(0, width).by(pv.index)) | ||
| 220 | + .bottom(pv.Scale.linear(rowData).range(0, 12)) | ||
| 221 | + .strokeStyle("#000") | ||
| 222 | + .lineWidth(1); | ||
| 223 | + } | ||
| 224 | + vis.render(); | ||
| 225 | + } | ||
| 226 | + }); | ||
| 227 | + } | ||
| 228 | +}); |
mashups/openlayers.js
| 1 | -$i = function(id) | ||
| 2 | -{return document.getElementById(id);}; | ||
| 3 | //seta as variáveis navn e navm | 1 | //seta as variáveis navn e navm |
| 4 | navn = false; | 2 | navn = false; |
| 5 | navm = false; | 3 | navm = false; |
| 4 | +$i = function(id) | ||
| 5 | +{return document.getElementById(id);}; | ||
| 6 | app = navigator.appName.substring(0,1); | 6 | app = navigator.appName.substring(0,1); |
| 7 | if (app==='N'){navn=true;}else{navm=true;} | 7 | if (app==='N'){navn=true;}else{navm=true;} |
| 8 | 8 | ||
| @@ -47,7 +47,7 @@ i3GEO.editorOL = { | @@ -47,7 +47,7 @@ i3GEO.editorOL = { | ||
| 47 | "Base cartográfica", | 47 | "Base cartográfica", |
| 48 | "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&", | 48 | "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&", |
| 49 | {layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'}, | 49 | {layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'}, |
| 50 | - {singleTile:true} | 50 | + {singleTile:false} |
| 51 | ), | 51 | ), |
| 52 | ol_wms: new OpenLayers.Layer.WMS.Untiled( | 52 | ol_wms: new OpenLayers.Layer.WMS.Untiled( |
| 53 | "OpenLayers WMS", | 53 | "OpenLayers WMS", |
| @@ -180,7 +180,7 @@ i3GEO.editorOL = { | @@ -180,7 +180,7 @@ i3GEO.editorOL = { | ||
| 180 | try{ | 180 | try{ |
| 181 | eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';"); | 181 | eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';"); |
| 182 | eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);"); | 182 | eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);"); |
| 183 | - eval("i3GEO.editorOL."+fundo[i]+".singleTile = single;"); | 183 | + eval("i3GEO.editorOL."+fundo[i]+".singleTile = false;"); |
| 184 | eval("alayers.push(i3GEO.editorOL."+fundo[i]+");"); | 184 | eval("alayers.push(i3GEO.editorOL."+fundo[i]+");"); |
| 185 | } | 185 | } |
| 186 | catch(e){ | 186 | catch(e){ |
| @@ -559,9 +559,11 @@ i3GEO.editorOL = { | @@ -559,9 +559,11 @@ i3GEO.editorOL = { | ||
| 559 | ins = "",i; | 559 | ins = "",i; |
| 560 | for(i=0;i<nlayers;i++){ | 560 | for(i=0;i<nlayers;i++){ |
| 561 | try{ | 561 | try{ |
| 562 | - var url = layers[i].getFullRequestString({"request":"getlegendgraphic"}); | ||
| 563 | - url = url.replace("LAYERS","LAYER"); | ||
| 564 | - ins += "<img src='"+url+"' /><br>"; | 562 | + if(layers[i].isBaseLayer === false){ |
| 563 | + var url = layers[i].getFullRequestString({"request":"getlegendgraphic"}); | ||
| 564 | + url = url.replace("LAYERS","LAYER"); | ||
| 565 | + ins += layers[i].name+"<br><img src='"+url+"' /><br>"; | ||
| 566 | + } | ||
| 565 | } | 567 | } |
| 566 | catch(e){} | 568 | catch(e){} |
| 567 | } | 569 | } |
mashups/openlayers.php
| @@ -222,7 +222,12 @@ if($temas != ""){ | @@ -222,7 +222,12 @@ if($temas != ""){ | ||
| 222 | if($l->status == MS_DEFAULT){ | 222 | if($l->status == MS_DEFAULT){ |
| 223 | $visivel = "true"; | 223 | $visivel = "true"; |
| 224 | } | 224 | } |
| 225 | - $objOpenLayers[] = 'new OpenLayers.Layer.WMS( "'.$tituloLayer.'", "../ogc.php?tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&",{layers:"'.$nomeLayer.'",transparent: "true", format: "image/png"},{singleTile:true,visibility:'.$visivel.',isBaseLayer:'.$ebase.'})'; | 225 | + if($tituloLayer != ""){ |
| 226 | + $objOpenLayers[] = 'new OpenLayers.Layer.WMS( "'.$tituloLayer.'", "../ogc.php?tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&",{layers:"'.$nomeLayer.'",transparent: "true", format: "image/png"},{singleTile:true,visibility:'.$visivel.',isBaseLayer:'.$ebase.'})'; | ||
| 227 | + } | ||
| 228 | + else{ | ||
| 229 | + $objOpenLayers[] = 'new OpenLayers.Layer.WMS( "'.$tituloLayer.'", "../ogc.php?tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&",{layers:"'.$nomeLayer.'",transparent: "true", format: "image/png"},{displayInLayerSwitcher:false,singleTile:true,visibility:'.$visivel.',isBaseLayer:'.$ebase.'})'; | ||
| 230 | + } | ||
| 226 | } | 231 | } |
| 227 | } | 232 | } |
| 228 | //var_dump($objOpenLayers);exit; | 233 | //var_dump($objOpenLayers);exit; |
mashups/openlayers_compacto.js
| @@ -3062,7 +3062,7 @@ ol_mma: new OpenLayers.Layer.WMS( | @@ -3062,7 +3062,7 @@ ol_mma: new OpenLayers.Layer.WMS( | ||
| 3062 | "Base cartográfica", | 3062 | "Base cartográfica", |
| 3063 | "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&", | 3063 | "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&", |
| 3064 | {layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'}, | 3064 | {layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'}, |
| 3065 | -{singleTile:true} | 3065 | +{singleTile:false} |
| 3066 | ), | 3066 | ), |
| 3067 | ol_wms: new OpenLayers.Layer.WMS.Untiled( | 3067 | ol_wms: new OpenLayers.Layer.WMS.Untiled( |
| 3068 | "OpenLayers WMS", | 3068 | "OpenLayers WMS", |
| @@ -3195,7 +3195,7 @@ if(fundo[i] != ""){ | @@ -3195,7 +3195,7 @@ if(fundo[i] != ""){ | ||
| 3195 | try{ | 3195 | try{ |
| 3196 | eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';"); | 3196 | eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';"); |
| 3197 | eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);"); | 3197 | eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);"); |
| 3198 | -eval("i3GEO.editorOL."+fundo[i]+".singleTile = single;"); | 3198 | +eval("i3GEO.editorOL."+fundo[i]+".singleTile = false;"); |
| 3199 | eval("alayers.push(i3GEO.editorOL."+fundo[i]+");"); | 3199 | eval("alayers.push(i3GEO.editorOL."+fundo[i]+");"); |
| 3200 | } | 3200 | } |
| 3201 | catch(e){ | 3201 | catch(e){ |
| @@ -3571,9 +3571,11 @@ nlayers = layers.length, | @@ -3571,9 +3571,11 @@ nlayers = layers.length, | ||
| 3571 | ins = "",i; | 3571 | ins = "",i; |
| 3572 | for(i=0;i<nlayers;i++){ | 3572 | for(i=0;i<nlayers;i++){ |
| 3573 | try{ | 3573 | try{ |
| 3574 | +if(layers[i].isBaseLayer === false){ | ||
| 3574 | var url = layers[i].getFullRequestString({"request":"getlegendgraphic"}); | 3575 | var url = layers[i].getFullRequestString({"request":"getlegendgraphic"}); |
| 3575 | url = url.replace("LAYERS","LAYER"); | 3576 | url = url.replace("LAYERS","LAYER"); |
| 3576 | -ins += "<img src='"+url+"' /><br>"; | 3577 | +ins += layers[i].name+"<br><img src='"+url+"' /><br>"; |
| 3578 | +} | ||
| 3577 | } | 3579 | } |
| 3578 | catch(e){} | 3580 | catch(e){} |
| 3579 | } | 3581 | } |
mashups/openlayers_compacto.js.php
| @@ -3062,7 +3062,7 @@ ol_mma: new OpenLayers.Layer.WMS( | @@ -3062,7 +3062,7 @@ ol_mma: new OpenLayers.Layer.WMS( | ||
| 3062 | "Base cartográfica", | 3062 | "Base cartográfica", |
| 3063 | "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&", | 3063 | "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&", |
| 3064 | {layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'}, | 3064 | {layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'}, |
| 3065 | -{singleTile:true} | 3065 | +{singleTile:false} |
| 3066 | ), | 3066 | ), |
| 3067 | ol_wms: new OpenLayers.Layer.WMS.Untiled( | 3067 | ol_wms: new OpenLayers.Layer.WMS.Untiled( |
| 3068 | "OpenLayers WMS", | 3068 | "OpenLayers WMS", |
| @@ -3195,7 +3195,7 @@ if(fundo[i] != ""){ | @@ -3195,7 +3195,7 @@ if(fundo[i] != ""){ | ||
| 3195 | try{ | 3195 | try{ |
| 3196 | eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';"); | 3196 | eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';"); |
| 3197 | eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);"); | 3197 | eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);"); |
| 3198 | -eval("i3GEO.editorOL."+fundo[i]+".singleTile = single;"); | 3198 | +eval("i3GEO.editorOL."+fundo[i]+".singleTile = false;"); |
| 3199 | eval("alayers.push(i3GEO.editorOL."+fundo[i]+");"); | 3199 | eval("alayers.push(i3GEO.editorOL."+fundo[i]+");"); |
| 3200 | } | 3200 | } |
| 3201 | catch(e){ | 3201 | catch(e){ |
| @@ -3571,9 +3571,11 @@ nlayers = layers.length, | @@ -3571,9 +3571,11 @@ nlayers = layers.length, | ||
| 3571 | ins = "",i; | 3571 | ins = "",i; |
| 3572 | for(i=0;i<nlayers;i++){ | 3572 | for(i=0;i<nlayers;i++){ |
| 3573 | try{ | 3573 | try{ |
| 3574 | +if(layers[i].isBaseLayer === false){ | ||
| 3574 | var url = layers[i].getFullRequestString({"request":"getlegendgraphic"}); | 3575 | var url = layers[i].getFullRequestString({"request":"getlegendgraphic"}); |
| 3575 | url = url.replace("LAYERS","LAYER"); | 3576 | url = url.replace("LAYERS","LAYER"); |
| 3576 | -ins += "<img src='"+url+"' /><br>"; | 3577 | +ins += layers[i].name+"<br><img src='"+url+"' /><br>"; |
| 3578 | +} | ||
| 3577 | } | 3579 | } |
| 3578 | catch(e){} | 3580 | catch(e){} |
| 3579 | } | 3581 | } |