Revision 26778 branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerFactory.java

View differences:

LayerFactory.java
4 4
import java.util.Map;
5 5

  
6 6
import org.cresques.cts.IProjection;
7
import org.gvsig.fmap.dal.*;
7
import org.gvsig.fmap.crs.CRSFactory;
8
import org.gvsig.fmap.dal.DALLocator;
9
import org.gvsig.fmap.dal.DataManager;
10
import org.gvsig.fmap.dal.DataStore;
11
import org.gvsig.fmap.dal.DataStoreParameters;
8 12
import org.gvsig.fmap.dal.exception.InitializeException;
9 13
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
10 14
import org.gvsig.fmap.dal.feature.FeatureStore;
......
43 47
    /**
44 48
     * Registra que clase tiene que usar para un {@link DataStore} determinado. <br>
45 49
     * Por defecto, si el
46
     * 
47
     * 
50
     *
51
     *
48 52
     * @param dataStoreName
49 53
     *            Nombre de registro del {@link DataStore} dentro del
50 54
     *            {@link DataManager}
......
98 102
	 * @throws DriverException @throws DriverIOException
99 103
	 */
100 104
	public FLayer createLayer(String layerName,
101
			DataStoreParameters storeParameters,
102
			IProjection proj) throws LoadLayerException  {
105
			DataStoreParameters storeParameters) throws LoadLayerException {
103 106
		// Se obtiene el driver que lee
104 107
		try{
105 108
			DataManager dataManager=DALLocator.getDataManager();
......
124 127
			}
125 128

  
126 129
			((SingleLayer) layer).setDataStore(dataStore);
127
			layer.setProjection(proj);
128 130
			layer.setName(layerName);
131
			Object srsObj = dataStore.getDynValue("DefaultSRS");
132
			if (srsObj != null) {
133
				IProjection proj = null;
134
				if (srsObj instanceof IProjection) {
135
					proj = (IProjection) srsObj;
136
				} else if (srsObj instanceof String) {
137
					proj = CRSFactory.getCRS((String) srsObj);
138
				}
139
				if (proj != null) {
140
					layer.setProjection(proj);
141
				}
142
			}
129 143

  
130 144

  
131 145
			return layer;

Also available in: Unified diff