Revision 2153

View differences:

branches/pilotoDWG/applications/appgvSIG/src/com/iver/cit/gvsig/gui/cad/tools/SelectionCadTool.java
79 79
			new Status("Precise punto del rect?ngulo de selecci?n(x,y):"),
80 80
			new Status(""), new Status("Precise punto de estiramiento(x,y):"),
81 81
		};
82
	public final static int tolerance = 5;
82
	public final static int tolerance = 4;
83 83
	private Seleccion selectionStatus = new Seleccion();
84 84
	private Point2D firstPoint;
85 85
	private Point2D lastPoint;
......
181 181

  
182 182
				try {
183 183
					for (int i = 0; i < indexes.length; i++) {
184
						double FLATNESS=getCadToolAdapter().getMapControl().getViewPort().toMapDistance(2);
185
						
184 186
						if (editingSource.getGeometry(indexes[i])
185
											 .intersects(rect, 0.1)) {
187
											 .intersects(rect,FLATNESS)) {
186 188
							selectedGeometries.set(indexes[i], true);
187 189
						}
188 190
					}
branches/pilotoDWG/applications/appgvSIG/src/com/iver/cit/gvsig/gui/cad/tools/ScaleCadTool.java
188 188
		for (int i = 0; i < editingSource.getGeometryCount(); i++) {
189 189
			if (selectedGeometries.get(i)) {
190 190
				IGeometry geometry = editingSource.getGeometry(i);
191
				geometry.scale(firstPoint, scaleFactor, scaleFactor);
191
				double size=geometry.getBounds2D().getWidth();
192
				if (size<geometry.getBounds2D().getHeight()){
193
					size=geometry.getBounds2D().getHeight();
194
				}
195
				geometry.scale(firstPoint, scaleFactor/(size/4), scaleFactor/(size/4));
192 196
				editingSource.modifyGeometry(i, geometry);
193 197
			}
194 198
		}
......
216 220
				for (int i = 0; i < efs.getGeometryCount(); i++) {
217 221
					if (selectedGeometries.get(i)) {
218 222
						IGeometry geometry = efs.getGeometry(i);
219

  
223
						double size=geometry.getBounds2D().getWidth();
224
						if (size<geometry.getBounds2D().getHeight()){
225
							size=geometry.getBounds2D().getHeight();
226
						}
220 227
						geometry.scale(firstPoint,
221
							firstPoint.distance(currentPoint),
222
							firstPoint.distance(currentPoint));
228
							firstPoint.distance(currentPoint)/(size/4),
229
							firstPoint.distance(currentPoint)/(size/4));
223 230
						geometry.draw((Graphics2D) g,
224 231
							getCadToolAdapter().getMapControl().getViewPort(),
225 232
							CadTool.modifySymbol);

Also available in: Unified diff