Revision 45303
trunk/org.gvsig.desktop/pom.xml | ||
---|---|---|
2740 | 2740 |
|
2741 | 2741 |
<jython.artifactId>jython-standalone</jython.artifactId> |
2742 | 2742 |
<!-- External project versions --> |
2743 |
<gvsig.tools.version>3.0.251</gvsig.tools.version>
|
|
2743 |
<gvsig.tools.version>3.0.252-SNAPSHOT</gvsig.tools.version>
|
|
2744 | 2744 |
<gvsig.proj.version>1.0.22</gvsig.proj.version> |
2745 | 2745 |
<gvsig.projection.api.version>2.0.46</gvsig.projection.api.version> |
2746 | 2746 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/fmap/mapcontrol/tools/Behavior/PolygonBehavior.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import java.awt.event.MouseEvent; |
27 | 27 |
import java.awt.geom.Point2D; |
28 |
|
|
29 | 28 |
import org.gvsig.fmap.mapcontrol.MapControlDrawer; |
30 | 29 |
import org.gvsig.fmap.mapcontrol.tools.BehaviorException; |
31 | 30 |
import org.gvsig.fmap.mapcontrol.tools.Events.MeasureEvent; |
... | ... | |
63 | 62 |
} |
64 | 63 |
|
65 | 64 |
/* |
66 |
* (non-Javadoc)
|
|
67 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.PolylineBehavior#mousePressed(java.awt.event.MouseEvent)
|
|
65 |
* (non-Javadoc)
|
|
66 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.PolylineBehavior#mousePressed(java.awt.event.MouseEvent)
|
|
68 | 67 |
*/ |
69 | 68 |
@Override |
70 |
public void mousePressed(MouseEvent e) throws BehaviorException {
|
|
69 |
public void mouseClicked(MouseEvent e) throws BehaviorException {
|
|
71 | 70 |
if (!isMyButton(e)) { |
72 | 71 |
return; |
73 | 72 |
} |
... | ... | |
81 | 80 |
} else { |
82 | 81 |
isClicked = true; |
83 | 82 |
|
84 |
if (arrayX.size() == 0) {
|
|
83 |
if (arrayX.isEmpty()) {
|
|
85 | 84 |
addPoint(getMapControl().getViewPort().toMapPoint(e.getPoint())); |
86 | 85 |
addPoint(getMapControl().getViewPort().toMapPoint(e.getPoint())); |
87 | 86 |
addPoint(getMapControl().getViewPort().toMapPoint(e.getPoint())); |
... | ... | |
100 | 99 |
* @param p a new vertex to the polygon |
101 | 100 |
*/ |
102 | 101 |
private void addAntPoint(Point2D p) { |
103 |
arrayX.add(arrayX.size() - 1, new Double(p.getX()));
|
|
104 |
arrayY.add(arrayY.size() - 1, new Double(p.getY()));
|
|
102 |
arrayX.add(arrayX.size() - 1, p.getX());
|
|
103 |
arrayY.add(arrayY.size() - 1, p.getY());
|
|
105 | 104 |
} |
106 | 105 |
|
107 | 106 |
/** |
... | ... | |
112 | 111 |
*/ |
113 | 112 |
private void changeAntPoint(Point2D p) { |
114 | 113 |
if (arrayX.size() > 2) { |
115 |
arrayX.set(arrayX.size() - 2, new Double(p.getX()));
|
|
116 |
arrayY.set(arrayY.size() - 2, new Double(p.getY()));
|
|
114 |
arrayX.set(arrayX.size() - 2, p.getX());
|
|
115 |
arrayY.set(arrayY.size() - 2, p.getY());
|
|
117 | 116 |
} |
118 | 117 |
} |
119 | 118 |
|
... | ... | |
135 | 134 |
} |
136 | 135 |
|
137 | 136 |
/* |
138 |
* (non-Javadoc)
|
|
139 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.PolylineBehavior#mouseDragged(java.awt.event.MouseEvent)
|
|
140 |
*/
|
|
137 |
* (non-Javadoc)
|
|
138 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.PolylineBehavior#mouseDragged(java.awt.event.MouseEvent)
|
|
139 |
*/ |
|
141 | 140 |
@Override |
142 | 141 |
public void mouseDragged(MouseEvent e) throws BehaviorException { |
143 | 142 |
mouseMoved(e); |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/fmap/mapcontrol/tools/Behavior/PolylineBehavior.java | ||
---|---|---|
29 | 29 |
import java.util.ArrayList; |
30 | 30 |
import java.util.List; |
31 | 31 |
import org.gvsig.fmap.geom.Geometry; |
32 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
33 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
34 |
|
|
35 | 32 |
import org.gvsig.fmap.geom.primitive.Line; |
36 | 33 |
import org.gvsig.fmap.mapcontrol.MapControlDrawer; |
37 | 34 |
import org.gvsig.fmap.mapcontrol.tools.BehaviorException; |
... | ... | |
39 | 36 |
import org.gvsig.fmap.mapcontrol.tools.Listeners.PolylineListener; |
40 | 37 |
import org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener; |
41 | 38 |
|
42 |
|
|
43 |
|
|
44 | 39 |
/** |
45 |
* <p>Behavior that allows user to draw a polyline by its vertexes on the image of the associated |
|
46 |
* <code>MapControl</code> using a {@link PolylineListener PolylineListener}.</p> |
|
40 |
* <p> |
|
41 |
* Behavior that allows user to draw a polyline by its vertexes on the image of |
|
42 |
* the associated <code>MapControl</code> using a |
|
43 |
* {@link PolylineListener PolylineListener}.</p> |
|
47 | 44 |
* |
48 | 45 |
* @author Vicente Caballero Navarro |
49 | 46 |
* @author Pablo Piqueras Bartolom? |
50 | 47 |
*/ |
51 | 48 |
public class PolylineBehavior extends Behavior { |
52 |
/** |
|
53 |
* The abscissa coordinate of all vertexes of the polyline. |
|
54 |
*/ |
|
55 |
protected List<Double> arrayX = new ArrayList<>(); |
|
56 | 49 |
|
57 |
/**
|
|
58 |
* The ordinate coordinate of all vertexes of the polyline.
|
|
59 |
*/
|
|
60 |
protected List<Double> arrayY = new ArrayList<>();
|
|
50 |
/**
|
|
51 |
* The abscissa coordinate of all vertexes of the polyline.
|
|
52 |
*/
|
|
53 |
protected List<Double> arrayX = new ArrayList<>();
|
|
61 | 54 |
|
62 |
/**
|
|
63 |
* Determines if user is setting the vertexes (with one click of the button 1 of the mouse), or not.
|
|
64 |
*/
|
|
65 |
protected boolean isClicked = false;
|
|
55 |
/**
|
|
56 |
* The ordinate coordinate of all vertexes of the polyline.
|
|
57 |
*/
|
|
58 |
protected List<Double> arrayY = new ArrayList<>();
|
|
66 | 59 |
|
67 |
/** |
|
68 |
* Tool listener used to work with the <code>MapControl</code> object. |
|
69 |
* |
|
70 |
* @see #getListener() |
|
71 |
* @see #setListener(ToolListener) |
|
72 |
*/ |
|
73 |
protected PolylineListener listener; |
|
60 |
/** |
|
61 |
* Determines if user is setting the vertexes (with one click of the button |
|
62 |
* 1 of the mouse), or not. |
|
63 |
*/ |
|
64 |
protected boolean isClicked = false; |
|
74 | 65 |
|
75 |
/** |
|
76 |
* <p>Creates a new behavior for drawing a polyline by its vertexes.</p> |
|
77 |
* |
|
78 |
* @param mli listener used to permit this object to work with the associated <code>MapControl</code> |
|
79 |
*/ |
|
80 |
public PolylineBehavior(PolylineListener mli) { |
|
81 |
super(Behavior.BUTTON_LEFT); |
|
82 |
listener = mli; |
|
83 |
} |
|
66 |
/** |
|
67 |
* Tool listener used to work with the <code>MapControl</code> object. |
|
68 |
* |
|
69 |
* @see #getListener() |
|
70 |
* @see #setListener(ToolListener) |
|
71 |
*/ |
|
72 |
protected PolylineListener listener; |
|
84 | 73 |
|
85 |
/* |
|
74 |
/** |
|
75 |
* <p> |
|
76 |
* Creates a new behavior for drawing a polyline by its vertexes.</p> |
|
77 |
* |
|
78 |
* @param mli listener used to permit this object to work with the |
|
79 |
* associated <code>MapControl</code> |
|
80 |
*/ |
|
81 |
public PolylineBehavior(PolylineListener mli) { |
|
82 |
super(Behavior.BUTTON_LEFT); |
|
83 |
listener = mli; |
|
84 |
} |
|
85 |
|
|
86 |
/* |
|
86 | 87 |
* (non-Javadoc) |
87 | 88 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#paintComponent(java.awt.Graphics) |
88 |
*/ |
|
89 |
public void paintComponent(MapControlDrawer mapControlDrawer) { |
|
90 |
mapControlDrawer.setColor(Color.black); |
|
89 |
*/ |
|
90 |
@Override |
|
91 |
public void paintComponent(MapControlDrawer mapControlDrawer) { |
|
92 |
mapControlDrawer.setColor(Color.black); |
|
91 | 93 |
|
92 |
if (!arrayX.isEmpty()) {
|
|
93 |
drawPolyLine(mapControlDrawer);
|
|
94 |
}
|
|
95 |
}
|
|
94 |
if (!arrayX.isEmpty()) {
|
|
95 |
drawPolyLine(mapControlDrawer);
|
|
96 |
}
|
|
97 |
}
|
|
96 | 98 |
|
97 |
/* |
|
98 |
* (non-Javadoc) |
|
99 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mousePressed(java.awt.event.MouseEvent) |
|
100 |
*/ |
|
101 |
public void mousePressed(MouseEvent e) throws BehaviorException { |
|
102 |
if( !isMyButton(e) ) { |
|
103 |
return; |
|
104 |
} |
|
105 |
if (e.getClickCount() == 2) { |
|
106 |
listener.polylineFinished(new MeasureEvent((Double[]) arrayX.toArray(new Double[arrayX.size()]), (Double[]) arrayY.toArray(new Double[arrayY.size()]), e)); |
|
99 |
@Override |
|
100 |
public void mouseClicked(MouseEvent e) throws BehaviorException { |
|
101 |
if (!isMyButton(e)) { |
|
102 |
return; |
|
103 |
} |
|
104 |
if (e.getClickCount() == 2) { |
|
105 |
listener.polylineFinished(new MeasureEvent((Double[]) arrayX.toArray(new Double[arrayX.size()]), (Double[]) arrayY.toArray(new Double[arrayY.size()]), e)); |
|
107 | 106 |
|
108 |
arrayX.clear();
|
|
109 |
arrayY.clear();
|
|
107 |
arrayX.clear();
|
|
108 |
arrayY.clear();
|
|
110 | 109 |
|
111 |
isClicked = false;
|
|
112 |
} else {
|
|
113 |
isClicked = true;
|
|
114 |
Point2D point = getMapControl().getViewPort().toMapPoint(e.getPoint());
|
|
115 |
addPoint(point);
|
|
110 |
isClicked = false;
|
|
111 |
} else {
|
|
112 |
isClicked = true;
|
|
113 |
Point2D point = getMapControl().getViewPort().toMapPoint(e.getPoint());
|
|
114 |
addPoint(point);
|
|
116 | 115 |
|
117 |
if (arrayX.size() < 2) {
|
|
118 |
addPoint(point);
|
|
119 |
}
|
|
116 |
if (arrayX.size() < 2) {
|
|
117 |
addPoint(point);
|
|
118 |
}
|
|
120 | 119 |
|
121 |
listener.pointFixed(new MeasureEvent((Double[]) arrayX.toArray(new Double[arrayX.size()]), (Double[]) arrayY.toArray(new Double[arrayY.size()]), e));
|
|
122 |
}
|
|
123 |
}
|
|
120 |
listener.pointFixed(new MeasureEvent((Double[]) arrayX.toArray(new Double[arrayX.size()]), (Double[]) arrayY.toArray(new Double[arrayY.size()]), e));
|
|
121 |
}
|
|
122 |
}
|
|
124 | 123 |
|
125 |
/* |
|
126 |
* (non-Javadoc) |
|
127 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseDragged(java.awt.event.MouseEvent) |
|
128 |
*/ |
|
129 |
public void mouseDragged(MouseEvent e) throws BehaviorException { |
|
130 |
mouseMoved(e); |
|
131 |
} |
|
124 |
@Override |
|
125 |
public void mouseDragged(MouseEvent e) throws BehaviorException { |
|
126 |
mouseMoved(e); |
|
127 |
} |
|
132 | 128 |
|
133 |
/** |
|
134 |
* <p>Changes the last point added of the polyline.</p> |
|
135 |
* |
|
136 |
* @param p a point which will replace the last added to the polyline |
|
137 |
*/ |
|
138 |
protected void changeLastPoint(Point2D p) { |
|
139 |
if (arrayX.size() > 0) { |
|
140 |
arrayX.set(arrayX.size() - 1, new Double(p.getX())); |
|
141 |
arrayY.set(arrayY.size() - 1, new Double(p.getY())); |
|
142 |
} |
|
143 |
} |
|
129 |
/** |
|
130 |
* <p> |
|
131 |
* Changes the last point added of the polyline.</p> |
|
132 |
* |
|
133 |
* @param p a point which will replace the last added to the polyline |
|
134 |
*/ |
|
135 |
protected void changeLastPoint(Point2D p) { |
|
136 |
if (arrayX.size() > 0) { |
|
137 |
arrayX.set(arrayX.size() - 1, p.getX()); |
|
138 |
arrayY.set(arrayY.size() - 1, p.getY()); |
|
139 |
} |
|
140 |
} |
|
144 | 141 |
|
145 |
/* |
|
146 |
* (non-Javadoc) |
|
147 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseMoved(java.awt.event.MouseEvent) |
|
148 |
*/ |
|
149 |
public void mouseMoved(MouseEvent e) throws BehaviorException { |
|
150 |
if (isClicked) { |
|
151 |
//System.err.println("moved despues de click"); |
|
152 |
changeLastPoint(getMapControl().getViewPort().toMapPoint(e.getPoint())); |
|
142 |
@Override |
|
143 |
public void mouseMoved(MouseEvent e) throws BehaviorException { |
|
144 |
if (isClicked) { |
|
145 |
//System.err.println("moved despues de click"); |
|
146 |
changeLastPoint(getMapControl().getViewPort().toMapPoint(e.getPoint())); |
|
153 | 147 |
|
154 |
MeasureEvent event = new MeasureEvent((Double[]) arrayX.toArray(new Double[arrayX.size()]), (Double[]) arrayY.toArray(new Double[arrayY.size()]), e);
|
|
148 |
MeasureEvent event = new MeasureEvent((Double[]) arrayX.toArray(new Double[arrayX.size()]), (Double[]) arrayY.toArray(new Double[arrayY.size()]), e);
|
|
155 | 149 |
|
156 |
listener.points(event);
|
|
157 |
getMapControl().repaint();
|
|
158 |
}
|
|
159 |
}
|
|
150 |
listener.points(event);
|
|
151 |
getMapControl().repaint();
|
|
152 |
}
|
|
153 |
}
|
|
160 | 154 |
|
161 |
/** |
|
162 |
* <p>Draws the polyline in the <code>Graphics2D</code> of the associated <code>MapControl</code>.</p> |
|
163 |
* @param mapControlDrawer |
|
164 |
*/ |
|
165 |
protected void drawPolyLine(MapControlDrawer mapControlDrawer) { |
|
166 |
|
|
167 |
// GeneralPathX polyline = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD, arrayX.size()); |
|
168 |
// |
|
169 |
// polyline.moveTo(((Double) arrayX.get(0)).doubleValue(), |
|
170 |
// ((Double) arrayY.get(0)).doubleValue()); |
|
171 |
// |
|
172 |
// for (int index = 0; index < arrayX.size(); index++) { |
|
173 |
// polyline.lineTo(((Double) arrayX.get(index)).doubleValue(),((Double) arrayY.get(index)).doubleValue()); |
|
174 |
// } |
|
155 |
/** |
|
156 |
* <p> |
|
157 |
* Draws the polyline in the <code>Graphics2D</code> of the associated |
|
158 |
* <code>MapControl</code>.</p> |
|
159 |
* |
|
160 |
* @param mapControlDrawer |
|
161 |
*/ |
|
162 |
protected void drawPolyLine(MapControlDrawer mapControlDrawer) { |
|
163 |
|
|
175 | 164 |
try { |
176 | 165 |
Line line = geomManager.createLine(Geometry.SUBTYPES.GEOM2D); |
177 | 166 |
for (int index = 0; index < arrayX.size(); index++) { |
178 |
line.addVertex(arrayX.get(index),arrayY.get(index)); |
|
167 |
line.addVertex(arrayX.get(index), arrayY.get(index));
|
|
179 | 168 |
} |
180 | 169 |
mapControlDrawer.draw(line); |
181 | 170 |
} catch (Exception ex) { |
182 |
LOG.warn("Can't draw polyline",ex); |
|
171 |
LOG.warn("Can't draw polyline", ex);
|
|
183 | 172 |
} |
184 |
}
|
|
173 |
}
|
|
185 | 174 |
|
186 |
/** |
|
187 |
* <p>Adds a new point to the polyline.</p> |
|
188 |
* |
|
189 |
* @param p a new point to the polyline |
|
190 |
*/ |
|
191 |
protected void addPoint(Point2D p) { |
|
192 |
arrayX.add(new Double(p.getX())); |
|
193 |
arrayY.add(new Double(p.getY())); |
|
194 |
} |
|
175 |
/** |
|
176 |
* <p> |
|
177 |
* Adds a new point to the polyline.</p> |
|
178 |
* |
|
179 |
* @param p a new point to the polyline |
|
180 |
*/ |
|
181 |
protected void addPoint(Point2D p) { |
|
182 |
arrayX.add(p.getX()); |
|
183 |
arrayY.add(p.getY()); |
|
184 |
} |
|
195 | 185 |
|
196 |
/** |
|
197 |
* <p>Sets a tool listener to work with the <code>MapControl</code> using this behavior.</p> |
|
198 |
* |
|
199 |
* @param listener a <code>PolylineListener</code> object for this behavior |
|
200 |
*/ |
|
201 |
public void setListener(ToolListener listener) { |
|
202 |
this.listener = (PolylineListener) listener; |
|
203 |
} |
|
186 |
/** |
|
187 |
* <p> |
|
188 |
* Sets a tool listener to work with the <code>MapControl</code> using this |
|
189 |
* behavior.</p> |
|
190 |
* |
|
191 |
* @param listener a <code>PolylineListener</code> object for this behavior |
|
192 |
*/ |
|
193 |
public void setListener(ToolListener listener) { |
|
194 |
this.listener = (PolylineListener) listener; |
|
195 |
} |
|
204 | 196 |
|
205 |
/* |
|
206 |
* (non-Javadoc) |
|
207 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#getListener() |
|
208 |
*/ |
|
209 |
public ToolListener getListener() { |
|
210 |
return listener; |
|
211 |
} |
|
197 |
@Override |
|
198 |
public ToolListener getListener() { |
|
199 |
return listener; |
|
200 |
} |
|
212 | 201 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/fmap/mapcontrol/tools/MeasureListenerImpl.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import java.awt.Image; |
27 | 27 |
import java.awt.Point; |
28 |
|
|
29 | 28 |
import org.gvsig.fmap.IconThemeHelper; |
30 | 29 |
import org.gvsig.fmap.mapcontext.ViewPort; |
31 | 30 |
import org.gvsig.fmap.mapcontrol.MapControl; |
... | ... | |
34 | 33 |
import org.slf4j.Logger; |
35 | 34 |
import org.slf4j.LoggerFactory; |
36 | 35 |
|
37 |
|
|
38 |
|
|
39 | 36 |
/** |
40 |
* <p>Listener for calculating the length of the segments of a polyline, defined in the associated {@link MapControl MapControl} |
|
41 |
* object.</p> |
|
37 |
* <p> |
|
38 |
* Listener for calculating the length of the segments of a polyline, defined in |
|
39 |
* the associated {@link MapControl MapControl} object.</p> |
|
42 | 40 |
* |
43 | 41 |
* @author Vicente Caballero Navarro |
44 | 42 |
*/ |
45 | 43 |
public class MeasureListenerImpl implements PolylineListener { |
46 | 44 |
|
47 |
private static final Logger logger = LoggerFactory.getLogger(MeasureListenerImpl.class);
|
|
48 |
/**
|
|
49 |
* The image to display when the cursor is active.
|
|
50 |
*/
|
|
45 |
private static final Logger logger = LoggerFactory.getLogger(MeasureListenerImpl.class);
|
|
46 |
/**
|
|
47 |
* The image to display when the cursor is active.
|
|
48 |
*/
|
|
51 | 49 |
// private final Image iruler = PluginServices.getIconTheme().get("cursor-query-area").getImage(); |
52 |
/**
|
|
53 |
* Reference to the <code>MapControl</code> object that uses.
|
|
54 |
*/
|
|
55 |
protected MapControl mapCtrl;
|
|
50 |
/**
|
|
51 |
* Reference to the <code>MapControl</code> object that uses.
|
|
52 |
*/
|
|
53 |
protected MapControl mapCtrl;
|
|
56 | 54 |
|
57 |
/** |
|
58 |
* <p>Creates a new listener for calculating the length of a polyline.</p> |
|
59 |
* |
|
60 |
* @param mc the <code>MapControl</code> where is calculated the length |
|
61 |
*/ |
|
62 |
public MeasureListenerImpl(MapControl mc) { |
|
63 |
this.mapCtrl = mc; |
|
64 |
} |
|
55 |
/** |
|
56 |
* <p> |
|
57 |
* Creates a new listener for calculating the length of a polyline.</p> |
|
58 |
* |
|
59 |
* @param mc the <code>MapControl</code> where is calculated the length |
|
60 |
*/ |
|
61 |
public MeasureListenerImpl(MapControl mc) { |
|
62 |
this.mapCtrl = mc; |
|
63 |
} |
|
65 | 64 |
|
66 |
/* |
|
67 |
* (non-Javadoc) |
|
68 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.PolylineListener#points(com.iver.cit.gvsig.fmap.tools.Events.MeasureEvent) |
|
69 |
*/ |
|
70 |
public void points(MeasureEvent event) { |
|
71 |
double dist = 0; |
|
72 |
double distAll = 0; |
|
65 |
@Override |
|
66 |
public void points(MeasureEvent event) { |
|
67 |
double distAll = 0; |
|
73 | 68 |
|
74 |
ViewPort vp = mapCtrl.getMapContext().getViewPort();
|
|
69 |
ViewPort vp = mapCtrl.getMapContext().getViewPort();
|
|
75 | 70 |
|
76 |
for (int i = 0; i < (event.getXs().length - 1); i++) {
|
|
77 |
dist = 0;
|
|
71 |
for (int i = 0; i < (event.getXs().length - 1); i++) {
|
|
72 |
double dist = 0;
|
|
78 | 73 |
|
79 |
Point p = new Point(event.getXs()[i].intValue(),
|
|
80 |
event.getXs()[i].intValue());
|
|
81 |
Point p2 = new Point(event.getXs()[i + 1].intValue(),
|
|
82 |
event.getXs()[i + 1].intValue());
|
|
74 |
Point p = new Point(event.getXs()[i].intValue(),
|
|
75 |
event.getXs()[i].intValue());
|
|
76 |
Point p2 = new Point(event.getXs()[i + 1].intValue(),
|
|
77 |
event.getXs()[i + 1].intValue());
|
|
83 | 78 |
|
84 |
///dist = vp.toMapDistance((int) p.distance(p2));
|
|
85 |
dist = vp.distanceWorld(p, p2);
|
|
86 |
distAll += dist;
|
|
87 |
}
|
|
79 |
dist = vp.distanceWorld(p, p2);
|
|
80 |
distAll += dist;
|
|
81 |
logger.debug("Distancia = {}, Distancia Total = {}.", dist, distAll);
|
|
82 |
}
|
|
88 | 83 |
|
89 |
logger.debug("Distancia = {}, Distancia Total = {}.",dist,distAll); |
|
90 |
} |
|
84 |
} |
|
91 | 85 |
|
92 |
/* |
|
93 |
* (non-Javadoc) |
|
94 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getImageCursor() |
|
95 |
*/ |
|
96 |
public Image getImageCursor() { |
|
97 |
return IconThemeHelper.getImage("cursor-query-area"); |
|
98 |
} |
|
86 |
@Override |
|
87 |
public Image getImageCursor() { |
|
88 |
return IconThemeHelper.getImage("cursor-query-area"); |
|
89 |
} |
|
99 | 90 |
|
100 |
/* |
|
101 |
* (non-Javadoc) |
|
102 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.PolylineListener#pointFixed(com.iver.cit.gvsig.fmap.tools.Events.MeasureEvent) |
|
103 |
*/ |
|
104 |
public void pointFixed(MeasureEvent event) { |
|
105 |
} |
|
91 |
@Override |
|
92 |
public void pointFixed(MeasureEvent event) { |
|
93 |
} |
|
106 | 94 |
|
107 |
/* |
|
108 |
* (non-Javadoc) |
|
109 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#cancelDrawing() |
|
110 |
*/ |
|
111 |
public boolean cancelDrawing() { |
|
112 |
return false; |
|
113 |
} |
|
95 |
@Override |
|
96 |
public boolean cancelDrawing() { |
|
97 |
return false; |
|
98 |
} |
|
114 | 99 |
|
115 |
/* |
|
116 |
* (non-Javadoc) |
|
117 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.PolylineListener#polylineFinished(com.iver.cit.gvsig.fmap.tools.Events.MeasureEvent) |
|
118 |
*/ |
|
119 |
public void polylineFinished(MeasureEvent event) { |
|
120 |
} |
|
100 |
@Override |
|
101 |
public void polylineFinished(MeasureEvent event) { |
|
102 |
} |
|
121 | 103 |
} |
Also available in: Unified diff