Revision 1773
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.algorithm/org.gvsig.raster.tools.algorithm.swing/org.gvsig.raster.tools.algorithm.swing.impl/src/main/resources/org/gvsig/raster/tools/algorithm/swing/impl/i18n/text.properties | ||
---|---|---|
33 | 33 |
resolution=Resoluci?n |
34 | 34 |
width_result=Ancho resultado |
35 | 35 |
height_result=Alto resultado |
36 |
result_size=Tama?o del resultado |
|
36 |
result_size=Tama?o del resultado (raw)
|
|
37 | 37 |
file=Fichero |
38 | 38 |
print_selection=Selecci?n para impresi?n |
39 | 39 |
|
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.algorithm/org.gvsig.raster.tools.algorithm.swing/org.gvsig.raster.tools.algorithm.swing.impl/src/main/resources/org/gvsig/raster/tools/algorithm/swing/impl/i18n/text_en.properties | ||
---|---|---|
33 | 33 |
resolution=Resolution |
34 | 34 |
width_result=Width result |
35 | 35 |
height_result=Height result |
36 |
result_size=Size of the result
|
|
36 |
result_size=Size of the output (raw)
|
|
37 | 37 |
file=File |
38 | 38 |
print_selection=Selection to print |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.algorithm/org.gvsig.raster.tools.algorithm.swing/org.gvsig.raster.tools.algorithm.swing.impl/src/main/java/org/gvsig/raster/tools/algorithm/swing/impl/saveraster/SaveRasterMainPanel.java | ||
---|---|---|
3 | 3 |
import java.awt.GridBagConstraints; |
4 | 4 |
import java.awt.GridBagLayout; |
5 | 5 |
import java.awt.Insets; |
6 |
import java.awt.event.ActionListener; |
|
6 | 7 |
import java.beans.PropertyChangeListener; |
7 | 8 |
|
8 | 9 |
import javax.swing.JButton; |
... | ... | |
94 | 95 |
getMethodPanel().getPrintSelectionPanel().getScale().setListener(listener); |
95 | 96 |
} |
96 | 97 |
|
98 |
public void addActionListener(ActionListener listener) { |
|
99 |
getMethodPanel().getPixelSelectionPanel().getRadioPxSelection().addActionListener(listener); |
|
100 |
getMethodPanel().getPrintSelectionPanel().getRadioPrintSelection().addActionListener(listener); |
|
101 |
getMethodPanel().getPrintSelectionPanel().getComboDPI().addActionListener(listener); |
|
102 |
getOutputPanel().getBSelect().addActionListener(listener); |
|
103 |
getOutputPanel().getBProperties().addActionListener(listener); |
|
104 |
} |
|
105 |
|
|
97 | 106 |
public boolean isPixelMethodSelected() { |
98 | 107 |
return getMethodPanel().getPixelSelectionPanel().getRadioPxSelection().isSelected(); |
99 | 108 |
} |
... | ... | |
129 | 138 |
return LRX_COMPONENT; |
130 | 139 |
if(obj == getWCCoordsPanel().getCoordinatesPanel().getDataInputContainer22().getDataInputField()) |
131 | 140 |
return LRY_COMPONENT; |
141 |
if(obj == getMethodPanel().getPixelSelectionPanel().getRadioPxSelection()) |
|
142 |
return PIXEL_SELECTOR; |
|
143 |
if(obj == getMethodPanel().getPrintSelectionPanel().getRadioPrintSelection()) |
|
144 |
return PRINT_SELECTOR; |
|
132 | 145 |
return -1; |
133 | 146 |
} |
134 | 147 |
|
135 |
public void setProjected(boolean isProjected) { |
|
136 |
|
|
137 |
} |
|
138 |
|
|
139 | 148 |
public void setSizeMB(double mb) { |
140 | 149 |
getMethodPanel().setSize(mb); |
141 | 150 |
} |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.algorithm/org.gvsig.raster.tools.algorithm.swing/org.gvsig.raster.tools.algorithm.swing.impl/src/main/java/org/gvsig/raster/tools/algorithm/swing/impl/saveraster/PixelSelectionPanel.java | ||
---|---|---|
1 | 1 |
package org.gvsig.raster.tools.algorithm.swing.impl.saveraster; |
2 | 2 |
|
3 |
import java.awt.Color; |
|
4 | 3 |
import java.awt.GridBagConstraints; |
5 | 4 |
import java.awt.GridBagLayout; |
6 | 5 |
import java.awt.Insets; |
... | ... | |
30 | 29 |
|
31 | 30 |
private void init() { |
32 | 31 |
setLayout(new GridBagLayout()); |
33 |
setBorder(BorderFactory.createLineBorder(Color.gray));
|
|
32 |
setBorder(BorderFactory.createTitledBorder(""));
|
|
34 | 33 |
|
35 | 34 |
GridBagConstraints gbc = new GridBagConstraints(); |
36 | 35 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
... | ... | |
61 | 60 |
gbc.gridy = 2; |
62 | 61 |
add(getCellsize(), gbc); |
63 | 62 |
|
64 |
gbc.fill = GridBagConstraints.BOTH; |
|
63 |
/*gbc.fill = GridBagConstraints.BOTH;
|
|
65 | 64 |
gbc.gridwidth = 2; |
66 | 65 |
gbc.weightx = 1; |
67 | 66 |
gbc.weighty = 1; |
68 | 67 |
gbc.gridx = 0; |
69 | 68 |
gbc.gridy = 3; |
70 |
add(new JPanel(), gbc); |
|
69 |
add(new JPanel(), gbc);*/
|
|
71 | 70 |
} |
72 | 71 |
|
73 | 72 |
public InputFieldPanel getCellsize() { |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.algorithm/org.gvsig.raster.tools.algorithm.swing/org.gvsig.raster.tools.algorithm.swing.impl/src/main/java/org/gvsig/raster/tools/algorithm/swing/impl/saveraster/PrintAndPxSelectionPanel.java | ||
---|---|---|
52 | 52 |
gbc.gridy = 2; |
53 | 53 |
add(getSizeImage(), gbc); |
54 | 54 |
|
55 |
gbc.fill = GridBagConstraints.BOTH; |
|
55 |
/*gbc.fill = GridBagConstraints.BOTH; |
|
56 |
gbc.weightx = 1; |
|
56 | 57 |
gbc.weighty = 1; |
57 | 58 |
gbc.gridy = 3; |
58 |
add(new JPanel(), gbc); |
|
59 |
add(new JPanel(), gbc);*/
|
|
59 | 60 |
} |
60 | 61 |
|
61 | 62 |
public PixelSelectionPanel getPixelSelectionPanel() { |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.algorithm/org.gvsig.raster.tools.algorithm.swing/org.gvsig.raster.tools.algorithm.swing.impl/src/main/java/org/gvsig/raster/tools/algorithm/swing/impl/saveraster/PrintSelectionPanel.java | ||
---|---|---|
1 | 1 |
package org.gvsig.raster.tools.algorithm.swing.impl.saveraster; |
2 | 2 |
|
3 |
import java.awt.Color; |
|
4 | 3 |
import java.awt.GridBagConstraints; |
5 | 4 |
import java.awt.GridBagLayout; |
6 | 5 |
import java.awt.Insets; |
... | ... | |
38 | 37 |
|
39 | 38 |
private void init() { |
40 | 39 |
setLayout(new GridBagLayout()); |
41 |
setBorder(BorderFactory.createLineBorder(Color.gray));
|
|
40 |
setBorder(BorderFactory.createTitledBorder(""));
|
|
42 | 41 |
|
43 | 42 |
GridBagConstraints gbc = new GridBagConstraints(); |
44 | 43 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
... | ... | |
94 | 93 |
gbc.gridy = 5; |
95 | 94 |
add(getLabelHeight(), gbc); |
96 | 95 |
|
97 |
gbc.fill = GridBagConstraints.BOTH; |
|
96 |
/*gbc.fill = GridBagConstraints.BOTH;
|
|
98 | 97 |
gbc.weightx = 1; |
99 | 98 |
gbc.weighty = 1; |
100 | 99 |
gbc.gridx = 0; |
101 | 100 |
gbc.gridy = 6; |
102 |
add(new JPanel(), gbc); |
|
101 |
add(new JPanel(), gbc);*/
|
|
103 | 102 |
} |
104 | 103 |
|
105 | 104 |
public JComboBox getComboDPI() { |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.algorithm/org.gvsig.raster.tools.algorithm.swing/org.gvsig.raster.tools.algorithm.swing.api/src/main/java/org/gvsig/raster/tools/algorithm/swing/saveraster/SaveRasterPanel.java | ||
---|---|---|
1 | 1 |
package org.gvsig.raster.tools.algorithm.swing.saveraster; |
2 | 2 |
|
3 |
import java.awt.event.ActionListener; |
|
3 | 4 |
import java.beans.PropertyChangeListener; |
4 | 5 |
|
5 | 6 |
import javax.swing.JButton; |
... | ... | |
23 | 24 |
public static int ULY_COMPONENT = 10; |
24 | 25 |
public static int LRX_COMPONENT = 11; |
25 | 26 |
public static int LRY_COMPONENT = 12; |
27 |
public static int PIXEL_SELECTOR = 13; |
|
28 |
public static int PRINT_SELECTOR = 14; |
|
26 | 29 |
|
27 | 30 |
public JComponent getComponent(); |
28 | 31 |
|
... | ... | |
80 | 83 |
|
81 | 84 |
public void setHeightPxValue(String value); |
82 | 85 |
|
83 |
public void setProjected(boolean isProjected); |
|
84 |
|
|
85 | 86 |
public void setSizePxPrintResult(int w, int h); |
86 | 87 |
|
87 | 88 |
public void setSizeMB(double mb); |
... | ... | |
117 | 118 |
* @param listener |
118 | 119 |
*/ |
119 | 120 |
public void addPropertiesChangeListener(PropertyChangeListener listener); |
121 |
|
|
122 |
/** |
|
123 |
* Adds listeners for the buttons |
|
124 |
* @param listener |
|
125 |
*/ |
|
126 |
public void addActionListener(ActionListener listener); |
|
120 | 127 |
} |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/saveviewtoraster/tool/SaveRasterRectangleTool.java | ||
---|---|---|
91 | 91 |
if(Math.abs(fin.getY() - ini.getY()) > 10 && Math.abs(fin.getX() - ini.getX()) > 10) { |
92 | 92 |
SaveRasterPanel panel = saveRaster.getSaveRasterPanel(); |
93 | 93 |
panel.getBProperties().setEnabled(false); |
94 |
panel.setProjected(vp.getProjection().isProjected()); |
|
95 | 94 |
|
96 | 95 |
DecimalFormat nf = (DecimalFormat)NumberFormat.getInstance(Locale.ENGLISH); |
97 | 96 |
nf.applyPattern("#.#"); |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/saveviewtoraster/ui/listener/DataInputListener.java | ||
---|---|---|
29 | 29 |
import java.awt.event.KeyListener; |
30 | 30 |
import java.awt.event.MouseEvent; |
31 | 31 |
import java.awt.event.MouseListener; |
32 |
import java.awt.geom.Point2D; |
|
32 | 33 |
import java.beans.PropertyChangeEvent; |
33 | 34 |
import java.beans.PropertyChangeListener; |
34 | 35 |
import java.io.File; |
35 | 36 |
import java.util.EventObject; |
36 | 37 |
|
38 |
import org.cresques.cts.IProjection; |
|
37 | 39 |
import org.gvsig.andami.PluginServices; |
38 | 40 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
39 | 41 |
import org.gvsig.fmap.dal.coverage.util.MathUtils; |
42 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
43 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
44 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
45 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
40 | 46 |
import org.gvsig.gui.beans.datainput.DataInputContainerListener; |
41 | 47 |
import org.gvsig.gui.beans.swing.JFileChooser; |
42 | 48 |
import org.gvsig.raster.tools.algorithm.swing.saveraster.SaveRasterPanel; |
43 | 49 |
import org.gvsig.raster.tools.app.basic.RasterToolsUtil; |
44 |
import org.gvsig.raster.tools.app.basic.tool.saveviewtoraster.ui.SaveViewToRasterDialog; |
|
45 | 50 |
import org.gvsig.raster.util.ExtendedFileFilter; |
46 | 51 |
|
47 | 52 |
/** |
... | ... | |
52 | 57 |
public class DataInputListener implements ActionListener, MouseListener, FocusListener, KeyListener, DataInputContainerListener, PropertyChangeListener { |
53 | 58 |
final private static long serialVersionUID = -3370601314380922368L; |
54 | 59 |
private SaveRasterPanel controlPanel = null; |
55 |
private SaveViewToRasterDialog dialog = null; |
|
56 | 60 |
private String fName = null; |
57 | 61 |
private boolean enableEventValueChanged = true; |
58 | 62 |
private MathUtils math = RasterLocator.getManager().getMathUtils(); |
63 |
private ViewPort viewPort = null; |
|
64 |
private FLayers layers = null; |
|
59 | 65 |
|
60 | 66 |
/** |
61 | 67 |
* This method initializes |
... | ... | |
66 | 72 |
this.controlPanel = controlPanel; |
67 | 73 |
initialize(); |
68 | 74 |
} |
75 |
|
|
76 |
public void setLayers(FLayers layers) { |
|
77 |
this.layers = layers; |
|
78 |
this.viewPort = layers.getMapContext().getViewPort(); |
|
79 |
} |
|
69 | 80 |
|
70 | 81 |
/** |
71 | 82 |
* This method initializes this |
... | ... | |
78 | 89 |
controlPanel.getCbResolution().addKeyListener(this); |
79 | 90 |
controlPanel.addActionListener(this); |
80 | 91 |
} |
81 |
|
|
82 |
/** |
|
83 |
* Asigna un valor al panel padre |
|
84 |
* @param dialogPanel |
|
85 |
*/ |
|
86 |
public void setDialogPanel(SaveViewToRasterDialog dialog) { |
|
87 |
this.dialog = dialog; |
|
88 |
} |
|
89 | 92 |
|
90 | 93 |
/** |
91 | 94 |
* Checks a integer value |
... | ... | |
314 | 317 |
|
315 | 318 |
double distWidth = 0; |
316 | 319 |
double distHeight = 0; |
317 |
if (ulx > lrx) |
|
318 |
distWidth = ulx - lrx; |
|
319 |
else |
|
320 |
distWidth = lrx - ulx; |
|
320 |
|
|
321 |
if(!controlPanel.isPixelMethodSelected() && !viewPort.getProjection().isProjected()) { |
|
322 |
Point2D pUL = new Point2D.Double(ulx, uly); |
|
323 |
Point2D pUR = new Point2D.Double(lrx, uly); |
|
324 |
Point2D pLR = new Point2D.Double(lrx, lry); |
|
325 |
distWidth = viewPort.distanceWorld(pUL, pUR); |
|
326 |
distHeight = viewPort.distanceWorld(pUR, pLR); |
|
327 |
double[] trans2Meter = MapContext.getDistanceTrans2Meter(); |
|
328 |
distWidth = distWidth / trans2Meter[viewPort.getDistanceUnits()]; |
|
329 |
distHeight = distHeight / trans2Meter[viewPort.getDistanceUnits()]; |
|
330 |
} else { |
|
331 |
if (ulx > lrx) |
|
332 |
distWidth = ulx - lrx; |
|
333 |
else |
|
334 |
distWidth = lrx - ulx; |
|
321 | 335 |
|
322 |
if (uly > lry) |
|
323 |
distHeight = uly - lry; |
|
324 |
else |
|
325 |
distHeight = lry - uly; |
|
336 |
if (uly > lry) |
|
337 |
distHeight = uly - lry; |
|
338 |
else |
|
339 |
distHeight = lry - uly; |
|
340 |
} |
|
326 | 341 |
|
327 |
//Point2D pUL = new Point2D.Double(ulx, uly); |
|
328 |
//Point2D pUR = new Point2D.Double(lrx, uly); |
|
329 |
//Point2D pLR = new Point2D.Double(lrx, lry); |
|
330 |
//double distWidth = controlPanel.getViewPort().distanceWorld(pUL, pUR); |
|
331 |
//double distHeight = controlPanel.getViewPort().distanceWorld(pUR, pLR); |
|
332 |
//double[] trans2Meter = MapContext.getDistanceTrans2Meter(); |
|
333 |
//distWidth = distWidth / trans2Meter[controlPanel.getViewPort().getDistanceUnits()]; |
|
334 |
//distHeight = distHeight / trans2Meter[controlPanel.getViewPort().getDistanceUnits()]; |
|
335 |
|
|
336 | 342 |
return new double[]{distWidth, distHeight}; |
337 | 343 |
} |
338 | 344 |
|
... | ... | |
413 | 419 |
if (selectedFilter != null) |
414 | 420 |
chooser.setFileFilter(selectedFilter); |
415 | 421 |
|
416 |
int returnVal = chooser.showOpenDialog(dialog);
|
|
422 |
int returnVal = chooser.showOpenDialog(controlPanel.getComponent());
|
|
417 | 423 |
|
418 | 424 |
if (returnVal == JFileChooser.APPROVE_OPTION) { |
419 | 425 |
ExtendedFileFilter fileFilter = ((ExtendedFileFilter) chooser.getFileFilter()); |
... | ... | |
442 | 448 |
enableButtons(); |
443 | 449 |
enableEventValueChanged = true; |
444 | 450 |
} |
451 |
|
|
452 |
if(controlPanel.getComponentID(obj) == SaveRasterPanel.PRINT_SELECTOR) { |
|
453 |
IProjection viewProj = viewPort.getProjection(); |
|
454 |
for (int i = 0; i < layers.getLayersCount(); i++) { |
|
455 |
FLayer lyr = layers.getLayer(i); |
|
456 |
if(lyr.getProjection() == null || !lyr.getProjection().getAbrev().equals(viewProj.getAbrev())) { |
|
457 |
RasterToolsUtil.messageBoxInfo("different_projection", controlPanel); |
|
458 |
break; |
|
459 |
} |
|
460 |
} |
|
461 |
|
|
462 |
} |
|
463 |
|
|
464 |
if( controlPanel.getComponentID(obj) == SaveRasterPanel.PIXEL_SELECTOR || |
|
465 |
controlPanel.getComponentID(obj) == SaveRasterPanel.PRINT_SELECTOR) { |
|
466 |
calculateFileSize(); |
|
467 |
} |
|
445 | 468 |
|
446 | 469 |
this.enableButtons(); |
447 | 470 |
|
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/saveviewtoraster/ui/SaveViewToRasterDialog.java | ||
---|---|---|
112 | 112 |
public DataInputListener getDataInputListener() { |
113 | 113 |
if (listener == null) { |
114 | 114 |
listener = new DataInputListener(getSaveRasterPanel()); |
115 |
listener.setDialogPanel(this);
|
|
115 |
listener.setLayers(layers);
|
|
116 | 116 |
} |
117 | 117 |
return listener; |
118 | 118 |
} |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/resources/text.properties | ||
---|---|---|
576 | 576 |
height_cannot_be_zero=La altura no puede ser cero |
577 | 577 |
width_cannot_be_zero=El ancho no puede ser cero |
578 | 578 |
cellsize_cannot_be_zero=El tama?o de celda no puede ser cero |
579 |
wc_wrong=Coordenadas del mundo erroneas |
|
579 |
wc_wrong=Coordenadas del mundo erroneas |
|
580 |
different_projection=La vista y alguna de las capas cargadas tienen proyecciones distintas.\n Esto es un problema para obtener una escala correcta.\n Corrija este error o use la selecci?n por p?xel. |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/resources/text_en.properties | ||
---|---|---|
563 | 563 |
height_cannot_be_zero=The height cannot be zero |
564 | 564 |
width_cannot_be_zero=The width cannot be zero |
565 | 565 |
cellsize_cannot_be_zero=The cellsize cannot be zero |
566 |
wc_wrong=The world coordinates are wrong |
|
566 |
wc_wrong=The world coordinates are wrong |
|
567 |
different_projection=The view and some of the loaded layers have different projections.\n This is a problem to get a correct scale.\n Solve this problem or use the pixel selection. |
Also available in: Unified diff