Revision 47620 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/gui/DefaultViewPanel.java
DefaultViewPanel.java | ||
---|---|---|
25 | 25 |
import java.awt.BorderLayout; |
26 | 26 |
import java.awt.Color; |
27 | 27 |
import java.awt.Dimension; |
28 |
import java.awt.event.FocusAdapter; |
|
29 |
import java.awt.event.FocusEvent; |
|
28 | 30 |
import java.beans.PropertyChangeEvent; |
29 | 31 |
import java.beans.PropertyChangeListener; |
30 | 32 |
import java.util.HashMap; |
31 | 33 |
import java.util.Iterator; |
32 | 34 |
import java.util.Map; |
35 |
import java.util.function.Supplier; |
|
33 | 36 |
|
34 | 37 |
import javax.swing.JSplitPane; |
35 | 38 |
import javax.swing.SwingUtilities; |
... | ... | |
62 | 65 |
import org.gvsig.app.project.documents.view.toolListeners.ZoomInListener; |
63 | 66 |
import org.gvsig.app.project.documents.view.toolListeners.ZoomOutListener; |
64 | 67 |
import org.gvsig.fmap.dal.feature.FeatureStoreNotification; |
68 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
|
69 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
65 | 70 |
import org.gvsig.fmap.mapcontext.MapContext; |
66 | 71 |
import org.gvsig.fmap.mapcontext.events.ColorEvent; |
67 | 72 |
import org.gvsig.fmap.mapcontext.events.ExtentEvent; |
... | ... | |
69 | 74 |
import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener; |
70 | 75 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
71 | 76 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
77 |
import org.gvsig.fmap.mapcontext.layers.LayerEvent; |
|
78 |
import org.gvsig.fmap.mapcontext.layers.LayerListener; |
|
72 | 79 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
73 | 80 |
import org.gvsig.fmap.mapcontrol.MapControlCreationException; |
74 | 81 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
... | ... | |
490 | 497 |
m_MapControl.addCombinedBehavior(new MouseMovementBehavior(statusBarListener)); |
491 | 498 |
m_MapControl.addCombinedBehavior(new MouseWheelBehavior()); |
492 | 499 |
m_MapControl.addCombinedBehavior(new MoveBehavior(panListener, Behavior.BUTTON_MIDDLE)); |
500 |
|
|
501 |
Supplier<Envelope> bboxSupplier = new Supplier<Envelope>() { |
|
502 |
@Override |
|
503 |
public Envelope get() { |
|
504 |
ApplicationManager application = ApplicationLocator.getApplicationManager(); |
|
505 |
Document activeView = application.getActiveDocument(ViewManager.TYPENAME); |
|
506 |
if( activeView == getDocument() ) { |
|
507 |
MapContext mapContext = getMapControl().getMapContext(); |
|
508 |
Envelope env = mapContext.getViewPort().getEnvelope(); |
|
509 |
return env; |
|
510 |
} |
|
511 |
return null; |
|
512 |
} |
|
513 |
}; |
|
514 |
m_MapControl.addFocusListener(new FocusAdapter() { |
|
515 |
@Override |
|
516 |
@SuppressWarnings("Convert2Lambda") |
|
517 |
public void focusGained(FocusEvent e) { |
|
518 |
DALSwingLocator.getDataSwingManager().setCurrentBoundingBox(new Supplier<Envelope>() { |
|
519 |
@Override |
|
520 |
public Envelope get() { |
|
521 |
MapContext mapContext = getMapControl().getMapContext(); |
|
522 |
Envelope env = mapContext.getViewPort().getEnvelope(); |
|
523 |
return env; |
|
524 |
} |
|
525 |
}); |
|
526 |
} |
|
527 |
}); |
|
528 |
m_MapControl.getMapContext().getViewPort().addViewPortListener(new ViewPortListener() { |
|
529 |
@Override |
|
530 |
@SuppressWarnings("Convert2Lambda") |
|
531 |
public void extentChanged(ExtentEvent e) { |
|
532 |
ApplicationManager application = ApplicationLocator.getApplicationManager(); |
|
533 |
Document activeView = application.getActiveDocument(ViewManager.TYPENAME); |
|
534 |
if (activeView == getDocument()) { |
|
535 |
DALSwingLocator.getDataSwingManager().setCurrentBoundingBox(new Supplier<Envelope>() { |
|
536 |
@Override |
|
537 |
public Envelope get() { |
|
538 |
MapContext mapContext = getMapControl().getMapContext(); |
|
539 |
Envelope env = mapContext.getViewPort().getEnvelope(); |
|
540 |
return env; |
|
541 |
} |
|
542 |
}); |
|
543 |
} |
|
544 |
} |
|
545 |
|
|
546 |
@Override |
|
547 |
public void backColorChanged(ColorEvent e) { |
|
548 |
} |
|
549 |
|
|
550 |
@Override |
|
551 |
public void projectionChanged(ProjectionEvent e) { |
|
552 |
} |
|
553 |
}); |
|
493 | 554 |
} |
494 | 555 |
|
495 | 556 |
public void windowActivated() { |
Also available in: Unified diff