From f0a7e60937ac594073bd58e89ba9054244597c90 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Thu, 25 Oct 2007 11:19:13 +0000 Subject: [PATCH] Incluida opção para dar nome a uma geometria capturada na função de análise de geometrias --- classesjs/funcoes.js | 197 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------- classesphp/classe_temas.php | 10 ++++++++-- classesphp/mapa_controle.php | 2 +- ferramentas/analisageometrias/index.js | 5 +++-- 4 files changed, 111 insertions(+), 103 deletions(-) diff --git a/classesjs/funcoes.js b/classesjs/funcoes.js index a534c5b..0fcf740 100644 --- a/classesjs/funcoes.js +++ b/classesjs/funcoes.js @@ -3487,105 +3487,106 @@ function limpacontainerf() {$i("mostradistancia").style.display="none";} } +//controle dois painéis que podem ser redimensionados +YAHOO.widget.ResizePanel = function(el, userConfig) +{ + if (arguments.length > 0) + {YAHOO.widget.ResizePanel.superclass.constructor.call(this, el, userConfig);} +}; +YAHOO.widget.ResizePanel.CSS_PANEL_RESIZE = "yui-resizepanel"; +YAHOO.widget.ResizePanel.CSS_RESIZE_HANDLE = "resizehandle"; +YAHOO.extend +( + YAHOO.widget.ResizePanel, YAHOO.widget.Panel, + { + init: function(el, userConfig) + { + YAHOO.widget.ResizePanel.superclass.init.call(this, el); + this.beforeInitEvent.fire(YAHOO.widget.ResizePanel); + var Dom = YAHOO.util.Dom, + Event = YAHOO.util.Event, + oInnerElement = this.innerElement, + oResizeHandle = document.createElement("DIV"), + sResizeHandleId = this.id + "_resizehandle"; + oResizeHandle.id = sResizeHandleId; + oResizeHandle.className = YAHOO.widget.ResizePanel.CSS_RESIZE_HANDLE; + Dom.addClass(oInnerElement, YAHOO.widget.ResizePanel.CSS_PANEL_RESIZE); + this.resizeHandle = oResizeHandle; + function initResizeFunctionality() + { + var me = this, + oHeader = this.header, + oBody = this.body, + oFooter = this.footer, + nStartWidth, + nStartHeight, + aStartPos, + nBodyBorderTopWidth, + nBodyBorderBottomWidth, + nBodyTopPadding, + nBodyBottomPadding, + nBodyOffset; + oInnerElement.appendChild(oResizeHandle); + this.ddResize = new YAHOO.util.DragDrop(sResizeHandleId, this.id); + this.ddResize.setHandleElId(sResizeHandleId); + this.ddResize.onMouseDown = function(e) + { + nStartWidth = oInnerElement.offsetWidth; + nStartHeight = oInnerElement.offsetHeight; + if (YAHOO.env.ua.ie && document.compatMode == "BackCompat") + {nBodyOffset = 0;} + else + { + nBodyBorderTopWidth = parseInt(Dom.getStyle(oBody, "borderTopWidth"), 10), + nBodyBorderBottomWidth = parseInt(Dom.getStyle(oBody, "borderBottomWidth"), 10), + nBodyTopPadding = parseInt(Dom.getStyle(oBody, "paddingTop"), 10), + nBodyBottomPadding = parseInt(Dom.getStyle(oBody, "paddingBottom"), 10), + nBodyOffset = nBodyBorderTopWidth + nBodyBorderBottomWidth + nBodyTopPadding + nBodyBottomPadding; + } + me.cfg.setProperty("width", nStartWidth + "px"); + aStartPos = [Event.getPageX(e), Event.getPageY(e)]; + }; + this.ddResize.onDrag = function(e) + { + var aNewPos = [Event.getPageX(e), Event.getPageY(e)], + nOffsetX = aNewPos[0] - aStartPos[0], + nOffsetY = aNewPos[1] - aStartPos[1], + nNewWidth = Math.max(nStartWidth + nOffsetX, 10), + nNewHeight = Math.max(nStartHeight + nOffsetY, 10), + nBodyHeight = (nNewHeight - (oFooter.offsetHeight + oHeader.offsetHeight + nBodyOffset)); + me.cfg.setProperty("width", nNewWidth + "px"); + if (nBodyHeight < 0) + {nBodyHeight = 0;} + oBody.style.height = nBodyHeight + "px"; + if ($i("wdocai")) + {$i("wdocai").style.height = nBodyHeight;} + }; + }; + function onBeforeShow() + { + initResizeFunctionality.call(this); + this.unsubscribe("beforeShow", onBeforeShow); + }; + function onBeforeRender() + { + if (!this.footer) + {this.setFooter("");} + if (this.cfg.getProperty("visible")) + {initResizeFunctionality.call(this);} + else + {this.subscribe("beforeShow", onBeforeShow);} + this.unsubscribe("beforeRender", onBeforeRender); + }; + this.subscribe("beforeRender", onBeforeRender); + if (userConfig) + {this.cfg.applyConfig(userConfig, true);} + this.initEvent.fire(YAHOO.widget.ResizePanel); + }, + toString: function() + {return "ResizePanel " + this.id;} + } +); - YAHOO.widget.ResizePanel = function(el, userConfig) - { - if (arguments.length > 0) - {YAHOO.widget.ResizePanel.superclass.constructor.call(this, el, userConfig);} - }; - YAHOO.widget.ResizePanel.CSS_PANEL_RESIZE = "yui-resizepanel"; - YAHOO.widget.ResizePanel.CSS_RESIZE_HANDLE = "resizehandle"; - YAHOO.extend - ( - YAHOO.widget.ResizePanel, YAHOO.widget.Panel, - { - init: function(el, userConfig) - { - YAHOO.widget.ResizePanel.superclass.init.call(this, el); - this.beforeInitEvent.fire(YAHOO.widget.ResizePanel); - var Dom = YAHOO.util.Dom, - Event = YAHOO.util.Event, - oInnerElement = this.innerElement, - oResizeHandle = document.createElement("DIV"), - sResizeHandleId = this.id + "_resizehandle"; - oResizeHandle.id = sResizeHandleId; - oResizeHandle.className = YAHOO.widget.ResizePanel.CSS_RESIZE_HANDLE; - Dom.addClass(oInnerElement, YAHOO.widget.ResizePanel.CSS_PANEL_RESIZE); - this.resizeHandle = oResizeHandle; - function initResizeFunctionality() - { - var me = this, - oHeader = this.header, - oBody = this.body, - oFooter = this.footer, - nStartWidth, - nStartHeight, - aStartPos, - nBodyBorderTopWidth, - nBodyBorderBottomWidth, - nBodyTopPadding, - nBodyBottomPadding, - nBodyOffset; - oInnerElement.appendChild(oResizeHandle); - this.ddResize = new YAHOO.util.DragDrop(sResizeHandleId, this.id); - this.ddResize.setHandleElId(sResizeHandleId); - this.ddResize.onMouseDown = function(e) - { - nStartWidth = oInnerElement.offsetWidth; - nStartHeight = oInnerElement.offsetHeight; - if (YAHOO.env.ua.ie && document.compatMode == "BackCompat") - {nBodyOffset = 0;} - else - { - nBodyBorderTopWidth = parseInt(Dom.getStyle(oBody, "borderTopWidth"), 10), - nBodyBorderBottomWidth = parseInt(Dom.getStyle(oBody, "borderBottomWidth"), 10), - nBodyTopPadding = parseInt(Dom.getStyle(oBody, "paddingTop"), 10), - nBodyBottomPadding = parseInt(Dom.getStyle(oBody, "paddingBottom"), 10), - nBodyOffset = nBodyBorderTopWidth + nBodyBorderBottomWidth + nBodyTopPadding + nBodyBottomPadding; - } - me.cfg.setProperty("width", nStartWidth + "px"); - aStartPos = [Event.getPageX(e), Event.getPageY(e)]; - }; - this.ddResize.onDrag = function(e) - { - var aNewPos = [Event.getPageX(e), Event.getPageY(e)], - nOffsetX = aNewPos[0] - aStartPos[0], - nOffsetY = aNewPos[1] - aStartPos[1], - nNewWidth = Math.max(nStartWidth + nOffsetX, 10), - nNewHeight = Math.max(nStartHeight + nOffsetY, 10), - nBodyHeight = (nNewHeight - (oFooter.offsetHeight + oHeader.offsetHeight + nBodyOffset)); - me.cfg.setProperty("width", nNewWidth + "px"); - if (nBodyHeight < 0) - {nBodyHeight = 0;} - oBody.style.height = nBodyHeight + "px"; - if ($i("wdocai")) - {$i("wdocai").style.height = nBodyHeight;} - }; - }; - function onBeforeShow() - { - initResizeFunctionality.call(this); - this.unsubscribe("beforeShow", onBeforeShow); - }; - function onBeforeRender() - { - if (!this.footer) - {this.setFooter("");} - if (this.cfg.getProperty("visible")) - {initResizeFunctionality.call(this);} - else - {this.subscribe("beforeShow", onBeforeShow);} - this.unsubscribe("beforeRender", onBeforeRender); - }; - this.subscribe("beforeRender", onBeforeRender); - if (userConfig) - {this.cfg.applyConfig(userConfig, true);} - this.initEvent.fire(YAHOO.widget.ResizePanel); - }, - toString: function() - {return "ResizePanel " + this.id;} - } - ); //testa se esse script foi carregado function testafuncoes() {} diff --git a/classesphp/classe_temas.php b/classesphp/classe_temas.php index a2e7071..b2a08b9 100644 --- a/classesphp/classe_temas.php +++ b/classesphp/classe_temas.php @@ -605,8 +605,10 @@ parameters: $dir_tmp - diretório temporário do I3Geo $imgdir - diretório temporário das imagens do mapa atual + +$nome - nome que será dado a geometria */ - function capturaGeometrias($dir_tmp,$imgdir) + function capturaGeometrias($dir_tmp,$imgdir,$nome="") { if (file_exists($this->arquivo."qy")) {$this->mapa->loadquery(($this->arquivo)."qy");} @@ -637,7 +639,11 @@ $imgdir - diretório temporário das imagens do mapa atual { $final["dados"] = $registros; //salva arquivo - $arq = $dir_tmp."/".$imgdir."/geometria".nomerandomico(15).".geo"; + if ($nome == "") + {$nome = nomerandomico(15);} + else + {$nome = str_replace(" ","_",$nome);} + $arq = $dir_tmp."/".$imgdir."/".$nome.".geo"; if (file_exists($arq)) {unlink($arq);} $fp = fopen($arq,"w"); diff --git a/classesphp/mapa_controle.php b/classesphp/mapa_controle.php index 14aea84..2ed7d0d 100644 --- a/classesphp/mapa_controle.php +++ b/classesphp/mapa_controle.php @@ -266,7 +266,7 @@ Include: case "capturageometrias": include("classe_temas.php"); $m = new Temas($map_file,$tema); - $resultado = $m->capturaGeometrias($dir_tmp,$imgdir); + $resultado = $m->capturaGeometrias($dir_tmp,$imgdir,$nome); $cp->set_data($resultado); break; /* diff --git a/ferramentas/analisageometrias/index.js b/ferramentas/analisageometrias/index.js index 0e1ef52..ba58138 100644 --- a/ferramentas/analisageometrias/index.js +++ b/ferramentas/analisageometrias/index.js @@ -85,8 +85,9 @@ function operacao(tipo) //captura as geometrias selecionadas e grava em arquivos function capturageo() { + var nome=window.prompt("Nome que sera dado a geometria:") aguarde("block") - var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=capturageometrias&tema="+$i("comboTemas").value + var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=capturageometrias&tema="+$i("comboTemas").value+"&nome="+nome var cp = new cpaint(); //cp.set_debug(2) cp.set_response_type("JSON"); @@ -113,7 +114,7 @@ function montalistageometrias(retorno) { ins += "" ins += "" - ins += "" + ins += "" ins += "
"+retorno.data[i].layer+""+retorno.data[i].layer+" "+retorno.data[i].arquivo+"" var temp = retorno.data[i].dados for (j=0;j