Commit ea046a7730b5a963ba49b50ba8f6af8673d6928c
1 parent
ef374e57
Exists in
master
and in
7 other branches
Otimização dos loops do tipo for( nos programas PHP
Showing
13 changed files
with
41 additions
and
41 deletions
Show diff stats
classesphp/classe_alteraclasse.php
... | ... | @@ -120,7 +120,7 @@ cores {array} - array com a lista de valores RGB |
120 | 120 | $numclasses = $this->layer->numclasses; |
121 | 121 | if ($numclasses > 0) |
122 | 122 | { |
123 | - for ($i=0; $i < $numclasses; $i++) | |
123 | + for ($i=0; $i < $numclasses; ++$i) | |
124 | 124 | { |
125 | 125 | $classe = $this->layer->getClass($i); |
126 | 126 | $estilo = $classe->getstyle(0); | ... | ... |
classesphp/classe_atlas.php
... | ... | @@ -153,7 +153,7 @@ locaplic - localiza&ccedil;&atilde;o do i3geo no servidor |
153 | 153 | $layers = array(); |
154 | 154 | $mapa = ms_newMapObj($map_file); |
155 | 155 | $numlayers = $mapa->numlayers; |
156 | - for ($i=0;$i < $numlayers;$i++) | |
156 | + for ($i=0;$i < $numlayers;++$i) | |
157 | 157 | { |
158 | 158 | $l = $mapa->getlayer($i); |
159 | 159 | if (($l->getmetadata("ATLAS")) != "nao") |
... | ... | @@ -206,7 +206,7 @@ locaplic - localiza&ccedil;&atilde;o do i3geo no servidor |
206 | 206 | |
207 | 207 | $mapa = ms_newMapObj($map_file); |
208 | 208 | $numlayers = $mapa->numlayers; |
209 | - for ($i=0;$i < $numlayers;$i++) | |
209 | + for ($i=0;$i < $numlayers;++$i) | |
210 | 210 | { |
211 | 211 | $l = $mapa->getlayer($i); |
212 | 212 | if (($l->getmetadata("ATLAS")) != "nao") | ... | ... |
classesphp/classe_atributos.php
... | ... | @@ -553,7 +553,7 @@ $onde - Tipo de abrang&ecirc;ncia espacial (brasil ou mapa) |
553 | 553 | if (@$l->queryByrect($ret) == MS_SUCCESS) |
554 | 554 | { |
555 | 555 | $res_count = $l->getNumresults(); |
556 | - for ($i = 0; $i < $res_count; $i++) | |
556 | + for ($i = 0; $i < $res_count; ++$i) | |
557 | 557 | { |
558 | 558 | $valitem = array(); |
559 | 559 | if($this->v == 6){ |
... | ... | @@ -743,7 +743,7 @@ $resolucao - Resolucao de busca. |
743 | 743 | function identifica($opcao,$xy,$resolucao) |
744 | 744 | { |
745 | 745 | $numlayers = $mapa->numlayers; |
746 | - for ($i=0;$i < $numlayers;$i++) | |
746 | + for ($i=0;$i < $numlayers;++$i) | |
747 | 747 | { |
748 | 748 | $layer = $mapa->getlayer($i); |
749 | 749 | $tem = $l->name; |
... | ... | @@ -973,7 +973,7 @@ $wkt - (opcional) {boolean} inclui ou n&atilde;o o valor do wkt da geometria |
973 | 973 | { |
974 | 974 | $ltemp = array(); |
975 | 975 | $numlayers = $this->mapa->numlayers; |
976 | - for ($i=0;$i < $numlayers;$i++) | |
976 | + for ($i=0;$i < $numlayers;++$i) | |
977 | 977 | { |
978 | 978 | $tl = $this->mapa->getlayer($i); |
979 | 979 | $tema = $tl->name; | ... | ... |
classesphp/classe_imagem.php
... | ... | @@ -39,26 +39,26 @@ class Imagem |
39 | 39 | { |
40 | 40 | /* |
41 | 41 | Variavel: $arquivoimg |
42 | - | |
42 | + | |
43 | 43 | Arquivo de imagem |
44 | 44 | */ |
45 | 45 | protected $arquivoimg; |
46 | 46 | /* |
47 | 47 | Variavel: $img |
48 | - | |
48 | + | |
49 | 49 | Objeto imagem |
50 | 50 | */ |
51 | 51 | protected $img; |
52 | - | |
52 | + | |
53 | 53 | /* |
54 | 54 | Function: __construct |
55 | 55 | |
56 | -Cria um objeto imagem | |
56 | +Cria um objeto imagem | |
57 | 57 | |
58 | 58 | parameters: |
59 | 59 | |
60 | 60 | $arquivo - Nome completo da imagem em disco. |
61 | -*/ | |
61 | +*/ | |
62 | 62 | function __construct($arquivo) |
63 | 63 | { |
64 | 64 | //error_reporting(E_ALL); |
... | ... | @@ -67,7 +67,7 @@ $arquivo - Nome completo da imagem em disco. |
67 | 67 | $this->arquivoimg = $arquivo; |
68 | 68 | $this->img = imagecreatefrompng($arquivo); |
69 | 69 | imagealphablending($this->img, false); |
70 | - imagesavealpha($this->img, true); | |
70 | + imagesavealpha($this->img, true); | |
71 | 71 | } |
72 | 72 | else |
73 | 73 | {return null;} |
... | ... | @@ -75,12 +75,12 @@ $arquivo - Nome completo da imagem em disco. |
75 | 75 | /* |
76 | 76 | function: fundeIm |
77 | 77 | |
78 | -Funde duas imagens | |
78 | +Funde duas imagens | |
79 | 79 | |
80 | 80 | parameters: |
81 | 81 | |
82 | 82 | $ims: arquivo com a imagem que será sobreposta a atual |
83 | -*/ | |
83 | +*/ | |
84 | 84 | function fundeIm($ims) |
85 | 85 | { |
86 | 86 | if (file_exists($ims)) |
... | ... | @@ -102,8 +102,8 @@ $ims: arquivo com a imagem que ser&aacute; sobreposta a atual |
102 | 102 | /* |
103 | 103 | function: cortaBorda |
104 | 104 | |
105 | -Corta as bordas da imagem baseando-se no primeiro pixel | |
106 | -*/ | |
105 | +Corta as bordas da imagem baseando-se no primeiro pixel | |
106 | +*/ | |
107 | 107 | function cortaBorda() |
108 | 108 | { |
109 | 109 | $sx = imagesx($this->img); |
... | ... | @@ -111,9 +111,9 @@ Corta as bordas da imagem baseando-se no primeiro pixel |
111 | 111 | $corBase = imagecolorat($this->img, 0, 0); |
112 | 112 | $linhai = 0; |
113 | 113 | //pega a linha inicial |
114 | - for ($y = 0; $y < $sy; $y++) | |
114 | + for ($y = 0; $y < $sy; ++$y) | |
115 | 115 | { |
116 | - for ($x = 0; $x < $sx; $x++) | |
116 | + for ($x = 0; $x < $sx; ++$x) | |
117 | 117 | { |
118 | 118 | if (imagecolorat($this->img, $x, $y) != $corBase) |
119 | 119 | {$linhai = $y - 1;break;} |
... | ... | @@ -121,9 +121,9 @@ Corta as bordas da imagem baseando-se no primeiro pixel |
121 | 121 | if ($linhai != 0){break;} |
122 | 122 | } |
123 | 123 | //pega a coluna inicial |
124 | - for ($x = 0; $x < $sx; $x++) | |
124 | + for ($x = 0; $x < $sx; ++$x) | |
125 | 125 | { |
126 | - for ($y = 0; $y < $sy; $y++) | |
126 | + for ($y = 0; $y < $sy; ++$y) | |
127 | 127 | { |
128 | 128 | if (imagecolorat($this->img, $x, $y) != $corBase) |
129 | 129 | {$colunai = $x - 1;break;} |
... | ... | @@ -133,7 +133,7 @@ Corta as bordas da imagem baseando-se no primeiro pixel |
133 | 133 | //pega a linha final |
134 | 134 | for ($y = $sy - 1; $y > 0; $y--) |
135 | 135 | { |
136 | - for ($x = 0; $x < $sx; $x++) | |
136 | + for ($x = 0; $x < $sx; ++$x) | |
137 | 137 | { |
138 | 138 | if (imagecolorat($this->img, $x, $y) != $corBase) |
139 | 139 | {$linhaf = $y + 1;break;} |
... | ... | @@ -143,7 +143,7 @@ Corta as bordas da imagem baseando-se no primeiro pixel |
143 | 143 | //pega a coluna final |
144 | 144 | for ($x = $sx - 1; $x > 0; $x--) |
145 | 145 | { |
146 | - for ($y = 0; $y < $sy; $y++) | |
146 | + for ($y = 0; $y < $sy; ++$y) | |
147 | 147 | { |
148 | 148 | if (imagecolorat($this->img, $x, $y) != $corBase) |
149 | 149 | {$colunaf = $x + 15;break;} |
... | ... | @@ -159,7 +159,7 @@ function: cinzaNormal |
159 | 159 | |
160 | 160 | Converte a imagem atual em tons de cinza |
161 | 161 | |
162 | -*/ | |
162 | +*/ | |
163 | 163 | function cinzaNormal() |
164 | 164 | { |
165 | 165 | imagefilter($this->img, IMG_FILTER_GRAYSCALE); |
... | ... | @@ -174,9 +174,9 @@ Converte para s&eacute;pia clara |
174 | 174 | { |
175 | 175 | $sx = imagesx($this->img); |
176 | 176 | $sy = imagesy($this->img); |
177 | - for ($x = 0; $x < $sx; $x++) | |
177 | + for ($x = 0; $x < $sx; ++$x) | |
178 | 178 | { |
179 | - for ($y = 0; $y < $sy; $y++) | |
179 | + for ($y = 0; $y < $sy; ++$y) | |
180 | 180 | { |
181 | 181 | $rgb = imagecolorat($this->img, $x, $y); |
182 | 182 | $n = min(255,abs((($rgb >> 16) & 0xFF) * .229 + (($rgb >> 8) & 0xFF) * .587 + ($rgb & 0xFF) * .114) + 20); |
... | ... | @@ -197,9 +197,9 @@ Converte para s&eacute;pia normal |
197 | 197 | { |
198 | 198 | $sx = imagesx($this->img); |
199 | 199 | $sy = imagesy($this->img); |
200 | - for ($x = 0; $x < $sx; $x++) | |
200 | + for ($x = 0; $x < $sx; ++$x) | |
201 | 201 | { |
202 | - for ($y = 0; $y < $sy; $y++) | |
202 | + for ($y = 0; $y < $sy; ++$y) | |
203 | 203 | { |
204 | 204 | $rgb = imagecolorat($this->img, $x, $y); |
205 | 205 | $n = min(255,abs((($rgb >> 16) & 0xFF) * .229 + (($rgb >> 8) & 0xFF) * .587 + ($rgb & 0xFF) * .114) + 3); | ... | ... |
classesphp/classe_legenda.php
... | ... | @@ -270,7 +270,7 @@ string de variaveis no formato javascript que permitem montar a legenda. |
270 | 270 | function legendaGrafica() |
271 | 271 | { |
272 | 272 | $numlayers = $this->$mapa->numlayers; |
273 | - for ($i=0;$i < $numlayers;$i++) | |
273 | + for ($i=0;$i < $numlayers;++$i) | |
274 | 274 | { |
275 | 275 | $layer = $this->$mapa->getlayer($i); |
276 | 276 | if (($layer->data != "") && (strtoupper($layer->getmetadata("escondido")) != "SIM") && (strtoupper($layer->getmetadata("tema")) != "NAO")) | ... | ... |
classesphp/classe_vermultilayer.php
classesphp/funcoes_gerais.php
... | ... | @@ -204,7 +204,7 @@ function criaImagemR($nomearq) |
204 | 204 | $trans = 250 / ($maxpixel - $minpixel); |
205 | 205 | $img = imagecreatetruecolor($wh[0],$wh[1]); |
206 | 206 | $celula = 0; |
207 | - for ($x = 0; $x < $wh[0]; $x++) | |
207 | + for ($x = 0; $x < $wh[0]; ++$x) | |
208 | 208 | { |
209 | 209 | for ($y = ($wh[1] - 1); $y >= 0; $y--) |
210 | 210 | { |
... | ... | @@ -2101,7 +2101,7 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa) |
2101 | 2101 | { |
2102 | 2102 | $maptemp = ms_newMapObj($temasdir."/".$tema.".map"); |
2103 | 2103 | $numlayers = $maptemp->numlayers; |
2104 | - for ($i=0;$i < $numlayers;$i++) | |
2104 | + for ($i=0;$i < $numlayers;++$i) | |
2105 | 2105 | { |
2106 | 2106 | $ll = $maptemp->getlayer($i); |
2107 | 2107 | $permite = $ll->getmetadata("permitedownload"); |
... | ... | @@ -2256,7 +2256,7 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa) |
2256 | 2256 | if(file_exists($temasdir."/".$tema.".map")){ |
2257 | 2257 | $maptemp = ms_newMapObj($temasdir."/".$tema.".map"); |
2258 | 2258 | $numlayers = $maptemp->numlayers; |
2259 | - for ($i=0;$i < $numlayers;$i++) | |
2259 | + for ($i=0;$i < $numlayers;++$i) | |
2260 | 2260 | { |
2261 | 2261 | $gl = $maptemp->getlayer($i); |
2262 | 2262 | $gl->set("data",""); |
... | ... | @@ -2916,7 +2916,7 @@ $map_file - arquivo mapfile que ser&aacute; processado |
2916 | 2916 | function sobeAnno($map_file){ |
2917 | 2917 | $mapa = ms_newMapObj($map_file); |
2918 | 2918 | $numlayers = $mapa->numlayers; |
2919 | - for ($i=0;$i<$numlayers;$i++){ | |
2919 | + for ($i=0;$i<$numlayers;++$i){ | |
2920 | 2920 | $layer = $mapa->getlayer($i); |
2921 | 2921 | if($layer->type == 4){ |
2922 | 2922 | $temp = ms_newLayerObj($mapa,$layer); | ... | ... |
classesphp/graficopizza.php
... | ... | @@ -109,12 +109,12 @@ function graficopizza($data,$width,$inclinacao,$shadow_height,$cores,$map_file,$ |
109 | 109 | } |
110 | 110 | for ($i=$centerY+$shadow_height; $i>$centerY; $i--) |
111 | 111 | { |
112 | - for ($j = 0; $j < count($slice); $j++) | |
112 | + for ($j = 0; $j < count($slice); ++$j) | |
113 | 113 | { |
114 | 114 | ImageFilledArc($img, $centerX, $i, $diameterX, $diameterY, $slice[$j][0], $slice[$j][1], $slice[$j][2], IMG_ARC_PIE); |
115 | 115 | } |
116 | 116 | } |
117 | - for ($j = 0; $j < count($slice); $j++) | |
117 | + for ($j = 0; $j < count($slice); ++$j) | |
118 | 118 | { |
119 | 119 | ImageFilledArc($img, $centerX, $centerY, $diameterX, $diameterY, $slice[$j][0], $slice[$j][1], $slice[$j][3], IMG_ARC_PIE); |
120 | 120 | } | ... | ... |
classesphp/mapa_controle.php
... | ... | @@ -153,7 +153,7 @@ if (isset($debug) && strtolower($debug) == "sim") |
153 | 153 | // |
154 | 154 | //teste de timeout |
155 | 155 | // |
156 | -//for($i==0;$i<5000000000;$i++){} | |
156 | +//for($i==0;$i<5000000000;++$i){} | |
157 | 157 | // |
158 | 158 | //ativa o php mapscript e as extensões necessárias |
159 | 159 | //se as extensões já estiverem carregadas no PHP, vc pode comentar essa linha para que o processamento fique mais rápido | ... | ... |
classesphp/mapa_googleearth.php
... | ... | @@ -120,7 +120,7 @@ function retornaWms($map_fileX,$postgis_mapa){ |
120 | 120 | $o->set("imagemode",MS_IMAGEMODE_RGBA); |
121 | 121 | if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao´e alterado |
122 | 122 | $numlayers = $mapa->numlayers; |
123 | - for ($i=0;$i < $numlayers;$i++) | |
123 | + for ($i=0;$i < $numlayers;++$i) | |
124 | 124 | { |
125 | 125 | $l = $mapa->getlayer($i); |
126 | 126 | if ($l->getmetadata("classesnome") != "") | ... | ... |
classesphp/mapa_googlemaps.php
... | ... | @@ -130,7 +130,7 @@ $cache = false; |
130 | 130 | if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao´e alterado |
131 | 131 | |
132 | 132 | $numlayers = $mapa->numlayers; |
133 | - for ($i=0;$i < $numlayers;$i++) | |
133 | + for ($i=0;$i < $numlayers;++$i) | |
134 | 134 | { |
135 | 135 | $l = $mapa->getlayer($i); |
136 | 136 | $layerName = $l->name; |
... | ... | @@ -178,7 +178,7 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao´e alter |
178 | 178 | else{ |
179 | 179 | $mapa->setProjection("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m"); |
180 | 180 | $numlayers = $mapa->numlayers; |
181 | - for ($i=0;$i < $numlayers;$i++) | |
181 | + for ($i=0;$i < $numlayers;++$i) | |
182 | 182 | { |
183 | 183 | $l = $mapa->getlayer($i); |
184 | 184 | if($l->getProjection() == "" ) | ... | ... |
classesphp/mapa_inicia.php
... | ... | @@ -244,7 +244,7 @@ function iniciaMapa() |
244 | 244 | $m->mapa->save($nomefundo); |
245 | 245 | $mf = ms_newMapObj($nomefundo); |
246 | 246 | $numlayers = $mf->numlayers; |
247 | - for($i = 0;$i < $numlayers;$i++) | |
247 | + for($i = 0;$i < $numlayers;++$i) | |
248 | 248 | { |
249 | 249 | $l = $mf->getLayer($i); |
250 | 250 | $l->set("status",MS_DELETE); | ... | ... |
classesphp/mapa_openlayers.php
... | ... | @@ -84,7 +84,7 @@ $qy = file_exists($qyfile); |
84 | 84 | if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alterado |
85 | 85 | $numlayers = $mapa->numlayers; |
86 | 86 | $cache = false; |
87 | - for($i = 0;$i < $numlayers;$i++) | |
87 | + for($i = 0;$i < $numlayers;++$i) | |
88 | 88 | { |
89 | 89 | $l = $mapa->getLayer($i); |
90 | 90 | if ($l->getmetadata("classesnome") != "") | ... | ... |