Revision 47747

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/MapContextManager.java
101 101
            Class<? extends FLayer> layerClass
102 102
    );
103 103

  
104
    /**
105
     * Register a factory to create new layers based on the parameters 
106
     * of the store and the store itself. 
107
     * If the factory cannot create the layer, it returns null 
108
     * without throwing an exception. 
109
     * The returned layer must be fully initialized.
110
     * 
111
     * @param factory
112
     * @return 
113
     */
104 114
    public boolean registerLayer(Factory<FLayer> factory);
105 115

  
106 116
    /**
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManager.java
699 699
        return true;
700 700
    }
701 701
    
702
    private FLayer newLayer(DataStore dataStore) {
702
    private FLayer newLayerFromFactories(DataStore dataStore) {
703 703
        for (Map.Entry<Object, Class<? extends FLayer>> entry : layerClassFromStoreClass.entrySet()) {
704 704
            Object  currentKey = entry.getKey();
705 705
            if( currentKey instanceof Factory ) {
......
838 838
                    }
839 839
                }
840 840
            }
841
            FLayer layer = this.newLayer(dataStore);
841
            FLayer layer = this.newLayerFromFactories(dataStore);
842 842
            if( layer == null ) {
843 843
                Class<? extends FLayer> layerClass = this.getLayerClass(dataStore.getParameters().getClass());
844 844
                if (layerClass == null) {
......
855 855
                } catch (InstantiationException | IllegalAccessException e) {
856 856
                    throw new LoadLayerException(layerName, e);
857 857
                }
858
                ((SingleLayer) layer).setDataStore(dataStore);
858 859
            }
859 860
            layer.setName(layerName);
860
            ((SingleLayer) layer).setDataStore(dataStore);
861 861
            if (projection != null) {
862 862
                layer.setProjection(projection);
863 863
                if( coordTrans != null ) {

Also available in: Unified diff