Revision 4386
trunk/libraries/libCq CMS for java.old/src/org/cresques/ui/raster/TransparencyByPixelPanel.java | ||
---|---|---|
98 | 98 |
gridBagConstraints3.insets = new java.awt.Insets(0,0,0,0); |
99 | 99 |
pEast = new JPanel(); |
100 | 100 |
pEast.setLayout(new GridBagLayout()); |
101 |
pEast.setPreferredSize(new java.awt.Dimension(190,110));
|
|
101 |
pEast.setPreferredSize(new java.awt.Dimension(170,110));
|
|
102 | 102 |
pEast.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); |
103 | 103 |
pEast.add(getJList(), gridBagConstraints3); |
104 | 104 |
} |
trunk/libraries/libCq CMS for java.old/src/org/cresques/ui/raster/RasterTransparencyPanel.java | ||
---|---|---|
33 | 33 |
import javax.swing.JPanel; |
34 | 34 |
import javax.swing.JSlider; |
35 | 35 |
import javax.swing.JTextField; |
36 |
import java.awt.Insets; |
|
36 | 37 |
|
37 | 38 |
|
38 | 39 |
/** |
... | ... | |
67 | 68 |
private JTextField tOpacidad = null; |
68 | 69 |
|
69 | 70 |
private TransparencyByPixelPanel pTranspByPixel = null; |
71 |
|
|
72 |
private JPanel pTransparencyByPixel = null; |
|
70 | 73 |
|
71 | 74 |
/** |
72 | 75 |
* Constructor. Asigna la variable panel que contiene este |
... | ... | |
130 | 133 |
*/ |
131 | 134 |
private JPanel getJPanel() { |
132 | 135 |
if (jPanel == null) { |
133 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
|
134 |
gridBagConstraints.gridx = 0; |
|
135 |
gridBagConstraints.gridy = 1;
|
|
136 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
|
|
137 |
gridBagConstraints1.gridx = 0;
|
|
138 |
gridBagConstraints1.gridy = 0;
|
|
136 | 139 |
GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); |
137 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
|
138 | 140 |
jPanel = new JPanel(); |
139 | 141 |
jPanel.setLayout(new GridBagLayout()); |
140 |
gridBagConstraints5.fill = java.awt.GridBagConstraints.NONE; |
|
141 |
gridBagConstraints5.gridy = 0; |
|
142 |
gridBagConstraints5.gridx = 0; |
|
143 |
gridBagConstraints5.ipady = 0; |
|
144 |
gridBagConstraints5.gridheight = 1; |
|
145 |
gridBagConstraints5.gridwidth = 0; |
|
146 |
gridBagConstraints5.anchor = java.awt.GridBagConstraints.WEST; |
|
147 |
gridBagConstraints5.insets = new java.awt.Insets(0,0,5,0); |
|
148 | 142 |
gridBagConstraints7.gridwidth = 1; |
149 | 143 |
gridBagConstraints7.gridy = 2; |
150 | 144 |
gridBagConstraints7.gridx = 0; |
151 | 145 |
gridBagConstraints7.insets = new java.awt.Insets(5,0,0,0); |
152 | 146 |
jPanel.setPreferredSize(new java.awt.Dimension(333, 113)); |
153 |
jPanel.add(getJPanel1(), gridBagConstraints5); |
|
154 |
jPanel.add(getPTranspByPixel(), gridBagConstraints); |
|
155 | 147 |
jPanel.add(getJPanel4(), gridBagConstraints7); |
148 |
jPanel.add(getPTransparencyByPixel(), gridBagConstraints1); |
|
156 | 149 |
} |
157 | 150 |
|
158 | 151 |
return jPanel; |
... | ... | |
168 | 161 |
jPanel1 = new JPanel(); |
169 | 162 |
jPanel1.setLayout(new BorderLayout()); |
170 | 163 |
jPanel1.setPreferredSize(new java.awt.Dimension(415,25)); |
171 |
jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
|
|
164 |
jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,0,0,0));
|
|
172 | 165 |
jPanel1.add(getTransparencyCheck(), java.awt.BorderLayout.NORTH); |
173 | 166 |
} |
174 | 167 |
|
... | ... | |
331 | 324 |
if (pTranspByPixel == null) { |
332 | 325 |
pTranspByPixel = new TransparencyByPixelPanel(); |
333 | 326 |
pTranspByPixel.setPreferredSize(new java.awt.Dimension(415,128)); |
334 |
pTranspByPixel.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
|
|
327 |
pTranspByPixel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,0,0,0));
|
|
335 | 328 |
pTranspByPixel.setControlEnabled(false); |
336 | 329 |
} |
337 | 330 |
return pTranspByPixel; |
338 | 331 |
} |
332 |
|
|
333 |
/** |
|
334 |
* This method initializes jPanel2 |
|
335 |
* |
|
336 |
* @return javax.swing.JPanel |
|
337 |
*/ |
|
338 |
private JPanel getPTransparencyByPixel() { |
|
339 |
if (pTransparencyByPixel == null) { |
|
340 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
|
341 |
gridBagConstraints.gridx = -1; |
|
342 |
gridBagConstraints.gridy = -1; |
|
343 |
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
|
344 |
gridBagConstraints2.anchor = GridBagConstraints.WEST; |
|
345 |
gridBagConstraints2.insets = new Insets(0, 0, 5, 0); |
|
346 |
gridBagConstraints2.gridheight = 1; |
|
347 |
gridBagConstraints2.gridwidth = 0; |
|
348 |
gridBagConstraints2.gridx = -1; |
|
349 |
gridBagConstraints2.gridy = -1; |
|
350 |
gridBagConstraints2.ipady = 0; |
|
351 |
gridBagConstraints2.fill = GridBagConstraints.NONE; |
|
352 |
pTransparencyByPixel = new JPanel(); |
|
353 |
pTransparencyByPixel.setLayout(new GridBagLayout()); |
|
354 |
pTransparencyByPixel.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1)); |
|
355 |
pTransparencyByPixel.add(getJPanel1(), gridBagConstraints2); |
|
356 |
pTransparencyByPixel.add(getPTranspByPixel(), gridBagConstraints); |
|
357 |
} |
|
358 |
return pTransparencyByPixel; |
|
359 |
} |
|
339 | 360 |
} // @jve:decl-index=0:visual-constraint="36,15" |
trunk/libraries/libCq CMS for java.old/src/org/cresques/ui/raster/TransparencyByPixelListener.java | ||
---|---|---|
54 | 54 |
entry.setGreen(rgbInputPanel.getRangeGreen()); |
55 | 55 |
entry.setBlue(rgbInputPanel.getRangeBlue()); |
56 | 56 |
|
57 |
String textR = rgbInputPanel.getTRed().getText(); |
|
58 |
if(textR.equals("")) |
|
59 |
textR = "*"; |
|
60 |
String textG = rgbInputPanel.getTGreen().getText(); |
|
61 |
if(textG.equals("")) |
|
62 |
textG = "*"; |
|
63 |
String textB = rgbInputPanel.getTBlue().getText(); |
|
64 |
if(textB.equals("")) |
|
65 |
textB = "*"; |
|
57 | 66 |
if(andRb.isSelected()){ |
58 |
entry.setStrEntry("("+rgbInputPanel.getTRed().getText()+") & ("+rgbInputPanel.getTGreen().getText()+") & ("+rgbInputPanel.getTBlue().getText()+")");
|
|
67 |
entry.setStrEntry(textR+" & "+textG+" & "+textB);
|
|
59 | 68 |
entry.setAnd(true); |
60 | 69 |
} |
61 | 70 |
|
62 | 71 |
if(orRb.isSelected()){ |
63 |
entry.setStrEntry("("+rgbInputPanel.getTRed().getText()+") | ("+rgbInputPanel.getTGreen().getText()+") | ("+rgbInputPanel.getTBlue().getText()+")");
|
|
72 |
entry.setStrEntry(textR+" | "+textG+" | "+textB);
|
|
64 | 73 |
entry.setAnd(false); |
65 | 74 |
} |
66 | 75 |
panel.getListModel().addElement(entry.getStrEntry()); |
... | ... | |
87 | 96 |
orRb.setSelected(false); |
88 | 97 |
} |
89 | 98 |
|
99 |
for(int i=0;i<s.length;i++){ |
|
100 |
if(s[i].equals("*")) |
|
101 |
s[i] = ""; |
|
102 |
} |
|
103 |
|
|
90 | 104 |
if(s.length == 3){ |
91 |
rgbInputPanel.getTRed().setText(s[0].substring(1,s[0].lastIndexOf(")") ));
|
|
92 |
rgbInputPanel.getTGreen().setText(s[1].substring(1,s[1].lastIndexOf(")") ));
|
|
93 |
rgbInputPanel.getTBlue().setText(s[2].substring(1,s[2].lastIndexOf(")") ));
|
|
105 |
rgbInputPanel.getTRed().setText(s[0].trim());
|
|
106 |
rgbInputPanel.getTGreen().setText(s[1].trim());
|
|
107 |
rgbInputPanel.getTBlue().setText(s[2].trim());
|
|
94 | 108 |
|
95 | 109 |
for(int i=0;i<entries.size();i++){ |
96 | 110 |
if( ((TransparencyRange)entries.get(i)).getStrEntry().equals(rule) ) |
trunk/libraries/libCq CMS for java.old/src/org/cresques/io/raster/RasterFilterStackManager.java | ||
---|---|---|
649 | 649 |
for (int propFilter = 0;propFilter < filters.size();propFilter++) { |
650 | 650 |
String elem = (String) filters.get(propFilter); |
651 | 651 |
|
652 |
//TODO: Para compatibilidad con versiones anteriores hay que hacer que a partir de esto se cree un filtro |
|
653 |
/*if (elem.startsWith("filter.transparency.rangeR")) { |
|
654 |
r = stringToRange(getValue(elem)); |
|
655 |
filters.remove(propFilter); |
|
656 |
propFilter--; |
|
657 |
} |
|
658 |
|
|
659 |
if (elem.startsWith("filter.transparency.rangeG")) { |
|
660 |
g = stringToRange(getValue(elem)); |
|
661 |
filters.remove(propFilter); |
|
662 |
propFilter--; |
|
663 |
} |
|
664 |
|
|
665 |
if (elem.startsWith("filter.transparency.rangeB")) { |
|
666 |
b = stringToRange(getValue(elem)); |
|
667 |
filters.remove(propFilter); |
|
668 |
propFilter--; |
|
669 |
}*/ |
|
670 | 652 |
if (elem.startsWith("filter.transparency.transparencyRange")) { |
671 | 653 |
TransparencyRange tr = new TransparencyRange(); |
672 | 654 |
String value = getValue(elem); |
trunk/libraries/libCq CMS for java.old/src/org/cresques/io/raster/TransparencyRange.java | ||
---|---|---|
148 | 148 |
for(int i=0;i<values.length();i++){ |
149 | 149 |
char c = values.charAt(i); |
150 | 150 |
switch(status){ |
151 |
case 0: if(c == '(') status = 2; |
|
152 |
else if(c == ' ') status = 0; |
|
153 |
else status = 1; |
|
154 |
break; |
|
155 |
case 1: throw new IOException("Error en la cadena de entrada "+status); |
|
156 |
case 2: if (c >= 48 && c <= 57) status = 3; |
|
157 |
else if(c == ')') status = 6; |
|
158 |
else status = 1; |
|
159 |
break; |
|
160 |
case 3: if (c >= 48 && c <= 57) status = 3; |
|
161 |
else if(c == ')') status = 6; |
|
162 |
else if(c == ':') status = 4; |
|
163 |
else status = 1; |
|
164 |
break; |
|
165 |
case 4: if (c >= 48 && c <= 57) status = 5; |
|
166 |
else status = 1; |
|
167 |
break; |
|
168 |
case 5: if (c >= 48 && c <= 57) status = 5; |
|
169 |
else if(c == ')') status = 6; |
|
170 |
else status = 1; |
|
171 |
break; |
|
172 |
case 6: if(c == '&'){ |
|
151 |
case 0: if(c == ' ')status = 0; |
|
152 |
else if ((c >= 48 && c <= 57) || c == '*')status = 1; |
|
153 |
else status = 4; |
|
154 |
break; |
|
155 |
case 1: if ((c >= 48 && c <= 57) || (c == ' '))status = 1; |
|
156 |
else if(c == ':') status = 2; |
|
157 |
else if(c == '&'){ |
|
173 | 158 |
status = 0; |
174 | 159 |
countAnd++; |
175 | 160 |
}else if(c == '|'){ |
176 | 161 |
status = 0; |
177 | 162 |
countOr++; |
178 |
}else if(c == ' ') |
|
179 |
status = 6; |
|
180 |
else |
|
181 |
status = 1; |
|
163 |
}else status = 4; |
|
164 |
break; |
|
165 |
case 2: if (c >= 48 && c <= 57) status = 3; |
|
166 |
else status = 4; |
|
167 |
break; |
|
168 |
case 3: if ((c >= 48 && c <= 57) || (c == ' '))status = 3; |
|
169 |
else if(c == '&'){ |
|
170 |
status = 0; |
|
171 |
countAnd++; |
|
172 |
}else if(c == '|'){ |
|
173 |
status = 0; |
|
174 |
countOr++; |
|
175 |
}else status = 4; |
|
176 |
break; |
|
177 |
case 4: throw new IOException("Error en la cadena de entrada "+status); |
|
182 | 178 |
} |
183 |
|
|
184 | 179 |
} |
185 | 180 |
|
186 | 181 |
//Si el analisis es correcto parseamos |
187 |
if(status == 6 && ((countAnd == 2 && countOr == 0) ||
|
|
182 |
if((status == 1 || status ==3) && ((countAnd == 2 && countOr == 0) ||
|
|
188 | 183 |
(countAnd == 0 && countOr == 2)) ){ |
189 | 184 |
String[] s = values.split(" & "); |
190 | 185 |
if(s.length < 3){ |
191 | 186 |
s = values.split(" \\| "); |
192 | 187 |
and = false; |
193 | 188 |
} |
194 |
|
|
195 |
String inter = s[0].substring(1, s[0].length() - 1); |
|
196 |
String[] val = inter.split(":"); |
|
189 |
; |
|
190 |
String[] val = s[0].split(":"); |
|
197 | 191 |
try{ |
198 | 192 |
r[0] = Integer.parseInt(val[0]); |
199 | 193 |
if(val.length == 2) |
... | ... | |
203 | 197 |
}catch(NumberFormatException e){ |
204 | 198 |
r [0] = -1;r [1] = -1; |
205 | 199 |
} |
206 |
|
|
207 |
|
|
208 |
|
|
209 |
inter = s[1].substring(1, s[1].length() - 1); |
|
210 |
val = inter.split(":"); |
|
200 |
|
|
201 |
val = s[1].split(":"); |
|
211 | 202 |
try{ |
212 | 203 |
g[0] = Integer.parseInt(val[0]); |
213 | 204 |
if(val.length == 2) |
... | ... | |
218 | 209 |
g[0] = -1;g[1] = -1; |
219 | 210 |
} |
220 | 211 |
|
221 |
|
|
222 |
inter = s[2].substring(1, s[2].length() - 1); |
|
223 |
val = inter.split(":"); |
|
212 |
val = s[2].split(":"); |
|
224 | 213 |
try{ |
225 | 214 |
b[0] = Integer.parseInt(val[0]); |
226 | 215 |
if(val.length == 2) |
... | ... | |
236 | 225 |
return and; |
237 | 226 |
} |
238 | 227 |
|
228 |
/** |
|
229 |
* Muestra los datos del objeto para depuraci?n |
|
230 |
* |
|
231 |
*/ |
|
239 | 232 |
public void show(){ |
240 | 233 |
if(getRed() != null) |
241 | 234 |
System.out.println(getRed()[0]+" "+getRed()[1]); |
Also available in: Unified diff