org.geomajas.internal.service.ConfigurationServiceImpl Maven / Gradle / Ivy
/*
* This file is part of Geomajas, a component framework for building
* rich Internet applications (RIA) with sophisticated capabilities for the
* display, analysis and management of geographic information.
* It is a building block that allows developers to add maps
* and other geographic data capabilities to their web applications.
*
* Copyright 2008-2010 Geosparc, http://www.geosparc.com, Belgium
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package org.geomajas.internal.service;
import java.util.LinkedHashMap;
import java.util.Map;
import org.geomajas.configuration.client.ClientApplicationInfo;
import org.geomajas.configuration.client.ClientMapInfo;
import org.geomajas.layer.Layer;
import org.geomajas.layer.LayerException;
import org.geomajas.layer.RasterLayer;
import org.geomajas.layer.VectorLayer;
import org.geomajas.service.ConfigurationService;
import org.geomajas.service.GeoService;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Container class which contains runtime information about the parameters and other information for Geomajas. Values
* are injected using Spring.
*
* @author Joachim Van der Auwera
*/
@Component
public class ConfigurationServiceImpl implements ConfigurationService {
@Autowired(required = false)
protected Map> layerMap = new LinkedHashMap>();
@Autowired(required = false)
protected Map vectorLayerMap = new LinkedHashMap();
@Autowired(required = false)
protected Map rasterLayerMap = new LinkedHashMap();
@Autowired(required = false)
protected Map applicationMap = new LinkedHashMap();
@Autowired
private GeoService geoService;
public VectorLayer getVectorLayer(String id) {
return id == null ? null : vectorLayerMap.get(id);
}
public RasterLayer getRasterLayer(String id) {
return id == null ? null : rasterLayerMap.get(id);
}
public Layer> getLayer(String id) {
return id == null ? null : layerMap.get(id);
}
public ClientMapInfo getMap(String mapId, String applicationId) {
if (null == mapId || null == applicationId) {
return null;
}
ClientApplicationInfo application = applicationMap.get(applicationId);
if (application != null) {
for (ClientMapInfo map : application.getMaps()) {
if (mapId.equals(map.getId())) {
return map;
}
}
}
return null;
}
public CoordinateReferenceSystem getCrs(String crs) throws LayerException {
return geoService.getCrs(crs);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy