Search in sources :

Example 1 with BasicMapKit

use of de.fhg.igd.mapviewer.BasicMapKit in project hale by halestudio.

the class BBOXPage method createContent.

@Override
protected void createContent(Composite parent) {
    Composite page = new Composite(parent, SWT.NONE);
    GridLayoutFactory.swtDefaults().numColumns(1).applyTo(page);
    SwingComposite wrapper = new SwingComposite(page);
    GridDataFactory.fillDefaults().grab(true, true).hint(600, 400).applyTo(wrapper);
    wrapper.getContentPane().setLayout(new BorderLayout());
    // create map kit
    mapKit = new BasicMapKit();
    // configure map
    updateMap(null);
    // mapKit.addCustomPainter(mypainter);
    // add map kit
    wrapper.getContentPane().add(mapKit, BorderLayout.CENTER);
    // create tool
    final Display display = Display.getCurrent();
    final Runnable updateRunner = new Runnable() {

        @Override
        public void run() {
            updateState();
        }
    };
    bboxTool = new BBoxTool() {

        @Override
        protected void addPosition(GeoPosition pos) {
            super.addPosition(pos);
            display.asyncExec(updateRunner);
        }

        @Override
        public void reset() {
            super.reset();
            display.asyncExec(updateRunner);
        }
    };
    // activate tool
    new MapToolAction(bboxTool, mapKit, true);
    setControl(page);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SwingComposite(eu.esdihumboldt.hale.ui.util.swing.SwingComposite) BorderLayout(java.awt.BorderLayout) BasicMapKit(de.fhg.igd.mapviewer.BasicMapKit) BBoxTool(eu.esdihumboldt.hale.io.wfs.ui.getfeature.internal.BBoxTool) MapToolAction(de.fhg.igd.mapviewer.view.MapToolAction) GeoPosition(org.jdesktop.swingx.mapviewer.GeoPosition) SwingComposite(eu.esdihumboldt.hale.ui.util.swing.SwingComposite) Display(org.eclipse.swt.widgets.Display)

Aggregations

BasicMapKit (de.fhg.igd.mapviewer.BasicMapKit)1 MapToolAction (de.fhg.igd.mapviewer.view.MapToolAction)1 BBoxTool (eu.esdihumboldt.hale.io.wfs.ui.getfeature.internal.BBoxTool)1 SwingComposite (eu.esdihumboldt.hale.ui.util.swing.SwingComposite)1 BorderLayout (java.awt.BorderLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Display (org.eclipse.swt.widgets.Display)1 GeoPosition (org.jdesktop.swingx.mapviewer.GeoPosition)1