1
|
Index: src/main/java/org/gvsig/app/project/documents/view/toolListeners/MeasureListener.java
|
2
|
===================================================================
|
3
|
--- src/main/java/org/gvsig/app/project/documents/view/toolListeners/MeasureListener.java (revisión: 40997)
|
4
|
+++ src/main/java/org/gvsig/app/project/documents/view/toolListeners/MeasureListener.java (copia de trabajo)
|
5
|
@@ -25,7 +25,9 @@
|
6
|
|
7
|
import java.awt.geom.Point2D;
|
8
|
import java.text.NumberFormat;
|
9
|
+import java.util.Locale;
|
10
|
|
11
|
+import org.geotools.measure.AngleFormat;
|
12
|
import org.gvsig.andami.PluginServices;
|
13
|
import org.gvsig.fmap.mapcontext.MapContext;
|
14
|
import org.gvsig.fmap.mapcontext.ViewPort;
|
15
|
@@ -67,6 +69,10 @@
|
16
|
public void points(MeasureEvent event) {
|
17
|
double dist = 0;
|
18
|
double distAll = 0;
|
19
|
+ double angle = 0;
|
20
|
+ double sin = 0;
|
21
|
+ double cos = 0;
|
22
|
+ double dm = 0;
|
23
|
|
24
|
ViewPort vp = mapCtrl.getMapContext().getViewPort();
|
25
|
|
26
|
@@ -75,12 +81,21 @@
|
27
|
Point2D p2 = new Point2D.Double(event.getXs()[i].doubleValue(), event.getYs()[i].doubleValue());// vp.toMapPoint(new Point(event.getXs()[i].intValue(),event.getYs()[i].intValue()));
|
28
|
dist = vp.distanceWorld(p, p2);
|
29
|
distAll += dist;
|
30
|
+
|
31
|
+ dm = p.distance(p2);
|
32
|
+ sin = (p2.getX()-p.getX())/dm;
|
33
|
+ cos = (p2.getY()-p.getY())/dm;
|
34
|
+ if (sin >= 0){
|
35
|
+ angle = Math.toDegrees(Math.acos(cos));
|
36
|
+ } else {
|
37
|
+ angle = 360 - Math.toDegrees(Math.acos(cos));
|
38
|
+ }
|
39
|
+
|
40
|
p = p2;
|
41
|
}
|
42
|
|
43
|
- //System.out.println("Distancia = " + dist + " Distancia Total = " +
|
44
|
- // (distAll));
|
45
|
NumberFormat nf = NumberFormat.getInstance();
|
46
|
+ AngleFormat af = AngleFormat.getInstance(Locale.getDefault());
|
47
|
nf.setMaximumFractionDigits(2);
|
48
|
if (PluginServices.getMainFrame() != null)
|
49
|
{
|
50
|
@@ -89,6 +104,8 @@
|
51
|
"Dist:" + nf.format(dist/trans2Meter[mapCtrl.getViewPort().getDistanceUnits()]) + "");
|
52
|
PluginServices.getMainFrame().getStatusBar().setMessage("5",
|
53
|
"Total:" + nf.format(distAll/trans2Meter[mapCtrl.getViewPort().getDistanceUnits()]) + "");
|
54
|
+ PluginServices.getMainFrame().getStatusBar().setMessage("azimut",
|
55
|
+ "Azimut:" + af.format(angle) + "");
|
56
|
}
|
57
|
}
|
58
|
}
|
59
|
Index: src/main/resources-plugin/config.xml
|
60
|
===================================================================
|
61
|
--- src/main/resources-plugin/config.xml (revisión: 40997)
|
62
|
+++ src/main/resources-plugin/config.xml (copia de trabajo)
|
63
|
@@ -40,6 +40,7 @@
|
64
|
<label id="5" size="110"/>
|
65
|
<label id="distancearea" size="30"/>
|
66
|
<label id="projection" size="110"/>
|
67
|
+ <label id="azimut" size="110"/>
|
68
|
</label-set>
|
69
|
|
70
|
<!--
|