Revision 175
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/FLayoutDraw.java | ||
---|---|---|
112 | 112 |
*/ |
113 | 113 |
public void drawLayout(Graphics2D g2, BufferedImage imgBase) |
114 | 114 |
throws ReadException { |
115 |
initializeAffineTransform(); |
|
115 |
if (!initializeAffineTransform()) { |
|
116 |
return; |
|
117 |
} |
|
116 | 118 |
|
117 | 119 |
IFFrame[] fframes = layoutContext.getFFrames(); |
118 | 120 |
for (int i = 0; i < fframes.length; i++) { |
... | ... | |
135 | 137 |
} |
136 | 138 |
} |
137 | 139 |
|
138 |
private void initializeAffineTransform(){
|
|
140 |
private boolean initializeAffineTransform(){
|
|
139 | 141 |
initialize(); |
140 | 142 |
AffineTransform at = layoutContext.getAT(); |
141 | 143 |
Rectangle2D rLayout = layoutControl.getRect(); |
144 |
if (rLayout.getHeight()<0) { |
|
145 |
// still not ready to be painted |
|
146 |
return false; |
|
147 |
} |
|
142 | 148 |
Attributes attributes = layoutContext.getAttributes(); |
143 | 149 |
|
144 | 150 |
layoutControl.setCancelDrawing(false); |
145 | 151 |
|
146 | 152 |
double scale = 0; |
147 |
scale = rLayout.getHeight() / attributes.m_sizePaper.getAlto() * 1; |
|
153 |
scale = rLayout.getHeight() / attributes.m_sizePaper.getAlto() * 1; // paper (paper units) to screen (pixels) scale
|
|
148 | 154 |
AffineTransform escalado = new AffineTransform(); |
149 | 155 |
AffineTransform translacion = new AffineTransform(); |
150 | 156 |
translacion.setToTranslation(rLayout.getMinX(), rLayout.getMinY()); |
... | ... | |
154 | 160 |
at.concatenate(escalado); |
155 | 161 |
attributes.setDistanceUnitX(rLayout); |
156 | 162 |
attributes.setDistanceUnitY(rLayout); |
163 |
return true; |
|
157 | 164 |
} |
158 | 165 |
|
159 | 166 |
/** |
... | ... | |
697 | 704 |
public void drawShapes(Graphics2D g2) { |
698 | 705 |
initialize(); |
699 | 706 |
layoutPanel.setCursor(Cursor.getDefaultCursor()); |
700 |
initializeAffineTransform(); |
|
707 |
if (!initializeAffineTransform()) { |
|
708 |
return; |
|
709 |
} |
|
701 | 710 |
|
702 | 711 |
IFFrame[] fframes = layoutContext.getFFrames(); |
703 | 712 |
for (int i = 0; i < fframes.length; i++) { |
Also available in: Unified diff