Revision 2192
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/raster/bean/previewbase/ParamStruct.java | ||
---|---|---|
37 | 37 |
public class ParamStruct { |
38 | 38 |
String filterName = null; |
39 | 39 |
Params filterParam = null; |
40 |
@SuppressWarnings("unchecked") |
|
41 |
Class filterClass = null; |
|
42 |
|
|
40 |
Class<?> filterClass = null; |
|
41 |
|
|
43 | 42 |
/** |
44 | 43 |
* @return the filterName |
45 | 44 |
*/ |
... | ... | |
71 | 70 |
/** |
72 | 71 |
* @return the filterClass |
73 | 72 |
*/ |
74 |
@SuppressWarnings("unchecked") |
|
75 |
public Class getFilterClass() { |
|
73 |
public Class<?> getFilterClass() { |
|
76 | 74 |
return filterClass; |
77 | 75 |
} |
78 | 76 |
|
79 | 77 |
/** |
80 | 78 |
* @param filterClass the filterClass to set |
81 | 79 |
*/ |
82 |
@SuppressWarnings("unchecked") |
|
83 |
public void setFilterClass(Class filterClass) { |
|
80 |
public void setFilterClass(Class<?> filterClass) { |
|
84 | 81 |
this.filterClass = filterClass; |
85 | 82 |
} |
86 | 83 |
|
... | ... | |
103 | 100 |
|
104 | 101 |
filterList.resetPercent(); |
105 | 102 |
} |
103 |
|
|
104 |
public ParamStruct clone() { |
|
105 |
ParamStruct p = new ParamStruct(); |
|
106 |
p.filterName = this.filterName; |
|
107 |
p.filterClass = this.filterClass; |
|
108 |
try { |
|
109 |
p.filterParam = (Params)filterParam.clone(); |
|
110 |
return p; |
|
111 |
} catch (CloneNotSupportedException e) { |
|
112 |
// TODO Auto-generated catch block |
|
113 |
e.printStackTrace(); |
|
114 |
} |
|
115 |
return null; |
|
116 |
} |
|
106 | 117 |
} |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/ui/PreviewFiltering.java | ||
---|---|---|
112 | 112 |
* @param params |
113 | 113 |
* @param classFilter |
114 | 114 |
*/ |
115 |
@SuppressWarnings("unchecked") |
|
116 |
public void addNewParam(String name, Params params, Class classFilter) { |
|
115 |
public void addNewParam(String name, Params params, Class<?> classFilter) { |
|
117 | 116 |
ParamStruct param = new ParamStruct(); |
118 | 117 |
param.setFilterName(name); |
119 | 118 |
param.setFilterParam(params); |
... | ... | |
126 | 125 |
* Esta funci?n llama a addFilter por cada filtro a?adido pero es applyFilters la encargada |
127 | 126 |
* de construir la lista. |
128 | 127 |
*/ |
129 |
@SuppressWarnings("unchecked") |
|
130 | 128 |
public void process(DataSourcePreview rendering) throws ImageUnavailableException { |
131 | 129 |
if(!showPreview) |
132 | 130 |
throw new ImageUnavailableException(RasterToolsUtil.getText(this, "panel_preview_not_available")); |
... | ... | |
150 | 148 |
for (int i = 0; i < listFilterUsed.size(); i++) { |
151 | 149 |
try { |
152 | 150 |
RasterFilterListManager filterManager = filterList.getManagerByFilterClass(((ParamStruct) listFilterUsed.get(i)).getFilterClass()); |
153 |
Class c = ((ParamStruct) listFilterUsed.get(i)).getFilterClass(); |
|
151 |
Class<?> c = ((ParamStruct) listFilterUsed.get(i)).getFilterClass();
|
|
154 | 152 |
Params p = ((ParamStruct) listFilterUsed.get(i)).getFilterParam(); |
155 | 153 |
filterManager.addFilter(c, p); |
156 | 154 |
} catch (FilterTypeException e) { |
... | ... | |
172 | 170 |
* @param layerRaster |
173 | 171 |
* @return |
174 | 172 |
*/ |
175 |
@SuppressWarnings("unchecked") |
|
176 | 173 |
public List<ParamStruct> applyAllFilters(FLyrRaster layerRaster) { |
177 | 174 |
List<ParamStruct> listFilterUsed = new ArrayList<ParamStruct>(); |
178 | 175 |
|
... | ... | |
190 | 187 |
|
191 | 188 |
RasterFilter obj = null; |
192 | 189 |
for (int j = 0; j < registeredFilters.size(); j++) { |
193 |
Class classFilter = (Class) registeredFilters.get(j);
|
|
190 |
Class<?> classFilter = (Class<?>) registeredFilters.get(j);
|
|
194 | 191 |
try { |
195 | 192 |
obj = (RasterFilter) classFilter.newInstance(); |
196 | 193 |
if (obj.getName().equals(((RasterFilter) filtersInit.get(i)).getName())) |
... | ... | |
236 | 233 |
*/ |
237 | 234 |
public List<ParamStruct> applySelectedFilters(List<ParamStruct> listFilterUsed) { |
238 | 235 |
if(listFilterUsed == null) |
239 |
return paramsList;
|
|
236 |
return getParamStructListCopy();
|
|
240 | 237 |
|
241 | 238 |
for (int i = 0; i < paramsList.size(); i++) { |
242 | 239 |
// En caso de existir el filtro, lo reemplazamos |
... | ... | |
255 | 252 |
return listFilterUsed; |
256 | 253 |
} |
257 | 254 |
|
255 |
private List<ParamStruct> getParamStructListCopy() { |
|
256 |
List<ParamStruct> p = new ArrayList<ParamStruct>(); |
|
257 |
for (int i = 0; i < paramsList.size(); i++) { |
|
258 |
p.add(paramsList.get(i).clone()); |
|
259 |
} |
|
260 |
return p; |
|
261 |
} |
|
262 |
|
|
258 | 263 |
/** |
259 | 264 |
* Obtiene el flag que informa de si se est? mostrando la previsualizaci?n o no. |
260 | 265 |
* En caso de no mostrarse se lanza una excepci?n ImageUnavailableExcepcion con el |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.api/src/main/java/org/gvsig/fmap/dal/coverage/datastruct/Params.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.fmap.dal.coverage.datastruct; |
23 | 23 |
|
24 |
import java.util.ArrayList;
|
|
24 |
import java.util.List; |
|
25 | 25 |
|
26 | 26 |
import org.gvsig.tools.persistence.Persistent; |
27 | 27 |
|
... | ... | |
105 | 105 |
* Devuelve el array de los Params |
106 | 106 |
* @return |
107 | 107 |
*/ |
108 |
public ArrayList<Param> getParams();
|
|
108 |
public List<Param> getParams(); |
|
109 | 109 |
|
110 | 110 |
/** |
111 | 111 |
* Clones this object |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/store/ParamsImpl.java | ||
---|---|---|
47 | 47 |
public static final int CHOICE = 2; |
48 | 48 |
public static final int SLIDER = 3; |
49 | 49 |
public static final int MULTI_CHECK = 4; |
50 |
private ArrayList<Param> params = new ArrayList<Param>();
|
|
50 |
private List<Param> params = new ArrayList<Param>(); |
|
51 | 51 |
|
52 | 52 |
/** |
53 | 53 |
* Obtiene el par?metro de la posici?n definida por param |
... | ... | |
87 | 87 |
return null; |
88 | 88 |
} |
89 | 89 |
|
90 |
/* |
|
91 |
* (non-Javadoc) |
|
92 |
* @see org.gvsig.fmap.dal.coverage.datastruct.Params#setParam(java.lang.String, java.lang.Object, int, java.lang.String[]) |
|
93 |
*/ |
|
94 | 90 |
public void setParam(String id, Object value, int type, String[] list) { |
95 | 91 |
ParamImpl p = (ParamImpl)getParamById(id); |
96 | 92 |
if (p == null) |
... | ... | |
103 | 99 |
params.add(p); |
104 | 100 |
} |
105 | 101 |
|
106 |
/* |
|
107 |
* (non-Javadoc) |
|
108 |
* @see org.gvsig.fmap.dal.coverage.datastruct.Params#setParam(java.lang.String, java.lang.Object) |
|
109 |
*/ |
|
110 | 102 |
public void setParam(String id, Object value) { |
111 | 103 |
ParamImpl p = (ParamImpl)getParamById(id); |
112 | 104 |
if (p == null) |
... | ... | |
159 | 151 |
* Devuelve el array de los Params |
160 | 152 |
* @return |
161 | 153 |
*/ |
162 |
public ArrayList<Param> getParams() {
|
|
154 |
public List<Param> getParams() { |
|
163 | 155 |
return params; |
164 | 156 |
} |
165 | 157 |
|
166 |
/* (non-Javadoc) |
|
167 |
* @see java.lang.Object#clone() |
|
168 |
*/ |
|
158 |
|
|
169 | 159 |
@SuppressWarnings("unchecked") |
170 | 160 |
public Object clone() throws CloneNotSupportedException { |
171 | 161 |
ParamsImpl aux = new ParamsImpl(); |
172 |
((ParamsImpl) aux).params = (ArrayList<Param>) this.params.clone();
|
|
162 |
((ParamsImpl) aux).params = (List<Param>)((ArrayList<Param>) this.params).clone();
|
|
173 | 163 |
return aux; |
174 | 164 |
} |
175 | 165 |
|
176 |
/* |
|
177 |
* (non-Javadoc) |
|
178 |
* @see org.gvsig.tools.persistence.Persistent#loadFromState(org.gvsig.tools.persistence.PersistentState) |
|
179 |
*/ |
|
180 |
@SuppressWarnings("unchecked") |
|
181 | 166 |
public void loadFromState(PersistentState state) |
182 | 167 |
throws PersistenceException { |
168 |
@SuppressWarnings("unchecked") |
|
183 | 169 |
List<Param> list = state.getList("list"); |
184 | 170 |
if(list != null) { |
185 | 171 |
this.params = new ArrayList<Param>(); |
... | ... | |
187 | 173 |
} |
188 | 174 |
} |
189 | 175 |
|
190 |
/* |
|
191 |
* (non-Javadoc) |
|
192 |
* @see org.gvsig.tools.persistence.Persistent#saveToState(org.gvsig.tools.persistence.PersistentState) |
|
193 |
*/ |
|
194 | 176 |
public void saveToState(PersistentState state) throws PersistenceException { |
195 | 177 |
state.set("list", params); |
196 | 178 |
} |
Also available in: Unified diff