Revision 326 trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/fframes/FFrameView.java

View differences:

FFrameView.java
936 936
        else {
937 937
        	syncLayers = true;
938 938
        }
939
        double layoutScale = state.getDouble(SCALE_FIELD);
939
        Double layoutScale = null;
940
        if (state.hasValue(SCALE_FIELD)) { 
941
        	layoutScale = state.getDouble(SCALE_FIELD);
942
        }
940 943
    	Envelope envelope = (Envelope) state.get(ENVELOPE_FIELD); 
941 944

  
942 945
        if (state.hasValue(SCALE_TYPE_FIELD)) {
......
947 950
        	}
948 951
        	else if (value==SCALE_TYPE.FIXED_SCALE.ordinal()) {
949 952
        		scaleType = SCALE_TYPE.FIXED_SCALE;
950
        		fixedScale = new Double(layoutScale);
953
        		fixedScale = layoutScale;
951 954
        	}
952 955
        	// else use the default value
953 956
        }
......
965 968
        	// create 2 separate EventBuffers, which will then have a very stange behaviour
966 969
        }
967 970
        if (getMapContext()!=null) {
968
        	getMapContext().setScaleView((long)layoutScale);
971
        	if (layoutScale!=null) {
972
        		getMapContext().setScaleView(layoutScale.longValue());
973
        	}
969 974
        	getMapContext().getViewPort().setEnvelope(envelope);
970 975
        	if (this.getLayoutContext()!=null) {
971 976
        		this.getLayoutContext().setTocModel(getMapContext());
......
989 994

  
990 995
        if (getMapContext() != null
991 996
            && getMapContext().getViewPort().getEnvelope() != null) {
992
        	if (scaleType==SCALE_TYPE.FIXED_SCALE && fixedScale!=null) {
997
        	if (scaleType==SCALE_TYPE.FIXED_SCALE) {
998
        		if (fixedScale==null) {
999
        			fixedScale = new Double(getMapContext().getScaleView());
1000
        		}
993 1001
        		state.set(SCALE_FIELD, (double)fixedScale);
994 1002
        	}
995 1003
        	else {
996 1004
        		state.set(SCALE_FIELD, (double)getMapContext().getScaleView());	
997 1005
        	}
998
        	if (scaleType == SCALE_TYPE.FIXED_EXTENT && fixedExtent!=null) {
1006
        	if (scaleType == SCALE_TYPE.FIXED_EXTENT) {
1007
        		if (fixedExtent==null) {
1008
        			fixedExtent = getMapContext().getViewPort().getAdjustedEnvelope();
1009
        		}
999 1010
        		state.set(ENVELOPE_FIELD, fixedExtent);
1000 1011
        	}
1001 1012
        	else {
......
1368 1379
				}
1369 1380
				else {
1370 1381
					Envelope newEnvelope;
1371
					if (scaleType==SCALE_TYPE.FIXED_SCALE) {
1382
					if (scaleType==SCALE_TYPE.FIXED_SCALE && fixedScale!=null) {
1372 1383
						getMapContext().setScaleView(Math.round(fixedScale));
1373 1384
						newEnvelope = getMapContext().getViewPort().getAdjustedEnvelope();
1374 1385
					}

Also available in: Unified diff