Revision 213 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
213 213
     * in inches of the paper.
214 214
     */
215 215
    protected double getDrawPaperDPI() {
216
    	return (2.54*getBoundingBox(null).width)/getBoundBox().width;	
216
    	AffineTransform at = null;
217
    	if (getLayoutContext()!=null) {
218
    		at = getLayoutContext().getAT();
219
    	}
220
    	return (2.54*getBoundingBox(at).width)/getBoundBox().width;	
217 221
    }
218 222

  
219 223
    /**
......
277 281
    					.getViewPort().clone());
278 282
    		}
279 283
    		ViewPort newViewPort = getMapContext().getViewPort();
280
    		newViewPort.setImageSize(new Dimension((int) getBoundingBox(null).width,
281
    				(int) getBoundingBox(null).height));
284
    		AffineTransform at;
285
    		if (getLayoutContext()!=null) {
286
    			at = getLayoutContext().getAT();
287
    		}
288
    		else {
289
    			at = null;
290
    		}
291
    		newViewPort.setImageSize(new Dimension((int) getBoundingBox(at).width,
292
    				(int) getBoundingBox(at).height));
282 293
    		newViewPort.setDPI(getDrawPaperDPI());
283 294
    		setListeners();
284 295
    		updateScaleCtrl();
......
928 939
    public void setBoundBox(Rectangle2D r) {
929 940
    	super.setBoundBox(r);
930 941
    	if (getMapContext()!=null) {
942
    		AffineTransform at = this.getLayoutContext().getAT();
931 943
    		getMapContext().getViewPort().setImageSize(
932
    				new Dimension((int)r.getWidth(), (int)r.getHeight()));
944
    				new Dimension((int)getBoundingBox(at).getWidth(), (int)getBoundingBox(at).getHeight()));
933 945
    		getMapContext().getViewPort().setDPI(getDrawPaperDPI());
934 946
    		updateScaleCtrl();
935 947
    		// FIXME: what should we do here? should we invalidate the cache?
......
1236 1248
		}
1237 1249

  
1238 1250
		public void layerAdded(final LayerCollectionEvent e) {
1251
			// necessary to set an envelope when the first layer is added
1252
			if (!b_updating && getMapContext().getViewPort().getEnvelope()==null) {
1253
				try {
1254
					b_updating = true;
1255
					fullExtent();
1256
					
1257
				} catch (ReadException e1) {
1258
				} finally {
1259
					b_updating = false;
1260
				}
1261
			}
1239 1262
			conditionalRedraw();
1240 1263
			invalidateToc();
1241 1264
		}

Also available in: Unified diff