Commit f0a7e60937ac594073bd58e89ba9054244597c90

Authored by Edmar Moretti
1 parent 7c091e8e

Incluida opção para dar nome a uma geometria capturada na função de análise de geometrias

classesjs/funcoes.js
... ... @@ -3487,105 +3487,106 @@ function limpacontainerf()
3487 3487 {$i("mostradistancia").style.display="none";}
3488 3488 }
3489 3489  
  3490 +//controle dois painéis que podem ser redimensionados
  3491 +YAHOO.widget.ResizePanel = function(el, userConfig)
  3492 +{
  3493 + if (arguments.length > 0)
  3494 + {YAHOO.widget.ResizePanel.superclass.constructor.call(this, el, userConfig);}
  3495 +};
  3496 +YAHOO.widget.ResizePanel.CSS_PANEL_RESIZE = "yui-resizepanel";
  3497 +YAHOO.widget.ResizePanel.CSS_RESIZE_HANDLE = "resizehandle";
  3498 +YAHOO.extend
  3499 +(
  3500 + YAHOO.widget.ResizePanel, YAHOO.widget.Panel,
  3501 + {
  3502 + init: function(el, userConfig)
  3503 + {
  3504 + YAHOO.widget.ResizePanel.superclass.init.call(this, el);
  3505 + this.beforeInitEvent.fire(YAHOO.widget.ResizePanel);
  3506 + var Dom = YAHOO.util.Dom,
  3507 + Event = YAHOO.util.Event,
  3508 + oInnerElement = this.innerElement,
  3509 + oResizeHandle = document.createElement("DIV"),
  3510 + sResizeHandleId = this.id + "_resizehandle";
  3511 + oResizeHandle.id = sResizeHandleId;
  3512 + oResizeHandle.className = YAHOO.widget.ResizePanel.CSS_RESIZE_HANDLE;
  3513 + Dom.addClass(oInnerElement, YAHOO.widget.ResizePanel.CSS_PANEL_RESIZE);
  3514 + this.resizeHandle = oResizeHandle;
  3515 + function initResizeFunctionality()
  3516 + {
  3517 + var me = this,
  3518 + oHeader = this.header,
  3519 + oBody = this.body,
  3520 + oFooter = this.footer,
  3521 + nStartWidth,
  3522 + nStartHeight,
  3523 + aStartPos,
  3524 + nBodyBorderTopWidth,
  3525 + nBodyBorderBottomWidth,
  3526 + nBodyTopPadding,
  3527 + nBodyBottomPadding,
  3528 + nBodyOffset;
  3529 + oInnerElement.appendChild(oResizeHandle);
  3530 + this.ddResize = new YAHOO.util.DragDrop(sResizeHandleId, this.id);
  3531 + this.ddResize.setHandleElId(sResizeHandleId);
  3532 + this.ddResize.onMouseDown = function(e)
  3533 + {
  3534 + nStartWidth = oInnerElement.offsetWidth;
  3535 + nStartHeight = oInnerElement.offsetHeight;
  3536 + if (YAHOO.env.ua.ie && document.compatMode == "BackCompat")
  3537 + {nBodyOffset = 0;}
  3538 + else
  3539 + {
  3540 + nBodyBorderTopWidth = parseInt(Dom.getStyle(oBody, "borderTopWidth"), 10),
  3541 + nBodyBorderBottomWidth = parseInt(Dom.getStyle(oBody, "borderBottomWidth"), 10),
  3542 + nBodyTopPadding = parseInt(Dom.getStyle(oBody, "paddingTop"), 10),
  3543 + nBodyBottomPadding = parseInt(Dom.getStyle(oBody, "paddingBottom"), 10),
  3544 + nBodyOffset = nBodyBorderTopWidth + nBodyBorderBottomWidth + nBodyTopPadding + nBodyBottomPadding;
  3545 + }
  3546 + me.cfg.setProperty("width", nStartWidth + "px");
  3547 + aStartPos = [Event.getPageX(e), Event.getPageY(e)];
  3548 + };
  3549 + this.ddResize.onDrag = function(e)
  3550 + {
  3551 + var aNewPos = [Event.getPageX(e), Event.getPageY(e)],
  3552 + nOffsetX = aNewPos[0] - aStartPos[0],
  3553 + nOffsetY = aNewPos[1] - aStartPos[1],
  3554 + nNewWidth = Math.max(nStartWidth + nOffsetX, 10),
  3555 + nNewHeight = Math.max(nStartHeight + nOffsetY, 10),
  3556 + nBodyHeight = (nNewHeight - (oFooter.offsetHeight + oHeader.offsetHeight + nBodyOffset));
  3557 + me.cfg.setProperty("width", nNewWidth + "px");
  3558 + if (nBodyHeight < 0)
  3559 + {nBodyHeight = 0;}
  3560 + oBody.style.height = nBodyHeight + "px";
  3561 + if ($i("wdocai"))
  3562 + {$i("wdocai").style.height = nBodyHeight;}
  3563 + };
  3564 + };
  3565 + function onBeforeShow()
  3566 + {
  3567 + initResizeFunctionality.call(this);
  3568 + this.unsubscribe("beforeShow", onBeforeShow);
  3569 + };
  3570 + function onBeforeRender()
  3571 + {
  3572 + if (!this.footer)
  3573 + {this.setFooter("");}
  3574 + if (this.cfg.getProperty("visible"))
  3575 + {initResizeFunctionality.call(this);}
  3576 + else
  3577 + {this.subscribe("beforeShow", onBeforeShow);}
  3578 + this.unsubscribe("beforeRender", onBeforeRender);
  3579 + };
  3580 + this.subscribe("beforeRender", onBeforeRender);
  3581 + if (userConfig)
  3582 + {this.cfg.applyConfig(userConfig, true);}
  3583 + this.initEvent.fire(YAHOO.widget.ResizePanel);
  3584 + },
  3585 + toString: function()
  3586 + {return "ResizePanel " + this.id;}
  3587 + }
  3588 +);
3490 3589  
3491   - YAHOO.widget.ResizePanel = function(el, userConfig)
3492   - {
3493   - if (arguments.length > 0)
3494   - {YAHOO.widget.ResizePanel.superclass.constructor.call(this, el, userConfig);}
3495   - };
3496   - YAHOO.widget.ResizePanel.CSS_PANEL_RESIZE = "yui-resizepanel";
3497   - YAHOO.widget.ResizePanel.CSS_RESIZE_HANDLE = "resizehandle";
3498   - YAHOO.extend
3499   - (
3500   - YAHOO.widget.ResizePanel, YAHOO.widget.Panel,
3501   - {
3502   - init: function(el, userConfig)
3503   - {
3504   - YAHOO.widget.ResizePanel.superclass.init.call(this, el);
3505   - this.beforeInitEvent.fire(YAHOO.widget.ResizePanel);
3506   - var Dom = YAHOO.util.Dom,
3507   - Event = YAHOO.util.Event,
3508   - oInnerElement = this.innerElement,
3509   - oResizeHandle = document.createElement("DIV"),
3510   - sResizeHandleId = this.id + "_resizehandle";
3511   - oResizeHandle.id = sResizeHandleId;
3512   - oResizeHandle.className = YAHOO.widget.ResizePanel.CSS_RESIZE_HANDLE;
3513   - Dom.addClass(oInnerElement, YAHOO.widget.ResizePanel.CSS_PANEL_RESIZE);
3514   - this.resizeHandle = oResizeHandle;
3515   - function initResizeFunctionality()
3516   - {
3517   - var me = this,
3518   - oHeader = this.header,
3519   - oBody = this.body,
3520   - oFooter = this.footer,
3521   - nStartWidth,
3522   - nStartHeight,
3523   - aStartPos,
3524   - nBodyBorderTopWidth,
3525   - nBodyBorderBottomWidth,
3526   - nBodyTopPadding,
3527   - nBodyBottomPadding,
3528   - nBodyOffset;
3529   - oInnerElement.appendChild(oResizeHandle);
3530   - this.ddResize = new YAHOO.util.DragDrop(sResizeHandleId, this.id);
3531   - this.ddResize.setHandleElId(sResizeHandleId);
3532   - this.ddResize.onMouseDown = function(e)
3533   - {
3534   - nStartWidth = oInnerElement.offsetWidth;
3535   - nStartHeight = oInnerElement.offsetHeight;
3536   - if (YAHOO.env.ua.ie && document.compatMode == "BackCompat")
3537   - {nBodyOffset = 0;}
3538   - else
3539   - {
3540   - nBodyBorderTopWidth = parseInt(Dom.getStyle(oBody, "borderTopWidth"), 10),
3541   - nBodyBorderBottomWidth = parseInt(Dom.getStyle(oBody, "borderBottomWidth"), 10),
3542   - nBodyTopPadding = parseInt(Dom.getStyle(oBody, "paddingTop"), 10),
3543   - nBodyBottomPadding = parseInt(Dom.getStyle(oBody, "paddingBottom"), 10),
3544   - nBodyOffset = nBodyBorderTopWidth + nBodyBorderBottomWidth + nBodyTopPadding + nBodyBottomPadding;
3545   - }
3546   - me.cfg.setProperty("width", nStartWidth + "px");
3547   - aStartPos = [Event.getPageX(e), Event.getPageY(e)];
3548   - };
3549   - this.ddResize.onDrag = function(e)
3550   - {
3551   - var aNewPos = [Event.getPageX(e), Event.getPageY(e)],
3552   - nOffsetX = aNewPos[0] - aStartPos[0],
3553   - nOffsetY = aNewPos[1] - aStartPos[1],
3554   - nNewWidth = Math.max(nStartWidth + nOffsetX, 10),
3555   - nNewHeight = Math.max(nStartHeight + nOffsetY, 10),
3556   - nBodyHeight = (nNewHeight - (oFooter.offsetHeight + oHeader.offsetHeight + nBodyOffset));
3557   - me.cfg.setProperty("width", nNewWidth + "px");
3558   - if (nBodyHeight < 0)
3559   - {nBodyHeight = 0;}
3560   - oBody.style.height = nBodyHeight + "px";
3561   - if ($i("wdocai"))
3562   - {$i("wdocai").style.height = nBodyHeight;}
3563   - };
3564   - };
3565   - function onBeforeShow()
3566   - {
3567   - initResizeFunctionality.call(this);
3568   - this.unsubscribe("beforeShow", onBeforeShow);
3569   - };
3570   - function onBeforeRender()
3571   - {
3572   - if (!this.footer)
3573   - {this.setFooter("");}
3574   - if (this.cfg.getProperty("visible"))
3575   - {initResizeFunctionality.call(this);}
3576   - else
3577   - {this.subscribe("beforeShow", onBeforeShow);}
3578   - this.unsubscribe("beforeRender", onBeforeRender);
3579   - };
3580   - this.subscribe("beforeRender", onBeforeRender);
3581   - if (userConfig)
3582   - {this.cfg.applyConfig(userConfig, true);}
3583   - this.initEvent.fire(YAHOO.widget.ResizePanel);
3584   - },
3585   - toString: function()
3586   - {return "ResizePanel " + this.id;}
3587   - }
3588   - );
3589 3590 //testa se esse script foi carregado
3590 3591 function testafuncoes()
3591 3592 {}
... ...
classesphp/classe_temas.php
... ... @@ -605,8 +605,10 @@ parameters:
605 605 $dir_tmp - diretório temporário do I3Geo
606 606  
607 607 $imgdir - diretório temporário das imagens do mapa atual
  608 +
  609 +$nome - nome que será dado a geometria
608 610 */
609   - function capturaGeometrias($dir_tmp,$imgdir)
  611 + function capturaGeometrias($dir_tmp,$imgdir,$nome="")
610 612 {
611 613 if (file_exists($this->arquivo."qy"))
612 614 {$this->mapa->loadquery(($this->arquivo)."qy");}
... ... @@ -637,7 +639,11 @@ $imgdir - diretório temporário das imagens do mapa atual
637 639 {
638 640 $final["dados"] = $registros;
639 641 //salva arquivo
640   - $arq = $dir_tmp."/".$imgdir."/geometria".nomerandomico(15).".geo";
  642 + if ($nome == "")
  643 + {$nome = nomerandomico(15);}
  644 + else
  645 + {$nome = str_replace(" ","_",$nome);}
  646 + $arq = $dir_tmp."/".$imgdir."/".$nome.".geo";
641 647 if (file_exists($arq))
642 648 {unlink($arq);}
643 649 $fp = fopen($arq,"w");
... ...
classesphp/mapa_controle.php
... ... @@ -266,7 +266,7 @@ Include:
266 266 case "capturageometrias":
267 267 include("classe_temas.php");
268 268 $m = new Temas($map_file,$tema);
269   - $resultado = $m->capturaGeometrias($dir_tmp,$imgdir);
  269 + $resultado = $m->capturaGeometrias($dir_tmp,$imgdir,$nome);
270 270 $cp->set_data($resultado);
271 271 break;
272 272 /*
... ...
ferramentas/analisageometrias/index.js
... ... @@ -85,8 +85,9 @@ function operacao(tipo)
85 85 //captura as geometrias selecionadas e grava em arquivos
86 86 function capturageo()
87 87 {
  88 + var nome=window.prompt("Nome que sera dado a geometria:")
88 89 aguarde("block")
89   - var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=capturageometrias&tema="+$i("comboTemas").value
  90 + var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=capturageometrias&tema="+$i("comboTemas").value+"&nome="+nome
90 91 var cp = new cpaint();
91 92 //cp.set_debug(2)
92 93 cp.set_response_type("JSON");
... ... @@ -113,7 +114,7 @@ function montalistageometrias(retorno)
113 114 {
114 115 ins += "<table width=700 ><tr style=background-color:"+cor+" >"
115 116 ins += "<td width=5 ><input type=checkbox id="+retorno.data[i].arquivo+" style=cursor:pointer \></td>"
116   - ins += "<td width=55 >"+retorno.data[i].layer+"</td>"
  117 + ins += "<td width=55 >"+retorno.data[i].layer+" "+retorno.data[i].arquivo+"</td>"
117 118 ins += "<td><table>"
118 119 var temp = retorno.data[i].dados
119 120 for (j=0;j<temp.length; j++)
... ...