Commit 303386b0d639e403dee42699c80cdb3bfa3a1941
1 parent
24de638f
Exists in
master
and in
7 other branches
Alteração na ferramenta de cálculo de área para utilizar a API do OpenLayers nessa interface
Showing
1 changed file
with
8 additions
and
10 deletions
Show diff stats
classesjs/classe_analise.js
@@ -866,7 +866,8 @@ i3GEO.analise = { | @@ -866,7 +866,8 @@ i3GEO.analise = { | ||
866 | trecho = 0, | 866 | trecho = 0, |
867 | per = 0, | 867 | per = 0, |
868 | direcao = 0, | 868 | direcao = 0, |
869 | - area = 0; | 869 | + area = 0, |
870 | + proj = new OpenLayers.Projection("EPSG:4326"); | ||
870 | n = i3GEO.analise.medeArea.pontos.ypt.length; | 871 | n = i3GEO.analise.medeArea.pontos.ypt.length; |
871 | if(n > 1){ | 872 | if(n > 1){ |
872 | x1 = i3GEO.analise.medeArea.pontos.xpt[n-1]; | 873 | x1 = i3GEO.analise.medeArea.pontos.xpt[n-1]; |
@@ -881,6 +882,7 @@ i3GEO.analise = { | @@ -881,6 +882,7 @@ i3GEO.analise = { | ||
881 | y1 = temp[1]; | 882 | y1 = temp[1]; |
882 | x2 = temp[2]; | 883 | x2 = temp[2]; |
883 | y2 = temp[3]; | 884 | y2 = temp[3]; |
885 | + proj = new OpenLayers.Projection("EPSG:900913"); | ||
884 | } | 886 | } |
885 | trecho = i3GEO.calculo.distancia(x1,y1,x2,y2); | 887 | trecho = i3GEO.calculo.distancia(x1,y1,x2,y2); |
886 | direcao = i3GEO.calculo.direcao(x1,y1,x2,y2); | 888 | direcao = i3GEO.calculo.direcao(x1,y1,x2,y2); |
@@ -894,13 +896,9 @@ i3GEO.analise = { | @@ -894,13 +896,9 @@ i3GEO.analise = { | ||
894 | temp = temp.split(" "); | 896 | temp = temp.split(" "); |
895 | x1 = temp[0]; | 897 | x1 = temp[0]; |
896 | y1 = temp[1]; | 898 | y1 = temp[1]; |
897 | - x2 = temp[2]; | ||
898 | - y2 = temp[3]; | ||
899 | } | 899 | } |
900 | per += i3GEO.calculo.distancia(x1,y1,x2,y2); | 900 | per += i3GEO.calculo.distancia(x1,y1,x2,y2); |
901 | - if(n > 2){ | ||
902 | - area = poligono.geometry.getGeodesicArea(); | ||
903 | - } | 901 | + area = poligono.geometry.getGeodesicArea(proj); |
904 | i3GEO.analise.medeArea.openlayers.mostraParcial(trecho,per,area,direcao); | 902 | i3GEO.analise.medeArea.openlayers.mostraParcial(trecho,per,area,direcao); |
905 | } | 903 | } |
906 | }, | 904 | }, |
@@ -909,7 +907,8 @@ i3GEO.analise = { | @@ -909,7 +907,8 @@ i3GEO.analise = { | ||
909 | //registra os pontos e calcula a distancia | 907 | //registra os pontos e calcula a distancia |
910 | per = 0, | 908 | per = 0, |
911 | trecho = 0, | 909 | trecho = 0, |
912 | - area = 0; | 910 | + area = 0, |
911 | + proj = new OpenLayers.Projection("EPSG:4326"); | ||
913 | i3GEO.analise.medeArea.pontos.xpt.push(point.x); | 912 | i3GEO.analise.medeArea.pontos.xpt.push(point.x); |
914 | i3GEO.analise.medeArea.pontos.ypt.push(point.y); | 913 | i3GEO.analise.medeArea.pontos.ypt.push(point.y); |
915 | n = i3GEO.analise.medeArea.pontos.ypt.length; | 914 | n = i3GEO.analise.medeArea.pontos.ypt.length; |
@@ -926,6 +925,7 @@ i3GEO.analise = { | @@ -926,6 +925,7 @@ i3GEO.analise = { | ||
926 | y1 = temp[1]; | 925 | y1 = temp[1]; |
927 | x2 = temp[2]; | 926 | x2 = temp[2]; |
928 | y2 = temp[3]; | 927 | y2 = temp[3]; |
928 | + proj = new OpenLayers.Projection("EPSG:900913"); | ||
929 | } | 929 | } |
930 | trecho = i3GEO.calculo.distancia(x1,y1,x2,y2); | 930 | trecho = i3GEO.calculo.distancia(x1,y1,x2,y2); |
931 | i3GEO.analise.medeArea.pontos.dist.push(trecho); | 931 | i3GEO.analise.medeArea.pontos.dist.push(trecho); |
@@ -939,8 +939,6 @@ i3GEO.analise = { | @@ -939,8 +939,6 @@ i3GEO.analise = { | ||
939 | temp = temp.split(" "); | 939 | temp = temp.split(" "); |
940 | x1 = temp[0]; | 940 | x1 = temp[0]; |
941 | y1 = temp[1]; | 941 | y1 = temp[1]; |
942 | - x2 = temp[2]; | ||
943 | - y2 = temp[3]; | ||
944 | } | 942 | } |
945 | per += i3GEO.calculo.distancia(x1,y1,x2,y2); | 943 | per += i3GEO.calculo.distancia(x1,y1,x2,y2); |
946 | //desenha ponto | 944 | //desenha ponto |
@@ -966,7 +964,7 @@ i3GEO.analise = { | @@ -966,7 +964,7 @@ i3GEO.analise = { | ||
966 | ); | 964 | ); |
967 | i3GEO.desenho.layergrafico.addFeatures([label]); | 965 | i3GEO.desenho.layergrafico.addFeatures([label]); |
968 | if(n > 2){ | 966 | if(n > 2){ |
969 | - area = poligono.getGeodesicArea(); | 967 | + area = poligono.getGeodesicArea(proj); |
970 | } | 968 | } |
971 | } | 969 | } |
972 | i3GEO.analise.medeArea.openlayers.mostraTotal(per,area); | 970 | i3GEO.analise.medeArea.openlayers.mostraTotal(per,area); |