Revision 42877

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/layers/FLyrDefault.java
100 100
         * Flag to set the layer as a temporary layer.
101 101
         */
102 102
        private boolean temporary;
103
        
103

  
104 104
	/**
105 105
	 * Path to the upper layer which this layer belongs.
106 106
	 *
......
200 200
	 */
201 201
	private long drawVersion= 0L;
202 202

  
203
        
203

  
204 204
        private ExtendedPropertiesHelper properties = new ExtendedPropertiesHelper();
205
        
205

  
206 206
	public FLyrDefault(MetadataContainer metadataContainer) {
207 207
		this.metadataContainer = metadataContainer;
208 208
	}
......
416 416
			this.updateDrawVersion();
417 417
		}
418 418
	}
419
	
420 419

  
420

  
421 421
	/*
422 422
	 * (non-Javadoc)
423 423
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getMapContext()
......
464 464
               } catch (Exception ex) {
465 465
                   logger.warn("Error calling listener '"+listener.toString()+"'.", ex);
466 466
               }
467
           }                
467
           }
468 468
	}
469 469
	/**
470 470
	 * Called by the method {@linkplain #setName(String)}. Notifies all listeners associated to this layer,
......
481 481
               } catch (Exception ex) {
482 482
                   logger.warn("Error calling listener '"+listener.toString()+"'.", ex);
483 483
               }
484
           }                
484
           }
485 485
	}
486 486

  
487 487
	/**
......
499 499
               } catch (Exception ex) {
500 500
                   logger.warn("Error calling listener '"+listener.toString()+"'.", ex);
501 501
               }
502
           }                                
502
           }
503 503
	}
504 504

  
505 505
	/**
......
655 655
               } catch (Exception ex) {
656 656
                   logger.warn("Error calling listener '"+listener.toString()+"'.", ex);
657 657
               }
658
           } 
658
           }
659 659
        }
660
        
660

  
661 661
	/*
662 662
	 * (non-Javadoc)
663 663
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isEditing()
......
672 672
	public String getTocImageIcon() {
673 673
		return "layer-icon";
674 674
	}
675
	
675

  
676 676
	/*
677 677
	 * (non-Javadoc)
678 678
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isInTOC()
......
709 709
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#reload()
710 710
	 */
711 711
	public void reload() throws ReloadLayerException {
712
	    if(this.ct!=null){
713
	        IProjection srcProj = this.ct.getPOrig();
714
	        if(!this.getProjection().equals(srcProj)){
715
	            this.ct = this.getProjection().getCT(this.ct.getPDest());
716
	        }
717
	    }
712 718
		this.setAvailable(true);
713 719
	}
714 720

  
......
770 776
	public void addError(BaseException exception){
771 777
		status.addLayerError(exception);
772 778
	}
773
        
779

  
774 780
        @Override
775 781
        public void setError(Exception ex) {
776 782
            this.status.setLayerError(ex);
777 783
        }
778
        
784

  
779 785
	/*
780 786
	 * (non-Javadoc)
781 787
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#visibleRequired()
......
940 946
	public void visibilityChanged(LayerEvent e) {
941 947

  
942 948
	}
943
	
949

  
944 950
	// ========================================================
945
	
951

  
946 952
	public void saveToState(PersistentState state) throws PersistenceException {
947 953
            try {
948 954
		state.set("parentLayer", (Persistent)parentLayer);
......
967 973
            try {
968 974
		this.setDynValue(METADATA_NAME, state.getString("name"));
969 975
		this.setDynValue(METADATA_CRS, state.get("crs"));
970
		
976

  
971 977
		this.parentLayer = (FLayers) state.get("parentLayer");
972 978
		this.status = (FLayerStatus) state.get("status");
973 979
		this.minScale = state.getDouble("minScale");
......
993 999
				FLyrDefault.class,
994 1000
				"FLyrDefault",
995 1001
				"FLyrDefault Persistence definition",
996
				null, 
1002
				null,
997 1003
				null
998 1004
		);
999 1005
		definition.addDynFieldString("name").setMandatory(false);
......
1006 1012
		definition.addDynFieldObject("status").setClassOfValue(FLayerStatus.class).setMandatory(true);
1007 1013
                definition.addDynFieldMap("properties").setClassOfItems(Object.class)
1008 1014
				.setMandatory(true);
1009
            
1015

  
1010 1016
            return Boolean.TRUE;
1011 1017
        }
1012 1018
    }
1013 1019

  
1014
	
1020

  
1015 1021
//	/**
1016 1022
//	 * Splits string into an array of strings
1017 1023
//	 * @param input input string
......
1021 1027
//	public static String[] splitString(String input, String sep) {
1022 1028
//		return Pattern.compile(sep).split(input, 0);
1023 1029
//	}
1024
	
1030

  
1025 1031
	public void clear() {
1026 1032
		if (metadataContainer != null) {
1027 1033
			metadataContainer.clear();
1028 1034
		}
1029 1035
	}
1030
	
1036

  
1031 1037
    public String getMetadataName() throws MetadataException {
1032 1038
        return FLayer.METADATA_DEFINITION_NAME;
1033 1039
    }
1034
    
1040

  
1035 1041
        public static class RegisterMetadata implements Callable {
1036 1042

  
1037 1043
            public Object call() {
......
1063 1069
	public String toString() {
1064 1070
		return this.getName();
1065 1071
	}
1066
	
1072

  
1067 1073
	public boolean hidesThisArea(Envelope area) {
1068 1074
		return false;
1069 1075
	}
1070
        
1076

  
1071 1077
        public boolean isTemporary() {
1072 1078
            return this.temporary;
1073 1079
        }
1074
        
1080

  
1075 1081
        public void setTemporary(boolean temporary) {
1076 1082
            this.temporary = temporary;
1077 1083
        }
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/layers/vectorial/FLyrVect.java
39 39
import org.gvsig.fmap.dal.DataStore;
40 40
import org.gvsig.fmap.dal.exception.DataException;
41 41
import org.gvsig.fmap.dal.exception.ReadException;
42
import org.gvsig.fmap.dal.exception.ReadRuntimeException;
42 43
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
43 44
import org.gvsig.fmap.dal.feature.FeatureQuery;
44 45
import org.gvsig.fmap.dal.feature.FeatureSet;
......
85 86
import org.gvsig.tools.dynobject.DynStruct;
86 87
import org.gvsig.tools.evaluator.Evaluator;
87 88
import org.gvsig.tools.exception.BaseException;
89
import org.gvsig.tools.exception.BaseRuntimeException;
88 90
import org.gvsig.tools.locator.LocatorException;
89 91
import org.gvsig.tools.observer.Observable;
90 92
import org.gvsig.tools.observer.Observer;
......
233 235
        // Si existe reproyecci?n, reproyectar el extent
234 236
        ICoordTrans ct = getCoordTrans();
235 237
        if (ct != null) {
238
            boolean originalEnvelopeIsEmpty = rAux.isEmpty();
236 239
            rAux = rAux.convert(ct);
240
            if(!originalEnvelopeIsEmpty && rAux.isEmpty()){
241
                try {
242
                    this.setAvailable(false);
243
                    throw new EnvelopeCantBeInitializedException();
244
                } catch(EnvelopeCantBeInitializedException e){
245
                    this.addError(e);
246
                }
247
            }
237 248
        }
238 249
        return rAux;
239 250

  
......
1197 1208
    public Iterator iterator() {
1198 1209
        return this.getFeatureStore().iterator();
1199 1210
    }
1211

  
1212
    protected class EnvelopeCantBeInitializedException extends BaseException {
1213

  
1214
        /**
1215
         *
1216
         */
1217
        private static final long serialVersionUID = 4572797479347381552L;
1218
        private final static String MESSAGE_FORMAT = "The envelope can't be initialized, maybe the layer has a wrong projection. Change the projection in layer properties of the add layer dialog to try fix it.";
1219
        private final static String MESSAGE_KEY = "_EnvelopeCantBeInitializedException";
1220

  
1221
        public EnvelopeCantBeInitializedException() {
1222
            super(MESSAGE_FORMAT, null, MESSAGE_KEY, serialVersionUID);
1223
        }
1224
    }
1225

  
1200 1226
}
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/gui/WizardPanel.java
272 272

  
273 273
                } catch (Exception e) {
274 274
                    LayerErrorsPanel panel = new LayerErrorsPanel(layerName, e);
275
                    if (preparedLayer != null) {
276
                        panel.setLayer(preparedLayer);
277
                    } else if(layer!=null){
278
                        panel.setLayer(layer);
279
                    }
275 280
                    I18nManager i18nManager = ToolsLocator.getI18nManager();
276 281
                    ToolsSwingLocator.getWindowManager().showWindow(
277 282
                        panel,

Also available in: Unified diff