Search in sources :

Example 1 with LatLng

use of org.discotools.gwt.leaflet.client.types.LatLng in project opennms by OpenNMS.

the class NodeMapWidget method createMap.

private void createMap(final String divId) {
    final MapOptions options = new MapOptions();
    options.setCenter(new LatLng(0, 0));
    options.setProperty("zoomControl", false);
    options.setZoom(1);
    options.setMaxZoom(15);
    m_map = new Map(divId, options);
}
Also used : MapOptions(org.discotools.gwt.leaflet.client.map.MapOptions) LatLng(org.discotools.gwt.leaflet.client.types.LatLng) Map(org.opennms.features.vaadin.nodemaps.internal.gwt.client.Map)

Example 2 with LatLng

use of org.discotools.gwt.leaflet.client.types.LatLng in project opennms by OpenNMS.

the class NodeMarkerSearchCallback method doSearch.

protected JSObject doSearch(final String text) {
    logger.log(Level.INFO, "doSearch(" + text + ")");
    final Collection<JSNodeMarker> markers = search(m_markerProvider.getMarkers(), text);
    logger.log(Level.INFO, markers.size() + " markers returned.");
    final SearchResults results = SearchResults.create();
    for (final JSNodeMarker marker : markers) {
        final LatLng latLng = JSNodeMarker.coordinatesToLatLng(marker.getCoordinates());
        results.setProperty(marker.getNodeLabel(), latLng.getJSObject());
    }
    return results;
}
Also used : LatLng(org.discotools.gwt.leaflet.client.types.LatLng) SearchResults(org.opennms.features.vaadin.nodemaps.internal.gwt.client.SearchResults) JSNodeMarker(org.opennms.features.vaadin.nodemaps.internal.gwt.client.JSNodeMarker)

Example 3 with LatLng

use of org.discotools.gwt.leaflet.client.types.LatLng in project activityinfo by bedatadriven.

the class MapEditorMapView method createMap.

private void createMap() {
    MapOptions mapOptions = new MapOptions();
    mapOptions.setCenter(new LatLng(content.getExtents().getCenterY(), content.getExtents().getCenterX()));
    mapOptions.setZoom(6);
    mapOptions.setProperty("crs", new EPSG3857());
    map = new LeafletMap(mapOptions);
    add(map);
    layout();
    EventHandlerManager.addEventHandler(map.getMap(), Events.moveend, new EventHandler() {

        @Override
        public void handle(Event event) {
            updateModelFromMap();
        }
    });
    EventHandlerManager.addEventHandler(map.getMap(), Events.zoomend, new EventHandler() {

        @Override
        public void handle(Event event) {
            updateModelFromMap();
        }
    });
    overlays = new LeafletReportOverlays(map.getMap());
}
Also used : EPSG3857(org.discotools.gwt.leaflet.client.crs.epsg.EPSG3857) LeafletReportOverlays(org.activityinfo.ui.client.component.report.editor.map.symbols.LeafletReportOverlays) MapOptions(org.discotools.gwt.leaflet.client.map.MapOptions) EventHandler(org.discotools.gwt.leaflet.client.events.handler.EventHandler) LeafletMarkerDrilldownEventHandler(org.activityinfo.ui.client.component.report.editor.map.symbols.LeafletMarkerDrilldownEventHandler) Event(org.discotools.gwt.leaflet.client.events.Event) AiLatLng(org.activityinfo.model.type.geo.AiLatLng) LatLng(org.discotools.gwt.leaflet.client.types.LatLng)

Example 4 with LatLng

use of org.discotools.gwt.leaflet.client.types.LatLng in project activityinfo by bedatadriven.

the class MapEditorMapView method onContentLoaded.

private void onContentLoaded(MapContent result) {
    Log.debug("MapPreview: Received content");
    content = result;
    statusWidget.setStatus(result.getUnmappedSites().size() + " " + I18N.CONSTANTS.siteLackCoordiantes(), null);
    if (!isRendered()) {
        return;
    }
    if (map == null) {
        createMap();
    }
    overlays.clear();
    overlays.setBaseMap(result.getBaseMap());
    overlays.addMarkers(result.getMarkers(), markerDrilldownEventHandler);
    for (AdminOverlay overlay : result.getAdminOverlays()) {
        overlays.addAdminLayer(overlay);
    }
    if (!zoomSet) {
        if (model.getZoomLevel() != -1 && model.getCenter() != null) {
            map.getMap().setView(new LatLng(model.getCenter().getLat(), model.getCenter().getLng()), model.getZoomLevel(), true);
        } else {
            map.fitBounds(result.getExtents());
        }
        zoomSet = true;
    }
}
Also used : AdminOverlay(org.activityinfo.legacy.shared.reports.content.AdminOverlay) AiLatLng(org.activityinfo.model.type.geo.AiLatLng) LatLng(org.discotools.gwt.leaflet.client.types.LatLng)

Example 5 with LatLng

use of org.discotools.gwt.leaflet.client.types.LatLng in project activityinfo by bedatadriven.

the class MapEditorMapView method updateModelFromMap.

private void updateModelFromMap() {
    model.setZoomLevel(map.getMap().getZoom());
    LatLng center = map.getMap().getBounds().getCenter();
    model.setCenter(new AiLatLng(center.lat(), center.lng()));
}
Also used : AiLatLng(org.activityinfo.model.type.geo.AiLatLng) AiLatLng(org.activityinfo.model.type.geo.AiLatLng) LatLng(org.discotools.gwt.leaflet.client.types.LatLng)

Aggregations

LatLng (org.discotools.gwt.leaflet.client.types.LatLng)8 AiLatLng (org.activityinfo.model.type.geo.AiLatLng)5 MapOptions (org.discotools.gwt.leaflet.client.map.MapOptions)2 JSNodeMarker (org.opennms.features.vaadin.nodemaps.internal.gwt.client.JSNodeMarker)2 ArrayList (java.util.ArrayList)1 AdminOverlay (org.activityinfo.legacy.shared.reports.content.AdminOverlay)1 LeafletMarkerDrilldownEventHandler (org.activityinfo.ui.client.component.report.editor.map.symbols.LeafletMarkerDrilldownEventHandler)1 LeafletReportOverlays (org.activityinfo.ui.client.component.report.editor.map.symbols.LeafletReportOverlays)1 EPSG3857 (org.discotools.gwt.leaflet.client.crs.epsg.EPSG3857)1 Event (org.discotools.gwt.leaflet.client.events.Event)1 EventHandler (org.discotools.gwt.leaflet.client.events.handler.EventHandler)1 LatLngBounds (org.discotools.gwt.leaflet.client.types.LatLngBounds)1 Map (org.opennms.features.vaadin.nodemaps.internal.gwt.client.Map)1 MapNode (org.opennms.features.vaadin.nodemaps.internal.gwt.client.MapNode)1 SearchResults (org.opennms.features.vaadin.nodemaps.internal.gwt.client.SearchResults)1