Revision 9392 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/FLayoutGraphics.java
FLayoutGraphics.java | ||
---|---|---|
48 | 48 |
import java.util.ArrayList; |
49 | 49 |
|
50 | 50 |
import com.iver.andami.PluginServices; |
51 |
import com.iver.cit.gvsig.gui.layout.Layout; |
|
52 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGraphics; |
|
53 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGroup; |
|
54 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameLegend; |
|
55 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameNorth; |
|
56 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameOverView; |
|
57 |
import com.iver.cit.gvsig.gui.layout.fframes.FFramePicture; |
|
58 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameScaleBar; |
|
59 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameTable; |
|
60 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameText; |
|
61 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameView; |
|
51 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGroup; |
|
52 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameLegend; |
|
62 | 53 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame; |
63 | 54 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrameUseFMap; |
55 |
import com.iver.cit.gvsig.project.documents.layout.gui.Layout; |
|
64 | 56 |
import com.iver.cit.gvsig.project.documents.layout.gui.dialogs.FAlignDialog; |
65 | 57 |
import com.iver.cit.gvsig.project.documents.layout.gui.dialogs.FBorderDialog; |
66 | 58 |
import com.iver.cit.gvsig.project.documents.layout.gui.dialogs.FPositionDialog; |
... | ... | |
90 | 82 |
* Transforma un FFrameLegend a FFrames de tipo FFrameSymbol y FFrameText. |
91 | 83 |
*/ |
92 | 84 |
public void simplify() { |
93 |
layout.getEFS().startComplexCommand(); |
|
94 |
IFFrame[] fframes=layout.getFFrames(); |
|
85 |
layout.getLayoutContext().getEFS().startComplexCommand();
|
|
86 |
IFFrame[] fframes=layout.getLayoutContext().getFFrames();
|
|
95 | 87 |
for (int i = fframes.length - 1; i >= 0; i--) { |
96 | 88 |
IFFrame fframe = fframes[i]; |
97 | 89 |
|
... | ... | |
101 | 93 |
} |
102 | 94 |
} |
103 | 95 |
} |
104 |
layout.getEFS().endComplexCommand(PluginServices.getText(this,"simplify")); |
|
105 |
layout.refresh(); |
|
96 |
layout.getLayoutContext().getEFS().endComplexCommand(PluginServices.getText(this,"simplify"));
|
|
97 |
layout.getLayoutControl().refresh();
|
|
106 | 98 |
} |
107 | 99 |
|
108 | 100 |
/** |
... | ... | |
111 | 103 |
public void grouping() { |
112 | 104 |
// Se debe controlar de alguna forma si hay varios seleccionados. |
113 | 105 |
IFFrame fframegroup = new FFrameGroup(); |
114 |
IFFrame[] fframes=layout.getFFrames(); |
|
106 |
fframegroup.setLayout(layout); |
|
107 |
IFFrame[] fframes=layout.getLayoutContext().getFFrames(); |
|
115 | 108 |
if (fframes.length > 1) { |
116 | 109 |
ArrayList selecList = new ArrayList(); |
117 | 110 |
|
... | ... | |
120 | 113 |
|
121 | 114 |
if (fframe.getSelected() != IFFrame.NOSELECT) { |
122 | 115 |
selecList.add(fframe); |
123 |
layout.delFFrame(fframe); |
|
116 |
layout.getLayoutContext().delFFrame(fframe);
|
|
124 | 117 |
} |
125 | 118 |
} |
126 | 119 |
|
... | ... | |
128 | 121 |
((FFrameGroup) fframegroup).addFFrame((IFFrame) selecList.get(i)); |
129 | 122 |
} |
130 | 123 |
|
131 |
((FFrameGroup) fframegroup).setAt(layout.getAT()); |
|
124 |
((FFrameGroup) fframegroup).setAt(layout.getLayoutControl().getAT());
|
|
132 | 125 |
|
133 |
Rectangle2D.Double rd = ((FFrameGroup) fframegroup).getRectangle(layout.getAT()); |
|
126 |
Rectangle2D.Double rd = ((FFrameGroup) fframegroup).getRectangle(layout.getLayoutControl().getAT());
|
|
134 | 127 |
|
135 | 128 |
Rectangle2D.Double rd1 = FLayoutUtilities.toSheetRect(rd, |
136 |
layout.getAT()); |
|
129 |
layout.getLayoutControl().getAT());
|
|
137 | 130 |
|
138 | 131 |
fframegroup.setBoundBox(rd1); |
139 | 132 |
fframegroup.setSelected(true); |
140 |
layout.addFFrame(fframegroup, true,true); |
|
141 |
layout.refresh(); |
|
133 |
layout.getLayoutContext().addFFrame(fframegroup, true,true);
|
|
134 |
layout.getLayoutControl().refresh();
|
|
142 | 135 |
} |
143 | 136 |
} |
144 | 137 |
|
... | ... | |
147 | 140 |
* FFrames individuales. |
148 | 141 |
*/ |
149 | 142 |
public void ungrouping() { |
150 |
layout.getEFS().startComplexCommand(); |
|
151 |
IFFrame[] fframes=layout.getFFrames(); |
|
143 |
layout.getLayoutContext().getEFS().startComplexCommand();
|
|
144 |
IFFrame[] fframes=layout.getLayoutContext().getFFrames();
|
|
152 | 145 |
for (int i = fframes.length - 1; i >= 0; i--) { |
153 | 146 |
IFFrame fframe = fframes[i]; |
154 | 147 |
|
... | ... | |
165 | 158 |
for (int j = selecList.size() - 1; j >= 0; j--) { |
166 | 159 |
IFFrame frame=(IFFrame) selecList.get(j); |
167 | 160 |
frame.setRotation(frame.getRotation()+fframe.getRotation()); |
168 |
layout.addFFrame(frame, false,true); |
|
161 |
layout.getLayoutContext().addFFrame(frame, false,true);
|
|
169 | 162 |
} |
170 |
layout.delFFrame(fframegroup); |
|
163 |
layout.getLayoutContext().delFFrame(fframegroup);
|
|
171 | 164 |
} |
172 | 165 |
} |
173 | 166 |
} |
174 |
layout.getEFS().endComplexCommand(PluginServices.getText(this,"ungroup")); |
|
175 |
layout.refresh(); |
|
167 |
layout.getLayoutContext().getEFS().endComplexCommand(PluginServices.getText(this,"ungroup"));
|
|
168 |
layout.getLayoutControl().refresh();
|
|
176 | 169 |
} |
177 | 170 |
|
178 | 171 |
/** |
... | ... | |
186 | 179 |
* Posiciona los FFrames seleccionados delante de los no seleccionados. |
187 | 180 |
*/ |
188 | 181 |
public void before() { |
189 |
layout.getEFS().startComplexCommand(); |
|
190 |
IFFrame[] fframes=layout.getFFrames(); |
|
182 |
layout.getLayoutContext().getEFS().startComplexCommand();
|
|
183 |
IFFrame[] fframes=layout.getLayoutContext().getFFrames();
|
|
191 | 184 |
for (int i = fframes.length - 1; i >= 0; i--) { |
192 | 185 |
IFFrame fframe = fframes[i]; |
193 | 186 |
if (fframe.getSelected() != IFFrame.NOSELECT) { |
194 | 187 |
if (fframe instanceof FFrameGroup) { |
195 |
((FFrameGroup) fframe).setAt(layout.getAT()); |
|
188 |
((FFrameGroup) fframe).setAt(layout.getLayoutControl().getAT());
|
|
196 | 189 |
} |
197 | 190 |
|
198 | 191 |
IFFrame fframeAux=fframe.cloneFFrame(layout); |
199 |
fframeAux.setLevel(layout.getNumBefore()); |
|
200 |
layout.getEFS().modifyFFrame(fframe,fframeAux); |
|
201 |
fframeAux.getBoundingBox(layout.getAT()); |
|
192 |
fframeAux.setLevel(layout.getLayoutContext().getNumBefore());
|
|
193 |
layout.getLayoutContext().getEFS().modifyFFrame(fframe,fframeAux);
|
|
194 |
fframeAux.getBoundingBox(layout.getLayoutControl().getAT());
|
|
202 | 195 |
} |
203 | 196 |
} |
204 |
layout.getEFS().endComplexCommand(PluginServices.getText(this,"change_before")); |
|
205 |
layout.updateFFrames(); |
|
206 |
layout.refresh(); |
|
197 |
layout.getLayoutContext().getEFS().endComplexCommand(PluginServices.getText(this,"change_before"));
|
|
198 |
layout.getLayoutContext().updateFFrames();
|
|
199 |
layout.getLayoutControl().refresh();
|
|
207 | 200 |
} |
208 | 201 |
|
209 | 202 |
/** |
... | ... | |
211 | 204 |
* seleccionados. |
212 | 205 |
*/ |
213 | 206 |
public void behind() { |
214 |
layout.getEFS().startComplexCommand(); |
|
215 |
IFFrame[] fframes=layout.getFFrames(); |
|
207 |
layout.getLayoutContext().getEFS().startComplexCommand();
|
|
208 |
IFFrame[] fframes=layout.getLayoutContext().getFFrames();
|
|
216 | 209 |
for (int i = fframes.length - 1; i >= 0; i--) { |
217 | 210 |
IFFrame fframe = fframes[i]; |
218 | 211 |
if (fframe.getSelected() != IFFrame.NOSELECT) { |
219 | 212 |
if (fframe instanceof FFrameGroup) { |
220 |
((FFrameGroup) fframe).setAt(layout.getAT()); |
|
213 |
((FFrameGroup) fframe).setAt(layout.getLayoutControl().getAT());
|
|
221 | 214 |
} |
222 | 215 |
|
223 | 216 |
IFFrame fframeAux=fframe.cloneFFrame(layout); |
224 |
fframeAux.setLevel(layout.getNumBehind()); |
|
225 |
layout.getEFS().modifyFFrame(fframe,fframeAux); |
|
226 |
fframeAux.getBoundingBox(layout.getAT()); |
|
217 |
fframeAux.setLevel(layout.getLayoutContext().getNumBehind());
|
|
218 |
layout.getLayoutContext().getEFS().modifyFFrame(fframe,fframeAux);
|
|
219 |
fframeAux.getBoundingBox(layout.getLayoutControl().getAT());
|
|
227 | 220 |
} |
228 | 221 |
} |
229 |
layout.getEFS().endComplexCommand(PluginServices.getText(this,"change_behind")); |
|
230 |
layout.updateFFrames(); |
|
231 |
layout.refresh(); |
|
222 |
layout.getLayoutContext().getEFS().endComplexCommand(PluginServices.getText(this,"change_behind"));
|
|
223 |
layout.getLayoutContext().updateFFrames();
|
|
224 |
layout.getLayoutControl().refresh();
|
|
232 | 225 |
} |
233 | 226 |
|
234 | 227 |
/** |
... | ... | |
236 | 229 |
* ahora mismo solo se abre cuando hay un solo FFrame seleccionado. |
237 | 230 |
*/ |
238 | 231 |
public void openFFrameDialog() { |
239 |
IFFrame[] selecList = layout.getFFrameSelected(); |
|
232 |
IFFrame[] selecList = layout.getLayoutContext().getFFrameSelected();
|
|
240 | 233 |
|
241 | 234 |
if (selecList.length == 1) { |
242 | 235 |
IFFrame frame=selecList[0]; |
243 |
int toolaux = layout.getTool(); |
|
244 |
layout.setTool(getType(frame)); |
|
236 |
// int toolaux = layout.getTool();
|
|
237 |
// layout.setTool(getType(frame));
|
|
245 | 238 |
// IFFrame fframeAux=frame.cloneFFrame(layout); |
246 | 239 |
IFFrame fframeAux=layout.openFFrameDialog(frame); |
247 | 240 |
if (fframeAux!=null) { |
248 | 241 |
if (fframeAux instanceof IFFrameUseFMap) |
249 | 242 |
((IFFrameUseFMap)fframeAux).refresh(); |
250 |
layout.getEFS().modifyFFrame(frame,fframeAux); |
|
251 |
fframeAux.getBoundingBox(layout.getAT()); |
|
252 |
layout.updateFFrames(); |
|
253 |
layout.setIsReSel(true); |
|
254 |
layout.refresh(); |
|
243 |
layout.getLayoutContext().getEFS().modifyFFrame(frame,fframeAux);
|
|
244 |
fframeAux.getBoundingBox(layout.getLayoutControl().getAT());
|
|
245 |
layout.getLayoutContext().updateFFrames();
|
|
246 |
layout.getLayoutControl().setIsReSel(true);
|
|
247 |
layout.getLayoutControl().refresh();
|
|
255 | 248 |
} |
256 |
layout.setTool(toolaux); |
|
249 |
// layout.setTool(toolaux);
|
|
257 | 250 |
|
258 | 251 |
} |
259 | 252 |
} |
260 | 253 |
|
261 | 254 |
/** |
262 |
* Devuelve un entero que representa el tipo de FFrame que se le pasa como |
|
263 |
* par?metro. |
|
264 |
* |
|
265 |
* @param fframe FFrame que se pasa como par?metro, para saber de que tipo |
|
266 |
* es. |
|
267 |
* |
|
268 |
* @return entero. |
|
269 |
*/ |
|
270 |
private int getType(IFFrame fframe) { |
|
271 |
if (fframe instanceof FFrameOverView) { |
|
272 |
return Layout.RECTANGLEOVERVIEW; |
|
273 |
} else if (fframe instanceof FFrameView) { |
|
274 |
return Layout.RECTANGLEVIEW; |
|
275 |
} else if (fframe instanceof FFrameText) { |
|
276 |
return Layout.RECTANGLETEXT; |
|
277 |
} else if (fframe instanceof FFrameScaleBar) { |
|
278 |
return Layout.RECTANGLESCALEBAR; |
|
279 |
} else if (fframe instanceof FFrameNorth) { |
|
280 |
return Layout.RECTANGLENORTH; |
|
281 |
} else if (fframe instanceof FFrameTable) { |
|
282 |
return Layout.RECTANGLEBOX; |
|
283 |
} else if (fframe instanceof FFramePicture) { |
|
284 |
return Layout.RECTANGLEPICTURE; |
|
285 |
} else if (fframe instanceof FFrameLegend) { |
|
286 |
return Layout.RECTANGLELEGEND; |
|
287 |
} else if (fframe instanceof FFrameGraphics) { |
|
288 |
return Layout.GRAPHICS; |
|
289 |
} else if (fframe instanceof FFrameGroup) { |
|
290 |
return Layout.RECTANGLEGROUP; |
|
291 |
} |
|
292 |
|
|
293 |
return Layout.SELECT; |
|
294 |
} |
|
295 |
|
|
296 |
/** |
|
297 | 255 |
* Selecci?n de todos los FFrames del Layout. |
298 | 256 |
*/ |
299 | 257 |
public void selecAll() { |
300 |
IFFrame[] fframes=layout.getFFrames(); |
|
258 |
IFFrame[] fframes=layout.getLayoutContext().getFFrames();
|
|
301 | 259 |
for (int i = fframes.length - 1; i >= 0; i--) { |
302 | 260 |
IFFrame fframe =fframes[i]; |
303 | 261 |
fframe.setSelected(true); |
304 | 262 |
} |
305 |
layout.refresh(); |
|
263 |
layout.getLayoutControl().refresh();
|
|
306 | 264 |
} |
307 | 265 |
|
308 | 266 |
/** |
... | ... | |
318 | 276 |
*/ |
319 | 277 |
public void position() { |
320 | 278 |
|
321 |
IFFrame[] fframes=layout.getFFrameSelected(); |
|
279 |
IFFrame[] fframes=layout.getLayoutContext().getFFrameSelected();
|
|
322 | 280 |
if (fframes.length!=0){ |
323 | 281 |
for (int i=0;i<fframes.length;i++){ |
324 | 282 |
positiondialog = new FPositionDialog(layout,fframes[i]); |
Also available in: Unified diff