Revision 40613
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.editing.app/org.gvsig.editing.app.mainplugin/src/main/java/org/gvsig/editing/gui/preferences/EditionPreferencePage.java | ||
---|---|---|
48 | 48 |
import org.gvsig.editing.EditionLocator; |
49 | 49 |
import org.gvsig.editing.IEditionManager; |
50 | 50 |
import org.gvsig.editing.layers.VectorialLayerEdited; |
51 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
52 |
import org.gvsig.fmap.geom.primitive.Point; |
|
51 | 53 |
import org.gvsig.fmap.mapcontext.MapContext; |
54 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
52 | 55 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
53 | 56 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
54 | 57 |
import org.gvsig.fmap.mapcontext.layers.SingleLayerIterator; |
55 | 58 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
56 | 59 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
57 | 60 |
import org.gvsig.fmap.mapcontrol.MapControlManager; |
61 |
import org.jfree.util.Log; |
|
62 |
import org.slf4j.Logger; |
|
63 |
import org.slf4j.LoggerFactory; |
|
58 | 64 |
|
59 | 65 |
public class EditionPreferencePage extends AbstractPreferencePage { |
66 |
|
|
67 |
private static final Logger logger = |
|
68 |
LoggerFactory.getLogger(EditionPreferencePage.class); |
|
69 |
|
|
60 | 70 |
private JLabel jLabel = null; |
61 | 71 |
|
62 | 72 |
private JTextField jTxtTolerance = null; |
... | ... | |
346 | 356 |
} |
347 | 357 |
|
348 | 358 |
} // while |
349 |
mapContext.invalidate(); |
|
359 |
|
|
350 | 360 |
try{ |
351 | 361 |
mapControlManager.setTolerance(Integer.parseInt(getJTxtTolerance().getText())); |
352 | 362 |
|
353 | 363 |
}catch (Exception e) { |
354 | 364 |
throw new StoreException(PluginServices.getText(this, "tolerancia_incorrecta"),e); |
355 | 365 |
} |
366 |
|
|
367 |
/* |
|
368 |
* I think "mapContext.invalidate()" does not work as expected. |
|
369 |
* Some layers are not actually redrawn. |
|
370 |
*/ |
|
371 |
forceRepaint(mapContext); |
|
356 | 372 |
} |
357 | 373 |
|
374 |
|
|
375 |
/** |
|
376 |
* Not very elegant method to force repaint of view. |
|
377 |
* @param mco |
|
378 |
*/ |
|
379 |
private void forceRepaint(MapContext mco) { |
|
380 |
|
|
381 |
ViewPort vp = mco.getViewPort(); |
|
382 |
Envelope env = vp.getAdjustedEnvelope(); |
|
383 |
try { |
|
384 |
env = (Envelope) env.clone(); |
|
385 |
} catch (CloneNotSupportedException e) { |
|
386 |
logger.error("Unable to clone envelope: ", e); |
|
387 |
} |
|
388 |
Point uc = env.getUpperCorner(); |
|
389 |
double upperx = uc.getX(); |
|
390 |
double inc_len = 0.000001 * env.getLength(0); |
|
391 |
uc.setX(upperx + inc_len); |
|
392 |
vp.setEnvelope(env); |
|
393 |
} |
|
394 |
|
|
358 | 395 |
public void initializeDefaults() { |
359 | 396 |
getJTxtTolerance().setText("4"); |
360 | 397 |
TableModel tm = getJTableSnapping().getModel(); |
Also available in: Unified diff