//Toolbar otros (Mediciones) var tmr; var blnMenuActivo = false; function DestacaMediciones(objMnuMediciones) { objMnuMediciones.className = "MenuMedicionesDestacado"; } function NormalizaMediciones(objMnuMediciones) { objMnuMediciones.className = "MenuMediciones"; } function RatonFueraDeMenu() { blnMenuActivo = false; tmr = setTimeout("DesactivaMenu()",500); } function RatonSobreMenu() { blnMenuActivo = true; } function DesactivaMenu () { if (!blnMenuActivo) { var objMnu = top.document.getElementById("MenuMedicionesFrame"); objMnu.style.display = "none"; } tmr = null; } function VerDistancia (){ var Fr = top.document.getElementById("MenuMedicionesFrame"); Fr.style.visibility = "hidden"; Fr.style.display="none"; top.document.TareaMedir = "Distancia"; top.document.mapa.viewDistanceEx ("M", "", "true"); } function VerSuperficie () { var Fr = top.document.getElementById("MenuMedicionesFrame"); Fr.style.visibility = "hidden"; Fr.style.display="none"; top.document.TareaMedir = "Superficie"; top.document.mapa.viewDistanceEx ("M", "", "true"); } function VerSuperficieSeleccionada () { var Fr = top.document.getElementById("MenuMedicionesFrame"); Fr.style.visibility = "hidden"; Fr.style.display="none"; var Mapa= top.document.getElementById("mapa"); var Seleccion = Mapa.getSelection(); var Coleccion = Seleccion.getMapObjects(null); var strMsg = ""; var strMsgDis = ""; var MensajeTotal = ""; if (Coleccion.count >0){ if (Coleccion.count == 1){ if (Coleccion(0).getArea()>0){ strMsg = Coleccion(0).Name + " -> " + Math.round(Coleccion(0).getArea()*100)/100 + "m2"; AreaTotal = Math.round(Coleccion(0).getArea(),2); alert(strMsg); }else{ if (Coleccion(0).getLength() > 1000){ strMsg = Coleccion(0).Name + " -> " + Math.round(Coleccion(0).getLength()*100/100) + "km"; }else{ strMsg = Coleccion(0).Name + " -> " + Math.round(Coleccion(0).getLength()*100/100) + "m"; } alert(strMsg); } }else{ var n=0; var AreaTotal=0; var DistanciaTotal=0; for(n=0;n0){ strMsg += (n+1) + ".- " + Coleccion(n).Name + " -> " + Math.round(100*Coleccion(n).getArea())/100 + "m2\n"; AreaTotal += Coleccion(n).getArea(); }else{ if (Coleccion(n).getLength() > 1000){ strMsgDis += (n+1) + ".- " + Coleccion(n).Name + " -> " + Math.round(100*Coleccion(n).getLength())/100 + "km\n"; }else{ strMsgDis += (n+1) + ".- " + Coleccion(n).Name + " -> " + Math.round(100*Coleccion(n).getLength())/100 + "m\n"; } DistanciaTotal += Coleccion(n).getLength(); } } if (AreaTotal >0 ){ MensajeTotal += strMsg + "\n" + ''+ ": " + Math.round(100*AreaTotal)/100 + "m2\n\n"; } if (DistanciaTotal >0){ if (DistanciaTotal > 1000){ MensajeTotal += strMsgDis + "\n" + '' + ": " + Math.round(100*DistanciaTotal)/100 + "km"; }else{ MensajeTotal += strMsgDis + "\n" + '' + ": " + Math.round(100*DistanciaTotal)/100 + "m"; } } alert(MensajeTotal); } }else{ alert(''); } if (Coleccion.count > 0){ var n=0; var blnActualizar = false; var Key = 0; var j=0; var Capa = Mapa.getMapLayer("Medicion"); if (!Capa){ Capa = Mapa.createLayer ("redline", "Medicion"); } for(n=0;n 0){ var RLSetup; var ColCapa = Capa.getMapObjects(); if (ColCapa.count == 0) { Key = 1; }else{ Key=ColCapa.count +1; } var Obj= Capa.createMapObject("SuperficieSel_" + Key, "", ""); Mapa.setAutoRefresh (false); if(Objeto.getArea()>0){ RLSetup = Mapa.getRedlineSetup(); RLSetup.FillAttr.BackMode = "Opaque"; RLSetup.FillAttr.Style = "Diagonal45"; RLSetup.FillAttr.Color = 5; RLSetup.FillAttr.BackColor = 1; RLSetup.LineAttr.Style = "Solid"; RLSetup.LineAttr.Thickness = 2; RLSetup.LineAttr.color = 5; RLSetup.EdgeAttr.Visible = true; Obj.addPolygonPrimitive (ColV, ColNV, true); Obj.addPolylinePrimitive (ColV, ColNV, true); var Perimetro; if (Obj.Primitives(1).getLength() > 1000){ Perimetro = "km"; }else{ Perimetro = "m"; } Obj.Name = "Medición\n" + '' + ": " + Math.round(Obj.Primitives(0).getArea()*100)/100 + " m2\n" + '' + ": " + Math.round(Obj.Primitives(1).getLength()*100)/100 + " " + Perimetro; blnActualizar=true; }else{ RLSetup = Mapa.getRedlineSetup(); RLSetup.FillAttr.BackMode = "Transparent"; RLSetup.FillAttr.Style = "None"; RLSetup.FillAttr.BackColor = 0; RLSetup.LineAttr.Style = "Solid"; RLSetup.LineAttr.Thickness = 2; RLSetup.LineAttr.color = 5; Obj.addPolylinePrimitive (ColV, ColNV, true); if (Obj.getLength()>1000){ Obj.Name = "Medición\n" + '' + ": " + Math.round(Obj.getLength()*100)/100 + " km"; }else{ Obj.Name = "Medición\n" + '' + ": " + Math.round(Obj.getLength()*100)/100 + " m"; } blnActualizar = true; } } } } if(blnActualizar){ Mapa.setAutoRefresh (true); Mapa.Refresh(); } } } function ObtenerSuperficie (map, points, UseMCS) { var NVertices = map.CreateObject('MGCollection'); var Capa; var RLSetup; var Col; var Key; Capa = map.getMapLayer("Medicion"); if (!Capa) Capa = map.createLayer ("redline", "Medicion"); Col = Capa.getMapObjectsEx(); if (Col.count > 0){ Key = Col.count + 1; }else{ Key = 1; } var Objeto = Capa.createMapObject("Superficie_" + Key, "", ""); points.Add (points(0)); NVertices.Add (points.Count); RLSetup = map.getRedlineSetup(); RLSetup.FillAttr.BackMode = "Transparent"; RLSetup.FillAttr.Style = "Diagonal45"; RLSetup.FillAttr.color = 5; Objeto.addPolygonPrimitive (points, NVertices, UseMCS); RLSetup = map.getRedlineSetup(); RLSetup.FillAttr.BackMode = "Transparent"; RLSetup.FillAttr.Style = "None"; RLSetup.FillAttr.BackColor = 0; RLSetup.LineAttr.Style = "Solid"; RLSetup.LineAttr.Thickness = 2; RLSetup.LineAttr.color = 5; Objeto.addPolylinePrimitive (points, NVertices, UseMCS); var Perimetro; if (Objeto.Primitives(1).getLength() > 1000){ Perimetro = "km"; }else{ Perimetro = "m"; } Objeto.Name = "Medición\n" + '' + ": " + Math.round(Objeto.Primitives(0).getArea()*100)/100 + " m2\n" + '' + ": " + Math.round(Objeto.Primitives(1).getLength()*100)/100 + " " + Perimetro; map.setAutoRefresh (true); alert ('' + ": " + Math.round(Objeto.Primitives(0).getArea()*100)/100 + " m2"); map.Refresh(); } function DibujarDistancia (map,points,UseMCS){ var NVertices = map.CreateObject('MGCollection'); var Capa; var RLSetup; var Col; var Key; var Distancia; Capa = map.getMapLayer("Medicion"); if (!Capa) Capa = map.createLayer ("redline", "Medicion"); Col = Capa.getMapObjectsEx(); if (Col.count > 0){ Key = Col.count + 1; }else{ Key = 1; } var Objeto = Capa.createMapObject("Distancia_" + Key, "", ""); NVertices.Add (points.Count); RLSetup = map.getRedlineSetup(); RLSetup.FillAttr.BackMode = "Transparent"; RLSetup.FillAttr.Style = "None"; RLSetup.FillAttr.BackColor = 0; RLSetup.LineAttr.Style = "Solid"; RLSetup.LineAttr.Thickness = 2; RLSetup.LineAttr.color = 5; Objeto.addPolylinePrimitive (points, NVertices, UseMCS); if (Objeto.getLength () > 1000){ Distancia = Math.round(Objeto.getLength()*100)/100 + " km"; }else{ Distancia = Math.round(Objeto.getLength()*100)/100 + " m"; } Objeto.Name = "Medición\n" + '' + ": " + Distancia; map.setAutoRefresh (true); alert('' + ": " + Distancia); map.Refresh(); } function EliminarMedicion(){ var Fr = top.document.getElementById("MenuMedicionesFrame"); Fr.style.visibility = "hidden"; Fr.style.display="none"; var Mapa= top.document.getElementById("mapa"); var Capa; var Objeto; Capa = Mapa.getMapLayer("Medicion"); if (!Capa){ alert(''); }else{ var Seleccion = Mapa.getSelection(); var Coleccion = Seleccion.getMapObjects(Capa); Mapa.setAutoRefresh (false); if (Coleccion.count > 0 ){ var n=0; for(n=0;n