Commit 65744aed4b425e58cd65a56bf3433a453b34a475

Authored by Edmar Moretti
1 parent ec7a9d48
Exists in master

Adaptacoes para Mapserver 7

aplicmap/geral1debianv7.map 0 → 100755
... ... @@ -0,0 +1,314 @@
  1 +#Este mapfile e utilizado pelo i3geo na instalacao em servidores linux
  2 +#Toda vez que o i3geo e iniciado, esse mapfile e considerado como o mapa basico.
  3 +#Se vc quer alterar a aparência do mapa inicial, edite esse arquivo para refletir
  4 +#o mapa desejado.
  5 +#
  6 +#Se vc quer adicionar temas, dê preferência por editar o arquivo menutemas/menutemas.xml
  7 +#assim, as camadas ficam disponíveis no menu de adicao de temas do i3geo. Nao se esqueca
  8 +#de criar o arquivo mapfile no diretorio i3geo/temas (veja a documentacao no wiki da
  9 +#comunidade i3geo no Portal do Software Publico Brasileiro.
  10 +#
  11 +#Existem varios metadados que podem ser incluidos na definicao de cada LAYER e que sao especificos do i3geo,
  12 +#Esses metadados possibilitam coisas como mostrar ou nao a legenda de um tema no mapa,
  13 +#mostrar ou nao o tema na ferramenta de identificacao, etc.
  14 +#A lista completa de metadados vc pode obter no wiki da comunidade
  15 +#
  16 +MAP
  17 + #
  18 + #edite os caminhos caso a aplicacao esteja instalada em um local diferente do default
  19 + #
  20 + FONTSET "/var/www/i3geo/symbols/fontes.txt"
  21 + SYMBOLSET "/var/www/i3geo/symbols/simbolosv6.sym"
  22 + SHAPEPATH "/var/www/geodados"
  23 + IMAGECOLOR 104 171 195
  24 + MAXSIZE 4096
  25 + #
  26 + #Por default, o i3geo utiliza o tipo de imagem configurado em png2
  27 + #Esse tipo nao e adequado para imagens raster, mas o i3geo muda automaticamente
  28 + #para png1 quando um arquivo raster e adicionado ao mapa
  29 + #
  30 + IMAGETYPE AGG_Q
  31 + #Brasil
  32 + #EXTENT -76.5125927 -39.3925675209 -29.5851853 9.49014852081
  33 + EXTENT -140 -60 140 60
  34 + SIZE 480 500
  35 + STATUS ON
  36 + UNITS DD
  37 + NAME "GERAL"
  38 + DEBUG OFF
  39 + #CONFIG "MS_ERRORFILE" "/tmp/ms_tmp/ms_error.txt"
  40 + #
  41 + #utilize o agg apenas com mapserver 5x
  42 +
  43 + OUTPUTFORMAT
  44 + NAME 'AGG_Q'
  45 + DRIVER AGG/PNG
  46 + IMAGEMODE RGB
  47 + FORMATOPTION "QUANTIZE_FORCE=ON"
  48 + FORMATOPTION "QUANTIZE_DITHER=OFF"
  49 + FORMATOPTION "QUANTIZE_COLORS=256"
  50 + FORMATOPTION "INTERLACE=OFF"
  51 + END
  52 +
  53 + #OUTPUTFORMAT
  54 + # NAME svg
  55 + # MIMETYPE "image/svg+xml"
  56 + # DRIVER cairo/svg
  57 + ##FORMATOPTION "COMPRESSED_OUTPUT=TRUE"
  58 + ##FORMATOPTION "FULL_RESOLUTION=TRUE"
  59 + #END
  60 +
  61 + OUTPUTFORMAT
  62 + NAME jpeg
  63 + DRIVER "AGG/JPEG"
  64 + MIMETYPE "image/jpeg"
  65 + IMAGEMODE RGB
  66 + EXTENSION jpg
  67 + FORMATOPTION "INTERLACE=OFF"
  68 + END
  69 +
  70 + OUTPUTFORMAT
  71 + NAME png1
  72 + MIMETYPE image/png
  73 + DRIVER AGG/PNG
  74 + EXTENSION png
  75 + IMAGEMODE RGB
  76 + TRANSPARENT FALSE
  77 + FORMATOPTION "INTERLACE=OFF"
  78 + END
  79 +
  80 + OUTPUTFORMAT
  81 + NAME png2
  82 + MIMETYPE image/png
  83 + DRIVER AGG/PNG
  84 + EXTENSION png
  85 + IMAGEMODE PC256
  86 + TRANSPARENT TRUE
  87 + FORMATOPTION "INTERLACE=OFF"
  88 + END
  89 +
  90 +
  91 + PROJECTION
  92 + "+proj=longlat +ellps=GRS67 +no_defs"
  93 + END
  94 + LEGEND
  95 + IMAGECOLOR 255 255 255
  96 + KEYSIZE 12 10
  97 + KEYSPACING 5 5
  98 + LABEL
  99 + SIZE 7
  100 + FONT "verdana"
  101 + TYPE truetype
  102 + BUFFER 0
  103 + COLOR 0 0 0
  104 + FORCE FALSE
  105 + MINDISTANCE -1
  106 + MINFEATURESIZE -1
  107 + OFFSET 0 -2
  108 + PARTIALS TRUE
  109 + END
  110 + POSITION LL
  111 + STATUS off
  112 + #edite o caminho se a aplicacao for movida de lugar
  113 + #TEMPLATE "/var/www/i3geo/aplicmap/legenda.htm"
  114 + END
  115 + QUERYMAP
  116 + #OUTLINECOLOR 255 0 0
  117 + COLOR 0 255 255
  118 + SIZE 480 500
  119 + STATUS on
  120 + STYLE hilite
  121 + END
  122 + REFERENCE
  123 + COLOR -1 -1 -1
  124 + EXTENT -75.5728 -37.4751 -30.525 7.57273
  125 + #-79.8713331401 -41.7736536401 -26.2264448599 11.8712346401
  126 + #edite o caminho se a aplicacao for movida de lugar
  127 + IMAGE "/var/www/i3geo/imagens/referencia1.png"
  128 + OUTLINECOLOR -1 -1 -1
  129 + SIZE 150 150
  130 + STATUS off
  131 + MARKER "ref"
  132 + MARKERSIZE 8
  133 + MINBOXSIZE 8
  134 + MAXBOXSIZE 145
  135 + END
  136 + SCALEBAR
  137 + BACKGROUNDCOLOR 200 200 200
  138 + COLOR 0 0 0
  139 + INTERVALS 5
  140 + LABEL
  141 + SIZE TINY
  142 + TYPE BITMAP
  143 + BUFFER 0
  144 + COLOR 0 0 0
  145 + FORCE FALSE
  146 + MINDISTANCE -1
  147 + MINFEATURESIZE -1
  148 + OFFSET 0 0
  149 + PARTIALS TRUE
  150 + END
  151 + POSITION LR
  152 + SIZE 200 2
  153 + STATUS embed
  154 + STYLE 0
  155 + TRANSPARENT FALSE
  156 + UNITS KILOMETERS
  157 + END
  158 + WEB
  159 + #edite o caminho se a aplicacao for movida de lugar
  160 + IMAGEPATH "/tmp/ms_tmp/"
  161 + IMAGEURL "/ms_tmp/"
  162 + TEMPLATE ""
  163 + END
  164 + LAYER
  165 + DATA "/var/www/i3geo/aplicmap/dados/mundo"
  166 + GROUP "mundo"
  167 + METADATA
  168 + "CLASSE" "SIM" #o simbolo sera mostrado na legenda
  169 + "ITENS" "FIPS_CNTRY,GMI_CNTRY,LONG_NAME,CNTRY_NAME" #itens que serao mostrados na opcao de identificacao
  170 + "ITENSDESC" "FIPS,GMI,Nome,Wikipedia" #descricao dos nomes dos itens
  171 + "ITENSLINK" ",,,http://pt.wikipedia.org/wiki/[CNTRY_NAME]"
  172 + "TEMA" "Países do mundo" #nome que sera mostrado na legenda
  173 + "TITULO" "Países do mundo" #nome alternativo que e mostrado nos combos para escolha do tema
  174 + "TIP" "FIPS_CNTRY,GMI_CNTRY,CNTRY_NAME"
  175 + "cache" "sim"
  176 + "itembuscarapida" "LONG_NAME"
  177 + END
  178 + NAME "mundo"
  179 + STATUS OFF
  180 + TEMPLATE "none.htm"
  181 + TYPE POLYGON
  182 + CLASS
  183 + NAME "" #vazio indica que nao sera incluido o nome ao lado do simbolo
  184 + STYLE
  185 + COLOR 230 230 230
  186 + OUTLINECOLOR 255 255 255
  187 + END
  188 + END
  189 + END
  190 + #
  191 + #para mostrar o mapa do Brasil, remova os comentarios
  192 + #
  193 + #LAYER
  194 + # DATA "/var/www/i3geo/aplicmap/dados/estados"
  195 + # METADATA
  196 + # "CLASSE" "SIM"
  197 + # "TEMA" "Brasil"
  198 + # "ESCALA" "250000" #escala utilizada nas marcas ao lado do tema na legenda
  199 + # "IDENTIFICA" "nao"
  200 + # "cache" "sim"
  201 + # "EXTENSAO" "-97.911949 -39.413578 -8.185829 9.511159"
  202 + # END
  203 + # NAME "estados"
  204 + # SIZEUNITS PIXELS
  205 + # STATUS DEFAULT
  206 + # TOLERANCE 0
  207 + # TOLERANCEUNITS PIXELS
  208 + # TRANSPARENCY 100
  209 + # TYPE POLYGON
  210 + # UNITS METERS
  211 + # CLASS
  212 + # NAME " "
  213 + # STYLE
  214 + # COLOR 232 220 201
  215 + # MAXSIZE 100
  216 + # MINSIZE 1
  217 + # SIZE 1
  218 + # SYMBOL 0
  219 + # END
  220 + # END
  221 + #END
  222 + #
  223 + #para mostrar os limites estaduais do Brasil, remova os comentarios
  224 + #
  225 + #LAYER
  226 + # NAME estadosl # ok
  227 + # TYPE line
  228 + # STATUS DEFAULT
  229 + # DATA "/var/www/i3geo/aplicmap/dados/estados"
  230 + # TEMPLATE "estados.htm"
  231 + # METADATA
  232 + # ITENS "ESTADO"
  233 + # ITENSDESC "Estado"
  234 + # TEMA "Limite Estadual"
  235 + # ESCALA "250000"
  236 + # CLASSE "SIM"
  237 + # cache "sim"
  238 + # END
  239 + # CLASS
  240 + # NAME " "
  241 + # STYLE
  242 + # WIDTH 2
  243 + # COLOR 255 255 0
  244 + # OUTLINECOLOR -1 -1 -1
  245 + # END
  246 + # STYLE
  247 + # COLOR 0 0 0
  248 + # OUTLINECOLOR -1 -1 -1
  249 + # END
  250 + # END # CLASS
  251 + #END # LAYER
  252 +
  253 + LAYER
  254 + METADATA
  255 + "TEMA" "NAO"
  256 + "ESCONDIDO" "SIM"
  257 + "cache" "nao"
  258 + END
  259 + NAME "copyright"
  260 + SIZEUNITS PIXELS
  261 + STATUS default
  262 + TOLERANCE 0
  263 + TOLERANCEUNITS PIXELS
  264 + TRANSFORM FALSE
  265 + TYPE POINT
  266 + UNITS METERS
  267 + CLASS
  268 + LABEL
  269 + SIZE TINY
  270 + TYPE BITMAP
  271 + BUFFER 0
  272 + COLOR 50 50 50
  273 + FORCE FALSE
  274 + MINDISTANCE -1
  275 + MINFEATURESIZE -1
  276 + OFFSET 0 0
  277 + PARTIALS TRUE
  278 + POSITION CC
  279 + END
  280 + END
  281 + FEATURE
  282 + POINTS
  283 + 10 5
  284 + END
  285 + TEXT "- i3Geo"
  286 + END
  287 + END
  288 +
  289 + LAYER
  290 + METADATA
  291 + "TEMA" "Rosa dos ventos"
  292 + "IDENTIFICA" "nao"
  293 + "TABELA" "nao"
  294 + "CLASSE" "NAO"
  295 + END
  296 + NAME "rosadosventos"
  297 + SIZEUNITS PIXELS
  298 + STATUS OFF
  299 + TOLERANCE 0
  300 + TOLERANCEUNITS PIXELS
  301 + TRANSFORM lr
  302 + TYPE POINT
  303 + UNITS pixels
  304 + CLASS
  305 + SYMBOL 'rosa200'
  306 + SIZE 90
  307 + END
  308 + FEATURE
  309 + POINTS
  310 + -70 -70
  311 + END
  312 + END
  313 + END
  314 +END
... ...
aplicmap/geral1fedorav7.map 0 → 100755
... ... @@ -0,0 +1,314 @@
  1 +#Este mapfile e utilizado pelo i3geo na instalacao em servidores linux
  2 +#Toda vez que o i3geo e iniciado, esse mapfile e considerado como o mapa basico.
  3 +#Se vc quer alterar a aparência do mapa inicial, edite esse arquivo para refletir
  4 +#o mapa desejado.
  5 +#
  6 +#Se vc quer adicionar temas, dê preferência por editar o arquivo menutemas/menutemas.xml
  7 +#assim, as camadas ficam disponíveis no menu de adicao de temas do i3geo. Nao se esqueca
  8 +#de criar o arquivo mapfile no diretorio i3geo/temas (veja a documentacao no wiki da
  9 +#comunidade i3geo no Portal do Software Publico Brasileiro.
  10 +#
  11 +#Existem varios metadados que podem ser incluidos na definicao de cada LAYER e que sao especificos do i3geo,
  12 +#Esses metadados possibilitam coisas como mostrar ou nao a legenda de um tema no mapa,
  13 +#mostrar ou nao o tema na ferramenta de identificacao, etc.
  14 +#A lista completa de metadados vc pode obter no wiki da comunidade
  15 +#
  16 +MAP
  17 + #
  18 + #edite os caminhos caso a aplicacao esteja instalada em um local diferente do default
  19 + #
  20 + FONTSET "/var/www/html/i3geo/symbols/fontes.txt"
  21 + SYMBOLSET "/var/www/html/i3geo/symbols/simbolosv6.sym"
  22 + SHAPEPATH "/var/www/html/geodados"
  23 + IMAGECOLOR 104 171 195
  24 + MAXSIZE 4096
  25 + #
  26 + #Por default, o i3geo utiliza o tipo de imagem configurado em png2
  27 + #Esse tipo nao e adequado para imagens raster, mas o i3geo muda automaticamente
  28 + #para png1 quando um arquivo raster e adicionado ao mapa
  29 + #
  30 + IMAGETYPE AGG_Q
  31 + #Brasil
  32 + #EXTENT -76.5125927 -39.3925675209 -29.5851853 9.49014852081
  33 + EXTENT -160 -70 160 70
  34 + SIZE 480 500
  35 + STATUS ON
  36 + UNITS DD
  37 + NAME "GERAL"
  38 + DEBUG OFF
  39 + #CONFIG "MS_ERRORFILE" "/tmp/ms_tmp/ms_error.txt"
  40 + #
  41 + #utilize o agg apenas com mapserver 5x
  42 +
  43 + OUTPUTFORMAT
  44 + NAME 'AGG_Q'
  45 + DRIVER AGG/PNG
  46 + IMAGEMODE RGB
  47 + FORMATOPTION "QUANTIZE_FORCE=ON"
  48 + FORMATOPTION "QUANTIZE_DITHER=OFF"
  49 + FORMATOPTION "QUANTIZE_COLORS=256"
  50 + FORMATOPTION "INTERLACE=OFF"
  51 + END
  52 +
  53 + #OUTPUTFORMAT
  54 + # NAME svg
  55 + # MIMETYPE "image/svg+xml"
  56 + # DRIVER cairo/svg
  57 + # #FORMATOPTION "COMPRESSED_OUTPUT=TRUE"
  58 + # #FORMATOPTION "FULL_RESOLUTION=TRUE"
  59 + #END
  60 +
  61 + OUTPUTFORMAT
  62 + NAME jpeg
  63 + DRIVER "AGG/JPEG"
  64 + MIMETYPE "image/jpeg"
  65 + IMAGEMODE RGB
  66 + EXTENSION jpg
  67 + FORMATOPTION "INTERLACE=OFF"
  68 + END
  69 +
  70 + OUTPUTFORMAT
  71 + NAME png1
  72 + MIMETYPE image/png
  73 + DRIVER AGG/PNG
  74 + EXTENSION png
  75 + IMAGEMODE RGB
  76 + TRANSPARENT FALSE
  77 + FORMATOPTION "INTERLACE=OFF"
  78 + END
  79 +
  80 + OUTPUTFORMAT
  81 + NAME png2
  82 + MIMETYPE image/png
  83 + DRIVER AGG/PNG
  84 + EXTENSION png
  85 + IMAGEMODE PC256
  86 + TRANSPARENT TRUE
  87 + FORMATOPTION "INTERLACE=OFF"
  88 + END
  89 +
  90 +
  91 + PROJECTION
  92 + "+proj=longlat +ellps=GRS67 +no_defs"
  93 + END
  94 + LEGEND
  95 + IMAGECOLOR 255 255 255
  96 + KEYSIZE 12 10
  97 + KEYSPACING 5 5
  98 + LABEL
  99 + SIZE 7
  100 + FONT "verdana"
  101 + TYPE truetype
  102 + BUFFER 0
  103 + COLOR 0 0 0
  104 + FORCE FALSE
  105 + MINDISTANCE -1
  106 + MINFEATURESIZE -1
  107 + OFFSET 0 -2
  108 + PARTIALS TRUE
  109 + END
  110 + POSITION LL
  111 + STATUS off
  112 + #edite o caminho se a aplicacao for movida de lugar
  113 + #TEMPLATE "/var/www/html/i3geo/aplicmap/legenda.htm"
  114 + END
  115 + QUERYMAP
  116 + #OUTLINECOLOR 255 0 0
  117 + COLOR 0 255 255
  118 + SIZE 480 500
  119 + STATUS on
  120 + STYLE hilite
  121 + END
  122 + REFERENCE
  123 + COLOR -1 -1 -1
  124 + EXTENT -75.5728 -37.4751 -30.525 7.57273
  125 + #-79.8713331401 -41.7736536401 -26.2264448599 11.8712346401
  126 + #edite o caminho se a aplicacao for movida de lugar
  127 + IMAGE "/var/www/html/i3geo/imagens/referencia1.png"
  128 + OUTLINECOLOR -1 -1 -1
  129 + SIZE 150 150
  130 + STATUS off
  131 + MARKER "ref"
  132 + MARKERSIZE 8
  133 + MINBOXSIZE 8
  134 + MAXBOXSIZE 145
  135 + END
  136 + SCALEBAR
  137 + BACKGROUNDCOLOR 200 200 200
  138 + COLOR 0 0 0
  139 + INTERVALS 5
  140 + LABEL
  141 + SIZE TINY
  142 + TYPE BITMAP
  143 + BUFFER 0
  144 + COLOR 0 0 0
  145 + FORCE FALSE
  146 + MINDISTANCE -1
  147 + MINFEATURESIZE -1
  148 + OFFSET 0 0
  149 + PARTIALS TRUE
  150 + END
  151 + POSITION LR
  152 + SIZE 200 2
  153 + STATUS embed
  154 + STYLE 1
  155 + TRANSPARENT FALSE
  156 + UNITS KILOMETERS
  157 + END
  158 + WEB
  159 + #edite o caminho se a aplicacao for movida de lugar
  160 + IMAGEPATH "/tmp/ms_tmp/"
  161 + IMAGEURL "/ms_tmp/"
  162 + TEMPLATE ""
  163 + END
  164 + LAYER
  165 + DATA "/var/www/html/i3geo/aplicmap/dados/mundo"
  166 + GROUP "mundo"
  167 + METADATA
  168 + "CLASSE" "SIM" #o simbolo sera mostrado na legenda
  169 + "ITENS" "FIPS_CNTRY,GMI_CNTRY,LONG_NAME,CNTRY_NAME" #itens que serao mostrados na opcao de identificacao
  170 + "ITENSDESC" "FIPS,GMI,Nome,Wikipedia" #descricao dos nomes dos itens
  171 + "ITENSLINK" ",,,http://pt.wikipedia.org/wiki/[CNTRY_NAME]"
  172 + "TEMA" "Países do mundo" #nome que sera mostrado na legenda
  173 + "TITULO" "Países do mundo" #nome alternativo que e mostrado nos combos para escolha do tema
  174 + "TIP" "FIPS_CNTRY,GMI_CNTRY,CNTRY_NAME"
  175 + "cache" "sim"
  176 + "itembuscarapida" "LONG_NAME"
  177 + END
  178 + NAME "mundo"
  179 + STATUS OFF
  180 + TEMPLATE "none.htm"
  181 + TYPE POLYGON
  182 + UNITS METERS
  183 + CLASS
  184 + NAME "" #vazio indica que nao sera incluido o nome ao lado do simbolo
  185 + STYLE
  186 + COLOR 230 230 230
  187 + OUTLINECOLOR 255 255 255
  188 + END
  189 + END
  190 + END
  191 + #
  192 + #para mostrar o mapa do Brasil, remova os comentarios
  193 + #
  194 + #LAYER
  195 + # DATA "/var/www/html/i3geo/aplicmap/dados/estados"
  196 + # METADATA
  197 + # "CLASSE" "SIM"
  198 + # "TEMA" "Brasil"
  199 + # "ESCALA" "250000" #escala utilizada nas marcas ao lado do tema na legenda
  200 + # "IDENTIFICA" "nao"
  201 + # "cache" "sim"
  202 + # "EXTENSAO" "-97.911949 -39.413578 -8.185829 9.511159"
  203 + # END
  204 + # NAME "estados"
  205 + # SIZEUNITS PIXELS
  206 + # STATUS DEFAULT
  207 + # TOLERANCE 0
  208 + # TOLERANCEUNITS PIXELS
  209 + # TRANSPARENCY 100
  210 + # TYPE POLYGON
  211 + # UNITS METERS
  212 + # CLASS
  213 + # NAME " "
  214 + # STYLE
  215 + # COLOR 232 220 201
  216 + # MAXSIZE 100
  217 + # MINSIZE 1
  218 + # SIZE 1
  219 + # SYMBOL 0
  220 + # END
  221 + # END
  222 + #END
  223 + #
  224 + #para mostrar os limites estaduais do Brasil, remova os comentarios
  225 + #
  226 + #LAYER
  227 + # NAME estadosl # ok
  228 + # TYPE line
  229 + # STATUS DEFAULT
  230 + # DATA "/var/www/html/i3geo/aplicmap/dados/estados"
  231 + # TEMPLATE "estados.htm"
  232 + # METADATA
  233 + # ITENS "ESTADO"
  234 + # ITENSDESC "Estado"
  235 + # TEMA "Limite Estadual"
  236 + # ESCALA "250000"
  237 + # CLASSE "SIM"
  238 + # cache "sim"
  239 + # END
  240 + # CLASS
  241 + # NAME " "
  242 + # STYLE
  243 + # WIDTH 2
  244 + # COLOR 255 255 0
  245 + # OUTLINECOLOR -1 -1 -1
  246 + # END
  247 + # STYLE
  248 + # COLOR 0 0 0
  249 + # OUTLINECOLOR -1 -1 -1
  250 + # END
  251 + # END # CLASS
  252 + #END # LAYER
  253 +
  254 + LAYER
  255 + METADATA
  256 + #"TEMA" "NAO"
  257 + "ESCONDIDO" "SIM"
  258 + "cache" "sim"
  259 + END
  260 + NAME "copyright"
  261 + SIZEUNITS PIXELS
  262 + STATUS default
  263 + TOLERANCE 0
  264 + TOLERANCEUNITS PIXELS
  265 + TRANSFORM FALSE
  266 + TYPE POINT
  267 + UNITS METERS
  268 + CLASS
  269 + LABEL
  270 + SIZE TINY
  271 + TYPE BITMAP
  272 + BUFFER 0
  273 + COLOR 50 50 50
  274 + FORCE FALSE
  275 + MINDISTANCE -1
  276 + MINFEATURESIZE -1
  277 + OFFSET 0 0
  278 + PARTIALS TRUE
  279 + POSITION CC
  280 + END
  281 + END
  282 + FEATURE
  283 + POINTS
  284 + 10 5
  285 + END
  286 + TEXT "- i3Geo"
  287 + END
  288 + END
  289 + LAYER
  290 + METADATA
  291 + "TEMA" "Rosa dos ventos"
  292 + "IDENTIFICA" "nao"
  293 + "TABELA" "nao"
  294 + "CLASSE" "NAO"
  295 + END
  296 + NAME "rosadosventos"
  297 + SIZEUNITS PIXELS
  298 + STATUS OFF
  299 + TOLERANCE 0
  300 + TOLERANCEUNITS PIXELS
  301 + TRANSFORM lr
  302 + TYPE POINT
  303 + UNITS pixels
  304 + CLASS
  305 + SYMBOL 'rosa200'
  306 + SIZE 90
  307 + END
  308 + FEATURE
  309 + POINTS
  310 + -70 -70
  311 + END
  312 + END
  313 + END
  314 +END
... ...
aplicmap/geral1windowsv7.map 0 → 100755
... ... @@ -0,0 +1,308 @@
  1 +#Este mapfile e utilizado pelo i3geo na instalacao em servidores linux
  2 +#Toda vez que o i3geo e iniciado, esse mapfile e considerado como o mapa basico.
  3 +#Se vc quer alterar a aparência do mapa inicial, edite esse arquivo para refletir
  4 +#o mapa desejado.
  5 +#
  6 +#Se vc quer adicionar temas, dê preferência por editar o arquivo menutemas/menutemas.xml
  7 +#assim, as camadas ficam disponíveis no menu de adicao de temas do i3geo. Nao se esqueca
  8 +#de criar o arquivo mapfile no diretorio i3geo/temas (veja a documentacao no wiki da
  9 +#comunidade i3geo no Portal do Software Publico Brasileiro.
  10 +#
  11 +#Existem varios metadados que podem ser incluidos na definicao de cada LAYER e que sao especificos do i3geo,
  12 +#Esses metadados possibilitam coisas como mostrar ou nao a legenda de um tema no mapa,
  13 +#mostrar ou nao o tema na ferramenta de identificacao, etc.
  14 +#A lista completa de metadados vc pode obter no wiki da comunidade
  15 +#
  16 +MAP
  17 + #
  18 + #edite os caminhos caso a aplicacao esteja instalada em um local diferente do default
  19 + #
  20 + FONTSET "c:\ms4w\apache\htdocs\i3geo\symbols\fontes.txt"
  21 + SYMBOLSET "c:\ms4w\apache\htdocs\i3geo\symbols\simbolosv6.sym"
  22 + DEBUG OFF
  23 + MAXSIZE 4096
  24 + #DEBUG 5
  25 + #CONFIG "MS_ERRORFILE" "c:\ms4w\tmp\ms_error.txt"
  26 +
  27 + SHAPEPATH "c:\ms4w\apache\htdocs\geodados"
  28 + IMAGECOLOR 104 171 195
  29 + IMAGETYPE AGG_Q
  30 + #Brasil
  31 + #EXTENT -76.5125927 -39.3925675209 -29.5851853 9.49014852081
  32 + EXTENT -140 -60 140 60
  33 + SIZE 480 500
  34 + STATUS ON
  35 + UNITS DD
  36 + NAME "GERAL"
  37 +
  38 + OUTPUTFORMAT
  39 + NAME 'AGG_Q'
  40 + DRIVER AGG/PNG
  41 + IMAGEMODE RGB
  42 + FORMATOPTION "QUANTIZE_FORCE=ON"
  43 + FORMATOPTION "QUANTIZE_DITHER=OFF"
  44 + FORMATOPTION "QUANTIZE_COLORS=256"
  45 + FORMATOPTION "INTERLACE=OFF"
  46 + END
  47 +
  48 + OUTPUTFORMAT
  49 + NAME svg
  50 + MIMETYPE "image/svg+xml"
  51 + DRIVER cairo/svg
  52 + IMAGEMODE RGB
  53 + #FORMATOPTION "COMPRESSED_OUTPUT=TRUE"
  54 + #FORMATOPTION "FULL_RESOLUTION=TRUE"
  55 + END
  56 + OUTPUTFORMAT
  57 + NAME jpeg
  58 + DRIVER "AGG/JPEG"
  59 + #MIMETYPE "image/jpeg"
  60 + IMAGEMODE RGB
  61 + EXTENSION jpg
  62 + FORMATOPTION "INTERLACE=OFF"
  63 + END
  64 +
  65 + OUTPUTFORMAT
  66 + NAME png1
  67 + MIMETYPE image/png
  68 + DRIVER AGG/PNG
  69 + EXTENSION png
  70 + IMAGEMODE RGBA
  71 + TRANSPARENT FALSE
  72 + FORMATOPTION "INTERLACE=OFF"
  73 + END
  74 +
  75 + OUTPUTFORMAT
  76 + NAME png2
  77 + MIMETYPE image/png
  78 + DRIVER AGG/PNG
  79 + EXTENSION png
  80 + IMAGEMODE PC256
  81 + TRANSPARENT TRUE
  82 + FORMATOPTION "INTERLACE=OFF"
  83 + END
  84 +
  85 + PROJECTION
  86 + "+proj=longlat +ellps=GRS67 +no_defs"
  87 + END
  88 + LEGEND
  89 + IMAGECOLOR 255 255 255
  90 + KEYSIZE 12 10
  91 + KEYSPACING 5 5
  92 + LABEL
  93 + SIZE 7
  94 + FONT "verdana"
  95 + TYPE truetype
  96 + BUFFER 0
  97 + COLOR 0 0 0
  98 + FORCE FALSE
  99 + MINDISTANCE -1
  100 + MINFEATURESIZE -1
  101 + OFFSET 0 -2
  102 + PARTIALS TRUE
  103 + END
  104 + POSITION LL
  105 + STATUS OFF
  106 + #edite o caminho se a aplicacao for movida de lugar
  107 + #TEMPLATE "c:\ms4w\apache\htdocs\i3geo/aplicmap/legenda.htm"
  108 + END
  109 + QUERYMAP
  110 + #OUTLINECOLOR 255 0 0
  111 + COLOR 0 255 255
  112 + SIZE 480 500
  113 + STATUS on
  114 + STYLE hilite
  115 + END
  116 + REFERENCE
  117 + COLOR -1 -1 -1
  118 + EXTENT -75.5728 -37.4751 -30.525 7.57273#-79.8713331401 -41.7736536401 -26.2264448599 11.8712346401
  119 + #edite o caminho se a aplicacao for movida de lugar
  120 + IMAGE "c:/ms4w/apache/htdocs/i3geo/imagens/referencia1.png"
  121 + OUTLINECOLOR -1 -1 -1
  122 + SIZE 150 150
  123 + STATUS off
  124 + MARKER "ref"
  125 + MARKERSIZE 8
  126 + MINBOXSIZE 8
  127 + MAXBOXSIZE 145
  128 + END
  129 + SCALEBAR
  130 + BACKGROUNDCOLOR 200 200 200
  131 + COLOR 0 0 0
  132 + INTERVALS 5
  133 + LABEL
  134 + SIZE TINY
  135 + TYPE BITMAP
  136 + BUFFER 0
  137 + COLOR 0 0 0
  138 + FORCE FALSE
  139 + MINDISTANCE -1
  140 + MINFEATURESIZE -1
  141 + OFFSET 0 0
  142 + PARTIALS TRUE
  143 + END
  144 + POSITION LR
  145 + SIZE 200 2
  146 + STATUS embed
  147 + STYLE 1
  148 + TRANSPARENT FALSE
  149 + UNITS KILOMETERS
  150 + END
  151 + WEB
  152 + #edite o caminho se a aplicacao for movida de lugar
  153 + IMAGEPATH "c:/ms4w/tmp/ms_tmp/"
  154 + IMAGEURL "/ms_tmp/"
  155 + TEMPLATE ""
  156 + END
  157 + LAYER
  158 + DATA "c:\ms4w\apache\htdocs\i3geo/aplicmap/dados/mundo"
  159 + METADATA
  160 + "CLASSE" "SIM" #o simbolo sera mostrado na legenda
  161 + "ITENS" "FIPS_CNTRY,GMI_CNTRY,LONG_NAME,CNTRY_NAME" #itens que serao mostrados na opcao de identificacao
  162 + "ITENSDESC" "FIPS,GMI,Nome,Wikipedia" #descricao dos nomes dos itens
  163 + "ITENSLINK" ",,,http://pt.wikipedia.org/wiki/[CNTRY_NAME]"
  164 + "TEMA" "Países do mundo" #nome que sera mostrado na legenda
  165 + "TITULO" "Países do mundo" #nome alternativo que e mostrado nos combos para escolha do tema
  166 + "TIP" "FIPS_CNTRY,GMI_CNTRY,CNTRY_NAME"
  167 + #"ESCONDIDO" "sim"
  168 + "cache" "sim"
  169 + "itembuscarapida" "LONG_NAME"
  170 + END
  171 + NAME "mundo"
  172 + STATUS OFF
  173 + TEMPLATE "none.htm"
  174 + TYPE POLYGON
  175 + CLASS
  176 + NAME " " #vazio indica que nao sera incluido o nome ao lado do simbolo
  177 + STYLE
  178 + COLOR 230 230 230
  179 + OUTLINECOLOR 255 255 255
  180 + END
  181 + END
  182 + END
  183 + #
  184 + #para mostrar o mapa do Brasil, remova os comentarios
  185 + #
  186 + #LAYER
  187 + # DATA "c:\ms4w\apache\htdocs\i3geo/aplicmap/dados/estados"
  188 + # METADATA
  189 + # "CLASSE" "SIM"
  190 + # "TEMA" "Brasil"
  191 + # "ESCALA" "250000" #escala utilizada nas marcas ao lado do tema na legenda
  192 + # "IDENTIFICA" "nao"
  193 + # "cache" "sim"
  194 + # "EXTENSAO" "-97.911949 -39.413578 -8.185829 9.511159"
  195 + # END
  196 + # NAME "estados"
  197 + # SIZEUNITS PIXELS
  198 + # STATUS DEFAULT
  199 + # TOLERANCE 0
  200 + # TOLERANCEUNITS PIXELS
  201 + # TRANSPARENCY 100
  202 + # TYPE POLYGON
  203 + # UNITS METERS
  204 + # CLASS
  205 + # NAME " "
  206 + # STYLE
  207 + # COLOR 232 220 201
  208 + # MAXSIZE 100
  209 + # MINSIZE 1
  210 + # SIZE 1
  211 + # SYMBOL 0
  212 + # END
  213 + # END
  214 + #END
  215 + #
  216 + #para mostrar os limites estaduais do Brasil, remova os comentarios
  217 + #
  218 + #LAYER
  219 + # NAME estadosl # ok
  220 + # TYPE line
  221 + # STATUS DEFAULT
  222 + # DATA "c:/ms4w/apache/htdocs/i3geo/aplicmap/dados/estados.shp"
  223 + # TEMPLATE "estados.htm"
  224 + # METADATA
  225 + # ITENS "ESTADO"
  226 + # ITENSDESC "Estado"
  227 + # TEMA "Limite Estadual"
  228 + # ESCALA "250000"
  229 + # CLASSE "SIM"
  230 + # cache "sim"
  231 + # END
  232 + # CLASS
  233 + # NAME " "
  234 + # STYLE
  235 + # WIDTH 2
  236 + # COLOR 255 255 0
  237 + # OUTLINECOLOR -1 -1 -1
  238 + # END
  239 + # STYLE
  240 + # COLOR 0 0 0
  241 + # OUTLINECOLOR -1 -1 -1
  242 + # END
  243 + # END # CLASS
  244 + #END # LAYER
  245 +
  246 + LAYER
  247 + METADATA
  248 + #"TEMA" "NAO"
  249 + "ESCONDIDO" "SIM"
  250 + "cache" "sim"
  251 + END
  252 + NAME "copyright"
  253 + SIZEUNITS PIXELS
  254 + STATUS DEFAULT
  255 + TOLERANCE 0
  256 + TOLERANCEUNITS PIXELS
  257 + TRANSFORM FALSE
  258 + TYPE POINT
  259 + UNITS METERS
  260 + CLASS
  261 + LABEL
  262 + SIZE TINY
  263 + TYPE BITMAP
  264 + BUFFER 0
  265 + COLOR 50 50 50
  266 + FORCE FALSE
  267 + MINDISTANCE -1
  268 + MINFEATURESIZE -1
  269 + OFFSET 0 0
  270 + PARTIALS TRUE
  271 + POSITION CC
  272 + END
  273 + END
  274 + FEATURE
  275 + POINTS
  276 + 10 5
  277 + END
  278 + TEXT "- i3Geo"
  279 + END
  280 + END
  281 + LAYER
  282 + METADATA
  283 + "TEMA" "Rosa dos ventos"
  284 + "IDENTIFICA" "nao"
  285 + "TABELA" "nao"
  286 + "CLASSE" "NAO"
  287 + #"cache" "sim"
  288 + END
  289 + NAME "rosadosventos"
  290 + SIZEUNITS PIXELS
  291 + STATUS OFF
  292 + TOLERANCE 0
  293 + TOLERANCEUNITS PIXELS
  294 + TRANSFORM lr
  295 + TYPE POINT
  296 + UNITS pixels
  297 + CLASS
  298 + SYMBOL 'rosa200'
  299 + SIZE 90
  300 + END
  301 + FEATURE
  302 + POINTS
  303 + -70 -70
  304 + END
  305 + END
  306 + END
  307 +
  308 +END
0 309 \ No newline at end of file
... ...
aplicmap/ogcwsv7.map 0 → 100755
... ... @@ -0,0 +1,149 @@
  1 +MAP
  2 + EXTENT -76.512593 -36.948432 -29.585185 7.046013
  3 + FONTSET "../symbols/fontes.txt"
  4 + SYMBOLSET "../symbols/simbolosv6.sym"
  5 + IMAGECOLOR 255 255 255
  6 + IMAGETYPE png
  7 + MAXSIZE 10000
  8 + SHAPEPATH "/opt/www/html/geodados"
  9 + SIZE 450 450
  10 + STATUS ON
  11 + UNITS METERS
  12 + #CONFIG MS_NONSQUARE "YES"
  13 + #CONFIG MS_ERRORFILE "/ms4w/tmp/ms_error.txt"
  14 + NAME "i3geoogc"
  15 + DEBUG OFF
  16 + #DEBUG 5
  17 + #CONFIG "MS_ERRORFILE" "/tmp/ms_tmp/ms_error.txt"
  18 + OUTPUTFORMAT
  19 + NAME 'png'
  20 + MIMETYPE "image/png"
  21 + DRIVER AGG/PNG
  22 + IMAGEMODE RGBA
  23 + FORMATOPTION "QUANTIZE_FORCE=ON"
  24 + FORMATOPTION "QUANTIZE_DITHER=OFF"
  25 + FORMATOPTION "QUANTIZE_COLORS=256"
  26 + FORMATOPTION "INTERLACE=OFF"
  27 + TRANSPARENT TRUE
  28 + END
  29 + OUTPUTFORMAT
  30 + NAME 'shape-zip'
  31 + DRIVER 'OGR/ESRI Shapefile'
  32 + IMAGEMODE FEATURE
  33 + END
  34 + OUTPUTFORMAT
  35 + NAME "csv"
  36 + DRIVER "OGR/CSV"
  37 + #MIMETYPE "text/csv"
  38 + FORMATOPTION "LCO:GEOMETRY=AS_WKT"
  39 + FORMATOPTION "STORAGE=memory"
  40 + #FORMATOPTION "FILENAME=result.csv"
  41 + END
  42 + OUTPUTFORMAT
  43 + NAME 'kml'
  44 + DRIVER 'OGR/KML'
  45 + MIMETYPE "application/vnd.google-earth.kml+xml"
  46 + #FORMATOPTION "STORAGE=memory"
  47 + IMAGEMODE FEATURE
  48 + END
  49 + OUTPUTFORMAT
  50 + NAME "geojson"
  51 + DRIVER "OGR/GEOJSON"
  52 + #MIMETYPE "application/json; subtype=geojson"
  53 + FORMATOPTION "STORAGE=memory"
  54 + FORMATOPTION "FORM=SIMPLE"
  55 + END
  56 +
  57 + PROJECTION
  58 + "+proj=longlat +ellps=GRS67 +no_defs"
  59 + END
  60 + LEGEND
  61 + IMAGECOLOR 255 255 255
  62 + KEYSIZE 10 10
  63 + KEYSPACING 5 5
  64 + LABEL
  65 + ANGLE 0.000000
  66 + ANTIALIAS TRUE
  67 + FONT "verdana"
  68 + MAXSIZE 256
  69 + MINSIZE 4
  70 + SIZE 10
  71 + TYPE TRUETYPE
  72 + BUFFER 0
  73 + COLOR 0 0 0
  74 + FORCE FALSE
  75 + MINDISTANCE -1
  76 + MINFEATURESIZE -1
  77 + OFFSET 0 0
  78 + PARTIALS FALSE
  79 + END
  80 + POSITION UL
  81 + STATUS ON
  82 + END
  83 +
  84 + QUERYMAP
  85 + COLOR 255 255 0
  86 + SIZE -1 -1
  87 + STATUS OFF
  88 + STYLE HILITE
  89 + END
  90 +
  91 + SCALEBAR
  92 + ALIGN CENTER
  93 + COLOR 0 0 0
  94 + IMAGECOLOR 255 255 255
  95 + INTERVALS 4
  96 + LABEL
  97 + SIZE MEDIUM
  98 + TYPE BITMAP
  99 + BUFFER 0
  100 + COLOR 0 0 0
  101 + FORCE FALSE
  102 + MINDISTANCE -1
  103 + MINFEATURESIZE -1
  104 + OFFSET 0 0
  105 + PARTIALS TRUE
  106 + END
  107 + POSITION LL
  108 + SIZE 200 3
  109 + STATUS OFF
  110 + STYLE 0
  111 + UNITS MILES
  112 + END
  113 +
  114 + WEB
  115 + IMAGEPATH "/tmp/ms_tmp/"
  116 + IMAGEURL "/ms_tmp/"
  117 + #nao coloque texto com acentuacao aqui
  118 + METADATA
  119 + "ows_country" "Brasil"
  120 + "ows_keywordlist" "i3Geo"
  121 + "ows_context_fid" "i3geo"
  122 + "ows_city" "Brasilia"
  123 + "ows_contactperson" "Web Master"
  124 + "ows_addresstype" "uri"
  125 + "ows_context_version" "1.1.1"
  126 + "wms_getcapabilities_version" "1.1.1"
  127 + "ows_abstract" "Web services gerados da base de dados do i3Geo. Para chamar um tema especificamente, veja o sistema de ajuda, digitando no navegador web ogc.php?ajuda=, para uma lista compacta de todos os servicos, digite ogc.php?lista=temas"
  128 + "ows_contactposition" "Administrador do sitio web"
  129 + "ows_stateorprovince" "DF"
  130 + "ows_contactorganization" "Coordenacao Geral de TI"
  131 + "ows_name" "i3geoogc"
  132 + "ows_accessconstraints" "vedado o uso comercial"
  133 + "ows_fees" "none"
  134 + "ows_contactelectronicmailaddress" ""
  135 + "ows_getcontext_enabled" "1"
  136 + "ows_namespace_uri" "http://www.omsug.ca/osgis2004"
  137 + "ows_address" "http://www.mma.gov.br"
  138 + "ows_postcode" ""
  139 + "ows_enable_request" "*"
  140 + "ows_sld_enabled" "true"
  141 + "wms_feature_info_mime_type" "application/json"
  142 + END
  143 + QUERYFORMAT text/html
  144 + LEGENDFORMAT text/html
  145 + BROWSEFORMAT text/html
  146 + TEMPLATE "none.htm"
  147 + END
  148 +
  149 +END
... ...
aplicmap/simlinv7.map 0 → 100755
... ... @@ -0,0 +1,27 @@
  1 +MAP
  2 +SYMBOLSET ../symbols/simboloslinv6.sym
  3 +FONTSET "../symbols/fontes.txt"
  4 + LAYER
  5 + METADATA
  6 + END
  7 + NAME "linha"
  8 + SIZEUNITS PIXELS
  9 + STATUS OFF
  10 + TOLERANCE 0
  11 + TOLERANCEUNITS PIXELS
  12 + TYPE LINE
  13 + UNITS METERS
  14 + CLASS
  15 + NAME ""
  16 + METADATA
  17 + END
  18 + STYLE
  19 + COLOR 0 0 0
  20 + MAXSIZE 500
  21 + MINSIZE 1
  22 + SIZE 5
  23 + SYMBOL "linha"
  24 + END
  25 + END
  26 + END
  27 +END
0 28 \ No newline at end of file
... ...
aplicmap/simpolv7.map 0 → 100755
... ... @@ -0,0 +1,29 @@
  1 +MAP
  2 +SYMBOLSET ../symbols/simbolospolv6.sym
  3 +FONTSET "../symbols/fontes.txt"
  4 + DEBUG OFF
  5 + #DEBUG 5
  6 + #CONFIG "MS_ERRORFILE" "/ms4w/tmp/ms_error.txt"
  7 +LAYER
  8 + METADATA
  9 + END
  10 + NAME "p0"
  11 + SIZEUNITS PIXELS
  12 + STATUS OFF
  13 + TOLERANCE 0
  14 + TOLERANCEUNITS PIXELS
  15 + TYPE POLYGON
  16 + UNITS METERS
  17 + CLASS
  18 + NAME ""
  19 + METADATA
  20 + END
  21 + STYLE
  22 + COLOR 0 0 0
  23 + MAXSIZE 500
  24 + MINSIZE 1
  25 + SYMBOL "p0"
  26 + END
  27 + END
  28 + END
  29 +END
0 30 \ No newline at end of file
... ...
aplicmap/simptv7.map 0 → 100755
... ... @@ -0,0 +1,27 @@
  1 +MAP
  2 +SYMBOLSET ../symbols/simbolosptv6.sym
  3 +FONTSET "../symbols/fontes.txt"
  4 + LAYER
  5 + METADATA
  6 + END
  7 + NAME "seta"
  8 + SIZEUNITS PIXELS
  9 + STATUS OFF
  10 + TOLERANCE 0
  11 + TOLERANCEUNITS PIXELS
  12 + TYPE POINT
  13 + UNITS METERS
  14 + CLASS
  15 + NAME ""
  16 + METADATA
  17 + END
  18 + STYLE
  19 + COLOR 0 0 0
  20 + MAXSIZE 500
  21 + MINSIZE 1
  22 + SIZE 8
  23 + SYMBOL "ponto"
  24 + END
  25 + END
  26 + END
  27 +END
0 28 \ No newline at end of file
... ...
classesphp/classe_legenda.php
... ... @@ -659,8 +659,8 @@ class Legenda
659 659 else
660 660 {$mapatemp = ms_newMapObj($this->localaplicacao."/aplicmap/".$t);
661 661 }
662   -
663 662 $l = $mapatemp->getlayer(0);
  663 +
664 664 if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
665 665 {
666 666 $novoss = dirname($this->mapa->symbolsetfilename)."\\".basename($mapatemp->symbolsetfilename);
... ... @@ -673,11 +673,13 @@ class Legenda
673 673 for ($i=0;$i < $ns;++$i)
674 674 {
675 675 $oSymbol = $this->mapa->getSymbolObjectById($i);
  676 +
676 677 $nomes = $oSymbol->name;
677 678 if($nomes == "")
678 679 {
679 680 $nomes = $i;
680 681 }
  682 +
681 683 $adiciona = ms_newLayerObj($this->mapa, $l);
682 684 $nomel = $l->name;
683 685 $tematemp= $this->mapa->getlayerbyname($nomel);
... ... @@ -686,8 +688,11 @@ class Legenda
686 688 $e->set("symbolname",$nomes);
687 689 $e->set("size",$tamanho);
688 690 $e->set("width",$width);
  691 +
689 692 $ico = $c->createLegendIcon(40,40);
  693 +
690 694 $nimg = $ico->saveWebImage();
  695 +
691 696 $pat = $this->mapa->web->imageurl;
692 697 $ins .= "<img src='".$nimg."' style='cursor:pointer;border: 5px solid #FFFFFF' title=".$nomes." onclick='".$onclick."'>";
693 698 }
... ...
classesphp/mapa_inicia.php
... ... @@ -286,7 +286,7 @@ function iniciaMapa()
286 286 $copyright = "";
287 287 $lc = $m->mapa->getlayerbyname("copyright");
288 288 if($lc != "" && $lc->status == MS_DEFAULT ){
289   - if($versao["principal"] == 6){
  289 + if($versao["principal"] > 6){
290 290 $shape = $lc->getShape(new resultObj(0));
291 291 $copyright = $shape->text;
292 292 }
... ...
ferramentas/editorgm/editorgm.js 0 → 100755
... ... @@ -0,0 +1,2056 @@
  1 +//TODO documentar
  2 +//TODO incluir balao de informacoes como um elemento grafico de desenho
  3 +//TODO incluir caixas de texto
  4 +//TODO incluir undo na edicao
  5 +
  6 +/*
  7 + Editor vetorial de limites para a interface google maps
  8 +
  9 + Utilizado em i3geo/metaestat/editorlimites.php
  10 +
  11 + Utiliza a API do Google Maps e pacotes/wicket/wicket.js (que cria o objeto Wkt com funcoes para processamento de Wkt)
  12 +
  13 + Licenca:
  14 +
  15 + GPL2
  16 +
  17 + i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  18 +
  19 + Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil
  20 + Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
  21 +
  22 + Esse programa utiliza parcialmente os codigos da aplicacao calculadora de carbono desenvolvido pelo
  23 + IPAM - Instituto de Pesquisa Ambiental da Amazonia
  24 +
  25 + Este programa e software livre; voce pode redistribui-lo
  26 + e/ou modifica-lo sob os termos da Licenca Publica Geral
  27 + GNU conforme publicada pela Free Software Foundation;
  28 +
  29 + Este programa e distribuido na expectativa de que seja util,
  30 + porem, SEM NENHUMA GARANTIA; nem mesmo a garantia implicita
  31 + de COMERCIABILIDADE OU ADEQUACAO A UMA FINALIDADE ESPECIFICA.
  32 + Consulte a Licenca Publica Geral do GNU para mais detalhes.
  33 + Voce deve ter recebido uma copia da Licenca Publica Geral do
  34 + GNU junto com este programa; se nao, escreva para a
  35 + Free Software Foundation, Inc., no endereco
  36 + 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  37 + */
  38 +//
  39 +if (typeof (i3GEO) === 'undefined') {
  40 + var i3GEO = {};
  41 +}
  42 +/*
  43 + * Classe i3GEO.editorGM
  44 + *
  45 + * Fun&ccedil;&otilde;es de edi&ccedil;&atilde;o vetorial utilizadas pelo editor de regi&otilde;es do sistema METAESTAT
  46 + */
  47 +i3GEO.editorGM =
  48 + {
  49 + iconePonto : function(sel) {
  50 + if (sel) {
  51 + return i3GEO.configura.locaplic + "/imagens/google/symbol_middot_y.png";
  52 + } else {
  53 + return i3GEO.configura.locaplic + "/imagens/google/symbol_middot.png";
  54 + }
  55 + },
  56 + /**
  57 + * Objeto DOM com a imagem de aguarde existente no cabecalho da janela
  58 + *
  59 + */
  60 + aguarde : "",
  61 + /**
  62 + * Guarda o Id do DIV que recebera o conteudo HTML do editor
  63 + */
  64 + iddiv : "",
  65 + /**
  66 + * Objeto criado com new google.maps.drawing.DrawingManager
  67 + */
  68 + drawingManager : "",
  69 + selectedShape : null,
  70 + /**
  71 + * guarda o mapeamento entre o codigo da regiao e o codigo do layer adicionado ao mapa
  72 + */
  73 + regioestemas : {},
  74 + /**
  75 + * Guarda o mapeamento entre o codigo da regiao e o codigo do layer adicionado ao mapa
  76 + */
  77 + temasregioes : {},
  78 + /**
  79 + * Guarda os dados descritivos sobre cada regiao obtidos na formacao no combo de escolha de regioes
  80 + */
  81 + descregioes : [],
  82 + /**
  83 + * Inicia o editor
  84 + *
  85 + * Cria o objeto da API do Google Maps com new google.maps.drawing.DrawingManager A janela flutuante que recebera os componentes do
  86 + * editor ja deve estar aberta (veja editorlimites.php) Executa i3GEO.editorGM.html
  87 + *
  88 + * @param Id
  89 + * do DIV que recebera o conteudo HTML do editor
  90 + */
  91 + inicia : function(iddiv) {
  92 + var i, n, ics;
  93 + // mensagem
  94 + // i3GEO.janela.tempoMsg("Aten&ccedil;&atilde;o: apenas tabelas no esquema i3geo_metaestat podem ser editadas.");
  95 + i3GEO.editorGM.iddiv = iddiv;
  96 + $i(iddiv).innerHTML = i3GEO.editorGM.html();
  97 + ics = $i(iddiv).getElementsByTagName("button");
  98 + n = ics.length;
  99 + i3GEO.barraDeBotoes.ativaBotoes();
  100 + i3GEO.editorGM.comboRegiaoEditavel();
  101 + for (i = 0; i < n; i++) {
  102 + ics[i].style.backgroundColor = "white";
  103 + ics[i].className = "iconeGuiaMovel";
  104 + ics[i].onmouseout = function() {
  105 + this.className = "iconeGuiaMovel iconeGuiaMovelMouseOut";
  106 + };
  107 + ics[i].onmouseover = function() {
  108 + this.className = "iconeGuiaMovel iconeGuiaMovelMouseOver";
  109 + };
  110 + ics[i].style.backgroundImage = "none";
  111 + ics[i].style.height = "32px";
  112 + ics[i].style.width = "32px";
  113 + ics[i].style.border = "1px solid gray";
  114 + ics[i].style.margin = "0px";
  115 + }
  116 + i3GEO.editorGM.drawingManager =
  117 + new google.maps.drawing.DrawingManager({
  118 + drawingMode : google.maps.drawing.OverlayType.POLYGON,
  119 + drawingControl : false,
  120 + drawingControlOptions : {
  121 + position : google.maps.ControlPosition.TOP_CENTER,
  122 + drawingModes : [
  123 + google.maps.drawing.OverlayType.POLYGON,
  124 + google.maps.drawing.OverlayType.MARKER,
  125 + google.maps.drawing.OverlayType.POLYLINE
  126 + ]
  127 + },
  128 + markerOptions : {
  129 + icon : i3GEO.editorGM.iconePonto(),
  130 + clickable : true,
  131 + zIndex : 1,
  132 + draggable : true,
  133 + tema : "",
  134 + colunaid : "",
  135 + valorid : "",
  136 + colunanome : "",
  137 + valornome : "",
  138 + editable : false
  139 + },
  140 + polygonOptions : {
  141 + fillColor : '#ffff00',
  142 + fillOpacity : .5,
  143 + strokeWeight : 2,
  144 + clickable : true,
  145 + zIndex : 1,
  146 + editable : true,
  147 + tema : "",
  148 + colunaid : "",
  149 + valorid : "",
  150 + colunanome : "",
  151 + valornome : ""
  152 + }
  153 + });
  154 + i3GEO.editorGM.drawingManager.setMap(i3GeoMap);
  155 + i3GEO.editorGM.drawingManager.setDrawingMode(null);
  156 + google.maps.event.addListener(i3GEO.editorGM.drawingManager, 'overlaycomplete', function(e) {
  157 + // if (e.type != google.maps.drawing.OverlayType.MARKER) {
  158 + i3GEO.editorGM.drawingManager.setDrawingMode(null);
  159 + i3GEO.editorGM.mudaicone();
  160 + var newShape = e.overlay;
  161 + newShape.type = e.type;
  162 + newShape.tema = $i("i3geoCartoRegioesEditaveis").value;
  163 + newShape.colunaid = "";
  164 + newShape.valorid = "";
  165 + newShape.colunanome = "";
  166 + newShape.valornome = "";
  167 + google.maps.event.addListener(newShape, 'click', function() {
  168 + i3GEO.editorGM.setSelection(newShape);
  169 + });
  170 + i3GEO.editorGM.setSelection(newShape);
  171 + i3GEO.desenho.googlemaps.shapes.push(newShape);
  172 + // }
  173 + });
  174 + google.maps.event.addListener(i3GEO.editorGM.drawingManager, 'drawingmode_changed', i3GEO.editorGM.clearSelection);
  175 + google.maps.event.addListener(i3GeoMap, 'click', i3GEO.editorGM.clearSelection);
  176 + },
  177 + /**
  178 + * Atualiza as camadas do mapa que sao oriundas do sistema METAESTAT Busca a lista de camadas com
  179 + * ferramentas/metaestat/analise.php?funcao=LISTACAMADASMETAESTAT Faz um loop para atualizar cada camada
  180 + */
  181 + atualizaCamadasMetaestat : function() {
  182 + var p =
  183 + i3GEO.configura.locaplic + "/ferramentas/metaestat/analise.php?funcao=LISTACAMADASMETAESTAT&g_sid=" + i3GEO.configura.sid, temp =
  184 + function(retorno) {
  185 + var n = retorno.data.length, i;
  186 + for (i = 0; i < n; i++) {
  187 + i3GEO.Interface.atualizaTema("", retorno.data[i]);
  188 + }
  189 + };
  190 + cpJSON.call(p, "foo", temp);
  191 + },
  192 + /**
  193 + * Monta o codigo HTML com o conteudo da ferramenta Define os botoes e demais elementos que serao preenchidos via codigo
  194 + *
  195 + * @return html
  196 + */
  197 + html : function() {
  198 + var ins =
  199 + '<div style=margin-left:5px >' + ' <button title="' + $trad("dpol")
  200 + + '" onclick="i3GEO.editorGM.digitalizaPol(this)"><img src="'
  201 + + i3GEO.configura.locaplic
  202 + + '/imagens/gisicons/polygon-create.png" /></button>'
  203 + + ' <button title="'
  204 + + $trad("dponto")
  205 + + '" onclick="i3GEO.editorGM.digitalizaPt(this)"><img src="'
  206 + + i3GEO.configura.locaplic
  207 + + '/imagens/gisicons/point-create.png" /></button>'
  208 + + ' <button title="'
  209 + + $trad("capturar")
  210 + + '" onclick="i3GEO.editorGM.capturaPoligonoTema.ativa(this)"><img src="'
  211 + + i3GEO.configura.locaplic
  212 + + '/imagens/gisicons/layer-import.png" /></button>'
  213 + + ' <button title="'
  214 + + $trad("d24t")
  215 + + '" onclick="i3GEO.editorGM.seleciona(this)"><img src="'
  216 + + i3GEO.configura.locaplic
  217 + + '/imagens/gisicons/select.png" /></button>'
  218 + + ' <button title="'
  219 + + $trad("studo")
  220 + + '" onclick="i3GEO.editorGM.selectAll(this)"><img src="'
  221 + + i3GEO.configura.locaplic
  222 + + '/imagens/gisicons/selectall.png" /></button>'
  223 + + ' <button title="'
  224 + + $trad("excsel")
  225 + + '" onclick="i3GEO.editorGM.deleteSelectedShape()"><img src="'
  226 + + i3GEO.configura.locaplic
  227 + + '/imagens/gisicons/selected-delete.png" /></button>'
  228 + + ' <button title="'
  229 + + $trad("salvexc")
  230 + + '" onclick="i3GEO.editorGM.salvaLimite.inicia()"><img src="'
  231 + + i3GEO.configura.locaplic
  232 + + '/imagens/gisicons/vector-save.png" /></button>'
  233 + + ' <button title="'
  234 + + $trad("edatrib")
  235 + + '" onclick="i3GEO.editorGM.editarAtributos.ativa(this)"><img src="'
  236 + + i3GEO.configura.locaplic
  237 + + '/imagens/gisicons/annotation-form.png" /></button>'
  238 + + ' <button title="'
  239 + + $trad("s1")
  240 + + '" onmousedown="i3GEO.editorGM.mudaicone()" onclick="i3GEO.editorGM.ajuda()" ><img src="'
  241 + + i3GEO.configura.locaplic
  242 + + '/imagens/gisicons/help-contents.png" /></button>'
  243 + + ' <br><div id="i3geoCartoRegioesEditaveisDiv" ><img style="display:block;z-index:2" src="'
  244 + + i3GEO.configura.locaplic
  245 + + '/imagens/aguarde.gif" /></div></div>'; // combo para escolher a regiao
  246 + return ins;
  247 + },
  248 + /**
  249 + * Atualiza a ferramenta quando a janela flutuante tem seu foco ativado
  250 + */
  251 + ativaFoco : function() {
  252 + i3GEO.util.mudaCursor(i3GEO.configura.cursores, "crosshair", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic);
  253 + i3GEO.barraDeBotoes.ativaIcone("pan");
  254 + i3GEO.editorGM.mudaicone();
  255 + i3GEO.Interface.googlemaps.recalcPar();
  256 + },
  257 + /**
  258 + * Marca uma figura como selecionada
  259 + *
  260 + * @param objeto
  261 + * shape que sera marcado
  262 + */
  263 + setSelection : function(shape) {
  264 + if (shape.setEditable) {
  265 + shape.setEditable(!shape.editable);
  266 + } else {
  267 + shape.editable = true;
  268 + shape.setIcon({
  269 + url : i3GEO.editorGM.iconePonto(true)
  270 + });
  271 + }
  272 + },
  273 + /**
  274 + * Marca todas as figuras como nao selecionadas As figuras existentes no mapa sao mantidas na variavel
  275 + * i3GEO.desenho.googlemaps.shapes
  276 + */
  277 + clearSelection : function() {
  278 + var i, n = i3GEO.desenho.googlemaps.shapes.length;
  279 + for (i = 0; i < n; i++) {
  280 + if (i3GEO.desenho.googlemaps.shapes[i] != "" && i3GEO.desenho.googlemaps.shapes[i].setEditable) {
  281 + i3GEO.desenho.googlemaps.shapes[i].setEditable(false);
  282 + } else if (i3GEO.desenho.googlemaps.shapes[i] != "") {// caso for ponto
  283 + i3GEO.desenho.googlemaps.shapes[i].editable = false;
  284 + if (i3GEO.desenho.googlemaps.shapes[i].setIcon) {
  285 + i3GEO.desenho.googlemaps.shapes[i].setIcon({
  286 + url : i3GEO.editorGM.iconePonto(false)
  287 + });
  288 + }
  289 + }
  290 + }
  291 + },
  292 + /**
  293 + * Marca todas as figuras como selecionadas As figuras existentes no mapa sao mantidas na variavel i3GEO.desenho.googlemaps.shapes
  294 + */
  295 + selectAll : function() {
  296 + var i, n = i3GEO.desenho.googlemaps.shapes.length;
  297 + for (i = 0; i < n; i++) {
  298 + if (i3GEO.desenho.googlemaps.shapes[i] != "" && i3GEO.desenho.googlemaps.shapes[i].setEditable) {
  299 + i3GEO.desenho.googlemaps.shapes[i].setEditable(true);
  300 + } else if (i3GEO.desenho.googlemaps.shapes[i] != "") {// caso for ponto
  301 + i3GEO.desenho.googlemaps.shapes[i].editable = true;
  302 + i3GEO.desenho.googlemaps.shapes[i].setIcon({
  303 + url : i3GEO.editorGM.iconePonto(true)
  304 + });
  305 + }
  306 + }
  307 + },
  308 + /**
  309 + * Remove do mapa as figuras que estiverem selecionadas
  310 + *
  311 + * @param boolean
  312 + * indica se deve ser feita uma confirmacao ou nao antes de apagar
  313 + */
  314 + deleteSelectedShape : function(naoconfirma) {
  315 + i3GEO.janela.tempoMsg($trad("meneditor1"));
  316 + if (!naoconfirma) {
  317 + naoconfirma = false;
  318 + }
  319 + var i, n = i3GEO.desenho.googlemaps.shapes.length;
  320 + if (n > 0) {
  321 + if (naoconfirma === false) {
  322 + var x = window.confirm($trad("excsel") + "?");
  323 + } else {
  324 + x = true;
  325 + }
  326 + if (x) {
  327 + for (i = 0; i < n; i++) {
  328 + if (i3GEO.desenho.googlemaps.shapes[i] != "" && i3GEO.desenho.googlemaps.shapes[i].editable
  329 + && i3GEO.desenho.googlemaps.shapes[i].editable === true) {
  330 + i3GEO.desenho.googlemaps.shapes[i].setMap(null);
  331 + i3GEO.desenho.googlemaps.shapes[i] = "";
  332 + }
  333 + }
  334 + }
  335 + } else {
  336 + i3GEO.janela.tempoMsg($trad("selum"));
  337 + }
  338 + },
  339 + /**
  340 + * Lista as figuras que estao marcadas como selecionadas
  341 + *
  342 + * @return array de shapes
  343 + */
  344 + selectedShapes : function() {
  345 + var i, s = [], n = i3GEO.desenho.googlemaps.shapes.length;
  346 + for (i = 0; i < n; i++) {
  347 + if (i3GEO.desenho.googlemaps.shapes[i] != "" && i3GEO.desenho.googlemaps.shapes[i].editable === true) {
  348 + s.push(i3GEO.desenho.googlemaps.shapes[i]);
  349 + }
  350 + }
  351 + return s;
  352 + },
  353 + /**
  354 + * Lista as coordenadas de todas as figuras existentes
  355 + *
  356 + * @return objeto contendo a indicacao do tipo de figura e o array com a lista de coordenadas
  357 + */
  358 + getCoordenadas : function() {
  359 + var coordenadas = [], lista = [], n = i3GEO.desenho.googlemaps.shapes.length, tipo = "", ps, nps, j, p, i, r;
  360 +
  361 + for (i = 0; i < n; i++) {
  362 + coordenadas = [];
  363 + if (i3GEO.desenho.googlemaps.shapes[i] != "" && i3GEO.desenho.googlemaps.shapes[i].editable === true) {
  364 + if (tipo == "") {
  365 + tipo = i3GEO.desenho.googlemaps.shapes[i].type;
  366 + }
  367 + ps = i3GEO.desenho.googlemaps.shapes[i].getPath();
  368 + nps = ps.getLength();
  369 + for (j = 0; j < nps; j++) {
  370 + p = ps.getAt(j);
  371 + coordenadas.push([
  372 + p.lng() + " " + p.lat()
  373 + ]);
  374 + }
  375 + lista.push(coordenadas);
  376 + }
  377 + }
  378 + r = {
  379 + "tipo" : tipo,
  380 + "coordenadas" : lista
  381 + };
  382 + return r;
  383 + },
  384 + /**
  385 + * Converte um objeto shape em uma string WKT
  386 + *
  387 + * @param shape
  388 + */
  389 + toWKT : function(obj) {
  390 + var wkt = new Wkt.Wkt();
  391 + wkt.fromObject(obj);
  392 + return wkt.write();
  393 + },
  394 + merge : function(geoms) {
  395 + var n = geoms.length, w = new Wkt.Wkt(), g, m, i;
  396 + w.read(geoms[0].toString());
  397 + if (n > 1) {
  398 + for (i = 1; i < n; i++) {
  399 + g = geoms[i].toString();
  400 + m = new Wkt.Wkt();
  401 + m.read(g);
  402 + w.merge(m);
  403 + }
  404 + }
  405 + return w.write();
  406 + },
  407 + /**
  408 + * Funcoes que controlam o processo de obtencao das coordenadas de um componente de uma camada existente no mapa
  409 + */
  410 + capturaPoligonoTema : {
  411 + /**
  412 + * Ativa a operaco de captura definindo o evento que sera executado no onclick do mouse sobre o mapa O evento executa
  413 + * i3GEO.editorGM.capturaPoligonoTema.captura
  414 + *
  415 + * @param botao
  416 + * da interface que foi pressionado
  417 + */
  418 + ativa : function(botao) {
  419 + i3GEO.editorGM.mudaicone(botao);
  420 + i3GEO.eventos.cliquePerm.desativa();
  421 + i3GEO.eventos.adicionaEventos("MOUSECLIQUE", [
  422 + "i3GEO.editorGM.capturaPoligonoTema.captura()"
  423 + ]);
  424 + i3GEO.util.mudaCursor(i3GEO.configura.cursores, "crosshair", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic);
  425 + },
  426 + desativa : function() {
  427 + },
  428 + /**
  429 + * Realiza a captura de um componente do mapa quando o usuario faz o clique A captura e feita com
  430 + * classesphp/mapa_controle.php&funcao=identifica3 O resultado e adicionado ao mapa como um novo objeto shape
  431 + */
  432 + captura : function() {
  433 + var temp, tema = "", regiao = "", p, par, aguarde = $i("i3GEOjanelaEditor_imagemCabecalho");
  434 + if (!$i("i3geoCartoRegioesEditaveis")) {
  435 + i3GEO.eventos.removeEventos("MOUSECLIQUE", [
  436 + "i3GEO.editorGM.capturaPoligonoTema.captura()"
  437 + ]);
  438 + } else {
  439 + temp =
  440 + function(retorno) {
  441 + var temp, n, i, WicketWkt, wkt = "", colunaid = "", valorid = "", colunanome = "", valornome = "", aguarde =
  442 + $i("i3GEOjanelaEditor_imagemCabecalho");
  443 + if (i3GEO.editorGM.descregioes["a_" + regiao]["identificador"]) {
  444 + colunaid = i3GEO.editorGM.descregioes["a_" + regiao]["identificador"];
  445 + }
  446 + if (i3GEO.editorGM.descregioes["a_" + regiao]["colunanomeregiao"]) {
  447 + colunanome = i3GEO.editorGM.descregioes["a_" + regiao]["colunanomeregiao"];
  448 + }
  449 + if (aguarde) {
  450 + aguarde.style.visibility = "hidden";
  451 + }
  452 + // obtem os dados buscando nos itens que vem da requisicao ao wms
  453 + temp = retorno.data[0].resultado[0];
  454 + if (temp === " ") {
  455 + i3GEO.janela.tempoMsg($trad("meneditor2"));
  456 + return;
  457 + }
  458 + i3GEO.editorGM.mudaicone();
  459 + n = temp.length;
  460 + for (i = 0; i < n; i++) {
  461 + if (temp[i].alias == "wkt") {
  462 + wkt = temp[i].valor;
  463 + }
  464 + if (temp[i].alias == colunaid || temp[i].item == colunaid) {
  465 + valorid = temp[i].valor;
  466 + }
  467 + if (temp[i].alias == colunanome || temp[i].item == colunanome) {
  468 + valornome = temp[i].valor;
  469 + }
  470 + }
  471 + // objeto do wicket ver pacotes/wicket
  472 + WicketWkt = new Wkt.Wkt();
  473 + // wkt = "MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 45 20, 30 5, 10 10, 10 30, 20 35), (30 20, 20
  474 + // 25, 20 15, 30 20)))";
  475 + try { // Catch any malformed WKT strings
  476 + WicketWkt.read(wkt);
  477 + } catch (e1) {
  478 + try {
  479 + wkt.read(wkt.replace('\n', '').replace('\r', '').replace('\t', ''));
  480 + } catch (e2) {
  481 + if (e2.name === 'WKTError') {
  482 + alert('Wicket could not understand the WKT string you entered. Check that you have parentheses balanced, and try removing tabs and newline characters.');
  483 + return;
  484 + }
  485 + }
  486 + }
  487 + obj = WicketWkt.toObject(i3GeoMap.defaults);
  488 + // obj.setMap(i3GeoMap); // Add it to the map
  489 + // i3GEO.desenho.googlemaps.shapes.push(obj);
  490 + i3GEO.editorGM.adicionaPoligonos(obj, tema, colunaid, valorid, colunanome, valornome);
  491 + i3GEO.eventos.MOUSECLIQUE = [];
  492 + };
  493 + regiao = $i("i3geoCartoRegioesEditaveis").value;
  494 + if (regiao != "") {
  495 + tema = i3GEO.editorGM.regioestemas["a" + regiao];
  496 + if (aguarde && aguarde.style.visibility == "hidden") {
  497 + aguarde.style.visibility = "visible";
  498 + p = i3GEO.configura.locaplic + "/classesphp/mapa_controle.php";
  499 + par =
  500 + "funcao=identifica3&opcao=tema&xy=" + objposicaocursor.ddx
  501 + + ","
  502 + + objposicaocursor.ddy
  503 + + "&resolucao=5&g_sid="
  504 + + i3GEO.configura.sid
  505 + + "&ext="
  506 + + i3GEO.parametros.mapexten
  507 + + "&listaDeTemas=&wkt=sim&tema="
  508 + + tema;
  509 + cpJSON.call(p, "identifica", temp, par);
  510 + }
  511 + }
  512 + }
  513 + }
  514 + },
  515 + /**
  516 + * Monta um combo com a lista de regioes cadastradas e que podem ser editadas pelo editor A regiao em edicao sera a escolhida nesse
  517 + * combo Ao ser escolhida, e adicionada uma camada no mapa
  518 + *
  519 + * @param opcional
  520 + * codigo da regiao no cadastro. Se nao for definido, busca todas
  521 + */
  522 + comboRegiaoEditavel : function(codigo_tipo_regiao) {
  523 + if (!codigo_tipo_regiao) {
  524 + codigo_tipo_regiao = "";
  525 + }
  526 + var onde = $i("i3geoCartoRegioesEditaveisDiv"), temp =
  527 + function(dados) {
  528 + var n = dados.length, ins = '<br><p class="paragrafo" >' + $trad("camedit") + ':</p>', i;
  529 + ins +=
  530 + "<select onchange='i3GEO.editorGM.comboRegiaoEditavelOnchange(this)' id='i3geoCartoRegioesEditaveis' style='width:175px' ><option value=''>---</option>";
  531 + for (i = 0; i < n; i++) {
  532 + ins += "<option value='" + dados[i].codigo_tipo_regiao + "'>" + dados[i].nome_tipo_regiao + "</option>";
  533 + i3GEO.editorGM.descregioes["a_" + dados[i].codigo_tipo_regiao] = dados[i];
  534 + }
  535 + // inclui as camadas que sao editaveis e estao no mapa
  536 + dados = i3GEO.arvoreDeCamadas.filtraCamadas("editavel", "SIM", "igual");
  537 + n = dados.length;
  538 + for (i = 0; i < n; i++) {
  539 + // layer e usado aqui para identificar que a camada veio do mapa e nao do cadastro de regioes
  540 + if (!dados[i].codigo_tipo_regiao || dados[i].codigo_tipo_regiao === "") {
  541 + ins += "<option value='" + dados[i].name + "'>" + dados[i].tema + "</option>";
  542 + dados[i]["identificador"] = dados[i].colunaidunico;
  543 + dados[i]["colunanomeregiao"] = "";
  544 + i3GEO.editorGM.descregioes["a_" + dados[i].name] = dados[i];
  545 + }
  546 + }
  547 + ins += "</select>";
  548 + if (onde) {
  549 + onde.innerHTML = ins;
  550 + }
  551 + return ins;
  552 + };
  553 + i3GEO.php.listaTipoRegiao(temp, codigo_tipo_regiao);
  554 + },
  555 + /**
  556 + * Funcao ativada no evento onchange do combo criado com comboRegiaoEditavel Executa i3GEO.php.mapfileTipoRegiao
  557 + */
  558 + comboRegiaoEditavelOnchange : function(combo) {
  559 + if (combo.value === "") {
  560 + return;
  561 + }
  562 + i3GEO.editorGM.editarAtributos.desativa();
  563 + // caso a camada escolhida seja uma camada normal, vinda de um mapfile
  564 + if (i3GEO.arvoreDeCamadas.pegaTema(combo.value) != "") {
  565 + i3GEO.editorGM.regioestemas["a" + combo.value] = combo.value;
  566 + i3GEO.editorGM.temasregioes[combo.value] = combo.value;
  567 + } else {
  568 + var temp = function(retorno) {
  569 + if (i3GEO.arvoreDeCamadas.pegaTema(retorno.layer) == "") {
  570 + i3GEO.php.adtema(i3GEO.atualiza, retorno.mapfile);
  571 + // guarda o codigo e relaciona com a regiao
  572 + i3GEO.editorGM.regioestemas["a" + combo.value] = retorno.layer;
  573 + i3GEO.editorGM.temasregioes[retorno.layer] = combo.value;
  574 + }
  575 + };
  576 + i3GEO.php.mapfileTipoRegiao(temp, combo.value);
  577 + }
  578 + },
  579 + /**
  580 + * Altera as bordas dos icones e desativa eventos Desativa todos os botoes e ativa o indicado
  581 + *
  582 + * @param objeto
  583 + * DOM que representa o botao que sera focado
  584 + */
  585 + mudaicone : function(botao) {
  586 + var c = $i(i3GEO.editorGM.iddiv), ci = c.getElementsByTagName("img"), n = ci.length, i;
  587 + for (i = 0; i < n; i++) {
  588 + ci[i].parentNode.style.backgroundColor = "#F5F5F5";
  589 + }
  590 + i3GEO.eventos.MOUSECLIQUE = [];
  591 + i3GEO.editorGM.capturaPoligonoTema.desativa();
  592 + i3GEO.editorGM.editarAtributos.desativa();
  593 + if (botao && botao.style) {
  594 + botao.style.backgroundColor = "#cedff2";
  595 + }
  596 + },
  597 + /**
  598 + * Ativa a digitalizacao de poligono
  599 + *
  600 + * @param objeto
  601 + * DOM que representa o botao que sera focado
  602 + */
  603 + digitalizaPol : function(botao) {
  604 + i3GEO.editorGM.mudaicone(botao);
  605 + i3GEO.util.mudaCursor(i3GEO.configura.cursores, "pointer", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic);
  606 + i3GEO.editorGM.drawingManager.setOptions({
  607 + drawingMode : google.maps.drawing.OverlayType.POLYGON
  608 + });
  609 + },
  610 + /**
  611 + * Ativa a digitalizacao de ponto
  612 + *
  613 + * @param objeto
  614 + * DOM que representa o botao que sera focado
  615 + */
  616 + digitalizaPt : function(botao) {
  617 + i3GEO.editorGM.mudaicone(botao);
  618 + i3GEO.util.mudaCursor(i3GEO.configura.cursores, "pointer", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic);
  619 + i3GEO.editorGM.drawingManager.setOptions({
  620 + drawingMode : google.maps.drawing.OverlayType.MARKER
  621 + });
  622 + },
  623 + /**
  624 + * Ativa a selecao de figuras
  625 + *
  626 + * @param objeto
  627 + * DOM que representa o botao que sera focado
  628 + */
  629 + seleciona : function(botao) {
  630 + i3GEO.editorGM.mudaicone(botao);
  631 + i3GEO.util.mudaCursor(i3GEO.configura.cursores, "pointer", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic);
  632 + i3GEO.editorGM.drawingManager.setOptions({
  633 + drawingMode : null
  634 + });
  635 + },
  636 + /**
  637 + * Adiciona uma nova figura ao mapa (shape) Pode ser poligono ou ponto
  638 + *
  639 + * @param objeto
  640 + * shape (API do Google)
  641 + * @param codigo
  642 + * do layer que sera vinculado ao shape
  643 + * @param coluna
  644 + * do tema que contem os identificadores de cada um de seus elementos (registros)
  645 + * @param valor
  646 + * do identificador
  647 + * @param coluna
  648 + * que cntem os nomes das regioes
  649 + * @param nome
  650 + * da regiao a ser adicionada
  651 + */
  652 + adicionaPoligonos : function(obj, tema, colunaid, valorid, colunanome, valornome) {
  653 + if (!tema) {
  654 + tema = $i("i3geoCartoRegioesEditaveis").value;
  655 + }
  656 + if (!colunaid) {
  657 + colunaid = "";
  658 + }
  659 + if (!valorid) {
  660 + valorid = "";
  661 + }
  662 + if (!colunanome) {
  663 + colunanome = "";
  664 + }
  665 + if (!valornome) {
  666 + valornome = "";
  667 + }
  668 + var pol;
  669 + if (Wkt.isArray(obj)) { // Distinguish multigeometries (Arrays) from objects
  670 + for (i in obj) {
  671 + if (obj.hasOwnProperty(i) && !Wkt.isArray(obj[i])) {
  672 + pol = new google.maps.Polygon({
  673 + path : obj[i].getPath(),
  674 + map : i3GeoMap,
  675 + fillColor : '#ffff00',
  676 + fillOpacity : .5,
  677 + strokeWeight : 2,
  678 + clickable : true,
  679 + zIndex : 1,
  680 + editable : true,
  681 + tema : tema,
  682 + colunaid : colunaid,
  683 + valorid : valorid,
  684 + colunanome : colunanome,
  685 + valornome : valornome
  686 + });
  687 + google.maps.event.addListener(pol, 'click', function() {
  688 + i3GEO.editorGM.setSelection(pol);
  689 + });
  690 + i3GEO.desenho.googlemaps.shapes.push(pol);
  691 + }
  692 + }
  693 + return;
  694 + }
  695 + if (obj.type === 'polygon' || obj.type === 'linestring') {
  696 + pol = new google.maps.Polygon({
  697 + paths : obj.getPaths(),
  698 + map : i3GeoMap,
  699 + fillColor : '#ffff00',
  700 + fillOpacity : .5,
  701 + strokeWeight : 2,
  702 + clickable : true,
  703 + zIndex : 1,
  704 + editable : true,
  705 + tema : tema,
  706 + colunaid : colunaid,
  707 + valorid : valorid,
  708 + colunanome : colunanome,
  709 + valornome : valornome
  710 + });
  711 + google.maps.event.addListener(pol, 'click', function() {
  712 + i3GEO.editorGM.setSelection(pol);
  713 + });
  714 + i3GEO.desenho.googlemaps.shapes.push(pol);
  715 + return;
  716 + }
  717 + if (obj.type === 'marker') {
  718 + i3GEO.editorGM.selectAll();
  719 + if (i3GEO.desenho.googlemaps.shapes.length > 0) {
  720 + i3GEO.editorGM.deleteSelectedShape(true);
  721 + }
  722 + pol = new google.maps.Marker({
  723 + position : new google.maps.LatLng(obj.getPosition().ob, obj.getPosition().pb),
  724 + map : i3GeoMap,
  725 + icon : {
  726 + url : i3GEO.editorGM.iconePonto(false)
  727 + },
  728 + clickable : true,
  729 + zIndex : 1,
  730 + draggable : true,
  731 + tema : tema,
  732 + colunaid : colunaid,
  733 + valorid : valorid,
  734 + colunanome : colunanome,
  735 + valornome : valornome,
  736 + editable : false
  737 + });
  738 + google.maps.event.addListener(pol, 'click', function() {
  739 + i3GEO.editorGM.setSelection(pol);
  740 + });
  741 + i3GEO.desenho.googlemaps.shapes.push(pol);
  742 + return;
  743 + }
  744 + },
  745 + /**
  746 + * Salva um poligono no banco de dados
  747 + */
  748 + salvaLimite : {
  749 + /**
  750 + * Inicia a ferramenta definindo as funcoes dos botoes Executa i3GEO.editorGM.salvaLimite.criaJanelaFlutuante
  751 + */
  752 + inicia : function() {
  753 + if (i3GEO.login.verificaCookieLogin() === false) {
  754 + i3GEO.janela.tempoMsg($trad("meneditor3"));
  755 + if (i3GEO.editorGM.selectedShapes().length > 0) {
  756 + var temp = i3GEO.editorGM.toWKT(i3GEO.editorGM.selectedShapes()[0]);
  757 + i3GEO.mapa.dialogo.wkt2layer(temp);
  758 + }
  759 + return;
  760 + }
  761 + var wkt, temp, s = i3GEO.editorGM.selectedShapes(), n = s.length, janela = YAHOO.i3GEO.janela.manager.find("salvaLimite");
  762 + if (janela) {
  763 + janela.destroy();
  764 + }
  765 + if (n == 1) {
  766 + s = s[0];
  767 + temp = function(retorno) {
  768 + i3GEO.editorGM.deleteSelectedShape(true);
  769 + i3GEO.Interface.redesenha();
  770 + };
  771 + // verifica se e uma regiao cadastrada ou um tema comum editavel
  772 + if (i3GEO.editorGM.descregioes["a_" + $i("i3geoCartoRegioesEditaveis").value].tema != undefined) {
  773 + wkt = i3GEO.editorGM.toWKT(i3GEO.editorGM.selectedShapes()[0]);
  774 + if (wkt && wkt != "") {
  775 + // cria um novo registro
  776 + if (s.valorid == "") {
  777 + p =
  778 + i3GEO.configura.locaplic + "/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="
  779 + + i3GEO.configura.sid;
  780 + cpJSON.call(p, "foo", temp, "&tema=" + $i("i3geoCartoRegioesEditaveis").value + "&wkt=" + wkt);
  781 + } else {
  782 + // atualiza a geometria
  783 + p =
  784 + i3GEO.configura.locaplic + "/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="
  785 + + i3GEO.configura.sid;
  786 + cpJSON.call(p, "foo", temp, "&idunico=" + s.valorid
  787 + + "&tema="
  788 + + $i("i3geoCartoRegioesEditaveis").value
  789 + + "&wkt="
  790 + + wkt);
  791 + }
  792 + }
  793 + } else {
  794 + // formulario para o caso de ser um tema cadastrado como regiao no sistema metaestat
  795 + i3GEO.editorGM.salvaLimite.criaJanelaFlutuante(i3GEO.editorGM.salvaLimite.html(
  796 + s.colunaid,
  797 + s.valorid,
  798 + s.colunanome,
  799 + s.valornome));
  800 + new YAHOO.widget.Button("i3GEOFmetaestati3GEO.editorGMBotao1", {
  801 + onclick : {
  802 + fn : function() {
  803 + i3GEO.editorGM.salvaLimite.gravaDados(true);
  804 + }
  805 + }
  806 + });
  807 + new YAHOO.widget.Button("i3GEOFmetaestati3GEO.editorGMBotao2", {
  808 + onclick : {
  809 + fn : function() {
  810 + i3GEO.editorGM.salvaLimite.gravaDados(false);
  811 + }
  812 + }
  813 + });
  814 + new YAHOO.widget.Button("i3GEOFmetaestati3GEO.editorGMBotao3", {
  815 + onclick : {
  816 + fn : function() {
  817 + i3GEO.editorGM.salvaLimite.excluiPoligono();
  818 + }
  819 + }
  820 + });
  821 + }
  822 + } else {
  823 + i3GEO.janela.tempoMsg("Selecione uma figura");
  824 + }
  825 + },
  826 + /**
  827 + * Monta o HTML para o formulario que permite salvar os dados
  828 + */
  829 + html : function(colunaIdElemento, valorIdElemento, colunaNomeElemento, valorNomeElemento) {
  830 + var ins =
  831 + '' + '<p class=paragrafo >Se o valor do c&oacute;digo for vazio, ser&aacute; criado um novo elemento. Caso contr&aacute;rio, os valores atualmente registrados ser&atilde;o atualizados.</p>'
  832 + + '<p class=paragrafo >Edite os atributos:</p>'
  833 + + '<input type=hidden id="inputColunaIdElemento" value="' + colunaIdElemento
  834 + + '" />'
  835 + + '<input type=hidden id="inputColunaNomeElemento" value="'
  836 + + colunaNomeElemento
  837 + + '" />'
  838 + + '<input type=hidden id="inputIdentificadorElemento" value="'
  839 + + valorIdElemento
  840 + + '" />'
  841 + + '<input type=hidden id="inputNomeElemento" value="'
  842 + + valorNomeElemento
  843 + + '" />'
  844 + + '<p class=paragrafo >C&oacute;digo:</p>'
  845 + + '<p class=paragrafo ><input class=digitar type=text id="inputIdentificadorNovoElemento" value="'
  846 + + valorIdElemento
  847 + + '" style="width:180;cursor:text" /></p>'
  848 + + '<p class=paragrafo >Nome:</p>'
  849 + + '<p class=paragrafo ><input class=digitar type=text id="inputNomeNovoElemento" value="'
  850 + + valorNomeElemento
  851 + + '" style="width:180;cursor:text" /></p>'
  852 + + '<p class=paragrafo >Escolha a opera&ccedil;&atilde;o desejada:</p>'
  853 + + '<input id=i3GEOFmetaestati3GEO.editorGMBotao1 type="button" value="Salvar tudo" />'
  854 + + '&nbsp;<input id=i3GEOFmetaestati3GEO.editorGMBotao2 type="button" value="Salvar apenas os atributos" />'
  855 + + '<br><br><input id=i3GEOFmetaestati3GEO.editorGMBotao3 type="button" value="Excluir" />';
  856 + return ins;
  857 + },
  858 + /**
  859 + * Cria a janela flutuante para receber os componentes da ferramenta
  860 + *
  861 + * @param html
  862 + * com o conteudo da ferramenta
  863 + */
  864 + criaJanelaFlutuante : function(html) {
  865 + var titulo, cabecalho, minimiza, janela;
  866 + cabecalho = function() {
  867 + };
  868 + minimiza = function() {
  869 + i3GEO.janela.minimiza("salvaLimite");
  870 + };
  871 + titulo = "<div class='i3GeoTituloJanela'>" + $trad("sdados") + "</div>";
  872 + janela = i3GEO.janela.cria("300px", "265px", "", "", "", titulo, "salvaLimite", true, "hd", cabecalho, minimiza);
  873 + $i("salvaLimite_corpo").style.backgroundColor = "white";
  874 + $i("salvaLimite_corpo").innerHTML = html;
  875 + YAHOO.util.Event.addListener(janela[0].close, "click", i3GEO.editorGM.mudaicone);
  876 + },
  877 + /**
  878 + * Aplica a operacao de salvar os dados no banco para o shape selecionado Executa
  879 + * admin/php/metaestat.php?funcao=mantemDadosRegiao
  880 + *
  881 + * @param boolean
  882 + * indica se as coordenadas serao salvas tambem
  883 + */
  884 + gravaDados : function(comwkt) {
  885 + if (i3GEO.login.verificaCookieLogin() === false) {
  886 + i3GEO.janela.tempoMsg($trad("meneditor3"));
  887 + return;
  888 + }
  889 + if (!window.confirm($trad("sdados") + "?")) {
  890 + return;
  891 + }
  892 + var p, codigo_tipo_regiao = $i("i3geoCartoRegioesEditaveis").value, identificadornovo =
  893 + $i("inputIdentificadorNovoElemento").value, identificador = $i("inputIdentificadorElemento").value, nome =
  894 + $i("inputNomeNovoElemento").value, wkt = "", temp = function(retorno) {
  895 + i3GEO.editorGM.deleteSelectedShape(true);
  896 + var janela = YAHOO.i3GEO.janela.manager.find("salvaLimite");
  897 + if (janela) {
  898 + janela.destroy();
  899 + }
  900 + i3GEO.Interface.redesenha();
  901 + };
  902 + if (comwkt === true) {
  903 + wkt = i3GEO.editorGM.toWKT(i3GEO.editorGM.selectedShapes()[0]);
  904 + } else {
  905 + if (identificadornovo === identificador && $i("inputNomeElemento").value === nome) {
  906 + i3GEO.janela.tempoMsg($trad("meneditor4"));
  907 + return;
  908 + }
  909 + }
  910 + p = i3GEO.configura.locaplic + "/admin/php/metaestat.php?funcao=mantemDadosRegiao&tipo=";
  911 + cpJSON.call(p, "foo", temp, "&codigo_tipo_regiao=" + codigo_tipo_regiao
  912 + + "&identificadornovo="
  913 + + identificadornovo
  914 + + "&identificador="
  915 + + identificador
  916 + + "&nome="
  917 + + nome
  918 + + "&wkt="
  919 + + wkt);
  920 + },
  921 + /**
  922 + * Exclui um registro do banco de dados Executa admin/php/metaestat.php?funcao=mantemDadosRegiao&tipo=excluir
  923 + */
  924 + excluiPoligono : function() {
  925 + if (i3GEO.login.verificaCookieLogin() === false) {
  926 + i3GEO.janela.tempoMsg($trad("meneditor3"));
  927 + return;
  928 + }
  929 + if (!window.confirm($trad("excsel") + "?")) {
  930 + return;
  931 + }
  932 + var codigo_tipo_regiao = $i("i3geoCartoRegioesEditaveis").value, identificador = $i("inputIdentificadorElemento").value, temp =
  933 + function(retorno) {
  934 + i3GEO.editorGM.deleteSelectedShape(true);
  935 + var janela = YAHOO.i3GEO.janela.manager.find("salvaLimite");
  936 + if (janela) {
  937 + janela.destroy();
  938 + }
  939 + i3GEO.Interface.redesenha();
  940 + }, p = i3GEO.configura.locaplic + "/admin/php/metaestat.php?funcao=mantemDadosRegiao&tipo=excluir";
  941 + if (identificador === "") {
  942 + i3GEO.janela.tempoMsg($trad("meneditor5"));
  943 + } else {
  944 + cpJSON.call(p, "foo", temp, "&codigo_tipo_regiao=" + codigo_tipo_regiao + "&identificador=" + identificador);
  945 + }
  946 + }
  947 + },
  948 + /**
  949 + * Funcoes que controlam o processo de edicao de atributos de um shape
  950 + */
  951 + editarAtributos : {
  952 + aliascolunas : "", // guarda os nomes das colunas e seus aliases para permitir a criacao de novos registros
  953 + x : "",
  954 + y : "",
  955 + /**
  956 + * Ativa a ferramenta Define os eventos de onclick para abrir formulario quando o usuario clica no mapa Para cada regiao sao
  957 + * obtidas todas as variaveis cadastradas Executa i3GEO.editorGM.editarAtributos.criaJanelaFlutuante Executa
  958 + * i3GEO.editorGM.editarAtributos.comboVariaveis();
  959 + */
  960 + ativa : function(botao) {
  961 + if ($i("i3geoCartoRegioesEditaveis").value == "") {
  962 + i3GEO.janela.tempoMsg("Escolha uma regiao");
  963 + return;
  964 + }
  965 + i3GEO.editorGM.mudaicone(botao);
  966 + i3GEO.eventos.adicionaEventos("MOUSECLIQUE", [
  967 + "i3GEO.editorGM.editarAtributos.captura()"
  968 + ]);
  969 + var janela = YAHOO.i3GEO.janela.manager.find("editaAtributos");
  970 + if (janela) {
  971 + $i("editarAtributosForm").innerHTML = "";
  972 + } else {
  973 + i3GEO.editorGM.editarAtributos.criaJanelaFlutuante(i3GEO.editorGM.editarAtributos.html());
  974 + i3GEO.editorGM.editarAtributos.comboVariaveis();
  975 + }
  976 + },
  977 + /**
  978 + * Fecha a janela de edicao
  979 + */
  980 + desativa : function() {
  981 + var janela = YAHOO.i3GEO.janela.manager.find("editaAtributos");
  982 + if (janela) {
  983 + janela.destroy();
  984 + }
  985 + },
  986 + criaJanelaFlutuante : function(html) {
  987 + var janela, titulo, cabecalho, minimiza;
  988 + cabecalho = function() {
  989 + };
  990 + minimiza = function() {
  991 + i3GEO.janela.minimiza("editaAtributos");
  992 + };
  993 + titulo = "<div class='i3GeoTituloJanela'>" + $trad("atrib") + "</div>";
  994 + janela = i3GEO.janela.cria("250px", "265px", "", "", "", titulo, "editaAtributos", false, "hd", cabecalho, minimiza);
  995 + $i("editaAtributos_corpo").style.backgroundColor = "white";
  996 + $i("editaAtributos_corpo").innerHTML = html;
  997 + i3GEO.janela.tempoMsg($trad("meneditor6"));
  998 + YAHOO.util.Event.addListener(janela[0].close, "click", i3GEO.editorGM.mudaicone);
  999 + },
  1000 + /**
  1001 + * Fornece o HTML com os objetos que receberao os componentes da ferramenta
  1002 + *
  1003 + * @return html
  1004 + */
  1005 + html : function() {
  1006 + var ins =
  1007 + '' + '<p class="paragrafo" ><div id="editarAtributosVariaveis" ></div></p>'
  1008 + + '<p class="paragrafo" ><div id="editarAtributosMedidasVariavel" ></div></p>'
  1009 + + '<p class="paragrafo" ><div id="editarAtributosRegiao" ></div></p>'
  1010 + + '<p class="paragrafo" ><div id="editarAtributosForm" ></div></p>'
  1011 + + '';
  1012 + return ins;
  1013 + },
  1014 + /**
  1015 + * Monta um combo para escolha de uma variavel que sera editada Executa i3GEO.php.listaVariavel
  1016 + */
  1017 + comboVariaveis : function() {
  1018 + var temp =
  1019 + function(dados) {
  1020 + var i, n = dados.length, ins = '';
  1021 + ins += '<p class="paragrafo" >Escolha uma vari&aacute;vel para editar</p>';
  1022 + ins +=
  1023 + "<select style='box-shadow:0 1px 5px gray;width:200px' onchange='i3GEO.editorGM.editarAtributos.comboMedidasVariavel(this)'><option value=''>---</option>";
  1024 + for (i = 0; i < n; i++) {
  1025 + ins +=
  1026 + "<option title='" + dados[i].descricao
  1027 + + "' value='"
  1028 + + dados[i].codigo_variavel
  1029 + + "'>"
  1030 + + dados[i].nome
  1031 + + "</option>";
  1032 + }
  1033 + ins += "</select>";
  1034 + $i("editarAtributosVariaveis").innerHTML = ins;
  1035 + };
  1036 + i3GEO.php.listaVariavel(temp, "i3geo_metaestat");
  1037 + },
  1038 + /**
  1039 + * Monta um combo com as medidas de uma variavel Executa i3GEO.php.listaMedidaVariavel
  1040 + *
  1041 + * @param objeto
  1042 + * DOM do tipo select que contem a lista de variaveis
  1043 + */
  1044 + comboMedidasVariavel : function(comboMedidas) {
  1045 + var temp =
  1046 + function(dados) {
  1047 + var i, n = dados.length, ins = '';
  1048 + ins += '<p class="paragrafo" >Escolha uma medida da vari&aacute;vel para editar</p>';
  1049 + ins +=
  1050 + "<select id='editarAtributosComboMedidas' style='box-shadow:0 1px 5px gray;width:200px' onchange=''><option value=''>---</option>";
  1051 + for (i = 0; i < n; i++) {
  1052 + if (dados[i].esquemadb == "i3geo_metaestat" && dados[i].codigo_tipo_regiao == $i("i3geoCartoRegioesEditaveis").value) {
  1053 + ins += "<option value='" + dados[i].id_medida_variavel + "'>" + dados[i].nomemedida + "</option>";
  1054 + }
  1055 + }
  1056 +
  1057 + ins += "</select>";
  1058 + $i("editarAtributosMedidasVariavel").innerHTML = ins;
  1059 + };
  1060 + if (comboMedidas.value !== "") {
  1061 + i3GEO.php.listaMedidaVariavel(comboMedidas.value, temp);
  1062 + }
  1063 + },
  1064 + /**
  1065 + * Captura os atributos de um elemento do mapa Executa i3GEO.editorGM.editarAtributos.pegaDados();
  1066 + */
  1067 + captura : function() {
  1068 + if (!YAHOO.i3GEO.janela.manager.find("editaAtributos")) {
  1069 + i3GEO.editorGM.mudaicone(botao);
  1070 + return;
  1071 + }
  1072 + i3GEO.editorGM.editarAtributos.x = objposicaocursor.ddx;
  1073 + i3GEO.editorGM.editarAtributos.y = objposicaocursor.ddy;
  1074 + i3GEO.editorGM.editarAtributos.pegaDados();
  1075 + },
  1076 + /**
  1077 + * Obtem os dados de um elemento de uma regiao Monta o formulario para edicao Executa
  1078 + * admin/php/metaestat.php?funcao=listaAtributosMedidaVariavelXY
  1079 + */
  1080 + pegaDados : function() {
  1081 + var p = i3GEO.configura.locaplic + "/admin/php/metaestat.php?funcao=listaAtributosMedidaVariavelXY", codigo_tipo_regiao =
  1082 + $i("i3geoCartoRegioesEditaveis").value, id_medida_variavel = $i("editarAtributosComboMedidas").value, temp =
  1083 + function(retorno) {
  1084 + var atr = retorno.atributos, i = 0, n = atr.dados.length, j = 0, idunico = "", nj = atr.aliascolunas.length, ins =
  1085 + "" + '<p class=paragrafo >Limite geogr&aacute;fico escolhido:</p>'
  1086 + + '<p class=paragrafo ><b>Nome: </b>'
  1087 + + retorno.regiao.nomeregiao
  1088 + + '</p>'
  1089 + + '<p class=paragrafo ><b>C&oacute;digo: </b>'
  1090 + + retorno.regiao.identificador_regiao
  1091 + + '</p>'
  1092 + + '<input type=hidden id="editarAtributosidentificador_regiao" value="'
  1093 + + retorno.regiao.identificador_regiao
  1094 + + '" />'
  1095 + + '<p class=paragrafo >Atributos:</p>'
  1096 + + '<input id=editarAtributosAdicionar value="Adicionar um novo" />'
  1097 + + '&nbsp;<input id=editarAtributosSalvar value="Salvar" />';
  1098 + $i("editarAtributosRegiao").innerHTML = ins;
  1099 + ins = "";
  1100 + // registros
  1101 + for (i = 0; i < n; i++) {
  1102 + // descobre qual o indice que corresponde ao idunico do registro
  1103 + for (j = 0; j < nj; j++) {
  1104 + if (atr.aliascolunas[j] == "idunico") {
  1105 + idunico = atr.dados[i][atr.colunas[j]];
  1106 + }
  1107 + }
  1108 + ins +=
  1109 + "<hr><div><p class=paragrafo style='color:blue;cursor:pointer' onclick='i3GEO.editorGM.editarAtributos.excluir(" + idunico
  1110 + + ")' >excluir</p>";
  1111 + // colunas
  1112 + for (j = 0; j < nj; j++) {
  1113 + if (atr.aliascolunas[j] !== "idunico") {
  1114 + ins +=
  1115 + '<p class=paragrafo >' + atr.aliascolunas[j]
  1116 + + ':<br>'
  1117 + + '<input class=digitar id="idunico_'
  1118 + + idunico
  1119 + + '" value="'
  1120 + + atr.dados[i][atr.colunas[j]]
  1121 + + '" name="'
  1122 + + atr.colunas[j]
  1123 + + '" /></p>';
  1124 + }
  1125 + }
  1126 + }
  1127 + $i("editarAtributosForm").innerHTML = ins;
  1128 + new YAHOO.widget.Button("editarAtributosAdicionar", {
  1129 + onclick : {
  1130 + fn : function() {
  1131 + var novoel = document.createElement("div"), ins = "<hr><br>";
  1132 + for (j = 0; j < nj; j++) {
  1133 + if (atr.aliascolunas[j] !== "idunico") {
  1134 + ins +=
  1135 + '<p class=paragrafo >' + atr.aliascolunas[j]
  1136 + + ' - '
  1137 + + atr.descricao[j]
  1138 + + ':<br>'
  1139 + + '<input class=digitar id="" value="" name="'
  1140 + + atr.colunas[j]
  1141 + + '" /></p>';
  1142 + }
  1143 + }
  1144 + ins += "<br></div>";
  1145 + novoel.innerHTML = ins;
  1146 + $i("editarAtributosForm").appendChild(novoel);
  1147 + }
  1148 + }
  1149 + });
  1150 + new YAHOO.widget.Button("editarAtributosSalvar", {
  1151 + onclick : {
  1152 + fn : function() {
  1153 + i3GEO.editorGM.editarAtributos.salva();
  1154 + }
  1155 + }
  1156 + });
  1157 + };
  1158 + cpJSON.call(p, "foo", temp, "&codigo_tipo_regiao=" + codigo_tipo_regiao
  1159 + + "&id_medida_variavel="
  1160 + + id_medida_variavel
  1161 + + "&x="
  1162 + + i3GEO.editorGM.editarAtributos.x
  1163 + + "&y="
  1164 + + i3GEO.editorGM.editarAtributos.y);
  1165 + },
  1166 + // FIXME redesenhar as camadas que sofrerem alteracoes em funcao do salvar ou excluir
  1167 + /**
  1168 + * Exclui o valor de uma medida de variavel para o componente de uma regiao
  1169 + */
  1170 + excluir : function(id) {
  1171 + if (i3GEO.login.verificaCookieLogin() === false) {
  1172 + i3GEO.janela.tempoMsg("Voc&ecirc; precisa fazer login para usar essa op&ccedil;&atilde;o");
  1173 + return;
  1174 + }
  1175 + var p = i3GEO.configura.locaplic + "/admin/php/metaestat.php?funcao=excluiAtributosMedidaVariavel", codigo_tipo_regiao =
  1176 + $i("i3geoCartoRegioesEditaveis").value, id_medida_variavel = $i("editarAtributosComboMedidas").value, identificador_regiao =
  1177 + $i("editarAtributosidentificador_regiao").value, temp = function(retorno) {
  1178 + i3GEO.editorGM.editarAtributos.pegaDados();
  1179 + i3GEO.janela.fechaAguarde("aguardeSalvaAtributos");
  1180 + };
  1181 + i3GEO.janela.AGUARDEMODAL = true;
  1182 + i3GEO.janela.abreAguarde("aguardeSalvaAtributos", "Salvando...");
  1183 + i3GEO.janela.AGUARDEMODAL = false;
  1184 + cpJSON.call(p, "foo", temp, "&codigo_tipo_regiao=" + codigo_tipo_regiao
  1185 + + "&identificador_regiao="
  1186 + + identificador_regiao
  1187 + + "&id_medida_variavel="
  1188 + + id_medida_variavel
  1189 + + "&id="
  1190 + + id);
  1191 +
  1192 + },
  1193 + /**
  1194 + * Salva os valores digitados
  1195 + */
  1196 + salva : function() {
  1197 + if (i3GEO.login.verificaCookieLogin() === false) {
  1198 + i3GEO.janela.tempoMsg("Voc&ecirc; precisa fazer login para usar essa op&ccedil;&atilde;o");
  1199 + return;
  1200 + }
  1201 + var container = $i("editarAtributosForm"), divsT = container.getElementsByTagName("div"), n = divsT.length, i = 0, dv = "", inputs =
  1202 + "", codigo_tipo_regiao = $i("i3geoCartoRegioesEditaveis").value, id_medida_variavel =
  1203 + $i("editarAtributosComboMedidas").value, identificador_regiao = $i("editarAtributosidentificador_regiao").value, nj, j, colunas =
  1204 + [], colunasT = [], valores = [], valoresT = [], idsunicosT = [], p =
  1205 + i3GEO.configura.locaplic + "/admin/php/metaestat.php?funcao=salvaAtributosMedidaVariavel", re =
  1206 + new RegExp("idunico_", "g"), // prefixo usado para marcar o id dos elementos input que contem os valores que se quer
  1207 + // obter
  1208 + temp = function(retorno) {
  1209 + i3GEO.editorGM.editarAtributos.pegaDados();
  1210 + i3GEO.editorGM.atualizaCamadasMetaestat();
  1211 + i3GEO.janela.fechaAguarde("aguardeSalvaAtributos");
  1212 + };
  1213 + if (codigo_tipo_regiao == "") {
  1214 + i3GEO.janela.tempoMsg("Problemas com o codigo da regiao");
  1215 + return;
  1216 + }
  1217 + if (id_medida_variavel == "") {
  1218 + i3GEO.janela.tempoMsg("Escolha uma medida");
  1219 + return;
  1220 + }
  1221 + if (identificador_regiao == "") {
  1222 + i3GEO.janela.tempoMsg("Problemas com o identificador da regiao");
  1223 + return;
  1224 + }
  1225 + for (i = 0; i < n; i++) {
  1226 + dv = divsT[i];
  1227 + inputs = dv.getElementsByTagName("input");
  1228 + nj = inputs.length;
  1229 + colunas = [];
  1230 + valores = [];
  1231 + for (j = 0; j < nj; j++) {
  1232 + colunas.push(inputs[j].name);
  1233 + valores.push(inputs[j].value);
  1234 + }
  1235 + idsunicosT.push(inputs[0].id.replace(re, ''));
  1236 + colunasT.push(colunas.join("|"));
  1237 + valoresT.push(valores.join("|"));
  1238 + }
  1239 + i3GEO.janela.AGUARDEMODAL = true;
  1240 + i3GEO.janela.abreAguarde("aguardeSalvaAtributos", "Salvando...");
  1241 + i3GEO.janela.AGUARDEMODAL = false;
  1242 + cpJSON.call(p, "foo", temp, "&codigo_tipo_regiao=" + codigo_tipo_regiao
  1243 + + "&identificador_regiao="
  1244 + + identificador_regiao
  1245 + + "&id_medida_variavel="
  1246 + + id_medida_variavel
  1247 + + "&colunas="
  1248 + + colunasT[0]
  1249 + + "&valores="
  1250 + + valoresT.join("#")
  1251 + + "&idsunicos="
  1252 + + idsunicosT.join("|"));
  1253 + }
  1254 + },
  1255 + /**
  1256 + * Abre a janela de ajuda sobre a operacao dos botoes do editor
  1257 + */
  1258 + ajuda : function() {
  1259 + var titulo, cabecalho, minimiza, html = "";
  1260 + cabecalho = function() {
  1261 + };
  1262 + minimiza = function() {
  1263 + i3GEO.janela.minimiza("editaAtributosAjuda");
  1264 + };
  1265 + titulo = "<div class='i3GeoTituloJanela'>Ajuda&nbsp;</div>";
  1266 + i3GEO.janela.cria("400px", "350px", "", "", "", titulo, "editaAtributosAjuda", false, "hd", cabecalho, minimiza);
  1267 + $i("editaAtributosAjuda_corpo").style.backgroundColor = "white";
  1268 + html +=
  1269 + "<table class=lista8 >" + "<tr><td><img src='" + i3GEO.configura.locaplic
  1270 + + "/imagens/gisicons/polygon-create.png' /></td>"
  1271 + + "<td>Clique no mapa para tra&ccedil;ar um pol&iacute;gono novo. Cada clique corresponde a um v&eacute;rtice do pol&iacute;gono. Para encerrar o tra&ccedil;ado utilize um duplo clique. Ap&oacute;s tra&ccedil;ar um novo pol&iacute;gono pode-se selecion&aacute;-lo novamente e editar os v&eacute;rtices, se for necess&aacute;rio, ou mesmo apagar o pol&iacute;gono por completo. O novo pol&iacute;gono s&oacute; ser&aacute; salvo por meio da op&ccedil;&atilde;o espec&iacute;fica para isso.</td></tr>"
  1272 + + "<tr><td><img src='"
  1273 + + i3GEO.configura.locaplic
  1274 + + "/imagens/gisicons/layer-import.png' /></td>"
  1275 + + "<td>Utilize essa op&ccedil;&atilde;o para capturar os v&eacute;rtices de um pol&iacute;gono existente. O resultado da captura &eacute; uma figura que pode ser editada, ou seja, os v&eacute;rtices podem ser modificados de posi&ccedil;&atilde;o ou mesmo removidos. Ap&oacute;s editar, salve o novo pol&iacute;gono.</td></tr>"
  1276 + + "<tr><td><img src='"
  1277 + + i3GEO.configura.locaplic
  1278 + + "/imagens/gisicons/select.png' /></td>"
  1279 + + "<td>Ap&oacute;s ativar essa op&ccedil;&atilde;o clique no mapa sobre uma figura existente (que tenha sido capturada ou digtalizada). A figura passar&aacute; ent&atilde;o para o estado de 'selecionada' podendo ser utilizada por outras ferramentas de edi&ccedil;&atilde;o.</td></tr>"
  1280 + + "<tr><td><img src='"
  1281 + + i3GEO.configura.locaplic
  1282 + + "/imagens/gisicons/selected-delete.png' /></td>"
  1283 + + "<td>Remove da tela a figura que estiver selecionada. Essa opera&ccedil;&atilde;o n&atilde;o apaga o pol&iacute;gono do banco de dados, apenas remove do modo de edi&ccedil;&atilde;o.</td></tr>"
  1284 + + "<tr><td><img src='"
  1285 + + i3GEO.configura.locaplic
  1286 + + "/imagens/gisicons/vector-save.png' /></td>"
  1287 + + "<td>Salva no banco de dados a figura que estiver selecionada. Essa op&ccedil;&atilde;o altera apenas os atributos do limite geogr&aacute;fico, n&atilde;o afetando os valores armazenados em cada medida de vari&aacute;vel.</td></tr>"
  1288 + + "<tr><td><img src='"
  1289 + + i3GEO.configura.locaplic
  1290 + + "/imagens/gisicons/annotation-form.png' /></td>"
  1291 + + "<td>Abre um formul&aacute;rio que permite alterar os valores de uma medida de vari&aacute;vel relacionada a uma determinada regi&atilde;o. Ap&oacute;s abrir o formul&aacute;rio, clique no mapa sobre a regi&atilde;o desejada, mas escolha a medida da vari&aacute;vel primeiro. Os valores j&aacute; existentes poder&atilde;o ent&atilde;o ser alterados ou podem ser adicionados novos.</td></tr>"
  1292 + + "</table>";
  1293 + $i("editaAtributosAjuda_corpo").innerHTML = html;
  1294 + }
  1295 + };
  1296 +
  1297 +// copia do original de pacotes/wicket
  1298 +
  1299 +/* global Wkt, google, document, window, console */
  1300 +google.maps.Marker.prototype.type = 'marker';
  1301 +google.maps.Polyline.prototype.type = 'polyline';
  1302 +google.maps.Polygon.prototype.type = 'polygon';
  1303 +google.maps.Rectangle.prototype.type = 'rectangle';
  1304 +google.maps.Circle.prototype.type = 'circle';
  1305 +
  1306 +/**
  1307 + * @license
  1308 + *
  1309 + * Copyright (C) 2012 K. Arthur Endsley (kaendsle@mtu.edu) Michigan Tech Research Institute (MTRI) 3600 Green Court, Suite 100, Ann Arbor,
  1310 + * MI, 48105
  1311 + *
  1312 + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
  1313 + * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  1314 + *
  1315 + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  1316 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  1317 + *
  1318 + * You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
  1319 + *
  1320 + */
  1321 +(function(Wkt) {
  1322 +
  1323 + /**
  1324 + * @augments Wkt.Wkt A framework-dependent flag, set for each Wkt.Wkt() instance, that indicates whether or not a closed polygon
  1325 + * geometry should be interpreted as a rectangle.
  1326 + */
  1327 + Wkt.Wkt.prototype.isRectangle = false;
  1328 +
  1329 + /**
  1330 + * @augments Wkt.Wkt An object of framework-dependent construction methods used to generate objects belonging to the various geometry
  1331 + * classes of the framework.
  1332 + */
  1333 + Wkt.Wkt.prototype.construct = {
  1334 + /**
  1335 + * Creates the framework's equivalent point geometry object.
  1336 + *
  1337 + * @param config
  1338 + * {Object} An optional properties hash the object should use
  1339 + * @param component
  1340 + * {Object} An optional component to build from
  1341 + * @return {google.maps.Marker}
  1342 + */
  1343 + point : function(config, component) {
  1344 + var c = component || this.components;
  1345 +
  1346 + config = config || {};
  1347 +
  1348 + config.position = new google.maps.LatLng(c[0].y, c[0].x);
  1349 +
  1350 + return new google.maps.Marker(config);
  1351 + },
  1352 +
  1353 + /**
  1354 + * Creates the framework's equivalent multipoint geometry object.
  1355 + *
  1356 + * @param config
  1357 + * {Object} An optional properties hash the object should use
  1358 + * @return {Array} Array containing multiple google.maps.Marker
  1359 + */
  1360 + multipoint : function(config) {
  1361 + var i, c, arr;
  1362 +
  1363 + c = this.components;
  1364 +
  1365 + config = config || {};
  1366 +
  1367 + arr = [];
  1368 +
  1369 + for (i = 0; i < c.length; i += 1) {
  1370 + arr.push(this.construct.point(config, c[i]));
  1371 + }
  1372 +
  1373 + return arr;
  1374 + },
  1375 +
  1376 + /**
  1377 + * Creates the framework's equivalent linestring geometry object.
  1378 + *
  1379 + * @param config
  1380 + * {Object} An optional properties hash the object should use
  1381 + * @param component
  1382 + * {Object} An optional component to build from
  1383 + * @return {google.maps.Polyline}
  1384 + */
  1385 + linestring : function(config, component) {
  1386 + var i, c;
  1387 +
  1388 + c = component || this.components;
  1389 +
  1390 + config = config || {
  1391 + editable : false
  1392 + };
  1393 +
  1394 + config.path = [];
  1395 +
  1396 + for (i = 0; i < c.length; i += 1) {
  1397 + config.path.push(new google.maps.LatLng(c[i].y, c[i].x));
  1398 + }
  1399 +
  1400 + return new google.maps.Polyline(config);
  1401 + },
  1402 +
  1403 + /**
  1404 + * Creates the framework's equivalent multilinestring geometry object.
  1405 + *
  1406 + * @param config
  1407 + * {Object} An optional properties hash the object should use
  1408 + * @return {Array} Array containing multiple google.maps.Polyline instances
  1409 + */
  1410 + multilinestring : function(config) {
  1411 + var i, c, arr;
  1412 +
  1413 + c = this.components;
  1414 +
  1415 + config = config || {
  1416 + editable : false
  1417 + };
  1418 +
  1419 + config.path = [];
  1420 +
  1421 + arr = [];
  1422 +
  1423 + for (i = 0; i < c.length; i += 1) {
  1424 + arr.push(this.construct.linestring(config, c[i]));
  1425 + }
  1426 +
  1427 + return arr;
  1428 + },
  1429 +
  1430 + /**
  1431 + * Creates the framework's equivalent Box or Rectangle geometry object.
  1432 + *
  1433 + * @param config
  1434 + * {Object} An optional properties hash the object should use
  1435 + * @param component
  1436 + * {Object} An optional component to build from
  1437 + * @return {google.maps.Rectangle}
  1438 + */
  1439 + box : function(config, component) {
  1440 + var c = component || this.components;
  1441 +
  1442 + config = config || {};
  1443 +
  1444 + config.bounds = new google.maps.LatLngBounds(new google.maps.LatLng(c[0].y, c[0].x), new google.maps.LatLng(c[1].y, c[1].x));
  1445 +
  1446 + return new google.maps.Rectangle(config);
  1447 + },
  1448 +
  1449 + /**
  1450 + * Creates the framework's equivalent polygon geometry object.
  1451 + *
  1452 + * @param config
  1453 + * {Object} An optional properties hash the object should use
  1454 + * @param component
  1455 + * {Object} An optional component to build from
  1456 + * @return {google.maps.Polygon}
  1457 + */
  1458 + polygon : function(config, component) {
  1459 + var j, k, c, rings, verts;
  1460 +
  1461 + c = component || this.components;
  1462 +
  1463 + config = config || {
  1464 + editable : false
  1465 + // Editable geometry off by default
  1466 + };
  1467 +
  1468 + config.paths = [];
  1469 +
  1470 + rings = [];
  1471 + for (j = 0; j < c.length; j += 1) { // For each ring...
  1472 +
  1473 + verts = [];
  1474 + // NOTE: We iterate to one (1) less than the Array length to skip the last vertex
  1475 + for (k = 0; k < c[j].length - 1; k += 1) { // For each vertex...
  1476 + verts.push(new google.maps.LatLng(c[j][k].y, c[j][k].x));
  1477 +
  1478 + } // eo for each vertex
  1479 +
  1480 + if (j !== 0) { // Reverse the order of coordinates in inner rings
  1481 + if (config.reverseInnerPolygons == null || config.reverseInnerPolygons) {
  1482 + verts.reverse();
  1483 + }
  1484 + }
  1485 +
  1486 + rings.push(verts);
  1487 + } // eo for each ring
  1488 +
  1489 + config.paths = config.paths.concat(rings);
  1490 +
  1491 + if (this.isRectangle) {
  1492 + return (function() {
  1493 + var bounds, v = 0;
  1494 +
  1495 + bounds = new google.maps.LatLngBounds();
  1496 +
  1497 + for (v in rings[0]) { // Ought to be only 1 ring in a Rectangle
  1498 + if (rings[0].hasOwnProperty(v)) {
  1499 + bounds.extend(rings[0][v]);
  1500 + }
  1501 + }
  1502 +
  1503 + return new google.maps.Rectangle({
  1504 + bounds : bounds
  1505 + });
  1506 + }());
  1507 + } else {
  1508 + return new google.maps.Polygon(config);
  1509 + }
  1510 + },
  1511 +
  1512 + /**
  1513 + * Creates the framework's equivalent multipolygon geometry object.
  1514 + *
  1515 + * @param config
  1516 + * {Object} An optional properties hash the object should use
  1517 + * @return {Array} Array containing multiple google.maps.Polygon
  1518 + */
  1519 + multipolygon : function(config) {
  1520 + var i, c, arr;
  1521 +
  1522 + c = this.components;
  1523 +
  1524 + config = config || {
  1525 + editable : false
  1526 + };
  1527 +
  1528 + config.path = [];
  1529 +
  1530 + arr = [];
  1531 +
  1532 + for (i = 0; i < c.length; i += 1) {
  1533 + arr.push(this.construct.polygon(config, c[i]));
  1534 + }
  1535 +
  1536 + return arr;
  1537 + }
  1538 +
  1539 + };
  1540 +
  1541 + /**
  1542 + * @augments Wkt.Wkt A framework-dependent deconstruction method used to generate internal geometric representations from instances of
  1543 + * framework geometry. This method uses object detection to attempt to classify members of framework geometry classes into the
  1544 + * standard WKT types.
  1545 + * @param obj
  1546 + * {Object} An instance of one of the framework's geometry classes
  1547 + * @param multiFlag
  1548 + * {Boolean} If true, then the deconstructor will be forced to return a MultiGeometry (multipoint, multilinestring or
  1549 + * multipolygon)
  1550 + * @return {Object} A hash of the 'type' and 'components' thus derived, plus the WKT string of the feature.
  1551 + */
  1552 + Wkt.Wkt.prototype.deconstruct =
  1553 + function(obj, multiFlag) {
  1554 + var features, i, j, verts, rings, sign, tmp, response, lat, lng;
  1555 +
  1556 + // Shortcut to signed area function (determines clockwise vs counter-clock)
  1557 + if (google.maps.geometry) {
  1558 + sign = google.maps.geometry.spherical.computeSignedArea;
  1559 + }
  1560 + ;
  1561 +
  1562 + // google.maps.LatLng //////////////////////////////////////////////////////
  1563 + if (obj.constructor === google.maps.LatLng) {
  1564 +
  1565 + response = {
  1566 + type : 'point',
  1567 + components : [
  1568 + {
  1569 + x : obj.lng(),
  1570 + y : obj.lat()
  1571 + }
  1572 + ]
  1573 + };
  1574 + return response;
  1575 + }
  1576 +
  1577 + // google.maps.Point //////////////////////////////////////////////////////
  1578 + if (obj.constructor === google.maps.Point) {
  1579 + response = {
  1580 + type : 'point',
  1581 + components : [
  1582 + {
  1583 + x : obj.x,
  1584 + y : obj.y
  1585 + }
  1586 + ]
  1587 + };
  1588 + return response;
  1589 + }
  1590 +
  1591 + // google.maps.Marker //////////////////////////////////////////////////////
  1592 + if (obj.constructor === google.maps.Marker) {
  1593 + response = {
  1594 + type : 'point',
  1595 + components : [
  1596 + {
  1597 + x : obj.getPosition().lng(),
  1598 + y : obj.getPosition().lat()
  1599 + }
  1600 + ]
  1601 + };
  1602 + return response;
  1603 + }
  1604 +
  1605 + // google.maps.Polyline ////////////////////////////////////////////////////
  1606 + if (obj.constructor === google.maps.Polyline) {
  1607 +
  1608 + verts = [];
  1609 + for (i = 0; i < obj.getPath().length; i += 1) {
  1610 + tmp = obj.getPath().getAt(i);
  1611 + verts.push({
  1612 + x : tmp.lng(),
  1613 + y : tmp.lat()
  1614 + });
  1615 + }
  1616 + response = {
  1617 + type : 'linestring',
  1618 + components : verts
  1619 + };
  1620 + return response;
  1621 +
  1622 + }
  1623 +
  1624 + // google.maps.Polygon /////////////////////////////////////////////////////
  1625 + if (obj.constructor === google.maps.Polygon) {
  1626 +
  1627 + rings = [];
  1628 +
  1629 + if (multiFlag === undefined) {
  1630 + multiFlag = (function() {
  1631 + var areas, l;
  1632 +
  1633 + l = obj.getPaths().length;
  1634 + if (l <= 1) { // Trivial; this is a single polygon
  1635 + return false;
  1636 + }
  1637 +
  1638 + if (l === 2) {
  1639 + // If clockwise*clockwise or counter*counter, i.e.
  1640 + // (-1)*(-1) or (1)*(1), then result would be positive
  1641 + if (sign(obj.getPaths().getAt(0)) * sign(obj.getPaths().getAt(1)) < 0) {
  1642 + return false; // Most likely single polygon with 1 hole
  1643 + }
  1644 +
  1645 + return true;
  1646 + }
  1647 +
  1648 + // Must be longer than 3 polygons at this point...
  1649 + areas = obj.getPaths().getArray().map(function(k) {
  1650 + return sign(k) / Math.abs(sign(k)); // Unit normalization (outputs 1 or -1)
  1651 + });
  1652 +
  1653 + // If two clockwise or two counter-clockwise rings are found
  1654 + // (at different indices)...
  1655 + if (areas.indexOf(areas[0]) !== areas.lastIndexOf(areas[0])) {
  1656 + multiFlag = true; // Flag for holes in one or more polygons
  1657 + return true;
  1658 + }
  1659 +
  1660 + return false;
  1661 +
  1662 + }());
  1663 + }
  1664 +
  1665 + for (i = 0; i < obj.getPaths().length; i += 1) { // For each polygon (ring)...
  1666 + tmp = obj.getPaths().getAt(i);
  1667 + verts = [];
  1668 + for (j = 0; j < obj.getPaths().getAt(i).length; j += 1) { // For each vertex...
  1669 + verts.push({
  1670 + x : tmp.getAt(j).lng(),
  1671 + y : tmp.getAt(j).lat()
  1672 + });
  1673 +
  1674 + }
  1675 +
  1676 + if (!tmp.getAt(tmp.length - 1).equals(tmp.getAt(0))) {
  1677 + if (i % 2 !== 0) { // In inner rings, coordinates are reversed...
  1678 + verts.unshift({ // Add the first coordinate again for closure
  1679 + x : tmp.getAt(tmp.length - 1).lng(),
  1680 + y : tmp.getAt(tmp.length - 1).lat()
  1681 + });
  1682 +
  1683 + } else {
  1684 + verts.push({ // Add the first coordinate again for closure
  1685 + x : tmp.getAt(0).lng(),
  1686 + y : tmp.getAt(0).lat()
  1687 + });
  1688 +
  1689 + }
  1690 +
  1691 + }
  1692 +
  1693 + if (obj.getPaths().length > 1 && i > 0) {
  1694 + // If this and the last ring have the same signs...
  1695 + if (sign(obj.getPaths().getAt(i)) > 0 && sign(obj.getPaths().getAt(i - 1)) > 0
  1696 + || sign(obj.getPaths().getAt(i)) < 0
  1697 + && sign(obj.getPaths().getAt(i - 1)) < 0
  1698 + && !multiFlag) {
  1699 + // ...They must both be inner rings (or both be outer rings, in a multipolygon)
  1700 + verts = [
  1701 + verts
  1702 + ]; // Wrap multipolygons once more (collection)
  1703 + }
  1704 +
  1705 + }
  1706 +
  1707 + if (i % 2 !== 0) { // In inner rings, coordinates are reversed...
  1708 + verts.reverse();
  1709 + }
  1710 + rings.push(verts);
  1711 + }
  1712 +
  1713 + response = {
  1714 + type : (multiFlag) ? 'multipolygon' : 'polygon',
  1715 + components : rings
  1716 + };
  1717 + return response;
  1718 +
  1719 + }
  1720 +
  1721 + // google.maps.Circle //////////////////////////////////////////////////////
  1722 + if (obj.constructor === google.maps.Circle) {
  1723 + var point = obj.getCenter();
  1724 + var radius = obj.getRadius();
  1725 + verts = [];
  1726 + var d2r = Math.PI / 180; // degrees to radians
  1727 + var r2d = 180 / Math.PI; // radians to degrees
  1728 + radius = radius / 1609; // meters to miles
  1729 + var earthsradius = 3963; // 3963 is the radius of the earth in miles
  1730 + var num_seg = 32; // number of segments used to approximate a circle
  1731 + var rlat = (radius / earthsradius) * r2d;
  1732 + var rlng = rlat / Math.cos(point.lat() * d2r);
  1733 +
  1734 + for (var n = 0; n <= num_seg; n++) {
  1735 + var theta = Math.PI * (n / (num_seg / 2));
  1736 + lng = point.lng() + (rlng * Math.cos(theta)); // center a + radius x * cos(theta)
  1737 + lat = point.lat() + (rlat * Math.sin(theta)); // center b + radius y * sin(theta)
  1738 + verts.push({
  1739 + x : lng,
  1740 + y : lat
  1741 + });
  1742 + }
  1743 +
  1744 + response = {
  1745 + type : 'polygon',
  1746 + components : [
  1747 + verts
  1748 + ]
  1749 + };
  1750 +
  1751 + return response;
  1752 +
  1753 + }
  1754 +
  1755 + // google.maps.LatLngBounds ///////////////////////////////////////////////////
  1756 + if (obj.constructor === google.maps.LatLngBounds) {
  1757 +
  1758 + tmp = obj;
  1759 + verts = [];
  1760 + verts.push({ // NW corner
  1761 + x : tmp.getSouthWest().lng(),
  1762 + y : tmp.getNorthEast().lat()
  1763 + });
  1764 +
  1765 + verts.push({ // NE corner
  1766 + x : tmp.getNorthEast().lng(),
  1767 + y : tmp.getNorthEast().lat()
  1768 + });
  1769 +
  1770 + verts.push({ // SE corner
  1771 + x : tmp.getNorthEast().lng(),
  1772 + y : tmp.getSouthWest().lat()
  1773 + });
  1774 +
  1775 + verts.push({ // SW corner
  1776 + x : tmp.getSouthWest().lng(),
  1777 + y : tmp.getSouthWest().lat()
  1778 + });
  1779 +
  1780 + verts.push({ // NW corner (again, for closure)
  1781 + x : tmp.getSouthWest().lng(),
  1782 + y : tmp.getNorthEast().lat()
  1783 + });
  1784 +
  1785 + response = {
  1786 + type : 'polygon',
  1787 + isRectangle : true,
  1788 + components : [
  1789 + verts
  1790 + ]
  1791 + };
  1792 +
  1793 + return response;
  1794 +
  1795 + }
  1796 +
  1797 + // google.maps.Rectangle ///////////////////////////////////////////////////
  1798 + if (obj.constructor === google.maps.Rectangle) {
  1799 +
  1800 + tmp = obj.getBounds();
  1801 + verts = [];
  1802 + verts.push({ // NW corner
  1803 + x : tmp.getSouthWest().lng(),
  1804 + y : tmp.getNorthEast().lat()
  1805 + });
  1806 +
  1807 + verts.push({ // NE corner
  1808 + x : tmp.getNorthEast().lng(),
  1809 + y : tmp.getNorthEast().lat()
  1810 + });
  1811 +
  1812 + verts.push({ // SE corner
  1813 + x : tmp.getNorthEast().lng(),
  1814 + y : tmp.getSouthWest().lat()
  1815 + });
  1816 +
  1817 + verts.push({ // SW corner
  1818 + x : tmp.getSouthWest().lng(),
  1819 + y : tmp.getSouthWest().lat()
  1820 + });
  1821 +
  1822 + verts.push({ // NW corner (again, for closure)
  1823 + x : tmp.getSouthWest().lng(),
  1824 + y : tmp.getNorthEast().lat()
  1825 + });
  1826 +
  1827 + response = {
  1828 + type : 'polygon',
  1829 + isRectangle : true,
  1830 + components : [
  1831 + verts
  1832 + ]
  1833 + };
  1834 +
  1835 + return response;
  1836 +
  1837 + }
  1838 +
  1839 + // google.maps.Data Geometry Types /////////////////////////////////////////////////////
  1840 +
  1841 + // google.maps.Data.Feature /////////////////////////////////////////////////////
  1842 + if (obj.constructor === google.maps.Data.Feature) {
  1843 + return this.deconstruct.call(this, obj.getGeometry());
  1844 + }
  1845 +
  1846 + // google.maps.Data.Point /////////////////////////////////////////////////////
  1847 + if (obj.constructor === google.maps.Data.Point) {
  1848 + // console.log('It is a google.maps.Data.Point');
  1849 + response = {
  1850 + type : 'point',
  1851 + components : [
  1852 + {
  1853 + x : obj.get().lng(),
  1854 + y : obj.get().lat()
  1855 + }
  1856 + ]
  1857 + };
  1858 + return response;
  1859 + }
  1860 +
  1861 + // google.maps.Data.LineString /////////////////////////////////////////////////////
  1862 + if (obj.constructor === google.maps.Data.LineString) {
  1863 + verts = [];
  1864 + // console.log('It is a google.maps.Data.LineString');
  1865 + for (i = 0; i < obj.getLength(); i += 1) {
  1866 + vertex = obj.getAt(i);
  1867 + verts.push({
  1868 + x : vertex.lng(),
  1869 + y : vertex.lat()
  1870 + });
  1871 + }
  1872 + response = {
  1873 + type : 'linestring',
  1874 + components : verts
  1875 + };
  1876 + return response;
  1877 + }
  1878 +
  1879 + // google.maps.Data.Polygon /////////////////////////////////////////////////////
  1880 + if (obj.constructor === google.maps.Data.Polygon) {
  1881 + var rings = [];
  1882 + // console.log('It is a google.maps.Data.Polygon');
  1883 + for (i = 0; i < obj.getLength(); i += 1) { // For each ring...
  1884 + ring = obj.getAt(i);
  1885 + var verts = [];
  1886 + for (j = 0; j < ring.getLength(); j += 1) { // For each vertex...
  1887 + vertex = ring.getAt(j);
  1888 + verts.push({
  1889 + x : vertex.lng(),
  1890 + y : vertex.lat()
  1891 + });
  1892 + }
  1893 + verts.push({
  1894 + x : ring.getAt(0).lng(),
  1895 + y : ring.getAt(0).lat()
  1896 + });
  1897 +
  1898 + rings.push(verts);
  1899 + }
  1900 + response = {
  1901 + type : 'polygon',
  1902 + components : rings
  1903 + };
  1904 +
  1905 + return response;
  1906 + }
  1907 +
  1908 + // google.maps.Data.MultiPoint /////////////////////////////////////////////////////
  1909 + if (obj.constructor === google.maps.Data.MultiPoint) {
  1910 + verts = [];
  1911 + for (i = 0; i < obj.getLength(); i += 1) {
  1912 + vertex = obj.getAt(i);
  1913 + verts.push([
  1914 + {
  1915 + x : vertex.lng(),
  1916 + y : vertex.lat()
  1917 + }
  1918 + ]);
  1919 + }
  1920 + response = {
  1921 + type : 'multipoint',
  1922 + components : verts
  1923 + };
  1924 + return response;
  1925 + }
  1926 +
  1927 + // google.maps.Data.MultiLineString /////////////////////////////////////////////////////
  1928 + if (obj.constructor === google.maps.Data.MultiLineString) {
  1929 + linestrings = [];
  1930 + for (i = 0; i < obj.getLength(); i += 1) {
  1931 + verts = [];
  1932 + var linestring = obj.getAt(i);
  1933 + for (j = 0; j < linestring.getLength(); j += 1) {
  1934 + vertex = linestring.getAt(j);
  1935 + verts.push({
  1936 + x : vertex.lng(),
  1937 + y : vertex.lat()
  1938 + });
  1939 + }
  1940 + linestrings.push(verts);
  1941 + }
  1942 + response = {
  1943 + type : 'multilinestring',
  1944 + components : linestrings
  1945 + };
  1946 + return response;
  1947 + }
  1948 +
  1949 + // google.maps.Data.MultiPolygon /////////////////////////////////////////////////////
  1950 + if (obj.constructor === google.maps.Data.MultiPolygon) {
  1951 +
  1952 + var k = 0, polygons = [];
  1953 +
  1954 + // console.log('It is a google.maps.Data.MultiPolygon');
  1955 + for (k = 0; k < obj.getLength(); k += 1) { // For each multipolygon
  1956 + var polygon = obj.getAt(k);
  1957 + var rings = [];
  1958 + for (i = 0; i < polygon.getLength(); i += 1) { // For each ring...
  1959 + ring = polygon.getAt(i);
  1960 + var verts = [];
  1961 + for (j = 0; j < ring.getLength(); j += 1) { // For each vertex...
  1962 + vertex = ring.getAt(j);
  1963 + verts.push({
  1964 + x : vertex.lng(),
  1965 + y : vertex.lat()
  1966 + });
  1967 + }
  1968 + verts.push({
  1969 + x : ring.getAt(0).lng(),
  1970 + y : ring.getAt(0).lat()
  1971 + });
  1972 +
  1973 + rings.push(verts);
  1974 + }
  1975 + polygons.push(rings);
  1976 + }
  1977 +
  1978 + response = {
  1979 + type : 'multipolygon',
  1980 + components : polygons
  1981 + };
  1982 + return response;
  1983 + }
  1984 +
  1985 + // google.maps.Data.GeometryCollection /////////////////////////////////////////////////////
  1986 + if (obj.constructor === google.maps.Data.GeometryCollection) {
  1987 +
  1988 + var objects = [];
  1989 + for (k = 0; k < obj.getLength(); k += 1) { // For each multipolygon
  1990 + var object = obj.getAt(k);
  1991 + objects.push(this.deconstruct.call(this, object));
  1992 + }
  1993 + // console.log('It is a google.maps.Data.GeometryCollection', objects);
  1994 + response = {
  1995 + type : 'geometrycollection',
  1996 + components : objects
  1997 + };
  1998 + return response;
  1999 + }
  2000 +
  2001 + // Array ///////////////////////////////////////////////////////////////////
  2002 + if (Wkt.isArray(obj)) {
  2003 + features = [];
  2004 +
  2005 + for (i = 0; i < obj.length; i += 1) {
  2006 + features.push(this.deconstruct.call(this, obj[i], true));
  2007 + }
  2008 +
  2009 + response = {
  2010 +
  2011 + type : (function() {
  2012 + var k, type = obj[0].constructor;
  2013 +
  2014 + for (k = 0; k < obj.length; k += 1) {
  2015 + // Check that all items have the same constructor as the first item
  2016 + if (obj[k].constructor !== type) {
  2017 + // If they don't, type is heterogeneous geometry collection
  2018 + return 'geometrycollection';
  2019 + }
  2020 + }
  2021 +
  2022 + switch (type) {
  2023 + case google.maps.Marker:
  2024 + return 'multipoint';
  2025 + case google.maps.Polyline:
  2026 + return 'multilinestring';
  2027 + case google.maps.Polygon:
  2028 + return 'multipolygon';
  2029 + default:
  2030 + return 'geometrycollection';
  2031 + }
  2032 +
  2033 + }()),
  2034 + components : (function() {
  2035 + // Pluck the components from each Wkt
  2036 + var i, comps;
  2037 +
  2038 + comps = [];
  2039 + for (i = 0; i < features.length; i += 1) {
  2040 + if (features[i].components) {
  2041 + comps.push(features[i].components);
  2042 + }
  2043 + }
  2044 +
  2045 + return {
  2046 + "comps" : comps
  2047 + };
  2048 + }())
  2049 +
  2050 + };
  2051 + response.components = response.components.comps;
  2052 + return response;
  2053 +
  2054 + }
  2055 + };
  2056 +}(Wkt || require('./wicket')));
... ...
ferramentas/editorgm/editorgm_compacto.js 0 → 100755
... ... @@ -0,0 +1 @@
  1 +if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.editorGM={iconePonto:function(sel){if(sel){return i3GEO.configura.locaplic+"/imagens/google/symbol_middot_y.png"}else{return i3GEO.configura.locaplic+"/imagens/google/symbol_middot.png"}},aguarde:"",iddiv:"",drawingManager:"",selectedShape:null,regioestemas:{},temasregioes:{},descregioes:[],inicia:function(iddiv){var i,n,ics;i3GEO.editorGM.iddiv=iddiv;$i(iddiv).innerHTML=i3GEO.editorGM.html();ics=$i(iddiv).getElementsByTagName("button");n=ics.length;i3GEO.barraDeBotoes.ativaBotoes();i3GEO.editorGM.comboRegiaoEditavel();for(i=0;i<n;i++){ics[i].style.backgroundColor="white";ics[i].className="iconeGuiaMovel";ics[i].onmouseout=function(){this.className="iconeGuiaMovel iconeGuiaMovelMouseOut"};ics[i].onmouseover=function(){this.className="iconeGuiaMovel iconeGuiaMovelMouseOver"};ics[i].style.backgroundImage="none";ics[i].style.height="32px";ics[i].style.width="32px";ics[i].style.border="1px solid gray";ics[i].style.margin="0px"}i3GEO.editorGM.drawingManager=new google.maps.drawing.DrawingManager({drawingMode:google.maps.drawing.OverlayType.POLYGON,drawingControl:false,drawingControlOptions:{position:google.maps.ControlPosition.TOP_CENTER,drawingModes:[google.maps.drawing.OverlayType.POLYGON,google.maps.drawing.OverlayType.MARKER,google.maps.drawing.OverlayType.POLYLINE]},markerOptions:{icon:i3GEO.editorGM.iconePonto(),clickable:true,zIndex:1,draggable:true,tema:"",colunaid:"",valorid:"",colunanome:"",valornome:"",editable:false},polygonOptions:{fillColor:'#ffff00',fillOpacity:.5,strokeWeight:2,clickable:true,zIndex:1,editable:true,tema:"",colunaid:"",valorid:"",colunanome:"",valornome:""}});i3GEO.editorGM.drawingManager.setMap(i3GeoMap);i3GEO.editorGM.drawingManager.setDrawingMode(null);google.maps.event.addListener(i3GEO.editorGM.drawingManager,'overlaycomplete',function(e){i3GEO.editorGM.drawingManager.setDrawingMode(null);i3GEO.editorGM.mudaicone();var newShape=e.overlay;newShape.type=e.type;newShape.tema=$i("i3geoCartoRegioesEditaveis").value;newShape.colunaid="";newShape.valorid="";newShape.colunanome="";newShape.valornome="";google.maps.event.addListener(newShape,'click',function(){i3GEO.editorGM.setSelection(newShape)});i3GEO.editorGM.setSelection(newShape);i3GEO.desenho.googlemaps.shapes.push(newShape)});google.maps.event.addListener(i3GEO.editorGM.drawingManager,'drawingmode_changed',i3GEO.editorGM.clearSelection);google.maps.event.addListener(i3GeoMap,'click',i3GEO.editorGM.clearSelection)},atualizaCamadasMetaestat:function(){var p=i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?funcao=LISTACAMADASMETAESTAT&g_sid="+i3GEO.configura.sid,temp=function(retorno){var n=retorno.data.length,i;for(i=0;i<n;i++){i3GEO.Interface.atualizaTema("",retorno.data[i])}};cpJSON.call(p,"foo",temp)},html:function(){var ins='<div style=margin-left:5px >'+' <button title="'+$trad("dpol")+'" onclick="i3GEO.editorGM.digitalizaPol(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/polygon-create.png" /></button>'+' <button title="'+$trad("dponto")+'" onclick="i3GEO.editorGM.digitalizaPt(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/point-create.png" /></button>'+' <button title="'+$trad("capturar")+'" onclick="i3GEO.editorGM.capturaPoligonoTema.ativa(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/layer-import.png" /></button>'+' <button title="'+$trad("d24t")+'" onclick="i3GEO.editorGM.seleciona(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/select.png" /></button>'+' <button title="'+$trad("studo")+'" onclick="i3GEO.editorGM.selectAll(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/selectall.png" /></button>'+' <button title="'+$trad("excsel")+'" onclick="i3GEO.editorGM.deleteSelectedShape()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/selected-delete.png" /></button>'+' <button title="'+$trad("salvexc")+'" onclick="i3GEO.editorGM.salvaLimite.inicia()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/vector-save.png" /></button>'+' <button title="'+$trad("edatrib")+'" onclick="i3GEO.editorGM.editarAtributos.ativa(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/annotation-form.png" /></button>'+' <button title="'+$trad("s1")+'" onmousedown="i3GEO.editorGM.mudaicone()" onclick="i3GEO.editorGM.ajuda()" ><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/help-contents.png" /></button>'+' <br><div id="i3geoCartoRegioesEditaveisDiv" ><img style="display:block;z-index:2" src="'+i3GEO.configura.locaplic+'/imagens/aguarde.gif" /></div></div>';return ins},ativaFoco:function(){i3GEO.util.mudaCursor(i3GEO.configura.cursores,"crosshair",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic);i3GEO.barraDeBotoes.ativaIcone("pan");i3GEO.editorGM.mudaicone();i3GEO.Interface.googlemaps.recalcPar()},setSelection:function(shape){if(shape.setEditable){shape.setEditable(!shape.editable)}else{shape.editable=true;shape.setIcon({url:i3GEO.editorGM.iconePonto(true)})}},clearSelection:function(){var i,n=i3GEO.desenho.googlemaps.shapes.length;for(i=0;i<n;i++){if(i3GEO.desenho.googlemaps.shapes[i]!=""&&i3GEO.desenho.googlemaps.shapes[i].setEditable){i3GEO.desenho.googlemaps.shapes[i].setEditable(false)}else if(i3GEO.desenho.googlemaps.shapes[i]!=""){i3GEO.desenho.googlemaps.shapes[i].editable=false;if(i3GEO.desenho.googlemaps.shapes[i].setIcon){i3GEO.desenho.googlemaps.shapes[i].setIcon({url:i3GEO.editorGM.iconePonto(false)})}}}},selectAll:function(){var i,n=i3GEO.desenho.googlemaps.shapes.length;for(i=0;i<n;i++){if(i3GEO.desenho.googlemaps.shapes[i]!=""&&i3GEO.desenho.googlemaps.shapes[i].setEditable){i3GEO.desenho.googlemaps.shapes[i].setEditable(true)}else if(i3GEO.desenho.googlemaps.shapes[i]!=""){i3GEO.desenho.googlemaps.shapes[i].editable=true;i3GEO.desenho.googlemaps.shapes[i].setIcon({url:i3GEO.editorGM.iconePonto(true)})}}},deleteSelectedShape:function(naoconfirma){i3GEO.janela.tempoMsg($trad("meneditor1"));if(!naoconfirma){naoconfirma=false}var i,n=i3GEO.desenho.googlemaps.shapes.length;if(n>0){if(naoconfirma===false){var x=window.confirm($trad("excsel")+"?")}else{x=true}if(x){for(i=0;i<n;i++){if(i3GEO.desenho.googlemaps.shapes[i]!=""&&i3GEO.desenho.googlemaps.shapes[i].editable&&i3GEO.desenho.googlemaps.shapes[i].editable===true){i3GEO.desenho.googlemaps.shapes[i].setMap(null);i3GEO.desenho.googlemaps.shapes[i]=""}}}}else{i3GEO.janela.tempoMsg($trad("selum"))}},selectedShapes:function(){var i,s=[],n=i3GEO.desenho.googlemaps.shapes.length;for(i=0;i<n;i++){if(i3GEO.desenho.googlemaps.shapes[i]!=""&&i3GEO.desenho.googlemaps.shapes[i].editable===true){s.push(i3GEO.desenho.googlemaps.shapes[i])}}return s},getCoordenadas:function(){var coordenadas=[],lista=[],n=i3GEO.desenho.googlemaps.shapes.length,tipo="",ps,nps,j,p,i,r;for(i=0;i<n;i++){coordenadas=[];if(i3GEO.desenho.googlemaps.shapes[i]!=""&&i3GEO.desenho.googlemaps.shapes[i].editable===true){if(tipo==""){tipo=i3GEO.desenho.googlemaps.shapes[i].type}ps=i3GEO.desenho.googlemaps.shapes[i].getPath();nps=ps.getLength();for(j=0;j<nps;j++){p=ps.getAt(j);coordenadas.push([p.lng()+" "+p.lat()])}lista.push(coordenadas)}}r={"tipo":tipo,"coordenadas":lista};return r},toWKT:function(obj){var wkt=new Wkt.Wkt();wkt.fromObject(obj);return wkt.write()},merge:function(geoms){var n=geoms.length,w=new Wkt.Wkt(),g,m,i;w.read(geoms[0].toString());if(n>1){for(i=1;i<n;i++){g=geoms[i].toString();m=new Wkt.Wkt();m.read(g);w.merge(m)}}return w.write()},capturaPoligonoTema:{ativa:function(botao){i3GEO.editorGM.mudaicone(botao);i3GEO.eventos.cliquePerm.desativa();i3GEO.eventos.adicionaEventos("MOUSECLIQUE",["i3GEO.editorGM.capturaPoligonoTema.captura()"]);i3GEO.util.mudaCursor(i3GEO.configura.cursores,"crosshair",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic)},desativa:function(){},captura:function(){var temp,tema="",regiao="",p,par,aguarde=$i("i3GEOjanelaEditor_imagemCabecalho");if(!$i("i3geoCartoRegioesEditaveis")){i3GEO.eventos.removeEventos("MOUSECLIQUE",["i3GEO.editorGM.capturaPoligonoTema.captura()"])}else{temp=function(retorno){var temp,n,i,WicketWkt,wkt="",colunaid="",valorid="",colunanome="",valornome="",aguarde=$i("i3GEOjanelaEditor_imagemCabecalho");if(i3GEO.editorGM.descregioes["a_"+regiao]["identificador"]){colunaid=i3GEO.editorGM.descregioes["a_"+regiao]["identificador"]}if(i3GEO.editorGM.descregioes["a_"+regiao]["colunanomeregiao"]){colunanome=i3GEO.editorGM.descregioes["a_"+regiao]["colunanomeregiao"]}if(aguarde){aguarde.style.visibility="hidden"}temp=retorno.data[0].resultado[0];if(temp===" "){i3GEO.janela.tempoMsg($trad("meneditor2"));return}i3GEO.editorGM.mudaicone();n=temp.length;for(i=0;i<n;i++){if(temp[i].alias=="wkt"){wkt=temp[i].valor}if(temp[i].alias==colunaid||temp[i].item==colunaid){valorid=temp[i].valor}if(temp[i].alias==colunanome||temp[i].item==colunanome){valornome=temp[i].valor}}WicketWkt=new Wkt.Wkt();try{WicketWkt.read(wkt)}catch(e1){try{wkt.read(wkt.replace('\n','').replace('\r','').replace('\t',''))}catch(e2){if(e2.name==='WKTError'){alert('Wicket could not understand the WKT string you entered. Check that you have parentheses balanced, and try removing tabs and newline characters.');return}}}obj=WicketWkt.toObject(i3GeoMap.defaults);i3GEO.editorGM.adicionaPoligonos(obj,tema,colunaid,valorid,colunanome,valornome);i3GEO.eventos.MOUSECLIQUE=[]};regiao=$i("i3geoCartoRegioesEditaveis").value;if(regiao!=""){tema=i3GEO.editorGM.regioestemas["a"+regiao];if(aguarde&&aguarde.style.visibility=="hidden"){aguarde.style.visibility="visible";p=i3GEO.configura.locaplic+"/classesphp/mapa_controle.php";par="funcao=identifica3&opcao=tema&xy="+objposicaocursor.ddx+","+objposicaocursor.ddy+"&resolucao=5&g_sid="+i3GEO.configura.sid+"&ext="+i3GEO.parametros.mapexten+"&listaDeTemas=&wkt=sim&tema="+tema;cpJSON.call(p,"identifica",temp,par)}}}}},comboRegiaoEditavel:function(codigo_tipo_regiao){if(!codigo_tipo_regiao){codigo_tipo_regiao=""}var onde=$i("i3geoCartoRegioesEditaveisDiv"),temp=function(dados){var n=dados.length,ins='<br><p class="paragrafo" >'+$trad("camedit")+':</p>',i;ins+="<select onchange='i3GEO.editorGM.comboRegiaoEditavelOnchange(this)' id='i3geoCartoRegioesEditaveis' style='width:175px' ><option value=''>---</option>";for(i=0;i<n;i++){ins+="<option value='"+dados[i].codigo_tipo_regiao+"'>"+dados[i].nome_tipo_regiao+"</option>";i3GEO.editorGM.descregioes["a_"+dados[i].codigo_tipo_regiao]=dados[i]}dados=i3GEO.arvoreDeCamadas.filtraCamadas("editavel","SIM","igual");n=dados.length;for(i=0;i<n;i++){if(!dados[i].codigo_tipo_regiao||dados[i].codigo_tipo_regiao===""){ins+="<option value='"+dados[i].name+"'>"+dados[i].tema+"</option>";dados[i]["identificador"]=dados[i].colunaidunico;dados[i]["colunanomeregiao"]="";i3GEO.editorGM.descregioes["a_"+dados[i].name]=dados[i]}}ins+="</select>";if(onde){onde.innerHTML=ins}return ins};i3GEO.php.listaTipoRegiao(temp,codigo_tipo_regiao)},comboRegiaoEditavelOnchange:function(combo){if(combo.value===""){return}i3GEO.editorGM.editarAtributos.desativa();if(i3GEO.arvoreDeCamadas.pegaTema(combo.value)!=""){i3GEO.editorGM.regioestemas["a"+combo.value]=combo.value;i3GEO.editorGM.temasregioes[combo.value]=combo.value}else{var temp=function(retorno){if(i3GEO.arvoreDeCamadas.pegaTema(retorno.layer)==""){i3GEO.php.adtema(i3GEO.atualiza,retorno.mapfile);i3GEO.editorGM.regioestemas["a"+combo.value]=retorno.layer;i3GEO.editorGM.temasregioes[retorno.layer]=combo.value}};i3GEO.php.mapfileTipoRegiao(temp,combo.value)}},mudaicone:function(botao){var c=$i(i3GEO.editorGM.iddiv),ci=c.getElementsByTagName("img"),n=ci.length,i;for(i=0;i<n;i++){ci[i].parentNode.style.backgroundColor="#F5F5F5"}i3GEO.eventos.MOUSECLIQUE=[];i3GEO.editorGM.capturaPoligonoTema.desativa();i3GEO.editorGM.editarAtributos.desativa();if(botao&&botao.style){botao.style.backgroundColor="#cedff2"}},digitalizaPol:function(botao){i3GEO.editorGM.mudaicone(botao);i3GEO.util.mudaCursor(i3GEO.configura.cursores,"pointer",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic);i3GEO.editorGM.drawingManager.setOptions({drawingMode:google.maps.drawing.OverlayType.POLYGON})},digitalizaPt:function(botao){i3GEO.editorGM.mudaicone(botao);i3GEO.util.mudaCursor(i3GEO.configura.cursores,"pointer",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic);i3GEO.editorGM.drawingManager.setOptions({drawingMode:google.maps.drawing.OverlayType.MARKER})},seleciona:function(botao){i3GEO.editorGM.mudaicone(botao);i3GEO.util.mudaCursor(i3GEO.configura.cursores,"pointer",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic);i3GEO.editorGM.drawingManager.setOptions({drawingMode:null})},adicionaPoligonos:function(obj,tema,colunaid,valorid,colunanome,valornome){if(!tema){tema=$i("i3geoCartoRegioesEditaveis").value}if(!colunaid){colunaid=""}if(!valorid){valorid=""}if(!colunanome){colunanome=""}if(!valornome){valornome=""}var pol;if(Wkt.isArray(obj)){for(i in obj){if(obj.hasOwnProperty(i)&&!Wkt.isArray(obj[i])){pol=new google.maps.Polygon({path:obj[i].getPath(),map:i3GeoMap,fillColor:'#ffff00',fillOpacity:.5,strokeWeight:2,clickable:true,zIndex:1,editable:true,tema:tema,colunaid:colunaid,valorid:valorid,colunanome:colunanome,valornome:valornome});google.maps.event.addListener(pol,'click',function(){i3GEO.editorGM.setSelection(pol)});i3GEO.desenho.googlemaps.shapes.push(pol)}}return}if(obj.type==='polygon'||obj.type==='linestring'){pol=new google.maps.Polygon({paths:obj.getPaths(),map:i3GeoMap,fillColor:'#ffff00',fillOpacity:.5,strokeWeight:2,clickable:true,zIndex:1,editable:true,tema:tema,colunaid:colunaid,valorid:valorid,colunanome:colunanome,valornome:valornome});google.maps.event.addListener(pol,'click',function(){i3GEO.editorGM.setSelection(pol)});i3GEO.desenho.googlemaps.shapes.push(pol);return}if(obj.type==='marker'){i3GEO.editorGM.selectAll();if(i3GEO.desenho.googlemaps.shapes.length>0){i3GEO.editorGM.deleteSelectedShape(true)}pol=new google.maps.Marker({position:new google.maps.LatLng(obj.getPosition().ob,obj.getPosition().pb),map:i3GeoMap,icon:{url:i3GEO.editorGM.iconePonto(false)},clickable:true,zIndex:1,draggable:true,tema:tema,colunaid:colunaid,valorid:valorid,colunanome:colunanome,valornome:valornome,editable:false});google.maps.event.addListener(pol,'click',function(){i3GEO.editorGM.setSelection(pol)});i3GEO.desenho.googlemaps.shapes.push(pol);return}},salvaLimite:{inicia:function(){if(i3GEO.login.verificaCookieLogin()===false){i3GEO.janela.tempoMsg($trad("meneditor3"));if(i3GEO.editorGM.selectedShapes().length>0){var temp=i3GEO.editorGM.toWKT(i3GEO.editorGM.selectedShapes()[0]);i3GEO.mapa.dialogo.wkt2layer(temp)}return}var wkt,temp,s=i3GEO.editorGM.selectedShapes(),n=s.length,janela=YAHOO.i3GEO.janela.manager.find("salvaLimite");if(janela){janela.destroy()}if(n==1){s=s[0];temp=function(retorno){i3GEO.editorGM.deleteSelectedShape(true);i3GEO.Interface.redesenha()};if(i3GEO.editorGM.descregioes["a_"+$i("i3geoCartoRegioesEditaveis").value].tema!=undefined){wkt=i3GEO.editorGM.toWKT(i3GEO.editorGM.selectedShapes()[0]);if(wkt&&wkt!=""){if(s.valorid==""){p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",temp,"&tema="+$i("i3geoCartoRegioesEditaveis").value+"&wkt="+wkt)}else{p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",temp,"&idunico="+s.valorid+"&tema="+$i("i3geoCartoRegioesEditaveis").value+"&wkt="+wkt)}}}else{i3GEO.editorGM.salvaLimite.criaJanelaFlutuante(i3GEO.editorGM.salvaLimite.html(s.colunaid,s.valorid,s.colunanome,s.valornome));new YAHOO.widget.Button("i3GEOFmetaestati3GEO.editorGMBotao1",{onclick:{fn:function(){i3GEO.editorGM.salvaLimite.gravaDados(true)}}});new YAHOO.widget.Button("i3GEOFmetaestati3GEO.editorGMBotao2",{onclick:{fn:function(){i3GEO.editorGM.salvaLimite.gravaDados(false)}}});new YAHOO.widget.Button("i3GEOFmetaestati3GEO.editorGMBotao3",{onclick:{fn:function(){i3GEO.editorGM.salvaLimite.excluiPoligono()}}})}}else{i3GEO.janela.tempoMsg("Selecione uma figura")}},html:function(colunaIdElemento,valorIdElemento,colunaNomeElemento,valorNomeElemento){var ins=''+'<p class=paragrafo >Se o valor do c&oacute;digo for vazio, ser&aacute; criado um novo elemento. Caso contr&aacute;rio, os valores atualmente registrados ser&atilde;o atualizados.</p>'+'<p class=paragrafo >Edite os atributos:</p>'+'<input type=hidden id="inputColunaIdElemento" value="'+colunaIdElemento+'" />'+'<input type=hidden id="inputColunaNomeElemento" value="'+colunaNomeElemento+'" />'+'<input type=hidden id="inputIdentificadorElemento" value="'+valorIdElemento+'" />'+'<input type=hidden id="inputNomeElemento" value="'+valorNomeElemento+'" />'+'<p class=paragrafo >C&oacute;digo:</p>'+'<p class=paragrafo ><input class=digitar type=text id="inputIdentificadorNovoElemento" value="'+valorIdElemento+'" style="width:180;cursor:text" /></p>'+'<p class=paragrafo >Nome:</p>'+'<p class=paragrafo ><input class=digitar type=text id="inputNomeNovoElemento" value="'+valorNomeElemento+'" style="width:180;cursor:text" /></p>'+'<p class=paragrafo >Escolha a opera&ccedil;&atilde;o desejada:</p>'+'<input id=i3GEOFmetaestati3GEO.editorGMBotao1 type="button" value="Salvar tudo" />'+'&nbsp;<input id=i3GEOFmetaestati3GEO.editorGMBotao2 type="button" value="Salvar apenas os atributos" />'+'<br><br><input id=i3GEOFmetaestati3GEO.editorGMBotao3 type="button" value="Excluir" />';return ins},criaJanelaFlutuante:function(html){var titulo,cabecalho,minimiza,janela;cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("salvaLimite")};titulo="<div class='i3GeoTituloJanela'>"+$trad("sdados")+"</div>";janela=i3GEO.janela.cria("300px","265px","","","",titulo,"salvaLimite",true,"hd",cabecalho,minimiza);$i("salvaLimite_corpo").style.backgroundColor="white";$i("salvaLimite_corpo").innerHTML=html;YAHOO.util.Event.addListener(janela[0].close,"click",i3GEO.editorGM.mudaicone)},gravaDados:function(comwkt){if(i3GEO.login.verificaCookieLogin()===false){i3GEO.janela.tempoMsg($trad("meneditor3"));return}if(!window.confirm($trad("sdados")+"?")){return}var p,codigo_tipo_regiao=$i("i3geoCartoRegioesEditaveis").value,identificadornovo=$i("inputIdentificadorNovoElemento").value,identificador=$i("inputIdentificadorElemento").value,nome=$i("inputNomeNovoElemento").value,wkt="",temp=function(retorno){i3GEO.editorGM.deleteSelectedShape(true);var janela=YAHOO.i3GEO.janela.manager.find("salvaLimite");if(janela){janela.destroy()}i3GEO.Interface.redesenha()};if(comwkt===true){wkt=i3GEO.editorGM.toWKT(i3GEO.editorGM.selectedShapes()[0])}else{if(identificadornovo===identificador&&$i("inputNomeElemento").value===nome){i3GEO.janela.tempoMsg($trad("meneditor4"));return}}p=i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=mantemDadosRegiao&tipo=";cpJSON.call(p,"foo",temp,"&codigo_tipo_regiao="+codigo_tipo_regiao+"&identificadornovo="+identificadornovo+"&identificador="+identificador+"&nome="+nome+"&wkt="+wkt)},excluiPoligono:function(){if(i3GEO.login.verificaCookieLogin()===false){i3GEO.janela.tempoMsg($trad("meneditor3"));return}if(!window.confirm($trad("excsel")+"?")){return}var codigo_tipo_regiao=$i("i3geoCartoRegioesEditaveis").value,identificador=$i("inputIdentificadorElemento").value,temp=function(retorno){i3GEO.editorGM.deleteSelectedShape(true);var janela=YAHOO.i3GEO.janela.manager.find("salvaLimite");if(janela){janela.destroy()}i3GEO.Interface.redesenha()},p=i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=mantemDadosRegiao&tipo=excluir";if(identificador===""){i3GEO.janela.tempoMsg($trad("meneditor5"))}else{cpJSON.call(p,"foo",temp,"&codigo_tipo_regiao="+codigo_tipo_regiao+"&identificador="+identificador)}}},editarAtributos:{aliascolunas:"",x:"",y:"",ativa:function(botao){if($i("i3geoCartoRegioesEditaveis").value==""){i3GEO.janela.tempoMsg("Escolha uma regiao");return}i3GEO.editorGM.mudaicone(botao);i3GEO.eventos.adicionaEventos("MOUSECLIQUE",["i3GEO.editorGM.editarAtributos.captura()"]);var janela=YAHOO.i3GEO.janela.manager.find("editaAtributos");if(janela){$i("editarAtributosForm").innerHTML=""}else{i3GEO.editorGM.editarAtributos.criaJanelaFlutuante(i3GEO.editorGM.editarAtributos.html());i3GEO.editorGM.editarAtributos.comboVariaveis()}},desativa:function(){var janela=YAHOO.i3GEO.janela.manager.find("editaAtributos");if(janela){janela.destroy()}},criaJanelaFlutuante:function(html){var janela,titulo,cabecalho,minimiza;cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("editaAtributos")};titulo="<div class='i3GeoTituloJanela'>"+$trad("atrib")+"</div>";janela=i3GEO.janela.cria("250px","265px","","","",titulo,"editaAtributos",false,"hd",cabecalho,minimiza);$i("editaAtributos_corpo").style.backgroundColor="white";$i("editaAtributos_corpo").innerHTML=html;i3GEO.janela.tempoMsg($trad("meneditor6"));YAHOO.util.Event.addListener(janela[0].close,"click",i3GEO.editorGM.mudaicone)},html:function(){var ins=''+'<p class="paragrafo" ><div id="editarAtributosVariaveis" ></div></p>'+'<p class="paragrafo" ><div id="editarAtributosMedidasVariavel" ></div></p>'+'<p class="paragrafo" ><div id="editarAtributosRegiao" ></div></p>'+'<p class="paragrafo" ><div id="editarAtributosForm" ></div></p>'+'';return ins},comboVariaveis:function(){var temp=function(dados){var i,n=dados.length,ins='';ins+='<p class="paragrafo" >Escolha uma vari&aacute;vel para editar</p>';ins+="<select style='box-shadow:0 1px 5px gray;width:200px' onchange='i3GEO.editorGM.editarAtributos.comboMedidasVariavel(this)'><option value=''>---</option>";for(i=0;i<n;i++){ins+="<option title='"+dados[i].descricao+"' value='"+dados[i].codigo_variavel+"'>"+dados[i].nome+"</option>"}ins+="</select>";$i("editarAtributosVariaveis").innerHTML=ins};i3GEO.php.listaVariavel(temp,"i3geo_metaestat")},comboMedidasVariavel:function(comboMedidas){var temp=function(dados){var i,n=dados.length,ins='';ins+='<p class="paragrafo" >Escolha uma medida da vari&aacute;vel para editar</p>';ins+="<select id='editarAtributosComboMedidas' style='box-shadow:0 1px 5px gray;width:200px' onchange=''><option value=''>---</option>";for(i=0;i<n;i++){if(dados[i].esquemadb=="i3geo_metaestat"&&dados[i].codigo_tipo_regiao==$i("i3geoCartoRegioesEditaveis").value){ins+="<option value='"+dados[i].id_medida_variavel+"'>"+dados[i].nomemedida+"</option>"}}ins+="</select>";$i("editarAtributosMedidasVariavel").innerHTML=ins};if(comboMedidas.value!==""){i3GEO.php.listaMedidaVariavel(comboMedidas.value,temp)}},captura:function(){if(!YAHOO.i3GEO.janela.manager.find("editaAtributos")){i3GEO.editorGM.mudaicone(botao);return}i3GEO.editorGM.editarAtributos.x=objposicaocursor.ddx;i3GEO.editorGM.editarAtributos.y=objposicaocursor.ddy;i3GEO.editorGM.editarAtributos.pegaDados()},pegaDados:function(){var p=i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=listaAtributosMedidaVariavelXY",codigo_tipo_regiao=$i("i3geoCartoRegioesEditaveis").value,id_medida_variavel=$i("editarAtributosComboMedidas").value,temp=function(retorno){var atr=retorno.atributos,i=0,n=atr.dados.length,j=0,idunico="",nj=atr.aliascolunas.length,ins=""+'<p class=paragrafo >Limite geogr&aacute;fico escolhido:</p>'+'<p class=paragrafo ><b>Nome: </b>'+retorno.regiao.nomeregiao+'</p>'+'<p class=paragrafo ><b>C&oacute;digo: </b>'+retorno.regiao.identificador_regiao+'</p>'+'<input type=hidden id="editarAtributosidentificador_regiao" value="'+retorno.regiao.identificador_regiao+'" />'+'<p class=paragrafo >Atributos:</p>'+'<input id=editarAtributosAdicionar value="Adicionar um novo" />'+'&nbsp;<input id=editarAtributosSalvar value="Salvar" />';$i("editarAtributosRegiao").innerHTML=ins;ins="";for(i=0;i<n;i++){for(j=0;j<nj;j++){if(atr.aliascolunas[j]=="idunico"){idunico=atr.dados[i][atr.colunas[j]]}}ins+="<hr><div><p class=paragrafo style='color:blue;cursor:pointer' onclick='i3GEO.editorGM.editarAtributos.excluir("+idunico+")' >excluir</p>";for(j=0;j<nj;j++){if(atr.aliascolunas[j]!=="idunico"){ins+='<p class=paragrafo >'+atr.aliascolunas[j]+':<br>'+'<input class=digitar id="idunico_'+idunico+'" value="'+atr.dados[i][atr.colunas[j]]+'" name="'+atr.colunas[j]+'" /></p>'}}}$i("editarAtributosForm").innerHTML=ins;new YAHOO.widget.Button("editarAtributosAdicionar",{onclick:{fn:function(){var novoel=document.createElement("div"),ins="<hr><br>";for(j=0;j<nj;j++){if(atr.aliascolunas[j]!=="idunico"){ins+='<p class=paragrafo >'+atr.aliascolunas[j]+' - '+atr.descricao[j]+':<br>'+'<input class=digitar id="" value="" name="'+atr.colunas[j]+'" /></p>'}}ins+="<br></div>";novoel.innerHTML=ins;$i("editarAtributosForm").appendChild(novoel)}}});new YAHOO.widget.Button("editarAtributosSalvar",{onclick:{fn:function(){i3GEO.editorGM.editarAtributos.salva()}}})};cpJSON.call(p,"foo",temp,"&codigo_tipo_regiao="+codigo_tipo_regiao+"&id_medida_variavel="+id_medida_variavel+"&x="+i3GEO.editorGM.editarAtributos.x+"&y="+i3GEO.editorGM.editarAtributos.y)},excluir:function(id){if(i3GEO.login.verificaCookieLogin()===false){i3GEO.janela.tempoMsg("Voc&ecirc; precisa fazer login para usar essa op&ccedil;&atilde;o");return}var p=i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=excluiAtributosMedidaVariavel",codigo_tipo_regiao=$i("i3geoCartoRegioesEditaveis").value,id_medida_variavel=$i("editarAtributosComboMedidas").value,identificador_regiao=$i("editarAtributosidentificador_regiao").value,temp=function(retorno){i3GEO.editorGM.editarAtributos.pegaDados();i3GEO.janela.fechaAguarde("aguardeSalvaAtributos")};i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaAtributos","Salvando...");i3GEO.janela.AGUARDEMODAL=false;cpJSON.call(p,"foo",temp,"&codigo_tipo_regiao="+codigo_tipo_regiao+"&identificador_regiao="+identificador_regiao+"&id_medida_variavel="+id_medida_variavel+"&id="+id)},salva:function(){if(i3GEO.login.verificaCookieLogin()===false){i3GEO.janela.tempoMsg("Voc&ecirc; precisa fazer login para usar essa op&ccedil;&atilde;o");return}var container=$i("editarAtributosForm"),divsT=container.getElementsByTagName("div"),n=divsT.length,i=0,dv="",inputs="",codigo_tipo_regiao=$i("i3geoCartoRegioesEditaveis").value,id_medida_variavel=$i("editarAtributosComboMedidas").value,identificador_regiao=$i("editarAtributosidentificador_regiao").value,nj,j,colunas=[],colunasT=[],valores=[],valoresT=[],idsunicosT=[],p=i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=salvaAtributosMedidaVariavel",re=new RegExp("idunico_","g"),temp=function(retorno){i3GEO.editorGM.editarAtributos.pegaDados();i3GEO.editorGM.atualizaCamadasMetaestat();i3GEO.janela.fechaAguarde("aguardeSalvaAtributos")};if(codigo_tipo_regiao==""){i3GEO.janela.tempoMsg("Problemas com o codigo da regiao");return}if(id_medida_variavel==""){i3GEO.janela.tempoMsg("Escolha uma medida");return}if(identificador_regiao==""){i3GEO.janela.tempoMsg("Problemas com o identificador da regiao");return}for(i=0;i<n;i++){dv=divsT[i];inputs=dv.getElementsByTagName("input");nj=inputs.length;colunas=[];valores=[];for(j=0;j<nj;j++){colunas.push(inputs[j].name);valores.push(inputs[j].value)}idsunicosT.push(inputs[0].id.replace(re,''));colunasT.push(colunas.join("|"));valoresT.push(valores.join("|"))}i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaAtributos","Salvando...");i3GEO.janela.AGUARDEMODAL=false;cpJSON.call(p,"foo",temp,"&codigo_tipo_regiao="+codigo_tipo_regiao+"&identificador_regiao="+identificador_regiao+"&id_medida_variavel="+id_medida_variavel+"&colunas="+colunasT[0]+"&valores="+valoresT.join("#")+"&idsunicos="+idsunicosT.join("|"))}},ajuda:function(){var titulo,cabecalho,minimiza,html="";cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("editaAtributosAjuda")};titulo="<div class='i3GeoTituloJanela'>Ajuda&nbsp;</div>";i3GEO.janela.cria("400px","350px","","","",titulo,"editaAtributosAjuda",false,"hd",cabecalho,minimiza);$i("editaAtributosAjuda_corpo").style.backgroundColor="white";html+="<table class=lista8 >"+"<tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/gisicons/polygon-create.png' /></td>"+"<td>Clique no mapa para tra&ccedil;ar um pol&iacute;gono novo. Cada clique corresponde a um v&eacute;rtice do pol&iacute;gono. Para encerrar o tra&ccedil;ado utilize um duplo clique. Ap&oacute;s tra&ccedil;ar um novo pol&iacute;gono pode-se selecion&aacute;-lo novamente e editar os v&eacute;rtices, se for necess&aacute;rio, ou mesmo apagar o pol&iacute;gono por completo. O novo pol&iacute;gono s&oacute; ser&aacute; salvo por meio da op&ccedil;&atilde;o espec&iacute;fica para isso.</td></tr>"+"<tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/gisicons/layer-import.png' /></td>"+"<td>Utilize essa op&ccedil;&atilde;o para capturar os v&eacute;rtices de um pol&iacute;gono existente. O resultado da captura &eacute; uma figura que pode ser editada, ou seja, os v&eacute;rtices podem ser modificados de posi&ccedil;&atilde;o ou mesmo removidos. Ap&oacute;s editar, salve o novo pol&iacute;gono.</td></tr>"+"<tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/gisicons/select.png' /></td>"+"<td>Ap&oacute;s ativar essa op&ccedil;&atilde;o clique no mapa sobre uma figura existente (que tenha sido capturada ou digtalizada). A figura passar&aacute; ent&atilde;o para o estado de 'selecionada' podendo ser utilizada por outras ferramentas de edi&ccedil;&atilde;o.</td></tr>"+"<tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/gisicons/selected-delete.png' /></td>"+"<td>Remove da tela a figura que estiver selecionada. Essa opera&ccedil;&atilde;o n&atilde;o apaga o pol&iacute;gono do banco de dados, apenas remove do modo de edi&ccedil;&atilde;o.</td></tr>"+"<tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/gisicons/vector-save.png' /></td>"+"<td>Salva no banco de dados a figura que estiver selecionada. Essa op&ccedil;&atilde;o altera apenas os atributos do limite geogr&aacute;fico, n&atilde;o afetando os valores armazenados em cada medida de vari&aacute;vel.</td></tr>"+"<tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/gisicons/annotation-form.png' /></td>"+"<td>Abre um formul&aacute;rio que permite alterar os valores de uma medida de vari&aacute;vel relacionada a uma determinada regi&atilde;o. Ap&oacute;s abrir o formul&aacute;rio, clique no mapa sobre a regi&atilde;o desejada, mas escolha a medida da vari&aacute;vel primeiro. Os valores j&aacute; existentes poder&atilde;o ent&atilde;o ser alterados ou podem ser adicionados novos.</td></tr>"+"</table>";$i("editaAtributosAjuda_corpo").innerHTML=html}};google.maps.Marker.prototype.type='marker';google.maps.Polyline.prototype.type='polyline';google.maps.Polygon.prototype.type='polygon';google.maps.Rectangle.prototype.type='rectangle';google.maps.Circle.prototype.type='circle';(function(Wkt){Wkt.Wkt.prototype.isRectangle=false;Wkt.Wkt.prototype.construct={point:function(config,component){var c=component||this.components;config=config||{};config.position=new google.maps.LatLng(c[0].y,c[0].x);return new google.maps.Marker(config)},multipoint:function(config){var i,c,arr;c=this.components;config=config||{};arr=[];for(i=0;i<c.length;i+=1){arr.push(this.construct.point(config,c[i]))}return arr},linestring:function(config,component){var i,c;c=component||this.components;config=config||{editable:false};config.path=[];for(i=0;i<c.length;i+=1){config.path.push(new google.maps.LatLng(c[i].y,c[i].x))}return new google.maps.Polyline(config)},multilinestring:function(config){var i,c,arr;c=this.components;config=config||{editable:false};config.path=[];arr=[];for(i=0;i<c.length;i+=1){arr.push(this.construct.linestring(config,c[i]))}return arr},box:function(config,component){var c=component||this.components;config=config||{};config.bounds=new google.maps.LatLngBounds(new google.maps.LatLng(c[0].y,c[0].x),new google.maps.LatLng(c[1].y,c[1].x));return new google.maps.Rectangle(config)},polygon:function(config,component){var j,k,c,rings,verts;c=component||this.components;config=config||{editable:false};config.paths=[];rings=[];for(j=0;j<c.length;j+=1){verts=[];for(k=0;k<c[j].length-1;k+=1){verts.push(new google.maps.LatLng(c[j][k].y,c[j][k].x))}if(j!==0){if(config.reverseInnerPolygons==null||config.reverseInnerPolygons){verts.reverse()}}rings.push(verts)}config.paths=config.paths.concat(rings);if(this.isRectangle){return(function(){var bounds,v=0;bounds=new google.maps.LatLngBounds();for(v in rings[0]){if(rings[0].hasOwnProperty(v)){bounds.extend(rings[0][v])}}return new google.maps.Rectangle({bounds:bounds})}())}else{return new google.maps.Polygon(config)}},multipolygon:function(config){var i,c,arr;c=this.components;config=config||{editable:false};config.path=[];arr=[];for(i=0;i<c.length;i+=1){arr.push(this.construct.polygon(config,c[i]))}return arr}};Wkt.Wkt.prototype.deconstruct=function(obj,multiFlag){var features,i,j,verts,rings,sign,tmp,response,lat,lng;if(google.maps.geometry){sign=google.maps.geometry.spherical.computeSignedArea};if(obj.constructor===google.maps.LatLng){response={type:'point',components:[{x:obj.lng(),y:obj.lat()}]};return response}if(obj.constructor===google.maps.Point){response={type:'point',components:[{x:obj.x,y:obj.y}]};return response}if(obj.constructor===google.maps.Marker){response={type:'point',components:[{x:obj.getPosition().lng(),y:obj.getPosition().lat()}]};return response}if(obj.constructor===google.maps.Polyline){verts=[];for(i=0;i<obj.getPath().length;i+=1){tmp=obj.getPath().getAt(i);verts.push({x:tmp.lng(),y:tmp.lat()})}response={type:'linestring',components:verts};return response}if(obj.constructor===google.maps.Polygon){rings=[];if(multiFlag===undefined){multiFlag=(function(){var areas,l;l=obj.getPaths().length;if(l<=1){return false}if(l===2){if(sign(obj.getPaths().getAt(0))*sign(obj.getPaths().getAt(1))<0){return false}return true}areas=obj.getPaths().getArray().map(function(k){return sign(k)/Math.abs(sign(k)); });if(areas.indexOf(areas[0])!==areas.lastIndexOf(areas[0])){multiFlag=true;return true}return false}())}for(i=0;i<obj.getPaths().length;i+=1){tmp=obj.getPaths().getAt(i);verts=[];for(j=0;j<obj.getPaths().getAt(i).length;j+=1){verts.push({x:tmp.getAt(j).lng(),y:tmp.getAt(j).lat()})}if(!tmp.getAt(tmp.length-1).equals(tmp.getAt(0))){if(i%2!==0){verts.unshift({x:tmp.getAt(tmp.length-1).lng(),y:tmp.getAt(tmp.length-1).lat()})}else{verts.push({x:tmp.getAt(0).lng(),y:tmp.getAt(0).lat()})}}if(obj.getPaths().length>1&&i>0){if(sign(obj.getPaths().getAt(i))>0&&sign(obj.getPaths().getAt(i-1))>0||sign(obj.getPaths().getAt(i))<0&&sign(obj.getPaths().getAt(i-1))<0&&!multiFlag){verts=[verts]}}if(i%2!==0){verts.reverse()}rings.push(verts)}response={type:(multiFlag)?'multipolygon':'polygon',components:rings};return response}if(obj.constructor===google.maps.Circle){var point=obj.getCenter();var radius=obj.getRadius();verts=[];var d2r=Math.PI/180; var r2d=180/Math.PI; radius=radius/1609; var earthsradius=3963;var num_seg=32;var rlat=(radius/earthsradius)*r2d;var rlng=rlat/Math.cos(point.lat()*d2r);for(var n=0;n<=num_seg;n++){var theta=Math.PI*(n/(num_seg/2));lng=point.lng()+(rlng*Math.cos(theta));lat=point.lat()+(rlat*Math.sin(theta));verts.push({x:lng,y:lat})}response={type:'polygon',components:[verts]};return response}if(obj.constructor===google.maps.LatLngBounds){tmp=obj;verts=[];verts.push({x:tmp.getSouthWest().lng(),y:tmp.getNorthEast().lat()});verts.push({x:tmp.getNorthEast().lng(),y:tmp.getNorthEast().lat()});verts.push({x:tmp.getNorthEast().lng(),y:tmp.getSouthWest().lat()});verts.push({x:tmp.getSouthWest().lng(),y:tmp.getSouthWest().lat()});verts.push({x:tmp.getSouthWest().lng(),y:tmp.getNorthEast().lat()});response={type:'polygon',isRectangle:true,components:[verts]};return response}if(obj.constructor===google.maps.Rectangle){tmp=obj.getBounds();verts=[];verts.push({x:tmp.getSouthWest().lng(),y:tmp.getNorthEast().lat()});verts.push({x:tmp.getNorthEast().lng(),y:tmp.getNorthEast().lat()});verts.push({x:tmp.getNorthEast().lng(),y:tmp.getSouthWest().lat()});verts.push({x:tmp.getSouthWest().lng(),y:tmp.getSouthWest().lat()});verts.push({x:tmp.getSouthWest().lng(),y:tmp.getNorthEast().lat()});response={type:'polygon',isRectangle:true,components:[verts]};return response}if(obj.constructor===google.maps.Data.Feature){return this.deconstruct.call(this,obj.getGeometry())}if(obj.constructor===google.maps.Data.Point){response={type:'point',components:[{x:obj.get().lng(),y:obj.get().lat()}]};return response}if(obj.constructor===google.maps.Data.LineString){verts=[];for(i=0;i<obj.getLength();i+=1){vertex=obj.getAt(i);verts.push({x:vertex.lng(),y:vertex.lat()})}response={type:'linestring',components:verts};return response}if(obj.constructor===google.maps.Data.Polygon){var rings=[];for(i=0;i<obj.getLength();i+=1){ring=obj.getAt(i);var verts=[];for(j=0;j<ring.getLength();j+=1){vertex=ring.getAt(j);verts.push({x:vertex.lng(),y:vertex.lat()})}verts.push({x:ring.getAt(0).lng(),y:ring.getAt(0).lat()});rings.push(verts)}response={type:'polygon',components:rings};return response}if(obj.constructor===google.maps.Data.MultiPoint){verts=[];for(i=0;i<obj.getLength();i+=1){vertex=obj.getAt(i);verts.push([{x:vertex.lng(),y:vertex.lat()}])}response={type:'multipoint',components:verts};return response}if(obj.constructor===google.maps.Data.MultiLineString){linestrings=[];for(i=0;i<obj.getLength();i+=1){verts=[];var linestring=obj.getAt(i);for(j=0;j<linestring.getLength();j+=1){vertex=linestring.getAt(j);verts.push({x:vertex.lng(),y:vertex.lat()})}linestrings.push(verts)}response={type:'multilinestring',components:linestrings};return response}if(obj.constructor===google.maps.Data.MultiPolygon){var k=0,polygons=[];for(k=0;k<obj.getLength();k+=1){var polygon=obj.getAt(k);var rings=[];for(i=0;i<polygon.getLength();i+=1){ring=polygon.getAt(i);var verts=[];for(j=0;j<ring.getLength();j+=1){vertex=ring.getAt(j);verts.push({x:vertex.lng(),y:vertex.lat()})}verts.push({x:ring.getAt(0).lng(),y:ring.getAt(0).lat()});rings.push(verts)}polygons.push(rings)}response={type:'multipolygon',components:polygons};return response}if(obj.constructor===google.maps.Data.GeometryCollection){var objects=[];for(k=0;k<obj.getLength();k+=1){var object=obj.getAt(k);objects.push(this.deconstruct.call(this,object))}response={type:'geometrycollection',components:objects};return response}if(Wkt.isArray(obj)){features=[];for(i=0;i<obj.length;i+=1){features.push(this.deconstruct.call(this,obj[i],true))}response={type:(function(){var k,type=obj[0].constructor;for(k=0;k<obj.length;k+=1){if(obj[k].constructor!==type){return'geometrycollection'}}switch(type){case google.maps.Marker:return'multipoint';case google.maps.Polyline:return'multilinestring';case google.maps.Polygon:return'multipolygon';default:return'geometrycollection'}}()),components:(function(){var i,comps;comps=[];for(i=0;i<features.length;i+=1){if(features[i].components){comps.push(features[i].components)}}return{"comps":comps}}())};response.components=response.components.comps;return response}}}(Wkt||require('./wicket')));
0 2 \ No newline at end of file
... ...
ferramentas/editorol/editorol.js 0 → 100755
... ... @@ -0,0 +1,2383 @@
  1 +//TODO incluir balao de informacoes como um elemento grafico de desenho
  2 +//TODO incluir caixas de texto
  3 +//TODO incluir undo na edicao
  4 +
  5 +/*
  6 + Title: Editor vetorial para OpenLayers
  7 +
  8 + i3GEO.editorOL
  9 +
  10 + Fun&ccedil;&otilde;es utilizadas pelo OpenLayers nas op&ccedil;&otilde;es de edi&ccedil;&atilde;o de dados vetoriais.
  11 + &Eacute; utilizado tamb&eacute;m pelo mashup com navega&ccedil;&atilde;o via OpenLayers e com OSM.
  12 +
  13 + Para adicionar novos botoes, modifique tamb&eacute;m i3GEO.editorOL.botoes existente em i3GEO.barraDeBotoes.openlayers.ativaPainel
  14 +
  15 + Mesmo em interfaces de debug, esse javascript s&oacute; &eacute; carregado depois de cmpactado
  16 +
  17 + Arquivo: i3geo/classesjs/classe_editorol.js
  18 +
  19 + Licen&ccedil;a:
  20 +
  21 + GPL2
  22 +
  23 + i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  24 +
  25 + Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil
  26 + Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
  27 +
  28 + Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo
  29 + e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral
  30 + GNU conforme publicada pela Free Software Foundation;
  31 +
  32 + Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,
  33 + por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita
  34 + de COMERCIABILIDADE OU ADEQUACAtilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.
  35 + Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.
  36 + Voc&ecirc; deve ter recebido uma c&oacute;pia da Licen&ccedil;a P&uacute;blica Geral do
  37 + GNU junto com este programa; se n&atilde;o, escreva para a
  38 + Free Software Foundation, Inc., no endere&ccedil;o
  39 + 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  40 + */
  41 +
  42 +if (!i3GEO || typeof (i3GEO) === 'undefined') {
  43 + var i3GEO = {};
  44 + i3GEO.Interface = {};
  45 + navn = false;
  46 + navm = false;
  47 + $i = function(id) {
  48 + return document.getElementById(id);
  49 + };
  50 + app = navigator.appName.substring(0, 1);
  51 + if (app === 'N') {
  52 + navn = true;
  53 + } else {
  54 + navm = true;
  55 + }
  56 +}
  57 +i3GEO.editorOL =
  58 + {
  59 + simbologia : {
  60 + opacidade : 0.8,
  61 + texto : "",
  62 + fillColor : "250,180,15",
  63 + strokeWidth : 5,
  64 + strokeColor : "250,150,0",
  65 + pointRadius : 4,
  66 + graphicName : "square",
  67 + fontSize : "12px",
  68 + fontColor : "0,0,0",
  69 + externalGraphic : "",
  70 + graphicHeight : 25,
  71 + graphicWidth : 25
  72 + },
  73 + backup : new ol.layer.Vector({
  74 + source : new ol.source.Vector({
  75 + features : new ol.Collection(),
  76 + useSpatialIndex : false,
  77 + name : "Backup"
  78 + }),
  79 + visible : false,
  80 + map : i3geoOL
  81 + }),
  82 + nomeFuncaoSalvar : "i3GEO.editorOL.salvaGeo()",
  83 + //substituir por i3GEO.Interface.openlayers.fundoDefault()
  84 + /*
  85 + e_oce : new ol.layer.Tile(
  86 + {
  87 + title : "ESRI Ocean Basemap",
  88 + visible : false,
  89 + isBaseLayer : true,
  90 + name : "oce",
  91 + source : new ol.source.TileArcGISRest(
  92 + {
  93 + url : "http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer",
  94 + attributions : [
  95 + new ol.Attribution(
  96 + {
  97 + html : 'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer">ArcGIS</a>'
  98 + })
  99 + ]
  100 + })
  101 + }),
  102 + e_ims : new ol.layer.Tile(
  103 + {
  104 + title : "ESRI Imagery World 2D",
  105 + visible : false,
  106 + isBaseLayer : true,
  107 + name : "ims",
  108 + source : new ol.source.TileArcGISRest(
  109 + {
  110 + url : "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer",
  111 + attributions : [
  112 + new ol.Attribution(
  113 + {
  114 + html : 'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer">ArcGIS</a>'
  115 + })
  116 + ]
  117 + })
  118 + }),
  119 + e_wsm : new ol.layer.Tile(
  120 + {
  121 + title : "ESRI World Street Map",
  122 + visible : false,
  123 + isBaseLayer : true,
  124 + name : "wsm",
  125 + source : new ol.source.TileArcGISRest(
  126 + {
  127 + url : "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer",
  128 + attributions : [
  129 + new ol.Attribution(
  130 + {
  131 + html : 'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer">ArcGIS</a>'
  132 + })
  133 + ]
  134 + })
  135 + }),
  136 + ol_mma : new ol.layer.Tile({
  137 + title : "Base carto MMA",
  138 + visible : false,
  139 + isBaseLayer : true,
  140 + name : "bra",
  141 + source : new ol.source.TileWMS({
  142 + url : "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",
  143 + params : {
  144 + 'layers' : "baseraster",
  145 + 'srs' : "EPSG:4326",
  146 + 'format' : "image/png"
  147 + }
  148 + })
  149 + }),
  150 + ol_wms : new ol.layer.Tile(
  151 + {
  152 + title : "ESRI World Street Map",
  153 + visible : false,
  154 + isBaseLayer : true,
  155 + name : "wsm",
  156 + source : new ol.source.TileArcGISRest(
  157 + {
  158 + url : "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer",
  159 + attributions : [
  160 + new ol.Attribution(
  161 + {
  162 + html : 'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer">ArcGIS</a>'
  163 + })
  164 + ]
  165 + })
  166 + }),
  167 + fundo : "e_ims,e_wsm,ol_mma,ol_wms,top_wms",
  168 + */
  169 + kml : [],
  170 + layersIniciais : [],
  171 + //essa configuracao dos botoes afeta apenas o mashup
  172 + //para a configuração do editor dentro de um mapa normal, veja i3GEO.barraDebotoes.editor.ativaPainel()
  173 + botoes : {
  174 + 'pan' : true,
  175 + 'zoombox' : true,
  176 + 'zoomtot' : true,
  177 + 'zoomin' : true,
  178 + 'zoomout' : true,
  179 + 'distancia' : true,
  180 + 'area' : true,
  181 + 'identifica' : true,
  182 + 'linha' : true,
  183 + 'ponto' : true,
  184 + 'poligono' : true,
  185 + 'texto' : true,
  186 + 'edita' : true,
  187 + 'listag' : true,
  188 + 'corta' : true,
  189 + 'apaga' : true,
  190 + 'procura' : true,
  191 + 'selecao' : true,
  192 + 'selecaotudo' : true,
  193 + 'salva' : true,
  194 + 'ajuda' : true,
  195 + 'propriedades' : true,
  196 + 'fecha' : false,
  197 + 'tools' : true,
  198 + 'undo' : false,
  199 + 'frente' : false,
  200 + 'legenda' : true,
  201 + 'rodadomouse' : true
  202 + },
  203 + pontos : [],
  204 + marca : "../pacotes/openlayers/img/marker-gold.png",
  205 + controles : [],
  206 + tiles : true,
  207 + incluilayergrafico : true,
  208 + ativalayerswitcher : false,
  209 + ativarodadomouse : true,
  210 + legendahtml : false,
  211 + numzoom : 12,
  212 + minresolution : 0.703125,
  213 + maxext : "",
  214 + mapext : [-76.5125927, -39.3925675209, -29.5851853, 9.49014852081],
  215 + mapa : "",
  216 + //ids das features graficas selecionadas
  217 + idsSelecionados : [],
  218 + //backup das features
  219 + featuresBackup : [],
  220 + //utilizado pelo mashup
  221 + inicia : function() {
  222 + // ativabotoes e boolean
  223 + if(i3GEO.editorOL.controles.length === 0){
  224 + i3GEO.editorOL.controles = [
  225 + new ol.interaction.DoubleClickZoom(),
  226 + new ol.interaction.KeyboardPan(),
  227 + new ol.interaction.KeyboardZoom(),
  228 + new ol.interaction.MouseWheelZoom(),
  229 + new ol.interaction.PinchRotate(),
  230 + new ol.interaction.PinchZoom(),
  231 + new ol.interaction.DragZoom(),
  232 + new ol.interaction.DragPan(),
  233 + new ol.control.Zoom(),
  234 + new ol.control.ZoomSlider(),
  235 + new ol.control.ScaleLine()
  236 + ];
  237 + }
  238 + var alayers = [], fundo = (i3GEO.editorOL.fundo).split(","), nfundo = fundo.length, ncontroles =
  239 + i3GEO.editorOL.controles.length, i, n, temp;
  240 +
  241 + // TODO layerswitcher no OL3
  242 + /*
  243 + * if (i3GEO.editorOL.ativalayerswitcher === "false") { i3GEO.editorOL.ativalayerswitcher = false; } if
  244 + * (i3GEO.editorOL.ativalayerswitcher === "true") { i3GEO.editorOL.ativalayerswitcher = true; }
  245 + */
  246 + if (i3GEO.editorOL.ativarodadomouse === "false") {
  247 + i3GEO.editorOL.ativarodadomouse = false;
  248 + }
  249 + if (i3GEO.editorOL.ativarodadomouse === "true") {
  250 + i3GEO.editorOL.ativarodadomouse = true;
  251 + }
  252 + if (i3GEO.editorOL.legendahtml === "false") {
  253 + i3GEO.editorOL.legendahtml = false;
  254 + }
  255 + if (i3GEO.editorOL.legendahtml === "true") {
  256 + i3GEO.editorOL.legendahtml = true;
  257 + }
  258 +
  259 + if (i3GEO.editorOL.incluilayergrafico === "false") {
  260 + i3GEO.editorOL.incluilayergrafico = false;
  261 + }
  262 + if (i3GEO.editorOL.incluilayergrafico === "true") {
  263 + i3GEO.editorOL.incluilayergrafico = true;
  264 + }
  265 + if (i3GEO.editorOL.incluilayergrafico === true) {
  266 + if (!i3GEO.desenho.layergrafico) {
  267 + i3GEO.editorOL.criaLayerGrafico();
  268 + }
  269 + } else {
  270 + i3GEO.desenho.layergrafico = "";
  271 + i3GEO.editorOL.botoes.linha = false;
  272 + i3GEO.editorOL.botoes.ponto = false;
  273 + i3GEO.editorOL.botoes.poligono = false;
  274 + i3GEO.editorOL.botoes.texto = false;
  275 + i3GEO.editorOL.botoes.edita = false;
  276 + i3GEO.editorOL.botoes.listag = false;
  277 + i3GEO.editorOL.botoes.corta = false;
  278 + i3GEO.editorOL.botoes.apaga = false;
  279 + i3GEO.editorOL.botoes.selecao = false;
  280 + i3GEO.editorOL.botoes.selecaotudo = false;
  281 + i3GEO.editorOL.botoes.salva = false;
  282 + i3GEO.editorOL.botoes.propriedades = false;
  283 + i3GEO.editorOL.botoes.fecha = false;
  284 + i3GEO.editorOL.botoes.tools = false;
  285 + i3GEO.editorOL.botoes.undo = false;
  286 + i3GEO.editorOL.botoes.frente = false;
  287 + }
  288 + if (i3GEO.editorOL.mapa === "") {
  289 + alert("O objeto i3GEO.editorOL.mapa nao existe. Precisa ser criado com new OpenLayers.Map()");
  290 + return;
  291 + }
  292 + for (i = 0; i < ncontroles; i++) {
  293 + i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i]);
  294 + }
  295 + if (i3GEO.editorOL.fundo != "") {
  296 + for (i = nfundo - 1; i >= 0; i--) {
  297 + if (fundo[i] != "") {
  298 + try {
  299 + i3GEO.editorOL[fundo[i]].transitionEffect = 'resize';
  300 + i3GEO.editorOL[fundo[i]].setVisibility(false);
  301 + i3GEO.editorOL[fundo[i]].singleTile = false;
  302 + alayers.push(i3GEO.editorOL[fundo[i]]);
  303 + } catch (e) {
  304 + if (alayers[0]) {
  305 + alayers[0].setVisibility(true);
  306 + }
  307 + }
  308 + }
  309 + }
  310 + }
  311 + i3GEO.editorOL.mapa.addLayers(alayers);
  312 + if (i3GEO.editorOL.layersIniciais !== "") {
  313 + n = i3GEO.editorOL.layersIniciais.length;
  314 + for (i = 0; i < n; i++) {
  315 + // singleTile deve ser definido em cada layer
  316 + // i3GEO.editorOL.layersIniciais[i].singleTile = single;
  317 + i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i]);
  318 + }
  319 + }
  320 + if (!i3GEO.desenho.layergrafico && i3GEO.editorOL.incluilayergrafico === true) {
  321 + i3GEO.editorOL.mapa.addLayers([
  322 + i3GEO.desenho.layergrafico
  323 + ]);
  324 + }
  325 + i3GEO.editorOL.adicionaKml();
  326 + i3GEO.editorOL.adicionaMarcas();
  327 +
  328 + i3GEO.editorOL.coordenadas();
  329 + i3GEO.editorOL.criaJanelaBusca();
  330 + i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);
  331 + if (i3GEO.editorOL.ativalayerswitcher === true) {
  332 + i3GEO.editorOL.ativaLayerSwitcher();
  333 + }
  334 + if (i3GEO.editorOL.ativarodadomouse === false) {
  335 + i3GEO.editorOL.desativaRodaDoMouse();
  336 + }
  337 +
  338 + if (i3GEO.editorOL.numzoom !== "") {
  339 + i3GEO.editorOL.mapa.setOptions({
  340 + numZoomLevels : i3GEO.editorOL.numzoom
  341 + });
  342 + }
  343 + if (i3GEO.editorOL.maxext !== "") {
  344 + i3GEO.editorOL.mapa.setOptions({
  345 + maxExtent : i3GEO.editorOL.maxext
  346 + });
  347 + }
  348 + if (i3GEO.editorOL.mapext != "") {
  349 + var m = i3GEO.util.extGeo2OSM(i3GEO.editorOL.mapext);
  350 + i3GEO.editorOL.mapa.zoomToExtent(m);
  351 + } else {
  352 + i3GEO.editorOL.mapa.zoomToMaxExtent();
  353 + }
  354 + i3GEO.editorOL.sobeLayersGraficos();
  355 + // evita que botoes de opcoes propaguem
  356 + // o mashup utiliza esse tipo de botal junto ao nome do layer
  357 + temp = i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");
  358 + if (temp) {
  359 + temp = temp.dataLayersDiv.getElementsByTagName("label");
  360 + n = temp.length;
  361 + for (i = 0; i < n; i++) {
  362 + // YAHOO.util.Event.addListener(temp[i], "click", YAHOO.util.Event.stopEvent);
  363 + temp[i].onclick = "";
  364 + }
  365 + }
  366 + },
  367 + criaLayerGrafico : function() {
  368 + i3GEO.desenho.openlayers.criaLayerGrafico();
  369 + },
  370 + layersLigados : function() {
  371 + var l, layers = i3GEO.editorOL.mapa.getLayers(), nlayers = layers.getLength(), ins = [], i;
  372 + for (i = 0; i < nlayers; i++) {
  373 + l = layers.item(i);
  374 + if (l.getVisible() === true) {
  375 + ins.push(l);
  376 + }
  377 + }
  378 + return ins;
  379 + },
  380 + layerPorParametro : function(parametro, valor) {
  381 + var layers = i3GEO.editorOL.mapa.layers, nlayers = layers.length, ins = [], i;
  382 + for (i = 0; i < nlayers; i++) {
  383 + if (layers[i][parametro] || layers[i][parametro.toLowerCase()]) {
  384 + if (layers[i][parametro] === valor || layers[i][parametro.toLowerCase()] === valor) {
  385 + ins.push(layers[i]);
  386 + }
  387 + } else {
  388 + if (layers[i].params && layers[i].params[parametro] && layers[i].params[parametro] === valor) {
  389 + ins.push(layers[i]);
  390 + }
  391 + }
  392 + }
  393 + return ins;
  394 + },
  395 + // layers clonados sao copias WMS de layers TMS necessarios para realizar o getfeature
  396 + // sao criados quando o layer e adicionado
  397 + layersClonados : function(paramsLayers) {
  398 + var layers = i3GEO.editorOL.mapa.layers, nlayers = layers.length, i;
  399 + for (i = 0; i < nlayers; i++) {
  400 + if (layers[i].params && layers[i].params.CLONETMS === paramsLayers) {
  401 + return (layers[i]);
  402 + }
  403 + }
  404 + return false;
  405 + },
  406 + layertms2wms : function(tms) {
  407 + var layer, url;
  408 + url = tms.url.replace("&cache=sim", "&DESLIGACACHE=sim");
  409 + url = url.replace("&Z=${z}&X=${x}&Y=${y}", "");
  410 + url = url.replace("Z=${z}&X=${x}&Y=${y}", "");
  411 + layer = new OpenLayers.Layer.WMS(tms.layername + "_clone", url, {
  412 + layers : tms.name,
  413 + transparent : true
  414 + }, {
  415 + gutter : 0,
  416 + isBaseLayer : false,
  417 + displayInLayerSwitcher : false,
  418 + opacity : 1,
  419 + visibility : true,
  420 + singleTile : true
  421 + });
  422 + // i3GEO.editorOL.mapa.addLayer(layer);
  423 + return layer;
  424 + },
  425 + // remove o layer clonado com layertms2wms
  426 + removeClone : function() {
  427 + var nome = i3GEO.editorOL.layerAtivo().layername + "_clone", busca = i3GEO.editorOL.mapa.getLayersByName(nome);
  428 + if (busca.length > 0) {
  429 + i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0], false);
  430 + }
  431 + },
  432 + coordenadas : function() {
  433 + //
  434 + // substitui o controle que mostra as coordenadas
  435 + //
  436 + var idcoord = i3GEO.editorOL.mapa.getControlsBy("separator", " ");
  437 + if (idcoord[0]) {
  438 + i3GEO.editorOL.mapa.events.register("mousemove", i3GEO.editorOL.mapa, function(e) {
  439 + var p, lonlat, d;
  440 + if (navm) {
  441 + p = new OpenLayers.Pixel(e.x, e.y);
  442 + } else {
  443 + p = e.xy;
  444 + }
  445 + // altera o indicador de localizacao
  446 + lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(p);
  447 + lonlat = i3GEO.util.projOSM2Geo(lonlat);
  448 + d = i3GEO.calculo.dd2dms(lonlat.lon, lonlat.lat);
  449 + try {
  450 + $i(idcoord[0].id).innerHTML = "Long: " + d[0] + "<br>Lat: " + d[1];
  451 + } catch (e) {
  452 + if (typeof (console) !== 'undefined') {
  453 + console.error(e);
  454 + }
  455 + }
  456 + });
  457 + }
  458 + },
  459 + criaJanelaBusca : function() {
  460 + var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, i, ins, combo =
  461 + "<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>";
  462 + for (i = 0; i < nlayers; i++) {
  463 + combo += "<option value='" + i + "' >" + layers[i].name + "</option>";
  464 + }
  465 + combo += "</select>";
  466 + ins = "<div class=paragrafo >" + $trad("a7") + ":<br>" + combo;
  467 + ins += "<br>" + $trad("x64") + ":<br><span id=i3GEOOLcomboitens ></span>";
  468 + ins += "<br>" + $trad("t23") + ":<br><input type=text size=20 id=i3GEOOLpalavraBusca >";
  469 + ins += "<br><br><input type=button value='" + $trad("t23") + "' id='i3GEOOLbotaoBusca' ></div>";
  470 + ins += "<br>'" + $trad("result") + "':<br><span id=i3GEOOLcomboresultado ></span>";
  471 + try {
  472 + YAHOO.namespace("procura.container");
  473 + YAHOO.procura.container.panel = new YAHOO.widget.Panel("panelprocura", {
  474 + zIndex : 2000,
  475 + iframe : false,
  476 + width : "250px",
  477 + visible : false,
  478 + draggable : true,
  479 + close : true
  480 + });
  481 + YAHOO.procura.container.panel.setHeader("Encontre no mapa");
  482 + YAHOO.procura.container.panel.setBody(ins);
  483 + YAHOO.procura.container.panel.setFooter("");
  484 + YAHOO.procura.container.panel.render(document.body);
  485 + YAHOO.procura.container.panel.center();
  486 +
  487 + document.getElementById("i3GEOOLbotaoBusca").onclick =
  488 + function() {
  489 + var layer = i3GEO.editorOL.layerAtivo(), item = document.getElementById("i3GEOOLbuscaItem").value, palavra =
  490 + document.getElementById("i3GEOOLpalavraBusca").value;
  491 + if (item === "" || palavra === "") {
  492 + alert("Escolha o item e o texto de busca");
  493 + return;
  494 + }
  495 + i3GEO.editorOL.busca(layer, item, palavra, "i3GEOOLcomboresultado");
  496 + };
  497 + document.getElementById("i3GEOOLlistaTemasBusca").onchange = function() {
  498 + i3GEO.editorOL.ativaTema(this.value);
  499 + document.getElementById("i3GEOOLcomboitens").innerHTML = "...";
  500 + i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(), "i3GEOOLcomboitens", "i3GEOOLbuscaItem");
  501 + };
  502 + } catch (e) {
  503 + }
  504 + },
  505 + criaComboTemas : function() {
  506 + var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, i, nometema = "", combo =
  507 + "<select id=i3GEOOLlistaTemasAtivos style=width:235px; >";
  508 + // i3GEO.desenho.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1);
  509 + for (i = 0; i < nlayers; i++) {
  510 + // pega o nome do tema
  511 + nometema = layers[i].getProperties().title;
  512 + combo += "<option value='" + layers[i].getProperties().name + "' >" + nometema + "</option>";
  513 + }
  514 + combo += "</select>";
  515 + return combo;
  516 + },
  517 + atualizaJanelaAtivaTema : function() {
  518 + var combo = i3GEO.editorOL.criaComboTemas();
  519 + YAHOO.temaativo.container.panel.setBody(combo);
  520 + },
  521 + criaJanelaAtivaTema : function() {
  522 + var temp;
  523 + if (!document.getElementById("paneltemaativo")) {
  524 + YAHOO.namespace("temaativo.container");
  525 + YAHOO.temaativo.container.panel = new YAHOO.widget.Panel("paneltemaativo", {
  526 + zIndex : 20000,
  527 + iframe : true,
  528 + width : "250px",
  529 + visible : false,
  530 + draggable : true,
  531 + close : true
  532 + });
  533 + YAHOO.temaativo.container.panel.setBody("");
  534 + if (i3GEO && typeof i3GEO != undefined && i3GEO != "") {
  535 + YAHOO.temaativo.container.panel
  536 + .setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>");
  537 + } else {
  538 + YAHOO.temaativo.container.panel.setHeader($trad("tativo"));
  539 + }
  540 + YAHOO.temaativo.container.panel.setFooter("");
  541 + YAHOO.temaativo.container.panel.render(document.body);
  542 + YAHOO.temaativo.container.panel.show();
  543 + YAHOO.temaativo.container.panel.center();
  544 + i3GEO.editorOL.atualizaJanelaAtivaTema();
  545 + YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close, "click", function() {
  546 + i3GEO.editorOL.marcaBotao();
  547 + if (i3GEO.eventos) {
  548 + i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS", [
  549 + "i3GEO.editorOL.atualizaJanelaAtivaTema()"
  550 + ]);
  551 + }
  552 + });
  553 + if (i3GEO && typeof i3GEO != undefined && i3GEO != "") {
  554 + if (i3GEO.eventos) {
  555 + i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS", [
  556 + "i3GEO.editorOL.atualizaJanelaAtivaTema()"
  557 + ]);
  558 + }
  559 + }
  560 + temp = $i("paneltemaativo_minimizaCabecalho");
  561 + if (temp) {
  562 + temp.onclick = function() {
  563 + i3GEO.janela.minimiza("paneltemaativo");
  564 + };
  565 + }
  566 + } else {
  567 + YAHOO.temaativo.container.panel.show();
  568 + i3GEO.editorOL.atualizaJanelaAtivaTema();
  569 + }
  570 + },
  571 + ativaTema : function(id) {
  572 + document.getElementById("i3GEOOLlistaTemasAtivos").value = id;
  573 + },
  574 + layerAtivo : function() {
  575 + var id = document.getElementById("i3GEOOLlistaTemasAtivos");
  576 + if (id) {
  577 + id = id.value;
  578 + } else {
  579 + id = i3GEO.temaAtivo;
  580 + }
  581 + if (id == "") {
  582 + return [];
  583 + } else {
  584 + return i3GEO.editorOL.layersLigados()[id];
  585 + }
  586 + },
  587 + listaItens : function(layer, idonde, idobj) {
  588 + if (!layer) {
  589 + return;
  590 + }
  591 + if (!layer.params) {
  592 + return;
  593 + }
  594 + var u = layer.url + "&request=describefeaturetype&service=wfs&version=1.0.0";
  595 + u += "&typename=" + layer.params.LAYERS;
  596 + document.body.style.cursor = "wait";
  597 + document.getElementById("i3geoMapa").style.cursor = "wait";
  598 + OpenLayers.Request.issue({
  599 + method : "GET",
  600 + url : u,
  601 + callback : function(retorno) {
  602 + document.body.style.cursor = "default";
  603 + document.getElementById("i3geoMapa").style.cursor = "default";
  604 + var fromgml = new OpenLayers.Format.WFSDescribeFeatureType({
  605 + geometryName : "msGeometry"
  606 + }), gml = fromgml.read(retorno.responseText), prop = gml.featureTypes[0].properties, nprop = prop.length, i, combo =
  607 + "<select id=" + idobj + " ><option value=''>----</option>";
  608 + for (i = 0; i < nprop; i++) {
  609 + combo += "<option value=" + prop[i].name + " >" + prop[i].name + "</option>";
  610 + }
  611 + combo += "</select>";
  612 + document.getElementById(idonde).innerHTML = combo;
  613 + },
  614 + failure : function() {
  615 + document.body.style.cursor = "default";
  616 + document.getElementById("i3geoMapa").style.cursor = "default";
  617 + alert("Erro");
  618 + }
  619 + });
  620 + },
  621 + busca : function(layer, item, palavra, onde) {
  622 + document.body.style.cursor = "wait";
  623 + document.getElementById("i3geoMapa").style.cursor = "wait";
  624 + var u = layer.url + "&request=getfeature&service=wfs&version=1.0.0";
  625 + u = u.replace("Z=${z}&X=${x}&Y=${y}", "");
  626 + u += "&OUTPUTFORMAT=gml2&typename=" + layer.params.LAYERS;
  627 + u +=
  628 + "&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>" + item
  629 + + "</PropertyName><Literal>*"
  630 + + palavra
  631 + + "*</Literal></PropertyIsLike></Filter>";
  632 + document.body.style.cursor = "wait";
  633 + document.getElementById("i3geoMapa").style.cursor = "wait";
  634 + document.getElementById(onde).innerHTML = "...";
  635 + OpenLayers.Request.issue({
  636 + method : "GET",
  637 + url : u,
  638 + callback : function(retorno) {
  639 + document.body.style.cursor = "default";
  640 + document.getElementById("i3geoMapa").style.cursor = "default";
  641 + var fromgml = new OpenLayers.Format.GML({
  642 + geometryName : "msGeometry"
  643 + }), gml = fromgml.read(retorno.responseText), ngml = gml.length, i, ins =
  644 + "<select onchange='i3GEO.editorOL.zoomPara(this.value)'>";
  645 + ins += "<option value=''>---</option>";
  646 + for (i = 0; i < ngml; i++) {
  647 + eval("var valor = gml[i].data." + item);
  648 + var bounds = gml[i].geometry.getBounds();
  649 + bounds = bounds.toBBOX();
  650 + ins += "<option value='" + bounds + "'>" + valor + "</option>";
  651 + }
  652 + ins += "</select>";
  653 + document.getElementById(onde).innerHTML = ins;
  654 + },
  655 + failure : function() {
  656 + document.body.style.cursor = "default";
  657 + document.getElementById("i3geoMapa").style.cursor = "default";
  658 + alert("Erro");
  659 + }
  660 + });
  661 + },
  662 + zoomPara : function(bbox) {
  663 + var b = new OpenLayers.Bounds.fromString(bbox);
  664 + i3GEO.editorOL.mapa.zoomToExtent(b);
  665 + },
  666 + mostraLegenda : function() {
  667 + //TODO testar no mashup
  668 + var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, ins = "", i, icone = "", url, fers, f = "", fer = "";
  669 + for (i = 0; i < nlayers; i++) {
  670 + try {
  671 + if (layers[i].get("isBaseLayer") === false) {
  672 + url = layers[i].getFullRequestString({
  673 + "request" : "getlegendgraphic"
  674 + });
  675 + //i3GEO.editorOL.mapa.getLayers().item(0).getSource().getUrls()[0]
  676 + icone = "";
  677 + if (i3GEO.editorOL.legendahtml === true) {
  678 + // os parametros FORMAT e SERVICE sao inseridos de forma redundante para grantir
  679 + // caso seja um TMS
  680 + url = url.replace("image%2Fpng", "text/html") + "&FORMAT=text/html&SERVICE=WMS";
  681 + // verifica se a camada veio de um plugin de classe_plugini3geo
  682 + // e insere o icone se for necessario
  683 + if (layers[i].options.plugini3geo) {
  684 + if (layers[i].params.LAYERS) {
  685 + // wms
  686 + icone = i3GEO.pluginI3geo[layers[i].options.plugini3geo].iconeArvoreDeCamadas(layers[i].params.LAYERS);
  687 + } else {
  688 + // tms
  689 + icone = i3GEO.pluginI3geo[layers[i].options.plugini3geo].iconeArvoreDeCamadas(layers[i].layers);
  690 + }
  691 + }
  692 + //
  693 + // verifica se a camada tem ferramentas parametrizadas
  694 + // insere o icone
  695 + //
  696 + fers = layers[i].options.ferramentas;
  697 + for (fer in fers) {
  698 + if (i3GEO.configura.ferramentasLayers[fer]) {
  699 + icone = i3GEO.configura.ferramentasLayers[fer].icone(layers[i]);
  700 + }
  701 + }
  702 + ins += icone + layers[i].name + "<br><div id=legendaL_" + i + " ></div><br>";
  703 + // necessario pq nao e sincrono
  704 + eval("var f = function(retorno){document.getElementById('legendaL_" + i
  705 + + "').innerHTML = retorno.responseText;};");
  706 + var config = {
  707 + method : "GET",
  708 + url : url,
  709 + callback : f
  710 + };
  711 + OpenLayers.Request.issue(config);
  712 + } else {
  713 + url = url.replace("LAYERS", "LAYER");
  714 + url = url.replace("&Z=${z}&X=${x}&Y=${y}", "");
  715 + url = url.replace("Z=${z}&X=${x}&Y=${y}", "");
  716 + ins += layers[i].name + "<br><img src='" + url + "&SERVICE=wms' /><br>";
  717 + }
  718 + }
  719 + } catch (e) {
  720 + }
  721 + }
  722 + // var w = window.open();
  723 + // w.document.write(ins);
  724 + // w.document.close();
  725 + if (!document.getElementById("panellegendaeditorOL")) {
  726 + YAHOO.namespace("legendaeditorOL.container");
  727 + YAHOO.legendaeditorOL.container.panel = new YAHOO.widget.Panel("panellegendaeditorOL", {
  728 + zIndex : 20000,
  729 + iframe : true,
  730 + width : "auto",
  731 + visible : false,
  732 + draggable : true,
  733 + close : true
  734 + });
  735 + YAHOO.legendaeditorOL.container.panel.setBody(ins);
  736 + YAHOO.legendaeditorOL.container.panel.setHeader($trad("p3"));
  737 + YAHOO.legendaeditorOL.container.panel.setFooter("");
  738 + YAHOO.legendaeditorOL.container.panel.render(document.body);
  739 + YAHOO.legendaeditorOL.container.panel.show();
  740 + YAHOO.legendaeditorOL.container.panel.center();
  741 +
  742 + YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close, "click", function() {
  743 + YAHOO.legendaeditorOL.container.panel.destroy();
  744 + });
  745 + } else {
  746 + YAHOO.legendaeditorOL.container.panel.setBody(ins);
  747 + YAHOO.legendaeditorOL.container.panel.show();
  748 + }
  749 + },
  750 + captura : function(lonlat) {
  751 + // if(i3GEO.desenho.layergrafico !== ""){return;}
  752 +
  753 + var d = 0.1, layers = [
  754 + i3GEO.editorOL.layerAtivo()
  755 + ], xy = lonlat.split(","), u = layers[0].url + "&REQUEST=getfeature&service=wfs&version=1.0.0";
  756 + u += "&OUTPUTFORMAT=gml2&typename=" + layers[0].params.LAYERS;
  757 + // remove parametros nao desejados
  758 + if (i3GEO.Interface.openlayers.googleLike === true) {
  759 + u += "&SRS=EPSG:3857";
  760 + }
  761 + u = u.replace("&cache=sim", "&DESLIGACACHE=sim");
  762 + u = u.replace("&Z=${z}&X=${x}&Y=${y}", "");
  763 + u = u.replace("Z=${z}&X=${x}&Y=${y}", "");
  764 + // u +=
  765 + // "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Point><gml:coordinates>"+lonlat+"</gml:coordinates></gml:Point></Intersects></Filter>";
  766 +
  767 + xy[0] = xy[0] * 1;
  768 + xy[1] = xy[1] * 1;
  769 + var poligono =
  770 + (xy[0] - d) + ","
  771 + + (xy[1] + d)
  772 + + " "
  773 + + (xy[0] + d)
  774 + + ","
  775 + + (xy[1] + d)
  776 + + " "
  777 + + (xy[0] + d)
  778 + + ","
  779 + + (xy[1] - d)
  780 + + " "
  781 + + (xy[0] - d)
  782 + + ","
  783 + + (xy[1] - d)
  784 + + " "
  785 + + (xy[0] - d)
  786 + + ","
  787 + + (xy[1] + d);
  788 + u +=
  789 + "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>" + poligono
  790 + + "</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>";
  791 +
  792 + document.body.style.cursor = "wait";
  793 + if (document.getElementById("i3geoMapa")) {
  794 + document.getElementById("i3geoMapa").style.cursor = "wait";
  795 + }
  796 + OpenLayers.Request.issue({
  797 + method : "GET",
  798 + url : u,
  799 + callback : function(retorno) {
  800 + document.body.style.cursor = "default";
  801 + if (document.getElementById("i3geoMapa")) {
  802 + document.getElementById("i3geoMapa").style.cursor = "default";
  803 + }
  804 + var i, n, f, fromgml = new OpenLayers.Format.GML({
  805 + geometryName : "msGeometry"
  806 + }), gml = fromgml.read(retorno.responseText);
  807 + n = gml.length;
  808 + for (i = 0; i < n; i++) {
  809 + f = gml[i];
  810 + f["attributes"] = {
  811 + opacidade : i3GEO.editorOL.simbologia.opacidade,
  812 + texto : i3GEO.editorOL.simbologia.texto,
  813 + fillColor : i3GEO.editorOL.simbologia.fillColor,
  814 + strokeWidth : i3GEO.editorOL.simbologia.strokeWidth,
  815 + strokeColor : i3GEO.editorOL.simbologia.strokeColor,
  816 + pointRadius : i3GEO.editorOL.simbologia.pointRadius,
  817 + graphicName : i3GEO.editorOL.simbologia.graphicName,
  818 + registros : f["attributes"]
  819 + };
  820 + }
  821 + i3GEO.desenho.layergrafico.addFeatures(gml);
  822 + },
  823 + failure : function() {
  824 + document.body.style.cursor = "default";
  825 + if (document.getElementById("i3geoMapa")) {
  826 + document.getElementById("i3geoMapa").style.cursor = "default";
  827 + }
  828 + alert("Erro");
  829 + }
  830 + });
  831 + },
  832 + salvaGeometrias : function() {
  833 + var geos = i3GEO.desenho.layergrafico.selectedFeatures, n = geos.length, ins = "";
  834 + if (n > 0) {
  835 + if ($i("panelsalvageometrias")) {
  836 + if (YAHOO.i3GEO) {
  837 + YAHOO.salvaGeometrias.container.panel = YAHOO.i3GEO.janela.manager.find("panelsalvageometrias");
  838 + }
  839 + YAHOO.salvaGeometrias.container.panel.show();
  840 + YAHOO.salvaGeometrias.container.panel.bringToTop();
  841 + } else {
  842 + try {
  843 + YAHOO.namespace("salvaGeometrias.container");
  844 + YAHOO.salvaGeometrias.container.panel = new YAHOO.widget.Panel("panelsalvageometrias", {
  845 + zIndex : 2000,
  846 + iframe : false,
  847 + width : "250px",
  848 + visible : false,
  849 + draggable : true,
  850 + close : true
  851 + });
  852 + YAHOO.salvaGeometrias.container.panel.setHeader($trad("u6"));
  853 + YAHOO.salvaGeometrias.container.panel.setBody("");
  854 + YAHOO.salvaGeometrias.container.panel.setFooter("");
  855 + YAHOO.salvaGeometrias.container.panel.render(document.body);
  856 + YAHOO.salvaGeometrias.container.panel.center();
  857 + if (YAHOO.i3GEO && YAHOO.i3GEO.janela) {
  858 + YAHOO.i3GEO.janela.manager.register(YAHOO.salvaGeometrias.container.panel);
  859 + }
  860 + YAHOO.salvaGeometrias.container.panel.show();
  861 + } catch (e) {
  862 + }
  863 + }
  864 + ins += "<p class=paragrafo >" + n + " " + $trad("geosel") + "</p>";
  865 + ins +=
  866 + "<p class=paragrafo ><a href='#' onclick='i3GEO.editorOL.listaGeometriasSel()' >" + $trad("listar")
  867 + + "</a>&nbsp;&nbsp;";
  868 + if (i3GEO.editorOL.nomeFuncaoSalvar && i3GEO.editorOL.nomeFuncaoSalvar != "") {
  869 + ins += "<a href='#' onclick='" + i3GEO.editorOL.nomeFuncaoSalvar + "' >" + $trad("sdados") + "</a>&nbsp;&nbsp;";
  870 + }
  871 + if (typeof i3geoOL !== "undefined") {
  872 + ins += "<a href='#' onclick='i3GEO.editorOL.incorporar()' >" + $trad("incorpo") + "</a></p>";
  873 + ins += "<p class=paragrafo>" + $trad("ajudaEditorOlSalva") + "</p>";
  874 + }
  875 + YAHOO.salvaGeometrias.container.panel.setBody(ins);
  876 + } else {
  877 + i3GEO.janela.tempoMsg($trad("selum"));
  878 + }
  879 + },
  880 + exportarSHP : function() {
  881 + i3GEO.editorOL.processageo("converteSHP");
  882 + },
  883 + incorporar : function() {
  884 + i3GEO.editorOL.processageo("incorporar");
  885 + },
  886 + listaGeometriasSel : function() {
  887 + var geos = i3GEO.desenho.layergrafico.selectedFeatures, n = geos.length, ins = "", i, a, w, g;
  888 + for (i = 0; i < n; i++) {
  889 + g = geos[i];
  890 + ins += "<b>" + $trad("u6") + ": " + i + "</b><br>" + i3GEO.editorOL.google2wgs(g.geometry) + "<br><br>";
  891 + ins += "<b>" + $trad("atrib") + ": " + i + "</b><br>";
  892 + a = g.attributes;
  893 + for (key in a) {
  894 + if (a[key]) {
  895 + ins += key + " = " + a[key] + "<br>";
  896 + }
  897 + }
  898 + // lista os registros se for fruto de uma captura
  899 + if (g.attributes.registros) {
  900 + ins += "<b>" + $trad("reg") + ": " + i + "</b><br>";
  901 + a = g.attributes.registros;
  902 + for (key in a) {
  903 + if (a[key]) {
  904 + ins += key + " = " + a[key] + "<br>";
  905 + }
  906 + }
  907 + }
  908 + ins += "<br>";
  909 + }
  910 + w = window.open();
  911 + w.document.write(ins);
  912 + w.document.close();
  913 + },
  914 + testeSalvar : function() {
  915 + alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar ");
  916 + },
  917 + salvaGeo : function() {
  918 + // i3GEO.editorOL.testeSalvar();
  919 + // return;
  920 + var geos = i3GEO.desenho.layergrafico.selectedFeatures, n = geos.length, funcaoOK =
  921 + function() {
  922 + // verifica se a geometria contem o atributo que indica a coluna ou codigo unico
  923 + if (geos[0].geometry) {
  924 + var registros = "", valorunico = "", nometema = $i("editorOLcomboTemaEditavel").value, key = "", tema, redesenha, p, g =
  925 + i3GEO.editorOL.google2wgs(geos[0].geometry);
  926 + if (nometema == "") {
  927 + return;
  928 + }
  929 + tema = i3GEO.arvoreDeCamadas.pegaTema(nometema, "", "name");
  930 + // o tema contem o indicador de qual e a coluna que contem o identificador unico
  931 + if (geos[0].attributes.registros) {
  932 + registros = geos[0].attributes.registros;
  933 + for (key in registros) {
  934 + if (registros[key] && key == tema.colunaidunico) {
  935 + valorunico = registros[key];
  936 + }
  937 + }
  938 + }
  939 + redesenha = function(retorno) {
  940 + i3GEO.janela.fechaAguarde("aguardeSalvaPonto");
  941 + i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);
  942 + i3GEO.Interface.atualizaTema("", nometema);
  943 + };
  944 + i3GEO.janela.AGUARDEMODAL = true;
  945 + i3GEO.janela.abreAguarde("aguardeSalvaPonto", $trad("adic") + "...");
  946 + i3GEO.janela.AGUARDEMODAL = false;
  947 +
  948 + // cria um novo registro
  949 + if (valorunico == "") {
  950 + p =
  951 + i3GEO.configura.locaplic + "/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="
  952 + + i3GEO.configura.sid;
  953 + cpJSON.call(p, "foo", redesenha, "&tema=" + nometema + "&wkt=" + g);
  954 + } else {
  955 + // atualiza a geometria
  956 + p =
  957 + i3GEO.configura.locaplic + "/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="
  958 + + i3GEO.configura.sid;
  959 + cpJSON.call(p, "foo", redesenha, "&idunico=" + valorunico + "&tema=" + nometema + "&wkt=" + g);
  960 + }
  961 + }
  962 + }, funcaoCombo = function(obj) {
  963 + $i("editorOLondeComboTemaEditavel").innerHTML = obj.dados;
  964 + }, texto = $trad("stema") + ":<br><div id=editorOLondeComboTemaEditavel ></div><br><br>";
  965 + if (n != 1) {
  966 + i3GEO.janela.tempoMsg($trad("seluma"));
  967 + } else {
  968 + i3GEO.janela.confirma(texto, 300, $trad("salva"), $trad("canc"), funcaoOK);
  969 + i3GEO.util.comboTemas("editorOLcomboTemaEditavel", funcaoCombo, "editorOLondeComboTemaEditavel", "", false, "editavel");
  970 + }
  971 + },
  972 + //muda a classe do botao para marca-lo como ativo
  973 + marcaBotao : function(classeBotao){
  974 + //desmarca todos os botoes
  975 + var i, n, botoes = $i("i3GEObarraEdicao").getElementsByTagName("div");
  976 + n = botoes.length;
  977 + for(i = 0; i < n; i++){
  978 + botoes[i].className = botoes[i].className.replace("ItemActive","ItemInactive");
  979 + if(classeBotao){
  980 + botoes[i].className = botoes[i].className.replace(classeBotao+"ItemInactive",classeBotao+"ItemActive");
  981 + }
  982 + }
  983 + i3GEO.editorOL.removeInteracoes();
  984 + },
  985 + //interacoes criadas ao ativar algum botao
  986 + //usado para remover as interacoes
  987 + interacoes : [],
  988 + removeInteracoes: function(){
  989 + var i, n;
  990 + n = i3GEO.editorOL.interacoes.length;
  991 + for(i = 0; i < n; i++){
  992 + i3geoOL.removeInteraction(i3GEO.editorOL.interacoes[i]);
  993 + }
  994 + i3GEO.editorOL.interacoes = [];
  995 + },
  996 + criaBotoes : function(botoes) {
  997 + if($i("i3GEObarraEdicao")){
  998 + $i("i3GEObarraEdicao").style.display = "block";
  999 + return;
  1000 + }
  1001 + var temp;
  1002 + //cria o painel onde entrarão os icones
  1003 + i3GEOpanelEditor = document.createElement("div");
  1004 + i3GEOpanelEditor.id = "i3GEObarraEdicao";
  1005 + i3GEOpanelEditor.className = "olControlEditingToolbar1 noprint";
  1006 + //cria os icones
  1007 + if (botoes.procura === true) {
  1008 + temp = document.createElement("div");
  1009 + temp.className = "editorOLprocuraItemInactive olButton";
  1010 + temp.title = $trad("t23");
  1011 + temp.onclick = function(){
  1012 + YAHOO.procura.container.panel.show();
  1013 + };
  1014 + i3GEOpanelEditor.appendChild(temp);
  1015 + }
  1016 + if (botoes.pan === true) {
  1017 + temp = document.createElement("div");
  1018 + temp.className = "editorOLpanItemInactive olButton";
  1019 + temp.title = "pan";
  1020 + temp.onclick = function(){
  1021 + i3GEO.editorOL.marcaBotao("editorOLpan");
  1022 + };
  1023 + i3GEOpanelEditor.appendChild(temp);
  1024 + }
  1025 + if (botoes.zoombox === true) {
  1026 + temp = document.createElement("div");
  1027 + temp.className = "editorOLzoomboxItemInactive olButton";
  1028 + temp.title = "zoombox";
  1029 + temp.onclick = function(){
  1030 + i3GEO.barraDeBotoes.defBotao("zoomli").funcaoonclick;
  1031 + };
  1032 + i3GEOpanelEditor.appendChild(temp);
  1033 + }
  1034 + if (botoes.zoomtot === true) {
  1035 + temp = document.createElement("div");
  1036 + temp.className = "editorOLzoomtotItemInactive olButton";
  1037 + temp.title = $trad("d2t");
  1038 + temp.onclick = function(){
  1039 + if (i3GEO.editorOL.mapext && i3GEO.editorOL.mapext != "") {
  1040 + i3GEO.Interface.openlayers.zoom2ext(i3GEO.editorOL.mapext.join(" "));
  1041 + } else {
  1042 + i3GEO.Interface.openlayers.zoom2ext(i3GEO.parametros.extentTotal);
  1043 + }
  1044 + };
  1045 + i3GEOpanelEditor.appendChild(temp);
  1046 + }
  1047 + if (botoes.zoomin === true) {
  1048 + temp = document.createElement("div");
  1049 + temp.className = "editorOLzoominItemInactive olButton";
  1050 + temp.title = $trad("d5t");
  1051 + temp.onclick = function(){
  1052 + var v = i3GEO.editorOL.mapa.getView();
  1053 + v.setZoom(v.getZoom() + 1);
  1054 + };
  1055 + i3GEOpanelEditor.appendChild(temp);
  1056 + }
  1057 + if (botoes.zoomout === true) {
  1058 + temp = document.createElement("div");
  1059 + temp.className = "editorOLzoomoutItemInactive olButton";
  1060 + temp.title = $trad("d5t");
  1061 + temp.onclick = function(){
  1062 + var v = i3GEO.editorOL.mapa.getView();
  1063 + v.setZoom(v.getZoom() - 1);
  1064 + };
  1065 + i3GEOpanelEditor.appendChild(temp);
  1066 + }
  1067 + if (botoes.legenda === true) {
  1068 + temp = document.createElement("div");
  1069 + temp.className = "editorOLlegendaItemInactive olButton";
  1070 + temp.title = $trad("p3");
  1071 + temp.onclick = function(){
  1072 + i3GEO.editorOL.mostraLegenda();
  1073 + };
  1074 + i3GEOpanelEditor.appendChild(temp);
  1075 + }
  1076 + if (botoes.distancia === true) {
  1077 + temp = document.createElement("div");
  1078 + temp.className = "editorOLdistanciaItemInactive olButton";
  1079 + temp.title = $trad("d21t");
  1080 + temp.onclick = function(){
  1081 + i3GEO.editorOL.marcaBotao("editorOLdistancia");
  1082 + i3GEO.barraDeBotoes.defBotao("mede").funcaoonclick;
  1083 + };
  1084 + i3GEOpanelEditor.appendChild(temp);
  1085 + }
  1086 + if (botoes.area === true) {
  1087 + temp = document.createElement("div");
  1088 + temp.className = "editorOLareaItemInactive olButton";
  1089 + temp.title = $trad("d21at");
  1090 + temp.onclick = function(){
  1091 + i3GEO.editorOL.marcaBotao("editorOLarea");
  1092 + i3GEO.barraDeBotoes.defBotao("area").funcaoonclick;
  1093 + };
  1094 + i3GEOpanelEditor.appendChild(temp);
  1095 + }
  1096 + if (botoes.linha === true) {
  1097 + temp = document.createElement("div");
  1098 + temp.className = "editorOLlinhaItemInactive olButton";
  1099 + temp.title = $trad("dlinha");
  1100 + temp.onclick = function(){
  1101 + i3GEO.eventos.cliquePerm.desativa();
  1102 + i3GEO.editorOL.marcaBotao("editorOLlinha");
  1103 + var draw = new ol.interaction.Draw({
  1104 + type : "LineString"
  1105 + });
  1106 + //adiciona a interacao para poder ser removida
  1107 + i3GEO.editorOL.interacoes.push(draw);
  1108 + //desativa ol.interaction.DoubleClickZoom
  1109 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1110 + draw.on("drawend", function(evt) {
  1111 + evt.feature.setStyle(
  1112 + new ol.style.Style({
  1113 + stroke: new ol.style.Stroke({
  1114 + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
  1115 + width: i3GEO.editorOL.simbologia.strokeWidth
  1116 + }),
  1117 + fill: new ol.style.Fill({
  1118 + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'
  1119 + })
  1120 + })
  1121 + );
  1122 + evt.feature.setId(i3GEO.util.uid());
  1123 + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
  1124 + draw.setActive(false);
  1125 + draw.setActive(true);
  1126 + if (document.getElementById("panellistagEditor")) {
  1127 + i3GEO.editorOL.listaGeometrias();
  1128 + }
  1129 + });
  1130 + i3geoOL.addInteraction(draw);
  1131 + };
  1132 + i3GEOpanelEditor.appendChild(temp);
  1133 + }
  1134 + //TODO falta definir imagem
  1135 + if (botoes.ponto === true) {
  1136 + i3GEO.eventos.cliquePerm.desativa();
  1137 + temp = document.createElement("div");
  1138 + temp.className = "editorOLpontoItemInactive olButton";
  1139 + temp.title = $trad("dponto");
  1140 + temp.onclick = function(){
  1141 + i3GEO.eventos.cliquePerm.desativa();
  1142 + i3GEO.editorOL.marcaBotao("editorOLponto");
  1143 + var draw = new ol.interaction.Draw({
  1144 + type : "Point"
  1145 + });
  1146 + //adiciona a interacao para poder ser removida
  1147 + i3GEO.editorOL.interacoes.push(draw);
  1148 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1149 + draw.on("drawend", function(evt) {
  1150 + evt.feature.setStyle(
  1151 + new ol.style.Style({
  1152 + image: new ol.style.Circle({
  1153 + radius: i3GEO.editorOL.simbologia.pointRadius,
  1154 + fill: new ol.style.Fill({
  1155 + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'
  1156 + }),
  1157 + stroke: new ol.style.Stroke({
  1158 + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
  1159 + width: i3GEO.editorOL.simbologia.pointRadius / 3
  1160 + })
  1161 + })
  1162 + })
  1163 + );
  1164 + evt.feature.setId(i3GEO.util.uid());
  1165 + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
  1166 + draw.setActive(false);
  1167 + draw.setActive(true);
  1168 + if (document.getElementById("panellistagEditor")) {
  1169 + i3GEO.editorOL.listaGeometrias();
  1170 + }
  1171 + });
  1172 + i3geoOL.addInteraction(draw);
  1173 + };
  1174 + i3GEOpanelEditor.appendChild(temp);
  1175 + }
  1176 + if (botoes.poligono === true) {
  1177 + i3GEO.eventos.cliquePerm.desativa();
  1178 + temp = document.createElement("div");
  1179 + temp.className = "editorOLpoligonoItemInactive olButton";
  1180 + temp.title = $trad("dpol");
  1181 + temp.onclick = function(){
  1182 + i3GEO.editorOL.marcaBotao("editorOLpoligono");
  1183 + var draw = new ol.interaction.Draw({
  1184 + type : "Polygon"
  1185 + });
  1186 + /*
  1187 + snap = new ol.interaction.Snap({
  1188 + source: i3GEO.desenho.layergrafico.getSource()
  1189 + });
  1190 + i3GEO.editorOL.interacoes.push(snap);
  1191 + */
  1192 + //adiciona a interacao para poder ser removida
  1193 + i3GEO.editorOL.interacoes.push(draw);
  1194 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1195 + draw.on("drawend", function(evt) {
  1196 + evt.feature.setStyle(
  1197 + new ol.style.Style({
  1198 + stroke: new ol.style.Stroke({
  1199 + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
  1200 + width: i3GEO.editorOL.simbologia.strokeWidth
  1201 + }),
  1202 + fill: new ol.style.Fill({
  1203 + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'
  1204 + })
  1205 + })
  1206 + );
  1207 + evt.feature.setId(i3GEO.util.uid());
  1208 + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
  1209 + draw.setActive(false);
  1210 + draw.setActive(true);
  1211 + if (document.getElementById("panellistagEditor")) {
  1212 + i3GEO.editorOL.listaGeometrias();
  1213 + }
  1214 + });
  1215 + i3geoOL.addInteraction(draw);
  1216 + };
  1217 + i3GEOpanelEditor.appendChild(temp);
  1218 + }
  1219 +
  1220 + if (botoes.texto === true) {
  1221 + i3GEO.eventos.cliquePerm.desativa();
  1222 + temp = document.createElement("div");
  1223 + temp.className = "editorOLtextoItemInactive olButton";
  1224 + temp.title = $trad("dtexto");
  1225 + temp.onclick = function(){
  1226 + i3GEO.eventos.cliquePerm.desativa();
  1227 + i3GEO.editorOL.marcaBotao("editorOLtexto");
  1228 + var draw = new ol.interaction.Draw({
  1229 + type : "Point"
  1230 + });
  1231 + //adiciona a interacao para poder ser removida
  1232 + i3GEO.editorOL.interacoes.push(draw);
  1233 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1234 + draw.on("drawend", function(evt) {
  1235 + var texto = window.prompt("Texto", "");
  1236 + evt.feature.setStyle(
  1237 + new ol.style.Style({
  1238 + text: new ol.style.Text({
  1239 + text: texto,
  1240 + font: 'Bold ' + parseInt(i3GEO.editorOL.simbologia.fontSize,10) + 'px Arial',
  1241 + textAlign: 'left',
  1242 + stroke: new ol.style.Stroke({
  1243 + color: 'white',
  1244 + width: i3GEO.editorOL.simbologia.strokeWidth
  1245 + }),
  1246 + fill: new ol.style.Fill({
  1247 + color: i3GEO.editorOL.simbologia.fontColor
  1248 + }),
  1249 + zIndex: 2000
  1250 + })
  1251 + })
  1252 + );
  1253 + evt.feature.setId(i3GEO.util.uid());
  1254 + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
  1255 + draw.setActive(false);
  1256 + draw.setActive(true);
  1257 + i3GEO.editorOL.marcaBotao();
  1258 + });
  1259 + i3geoOL.addInteraction(draw);
  1260 + };
  1261 + i3GEOpanelEditor.appendChild(temp);
  1262 + }
  1263 +
  1264 + if (botoes.selecao === true) {
  1265 + i3GEO.eventos.cliquePerm.desativa();
  1266 + temp = document.createElement("div");
  1267 + temp.className = "editorOLselecaoItemInactive olButton";
  1268 + temp.title = $trad("d24t");
  1269 + temp.onclick = function(){
  1270 + i3GEO.editorOL.marcaBotao("editorOLselecao");
  1271 + var sel = new ol.interaction.Select();
  1272 + //adiciona a interacao para poder ser removida
  1273 + i3GEO.editorOL.interacoes.push(sel);
  1274 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1275 + sel.on("select", function(evt) {
  1276 + var i, n, id, f;
  1277 + n = evt.selected.length;
  1278 + for(i=0; i<n; i++){
  1279 + f = evt.selected[i];
  1280 + id = f.getId();
  1281 + if(id && i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){
  1282 + i3GEO.editorOL.unselFeature(id);
  1283 + }
  1284 + else{
  1285 + id = i3GEO.util.uid();
  1286 + i3GEO.editorOL.idsSelecionados.push(id);
  1287 + f.setId(id);
  1288 + f.setProperties({
  1289 + fillColor: f.getStyle().getFill().getColor(),
  1290 + strokeColor: f.getStyle().getStroke().getColor()
  1291 + });
  1292 + f.getStyle().getFill().setColor('rgba(255, 255, 255, 0.5)');
  1293 + f.getStyle().getStroke().setColor('blue');
  1294 + }
  1295 + }
  1296 + if (n === 0){
  1297 + i3GEO.editorOL.unselTodos();
  1298 + }
  1299 + });
  1300 + i3geoOL.addInteraction(sel);
  1301 + };
  1302 + i3GEOpanelEditor.appendChild(temp);
  1303 + }
  1304 +
  1305 + if (botoes.selecaotudo === true) {
  1306 + temp = document.createElement("div");
  1307 + temp.className = "editorOLselecaoTudoItemInactive olButton";
  1308 + temp.title = $trad("studo");
  1309 + temp.onclick = function(){
  1310 + i3GEO.editorOL.marcaBotao();
  1311 + i3GEO.editorOL.selTodos();
  1312 + };
  1313 + i3GEOpanelEditor.appendChild(temp);
  1314 + }
  1315 +
  1316 + if (botoes.apaga === true) {
  1317 + temp = document.createElement("div");
  1318 + temp.className = "editorOLapagaItemInactive olButton";
  1319 + temp.title = $trad("excsel");
  1320 + temp.onclick = function(){
  1321 + var x, nsel = i3GEO.editorOL.idsSelecionados.length;
  1322 + i3GEO.editorOL.featuresBackup = [];
  1323 + i3GEO.editorOL.marcaBotao();
  1324 + if(nsel > 0){
  1325 + x = window.confirm($trad("excsel") + "?");
  1326 + if(x){
  1327 + i3GEO.editorOL.removeFeaturesSel();
  1328 + i3GEO.desenho.layergrafico.getSource().changed();
  1329 + }
  1330 + }
  1331 + else{
  1332 + i3GEO.janela.tempoMsg($trad("selum"));
  1333 + }
  1334 + };
  1335 + i3GEOpanelEditor.appendChild(temp);
  1336 + }
  1337 +
  1338 + if (botoes.frente === true) {
  1339 + temp = document.createElement("div");
  1340 + temp.className = "editorOLfrenteItemInactive olButton";
  1341 + temp.title = $trad("frente");
  1342 + temp.onclick = function(){
  1343 + var nsel = i3GEO.editorOL.idsSelecionados.length;
  1344 + if(nsel > 0){
  1345 + i3GEO.editorOL.marcaBotao();
  1346 + i3GEO.editorOL.trazParaFrente();
  1347 + }
  1348 + else{
  1349 + i3GEO.janela.tempoMsg($trad("selum"));
  1350 + }
  1351 + };
  1352 + i3GEOpanelEditor.appendChild(temp);
  1353 + }
  1354 + //TODO Translate nao funciona nessa versao do openlayers 3x precisa atualizar
  1355 + if (botoes.edita === true) {
  1356 + i3GEO.eventos.cliquePerm.desativa();
  1357 + temp = document.createElement("div");
  1358 + temp.className = "editorOLeditaItemInactive olButton";
  1359 + temp.title = $trad("dpol");
  1360 + temp.onclick = function(){
  1361 + i3GEO.editorOL.featuresBackup = [];
  1362 + var draw, nsel, f, c;
  1363 + nsel = i3GEO.editorOL.idsSelecionados.length;
  1364 + if(nsel > 0){
  1365 + i3GEO.editorOL.marcaBotao("editorOLedita");
  1366 + f = i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel - 1]);
  1367 + i3GEO.editorOL.featuresBackup.push(f.clone());
  1368 + c = new ol.Collection();
  1369 + c.push(f);
  1370 + draw = new ol.interaction.Modify({
  1371 + features: c
  1372 + });
  1373 + //adiciona a interacao para poder ser removida
  1374 + i3GEO.editorOL.interacoes.push(draw);
  1375 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1376 + i3geoOL.addInteraction(draw);
  1377 + }
  1378 + else{
  1379 + i3GEO.janela.tempoMsg($trad("selum"));
  1380 + }
  1381 + };
  1382 + i3GEOpanelEditor.appendChild(temp);
  1383 + }
  1384 + if (botoes.edita === true && botoes.corta === true && i3GEO.php) {
  1385 + i3GEO.eventos.cliquePerm.desativa();
  1386 + temp = document.createElement("div");
  1387 + temp.className = "editorOLcortaItemInactive olButton";
  1388 + temp.title = $trad("cortaf");
  1389 + temp.onclick = function(){
  1390 + var nsel = i3GEO.editorOL.idsSelecionados.length;
  1391 + if (nsel != 1) {
  1392 + alert("Selecione primeiro um elemento para ser cortado");
  1393 + } else {
  1394 + i3GEO.janela.tempoMsg("Desenhe um pol&iacute;gono");
  1395 + i3GEO.editorOL.marcaBotao("editorOLcorta");
  1396 + var draw = new ol.interaction.Draw({
  1397 + type : "Polygon"
  1398 + });
  1399 + //adiciona a interacao para poder ser removida
  1400 + i3GEO.editorOL.interacoes.push(draw);
  1401 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1402 + draw.on("drawend", function(evt) {
  1403 + var temp, f, c, format, fwkt, cwkt;
  1404 + f = evt.feature;
  1405 + c = i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel - 1]);
  1406 + i3GEO.editorOL.featuresBackup.push(c.clone());
  1407 + i3GEO.editorOL.marcaBotao();
  1408 + //corta
  1409 + format = new ol.format.WKT();
  1410 + if(f && c){
  1411 + fwkt = format.writeFeatures([f]);
  1412 + cwkt = format.writeFeatures([c]);
  1413 + if(fwkt && cwkt){
  1414 + temp = function(retorno) {
  1415 + i3GEO.janela.fechaAguarde("i3GEO.cortador");
  1416 + if (retorno != "" && retorno.data && retorno.data != "") {
  1417 + i3GEO.janela.fechaAguarde("i3GEO.cortador");
  1418 + c.setGeometry(format.readGeometry(retorno.data));
  1419 + //i3GEO.editorOL.substituiFeaturesSel(retorno.data);
  1420 + if (document.getElementById("panellistagEditor")) {
  1421 + i3GEO.editorOL.listaGeometrias();
  1422 + }
  1423 + }
  1424 + };
  1425 + i3GEO.janela.abreAguarde("i3GEO.cortador", "Cortando");
  1426 + i3GEO.php.funcoesGeometriasWkt(temp, cwkt + "|" + fwkt, "difference");
  1427 + }
  1428 + }
  1429 + });
  1430 + i3geoOL.addInteraction(draw);
  1431 + }
  1432 + };
  1433 + i3GEOpanelEditor.appendChild(temp);
  1434 + }
  1435 + if (botoes.edita === true && botoes.listag === true) {
  1436 + temp = document.createElement("div");
  1437 + temp.className = "editorOLlistagItemInactive olButton";
  1438 + temp.title = $trad("listag");
  1439 + temp.onclick = function(){
  1440 + i3GEO.editorOL.listaGeometrias();
  1441 + };
  1442 + i3GEOpanelEditor.appendChild(temp);
  1443 + }
  1444 + //TODO abrir em uma janela flutuante interna
  1445 + if (botoes.ajuda === true) {
  1446 + temp = document.createElement("div");
  1447 + temp.className = "editorOLajudaItemInactive olButton";
  1448 + temp.title = $trad("s1");
  1449 + temp.onclick = function(){
  1450 + if(i3GEO.configura && i3GEO.configura.locaplic){
  1451 + window.open(i3GEO.configura.locaplic + "/mashups/openlayers_ajuda.php");
  1452 + }
  1453 + else{
  1454 + window.open("openlayers_ajuda.php");
  1455 + }
  1456 + };
  1457 + i3GEOpanelEditor.appendChild(temp);
  1458 + }
  1459 + if (botoes.fecha === true) {
  1460 + temp = document.createElement("div");
  1461 + temp.className = "editorOLfechaItemInactive olButton";
  1462 + temp.title = $trad("x74");
  1463 + temp.onclick = function(){
  1464 + i3GEO.editorOL.unselTodos();
  1465 + i3GEO.editorOL.featuresBackup = [];
  1466 + i3GEO.editorOL.marcaBotao();
  1467 + i3GEO.eventos.cliquePerm.ativa();
  1468 + $i("i3GEObarraEdicao").style.display = "none";
  1469 + };
  1470 + i3GEOpanelEditor.appendChild(temp);
  1471 + }
  1472 + if (botoes.tools === true) {
  1473 + temp = document.createElement("div");
  1474 + temp.className = "editorOLtoolsItemInactive olButton";
  1475 + temp.title = $trad("u15a");
  1476 + temp.onclick = function(){
  1477 + // fora do i3geo, usa o jsts
  1478 + if (i3GEO.php) {
  1479 + i3GEO.editorOL.ferramentas();
  1480 + } else {
  1481 + i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()");
  1482 + }
  1483 + };
  1484 + i3GEOpanelEditor.appendChild(temp);
  1485 + }
  1486 + if (botoes.propriedades === true) {
  1487 + temp = document.createElement("div");
  1488 + temp.className = "editorOLpropriedadesItemInactive olButton";
  1489 + temp.title = $trad("p13");
  1490 + temp.onclick = function(){
  1491 + i3GEO.editorOL.propriedades();
  1492 + };
  1493 + i3GEOpanelEditor.appendChild(temp);
  1494 + }
  1495 + if (botoes.identifica === true) {
  1496 + i3GEO.eventos.cliquePerm.desativa();
  1497 + temp = document.createElement("div");
  1498 + temp.className = "editorOLidentificaItemInactive olButton";
  1499 + temp.title = $trad("d7t");
  1500 + temp.onclick = function(){
  1501 + i3GEO.editorOL.criaJanelaAtivaTema();
  1502 + i3GEO.eventos.cliquePerm.desativa();
  1503 + i3GEO.editorOL.marcaBotao("editorOLidentifica");
  1504 + var draw = new ol.interaction.Draw({
  1505 + type : "Point"
  1506 + });
  1507 + //adiciona a interacao para poder ser removida
  1508 + i3GEO.editorOL.interacoes.push(draw);
  1509 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1510 + draw.on("drawend", function(evt) {
  1511 + var xy, p, retorno, url, layer, tema = $i("i3GEOOLlistaTemasAtivos");
  1512 + if(tema){
  1513 + layer = i3geoOL.getLayersByName(tema.value)[0];
  1514 + url = layer.getSource().getUrls()[0];
  1515 + xy = evt.target.downPx_;
  1516 + retorno = function(r){
  1517 + var xy = evt.feature.getGeometry().getFirstCoordinate();
  1518 + i3GEO.eventos.cliquePerm.ativo = true;
  1519 + i3GEO.Interface.openlayers.balao(r,"", xy[0], xy[1]);
  1520 + i3GEO.eventos.cliquePerm.ativo = false;
  1521 + };
  1522 + p = i3GEO.configura.locaplic + "/classesphp/proxy.php?"
  1523 + + url
  1524 + + "&tipoRetornoProxy=string&REQUEST=GetFeatureInfo&TIPOIMAGEM=nenhum&DESLIGACACHE=sim&STYLES=&SERVICE=WMS&VERSION=1.1.1&FEATURE_COUNT=1"
  1525 + + "&FORMAT=image/png&INFO_FORMAT=text/plain&SRS=EPSG:4326"
  1526 + + "&LAYERS= " + tema.value
  1527 + + "&layer= " + tema.value
  1528 + + "&QUERY_LAYERS= " + tema.value
  1529 + + "&HEIGHT=" + i3GEO.parametros.h
  1530 + + "&WIDTH=" + i3GEO.parametros.w
  1531 + + "&BBOX=" + i3geoOL.getExtent().toBBOX().split(",").join(" ")
  1532 + + "&X=" + xy[0] + "&Y=" + xy[1];
  1533 + cpJSON.call(p, "foo", retorno, "");
  1534 + }
  1535 + //i3GEO.editorOL.marcaBotao();
  1536 + });
  1537 + i3geoOL.addInteraction(draw);
  1538 + };
  1539 + i3GEOpanelEditor.appendChild(temp);
  1540 + }
  1541 + i3GEOpanelEditor.style.width = i3GEOpanelEditor.getElementsByTagName("div").length * 33 + "px";
  1542 + i3GEO.editorOL.mapa.getViewport().getElementsByClassName("ol-overlaycontainer-stopevent")[0].appendChild(i3GEOpanelEditor);
  1543 +
  1544 + /*
  1545 + if (botoes.salva === true) {
  1546 +
  1547 + button = new OpenLayers.Control.Button({
  1548 + displayClass : "editorOLsalva",
  1549 + trigger : function() {
  1550 + i3GEO.editorOL.salvaGeometrias();
  1551 + },
  1552 + title : $trad("salva"),
  1553 + type : OpenLayers.Control.TYPE_BUTTON
  1554 + });
  1555 + controles.push(button);
  1556 + adiciona = true;
  1557 +
  1558 + }
  1559 + if (botoes.identifica === true) {
  1560 + //TODO incluir codigo ol3
  1561 +
  1562 + botaoIdentifica =
  1563 + new OpenLayers.Control.WMSGetFeatureInfo(
  1564 + {
  1565 + maxFeatures : 1,
  1566 + infoFormat : 'text/plain', // 'application/vnd.ogc.gml',
  1567 + layers : [
  1568 + i3GEO.editorOL.layerAtivo()
  1569 + ],
  1570 + queryVisible : true,
  1571 + title : $trad("d7t"),
  1572 + type : OpenLayers.Control.TYPE_TOOL,
  1573 + displayClass : "editorOLidentifica",
  1574 + eventListeners : {
  1575 + getfeatureinfo : function(event) {
  1576 + var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), lonlattexto = "<hr>", formata;
  1577 + if (botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true) {
  1578 + lonlattexto +=
  1579 + "<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\"" + lonlat.lon
  1580 + + ","
  1581 + + lonlat.lat
  1582 + + "\")'>edita geometria</span></pre><br>";
  1583 + }
  1584 + formata = function(texto) {
  1585 + var temp, temp1, n, i, f = [], textoN = texto.split(":");
  1586 + try {
  1587 + if (textoN.length > 1) {
  1588 + temp = textoN[2].replace(/\n\r/g, "");
  1589 + temp = temp.replace(/'/g, "");
  1590 + temp = temp.replace(/\n/g, "|");
  1591 + temp = temp.replace(/_/g, " ");
  1592 + temp = temp.replace(/=/g, ":");
  1593 + temp = temp.split("|");
  1594 + n = temp.length;
  1595 + for (i = 0; i < n; i++) {
  1596 + temp1 = temp[i].replace(/^\s+/, "");
  1597 + temp1 = temp1.replace(/\s+$/, "");
  1598 + if (temp1 != "")
  1599 + f.push(temp1);
  1600 + }
  1601 + texto = f.join("<br><br>");
  1602 + }
  1603 + } catch (e) {
  1604 + }
  1605 + return texto;
  1606 + };
  1607 + i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("chicken", i3GEO.editorOL.mapa
  1608 + .getLonLatFromPixel(event.xy), null, "<div style=text-align:left >" + lonlattexto
  1609 + + "<pre>"
  1610 + + formata(event.text)
  1611 + + "</pre></div>", null, true));
  1612 + i3GEO.editorOL.removeClone();
  1613 + },
  1614 + beforegetfeatureinfo : function(event) {
  1615 + var ativo = [
  1616 + i3GEO.editorOL.layerAtivo()
  1617 + ];
  1618 + // se for TMS tem de pegar o clone wms
  1619 + if (ativo[0].serviceVersion === "&tms=" || ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"
  1620 + || ativo[0].CLASS_NAME == "OpenLayers.Layer.OSM") {
  1621 + ativo = [
  1622 + i3GEO.editorOL.layertms2wms(ativo[0])
  1623 + ];
  1624 + }
  1625 + ativo[0].projection = new OpenLayers.Projection("EPSG:4326");
  1626 + event.object.layers = ativo;
  1627 + botaoIdentifica.layers = ativo;
  1628 + botaoIdentifica.url = ativo[0].url;
  1629 + },
  1630 + activate : function() {
  1631 + i3GEO.editorOL.criaJanelaAtivaTema();
  1632 + }
  1633 + }
  1634 + });
  1635 + // button.events.register("getfeatureinfo", this, showInfo);
  1636 + controles.push(botaoIdentifica);
  1637 + adiciona = true;
  1638 +
  1639 + }
  1640 +
  1641 + */
  1642 + },
  1643 + removeFeaturesSel : function(){
  1644 + var s, i, nsel, f;
  1645 + nsel = i3GEO.editorOL.idsSelecionados.length;
  1646 + s = i3GEO.desenho.layergrafico.getSource();
  1647 + for(i=0; i<nsel; i++){
  1648 + f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);
  1649 + if(f){
  1650 + i3GEO.editorOL.featuresBackup.push(f.clone());
  1651 + s.removeFeature(f);
  1652 + }
  1653 + }
  1654 + i3GEO.editorOL.idsSelecionados = [];
  1655 + },
  1656 + mudaSimbolo : function(estilo, id) {
  1657 + var s, i, nsel, f;
  1658 + i3GEO.editorOL.simbologia[estilo] = $i(id).value;
  1659 + nsel = i3GEO.editorOL.idsSelecionados.length;
  1660 + s = i3GEO.desenho.layergrafico.getSource();
  1661 + for(i=0; i<nsel; i++){
  1662 + f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);
  1663 + if(f){
  1664 + f.setProperties({
  1665 + fillColor: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
  1666 + strokeColor: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
  1667 + width: i3GEO.editorOL.simbologia.strokeWidth,
  1668 + fontSize: i3GEO.editorOL.simbologia.fontSize,
  1669 + fontColor: i3GEO.editorOL.simbologia.fontColor
  1670 + });
  1671 + }
  1672 + }
  1673 + },
  1674 + adicionaMarcas : function() {
  1675 + if (i3GEO.editorOL.pontos.length === 0) {
  1676 + return;
  1677 + }
  1678 + var f, SHADOW_Z_INDEX = 10, MARKER_Z_INDEX = 11, layer = new OpenLayers.Layer.Vector("pontos", {
  1679 + styleMap : new OpenLayers.StyleMap({
  1680 + externalGraphic : i3GEO.editorOL.marca,
  1681 + backgroundGraphic : "../pacotes/openlayers/img/marker_shadow.png",
  1682 + backgroundXOffset : 0,
  1683 + backgroundYOffset : -7,
  1684 + graphicZIndex : MARKER_Z_INDEX,
  1685 + backgroundGraphicZIndex : SHADOW_Z_INDEX,
  1686 + pointRadius : 10
  1687 + }),
  1688 + isBaseLayer : false,
  1689 + rendererOptions : {
  1690 + yOrdering : true
  1691 + },
  1692 + displayInLayerSwitcher : true,
  1693 + visibility : true
  1694 + }), index, x = [], y = [], features = [];
  1695 + for (index = 0; index < i3GEO.editorOL.pontos.length; index = index + 2) {
  1696 + x.push(i3GEO.editorOL.pontos[index]);
  1697 + y.push(i3GEO.editorOL.pontos[index + 1]);
  1698 + }
  1699 + for (index = 0; index < x.length; index++) {
  1700 + f = new OpenLayers.Geometry.Point(x[index], y[index]);
  1701 + f = i3GEO.util.projGeo2OSM(f);
  1702 + f = new OpenLayers.Feature.Vector(f);
  1703 + features.push(f);
  1704 + }
  1705 + layer.addFeatures(features);
  1706 + i3GEO.editorOL.mapa.addLayer(layer);
  1707 + },
  1708 + adicionaKml : function() {
  1709 + var temp, n, i, id, url;
  1710 + n = i3GEO.editorOL.kml.length;
  1711 + for (i = 0; i < n; i++) {
  1712 + id = "kml" + i;
  1713 + url = i3GEO.editorOL.kml[i];
  1714 + eval(id + " = new OpenLayers.Layer.Vector('"
  1715 + + id
  1716 + + "', {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '"
  1717 + + url
  1718 + + "',format: new OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})");
  1719 + eval("i3GEO.editorOL.mapa.addLayer(" + id + ");");
  1720 + eval("temp = " + id + ".div;");
  1721 + temp.onclick =
  1722 + function(e) {
  1723 + var targ = "", id, temp, features, n, i, g, html = "";
  1724 + if (!e) {
  1725 + e = window.event;
  1726 + }
  1727 + if (e.target) {
  1728 + targ = e.target;
  1729 + } else {
  1730 + if (e.srcElement) {
  1731 + targ = e.srcElement;
  1732 + }
  1733 + }
  1734 + if (targ.id) {
  1735 + temp = targ.id.split("_");
  1736 + if (temp[0] === "OpenLayers.Geometry.Point") {
  1737 + id = targ.id;
  1738 + temp = i3GEO.editorOL.mapa.getLayer(this.id);
  1739 + features = temp.features;
  1740 + n = features.length;
  1741 + for (i = 0; i < n; i++) {
  1742 + if (features[i].geometry.id === id) {
  1743 + for ( var j in features[i].attributes) {
  1744 + html += j + ": " + features[i].attributes[j];
  1745 + }
  1746 + g = features[i].geometry;
  1747 + i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud(
  1748 + "kml",
  1749 + new OpenLayers.LonLat(g.x, g.y),
  1750 + null,
  1751 + html,
  1752 + null,
  1753 + true));
  1754 + }
  1755 + }
  1756 + }
  1757 + }
  1758 + };
  1759 + }
  1760 + },
  1761 + // obtido de openlayers.org
  1762 + propriedades : function() {
  1763 + if (!document.getElementById("panelpropriedadesEditor")) {
  1764 + YAHOO.namespace("editorOL.container");
  1765 + YAHOO.editorOL.container.panel = new YAHOO.widget.Panel("panelpropriedadesEditor", {
  1766 + zIndex : 20000,
  1767 + iframe : true,
  1768 + width : "350px",
  1769 + height : "250px",
  1770 + visible : false,
  1771 + draggable : true,
  1772 + close : true
  1773 + });
  1774 + //TODO ajustar o layout dos botoes para os novos padroes
  1775 + var ins =
  1776 + "" + '<p class=paragrafo ><b>Estilos (utilize a cor no formato r,g,b):</b></p>'
  1777 + + '<table class=lista7 >'
  1778 + + ' <tr>'
  1779 + + ' <td>Cor do contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeColor\',\'i3GEOEditorOLcorContorno\')" type="text" style="cursor:text" id="i3GEOEditorOLcorContorno" size="12" value="'
  1780 + + i3GEO.editorOL.simbologia.strokeColor
  1781 + + '" /></td><td>';
  1782 + if (i3GEO.configura) {
  1783 + ins +=
  1784 + '<img alt="aquarela.gif" style=cursor:pointer src="' + i3GEO.configura.locaplic
  1785 + + '/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorContorno\');" />';
  1786 + }
  1787 + ins +=
  1788 + "" + ' </td>'
  1789 + + ' </tr>'
  1790 + + ' <tr>'
  1791 + + ' <td>Cor do preenchimento</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fillColor\',\'i3GEOEditorOLcorPre\')" type="text" style="cursor:text" id="i3GEOEditorOLcorPre" size="12" value="'
  1792 + + i3GEO.editorOL.simbologia.fillColor
  1793 + + '" /></td><td>';
  1794 + if (i3GEO.configura) {
  1795 + ins +=
  1796 + '<img alt="aquarela.gif" style=cursor:pointer src="' + i3GEO.configura.locaplic
  1797 + + '/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorPre\');" />';
  1798 + }
  1799 + ins +=
  1800 + "" + ' </td>'
  1801 + + ' </tr>'
  1802 + + ' <tr>'
  1803 + + ' <td>Cor da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontColor\',\'i3GEOEditorOLcorFonte\')" type="text" style="cursor:text" id="i3GEOEditorOLcorFonte" size="12" value="'
  1804 + + i3GEO.editorOL.simbologia.fontColor
  1805 + + '" /></td><td>';
  1806 + if (i3GEO.configura) {
  1807 + ins +=
  1808 + '<img alt="aquarela.gif" style=cursor:pointer src="' + i3GEO.configura.locaplic
  1809 + + '/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorFonte\');" />';
  1810 + }
  1811 + ins +=
  1812 + "" + ' </td>'
  1813 + + ' </tr>'
  1814 + + ' <tr>'
  1815 + + ' <td>Tamanho da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontSize\',\'i3GEOEditorOLfontsize\')" type="text" style="cursor:text" id="i3GEOEditorOLfontsize" size="3" value="' + i3GEO.editorOL.simbologia.fontSize
  1816 + + '" /></td><td></td>'
  1817 + + ' </tr>'
  1818 + + ' <tr>'
  1819 + + ' <td>Opacidade (de 0 a 1)</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'opacidade\',\'i3GEOEditorOLopacidade\')" type="text" style="cursor:text" id="i3GEOEditorOLopacidade" size="3" value="'
  1820 + + i3GEO.editorOL.simbologia.opacidade
  1821 + + '" /></td><td></td>'
  1822 + + ' </tr>'
  1823 + + ' <tr>'
  1824 + + ' <td>Largura da linha/contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeWidth\',\'i3GEOEditorOLlarguraLinha\')" type="text" style="cursor:text" id="i3GEOEditorOLlarguraLinha" size="2" value="'
  1825 + + i3GEO.editorOL.simbologia.strokeWidth
  1826 + + '" /></td><td></td>'
  1827 + + ' </tr>'
  1828 + //TODO incluir propriedades de uma figura
  1829 + /*
  1830 + + ' <tr>'
  1831 + + ' <td>Url de uma figura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'externalGraphic\',\'i3GEOEditorOLexternalGraphic\')" type="text" style="cursor:text" id="i3GEOEditorOLexternalGraphic" size="22" value="'
  1832 + + i3GEO.editorOL.simbologia.externalGraphic
  1833 + + '" /></td><td></td>'
  1834 + + ' </tr>'
  1835 + + ' <tr>'
  1836 + + ' <td>Largura e altura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicWidth\',\'i3GEOEditorOLgraphicWidth\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicWidth" size="4" value="'
  1837 + + i3GEO.editorOL.simbologia.graphicWidth
  1838 + + '" />&nbsp;<input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicHeight\',\'i3GEOEditorOLgraphicHeight\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicHeight" size="4" value="'
  1839 + + i3GEO.editorOL.simbologia.graphicHeight
  1840 + + '" /></td><td></td>'
  1841 + + ' </tr>'
  1842 + */
  1843 + + '</table>';
  1844 + //TODO implementar ao atualizar OL3
  1845 + /*
  1846 + + '<br />'
  1847 + + '<p class=paragrafo ><b>Ajusta n&oacute; em edi&ccedil;&atilde;o para o(a):</b></p>'
  1848 + + '<table class=lista7 >'
  1849 + + ' <tr>'
  1850 + + ' <td></td><td>n&oacute</td><td></td><td>v&eacute;rtice</td><td></td><td>borda</td>'
  1851 + + ' </tr>'
  1852 + + ' <tr>'
  1853 + + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_node" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_nodeTolerance" type="text" size="3" value=15 /></td>'
  1854 + + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_vertex" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_vertexTolerance" type="text" size="3" value=15 /></td>'
  1855 + + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_edge" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_edgeTolerance" type="text" size="3" value=15 /></td>'
  1856 + + ' </tr>'
  1857 + + '</table>'
  1858 +
  1859 + + '<br />'
  1860 + + '<p class=paragrafo ><b>Divide intersec&ccedil;&atilde;o ao digitalizar</b></p>'
  1861 + + '<table class=lista7 >'
  1862 + + ' <tr>'
  1863 + + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.split()" type="checkbox" id="edge_split_toggle" /></td><td>borda</td>'
  1864 + + ' </tr>'
  1865 + + '</table>'
  1866 + + '<br />'
  1867 + + '<p class=paragrafo ><b>Opera&ccedil;&atilde;o ativada pelo bot&atilde;o de modifica&ccedil;&atilde;o da figura</b></p>'
  1868 + + '<table class=lista7 >'
  1869 + + ' <tr>'
  1870 + + ' <td><input checked style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESHAPE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera figura</td>'
  1871 + + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESIZE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera tamanho</td>'
  1872 + + ' </tr>'
  1873 + + ' <tr>'
  1874 + + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.ROTATE;" type="radio" name=i3geoOLtipoEdita /></td><td>rotaciona</td>'
  1875 + + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.DRAG;" type="radio" name=i3geoOLtipoEdita /></td><td>desloca</td>'
  1876 + + ' </tr>'
  1877 + + '</table>';
  1878 + */
  1879 + YAHOO.editorOL.container.panel.setBody(ins);
  1880 + if (i3GEO && typeof i3GEO != undefined && i3GEO != "") {
  1881 + YAHOO.editorOL.container.panel
  1882 + .setHeader("Propriedades<div id='panelpropriedadesEditor_minimizaCabecalho' class='container-minimiza'></div>");
  1883 + } else {
  1884 + YAHOO.editorOL.container.panel.setHeader("Propriedades");
  1885 + }
  1886 +
  1887 + YAHOO.editorOL.container.panel.setFooter("");
  1888 + YAHOO.editorOL.container.panel.render(document.body);
  1889 +
  1890 + YAHOO.editorOL.container.panel.center();
  1891 + YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close, "click", function() {
  1892 + });
  1893 + temp = $i("panelpropriedadesEditor_minimizaCabecalho");
  1894 + if (temp) {
  1895 + temp.onclick = function() {
  1896 + i3GEO.janela.minimiza("panelpropriedadesEditor");
  1897 + };
  1898 + }
  1899 + }
  1900 + YAHOO.editorOL.container.panel.show();
  1901 + temp = $i("panelpropriedadesEditor").getElementsByTagName("div");
  1902 + if (temp && temp[2]) {
  1903 + temp[2].style.overflow = "auto";
  1904 + }
  1905 + },
  1906 + listaGeometrias : function() {
  1907 + if (!document.getElementById("panellistagEditor")) {
  1908 + YAHOO.namespace("editorOL.listaGeometrias");
  1909 + YAHOO.editorOL.listaGeometrias.panel = new YAHOO.widget.Panel("panellistagEditor", {
  1910 + zIndex : 20000,
  1911 + iframe : true,
  1912 + width : "320px",
  1913 + visible : false,
  1914 + draggable : true,
  1915 + close : true
  1916 + });
  1917 + if (i3GEO && typeof i3GEO != undefined && i3GEO != "") {
  1918 + YAHOO.editorOL.listaGeometrias.panel
  1919 + .setHeader($trad("u6") + " <div id='panellistagEditor_minimizaCabecalho' class='container-minimiza'></div>");
  1920 + } else {
  1921 + YAHOO.editorOL.listaGeometrias.panel.setHeader($trad("u6"));
  1922 + }
  1923 + YAHOO.editorOL.listaGeometrias.panel.setFooter("");
  1924 + YAHOO.editorOL.listaGeometrias.panel.render(document.body);
  1925 + YAHOO.editorOL.listaGeometrias.panel.center();
  1926 + YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close, "click", function() {
  1927 + YAHOO.editorOL.listaGeometrias.panel.destroy();
  1928 + });
  1929 + temp = $i("panellistagEditor_minimizaCabecalho");
  1930 + if (temp) {
  1931 + temp.onclick = function() {
  1932 + i3GEO.janela.minimiza("panellistagEditor");
  1933 + };
  1934 + }
  1935 + } else {
  1936 + YAHOO.editorOL.listaGeometrias.panel.render(document.body);
  1937 + }
  1938 + var id, temp, geos = i3GEO.desenho.layergrafico.getSource().getFeatures(), n = geos.length, ins = "<table class=lista4 >";
  1939 + ins += "<tr><td><i>" + $trad("u6") + "</i></td><td><i>" + $trad("opcoes") + "</i></td><td></td></tr>";
  1940 +
  1941 + while (n > 0) {
  1942 + n -= 1;
  1943 + id = geos[n].getId();
  1944 + if(id){
  1945 + ins +=
  1946 + "<tr><td>" + id
  1947 + + "</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.marcaBotao();i3GEO.editorOL.selFeature(\""
  1948 + + id
  1949 + + "\")'>seleciona</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.unselFeature(\""
  1950 + + id
  1951 + + "\")'>limpa</td></tr>";
  1952 + }
  1953 + }
  1954 + ins += "</table>";
  1955 + if (geos.length === 0) {
  1956 + ins = $trad("meneditor2");
  1957 + }
  1958 + YAHOO.editorOL.listaGeometrias.panel.show();
  1959 + if (i3GEO.configura) {
  1960 + temp = $i("panellistagEditor").getElementsByTagName("div")[2];
  1961 + } else {
  1962 + temp = $i("panellistagEditor").getElementsByTagName("div")[1];
  1963 + }
  1964 + temp.style.overflow = "auto";
  1965 + temp.style.height = "100px";
  1966 + temp.innerHTML = ins;
  1967 + },
  1968 + //TODO incuir um botao para executar a operacao ao inves do evento onchange
  1969 + ferramentas : function() {
  1970 + if (!document.getElementById("panelferramentasEditor")) {
  1971 + YAHOO.namespace("editorOL.ferramentas");
  1972 + YAHOO.editorOL.ferramentas.panel = new YAHOO.widget.Panel("panelferramentasEditor", {
  1973 + zIndex : 20000,
  1974 + iframe : true,
  1975 + width : "300px",
  1976 + visible : false,
  1977 + draggable : true,
  1978 + close : true
  1979 + });
  1980 + var ins =
  1981 + "" + '<p class=paragrafo >'
  1982 + + $trad("opsel")
  1983 + + ':</p>'
  1984 + + '<div class=styled-select >'
  1985 + + '<select onchange="i3GEO.editorOL.processageo(this.value);this.value = \'\'" >'
  1986 + + ' <option value="">---</option>'
  1987 + + ' <option value=union >Uni&atilde;o</option>';
  1988 + if (i3GEO.php) {
  1989 + ins +=
  1990 + ' <option value=intersection >Intersec&ccedil;&atilde;o</option>' + ' <option value=convexhull >Convex hull</option>'
  1991 + + ' <option value=boundary >Bordas</option>'
  1992 + + ' <option value=difference >Diferen&ccedil;a</option>'
  1993 + + ' <option value=symdifference >Diferen&ccedil;a sim&eacute;trica</option>';
  1994 + }
  1995 + ins +=
  1996 + '</select></div>';
  1997 +
  1998 + YAHOO.editorOL.ferramentas.panel.setBody(ins);
  1999 + if (i3GEO && typeof i3GEO != undefined && i3GEO != "") {
  2000 + YAHOO.editorOL.ferramentas.panel
  2001 + .setHeader("Ferramentas <div id='panelferramentasEditor_minimizaCabecalho' class='container-minimiza'></div>");
  2002 + } else {
  2003 + YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas");
  2004 + }
  2005 +
  2006 + YAHOO.editorOL.ferramentas.panel.setFooter("");
  2007 + YAHOO.editorOL.ferramentas.panel.render(document.body);
  2008 + YAHOO.editorOL.ferramentas.panel.center();
  2009 + YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close, "click", function() {
  2010 + });
  2011 + temp = $i("panelferramentasEditor_minimizaCabecalho");
  2012 + if (temp) {
  2013 + temp.onclick = function() {
  2014 + i3GEO.janela.minimiza("panelferramentasEditor");
  2015 + };
  2016 + }
  2017 + } else {
  2018 + YAHOO.editorOL.ferramentas.panel.render(document.body);
  2019 + }
  2020 + YAHOO.editorOL.ferramentas.panel.show();
  2021 + },
  2022 + //TODO implementar ao atualizar OL3
  2023 + snap : function() {
  2024 + var target = i3GEOOLsnap.targets[0], tipos = [
  2025 + "node", "vertex", "edge"
  2026 + ], ntipos = tipos.length, i, temp, ativa = false;
  2027 + i3GEOOLsnap.deactivate();
  2028 + for (i = 0; i < ntipos; i++) {
  2029 + temp = $i("target_" + tipos[i]);
  2030 + target[tipos[i]] = temp.checked;
  2031 + if (temp.checked === true) {
  2032 + ativa = true;
  2033 + }
  2034 + temp = $i("target_" + tipos[i] + "Tolerance");
  2035 + target[tipos[i] + "Tolerance"] = temp.value;
  2036 + }
  2037 + if (ativa === true) {
  2038 + i3GEOOLsnap.activate();
  2039 + }
  2040 + },
  2041 + split : function() {
  2042 + i3GEOOLsplit.deactivate();
  2043 + var temp = $i("edge_split_toggle");
  2044 + if (temp.checked === true) {
  2045 + i3GEOOLsplit.activate();
  2046 + }
  2047 + },
  2048 + processageo : function(operacao) {
  2049 + if (operacao === "") {
  2050 + return;
  2051 + }
  2052 + var polis, linhas, pontos, temp, nsel = i3GEO.editorOL.idsSelecionados.length;
  2053 + if (nsel > 0) {
  2054 + polis = i3GEO.editorOL.retornaGeometriasTipo("Polygon");
  2055 + linhas = i3GEO.editorOL.retornaGeometriasTipo("LineString");
  2056 + pontos = i3GEO.editorOL.retornaGeometriasTipo("Point");
  2057 + temp = function(retorno) {
  2058 + if (i3GEO.janela) {
  2059 + i3GEO.janela.fechaAguarde("i3GEO.editorPoli");
  2060 + i3GEO.janela.fechaAguarde("i3GEO.editorLinhas");
  2061 + i3GEO.janela.fechaAguarde("i3GEO.editorPontos");
  2062 + }
  2063 + if (retorno != "" && retorno.data && retorno.data != "" && operacao != "converteSHP") {
  2064 + i3GEO.editorOL.substituiFeaturesSel(retorno.data);
  2065 + }
  2066 + if (operacao === "converteSHP") {
  2067 + i3GEO.atualiza();
  2068 + i3GEO.janela.minimiza("paneltemaativo");
  2069 + }
  2070 + };
  2071 + if (operacao === "incorporar") {
  2072 + if (polis.length > 0) {
  2073 + temp = i3GEO.editorOL.merge(polis);
  2074 + }
  2075 + if (linhas.length > 0) {
  2076 + temp = i3GEO.editorOL.merge(linhas);
  2077 + }
  2078 + if (pontos.length > 0) {
  2079 + temp = i3GEO.editorOL.merge(pontos);
  2080 + }
  2081 + if (i3GEO.mapa) {
  2082 + i3GEO.mapa.dialogo.wkt2layer(temp);
  2083 + }
  2084 + return;
  2085 + }
  2086 + if (operacao === "union" && !i3GEO.php) {
  2087 + if (polis.length > 0) {
  2088 + temp = i3GEO.editorOL.uniaojts(polis);
  2089 + i3GEO.editorOL.substituiFeaturesSel(temp);
  2090 + }
  2091 + if (linhas.length > 0) {
  2092 + temp = i3GEO.editorOL.uniaojts(linhas);
  2093 + i3GEO.editorOL.substituiFeaturesSel(temp);
  2094 + }
  2095 + if (pontos.length > 0) {
  2096 + temp = i3GEO.editorOL.uniaojts(pontos);
  2097 + i3GEO.editorOL.substituiFeaturesSel(temp);
  2098 + }
  2099 + } else {
  2100 + if (polis.length > 0) {
  2101 + i3GEO.janela.abreAguarde("i3GEO.editorPoli", "Poligonos");
  2102 + i3GEO.php.funcoesGeometriasWkt(temp, polis.join("|"), operacao);
  2103 + }
  2104 + if (linhas.length > 0) {
  2105 + i3GEO.janela.abreAguarde("i3GEO.editorLinhas", "Linhas");
  2106 + i3GEO.php.funcoesGeometriasWkt(temp, linhas.join("|"), operacao);
  2107 + }
  2108 + if (pontos.length > 0) {
  2109 + i3GEO.janela.abreAguarde("i3GEO.editorPontos", "Pontos");
  2110 + i3GEO.php.funcoesGeometriasWkt(temp, pontos.join("|"), operacao);
  2111 + }
  2112 + }
  2113 + i3GEO.desenho.layergrafico.getSource().changed();
  2114 + return;
  2115 + } else {
  2116 + i3GEO.janela.tempoMsg("Selecione pelo menos dois elementos");
  2117 + }
  2118 + },
  2119 + merge : function(geoms) {
  2120 + var n = geoms.length, w = new Wkt.Wkt(), g, m, i, format = new ol.format.WKT();
  2121 + w.read(format.writeFeatures([geoms[0]]));
  2122 + if (n > 1) {
  2123 + for (i = 1; i < n; i++) {
  2124 + g = format.writeFeatures([geoms[i]]);
  2125 + m = new Wkt.Wkt();
  2126 + m.read(g);
  2127 + w.merge(m);
  2128 + }
  2129 + }
  2130 + return w.write();
  2131 + },
  2132 + uniaojts : function(geoms) {
  2133 + var n = geoms.length,
  2134 + fwkt = new ol.format.WKT(),
  2135 + rwkt = new jsts.io.WKTReader(),
  2136 + wwkt = new jsts.io.WKTWriter(),
  2137 + g, i, uniao;
  2138 + if (n > 1) {
  2139 + uniao = fwkt.writeFeatures([geoms[0]]);
  2140 + uniao = rwkt.read(uniao);
  2141 + for (i = 1; i <= n; i++) {
  2142 + g = fwkt.writeFeatures([geoms[i]]);
  2143 + uniao = uniao.union(rwkt.read(g));
  2144 + }
  2145 + uniao = wwkt.write(uniao);
  2146 + return [
  2147 + fwkt.readFeatures(uniao)
  2148 + ];
  2149 + } else {
  2150 + return false;
  2151 + }
  2152 + },
  2153 + retornaGeometriasTipo : function(tipo) {
  2154 + var n = i3GEO.editorOL.idsSelecionados.length, lista = [], i,
  2155 + s = i3GEO.desenho.layergrafico.getSource(),
  2156 + fwkt = new ol.format.WKT();
  2157 + for (i = 0; i < n; i++) {
  2158 + f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);
  2159 + if (f.getGeometry().getType() == tipo) {
  2160 + lista.push(fwkt.writeFeatures([f]));
  2161 + }
  2162 + }
  2163 + return lista;
  2164 + },
  2165 + guardaBackup : function() {
  2166 + return;
  2167 + // if(!i3GEO.editorOL.backup)
  2168 + // {i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});}
  2169 + // else
  2170 + // {i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features);}
  2171 + // i3GEO.editorOL.backup.addFeatures(i3GEO.desenho.layergrafico.features);
  2172 + },
  2173 + selTodos : function() {
  2174 + i3GEO.editorOL.unselTodos();
  2175 + var features, n, f, i, id;
  2176 + features = i3GEO.desenho.layergrafico.getSource().getFeatures();
  2177 + n = features.length;
  2178 + for (i = 0; i < n; i++) {
  2179 + f = features[i];
  2180 + id = f.getId();
  2181 + if(!id){
  2182 + id = i3GEO.util.uid();
  2183 + f.setId(id);
  2184 + }
  2185 + i3GEO.editorOL.idsSelecionados.push(id);
  2186 + f.setProperties({
  2187 + fillColor: f.getStyle().getFill().getColor(),
  2188 + strokeColor: f.getStyle().getStroke().getColor()
  2189 + });
  2190 + f.getStyle().getFill().setColor('rgba(255, 255, 255, 0.5)');
  2191 + f.getStyle().getStroke().setColor('blue');
  2192 + }
  2193 + i3GEO.desenho.layergrafico.getSource().changed();
  2194 + },
  2195 + unselTodos : function() {
  2196 + var i, n, f, s;
  2197 + s = i3GEO.desenho.layergrafico.getSource();
  2198 + n = i3GEO.editorOL.idsSelecionados.length;
  2199 + for(i=0; i<n; i++){
  2200 + f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);
  2201 + if(f){
  2202 + f.getStyle().getFill().setColor(f.getProperties().fillColor);
  2203 + f.getStyle().getStroke().setColor(f.getProperties().strokeColor);
  2204 + }
  2205 + }
  2206 + i3GEO.editorOL.idsSelecionados = [];
  2207 + i3GEO.desenho.layergrafico.getSource().changed();
  2208 + },
  2209 + unselTodosBackup : function() {
  2210 + var n, i;
  2211 + n = i3GEO.editorOL.backup.features.length;
  2212 + for (i = 0; i < n; i++) {
  2213 + i3GEO.editorOL.backup.features[i].renderIntent = "default";
  2214 + i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i]);
  2215 + }
  2216 + },
  2217 + unselFeature : function(id) {
  2218 + var f, s;
  2219 + s = i3GEO.desenho.layergrafico.getSource();
  2220 + f = s.getFeatureById(id);
  2221 + if(f){
  2222 + f.getStyle().getFill().setColor(f.getProperties().fillColor);
  2223 + f.getStyle().getStroke().setColor(f.getProperties().strokeColor);
  2224 + }
  2225 + i3GEO.editorOL.idsSelecionados.remove(id);
  2226 + i3GEO.desenho.layergrafico.getSource().changed();
  2227 + },
  2228 + restauraBackup : function() {
  2229 + if (i3GEO.editorOL.backup.features.length > 0) {
  2230 + i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.features);
  2231 + i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features);
  2232 + }
  2233 + if (document.getElementById("panellistagEditor")) {
  2234 + i3GEO.editorOL.listaGeometrias();
  2235 + }
  2236 + // i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features);
  2237 + },
  2238 + substituiFeaturesSel : function(f) {
  2239 + i3GEO.editorOL.removeFeaturesSel();
  2240 + var fwkt = new ol.format.WKT();
  2241 + f = fwkt.readFeatures(f)[0];
  2242 + f.setStyle(
  2243 + new ol.style.Style({
  2244 + stroke: new ol.style.Stroke({
  2245 + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
  2246 + width: i3GEO.editorOL.simbologia.strokeWidth
  2247 + }),
  2248 + fill: new ol.style.Fill({
  2249 + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'
  2250 + })
  2251 + })
  2252 + );
  2253 + f.setId(i3GEO.util.uid());
  2254 + i3GEO.desenho.layergrafico.getSource().addFeature(f);
  2255 + },
  2256 + adicionaFeatureWkt : function(wkt, atributos) {
  2257 + var f, fwkt = new OpenLayers.Format.WKT();
  2258 +
  2259 + if (atributos.externalGraphic && atributos.externalGraphic != "") {
  2260 + var style_mark = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
  2261 + style_mark.externalGraphic = atributos.externalGraphic;
  2262 + style_mark.graphicWidth = atributos.graphicWidth;
  2263 + style_mark.graphicHeight = atributos.graphicHeight;
  2264 + style_mark.fillOpacity = atributos.opacidade;
  2265 + f = fwkt.read(wkt);
  2266 + f["attributes"] = atributos;
  2267 + f["style"] = style_mark;
  2268 + } else {
  2269 + f = fwkt.read(wkt);
  2270 + f["attributes"] = atributos;
  2271 + }
  2272 + i3GEO.desenho.layergrafico.addFeatures([
  2273 + f
  2274 + ]);
  2275 + if (document.getElementById("panellistagEditor")) {
  2276 + i3GEO.editorOL.listaGeometrias();
  2277 + }
  2278 + },
  2279 + flashFeaturesI : function(index) {
  2280 + i3GEO.editorOL.flashFeatures([
  2281 + i3GEO.desenho.layergrafico.features[index]
  2282 + ], 0);
  2283 + },
  2284 + flashFeatures : function(features, index) {
  2285 + if (!index) {
  2286 + index = 0;
  2287 + }
  2288 + var current = features[index];
  2289 + if (current && current.layer === i3GEO.desenho.layergrafico) {
  2290 + i3GEO.desenho.layergrafico.drawFeature(features[index], "select");
  2291 + }
  2292 + var prev = features[index - 1];
  2293 + if (prev && prev.layer === i3GEO.desenho.layergrafico) {
  2294 + i3GEO.desenho.layergrafico.drawFeature(prev, "default");
  2295 + }
  2296 + ++index;
  2297 + if (index <= features.length) {
  2298 + window.setTimeout(function() {
  2299 + i3GEO.editorOL.flashFeatures(features, index);
  2300 + }, 75);
  2301 + }
  2302 + },
  2303 + selFeature : function(id) {
  2304 + var s,f;
  2305 + s = i3GEO.desenho.layergrafico.getSource();
  2306 + f = s.getFeatureById(id);
  2307 + if(!i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){
  2308 + i3GEO.editorOL.idsSelecionados.push(id);
  2309 + f.setProperties({
  2310 + fillColor: f.getStyle().getFill().getColor(),
  2311 + strokeColor: f.getStyle().getStroke().getColor()
  2312 + });
  2313 + f.getStyle().getFill().setColor('rgba(255, 255, 255, 0.5)');
  2314 + f.getStyle().getStroke().setColor('blue');
  2315 + s.changed();
  2316 + }
  2317 + },
  2318 + carregajts : function(funcao) {
  2319 + if (i3GEO.configura) {
  2320 + i3GEO.util.scriptTag(i3GEO.configura.locaplic + "/pacotes/jsts/lib/jsts.js", funcao, "i3GEOjts", true);
  2321 + } else {
  2322 + i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js", funcao, "i3GEOjts", true);
  2323 + }
  2324 + },
  2325 + trazParaFrente : function() {
  2326 + var s, i, nsel, id, clone;
  2327 + s = i3GEO.desenho.layergrafico.getSource();
  2328 + nsel = i3GEO.editorOL.idsSelecionados.length;
  2329 + for(i=0; i<nsel; i++){
  2330 + f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);
  2331 + if(f){
  2332 + clone = f.clone();
  2333 + id = f.getId();
  2334 + s.removeFeature(f);
  2335 + clone.setId(id);
  2336 + s.addFeature(clone);
  2337 + }
  2338 + }
  2339 + s.changed();
  2340 + },
  2341 + pegaControle : function(classe) {
  2342 + var n = i3GEO.editorOL.controles.length, i;
  2343 + for (i = 0; i < n; i++) {
  2344 + if (i3GEO.editorOL.controles[i].CLASS_NAME === classe) {
  2345 + return i3GEO.editorOL.controles[i];
  2346 + }
  2347 + }
  2348 + return false;
  2349 + },
  2350 + ativaLayerSwitcher : function() {
  2351 + var ls = i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");
  2352 + if (ls) {
  2353 + ls.maximizeDiv.click();
  2354 + }
  2355 + },
  2356 + desativaRodaDoMouse : function() {
  2357 + var controls = i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');
  2358 + for ( var i = 0; i < controls.length; ++i) {
  2359 + controls[i].disableZoomWheel();
  2360 + }
  2361 + },
  2362 + google2wgs : function(obj) {
  2363 + if (i3GEO.Interface.openlayers.googleLike === true) {
  2364 + var projWGS84 = new OpenLayers.Projection("EPSG:4326"), proj900913 = new OpenLayers.Projection("EPSG:900913");
  2365 + return obj.transform(proj900913, projWGS84);
  2366 + } else {
  2367 + return obj;
  2368 + }
  2369 + },
  2370 + sobeLayersGraficos : function() {
  2371 + var nlayers = i3GEO.editorOL.mapa.getNumLayers(), layers = i3GEO.editorOL.mapa.layers, i;
  2372 + for (i = 0; i < nlayers; i++) {
  2373 + if (layers[i].CLASS_NAME == "OpenLayers.Layer.Vector" && layers[i].name != "Nenhum") {
  2374 + i3GEO.editorOL.mapa.raiseLayer(i3GEO.editorOL.mapa.layers[i], nlayers);
  2375 + }
  2376 + }
  2377 + }
  2378 + };
  2379 +
  2380 +// para compatibilidade com OpenLayers 2x
  2381 +i3GEO.editorOL.backup.getFeatures = function() {
  2382 + return i3GEO.editorOL.backup.getSource().getFeatures();
  2383 +};
0 2384 \ No newline at end of file
... ...
ferramentas/editorol/editorol_compacto.js 0 → 100755
... ... @@ -0,0 +1 @@
  1 +if(!i3GEO||typeof(i3GEO)==='undefined'){var i3GEO={};i3GEO.Interface={};navn=false;navm=false;$i=function(id){return document.getElementById(id)};app=navigator.appName.substring(0,1);if(app==='N'){navn=true}else{navm=true}}i3GEO.editorOL={simbologia:{opacidade:0.8,texto:"",fillColor:"250,180,15",strokeWidth:2,strokeColor:"250,150,0",pointRadius:4,graphicName:"square",fontSize:"12px",fontColor:"0,0,0",externalGraphic:"",graphicHeight:25,graphicWidth:25},backup:new ol.layer.Vector({source:new ol.source.Vector({features:new ol.Collection(),useSpatialIndex:false,name:"Backup"}),visible:false,map:i3geoOL}),nomeFuncaoSalvar:"i3GEO.editorOL.salvaGeo()",e_oce:new ol.layer.Tile({title:"ESRI Ocean Basemap",visible:false,isBaseLayer:true,name:"oce",source:new ol.source.TileArcGISRest({url:"http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer",attributions:[new ol.Attribution({html:'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer">ArcGIS</a>'})]})}),e_ims:new ol.layer.Tile({title:"ESRI Imagery World 2D",visible:false,isBaseLayer:true,name:"ims",source:new ol.source.TileArcGISRest({url:"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer",attributions:[new ol.Attribution({html:'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer">ArcGIS</a>'})]})}),e_wsm:new ol.layer.Tile({title:"ESRI World Street Map",visible:false,isBaseLayer:true,name:"wsm",source:new ol.source.TileArcGISRest({url:"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer",attributions:[new ol.Attribution({html:'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer">ArcGIS</a>'})]})}),ol_mma:new ol.layer.Tile({title:"Base carto MMA",visible:false,isBaseLayer:true,name:"bra",source:new ol.source.TileWMS({url:"http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",params:{'layers':"baseraster",'srs':"EPSG:4326",'format':"image/png"}})}),ol_wms:new ol.layer.Tile({title:"ESRI World Street Map",visible:false,isBaseLayer:true,name:"wsm",source:new ol.source.TileArcGISRest({url:"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer",attributions:[new ol.Attribution({html:'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer">ArcGIS</a>'})]})}),fundo:"e_ims,e_wsm,ol_mma,ol_wms,top_wms",kml:[],layersIniciais:[],botoes:{'pan':true,'zoombox':true,'zoomtot':true,'zoomin':true,'zoomout':true,'distancia':true,'area':true,'identifica':true,'linha':true,'ponto':true,'poligono':true,'texto':true,'edita':true,'listag':true,'corta':true,'apaga':true,'procura':true,'selecao':true,'selecaotudo':true,'salva':true,'ajuda':true,'propriedades':true,'fecha':false,'tools':true,'undo':false,'frente':false,'legenda':true,'rodadomouse':true},pontos:[],marca:"../pacotes/openlayers/img/marker-gold.png",controles:[],tiles:true,incluilayergrafico:true,ativalayerswitcher:false,ativarodadomouse:true,legendahtml:false,numzoom:12,minresolution:0.703125,maxext:"",mapext:[-76.5125927,-39.3925675209,-29.5851853,9.49014852081],mapa:"",inicia:function(){if(i3GEO.editorOL.controles.length===0){i3GEO.editorOL.controles=[new ol.interaction.DoubleClickZoom(),new ol.interaction.KeyboardPan(),new ol.interaction.KeyboardZoom(),new ol.interaction.MouseWheelZoom(),new ol.interaction.PinchRotate(),new ol.interaction.PinchZoom(),new ol.interaction.DragZoom(),new ol.interaction.DragPan(),new ol.control.Zoom(),new ol.control.ZoomSlider(),new ol.control.ScaleLine()]}var alayers=[],fundo=(i3GEO.editorOL.fundo).split(","),nfundo=fundo.length,ncontroles=i3GEO.editorOL.controles.length,i,n,temp;if(i3GEO.editorOL.ativarodadomouse==="false"){i3GEO.editorOL.ativarodadomouse=false}if(i3GEO.editorOL.ativarodadomouse==="true"){i3GEO.editorOL.ativarodadomouse=true}if(i3GEO.editorOL.legendahtml==="false"){i3GEO.editorOL.legendahtml=false}if(i3GEO.editorOL.legendahtml==="true"){i3GEO.editorOL.legendahtml=true}if(i3GEO.editorOL.incluilayergrafico==="false"){i3GEO.editorOL.incluilayergrafico=false}if(i3GEO.editorOL.incluilayergrafico==="true"){i3GEO.editorOL.incluilayergrafico=true}if(i3GEO.editorOL.incluilayergrafico===true){if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.criaLayerGrafico()}}else{i3GEO.desenho.layergrafico="";i3GEO.editorOL.botoes.linha=false;i3GEO.editorOL.botoes.ponto=false;i3GEO.editorOL.botoes.poligono=false;i3GEO.editorOL.botoes.texto=false;i3GEO.editorOL.botoes.edita=false;i3GEO.editorOL.botoes.listag=false;i3GEO.editorOL.botoes.corta=false;i3GEO.editorOL.botoes.apaga=false;i3GEO.editorOL.botoes.selecao=false;i3GEO.editorOL.botoes.selecaotudo=false;i3GEO.editorOL.botoes.salva=false;i3GEO.editorOL.botoes.propriedades=false;i3GEO.editorOL.botoes.fecha=false;i3GEO.editorOL.botoes.tools=false;i3GEO.editorOL.botoes.undo=false;i3GEO.editorOL.botoes.frente=false}if(i3GEO.editorOL.mapa===""){alert("O objeto i3GEO.editorOL.mapa nao existe. Precisa ser criado com new OpenLayers.Map()");return}for(i=0;i<ncontroles;i++){i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i])}if(i3GEO.editorOL.fundo!=""){for(i=nfundo-1;i>=0;i--){if(fundo[i]!=""){try{i3GEO.editorOL[fundo[i]].transitionEffect='resize';i3GEO.editorOL[fundo[i]].setVisibility(false);i3GEO.editorOL[fundo[i]].singleTile=false;alayers.push(i3GEO.editorOL[fundo[i]])}catch(e){if(alayers[0]){alayers[0].setVisibility(true)}}}}}i3GEO.editorOL.mapa.addLayers(alayers);if(i3GEO.editorOL.layersIniciais!==""){n=i3GEO.editorOL.layersIniciais.length;for(i=0;i<n;i++){i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i])}}if(!i3GEO.desenho.layergrafico&&i3GEO.editorOL.incluilayergrafico===true){i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}i3GEO.editorOL.adicionaKml();i3GEO.editorOL.adicionaMarcas();i3GEO.editorOL.coordenadas();i3GEO.editorOL.criaJanelaBusca();i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);if(i3GEO.editorOL.ativalayerswitcher===true){i3GEO.editorOL.ativaLayerSwitcher()}if(i3GEO.editorOL.ativarodadomouse===false){i3GEO.editorOL.desativaRodaDoMouse()}if(i3GEO.editorOL.numzoom!==""){i3GEO.editorOL.mapa.setOptions({numZoomLevels:i3GEO.editorOL.numzoom})}if(i3GEO.editorOL.maxext!==""){i3GEO.editorOL.mapa.setOptions({maxExtent:i3GEO.editorOL.maxext})}if(i3GEO.editorOL.mapext!=""){var m=i3GEO.util.extGeo2OSM(i3GEO.editorOL.mapext);i3GEO.editorOL.mapa.zoomToExtent(m)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}i3GEO.editorOL.sobeLayersGraficos();temp=i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");if(temp){temp=temp.dataLayersDiv.getElementsByTagName("label");n=temp.length;for(i=0;i<n;i++){temp[i].onclick=""}}},criaLayerGrafico:function(){i3GEO.desenho.openlayers.criaLayerGrafico()},layersLigados:function(){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,ins=[],i;for(i=0;i<nlayers;i++){if(layers[i].visibility===true){ins.push(layers[i])}}return ins},layerPorParametro:function(parametro,valor){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,ins=[],i;for(i=0;i<nlayers;i++){if(layers[i][parametro]||layers[i][parametro.toLowerCase()]){if(layers[i][parametro]===valor||layers[i][parametro.toLowerCase()]===valor){ins.push(layers[i])}}else{if(layers[i].params&&layers[i].params[parametro]&&layers[i].params[parametro]===valor){ins.push(layers[i])}}}return ins},layersClonados:function(paramsLayers){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,i;for(i=0;i<nlayers;i++){if(layers[i].params&&layers[i].params.CLONETMS===paramsLayers){return(layers[i])}}return false},layertms2wms:function(tms){var layer,url;url=tms.url.replace("&cache=sim","&DESLIGACACHE=sim");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");url=url.replace("Z=${z}&X=${x}&Y=${y}","");layer=new OpenLayers.Layer.WMS(tms.layername+"_clone",url,{layers:tms.name,transparent:true},{gutter:0,isBaseLayer:false,displayInLayerSwitcher:false,opacity:1,visibility:true,singleTile:true});return layer},removeClone:function(){var nome=i3GEO.editorOL.layerAtivo().layername+"_clone",busca=i3GEO.editorOL.mapa.getLayersByName(nome);if(busca.length>0){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0],false)}},coordenadas:function(){var idcoord=i3GEO.editorOL.mapa.getControlsBy("separator"," ");if(idcoord[0]){i3GEO.editorOL.mapa.events.register("mousemove",i3GEO.editorOL.mapa,function(e){var p,lonlat,d;if(navm){p=new OpenLayers.Pixel(e.x,e.y)}else{p=e.xy}lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(p);lonlat=i3GEO.util.projOSM2Geo(lonlat);d=i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);try{$i(idcoord[0].id).innerHTML="Long: "+d[0]+"<br>Lat: "+d[1]}catch(e){}}})}},criaJanelaBusca:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,ins,combo="<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>";for(i=0;i<nlayers;i++){combo+="<option value='"+i+"' >"+layers[i].name+"</option>"}combo+="</select>";ins="<div class=paragrafo >"+$trad("a7")+":<br>"+combo;ins+="<br>"+$trad("x64")+":<br><span id=i3GEOOLcomboitens ></span>";ins+="<br>"+$trad("t23")+":<br><input type=text size=20 id=i3GEOOLpalavraBusca >";ins+="<br><br><input type=button value='"+$trad("t23")+"' id='i3GEOOLbotaoBusca' ></div>";ins+="<br>'"+$trad("result")+"':<br><span id=i3GEOOLcomboresultado ></span>";try{YAHOO.namespace("procura.container");YAHOO.procura.container.panel=new YAHOO.widget.Panel("panelprocura",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.procura.container.panel.setHeader("Encontre no mapa");YAHOO.procura.container.panel.setBody(ins);YAHOO.procura.container.panel.setFooter("");YAHOO.procura.container.panel.render(document.body);YAHOO.procura.container.panel.center();document.getElementById("i3GEOOLbotaoBusca").onclick=function(){var layer=i3GEO.editorOL.layerAtivo(),item=document.getElementById("i3GEOOLbuscaItem").value,palavra=document.getElementById("i3GEOOLpalavraBusca").value;if(item===""||palavra===""){alert("Escolha o item e o texto de busca");return}i3GEO.editorOL.busca(layer,item,palavra,"i3GEOOLcomboresultado")};document.getElementById("i3GEOOLlistaTemasBusca").onchange=function(){i3GEO.editorOL.ativaTema(this.value);document.getElementById("i3GEOOLcomboitens").innerHTML="...";i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(),"i3GEOOLcomboitens","i3GEOOLbuscaItem")}}catch(e){}},criaComboTemas:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,nometema="",temp,combo="<select id=i3GEOOLlistaTemasAtivos style=width:235px; >";for(i=0;i<nlayers;i++){nometema="";if(i3GEO.arvoreDeCamadas&&i3GEO.arvoreDeCamadas.CAMADAS){temp=i3GEO.arvoreDeCamadas.pegaTema(layers[i].name,"","name");if(temp!=""){nometema=temp.tema+" - "}}combo+="<option value='"+i+"' >"+nometema+layers[i].name+"</option>"}combo+="</select>";return combo},atualizaJanelaAtivaTema:function(){var combo=i3GEO.editorOL.criaComboTemas();YAHOO.temaativo.container.panel.setBody(combo);document.getElementById("i3GEOOLlistaTemasAtivos").onchange=function(){if(botaoIdentifica){botaoIdentifica.layers=[i3GEO.editorOL.layersLigados()[this.value]]}}},criaJanelaAtivaTema:function(){var temp;if(!document.getElementById("paneltemaativo")){YAHOO.namespace("temaativo.container");YAHOO.temaativo.container.panel=new YAHOO.widget.Panel("paneltemaativo",{zIndex:20000,iframe:true,width:"250px",visible:false,draggable:true,close:true});YAHOO.temaativo.container.panel.setBody("");if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.temaativo.container.panel.setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.temaativo.container.panel.setHeader($trad("tativo"))}YAHOO.temaativo.container.panel.setFooter("");YAHOO.temaativo.container.panel.render(document.body);YAHOO.temaativo.container.panel.show();YAHOO.temaativo.container.panel.center();i3GEO.editorOL.atualizaJanelaAtivaTema();YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close,"click",function(){i3GEOpanelEditor.deactivate();i3GEOpanelEditor.activate();if(i3GEO.eventos){i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["i3GEO.editorOL.atualizaJanelaAtivaTema()"])}});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){if(i3GEO.eventos){i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["i3GEO.editorOL.atualizaJanelaAtivaTema()"])}}temp=$i("paneltemaativo_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("paneltemaativo")}}}else{YAHOO.temaativo.container.panel.show();i3GEO.editorOL.atualizaJanelaAtivaTema()}},ativaTema:function(id){document.getElementById("i3GEOOLlistaTemasAtivos").value=id},layerAtivo:function(){var id=document.getElementById("i3GEOOLlistaTemasAtivos");if(id){id=id.value}else{id=i3GEO.temaAtivo}if(id==""){return[]}else{return i3GEO.editorOL.layersLigados()[id]}},listaItens:function(layer,idonde,idobj){if(!layer){return}if(!layer.params){return}var u=layer.url+"&request=describefeaturetype&service=wfs&version=1.0.0";u+="&typename="+layer.params.LAYERS;document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.WFSDescribeFeatureType({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),prop=gml.featureTypes[0].properties,nprop=prop.length,i,combo="<select id="+idobj+" ><option value=''>----</option>";for(i=0;i<nprop;i++){combo+="<option value="+prop[i].name+" >"+prop[i].name+"</option>"}combo+="</select>";document.getElementById(idonde).innerHTML=combo},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},busca:function(layer,item,palavra,onde){document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";var u=layer.url+"&request=getfeature&service=wfs&version=1.0.0";u=u.replace("Z=${z}&X=${x}&Y=${y}","");u+="&OUTPUTFORMAT=gml2&typename="+layer.params.LAYERS;u+="&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>"+item+"</PropertyName><Literal>*"+palavra+"*</Literal></PropertyIsLike></Filter>";document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";document.getElementById(onde).innerHTML="...";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),ngml=gml.length,i,ins="<select onchange='i3GEO.editorOL.zoomPara(this.value)'>";ins+="<option value=''>---</option>";for(i=0;i<ngml;i++){eval("var valor = gml[i].data."+item);var bounds=gml[i].geometry.getBounds();bounds=bounds.toBBOX();ins+="<option value='"+bounds+"'>"+valor+"</option>"}ins+="</select>";document.getElementById(onde).innerHTML=ins},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},zoomPara:function(bbox){var b=new OpenLayers.Bounds.fromString(bbox);i3GEO.editorOL.mapa.zoomToExtent(b)},mostraLegenda:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,ins="",i,icone="",url,fers,f="",fer="";for(i=0;i<nlayers;i++){try{if(layers[i].isBaseLayer===false){url=layers[i].getFullRequestString({"request":"getlegendgraphic"});icone="";if(i3GEO.editorOL.legendahtml===true){url=url.replace("image%2Fpng","text/html")+"&FORMAT=text/html&SERVICE=WMS";if(layers[i].options.plugini3geo){if(layers[i].params.LAYERS){icone=i3GEO.pluginI3geo[layers[i].options.plugini3geo].iconeArvoreDeCamadas(layers[i].params.LAYERS)}else{icone=i3GEO.pluginI3geo[layers[i].options.plugini3geo].iconeArvoreDeCamadas(layers[i].layers)}}fers=layers[i].options.ferramentas;for(fer in fers){if(i3GEO.configura.ferramentasLayers[fer]){icone=i3GEO.configura.ferramentasLayers[fer].icone(layers[i])}}ins+=icone+layers[i].name+"<br><div id=legendaL_"+i+" ></div><br>";eval("var f = function(retorno){document.getElementById('legendaL_"+i+"').innerHTML = retorno.responseText;};");var config={method:"GET",url:url,callback:f};OpenLayers.Request.issue(config)}else{url=url.replace("LAYERS","LAYER");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");url=url.replace("Z=${z}&X=${x}&Y=${y}","");ins+=layers[i].name+"<br><img src='"+url+"&SERVICE=wms' /><br>"}}}catch(e){}}if(!document.getElementById("panellegendaeditorOL")){YAHOO.namespace("legendaeditorOL.container");YAHOO.legendaeditorOL.container.panel=new YAHOO.widget.Panel("panellegendaeditorOL",{zIndex:20000,iframe:true,width:"auto",visible:false,draggable:true,close:true});YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.setHeader($trad("p3"));YAHOO.legendaeditorOL.container.panel.setFooter("");YAHOO.legendaeditorOL.container.panel.render(document.body);YAHOO.legendaeditorOL.container.panel.show();YAHOO.legendaeditorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close,"click",function(){YAHOO.legendaeditorOL.container.panel.destroy()})}else{YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.show()}},captura:function(lonlat){var d=0.1,layers=[i3GEO.editorOL.layerAtivo()],xy=lonlat.split(","),u=layers[0].url+"&REQUEST=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS;if(i3GEO.Interface.openlayers.googleLike===true){u+="&SRS=EPSG:3857"}u=u.replace("&cache=sim","&DESLIGACACHE=sim");u=u.replace("&Z=${z}&X=${x}&Y=${y}","");u=u.replace("Z=${z}&X=${x}&Y=${y}","");xy[0]=xy[0]*1;xy[1]=xy[1]*1;var poligono=(xy[0]-d)+","+(xy[1]+d)+" "+(xy[0]+d)+","+(xy[1]+d)+" "+(xy[0]+d)+","+(xy[1]-d)+" "+(xy[0]-d)+","+(xy[1]-d)+" "+(xy[0]-d)+","+(xy[1]+d);u+="&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>"+poligono+"</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>";document.body.style.cursor="wait";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="wait"}OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}var i,n,f,fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText);n=gml.length;for(i=0;i<n;i++){f=gml[i];f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName,registros:f["attributes"]}}i3GEO.desenho.layergrafico.addFeatures(gml)},failure:function(){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}alert("Erro")}})},salvaGeometrias:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="";if(n>0){if($i("panelsalvageometrias")){if(YAHOO.i3GEO){YAHOO.salvaGeometrias.container.panel=YAHOO.i3GEO.janela.manager.find("panelsalvageometrias")}YAHOO.salvaGeometrias.container.panel.show();YAHOO.salvaGeometrias.container.panel.bringToTop()}else{try{YAHOO.namespace("salvaGeometrias.container");YAHOO.salvaGeometrias.container.panel=new YAHOO.widget.Panel("panelsalvageometrias",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.salvaGeometrias.container.panel.setHeader($trad("u6"));YAHOO.salvaGeometrias.container.panel.setBody("");YAHOO.salvaGeometrias.container.panel.setFooter("");YAHOO.salvaGeometrias.container.panel.render(document.body);YAHOO.salvaGeometrias.container.panel.center();if(YAHOO.i3GEO&&YAHOO.i3GEO.janela){YAHOO.i3GEO.janela.manager.register(YAHOO.salvaGeometrias.container.panel)}YAHOO.salvaGeometrias.container.panel.show()}catch(e){}}ins+="<p class=paragrafo >"+n+" "+$trad("geosel")+"</p>";ins+="<p class=paragrafo ><a href='#' onclick='i3GEO.editorOL.listaGeometriasSel()' >"+$trad("listar")+"</a>&nbsp;&nbsp;";if(i3GEO.editorOL.nomeFuncaoSalvar&&i3GEO.editorOL.nomeFuncaoSalvar!=""){ins+="<a href='#' onclick='"+i3GEO.editorOL.nomeFuncaoSalvar+"' >"+$trad("sdados")+"</a>&nbsp;&nbsp;"}if(typeof i3geoOL!=="undefined"){ins+="<a href='#' onclick='i3GEO.editorOL.incorporar()' >"+$trad("incorpo")+"</a></p>";ins+="<p class=paragrafo>"+$trad("ajudaEditorOlSalva")+"</p>"}YAHOO.salvaGeometrias.container.panel.setBody(ins)}else{i3GEO.janela.tempoMsg($trad("selum"))}},exportarSHP:function(){i3GEO.editorOL.processageo("converteSHP")},incorporar:function(){i3GEO.editorOL.processageo("incorporar")},listaGeometriasSel:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="",i,a,w,g;for(i=0;i<n;i++){g=geos[i];ins+="<b>"+$trad("u6")+": "+i+"</b><br>"+i3GEO.editorOL.google2wgs(g.geometry)+"<br><br>";ins+="<b>"+$trad("atrib")+": "+i+"</b><br>";a=g.attributes;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}if(g.attributes.registros){ins+="<b>"+$trad("reg")+": "+i+"</b><br>";a=g.attributes.registros;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}}ins+="<br>"}w=window.open();w.document.write(ins);w.document.close()},testeSalvar:function(){alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar ")},salvaGeo:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,funcaoOK=function(){if(geos[0].geometry){var registros="",valorunico="",nometema=$i("editorOLcomboTemaEditavel").value,key="",tema,redesenha,p,g=i3GEO.editorOL.google2wgs(geos[0].geometry);if(nometema==""){return}tema=i3GEO.arvoreDeCamadas.pegaTema(nometema,"","name");if(geos[0].attributes.registros){registros=geos[0].attributes.registros;for(key in registros){if(registros[key]&&key==tema.colunaidunico){valorunico=registros[key]}}}redesenha=function(retorno){i3GEO.janela.fechaAguarde("aguardeSalvaPonto");i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);i3GEO.Interface.atualizaTema("",nometema)};i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaPonto",$trad("adic")+"...");i3GEO.janela.AGUARDEMODAL=false;if(valorunico==""){p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+g)}else{p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+g)}}},funcaoCombo=function(obj){$i("editorOLondeComboTemaEditavel").innerHTML=obj.dados},texto=$trad("stema")+":<br><div id=editorOLondeComboTemaEditavel ></div><br><br>";if(n!=1){i3GEO.janela.tempoMsg($trad("seluma"))}else{i3GEO.janela.confirma(texto,300,$trad("salva"),$trad("canc"),funcaoOK);i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel")}},criaBotoes:function(botoes){var controles=[],adiciona=true,sketchSymbolizers={"Point":{pointRadius:4,graphicName:"square",fillColor:"white",fillOpacity:1,strokeWidth:1,strokeOpacity:1,strokeColor:"#333333"},"Line":{strokeWidth:3,strokeOpacity:1,strokeColor:"#666666",strokeDashstyle:"dash"},"Polygon":{strokeWidth:2,strokeOpacity:1,strokeColor:"#666666",fillColor:"white",fillOpacity:0.3}};i3GEOpanelEditor=new OpenLayers.Control.Panel({displayClass:"olControlEditingToolbar1 noprint",saveState:false,activateControl:function(c){this.deactivate();this.activate();try{i3GEO.editorOL.ModifyFeature.deactivate();if(i3GEO&&i3GEO.barraDeBotoes){i3GEO.barraDeBotoes.ativaPadrao()}}catch(e){}if(!c.trigger){c.activate()}else{c.trigger.call()}}});if(botoes.procura===false){button=new OpenLayers.Control.Button({displayClass:"editorOLprocura",trigger:function(){YAHOO.procura.container.panel.show()},title:$trad("t23"),type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.pan===true){controles.push(new OpenLayers.Control.Navigation({title:"pan",displayClass:"editorOLpan",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoombox===true){controles.push(new OpenLayers.Control.ZoomBox({title:"zoombox",displayClass:"editorOLzoombox",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoomtot===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomtot",trigger:function(){if(i3GEO.editorOL.mapext&&i3GEO.editorOL.mapext!=""){i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}},title:$trad("d2t"),type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomin===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomin",trigger:function(){i3GEO.editorOL.mapa.zoomIn()},title:$trad("d5t"),type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomout===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomout",trigger:function(){i3GEO.editorOL.mapa.zoomOut()},title:$trad("d6t"),type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.legenda===true){button=new OpenLayers.Control.Button({displayClass:"editorOLlegenda",trigger:function(){i3GEO.editorOL.mostraLegenda()},title:$trad("p3"),type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.distancia===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Path,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLdistancia",title:$trad("d21t"),type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units,measure=event.measure;alert($trad("d21t")+": "+measure.toFixed(3)+" "+units)}});controles.push(button);adiciona=true}if(botoes.area===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLarea",title:$trad("d21at"),type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units;var measure=event.measure;alert($trad("d21at")+": "+measure.toFixed(3)+" "+units+"2")}});controles.push(button);adiciona=true}if(botoes.identifica===true){}if(botoes.linha===true){}if(botoes.ponto===true){}if(botoes.poligono===true){}if(botoes.texto===true){}if(botoes.edita===true&&botoes.corta===true&&i3GEO.php){}if(botoes.edita===true){}if(botoes.edita===true&&botoes.listag===true){}if(botoes.frente===true){}if(botoes.tools===true&&i3GEO.php){}if(botoes.selecao===true){}if(botoes.selecaotudo===true){}if(botoes.apaga===true){}if(botoes.propriedades===true){}if(botoes.salva===true){}if(botoes.ajuda===true){}if(botoes.fecha===true){}if(adiciona===true){i3GEOpanelEditor.addControls(controles)}},mudaSimbolo:function(estilo,id){var valor=$i(id).value,geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,i;i3GEO.editorOL.simbologia[estilo]=valor;for(i=0;i<n;i++){geos[i].attributes[estilo]=valor;geos[i].style[estilo]=valor}},adicionaMarcas:function(){if(i3GEO.editorOL.pontos.length===0){return}var f,SHADOW_Z_INDEX=10,MARKER_Z_INDEX=11,layer=new OpenLayers.Layer.Vector("pontos",{styleMap:new OpenLayers.StyleMap({externalGraphic:i3GEO.editorOL.marca,backgroundGraphic:"../pacotes/openlayers/img/marker_shadow.png",backgroundXOffset:0,backgroundYOffset:-7,graphicZIndex:MARKER_Z_INDEX,backgroundGraphicZIndex:SHADOW_Z_INDEX,pointRadius:10}),isBaseLayer:false,rendererOptions:{yOrdering:true},displayInLayerSwitcher:true,visibility:true}),index,x=[],y=[],features=[];for(index=0;index<i3GEO.editorOL.pontos.length;index=index+2){x.push(i3GEO.editorOL.pontos[index]);y.push(i3GEO.editorOL.pontos[index+1])}for(index=0;index<x.length;index++){f=new OpenLayers.Geometry.Point(x[index],y[index]);f=i3GEO.util.projGeo2OSM(f);f=new OpenLayers.Feature.Vector(f);features.push(f)}layer.addFeatures(features);i3GEO.editorOL.mapa.addLayer(layer)},adicionaKml:function(){var temp,n,i,id,url;n=i3GEO.editorOL.kml.length;for(i=0;i<n;i++){id="kml"+i;url=i3GEO.editorOL.kml[i];eval(id+" = new OpenLayers.Layer.Vector('"+id+"', {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '"+url+"',format: new OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})");eval("i3GEO.editorOL.mapa.addLayer("+id+");");eval("temp = "+id+".div;");temp.onclick=function(e){var targ="",id,temp,features,n,i,g,html="";if(!e){e=window.event}if(e.target){targ=e.target}else{if(e.srcElement){targ=e.srcElement}}if(targ.id){temp=targ.id.split("_");if(temp[0]==="OpenLayers.Geometry.Point"){id=targ.id;temp=i3GEO.editorOL.mapa.getLayer(this.id);features=temp.features;n=features.length;for(i=0;i<n;i++){if(features[i].geometry.id===id){for(var j in features[i].attributes){html+=j+": "+features[i].attributes[j]}g=features[i].geometry;i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("kml",new OpenLayers.LonLat(g.x,g.y),null,html,null,true))}}}}}}},propriedades:function(){if(!document.getElementById("panelpropriedadesEditor")){YAHOO.namespace("editorOL.container");YAHOO.editorOL.container.panel=new YAHOO.widget.Panel("panelpropriedadesEditor",{zIndex:20000,iframe:true,width:"350px",height:"250px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo ><b>Estilos (utilize a cor no formato r,g,b):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td>Cor do contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeColor\',\'i3GEOEditorOLcorContorno\')" type="text" style="cursor:text" id="i3GEOEditorOLcorContorno" size="12" value="'+i3GEO.editorOL.simbologia.strokeColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorContorno\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor do preenchimento</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fillColor\',\'i3GEOEditorOLcorPre\')" type="text" style="cursor:text" id="i3GEOEditorOLcorPre" size="12" value="'+i3GEO.editorOL.simbologia.fillColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorPre\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontColor\',\'i3GEOEditorOLcorFonte\')" type="text" style="cursor:text" id="i3GEOEditorOLcorFonte" size="12" value="'+i3GEO.editorOL.simbologia.fontColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorFonte\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Tamanho da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontSize\',\'i3GEOEditorOLfontsize\')" type="text" style="cursor:text" id="i3GEOEditorOLfontsize" size="3" value="'+i3GEO.editorOL.simbologia.fontSize+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Opacidade (de 0 a 1)</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'opacidade\',\'i3GEOEditorOLopacidade\')" type="text" style="cursor:text" id="i3GEOEditorOLopacidade" size="3" value="'+i3GEO.editorOL.simbologia.opacidade+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura da linha/contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeWidth\',\'i3GEOEditorOLlarguraLinha\')" type="text" style="cursor:text" id="i3GEOEditorOLlarguraLinha" size="2" value="'+i3GEO.editorOL.simbologia.strokeWidth+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Url de uma figura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'externalGraphic\',\'i3GEOEditorOLexternalGraphic\')" type="text" style="cursor:text" id="i3GEOEditorOLexternalGraphic" size="22" value="'+i3GEO.editorOL.simbologia.externalGraphic+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura e altura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicWidth\',\'i3GEOEditorOLgraphicWidth\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicWidth" size="4" value="'+i3GEO.editorOL.simbologia.graphicWidth+'" />&nbsp;<input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicHeight\',\'i3GEOEditorOLgraphicHeight\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicHeight" size="4" value="'+i3GEO.editorOL.simbologia.graphicHeight+'" /></td><td></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Ajusta n&oacute; em edi&ccedil;&atilde;o para o(a):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td></td><td>n&oacute</td><td></td><td>v&eacute;rtice</td><td></td><td>borda</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_node" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_nodeTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_vertex" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_vertexTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_edge" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_edgeTolerance" type="text" size="3" value=15 /></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Divide intersec&ccedil;&atilde;o ao digitalizar</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.split()" type="checkbox" id="edge_split_toggle" /></td><td>borda</td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Opera&ccedil;&atilde;o ativada pelo bot&atilde;o de modifica&ccedil;&atilde;o da figura</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input checked style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESHAPE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera figura</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESIZE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera tamanho</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.ROTATE;" type="radio" name=i3geoOLtipoEdita /></td><td>rotaciona</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.DRAG;" type="radio" name=i3geoOLtipoEdita /></td><td>desloca</td>'+' </tr>'+'</table>';YAHOO.editorOL.container.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.container.panel.setHeader("Propriedades<div id='panelpropriedadesEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.container.panel.setHeader("Propriedades")}YAHOO.editorOL.container.panel.setFooter("");YAHOO.editorOL.container.panel.render(document.body);YAHOO.editorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close,"click",function(){});temp=$i("panelpropriedadesEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelpropriedadesEditor")}}}YAHOO.editorOL.container.panel.show();temp=$i("panelpropriedadesEditor").getElementsByTagName("div");if(temp&&temp[2]){temp[2].style.overflow="auto"}},listaGeometrias:function(){if(!document.getElementById("panellistagEditor")){YAHOO.namespace("editorOL.listaGeometrias");YAHOO.editorOL.listaGeometrias.panel=new YAHOO.widget.Panel("panellistagEditor",{zIndex:20000,iframe:true,width:"320px",visible:false,draggable:true,close:true});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.listaGeometrias.panel.setHeader($trad("u6")+" <div id='panellistagEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.listaGeometrias.panel.setHeader($trad("u6"))}YAHOO.editorOL.listaGeometrias.panel.setFooter("");YAHOO.editorOL.listaGeometrias.panel.render(document.body);YAHOO.editorOL.listaGeometrias.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close,"click",function(){YAHOO.editorOL.listaGeometrias.panel.destroy()});temp=$i("panellistagEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panellistagEditor")}}}else{YAHOO.editorOL.listaGeometrias.panel.render(document.body)}var g,temp,geos=i3GEO.desenho.layergrafico.features,n=geos.length,ins="<table class=lista4 >";ins+="<tr><td><i>"+$trad("u6")+"</i></td><td><i>"+$trad("opcoes")+"</i></td><td></td><td></td></tr>";while(n>0){n-=1;g=geos[n].geometry;ins+="<tr><td>"+g.CLASS_NAME+"</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.selFeature("+n+")'>seleciona</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.unselFeature("+n+")'>limpa</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.flashFeaturesI("+n+")'>brilha</td></tr>"}ins+="</table>";if(geos.length===0){ins=$trad("meneditor2")}YAHOO.editorOL.listaGeometrias.panel.show();if(i3GEO.configura){temp=$i("panellistagEditor").getElementsByTagName("div")[2]}else{temp=$i("panellistagEditor").getElementsByTagName("div")[1]}temp.style.overflow="auto";temp.style.height="100px";temp.innerHTML=ins},ferramentas:function(){if(!document.getElementById("panelferramentasEditor")){YAHOO.namespace("editorOL.ferramentas");YAHOO.editorOL.ferramentas.panel=new YAHOO.widget.Panel("panelferramentasEditor",{zIndex:20000,iframe:true,width:"300px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo >'+$trad("opsel")+':</p>'+'<select onchange="i3GEO.editorOL.processageo(this.value);this.value = \'\'" >'+' <option value="">---</option>'+' <option value=union >Uni&atilde;o</option>';if(i3GEO.php){ins+=' <option value=intersection >Intersec&ccedil;&atilde;o</option>'+' <option value=convexhull >Convex hull</option>'+' <option value=boundary >Bordas</option>'+' <option value=difference >Diferen&ccedil;a</option>'+' <option value=symdifference >Diferen&ccedil;a sim&eacute;trica</option>'}ins+='</select>'+'<br><br><a class=paragrafo href=# onclick="i3GEO.desenho.layergrafico.destroyFeatures()" >Apaga tudo</a>';YAHOO.editorOL.ferramentas.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas <div id='panelferramentasEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas")}YAHOO.editorOL.ferramentas.panel.setFooter("");YAHOO.editorOL.ferramentas.panel.render(document.body);YAHOO.editorOL.ferramentas.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close,"click",function(){});temp=$i("panelferramentasEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelferramentasEditor")}}}else{YAHOO.editorOL.ferramentas.panel.render(document.body)}YAHOO.editorOL.ferramentas.panel.show()},snap:function(){var target=i3GEOOLsnap.targets[0],tipos=["node","vertex","edge"],ntipos=tipos.length,i,temp,ativa=false;i3GEOOLsnap.deactivate();for(i=0;i<ntipos;i++){temp=$i("target_"+tipos[i]);target[tipos[i]]=temp.checked;if(temp.checked===true){ativa=true}temp=$i("target_"+tipos[i]+"Tolerance");target[tipos[i]+"Tolerance"]=temp.value}if(ativa===true){i3GEOOLsnap.activate()}},split:function(){i3GEOOLsplit.deactivate();var temp=$i("edge_split_toggle");if(temp.checked===true){i3GEOOLsplit.activate()}},processageo:function(operacao){if(operacao===""){return}var geosel=i3GEO.desenho.layergrafico.selectedFeatures,polis,linhas,pontos,temp;if(geosel.length>0){polis=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Polygon");linhas=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.LineString");pontos=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Point");temp=function(retorno){if(i3GEO.janela){i3GEO.janela.fechaAguarde("i3GEO.editorPoli");i3GEO.janela.fechaAguarde("i3GEO.editorLinhas");i3GEO.janela.fechaAguarde("i3GEO.editorPontos")}if(retorno!=""&&retorno.data&&retorno.data!=""&&operacao!="converteSHP"){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}if(operacao==="converteSHP"){i3GEO.atualiza();i3GEO.janela.minimiza("paneltemaativo")}};if(operacao==="incorporar"){if(polis.length>0){temp=i3GEO.editorOL.merge(polis)}if(linhas.length>0){temp=i3GEO.editorOL.merge(linhas)}if(pontos.length>0){temp=i3GEO.editorOL.merge(pontos)}if(i3GEO.mapa){i3GEO.mapa.dialogo.wkt2layer(temp)}return}if(operacao==="union"&&!i3GEO.php){if(polis.length>0){temp=i3GEO.editorOL.uniaojts(polis);i3GEO.editorOL.substituiFeaturesSel(temp)}if(linhas.length>0){temp=i3GEO.editorOL.uniaojts(linhas);i3GEO.editorOL.substituiFeaturesSel(temp)}if(pontos.length>0){temp=i3GEO.editorOL.uniaojts(pontos);i3GEO.editorOL.substituiFeaturesSel(temp)}}else{if(polis.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPoli","Poligonos");i3GEO.php.funcoesGeometriasWkt(temp,polis.join("|"),operacao)}if(linhas.length>0){i3GEO.janela.abreAguarde("i3GEO.editorLinhas","Linhas");i3GEO.php.funcoesGeometriasWkt(temp,linhas.join("|"),operacao)}if(pontos.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPontos","Pontos");i3GEO.php.funcoesGeometriasWkt(temp,pontos.join("|"),operacao)}}return}else{i3GEO.janela.tempoMsg("Selecione pelo menos dois elementos")}},merge:function(geoms){var n=geoms.length,w=new Wkt.Wkt(),g,m,i;w.read(geoms[0].toString());if(n>1){for(i=1;i<n;i++){g=geoms[i].toString();m=new Wkt.Wkt();m.read(g);w.merge(m)}}return w.write()},uniaojts:function(geoms){var n=geoms.length,rwkt=new jsts.io.WKTReader(),wwkt=new jsts.io.WKTWriter(),fwkt=new OpenLayers.Format.WKT(),g,i,uniao;if(n>1){uniao=(fwkt.read(geoms[0]).geometry).toString();uniao=rwkt.read(uniao);for(i=1;i<=n;i++){g=(fwkt.read(geoms[i]).geometry).toString();uniao=uniao.union(rwkt.read(g))}uniao=wwkt.write(uniao);return[fwkt.read(uniao)]}else{return false}},retornaGeometriasTipo:function(features,tipo){var n=features.length,lista=[],i,temp;for(i=0;i<n;i++){temp=features[i].geometry;if(temp.CLASS_NAME==tipo){lista.push(temp)}}return lista},guardaBackup:function(){return},unselTodos:function(){var n,i;n=i3GEO.desenho.layergrafico.features.length;for(i=0;i<n;i++){i3GEO.desenho.layergrafico.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[i])}},unselTodosBackup:function(){var n,i;n=i3GEO.editorOL.backup.features.length;for(i=0;i<n;i++){i3GEO.editorOL.backup.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i])}},restauraBackup:function(){if(i3GEO.editorOL.backup.features.length>0){i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features)}if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},substituiFeaturesSel:function(wkt){i3GEO.editorOL.guardaBackup();try{var f,fwkt=new OpenLayers.Format.WKT();i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);f=fwkt.read(wkt);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}catch(e){i3GEO.editorOL.restauraBackup()}},adicionaFeatureWkt:function(wkt,atributos){var f,fwkt=new OpenLayers.Format.WKT();if(atributos.externalGraphic&&atributos.externalGraphic!=""){var style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=atributos.externalGraphic;style_mark.graphicWidth=atributos.graphicWidth;style_mark.graphicHeight=atributos.graphicHeight;style_mark.fillOpacity=atributos.opacidade;f=fwkt.read(wkt);f["attributes"]=atributos;f["style"]=style_mark}else{f=fwkt.read(wkt);f["attributes"]=atributos}i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},flashFeaturesI:function(index){i3GEO.editorOL.flashFeatures([i3GEO.desenho.layergrafico.features[index]],0)},flashFeatures:function(features,index){if(!index){index=0}var current=features[index];if(current&&current.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(features[index],"select")}var prev=features[index-1];if(prev&&prev.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(prev,"default")}++index;if(index<=features.length){window.setTimeout(function(){i3GEO.editorOL.flashFeatures(features,index)},75)}},selFeature:function(index){i3GEO.editorOL.selbutton.select(i3GEO.desenho.layergrafico.features[index])},unselFeature:function(index){i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[index])},carregajts:function(funcao){if(i3GEO.configura){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}else{i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}},trazParaFrente:function(){var features=i3GEO.desenho.layergrafico.selectedFeatures;if(features.length>0){i3GEO.editorOL.backup=new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});i3GEO.editorOL.backup.addFeatures(features);i3GEO.editorOL.unselTodosBackup();i3GEO.desenho.layergrafico.removeFeatures(features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}else{i3GEO.janela.tempoMsg("Selecione pelo menos um elemento")}},pegaControle:function(classe){var n=i3GEO.editorOL.controles.length,i;for(i=0;i<n;i++){if(i3GEO.editorOL.controles[i].CLASS_NAME===classe){return i3GEO.editorOL.controles[i]}}return false},ativaLayerSwitcher:function(){var ls=i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");if(ls){ls.maximizeDiv.click()}},desativaRodaDoMouse:function(){var controls=i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');for(var i=0;i<controls.length;++i){controls[i].disableZoomWheel()}},google2wgs:function(obj){if(i3GEO.Interface.openlayers.googleLike===true){var projWGS84=new OpenLayers.Projection("EPSG:4326"),proj900913=new OpenLayers.Projection("EPSG:900913");return obj.transform(proj900913,projWGS84)}else{return obj}},sobeLayersGraficos:function(){var nlayers=i3GEO.editorOL.mapa.getNumLayers(),layers=i3GEO.editorOL.mapa.layers,i;for(i=0;i<nlayers;i++){if(layers[i].CLASS_NAME=="OpenLayers.Layer.Vector"&&layers[i].name!="Nenhum"){i3GEO.editorOL.mapa.raiseLayer(i3GEO.editorOL.mapa.layers[i],nlayers)}}}};i3GEO.editorOL.backup.getFeatures=function(){return i3GEO.editorOL.backup.getSource().getFeatures()};
0 2 \ No newline at end of file
... ...
symbols/simboloslinv7.sym 0 → 100755
... ... @@ -0,0 +1,163 @@
  1 +SYMBOLSET
  2 +Symbol
  3 + Name 'ferrovia-line1'
  4 + Type ELLIPSE
  5 + Points
  6 + 1 1
  7 + END
  8 + FILLED TRUE
  9 + Transparent 0
  10 +
  11 +END
  12 +Symbol
  13 + Name 'ferrovia-line2'
  14 + Type VECTOR
  15 + Points
  16 + 0 0
  17 + 1 0
  18 + 1 0
  19 + 0 0
  20 + END
  21 + FILLED TRUE
  22 +END
  23 + Symbol
  24 + Name "pt1l"
  25 + Type VECTOR
  26 + TRANSPARENT 0
  27 + Points
  28 + 1 1
  29 + 1 1
  30 + END
  31 + END
  32 +
  33 + Symbol
  34 + name "pt2l"
  35 + TYPE ELLIPSE
  36 + POINTS 1 1 END
  37 + FILLED true
  38 + END
  39 +
  40 + Symbol
  41 + Name "pt3l"
  42 + Type ELLIPSE
  43 + POINTS 1 1 END
  44 + Transparent 0
  45 + END
  46 +
  47 + Symbol
  48 + Name "linha"
  49 + Type ELLIPSE
  50 + POINTS 1 1 END
  51 + Transparent 0
  52 + END
  53 +
  54 + Symbol
  55 + Name "linha1"
  56 + Type ELLIPSE
  57 + POINTS 1 1 END
  58 + Transparent 0
  59 + END
  60 +
  61 + Symbol
  62 + name "dashed"
  63 + Type ELLIPSE
  64 + FILLED true
  65 + POINTS
  66 + 1 1
  67 + END
  68 + END
  69 +
  70 + Symbol
  71 + name "dashed1"
  72 + Type ELLIPSE
  73 + FILLED true
  74 + POINTS
  75 + 1 1
  76 + END
  77 + END
  78 +
  79 + Symbol
  80 + name "dashed2"
  81 + Type ELLIPSE
  82 + FILLED true
  83 + POINTS
  84 + 2 0
  85 + END
  86 + END
  87 +
  88 + Symbol
  89 + Name "setal"
  90 + Type PIXMAP
  91 + Image "seta.png"
  92 + END
  93 +
  94 + Symbol
  95 + Name "sedel"
  96 + Type PIXMAP
  97 + Image "sede.png"
  98 + Transparent 1
  99 + END
  100 +
  101 +
  102 + Symbol
  103 + Name "pontol"
  104 + Type ELLIPSE
  105 + FILLED true
  106 + TRANSPARENT 0
  107 + Points
  108 + 1 1
  109 + 1 1
  110 + END
  111 + END
  112 +
  113 + Symbol
  114 + NAME 'quadradol'
  115 + TYPE VECTOR
  116 + FILLED TRUE
  117 + POINTS
  118 + 0 1
  119 + 0 0
  120 + 1 0
  121 + 1 1
  122 + 0 1
  123 + END
  124 + END
  125 +
  126 + SYMBOL
  127 + NAME "estrelal"
  128 + TYPE vector
  129 + FILLED TRUE
  130 + POINTS
  131 + 81 48
  132 + 66 0
  133 + 50 48
  134 + 0 48
  135 + 41 77
  136 + 25 125
  137 + 66 96
  138 + 106 125
  139 + 91 77
  140 + 131 48
  141 + 81 48
  142 + END
  143 + END
  144 +
  145 + SYMBOL
  146 + NAME 'triangulol'
  147 + TYPE VECTOR
  148 + FILLED TRUE
  149 + POINTS
  150 + 0 1
  151 + .5 0
  152 + 1 1
  153 + 0 1
  154 + END
  155 + END
  156 +Symbol
  157 + name "circlel"
  158 + Type ELLIPSE
  159 + Filled true
  160 + POINTS
  161 + 1 1
  162 + END
  163 +END
... ...
symbols/simbolospolv7.sym 0 → 100755
... ... @@ -0,0 +1,357 @@
  1 +SYMBOLSET
  2 + Symbol
  3 + NAME 'p0'
  4 + TYPE VECTOR
  5 + FILLED TRUE
  6 + POINTS
  7 + 0 1
  8 + 0 0
  9 + 1 0
  10 + 1 1
  11 + 0 1
  12 + END
  13 + END
  14 + Symbol
  15 + Name "p1"
  16 + Type VECTOR
  17 + TRANSPARENT 0
  18 + Points
  19 + 0 1
  20 + 1 1
  21 + END
  22 + END
  23 + Symbol
  24 + Name "p2"
  25 + Type VECTOR
  26 + TRANSPARENT 0
  27 + Points
  28 + 1 0
  29 + 1 1
  30 + END
  31 + END
  32 +
  33 + Symbol
  34 + Name "p3"
  35 + Type VECTOR
  36 + TRANSPARENT 0
  37 + Points
  38 + 1 0
  39 + 0 1
  40 + END
  41 + END
  42 +
  43 + Symbol
  44 + Name "p4"
  45 + Type VECTOR
  46 + TRANSPARENT 0
  47 + Points
  48 + 1 1
  49 + 0 0
  50 + END
  51 + END
  52 +
  53 + Symbol
  54 + Name "p5"
  55 + Type VECTOR
  56 + TRANSPARENT 0
  57 + Points
  58 + 0 0
  59 + 1 0
  60 + 0 1
  61 + END
  62 + END
  63 +
  64 + Symbol
  65 + Name "p6"
  66 + Type VECTOR
  67 + TRANSPARENT 0
  68 + Points
  69 + 0 0
  70 + 0 1
  71 + 1 0
  72 + END
  73 + END
  74 +
  75 + Symbol
  76 + Name "p7"
  77 + Type VECTOR
  78 + TRANSPARENT 0
  79 + Points
  80 + 0 1
  81 + 1 1
  82 + 1 0
  83 + END
  84 + END
  85 +
  86 + Symbol
  87 + Name "p8"
  88 + Type VECTOR
  89 + TRANSPARENT 0
  90 + Points
  91 + 0 1
  92 + 1 1
  93 + -99 -99
  94 + 0 3
  95 + 3 3
  96 + END
  97 + END
  98 +
  99 + Symbol
  100 + Name "p9"
  101 + Type VECTOR
  102 + TRANSPARENT 0
  103 + Points
  104 + 0 1
  105 + 1 1
  106 + -99 -99
  107 + 0 0
  108 + 1 1
  109 + END
  110 + END
  111 +
  112 + Symbol
  113 + Name "pt1"
  114 + Type VECTOR
  115 + TRANSPARENT 0
  116 + Points
  117 + 1 1
  118 + 1 1
  119 + END
  120 + END
  121 +
  122 + Symbol
  123 + name "pt2"
  124 + TYPE ELLIPSE
  125 + POINTS 1 1 END
  126 + FILLED true
  127 + END
  128 +
  129 + Symbol
  130 + Name "pt3"
  131 + Type ELLIPSE
  132 + POINTS 1 1 END
  133 + Transparent 0
  134 + END
  135 + Symbol
  136 + Name "cidmun"
  137 + Type PIXMAP
  138 + Image "cidmun.png"
  139 + END
  140 +
  141 + Symbol
  142 + Name "capital"
  143 + Type PIXMAP
  144 + Image "capital.png"
  145 + END
  146 + Symbol
  147 + Name "vila"
  148 + Type PIXMAP
  149 + Image "vila.png"
  150 + END
  151 +
  152 + Symbol
  153 + Name "xy"
  154 + Type PIXMAP
  155 + Image "xy.png"
  156 + END
  157 +
  158 + Symbol
  159 + Name "xyr"
  160 + Type PIXMAP
  161 + Image "xyr.png"
  162 + END
  163 +
  164 + Symbol
  165 + Name "porto"
  166 + Type PIXMAP
  167 + Image "porto.png"
  168 + END
  169 +
  170 + Symbol
  171 + Name "ref"
  172 + Type PIXMAP
  173 + Image "ref.png"
  174 + END
  175 +
  176 + Symbol
  177 + Name "foto"
  178 + Type PIXMAP
  179 + Image "foto.png"
  180 + END
  181 +
  182 + Symbol
  183 + Name "filme"
  184 + Type PIXMAP
  185 + Image "filme.png"
  186 + END
  187 +
  188 + Symbol
  189 + Name "marca"
  190 + Type PIXMAP
  191 + Image "marca.png"
  192 + END
  193 + SYMBOL
  194 + NAME "estrela"
  195 + TYPE vector
  196 + FILLED TRUE
  197 + POINTS
  198 + 81 48
  199 + 66 0
  200 + 50 48
  201 + 0 48
  202 + 41 77
  203 + 25 125
  204 + 66 96
  205 + 106 125
  206 + 91 77
  207 + 131 48
  208 + 81 48
  209 + END
  210 + END
  211 +
  212 + SYMBOL
  213 + NAME 'triangulo'
  214 + TYPE VECTOR
  215 + FILLED TRUE
  216 + POINTS
  217 + 0 1
  218 + .5 0
  219 + 1 1
  220 + 0 1
  221 + END
  222 + END
  223 +
  224 + SYMBOL
  225 + NAME 'industria'
  226 + TYPE VECTOR
  227 + FILLED TRUE
  228 + POINTS
  229 + 0 2
  230 + 0 5
  231 + 4 5
  232 + 4 0
  233 + 3 0
  234 + 3 2
  235 + 0 2
  236 + END
  237 + END
  238 +
  239 + SYMBOL
  240 + NAME 'torre'
  241 + TYPE VECTOR
  242 + FILLED FALSE
  243 + POINTS
  244 + 2 0
  245 + 3 4
  246 + 4 4
  247 + 4 5
  248 + 0 5
  249 + 0 4
  250 + 1 4
  251 + 2 0
  252 + END
  253 + END
  254 +
  255 + SYMBOL
  256 + NAME 'mineracao'
  257 + TYPE VECTOR
  258 + FILLED FALSE
  259 + POINTS
  260 + 0 0
  261 + 5 5
  262 + 4 6
  263 + 3 7
  264 + 2 6
  265 + 0 5
  266 + 5 0
  267 + END
  268 + END
  269 +
  270 + SYMBOL
  271 + NAME 'templo'
  272 + TYPE VECTOR
  273 + FILLED FALSE
  274 + POINTS
  275 + 2 0
  276 + 3 0
  277 + 3 1
  278 + 4 1
  279 + 4 2
  280 + 3 2
  281 + 3 3
  282 + 5 3
  283 + 5 5
  284 + 0 5
  285 + 0 3
  286 + 2 3
  287 + 2 2
  288 + 1 2
  289 + 1 1
  290 + 2 1
  291 + 2 0
  292 + END
  293 + END
  294 +
  295 + SYMBOL
  296 + NAME 'saude'
  297 + TYPE VECTOR
  298 + FILLED TRUE
  299 + POINTS
  300 + 2 0
  301 + 3 0
  302 + 3 1
  303 + 4 1
  304 + 4 2
  305 + 3 2
  306 + 3 3
  307 + 2 3
  308 + 2 2
  309 + 1 2
  310 + 1 1
  311 + 2 1
  312 + 2 0
  313 + END
  314 + END
  315 +
  316 + SYMBOL
  317 + NAME 'escola'
  318 + TYPE VECTOR
  319 + FILLED FALSE
  320 + POINTS
  321 + 2 0
  322 + 5 2
  323 + 3 2
  324 + 3 4
  325 + 5 4
  326 + 5 7
  327 + 0 7
  328 + 0 4
  329 + 2 4
  330 + 2 0
  331 + END
  332 + END
  333 +
  334 + SYMBOL
  335 + NAME 'cruz'
  336 + TYPE VECTOR
  337 + FILLED TRUE
  338 + POINTS
  339 + 2 0
  340 + 3 0
  341 + 3 1
  342 + 5 1
  343 + 5 2
  344 + 3 2
  345 + 3 7
  346 + 2 7
  347 + 2 2
  348 + 0 2
  349 + 0 1
  350 + 2 1
  351 + 2 0
  352 + END
  353 + END
  354 +
  355 +
  356 +
  357 +
... ...
symbols/simbolosptv7.sym 0 → 100755
... ... @@ -0,0 +1,575 @@
  1 +SYMBOLSET
  2 + SYMBOL
  3 + NAME 'cruzeta'
  4 + TYPE VECTOR
  5 + POINTS
  6 + 0.5 0
  7 + 0.5 1
  8 + -99 -99
  9 + 0 0.5
  10 + 1 0.5
  11 + END
  12 + END
  13 + SYMBOL
  14 + NAME 'google1'
  15 + TYPE VECTOR
  16 + FILLED TRUE
  17 + POINTS
  18 + 90 -363
  19 + 140 -363
  20 + 165 -347
  21 + 177 -335
  22 + 188 -323
  23 + 201 -311
  24 + 213 -287
  25 + 213 -192
  26 + 199 -169
  27 + 188 -154
  28 + 175 -144
  29 + 163 -132
  30 + 152 -106
  31 + 141 -82
  32 + 126 -46
  33 + 117 50
  34 + 97 50
  35 + 85 -46
  36 + 74 -82
  37 + 61 -106
  38 + 50 -132
  39 + 38 -144
  40 + 25 -154
  41 + 12 -169
  42 + 0 -192
  43 + 0 -287
  44 + 14 -311
  45 + 25 -323
  46 + 38 -335
  47 + 51 -347
  48 + 73 -363
  49 + 120 -363
  50 + END
  51 + END
  52 +
  53 + Symbol
  54 + Name "rosa200"
  55 + Type PIXMAP
  56 + Image "rosa200.png"
  57 + END
  58 +
  59 + Symbol
  60 + NAME 'p0'
  61 + TYPE VECTOR
  62 + FILLED TRUE
  63 + POINTS
  64 + 0 1
  65 + 0 0
  66 + 1 0
  67 + 1 1
  68 + 0 1
  69 + END
  70 + END
  71 +
  72 + Symbol
  73 + Name "p1"
  74 + Type VECTOR
  75 + TRANSPARENT 0
  76 + Points
  77 + 0 1
  78 + 1 1
  79 + END
  80 + END
  81 +
  82 + Symbol
  83 + Name "p2"
  84 + Type VECTOR
  85 + TRANSPARENT 0
  86 + Points
  87 + 1 0
  88 + 1 1
  89 + END
  90 + END
  91 +
  92 +Symbol
  93 + Name 'ferrovia-line1'
  94 + Type ELLIPSE
  95 + Points
  96 + 1 1
  97 + END
  98 + FILLED TRUE
  99 +END
  100 +
  101 +Symbol
  102 + Name 'ferrovia-line2'
  103 + Type VECTOR
  104 + Points
  105 + 0 0
  106 + 1 0
  107 + 1 0
  108 + 0 0
  109 + END
  110 + FILLED TRUE
  111 +END
  112 + Symbol
  113 + Name "p3"
  114 + Type VECTOR
  115 + TRANSPARENT 0
  116 + Points
  117 + 1 0
  118 + 0 1
  119 + END
  120 + END
  121 +
  122 + Symbol
  123 + Name "p4"
  124 + Type VECTOR
  125 + TRANSPARENT 0
  126 + Points
  127 + 1 1
  128 + 0 0
  129 + END
  130 + END
  131 +
  132 + Symbol
  133 + Name "p5"
  134 + Type VECTOR
  135 + TRANSPARENT 0
  136 + Points
  137 + 0 0
  138 + 1 0
  139 + 0 1
  140 + END
  141 + END
  142 +
  143 + Symbol
  144 + Name "p6"
  145 + Type VECTOR
  146 + TRANSPARENT 0
  147 + Points
  148 + 0 0
  149 + 0 1
  150 + 1 0
  151 + END
  152 + END
  153 +
  154 + Symbol
  155 + Name "p7"
  156 + Type VECTOR
  157 + TRANSPARENT 0
  158 + Points
  159 + 0 1
  160 + 1 1
  161 + 1 0
  162 + END
  163 + END
  164 +
  165 + Symbol
  166 + Name "p8"
  167 + Type VECTOR
  168 + TRANSPARENT 0
  169 + Points
  170 + 0 1
  171 + 1 1
  172 + -99 -99
  173 + 0 3
  174 + 3 3
  175 + END
  176 + END
  177 +
  178 + Symbol
  179 + Name "p9"
  180 + Type VECTOR
  181 + TRANSPARENT 0
  182 + Points
  183 + 0 1
  184 + 1 1
  185 + -99 -99
  186 + 0 0
  187 + 1 1
  188 + END
  189 + END
  190 +
  191 + Symbol
  192 + Name "pt1"
  193 + Type VECTOR
  194 + TRANSPARENT 0
  195 + Points
  196 + 1 1
  197 + 1 1
  198 + END
  199 + END
  200 +
  201 + Symbol
  202 + name "pt2"
  203 + TYPE ELLIPSE
  204 + POINTS 1 1 END
  205 + FILLED true
  206 + END
  207 +
  208 + Symbol
  209 + Name "pt3"
  210 + Type ELLIPSE
  211 + POINTS 1 1 END
  212 + Transparent 0
  213 + END
  214 +
  215 + Symbol
  216 + Name "linha"
  217 + Type ELLIPSE
  218 + POINTS 1 1 END
  219 + Transparent 0
  220 + END
  221 +
  222 + Symbol
  223 + Name "linha1"
  224 + Type ELLIPSE
  225 + POINTS 1 1 END
  226 + Transparent 0
  227 + END
  228 +
  229 + Symbol
  230 + name "dashed"
  231 + Type ELLIPSE
  232 + FILLED true
  233 + POINTS
  234 + 1 1
  235 + END
  236 + END
  237 +
  238 + Symbol
  239 + name "dashed1"
  240 + Type ELLIPSE
  241 + FILLED true
  242 + POINTS
  243 + 1 1
  244 + END
  245 + END
  246 +
  247 + Symbol
  248 + name "dashed2"
  249 + Type ELLIPSE
  250 + FILLED true
  251 + POINTS
  252 + 2 0
  253 + END
  254 + END
  255 +
  256 + Symbol
  257 + Name "aviao"
  258 + Type PIXMAP
  259 + Image "aviao.png"
  260 + END
  261 +
  262 + Symbol
  263 + Name "seta"
  264 + Type PIXMAP
  265 + Image "seta.png"
  266 + END
  267 +
  268 + Symbol
  269 + Name "aviao1"
  270 + Type PIXMAP
  271 + Image "aviao1.png"
  272 + END
  273 +
  274 + Symbol
  275 + Name "leste"
  276 + Type PIXMAP
  277 + Image "leste.png"
  278 + END
  279 +
  280 + Symbol
  281 + Name "oeste"
  282 + Type PIXMAP
  283 + Image "oeste.png"
  284 + END
  285 +
  286 + Symbol
  287 + Name "norte"
  288 + Type PIXMAP
  289 + Image "norte.png"
  290 + END
  291 +
  292 + Symbol
  293 + Name "sul"
  294 + Type PIXMAP
  295 + Image "sul.png"
  296 + END
  297 +
  298 + Symbol
  299 + Name "sede"
  300 + Type PIXMAP
  301 + Image "sede.png"
  302 + Transparent 1
  303 + END
  304 +
  305 + Symbol
  306 + Name "cidmun"
  307 + Type PIXMAP
  308 + Image "cidmun.png"
  309 + END
  310 +
  311 + Symbol
  312 + Name "capital"
  313 + Type PIXMAP
  314 + Image "capital.png"
  315 + END
  316 +
  317 + Symbol
  318 + Name "cidade"
  319 + Type PIXMAP
  320 + Image "cidade.png"
  321 + END
  322 +
  323 + Symbol
  324 + Name "vila"
  325 + Type PIXMAP
  326 + Image "vila.png"
  327 + END
  328 +
  329 + Symbol
  330 + Name "xy"
  331 + Type PIXMAP
  332 + Image "xy.png"
  333 + END
  334 +
  335 + Symbol
  336 + Name "xyr"
  337 + Type PIXMAP
  338 + Image "xyr.png"
  339 + END
  340 +
  341 + Symbol
  342 + Name "porto"
  343 + Type PIXMAP
  344 + Image "porto.png"
  345 + END
  346 +
  347 + Symbol
  348 + Name "ref"
  349 + Type PIXMAP
  350 + Image "ref.png"
  351 + END
  352 +
  353 + Symbol
  354 + Name "foto"
  355 + Type PIXMAP
  356 + Image "foto.png"
  357 + END
  358 +
  359 + Symbol
  360 + Name "filme"
  361 + Type PIXMAP
  362 + Image "filme.png"
  363 + END
  364 +
  365 + Symbol
  366 + Name "marca"
  367 + Type PIXMAP
  368 + Image "marca.png"
  369 + END
  370 +
  371 +
  372 + Symbol
  373 + Name "ponto"
  374 + Type ELLIPSE
  375 + FILLED true
  376 + TRANSPARENT 0
  377 + Points
  378 + 1 1
  379 + 1 1
  380 + END
  381 + END
  382 +
  383 + Symbol
  384 + NAME 'quadrado'
  385 + TYPE VECTOR
  386 + FILLED TRUE
  387 + POINTS
  388 + 0 1
  389 + 0 0
  390 + 1 0
  391 + 1 1
  392 + 0 1
  393 + END
  394 + END
  395 +
  396 + SYMBOL
  397 + NAME "estrela"
  398 + TYPE vector
  399 + FILLED TRUE
  400 + POINTS
  401 + 81 48
  402 + 66 0
  403 + 50 48
  404 + 0 48
  405 + 41 77
  406 + 25 125
  407 + 66 96
  408 + 106 125
  409 + 91 77
  410 + 131 48
  411 + 81 48
  412 + END
  413 + END
  414 +
  415 + SYMBOL
  416 + NAME 'triangulo'
  417 + TYPE VECTOR
  418 + FILLED TRUE
  419 + POINTS
  420 + 0 1
  421 + .5 0
  422 + 1 1
  423 + 0 1
  424 + END
  425 + END
  426 +
  427 + SYMBOL
  428 + NAME 'industria'
  429 + TYPE VECTOR
  430 + FILLED TRUE
  431 + POINTS
  432 + 0 2
  433 + 0 5
  434 + 4 5
  435 + 4 0
  436 + 3 0
  437 + 3 2
  438 + 0 2
  439 + END
  440 + END
  441 +
  442 + SYMBOL
  443 + NAME 'torre'
  444 + TYPE VECTOR
  445 + FILLED FALSE
  446 + POINTS
  447 + 2 0
  448 + 3 4
  449 + 4 4
  450 + 4 5
  451 + 0 5
  452 + 0 4
  453 + 1 4
  454 + 2 0
  455 + END
  456 + END
  457 +
  458 + SYMBOL
  459 + NAME 'mineracao'
  460 + TYPE VECTOR
  461 + FILLED FALSE
  462 + POINTS
  463 + 0 0
  464 + 5 5
  465 + 4 6
  466 + 3 7
  467 + 2 6
  468 + 0 5
  469 + 5 0
  470 + END
  471 + END
  472 +
  473 + SYMBOL
  474 + NAME 'templo'
  475 + TYPE VECTOR
  476 + FILLED FALSE
  477 + POINTS
  478 + 2 0
  479 + 3 0
  480 + 3 1
  481 + 4 1
  482 + 4 2
  483 + 3 2
  484 + 3 3
  485 + 5 3
  486 + 5 5
  487 + 0 5
  488 + 0 3
  489 + 2 3
  490 + 2 2
  491 + 1 2
  492 + 1 1
  493 + 2 1
  494 + 2 0
  495 + END
  496 + END
  497 +
  498 + SYMBOL
  499 + NAME 'saude'
  500 + TYPE VECTOR
  501 + FILLED TRUE
  502 + POINTS
  503 + 2 0
  504 + 3 0
  505 + 3 1
  506 + 4 1
  507 + 4 2
  508 + 3 2
  509 + 3 3
  510 + 2 3
  511 + 2 2
  512 + 1 2
  513 + 1 1
  514 + 2 1
  515 + 2 0
  516 + END
  517 + END
  518 +
  519 + SYMBOL
  520 + NAME 'escola'
  521 + TYPE VECTOR
  522 + FILLED FALSE
  523 + POINTS
  524 + 2 0
  525 + 5 2
  526 + 3 2
  527 + 3 4
  528 + 5 4
  529 + 5 7
  530 + 0 7
  531 + 0 4
  532 + 2 4
  533 + 2 0
  534 + END
  535 + END
  536 +
  537 + SYMBOL
  538 + NAME 'cruz'
  539 + TYPE VECTOR
  540 + FILLED TRUE
  541 + POINTS
  542 + 2 0
  543 + 3 0
  544 + 3 1
  545 + 5 1
  546 + 5 2
  547 + 3 2
  548 + 3 7
  549 + 2 7
  550 + 2 2
  551 + 0 2
  552 + 0 1
  553 + 2 1
  554 + 2 0
  555 + END
  556 + END
  557 +
  558 +Symbol
  559 + name "circle"
  560 + Type ELLIPSE
  561 + Filled true
  562 + POINTS
  563 + 1 1
  564 + END
  565 +END
  566 +SYMBOL
  567 +NAME "T"
  568 +TYPE TRUETYPE
  569 +FONT "arial"
  570 +CHARACTER "#"
  571 +ANTIALIAS TRUE
  572 +END
  573 +
  574 +
  575 +
... ...
symbols/simbolosv7.sym 0 → 100755
... ... @@ -0,0 +1,696 @@
  1 +SYMBOLSET
  2 + Symbol
  3 + NAME 'p0'
  4 + TYPE VECTOR
  5 + FILLED TRUE
  6 + POINTS
  7 + 0 0
  8 + END
  9 + END
  10 + SYMBOL
  11 + NAME 'cruzeta'
  12 + TYPE VECTOR
  13 + POINTS
  14 + 0.5 0
  15 + 0.5 1
  16 + -99 -99
  17 + 0 0.5
  18 + 1 0.5
  19 + END
  20 + END
  21 + SYMBOL
  22 + NAME 'google1'
  23 + TYPE VECTOR
  24 + FILLED TRUE
  25 + POINTS
  26 + 90 -363
  27 + 140 -363
  28 + 165 -347
  29 + 177 -335
  30 + 188 -323
  31 + 201 -311
  32 + 213 -287
  33 + 213 -192
  34 + 199 -169
  35 + 188 -154
  36 + 175 -144
  37 + 163 -132
  38 + 152 -106
  39 + 141 -82
  40 + 126 -46
  41 + 117 50
  42 + 97 50
  43 + 85 -46
  44 + 74 -82
  45 + 61 -106
  46 + 50 -132
  47 + 38 -144
  48 + 25 -154
  49 + 12 -169
  50 + 0 -192
  51 + 0 -287
  52 + 14 -311
  53 + 25 -323
  54 + 38 -335
  55 + 51 -347
  56 + 73 -363
  57 + 120 -363
  58 + END
  59 + END
  60 +
  61 + Symbol
  62 + NAME 'p0'
  63 + TYPE VECTOR
  64 + FILLED TRUE
  65 + POINTS
  66 + 0 1
  67 + 0 0
  68 + 1 0
  69 + 1 1
  70 + 0 1
  71 + END
  72 + END
  73 +
  74 + Symbol
  75 + Name "p1"
  76 + Type VECTOR
  77 + TRANSPARENT 0
  78 + Points
  79 + 0 1
  80 + 1 1
  81 + END
  82 + END
  83 +
  84 + Symbol
  85 + Name "p2"
  86 + Type VECTOR
  87 + TRANSPARENT 0
  88 + Points
  89 + 1 0
  90 + 1 1
  91 + END
  92 + END
  93 +
  94 + Symbol
  95 + Name "p3"
  96 + Type VECTOR
  97 + TRANSPARENT 0
  98 + Points
  99 + 1 0
  100 + 0 1
  101 + END
  102 + END
  103 +
  104 + Symbol
  105 + Name "p4"
  106 + Type VECTOR
  107 + TRANSPARENT 0
  108 + Points
  109 + 1 1
  110 + 0 0
  111 + END
  112 + END
  113 +
  114 + Symbol
  115 + Name "p5"
  116 + Type VECTOR
  117 + TRANSPARENT 0
  118 + Points
  119 + 0 0
  120 + 1 0
  121 + 0 1
  122 + END
  123 + END
  124 +
  125 + Symbol
  126 + Name "p6"
  127 + Type VECTOR
  128 + TRANSPARENT 0
  129 + Points
  130 + 0 0
  131 + 0 1
  132 + 1 0
  133 + END
  134 + END
  135 +
  136 + Symbol
  137 + Name "p7"
  138 + Type VECTOR
  139 + TRANSPARENT 0
  140 + Points
  141 + 0 1
  142 + 1 1
  143 + 1 0
  144 + END
  145 + END
  146 +
  147 + Symbol
  148 + Name "p8"
  149 + Type VECTOR
  150 + TRANSPARENT 0
  151 + Points
  152 + 0 1
  153 + 1 1
  154 + -99 -99
  155 + 0 3
  156 + 3 3
  157 + END
  158 + END
  159 +
  160 + Symbol
  161 + Name "p9"
  162 + Type VECTOR
  163 + TRANSPARENT 0
  164 + Points
  165 + 0 1
  166 + 1 1
  167 + -99 -99
  168 + 0 0
  169 + 1 1
  170 + END
  171 + END
  172 +
  173 + Symbol
  174 + Name "pt1"
  175 + Type VECTOR
  176 + TRANSPARENT 0
  177 + Points
  178 + 1 1
  179 + 1 1
  180 + END
  181 + END
  182 +
  183 + Symbol
  184 + name "pt2"
  185 + TYPE ELLIPSE
  186 + POINTS 1 1 END
  187 + FILLED true
  188 + END
  189 +
  190 + Symbol
  191 + Name "pt3"
  192 + Type ELLIPSE
  193 + POINTS 1 1 END
  194 + Transparent 0
  195 + END
  196 +
  197 +
  198 + Symbol
  199 + Name "aviao"
  200 + Type PIXMAP
  201 + Image "aviao.png"
  202 + END
  203 +
  204 + Symbol
  205 + Name "rosa200"
  206 + Type PIXMAP
  207 + Image "rosa200.png"
  208 + END
  209 +
  210 + Symbol
  211 + Name "seta"
  212 + Type PIXMAP
  213 + Image "seta.png"
  214 + END
  215 +
  216 + Symbol
  217 + Name "aviao1"
  218 + Type PIXMAP
  219 + Image "aviao1.png"
  220 + END
  221 +
  222 + Symbol
  223 + Name "leste"
  224 + Type PIXMAP
  225 + Image "leste.png"
  226 + END
  227 +
  228 + Symbol
  229 + Name "oeste"
  230 + Type PIXMAP
  231 + Image "oeste.png"
  232 + END
  233 +
  234 + Symbol
  235 + Name "norte"
  236 + Type PIXMAP
  237 + Image "norte.png"
  238 + END
  239 +
  240 + Symbol
  241 + Name "sul"
  242 + Type PIXMAP
  243 + Image "sul.png"
  244 + END
  245 +
  246 + Symbol
  247 + Name "sede"
  248 + Type PIXMAP
  249 + Image "sede.png"
  250 + Transparent 1
  251 + END
  252 +
  253 + Symbol
  254 + Name "cidmun"
  255 + Type PIXMAP
  256 + Image "cidmun.png"
  257 + END
  258 +
  259 + Symbol
  260 + Name "capital"
  261 + Type PIXMAP
  262 + Image "capital.png"
  263 + END
  264 +
  265 + Symbol
  266 + Name "cidade"
  267 + Type PIXMAP
  268 + Image "cidade.png"
  269 + END
  270 +
  271 + Symbol
  272 + Name "vila"
  273 + Type PIXMAP
  274 + Image "vila.png"
  275 + END
  276 +
  277 + Symbol
  278 + Name "xy"
  279 + Type PIXMAP
  280 + Image "xy.png"
  281 + END
  282 +
  283 + Symbol
  284 + Name "xyr"
  285 + Type PIXMAP
  286 + Image "xyr.png"
  287 + END
  288 +
  289 + Symbol
  290 + Name "porto"
  291 + Type PIXMAP
  292 + Image "porto.png"
  293 + END
  294 +
  295 + Symbol
  296 + Name "ref"
  297 + Type PIXMAP
  298 + Image "ref.png"
  299 + END
  300 +
  301 + Symbol
  302 + Name "foto"
  303 + Type PIXMAP
  304 + Image "foto.png"
  305 + END
  306 +
  307 + Symbol
  308 + Name "filme"
  309 + Type PIXMAP
  310 + Image "filme.png"
  311 + END
  312 +
  313 + Symbol
  314 + Name "marca"
  315 + Type PIXMAP
  316 + Image "marca.png"
  317 + END
  318 +
  319 +
  320 + Symbol
  321 + Name "ponto"
  322 + Type ELLIPSE
  323 + FILLED true
  324 + TRANSPARENT 0
  325 + Points
  326 + 1 1
  327 + 1 1
  328 + END
  329 + END
  330 +
  331 + Symbol
  332 + NAME 'quadrado'
  333 + TYPE VECTOR
  334 + FILLED TRUE
  335 + POINTS
  336 + 0 1
  337 + 0 0
  338 + 1 0
  339 + 1 1
  340 + 0 1
  341 + END
  342 + END
  343 +
  344 + SYMBOL
  345 + NAME "estrela"
  346 + TYPE vector
  347 + FILLED TRUE
  348 + POINTS
  349 + 81 48
  350 + 66 0
  351 + 50 48
  352 + 0 48
  353 + 41 77
  354 + 25 125
  355 + 66 96
  356 + 106 125
  357 + 91 77
  358 + 131 48
  359 + 81 48
  360 + END
  361 + END
  362 +
  363 + SYMBOL
  364 + NAME 'triangulo'
  365 + TYPE VECTOR
  366 + FILLED TRUE
  367 + POINTS
  368 + 0 1
  369 + .5 0
  370 + 1 1
  371 + 0 1
  372 + END
  373 + END
  374 +
  375 + SYMBOL
  376 + NAME 'industria'
  377 + TYPE VECTOR
  378 + FILLED TRUE
  379 + POINTS
  380 + 0 2
  381 + 0 5
  382 + 4 5
  383 + 4 0
  384 + 3 0
  385 + 3 2
  386 + 0 2
  387 + END
  388 + END
  389 +
  390 + SYMBOL
  391 + NAME 'torre'
  392 + TYPE VECTOR
  393 + FILLED FALSE
  394 + POINTS
  395 + 2 0
  396 + 3 4
  397 + 4 4
  398 + 4 5
  399 + 0 5
  400 + 0 4
  401 + 1 4
  402 + 2 0
  403 + END
  404 + END
  405 +
  406 + SYMBOL
  407 + NAME 'mineracao'
  408 + TYPE VECTOR
  409 + FILLED FALSE
  410 + POINTS
  411 + 0 0
  412 + 5 5
  413 + 4 6
  414 + 3 7
  415 + 2 6
  416 + 0 5
  417 + 5 0
  418 + END
  419 + END
  420 +
  421 + SYMBOL
  422 + NAME 'templo'
  423 + TYPE VECTOR
  424 + FILLED FALSE
  425 + POINTS
  426 + 2 0
  427 + 3 0
  428 + 3 1
  429 + 4 1
  430 + 4 2
  431 + 3 2
  432 + 3 3
  433 + 5 3
  434 + 5 5
  435 + 0 5
  436 + 0 3
  437 + 2 3
  438 + 2 2
  439 + 1 2
  440 + 1 1
  441 + 2 1
  442 + 2 0
  443 + END
  444 + END
  445 +
  446 + SYMBOL
  447 + NAME 'saude'
  448 + TYPE VECTOR
  449 + FILLED TRUE
  450 + POINTS
  451 + 2 0
  452 + 3 0
  453 + 3 1
  454 + 4 1
  455 + 4 2
  456 + 3 2
  457 + 3 3
  458 + 2 3
  459 + 2 2
  460 + 1 2
  461 + 1 1
  462 + 2 1
  463 + 2 0
  464 + END
  465 + END
  466 +
  467 + SYMBOL
  468 + NAME 'escola'
  469 + TYPE VECTOR
  470 + FILLED FALSE
  471 + POINTS
  472 + 2 0
  473 + 5 2
  474 + 3 2
  475 + 3 4
  476 + 5 4
  477 + 5 7
  478 + 0 7
  479 + 0 4
  480 + 2 4
  481 + 2 0
  482 + END
  483 + END
  484 +
  485 + SYMBOL
  486 + NAME 'cruz'
  487 + TYPE VECTOR
  488 + FILLED TRUE
  489 + POINTS
  490 + 2 0
  491 + 3 0
  492 + 3 1
  493 + 5 1
  494 + 5 2
  495 + 3 2
  496 + 3 7
  497 + 2 7
  498 + 2 2
  499 + 0 2
  500 + 0 1
  501 + 2 1
  502 + 2 0
  503 + END
  504 + END
  505 +
  506 +Symbol
  507 + name "circle"
  508 + Type ELLIPSE
  509 + Filled true
  510 + POINTS
  511 + 1 1
  512 + END
  513 +END
  514 +Symbol
  515 + Name 'ferrovia-line1'
  516 + Type ELLIPSE
  517 + Points
  518 + 1 1
  519 + END
  520 + FILLED TRUE
  521 + #PATTERN 1 13 1 13 END
  522 +END
  523 +Symbol
  524 + Name 'ferrovia-line2'
  525 + Type VECTOR
  526 + Points
  527 + 0 0
  528 + 1 0
  529 + 1 0
  530 + 0 0
  531 + END
  532 + FILLED TRUE
  533 + #PATTERN 5 13 5 13 END
  534 +END
  535 + Symbol
  536 + Name "pt1l"
  537 + Type VECTOR
  538 + TRANSPARENT 0
  539 + Points
  540 + 1 1
  541 + 1 1
  542 + END
  543 + #PATTERN 1 13 1 13 END
  544 + END
  545 +
  546 + Symbol
  547 + name "pt2l"
  548 + TYPE ELLIPSE
  549 + POINTS 1 1 END
  550 + FILLED true
  551 + #PATTERN 1 13 1 13 END
  552 + END
  553 +
  554 + Symbol
  555 + Name "pt3l"
  556 + Type ELLIPSE
  557 + POINTS 1 1 END
  558 + Transparent 0
  559 + #PATTERN 1 13 1 13 END
  560 + END
  561 +
  562 + Symbol
  563 + Name "linha"
  564 + Type ELLIPSE
  565 + POINTS 1 1 END
  566 + Transparent 0
  567 + END
  568 +
  569 + Symbol
  570 + Name "linha1"
  571 + Type ELLIPSE
  572 + POINTS 1 1 END
  573 + #PATTERN 1 4 1 END
  574 + Transparent 0
  575 + #PATTERN 10 20 10 20 END
  576 + END
  577 +
  578 + Symbol
  579 + name "dashed"
  580 + Type ELLIPSE
  581 + FILLED true
  582 + POINTS
  583 + 1 1
  584 + END
  585 + #PATTERN 8 3 END
  586 + END
  587 +
  588 + Symbol
  589 + name "dashed1"
  590 + Type ELLIPSE
  591 + FILLED true
  592 + POINTS
  593 + 1 1
  594 + END
  595 + #PATTERN 8 8 1 8 END
  596 + END
  597 +
  598 + Symbol
  599 + name "dashed2"
  600 + Type ELLIPSE
  601 + FILLED true
  602 + POINTS
  603 + 2 0
  604 + END
  605 + END
  606 +
  607 + Symbol
  608 + Name "setal"
  609 + Type PIXMAP
  610 + Image "seta.png"
  611 + #PATTERN 1 13 1 13 END
  612 + END
  613 +
  614 + Symbol
  615 + Name "sedel"
  616 + Type PIXMAP
  617 + Image "sede.png"
  618 + Transparent 1
  619 + #PATTERN 1 13 1 13 END
  620 +
  621 + END
  622 +
  623 +
  624 + Symbol
  625 + Name "pontol"
  626 + Type ELLIPSE
  627 + FILLED true
  628 + TRANSPARENT 0
  629 + Points
  630 + 1 1
  631 + 1 1
  632 + END
  633 + #PATTERN 1 13 1 13 END
  634 +
  635 + END
  636 +
  637 + Symbol
  638 + NAME 'quadradol'
  639 + TYPE VECTOR
  640 + FILLED TRUE
  641 + POINTS
  642 + 0 1
  643 + 0 0
  644 + 1 0
  645 + 1 1
  646 + 0 1
  647 + END
  648 + #PATTERN 1 13 1 13 END
  649 +
  650 + END
  651 +
  652 + SYMBOL
  653 + NAME "estrelal"
  654 + TYPE vector
  655 + FILLED TRUE
  656 + POINTS
  657 + 81 48
  658 + 66 0
  659 + 50 48
  660 + 0 48
  661 + 41 77
  662 + 25 125
  663 + 66 96
  664 + 106 125
  665 + 91 77
  666 + 131 48
  667 + 81 48
  668 + END
  669 + #PATTERN 1 13 1 13 END
  670 +
  671 + END
  672 +
  673 + SYMBOL
  674 + NAME 'triangulol'
  675 + TYPE VECTOR
  676 + FILLED TRUE
  677 + POINTS
  678 + 0 1
  679 + .5 0
  680 + 1 1
  681 + 0 1
  682 + END
  683 + #PATTERN 1 13 1 13 END
  684 +
  685 + END
  686 +
  687 +Symbol
  688 + name "circlel"
  689 + Type ELLIPSE
  690 + Filled true
  691 + POINTS
  692 + 1 1
  693 + END
  694 + #PATTERN 1 13 1 13 END
  695 +
  696 +END
... ...
testamapfile.php
... ... @@ -88,6 +88,7 @@ if ($tipo == &quot;&quot;)
88 88 echo 'i3GEO.configura.locaplic = i3GEO.util.protocolo() + "://" + window.location.host + "/i3geo";';
89 89 echo '</script>';
90 90 echo '<script src="admin/js/core.js"></script>';
  91 + echo '<script src="admin/dicionario/core.js"></script>';
91 92 echo '</head>';
92 93 echo '<body class=" yui-skin-sam" style="background: white;"><center>';
93 94 echo '<div class="bordaSuperior" >&nbsp;</div>';
... ...