Commit 8829c73e031c1c956529c9c7fc79b1dffd59357f

Authored by Edmar Moretti
1 parent 8c9986e6

--no commit message

Showing 1 changed file with 90 additions and 8 deletions   Show diff stats
mashups/openlayers.js.php
... ... @@ -684,7 +684,16 @@ i3GEO.editorOL = {
684 684 //controle que permite o snap
685 685 //
686 686 i3GEOOLsnap = new OpenLayers.Control.Snapping({layer: i3GEO.editorOL.layergrafico});
687   - //controles.push(i3GEOOLsnap);
  687 + i3GEOOLsplit = new OpenLayers.Control.Split({
  688 + layer: i3GEO.editorOL.layergrafico,
  689 + source: i3GEO.editorOL.layergrafico,
  690 + tolerance: 0.0001,
  691 + eventListeners: {
  692 + aftersplit: function(event) {
  693 + i3GEO.editorOL.flashFeatures(event.features);
  694 + }
  695 + }
  696 + });
688 697 //
689 698 //adiciona o painel ao mapa se alguma op��o foi inserida
690 699 //
... ... @@ -692,13 +701,6 @@ i3GEO.editorOL = {
692 701 i3GEOpanelEditor.addControls(controles);
693 702 i3GEO.editorOL.mapa.addControl(i3GEOpanelEditor);
694 703 }
695   - var target = i3GEOOLsnap.targets[0];
696   - target["vertex"] = true;
697   - target["node"] = true;
698   - target["edge"] = true;
699   - target["vertexTolerance"] = 15;
700   - target["edgeTolerance"] = 15;
701   - i3GEOOLsnap.activate();
702 704 },
703 705 adicionaMarcas: function(){
704 706 if(i3GEO.editorOL.pontos.length == 0)
... ... @@ -744,6 +746,86 @@ i3GEO.editorOL = {
744 746 layer.addFeatures(features);
745 747 i3GEO.editorOL.mapa.addLayer(layer);
746 748 },
  749 + //obtido de openlayers.org
747 750 propriedades: function(){
  751 + if(!document.getElementById("panelpropriedadesEditor")){
  752 + YAHOO.namespace("editorOL.container");
  753 + YAHOO.editorOL.container.panel = new YAHOO.widget.Panel("panelpropriedadesEditor", {zIndex:20000, iframe:true, width:"350px", visible:false, draggable:true, close:true } );
  754 + var ins = "" +
  755 + '<p class=paragrafo >Ajusta nó em edição para o(a):</p>' +
  756 + '<table class=lista7 >' +
  757 + ' <tr>' +
  758 + ' <td></td><td>nó</td><td></td><td>vértice</td><td></td><td>borda</td>' +
  759 + ' </tr>' +
  760 + ' <tr>' +
  761 + ' <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>' +
  762 + ' <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>' +
  763 + ' <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>' +
  764 + ' </tr>' +
  765 + '</table>' +
  766 + '<br />' +
  767 + '<p class=paragrafo >Divide intersecção ao digitalizar</p>' +
  768 + '<table class=lista7 >' +
  769 + ' <tr>' +
  770 + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.split()" type="checkbox" id="edge_split_toggle" /></td><td>borda</td>' +
  771 + ' </tr>' +
  772 + '</table>';
  773 + YAHOO.editorOL.container.panel.setBody(ins);
  774 + YAHOO.editorOL.container.panel.setHeader("Propriedades");
  775 + YAHOO.editorOL.container.panel.setFooter("");
  776 + YAHOO.editorOL.container.panel.render(document.body);
  777 + YAHOO.editorOL.container.panel.center();
  778 + YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close, "click", function(){
  779 + });
  780 + if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.criaJanelaAtivaTema()") < 0)
  781 + {i3GEO.eventos.ATUALIZAARVORECAMADAS.push("i3GEO.editorOL.criaJanelaAtivaTema()");}
  782 + }
  783 + else{
  784 + YAHOO.editorOL.container.panel.render(document.body);
  785 + }
  786 + YAHOO.editorOL.container.panel.show();
  787 + },
  788 + snap: function(){
  789 + var target = i3GEOOLsnap.targets[0],
  790 + tipos = ["node","vertex","edge"],
  791 + ntipos = tipos.length,
  792 + i,
  793 + temp,
  794 + ativa = false;
  795 + i3GEOOLsnap.deactivate();
  796 + for(i=0;i<ntipos;i++){
  797 + temp = $i("target_"+tipos[i]);
  798 + target[tipos[i]] = temp.checked;
  799 + if(temp.checked === true)
  800 + {ativa = true;}
  801 + temp = $i("target_"+tipos[i]+"Tolerance");
  802 + target[tipos[i]+"Tolerance"] = temp.value;
  803 + }
  804 + if(ativa === true)
  805 + {i3GEOOLsnap.activate();}
  806 + },
  807 + split: function(){
  808 + i3GEOOLsplit.deactivate();
  809 + var temp = $i("edge_split_toggle");
  810 + if(temp.checked === true)
  811 + {i3GEOOLsplit.activate();}
  812 + },
  813 + flashFeatures: function(features, index) {
  814 + if(!index) {
  815 + index = 0;
  816 + }
  817 + var current = features[index];
  818 + if(current && current.layer === i3GEO.editorOL.layergrafico) {
  819 + i3GEO.editorOL.layergrafico.drawFeature(features[index], "select");
  820 + }
  821 + var prev = features[index-1];
  822 + if(prev && prev.layer === i3GEO.editorOL.layergrafico) {
  823 + i3GEO.editorOL.layergrafico.drawFeature(prev, "default");
  824 + }
  825 + ++index;
  826 + if(index <= features.length) {
  827 + window.setTimeout(function() {i3GEO.editorOL.flashFeatures(features, index)}, 75);
  828 + }
748 829 }
  830 +
749 831 };
... ...