Search in sources :

Example 1 with MapAccessor

use of org.netxms.ui.eclipse.osm.tools.MapAccessor in project netxms by netxms.

the class AbstractGeolocationView method createPartControl.

/* (non-Javadoc)
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
	 */
@Override
public void createPartControl(Composite parent) {
    // Map control
    map = createMapViewer(parent, SWT.BORDER);
    map.setViewPart(this);
    createActions();
    contributeToActionBars();
    createPopupMenu();
    activateContext();
    // Initial map view
    mapAccessor = new MapAccessor(getInitialCenterPoint());
    zoomLevel = getInitialZoomLevel();
    mapAccessor.setZoom(zoomLevel);
    map.showMap(mapAccessor);
    map.addMapListener(new GeoMapListener() {

        @Override
        public void onZoom(int zoomLevel) {
            AbstractGeolocationView.this.zoomLevel = zoomLevel;
            mapAccessor.setZoom(zoomLevel);
            actionZoomIn.setEnabled(zoomLevel < MapAccessor.MAX_MAP_ZOOM);
            actionZoomOut.setEnabled(zoomLevel > MapAccessor.MIN_MAP_ZOOM);
        }

        @Override
        public void onPan(GeoLocation centerPoint) {
            mapAccessor.setLatitude(centerPoint.getLatitude());
            mapAccessor.setLongitude(centerPoint.getLongitude());
        }
    });
    getSite().setSelectionProvider(this);
}
Also used : MapAccessor(org.netxms.ui.eclipse.osm.tools.MapAccessor) GeoLocation(org.netxms.base.GeoLocation) GeoMapListener(org.netxms.ui.eclipse.osm.widgets.helpers.GeoMapListener)

Example 2 with MapAccessor

use of org.netxms.ui.eclipse.osm.tools.MapAccessor in project netxms by netxms.

the class AbstractGeoMapViewer method showMap.

/**
 * Show given map
 *
 * @param accessor
 */
public void showMap(MapAccessor accessor) {
    this.accessor = new MapAccessor(accessor);
    reloadMap();
}
Also used : MapAccessor(org.netxms.ui.eclipse.osm.tools.MapAccessor)

Example 3 with MapAccessor

use of org.netxms.ui.eclipse.osm.tools.MapAccessor in project netxms by netxms.

the class HistoryView method createPartControl.

/* (non-Javadoc)
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
	 */
@Override
public void createPartControl(Composite parent) {
    // Map control
    map = new GeoLocationHistoryViewer(parent, SWT.BORDER, object);
    map.setViewPart(this);
    createActions(parent);
    contributeToActionBars();
    createPopupMenu();
    // Initial map view
    mapAccessor = new MapAccessor(getInitialCenterPoint());
    zoomLevel = getInitialZoomLevel();
    mapAccessor.setZoom(zoomLevel);
    map.showMap(mapAccessor);
    map.addMapListener(new GeoMapListener() {

        @Override
        public void onZoom(int zoomLevel) {
            HistoryView.this.zoomLevel = zoomLevel;
            mapAccessor.setZoom(zoomLevel);
            actionZoomIn.setEnabled(zoomLevel < 18);
            actionZoomOut.setEnabled(zoomLevel > 0);
        }

        @Override
        public void onPan(GeoLocation centerPoint) {
            mapAccessor.setLatitude(centerPoint.getLatitude());
            mapAccessor.setLongitude(centerPoint.getLongitude());
        }
    });
}
Also used : MapAccessor(org.netxms.ui.eclipse.osm.tools.MapAccessor) GeoLocation(org.netxms.base.GeoLocation) GeoLocationHistoryViewer(org.netxms.ui.eclipse.osm.widgets.GeoLocationHistoryViewer) GeoMapListener(org.netxms.ui.eclipse.osm.widgets.helpers.GeoMapListener)

Example 4 with MapAccessor

use of org.netxms.ui.eclipse.osm.tools.MapAccessor in project netxms by netxms.

the class WorldMap method dispose.

/* (non-Javadoc)
    * @see org.eclipse.ui.part.WorkbenchPart#dispose()
    */
@Override
public void dispose() {
    IDialogSettings settings = Activator.getDefault().getDialogSettings();
    MapAccessor m = getMapAccessor();
    settings.put(ID + "zoom", m.getZoom());
    settings.put(ID + "latitude", m.getLatitude());
    settings.put(ID + "longitude", m.getLongitude());
    settings.put(ID + "filterEnabled", filterEnabled);
    super.dispose();
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) MapAccessor(org.netxms.ui.eclipse.osm.tools.MapAccessor)

Aggregations

MapAccessor (org.netxms.ui.eclipse.osm.tools.MapAccessor)4 GeoLocation (org.netxms.base.GeoLocation)2 GeoMapListener (org.netxms.ui.eclipse.osm.widgets.helpers.GeoMapListener)2 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)1 GeoLocationHistoryViewer (org.netxms.ui.eclipse.osm.widgets.GeoLocationHistoryViewer)1