Revision 12838 trunk/libraries/libRaster/src/org/gvsig/raster/datastruct/serializer/ColorTableLibraryPersistence.java
ColorTableLibraryPersistence.java | ||
---|---|---|
42 | 42 |
* @param palettesBasePath |
43 | 43 |
* @return |
44 | 44 |
*/ |
45 |
public static ArrayList getPaletteFileList(String palettesBasePath, String nameSubdir) {
|
|
46 |
updateVersion(palettesBasePath, nameSubdir);
|
|
45 |
public static ArrayList getPaletteFileList(String palettesBasePath) { |
|
46 |
updateVersion(palettesBasePath); |
|
47 | 47 |
|
48 |
File paletteFiles = new File(palettesBasePath + File.separator + nameSubdir);
|
|
48 |
File paletteFiles = new File(palettesBasePath); |
|
49 | 49 |
|
50 | 50 |
if (!paletteFiles.exists()) |
51 | 51 |
return null; |
... | ... | |
64 | 64 |
* antigua version. |
65 | 65 |
* @param palettesPath |
66 | 66 |
*/ |
67 |
public static void updateVersion_1_0_to_1_1(String palettesBasePath, String nameSubdir) {
|
|
68 |
File palettesFile = new File(palettesBasePath + File.separator + "palettes.xml");
|
|
67 |
public static void updateVersion_1_0_to_1_1(String palettesBasePath) { |
|
68 |
File palettesFile = new File(new File(palettesBasePath).getParent().toString() + File.separator + "palettes.xml");
|
|
69 | 69 |
if (!palettesFile.exists()) |
70 | 70 |
return; |
71 |
new File(palettesBasePath + File.separator + nameSubdir).mkdir();
|
|
71 |
new File(palettesBasePath).mkdir(); |
|
72 | 72 |
|
73 | 73 |
try { |
74 | 74 |
KXmlParser parser = new KXmlParser(); |
75 |
FileInputStream fileInputStream = new FileInputStream(palettesBasePath + File.separator + "palettes.xml");
|
|
75 |
FileInputStream fileInputStream = new FileInputStream(palettesFile);
|
|
76 | 76 |
parser.setInput(fileInputStream, null); |
77 | 77 |
int tag = parser.nextTag(); |
78 | 78 |
|
... | ... | |
88 | 88 |
if (parser.getAttributeCount() == 2) { |
89 | 89 |
// Generar nuevo fichero |
90 | 90 |
KXmlSerializer parserOutput = new KXmlSerializer(); |
91 |
FileOutputStream fileOutputStream = new FileOutputStream(palettesBasePath + File.separator + nameSubdir + File.separator + parser.getAttributeValue(0) + ".xml");
|
|
91 |
FileOutputStream fileOutputStream = new FileOutputStream(palettesBasePath + File.separator + parser.getAttributeValue(0) + ".xml"); |
|
92 | 92 |
|
93 | 93 |
parserOutput.setOutput(fileOutputStream, null); |
94 | 94 |
parserOutput.startDocument("UTF-8", null); |
... | ... | |
180 | 180 |
* Invocar? todos los metodos de actualizaciones de version |
181 | 181 |
* @param palettesBasePath |
182 | 182 |
*/ |
183 |
public static void updateVersion(String palettesBasePath, String nameSubdir) {
|
|
184 |
updateVersion_1_0_to_1_1(palettesBasePath, nameSubdir);
|
|
183 |
public static void updateVersion(String palettesBasePath) { |
|
184 |
updateVersion_1_0_to_1_1(palettesBasePath); |
|
185 | 185 |
//updateVersion_1_1_to_1_2(palettesBasePath); |
186 | 186 |
} |
187 | 187 |
|
... | ... | |
206 | 206 |
* @param palettesPath Camino al fichero de paletas predefinidas. |
207 | 207 |
* @param paletteName Nombre de paleta a cargar desde el fichero xml. |
208 | 208 |
*/ |
209 |
public static String loadPalette(String palettesBasePath, String paletteFileName, ArrayList items, String nameSubdir) {
|
|
210 |
updateVersion(palettesBasePath, nameSubdir);
|
|
209 |
public static String loadPalette(String palettesBasePath, String paletteFileName, ArrayList items) { |
|
210 |
updateVersion(palettesBasePath); |
|
211 | 211 |
|
212 | 212 |
items.clear(); |
213 | 213 |
|
214 |
File palettesFile = new File(palettesBasePath + File.separator + nameSubdir + File.separator + paletteFileName);
|
|
214 |
File palettesFile = new File(palettesBasePath + File.separator + paletteFileName); |
|
215 | 215 |
if (!palettesFile.exists()) |
216 | 216 |
return null; |
217 | 217 |
|
... | ... | |
220 | 220 |
ArrayList rows = new ArrayList(); |
221 | 221 |
|
222 | 222 |
KXmlParser parser = new KXmlParser(); |
223 |
FileInputStream fileInputStream = new FileInputStream(palettesBasePath + File.separator + nameSubdir + File.separator + paletteFileName);
|
|
223 |
FileInputStream fileInputStream = new FileInputStream(palettesBasePath + File.separator + paletteFileName); |
|
224 | 224 |
parser.setInput(fileInputStream, null); |
225 | 225 |
int tag = parser.nextTag(); |
226 | 226 |
|
Also available in: Unified diff