Search in sources :

Example 1 with GeoLocationHistoryViewer

use of org.netxms.ui.eclipse.osm.widgets.GeoLocationHistoryViewer 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)

Aggregations

GeoLocation (org.netxms.base.GeoLocation)1 MapAccessor (org.netxms.ui.eclipse.osm.tools.MapAccessor)1 GeoLocationHistoryViewer (org.netxms.ui.eclipse.osm.widgets.GeoLocationHistoryViewer)1 GeoMapListener (org.netxms.ui.eclipse.osm.widgets.helpers.GeoMapListener)1