Revision 357 trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/Attributes.java

View differences:

Attributes.java
1114 1114
        Rectangle2D.Double rectaux = new Rectangle2D.Double();
1115 1115
        int x0 = (int) rect.getMinX();
1116 1116
        int y0 = (int) rect.getMinY();
1117
        int y1;
1118
        int x1;
1119
        y1 = (h - (2 * y0));
1120
        x1 = (int) (y1 * getPaperSizeRatio());
1121 1117

  
1118
        // Don't use the whole component space to draw the sheet,
1119
        // add some margin to make the sheet evident.
1120
        // 2 * x0: margin left and margin right
1121
        // 2 * y0: margin top and margin bottom
1122
        int newHeight = (h - (2 * y0));
1123
        int newWidth = (int) (newHeight * getPaperSizeRatio());
1122 1124
        if (((int) (((h) - (2 * y0)) * getPaperSizeRatio())) > ((w) - (2 * x0))) {
1123
            x1 = ((w) - (2 * x0));
1124
            y1 = (int) (x1 / getPaperSizeRatio());
1125
        	newWidth = ((w) - (2 * x0));
1126
        	newHeight = (int) (newWidth / getPaperSizeRatio());
1125 1127
        }
1126

  
1127
        rectaux.setRect(x0, y0, x1, y1);
1128

  
1128
        rectaux.setRect(x0, y0, newWidth, newHeight);
1129 1129
        return rectaux;
1130 1130
    }
1131 1131

  
......
1156 1156
        Rectangle2D.Double rectaux = new Rectangle2D.Double();
1157 1157
        int x0 = (int) rect.getMinX();
1158 1158
        int y0 = (int) rect.getMinY();
1159
        int y1;
1160
        int x1;
1161
        x1 = (w - (2 * x0));
1162
        y1 = (int) (x1 * getPaperSizeRatio());
1163

  
1159
                
1160
        // Don't use the whole component space to draw the sheet,
1161
        // add some margin to make the sheet evident.
1162
        // 2 * x0: margin left and margin right
1163
        // 2 * y0: margin top and margin bottom
1164
        int newWidth = (w - (2 * x0));
1165
        int newHeight = (int) (newWidth * getPaperSizeRatio());
1164 1166
        if (((int) (((w) - (2 * x0)) * getPaperSizeRatio())) > ((h) - (2 * y0))) {
1165
            y1 = (h - (2 * y0));
1166
            x1 = (int) (y1 / getPaperSizeRatio());
1167
        	newHeight = (h - (2 * y0));
1168
        	newWidth = (int) (newHeight / getPaperSizeRatio());
1167 1169
        }
1168

  
1169
        rectaux.setRect(x0, y0, x1, y1);
1170

  
1170
        rectaux.setRect(x0, y0, newWidth, newHeight);
1171 1171
        return rectaux;
1172 1172
    }
1173 1173

  

Also available in: Unified diff