Revision 3301 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/LayerFactory.java

View differences:

LayerFactory.java
189 189
		return capa;
190 190
	}
191 191

  
192
    public static FLayer createLayer(String layerName, VectorialDriver d,
193
            IProjection proj) throws DriverException {
194
            //TODO Comprobar si hay un adaptador ya
195
            VectorialDefaultAdapter adapter = new VectorialDefaultAdapter();
196
            adapter.setDriver((VectorialDriver) d);
197

  
198
            FLyrVect capa = new FLyrVect();
199
            capa.setName(layerName);
200

  
201
            capa.setSource(adapter);
202
            capa.setProjection(proj);
203

  
204
            try {
205
                
206
                // Le asignamos tambi?n una legenda por defecto acorde con
207
                // el tipo de shape que tenga. Tampoco s? si es aqu? el
208
                // sitio adecuado, pero en fin....
209
                if (d instanceof WithDefaultLegend) {
210
                    WithDefaultLegend aux = (WithDefaultLegend) d;
211
                    adapter.start();
212
                    capa.setLegend((VectorialLegend) aux.getDefaultLegend());
213
                    adapter.stop();
214
                } else {
215
                    capa.setLegend(LegendFactory.createSingleSymbolLegend(
216
                            capa.getShapeType()));
217
                }
218
            } catch (FieldNotFoundException e) {
219
                //Esta no puede saltar
220
            } catch (DriverIOException e) {
221
                throw new DriverException(e);
222
            }
223

  
224
            return capa;
225
        }
226
    
192 227
	/**
193 228
	 * Crea una capa WMS con el driver que se le pasa como par?metro y
194 229
	 * guard?ndose el nombre del fichero para realizar los accesos, la capa

Also available in: Unified diff