Revision 12611
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/pixelinspector/PixelInspector.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing.pixelinspector; |
|
23 |
|
|
24 |
import java.awt.image.BufferedImage; |
|
25 |
|
|
26 |
/** |
|
27 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
28 |
*/ |
|
29 |
public interface PixelInspector { |
|
30 |
|
|
31 |
public void setClear(boolean clear); |
|
32 |
|
|
33 |
/** |
|
34 |
* Gets the with of the control |
|
35 |
* @return |
|
36 |
*/ |
|
37 |
public int getWidth(); |
|
38 |
|
|
39 |
/** |
|
40 |
* Gets the height of the control |
|
41 |
* @return |
|
42 |
*/ |
|
43 |
public int getHeight(); |
|
44 |
|
|
45 |
/** |
|
46 |
* Gets the scale factor |
|
47 |
* @return |
|
48 |
*/ |
|
49 |
public int getScale(); |
|
50 |
|
|
51 |
/** |
|
52 |
* Assigns view coordinates |
|
53 |
* @param pixX |
|
54 |
* @param pixY |
|
55 |
*/ |
|
56 |
public void setViewCoordinates(int pixX, int pixY); |
|
57 |
|
|
58 |
public void setDataBuffer(BufferedImage view); |
|
59 |
|
|
60 |
public BufferedImage getDataBuffer(); |
|
61 |
|
|
62 |
/** |
|
63 |
* Sets the X position of the control where the painted starts |
|
64 |
* |
|
65 |
* @param posX |
|
66 |
*/ |
|
67 |
public void setPosX(int posX); |
|
68 |
|
|
69 |
/** |
|
70 |
* Sets the Y position of the control where the painted starts |
|
71 |
* |
|
72 |
* @param posY |
|
73 |
*/ |
|
74 |
public void setPosY(int posY); |
|
75 |
|
|
76 |
/** |
|
77 |
* Repaints the control |
|
78 |
*/ |
|
79 |
public void repaint(); |
|
80 |
} |
|
0 | 81 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/BasePanel.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing; |
|
23 |
|
|
24 |
import java.awt.Component; |
|
25 |
import java.awt.event.ActionListener; |
|
26 |
import java.awt.event.KeyListener; |
|
27 |
import java.awt.event.MouseListener; |
|
28 |
import java.util.ArrayList; |
|
29 |
|
|
30 |
import javax.swing.AbstractButton; |
|
31 |
import javax.swing.JPanel; |
|
32 |
|
|
33 |
import org.slf4j.Logger; |
|
34 |
import org.slf4j.LoggerFactory; |
|
35 |
|
|
36 |
/** |
|
37 |
* Clase base para los paneles gr?ficos. |
|
38 |
* |
|
39 |
* 17/07/2008 |
|
40 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
41 |
*/ |
|
42 |
public abstract class BasePanel extends JPanel { |
|
43 |
private static final long serialVersionUID = -8877600252349334979L; |
|
44 |
private boolean enableValueChangedEvent = true; |
|
45 |
|
|
46 |
public static final int KEYLISTENER = 0; |
|
47 |
public static final int ACTIONLISTENER = 1; |
|
48 |
public static final int MOUSELISTENER = 2; |
|
49 |
private static final Logger logger = LoggerFactory.getLogger(BasePanel.class); |
|
50 |
|
|
51 |
/** |
|
52 |
* Obtiene la traducci?n de la cadena de texto |
|
53 |
* @param parent Ventana padre |
|
54 |
* @param text Cadena a traducir |
|
55 |
* @return Cadena de texto traducida |
|
56 |
*/ |
|
57 |
public String getText(Object parent, String key) { |
|
58 |
if (key == null) |
|
59 |
return null; |
|
60 |
String translation = org.gvsig.i18n.Messages.getText(key, false); |
|
61 |
if (translation != null) |
|
62 |
return translation; |
|
63 |
else { |
|
64 |
logger.debug("Can't find translation for ''{1}''.", key); |
|
65 |
return key; |
|
66 |
} |
|
67 |
} |
|
68 |
|
|
69 |
/** |
|
70 |
* Obtiene la traducci?n de la cadena de texto |
|
71 |
* @param text Cadena a traducir |
|
72 |
* @return Cadena de texto traducida |
|
73 |
*/ |
|
74 |
public String getText(String text) { |
|
75 |
return getText(this, text); |
|
76 |
} |
|
77 |
|
|
78 |
/** |
|
79 |
* Asigna el valor para la activaci?n y desactivaci?n del evento de cambio de valor en |
|
80 |
* las cajas de texto. |
|
81 |
* @param enableValueChangedEvent |
|
82 |
*/ |
|
83 |
public void setEnableValueChangedEvent(boolean enableValueChangedEvent) { |
|
84 |
this.enableValueChangedEvent = enableValueChangedEvent; |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* Obtiene el valor para la activaci?n y desactivaci?n del evento de cambio de valor en |
|
89 |
* las cajas de texto. |
|
90 |
* @param enableValueChangedEvent |
|
91 |
*/ |
|
92 |
public boolean isEnableValueChangedEvent() { |
|
93 |
return this.enableValueChangedEvent; |
|
94 |
} |
|
95 |
|
|
96 |
/** |
|
97 |
* Obtiene la lista de componentes del panel. Si dentro tiene alg?n BasePanel |
|
98 |
* consulta la lista de componentes de este y la devuelve. |
|
99 |
* @return |
|
100 |
*/ |
|
101 |
@SuppressWarnings("unchecked") |
|
102 |
public ArrayList getComponentList() { |
|
103 |
ArrayList listComp = new ArrayList(); |
|
104 |
for (int i = 0; i < this.getComponentCount(); i++) { |
|
105 |
if(getComponent(i) instanceof BasePanel) { |
|
106 |
ArrayList list = ((BasePanel)getComponent(i)).getComponentList(); |
|
107 |
for (int j = 0; j < list.size(); j++) |
|
108 |
listComp.add(list.get(j)); |
|
109 |
} else |
|
110 |
listComp.add(getComponent(i)); |
|
111 |
} |
|
112 |
return listComp; |
|
113 |
} |
|
114 |
|
|
115 |
/** |
|
116 |
* Registra un listener en todos los componentes contenidos en este panel. |
|
117 |
* @param type Tipo de listener definido por las variables est?ticas en esta clase |
|
118 |
* @param listener Objeto listener del tipo correcto |
|
119 |
*/ |
|
120 |
@SuppressWarnings("unchecked") |
|
121 |
public void registerListener(int type, Object listener) { |
|
122 |
ArrayList listComp = getComponentList(); |
|
123 |
if(type == KEYLISTENER) { |
|
124 |
if(listener instanceof KeyListener) { |
|
125 |
for (int i = 0; i < listComp.size(); i++) |
|
126 |
if(listComp.get(i) instanceof Component) |
|
127 |
((Component)listComp.get(i)).addKeyListener((KeyListener)listener); |
|
128 |
} |
|
129 |
} |
|
130 |
if(type == ACTIONLISTENER) { |
|
131 |
if(listener instanceof ActionListener) { |
|
132 |
for (int i = 0; i < listComp.size(); i++) |
|
133 |
if(listComp.get(i) instanceof AbstractButton) |
|
134 |
((AbstractButton)listComp.get(i)).addActionListener((ActionListener)listener); |
|
135 |
} |
|
136 |
} |
|
137 |
if(type == MOUSELISTENER) { |
|
138 |
if(listener instanceof MouseListener) { |
|
139 |
for (int i = 0; i < listComp.size(); i++) |
|
140 |
if(listComp.get(i) instanceof Component) |
|
141 |
((Component)listComp.get(i)).addMouseListener((MouseListener)listener); |
|
142 |
} |
|
143 |
} |
|
144 |
} |
|
145 |
|
|
146 |
/** |
|
147 |
* Traducci?n centralizada de los componentes de una panel |
|
148 |
*/ |
|
149 |
protected abstract void translate(); |
|
150 |
|
|
151 |
/** |
|
152 |
* Acciones de inicializaci?n |
|
153 |
*/ |
|
154 |
protected abstract void init(); |
|
155 |
} |
|
0 | 156 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/RasterSwingLocator.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing; |
|
23 |
|
|
24 |
import org.gvsig.tools.locator.BaseLocator; |
|
25 |
|
|
26 |
/** |
|
27 |
* This locator is the entry point for the Validation swing library, |
|
28 |
* providing access to all Validation swing services through the |
|
29 |
* {@link RasterSwingManager} . |
|
30 |
* |
|
31 |
* @author gvSIG team |
|
32 |
* @version $Id$ |
|
33 |
*/ |
|
34 |
public class RasterSwingLocator extends BaseLocator { |
|
35 |
|
|
36 |
/** |
|
37 |
* Validation swing manager name. |
|
38 |
*/ |
|
39 |
public static final String SWING_MANAGER_NAME = |
|
40 |
"Raster.swing.manager"; |
|
41 |
|
|
42 |
/** |
|
43 |
* Validation swing manager description. |
|
44 |
*/ |
|
45 |
public static final String SWING_MANAGER_DESCRIPTION = |
|
46 |
"Raster UIManager"; |
|
47 |
|
|
48 |
private static final String LOCATOR_NAME = "Raster.swing.locator"; |
|
49 |
|
|
50 |
/** |
|
51 |
* Unique instance. |
|
52 |
*/ |
|
53 |
private static final RasterSwingLocator INSTANCE = |
|
54 |
new RasterSwingLocator(); |
|
55 |
|
|
56 |
/** |
|
57 |
* Return the singleton instance. |
|
58 |
* |
|
59 |
* @return the singleton instance |
|
60 |
*/ |
|
61 |
public static RasterSwingLocator getInstance() { |
|
62 |
return INSTANCE; |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* Return the Locator's name |
|
67 |
* |
|
68 |
* @return a String with the Locator's name |
|
69 |
*/ |
|
70 |
public final String getLocatorName() { |
|
71 |
return LOCATOR_NAME; |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Registers the Class implementing the PersistenceManager interface. |
|
76 |
* |
|
77 |
* @param clazz |
|
78 |
* implementing the PersistenceManager interface |
|
79 |
*/ |
|
80 |
public static void registerSwingManager( |
|
81 |
Class<? extends RasterSwingManager> clazz) { |
|
82 |
getInstance().register(SWING_MANAGER_NAME, SWING_MANAGER_DESCRIPTION, |
|
83 |
clazz); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* Gets the instance of the {@link ScriptingUIManager} registered. |
|
88 |
* |
|
89 |
* @return {@link ScriptingUIManager} |
|
90 |
*/ |
|
91 |
public static RasterSwingManager getSwingManager() { |
|
92 |
return (RasterSwingManager) getInstance() |
|
93 |
.get(SWING_MANAGER_NAME); |
|
94 |
} |
|
95 |
|
|
96 |
} |
|
0 | 97 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/RasterSwingLibrary.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing; |
|
23 |
|
|
24 |
import java.awt.Component; |
|
25 |
import java.util.List; |
|
26 |
|
|
27 |
import javax.swing.JOptionPane; |
|
28 |
|
|
29 |
import org.gvsig.i18n.Messages; |
|
30 |
import org.gvsig.tools.library.AbstractLibrary; |
|
31 |
import org.gvsig.tools.library.LibraryException; |
|
32 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
33 |
import org.slf4j.LoggerFactory; |
|
34 |
|
|
35 |
/** |
|
36 |
* Library for Swing API initialization and configuration. |
|
37 |
* |
|
38 |
* @author gvSIG team |
|
39 |
* @version $Id$ |
|
40 |
*/ |
|
41 |
public class RasterSwingLibrary extends AbstractLibrary { |
|
42 |
|
|
43 |
@Override |
|
44 |
protected void doInitialize() throws LibraryException { |
|
45 |
// Do nothing |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
protected void doPostInitialize() throws LibraryException { |
|
50 |
// Validate there is any implementation registered. |
|
51 |
RasterSwingManager manager = |
|
52 |
RasterSwingLocator.getSwingManager(); |
|
53 |
if (manager == null) { |
|
54 |
throw new ReferenceNotRegisteredException( |
|
55 |
RasterSwingLocator.SWING_MANAGER_NAME, |
|
56 |
RasterSwingLocator.getInstance()); |
|
57 |
} |
|
58 |
} |
|
59 |
|
|
60 |
public static boolean messageBoxYesOrNot(String msg, Object parentWindow){ |
|
61 |
String string1 = Messages.getText("yes"); |
|
62 |
String string2 = Messages.getText("no"); |
|
63 |
Object[] options = {string1, string2}; |
|
64 |
Component parent = null; |
|
65 |
if(parentWindow instanceof Component) |
|
66 |
parent = (Component)parentWindow; |
|
67 |
int n = JOptionPane.showOptionDialog(parent, |
|
68 |
"<html>" + Messages.getText(msg).replaceAll("\n", "<br>") + "</html>", |
|
69 |
Messages.getText("confirmacion"), |
|
70 |
JOptionPane.YES_NO_OPTION, |
|
71 |
JOptionPane.QUESTION_MESSAGE, |
|
72 |
null, |
|
73 |
options, |
|
74 |
string1); |
|
75 |
if (n == JOptionPane.YES_OPTION) |
|
76 |
return true; |
|
77 |
else |
|
78 |
return false; |
|
79 |
} |
|
80 |
|
|
81 |
public static void messageBoxError(String msg, Object parentWindow) { |
|
82 |
String string = Messages.getText("accept"); |
|
83 |
Object[] options = {string}; |
|
84 |
Component parent = null; |
|
85 |
if(parentWindow instanceof Component) |
|
86 |
parent = (Component)parentWindow; |
|
87 |
JOptionPane.showOptionDialog(parent, |
|
88 |
"<html>" + Messages.getText(msg).replaceAll("\n", "<br>") + "</html>", |
|
89 |
Messages.getText("confirmacion"), |
|
90 |
JOptionPane.OK_OPTION, |
|
91 |
JOptionPane.ERROR_MESSAGE, |
|
92 |
null, |
|
93 |
options, |
|
94 |
string); |
|
95 |
} |
|
96 |
|
|
97 |
public static void messageBoxInfo(String msg, Object parentWindow) { |
|
98 |
String string = Messages.getText("accept"); |
|
99 |
Object[] options = {string}; |
|
100 |
Component parent = null; |
|
101 |
if(parentWindow instanceof Component) |
|
102 |
parent = (Component)parentWindow; |
|
103 |
JOptionPane.showOptionDialog(parent, |
|
104 |
"<html>" + Messages.getText(msg).replaceAll("\n", "<br>") + "</html>", |
|
105 |
Messages.getText("confirmacion"), |
|
106 |
JOptionPane.OK_OPTION, |
|
107 |
JOptionPane.INFORMATION_MESSAGE, |
|
108 |
null, |
|
109 |
options, |
|
110 |
string); |
|
111 |
} |
|
112 |
|
|
113 |
public static void debug(String msg, Object parent, Exception exception) { |
|
114 |
if(parent != null) |
|
115 |
LoggerFactory |
|
116 |
.getLogger(parent.getClass()).debug(Messages.getText(msg), exception); |
|
117 |
} |
|
118 |
|
|
119 |
public static void messageBoxError(String msg, Object parentWindow, Exception exception) { |
|
120 |
debug(msg, parentWindow, exception); |
|
121 |
messageBoxError(msg, parentWindow); |
|
122 |
} |
|
123 |
|
|
124 |
public static void messageBoxError(String msg, Object parentWindow, List<Exception> exception) { |
|
125 |
for (int i = 0; i < exception.size(); i++) |
|
126 |
debug(msg, parentWindow, exception.get(i)); |
|
127 |
messageBoxError(msg, parentWindow); |
|
128 |
} |
|
129 |
|
|
130 |
public static void messageBoxInfo(String msg, Object parentWindow, Exception exception) { |
|
131 |
debug(msg, parentWindow, exception); |
|
132 |
messageBoxInfo(msg, parentWindow); |
|
133 |
} |
|
134 |
|
|
135 |
public static boolean messageBoxYesOrNot(String msg, Object parentWindow, Exception exception) { |
|
136 |
debug(msg, parentWindow, exception); |
|
137 |
return messageBoxYesOrNot(msg, parentWindow); |
|
138 |
} |
|
139 |
|
|
140 |
} |
|
0 | 141 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/preview/DataSourcePreview.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing.preview; |
|
23 |
|
|
24 |
import java.awt.Graphics2D; |
|
25 |
import java.awt.geom.Rectangle2D; |
|
26 |
import java.awt.image.BufferedImage; |
|
27 |
|
|
28 |
import org.gvsig.gui.beans.imagenavigator.ImageUnavailableException; |
|
29 |
import org.gvsig.tools.task.Cancellable; |
|
30 |
|
|
31 |
/** |
|
32 |
* Data source for the raster preview |
|
33 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
34 |
*/ |
|
35 |
@SuppressWarnings("deprecation") |
|
36 |
public interface DataSourcePreview { |
|
37 |
|
|
38 |
public void draw(BufferedImage image, Graphics2D g, double[] coords, int w, int h, Cancellable cancel, double scale) throws ImageUnavailableException; |
|
39 |
|
|
40 |
public Rectangle2D getBBoxRectangle(); |
|
41 |
|
|
42 |
public double getCellSize(); |
|
43 |
|
|
44 |
public void closePreviewLayer(); |
|
45 |
|
|
46 |
public void pushStatus(); |
|
47 |
|
|
48 |
public void popStatus(); |
|
49 |
|
|
50 |
public DataSourcePreview cloneDataSourcePreview(); |
|
51 |
|
|
52 |
public Object getSource(); |
|
53 |
} |
|
0 | 54 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/preview/PreviewRenderProcess.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing.preview; |
|
23 |
|
|
24 |
import org.gvsig.gui.beans.imagenavigator.ImageUnavailableException; |
|
25 |
|
|
26 |
/** |
|
27 |
* Interfaz para el procesado del rendering antes de dibujar la preview. |
|
28 |
* El cliente puede obtener la lista de filtros del rendering de la imagen |
|
29 |
* que va a dibujarse como preview y modificarla para visulizar la preview |
|
30 |
* modificada. En caso de no modificar la preview se ver? la imagen sin variaciones |
|
31 |
* con respecto a la original. |
|
32 |
* |
|
33 |
* 19/02/2008 |
|
34 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
35 |
*/ |
|
36 |
public interface PreviewRenderProcess { |
|
37 |
|
|
38 |
/** |
|
39 |
* Procesado del rendering |
|
40 |
* @param rendering |
|
41 |
* @throws ImageUnavailable Cuando se ha producido un error y hay que mostrar un mensaje en la |
|
42 |
* previsualizaci?n porque no se puede mostrar la imagen |
|
43 |
*/ |
|
44 |
public void process(DataSourcePreview lyr) throws ImageUnavailableException; |
|
45 |
|
|
46 |
/** |
|
47 |
* Obtiene el flag que informa de si se est? mostrando la previsualizaci?n o no. |
|
48 |
* En caso de no mostrarse deber?a lanzarse una excepci?n ImageUnavailableExcepcion al |
|
49 |
* hacer un process. |
|
50 |
* @return |
|
51 |
*/ |
|
52 |
public boolean isShowPreview(); |
|
53 |
|
|
54 |
/** |
|
55 |
* Asigna el flag para mostrar u ocultar la preview. En caso de no mostrarse deber?a lanzarse una |
|
56 |
* excepci?n ImageUnavailableExcepcion cuando se hace un process. |
|
57 |
* @param showPreview |
|
58 |
*/ |
|
59 |
public void setShowPreview(boolean showPreview); |
|
60 |
} |
|
0 | 61 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/preview/PreviewPanel.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing.preview; |
|
23 |
|
|
24 |
import java.awt.Dimension; |
|
25 |
|
|
26 |
import javax.swing.JTabbedPane; |
|
27 |
|
|
28 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
|
29 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
|
30 |
import org.gvsig.gui.beans.imagenavigator.ImageNavigator; |
|
31 |
|
|
32 |
/** |
|
33 |
* Base interface for panels with preview |
|
34 |
* |
|
35 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
36 |
*/ |
|
37 |
public interface PreviewPanel { |
|
38 |
|
|
39 |
/** |
|
40 |
* Gets the data source of the preview |
|
41 |
* @return |
|
42 |
*/ |
|
43 |
public DataSourcePreview getDataSourcePreview(); |
|
44 |
|
|
45 |
/** |
|
46 |
* Obtiene el componente con los tabs donde se a?aden las pesta?as del usuario. |
|
47 |
* @return JTabbedPane |
|
48 |
*/ |
|
49 |
public JTabbedPane getTabbedPane(); |
|
50 |
|
|
51 |
/** |
|
52 |
* Obtener el objeto <code>ButtonsPanel</code> del <code>DialogPanel</code>. |
|
53 |
* En caso de no estar creado, lo crear?. |
|
54 |
* |
|
55 |
* @return El componente bp |
|
56 |
*/ |
|
57 |
public ButtonsPanel getButtonsPanel(); |
|
58 |
|
|
59 |
/** |
|
60 |
* Devuelve el componente para la vista previa |
|
61 |
* @return |
|
62 |
*/ |
|
63 |
public ImageNavigator getImageNavigator(); |
|
64 |
|
|
65 |
/** |
|
66 |
* Preview refresh |
|
67 |
*/ |
|
68 |
public void refreshPreview(); |
|
69 |
|
|
70 |
public void addButtonPressedListener(ButtonsPanelListener listener); |
|
71 |
|
|
72 |
/** |
|
73 |
* Sets the size of the preview |
|
74 |
* @param dimension |
|
75 |
*/ |
|
76 |
public void setPreviewSize(Dimension dimension); |
|
77 |
|
|
78 |
/** |
|
79 |
* Sets the data source for the preview. |
|
80 |
* |
|
81 |
* @param layer |
|
82 |
*/ |
|
83 |
public void setLayer(DataSourcePreview fLayer); |
|
84 |
|
|
85 |
/** |
|
86 |
* Initializes the preview size and coordinates. This function should |
|
87 |
* be called after the window has been opened because this call |
|
88 |
* assigns the size of the preview panel. |
|
89 |
* |
|
90 |
* @param layer |
|
91 |
*/ |
|
92 |
public void previewInitializeSizes(); |
|
93 |
|
|
94 |
/** |
|
95 |
* Cierra la capa abierta para previsualizaci?n |
|
96 |
*/ |
|
97 |
public void closePreviewLayer(); |
|
98 |
} |
|
0 | 99 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/preview/PreviewBasePanelTab.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing.preview; |
|
23 |
|
|
24 |
import javax.swing.JPanel; |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* Interfaz que implementan los paneles que se incorporan al PreviewBasePanel |
|
29 |
* |
|
30 |
* 19/02/2008 |
|
31 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
32 |
*/ |
|
33 |
public interface PreviewBasePanelTab { |
|
34 |
/** |
|
35 |
* Obtiene el t?tulo del panel. Esta ser? la etiqueta que se ponga en |
|
36 |
* la pesta?a del tab. |
|
37 |
* @return Cadena con el t?tulo. |
|
38 |
*/ |
|
39 |
public String getTitle(); |
|
40 |
|
|
41 |
/** |
|
42 |
* Obtiene el panel que se a?ade en el tab |
|
43 |
* @return JPanel |
|
44 |
*/ |
|
45 |
public JPanel getPanel(); |
|
46 |
} |
|
0 | 47 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/slider/SliderEvent.java | ||
---|---|---|
1 |
package org.gvsig.raster.swing.slider; |
|
2 |
|
|
3 |
import java.util.EventObject; |
|
4 |
|
|
5 |
public class SliderEvent extends EventObject { |
|
6 |
private static final long serialVersionUID = -128111523373280522L; |
|
7 |
|
|
8 |
/** |
|
9 |
* Construye un SliderEvent |
|
10 |
* @param source |
|
11 |
*/ |
|
12 |
public SliderEvent(Object source) { |
|
13 |
super(source); |
|
14 |
} |
|
15 |
} |
|
0 | 16 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/slider/SliderText.java | ||
---|---|---|
1 |
package org.gvsig.raster.swing.slider; |
|
2 |
|
|
3 |
import javax.swing.JComponent; |
|
4 |
|
|
5 |
import org.gvsig.gui.beans.slidertext.listeners.SliderListener; |
|
6 |
|
|
7 |
public interface SliderText { |
|
8 |
|
|
9 |
/** |
|
10 |
* Adds a listener to receive changes in this component |
|
11 |
* @param listener |
|
12 |
*/ |
|
13 |
public void addValueChangedListener(SliderListener listener); |
|
14 |
|
|
15 |
/** |
|
16 |
* Obtiene el valor del control. |
|
17 |
* @return Valor del control en formato double. |
|
18 |
*/ |
|
19 |
public double getValue(); |
|
20 |
|
|
21 |
/** |
|
22 |
* Asigna el valor del control. |
|
23 |
* @return Valor del control en formato double. |
|
24 |
*/ |
|
25 |
public void setValue(double value); |
|
26 |
|
|
27 |
/** |
|
28 |
* Activa o desactiva el control del panel |
|
29 |
* @param active |
|
30 |
*/ |
|
31 |
public void setControlEnabled(boolean active); |
|
32 |
|
|
33 |
/** |
|
34 |
* Asigna el flag que dice si el valor del campo de texto ser? |
|
35 |
* decimal o entero |
|
36 |
* @param dec true si se admiten valores decimales y false si no se admiten |
|
37 |
*/ |
|
38 |
public void setDecimal (boolean dec); |
|
39 |
|
|
40 |
/** |
|
41 |
* Obtiene el flag que dice si el valor del campo de texto es |
|
42 |
* decimal o entero |
|
43 |
* @return true si se admiten valores decimales y false si no se admiten |
|
44 |
*/ |
|
45 |
public boolean getDecimal (); |
|
46 |
|
|
47 |
/** |
|
48 |
* Obtiene el valor m?ximo del slider |
|
49 |
* @return Entero con el valor m?ximo |
|
50 |
*/ |
|
51 |
public int getMax(); |
|
52 |
|
|
53 |
/** |
|
54 |
* Asigna el valor m?ximo del slider |
|
55 |
* @param Entero con el valor m?ximo |
|
56 |
*/ |
|
57 |
public void setMaximum(int max); |
|
58 |
|
|
59 |
/** |
|
60 |
* Obtiene el valor m?nimo del slider |
|
61 |
* @return Entero con el valor m?nimo |
|
62 |
*/ |
|
63 |
public int getMin(); |
|
64 |
|
|
65 |
/** |
|
66 |
* Asigna el valor m?nimo del slider |
|
67 |
* @param Entero con el valor m?nimo |
|
68 |
*/ |
|
69 |
public void setMinimum(int min); |
|
70 |
|
|
71 |
/** |
|
72 |
* Definir un intervalo para el slider |
|
73 |
* @param value |
|
74 |
*/ |
|
75 |
public void setInterval(double value); |
|
76 |
|
|
77 |
/** |
|
78 |
* Obtener el intervalo definido para el slider |
|
79 |
* @return |
|
80 |
*/ |
|
81 |
public double getInterval(); |
|
82 |
|
|
83 |
/** |
|
84 |
* Asigna un borde al componente con el texto pasado como |
|
85 |
* par?metro |
|
86 |
* @param name |
|
87 |
*/ |
|
88 |
public void setBorder(String name); |
|
89 |
|
|
90 |
public JComponent getComponent(); |
|
91 |
} |
|
0 | 92 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/slider/SliderListener.java | ||
---|---|---|
1 |
package org.gvsig.raster.swing.slider; |
|
2 |
|
|
3 |
import java.util.EventListener; |
|
4 |
|
|
5 |
public interface SliderListener extends EventListener { |
|
6 |
/** |
|
7 |
* Evento que se dispara cuando cambia el valor del componente. Nunca |
|
8 |
* se dispara mientras se hace un dragged con el rat?n. |
|
9 |
* @param e |
|
10 |
*/ |
|
11 |
public void actionValueChanged(SliderEvent e); |
|
12 |
|
|
13 |
/** |
|
14 |
* Evento que se dispara cuando cambia el valor del componente mientras se |
|
15 |
* hace un dragged con el rat?n. |
|
16 |
* @param e |
|
17 |
*/ |
|
18 |
public void actionValueDragged(SliderEvent e); |
|
19 |
} |
|
0 | 20 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/gcanvas/GCanvasEvent.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing.gcanvas; |
|
23 |
|
|
24 |
import java.util.EventObject; |
|
25 |
/** |
|
26 |
* Clase que contiene la informaci?n que se produce al dispararse un evento |
|
27 |
* en el GCanvas |
|
28 |
* |
|
29 |
* @version 28/02/2008 |
|
30 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
31 |
*/ |
|
32 |
public class GCanvasEvent extends EventObject { |
|
33 |
private static final long serialVersionUID = 1654248992170060578L; |
|
34 |
private String key; |
|
35 |
private Object value; |
|
36 |
|
|
37 |
public GCanvasEvent(Object source, String key, Object value) { |
|
38 |
super(source); |
|
39 |
this.key = key; |
|
40 |
this.value = value; |
|
41 |
} |
|
42 |
|
|
43 |
/** |
|
44 |
* @return the key |
|
45 |
*/ |
|
46 |
public String getKey() { |
|
47 |
return key; |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* @return the value |
|
52 |
*/ |
|
53 |
public Object getValue() { |
|
54 |
return value; |
|
55 |
} |
|
56 |
} |
|
0 | 57 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/gcanvas/MinMaxLines.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing.gcanvas; |
|
23 |
|
|
24 |
/** |
|
25 |
* Graphic layer to paint a two lines with the maximum and the minumun |
|
26 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
27 |
*/ |
|
28 |
public abstract class MinMaxLines extends DrawableElement { |
|
29 |
public abstract void setMinimum(double min); |
|
30 |
|
|
31 |
public abstract void setMaximum(double max); |
|
32 |
} |
|
0 | 33 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/gcanvas/InfoLayer.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing.gcanvas; |
|
23 |
|
|
24 |
/** |
|
25 |
* Graphic layer to paint a layer of information |
|
26 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
27 |
*/ |
|
28 |
public abstract class InfoLayer extends DrawableElement { |
|
29 |
/** |
|
30 |
* Sets the maximum and minimum values for this layer |
|
31 |
* @param min |
|
32 |
* @param max |
|
33 |
*/ |
|
34 |
public abstract void setLimits(double min, double max); |
|
35 |
} |
|
0 | 36 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/gcanvas/LogaritmicExponentialLine.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing.gcanvas; |
|
23 |
|
|
24 |
/** |
|
25 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
26 |
*/ |
|
27 |
public interface LogaritmicExponentialLine extends BaseFunction { |
|
28 |
/** |
|
29 |
* Devuelve si esta usando la funcion logaritmica |
|
30 |
* @return |
|
31 |
*/ |
|
32 |
public boolean isLogaritmical(); |
|
33 |
|
|
34 |
/** |
|
35 |
* Devuelve si esta usando la funcion exponencial |
|
36 |
* @return |
|
37 |
*/ |
|
38 |
public boolean isExponencial(); |
|
39 |
} |
|
0 | 40 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/gcanvas/DrawableElement.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing.gcanvas; |
|
23 |
|
|
24 |
import java.awt.Color; |
|
25 |
import java.awt.Graphics; |
|
26 |
import java.awt.event.MouseEvent; |
|
27 |
/** |
|
28 |
* Clase base para los gr?ficos a dibujar sobre el canvas |
|
29 |
* |
|
30 |
* 14-oct-2007 |
|
31 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
32 |
*/ |
|
33 |
public abstract class DrawableElement { |
|
34 |
protected Color color = Color.BLACK; |
|
35 |
private boolean firstDraw = true; |
|
36 |
private boolean drawing = true; |
|
37 |
|
|
38 |
/** |
|
39 |
* Entorno donde se dibuja |
|
40 |
*/ |
|
41 |
protected GCanvas canvas = null; |
|
42 |
|
|
43 |
/** |
|
44 |
* Dibujado del elemento gr?fico desde el GCanvas. Llamar? antes de dibujar a |
|
45 |
* la funci?n firstDrawActions |
|
46 |
* @param g |
|
47 |
*/ |
|
48 |
public void draw(Graphics g) { |
|
49 |
if(!drawing) |
|
50 |
return; |
|
51 |
if (firstDraw) { |
|
52 |
firstDrawActions(); |
|
53 |
firstDraw = false; |
|
54 |
} |
|
55 |
paint(g); |
|
56 |
} |
|
57 |
|
|
58 |
/** |
|
59 |
* Asigna el flag de dibujado del elemento gr?fico |
|
60 |
* @param draw |
|
61 |
*/ |
|
62 |
public void setDrawing(boolean drawing) { |
|
63 |
this.drawing = drawing; |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* Obtiene el flag que informa si el elemento gr?fico est? dibujandose |
|
68 |
* o no. |
|
69 |
* @return |
|
70 |
*/ |
|
71 |
public boolean isDrawing() { |
|
72 |
return this.drawing; |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* Dibujado del elemento gr?fico |
|
77 |
* @param g |
|
78 |
*/ |
|
79 |
protected abstract void paint(Graphics g); |
|
80 |
|
|
81 |
/** |
|
82 |
* Acciones a ejecutar al asignar el canvas |
|
83 |
*/ |
|
84 |
public abstract void firstActions(); |
|
85 |
|
|
86 |
/** |
|
87 |
* Acciones a ejecutar antes del primer dibujado |
|
88 |
*/ |
|
89 |
public abstract void firstDrawActions(); |
|
90 |
|
|
91 |
/** |
|
92 |
* Asigna el objeto JComponent donde se pintan los elementos. |
|
93 |
* @param canvas |
|
94 |
*/ |
|
95 |
public void setCanvas(GCanvas canvas) { |
|
96 |
this.canvas = canvas; |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* Asigna el color de la l?nea |
|
101 |
* @param c Color |
|
102 |
*/ |
|
103 |
public void setColor(Color c) { |
|
104 |
this.color = c; |
|
105 |
} |
|
106 |
|
|
107 |
/** |
|
108 |
* Obtiene el color de la l?nea |
|
109 |
* @param c Color |
|
110 |
*/ |
|
111 |
public Color getColor() { |
|
112 |
return this.color; |
|
113 |
} |
|
114 |
|
|
115 |
/** |
|
116 |
* Metodo que se ejecuta cuando se suelta el raton en el canvas |
|
117 |
* @param e |
|
118 |
* @return Si no se desea propagar el evento a otros drawables, devolver false. |
|
119 |
*/ |
|
120 |
public boolean mouseReleased(MouseEvent e) { |
|
121 |
return true; |
|
122 |
} |
|
123 |
|
|
124 |
/** |
|
125 |
* Metodo que se ejecuta cuando se presiona el raton en el canvas |
|
126 |
* @param e |
|
127 |
* @return Si no se desea propagar el evento a otros drawables, devolver false. |
|
128 |
*/ |
|
129 |
public boolean mousePressed(MouseEvent e) { |
|
130 |
return true; |
|
131 |
} |
|
132 |
|
|
133 |
/** |
|
134 |
* Metodo que se ejecuta cuando se esta dibujando con el raton en el canvas |
|
135 |
* @param e |
|
136 |
* @return Si no se desea propagar el evento a otros drawables, devolver false. |
|
137 |
*/ |
|
138 |
public boolean mouseDragged(MouseEvent e) { |
|
139 |
return true; |
|
140 |
} |
|
141 |
|
|
142 |
/** |
|
143 |
* Metodo que se ejecuta cuando se esta moviendo el raton sobre el canvas |
|
144 |
* @param e |
|
145 |
* @return Si no se desea propagar el evento a otros drawables, devolver false. |
|
146 |
*/ |
|
147 |
public boolean mouseMoved(MouseEvent e) { |
|
148 |
return true; |
|
149 |
} |
|
150 |
|
|
151 |
/** |
|
152 |
* Metodo que se ejecuta cuando entra el raton al canvas |
|
153 |
* @param e |
|
154 |
* @return |
|
155 |
*/ |
|
156 |
public boolean mouseEntered(MouseEvent e) { |
|
157 |
return true; |
|
158 |
} |
|
159 |
|
|
160 |
/** |
|
161 |
* Metodo que se ejecuta cuando sale el raton del canvas |
|
162 |
* @param e |
|
163 |
* @return |
|
164 |
*/ |
|
165 |
public boolean mouseExited(MouseEvent e) { |
|
166 |
return true; |
|
167 |
} |
|
168 |
} |
|
0 | 169 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/gcanvas/GraphicHistogram.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing.gcanvas; |
|
23 |
|
|
24 |
/** |
|
25 |
* Graphic layer to paint a histogram |
|
26 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
27 |
*/ |
|
28 |
public abstract class GraphicHistogram extends DrawableElement { |
|
29 |
public static final int TYPE_LINE = 1; |
|
30 |
public static final int TYPE_FILL = 2; |
|
31 |
|
|
32 |
public static final int VIEW_LINEAL = 0; |
|
33 |
public static final int VIEW_ACUMMULATED = 1; |
|
34 |
public static final int VIEW_LOGARITHMIC = 2; |
|
35 |
public static final int VIEW_ACUMMULATEDLOG = 3; |
|
36 |
|
|
37 |
public static final int FUNCTION_NONE = -1; |
|
38 |
public static final int FUNCTION_LINEAL = 0; |
|
39 |
public static final int FUNCTION_GAUSS = 1; |
|
40 |
public static final int FUNCTION_EXPONENT = 2; |
|
41 |
public static final int FUNCTION_LOGARIT = 3; |
|
42 |
public static final int FUNCTION_SQUARE_ROOT = 4; |
|
43 |
public static final int EQUALIZATION = 5; |
|
44 |
public static final int FUNCTION_DENSITY = 6; |
|
45 |
|
|
46 |
/** |
|
47 |
* Asigna el tipo de gr?fica a mostrar. El tipo de gr?fica est? definida por las constantes TYPE |
|
48 |
* definidas en esta clase. Por defecto siempre se muestra el tipo LINE |
|
49 |
* @param type |
|
50 |
*/ |
|
51 |
public abstract void setType(int type); |
|
52 |
|
|
53 |
/** |
|
54 |
* Asigna el histograma a visualizar |
|
55 |
* @param histogramDrawed |
|
56 |
*/ |
|
57 |
public abstract void setHistogramDrawed(double[] histogramDrawed); |
|
58 |
|
|
59 |
/** |
|
60 |
* Asigna el tipo de vista para el histograma a mostrar. No hace un repintado |
|
61 |
* @param type |
|
62 |
*/ |
|
63 |
public abstract void setTypeViewed(int type); |
|
64 |
|
|
65 |
/** |
|
66 |
* Devuelve la forma en la que se dibujara el histograma. Posibilidades:<br> |
|
67 |
* TYPE_LINE<br> |
|
68 |
* TYPE_FILL |
|
69 |
* @return the type |
|
70 |
*/ |
|
71 |
public abstract int getType(); |
|
72 |
|
|
73 |
/** |
|
74 |
* Devuelve la forma que tendr? la grafica del histograma. Posibilidades:<br> |
|
75 |
* VIEW_LINEAL<br> |
|
76 |
* VIEW_ACUMMULATED<br> |
|
77 |
* VIEW_LOGARITHMIC<br> |
|
78 |
* VIEW_ACUMMULATEDLOG<br> |
|
79 |
* |
|
80 |
* @return the typeViewed |
|
81 |
*/ |
|
82 |
public abstract int getTypeViewed(); |
|
83 |
} |
|
0 | 84 |
org.gvsig.raster/tags/org.gvsig.raster-2.2.133/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/gcanvas/StraightLine.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.swing.gcanvas; |
|
23 |
|
|
24 |
|
|
25 |
/** |
|
26 |
* Graphic layer to paint a straight line |
|
27 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
28 |
*/ |
|
29 |
public interface StraightLine extends BaseFunction { |
|
30 |
/** |
|
31 |
* En una funci?n lineal da igual lo que devuelva, pero es interesante para sus |
|
32 |
* clases derivadas |
|
33 |
* @return |
|
34 |
*/ |
|
35 |
public double getValueFunction(); |
|
36 |
|
|
37 |
/** |
|
38 |
* Borra la lista de puntos |
Also available in: Unified diff