Search in sources :

Example 1 with GetBaseMaps

use of org.activityinfo.legacy.shared.command.GetBaseMaps in project activityinfo by bedatadriven.

the class BaseMapPanel method loadTileMapLabel.

private void loadTileMapLabel() {
    label.setText(I18N.CONSTANTS.loading());
    dispatcher.execute(new GetBaseMaps(), new AsyncCallback<BaseMapResult>() {

        @Override
        public void onFailure(Throwable caught) {
            label.setText(value);
        }

        @Override
        public void onSuccess(BaseMapResult result) {
            for (TileBaseMap baseMap : result.getBaseMaps()) {
                if (baseMap.getId().equals(value)) {
                    label.setText(baseMap.getName());
                    return;
                }
            }
            label.setText(value);
        }
    });
}
Also used : BaseMapResult(org.activityinfo.legacy.shared.command.result.BaseMapResult) TileBaseMap(org.activityinfo.legacy.shared.model.TileBaseMap) GetBaseMaps(org.activityinfo.legacy.shared.command.GetBaseMaps)

Example 2 with GetBaseMaps

use of org.activityinfo.legacy.shared.command.GetBaseMaps in project activityinfo by bedatadriven.

the class BaseMapDialog method loadBaseMaps.

private void loadBaseMaps() {
    listView.getStore().removeAll();
    listView.getStore().add(googleThumb(GoogleBaseMap.ROADMAP, I18N.CONSTANTS.googleRoadmap()));
    listView.getStore().add(googleThumb(GoogleBaseMap.SATELLITE, I18N.CONSTANTS.googleSatelliteMap()));
    listView.getStore().add(googleThumb(GoogleBaseMap.HYBRID, I18N.CONSTANTS.googleHybrid()));
    listView.getStore().add(googleThumb(GoogleBaseMap.TERRAIN, I18N.CONSTANTS.googleTerrainMap()));
    updateSelection();
    service.execute(new GetBaseMaps(), new MaskingAsyncMonitor(listView, I18N.CONSTANTS.loading()), new AsyncCallback<BaseMapResult>() {

        @Override
        public void onFailure(Throwable caught) {
            failLoadingBaseMaps();
        }

        @Override
        public void onSuccess(BaseMapResult result) {
            List<ModelData> thumbnails = new ArrayList<ModelData>();
            for (BaseMap baseMap : result.getBaseMaps()) {
                thumbnails.add(tileThumb(baseMap));
            }
            listView.getStore().add(thumbnails);
            updateSelection();
        }
    });
}
Also used : ModelData(com.extjs.gxt.ui.client.data.ModelData) BaseModelData(com.extjs.gxt.ui.client.data.BaseModelData) MaskingAsyncMonitor(org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor) BaseMapResult(org.activityinfo.legacy.shared.command.result.BaseMapResult) GetBaseMaps(org.activityinfo.legacy.shared.command.GetBaseMaps) ArrayList(java.util.ArrayList) List(java.util.List) BaseMap(org.activityinfo.legacy.shared.model.BaseMap) TileBaseMap(org.activityinfo.legacy.shared.model.TileBaseMap) GoogleBaseMap(org.activityinfo.legacy.shared.reports.content.GoogleBaseMap)

Example 3 with GetBaseMaps

use of org.activityinfo.legacy.shared.command.GetBaseMaps in project activityinfo by bedatadriven.

the class MapGenerator method getBaseMap.

private BaseMap getBaseMap(String baseMapId) {
    BaseMapResult maps = dispatcher.execute(new GetBaseMaps());
    for (TileBaseMap map : maps.getBaseMaps()) {
        if (map.getId().equals(baseMapId)) {
            return map;
        }
    }
    LOGGER.log(Level.SEVERE, "Could not find base map id=" + baseMapId);
    return TileBaseMap.createNullMap(baseMapId);
}
Also used : BaseMapResult(org.activityinfo.legacy.shared.command.result.BaseMapResult) TileBaseMap(org.activityinfo.legacy.shared.model.TileBaseMap) GetBaseMaps(org.activityinfo.legacy.shared.command.GetBaseMaps)

Aggregations

GetBaseMaps (org.activityinfo.legacy.shared.command.GetBaseMaps)3 BaseMapResult (org.activityinfo.legacy.shared.command.result.BaseMapResult)3 TileBaseMap (org.activityinfo.legacy.shared.model.TileBaseMap)3 BaseModelData (com.extjs.gxt.ui.client.data.BaseModelData)1 ModelData (com.extjs.gxt.ui.client.data.ModelData)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 BaseMap (org.activityinfo.legacy.shared.model.BaseMap)1 GoogleBaseMap (org.activityinfo.legacy.shared.reports.content.GoogleBaseMap)1 MaskingAsyncMonitor (org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor)1