Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] About previous email - Making a Style Editor Dialog for a new type of file

Hello:
In a previous email i was asking about making a Style Editor Dialog for a new type of file.
Well, I did some advances and could get a new page (named "Grids") in the Style Editor Dialog. In this page we change the style of grid files (*.grd) but we do not use sld style, we have a special form of reading this files , it can be seen in the plugin http://svn.geotools.org/udig/community/lavila/plugins/org.cgiar.cip.diva.catalog.addingridfiles.
We read the Style characteristics from the *.grd file.
Now, we could save the style changes in the file but when we refresh in the map Editor, the new changes are NOT shown.

To save the changes we did the following:
1. We get the displayed layer (*.grd), then we extract its style characteristics and show in its StyleEditor Page.
2. After the Style changes are applied, we save the new styles in a temporal file to generate a *.png file, this png is what we show in the map editor (if we save this new styles changes directly into the original grd file we will not see the changes written in the file because the file is being read).
The goal is to get the new generated png file to be shown in the map editor.

Theese procedures are in: http://svn.geotools.org/udig/community/lavila/plugins/org.cgiar.cip.diva.legend.grid
Here is the part when we apply changes (GridPageUI.java):
/****************************************************************/
public boolean performApply() {
   layer = getSelectedLayer();
   String name = layer.getID().getPath().substring(layer.getID().getPath().lastIndexOf("/")+1, layer.getID().getPath().lastIndexOf("."));
   String dir = layer.getID().getPath().substring(0, layer.getID().getPath().lastIndexOf("/")+1);
   File dirF = new File(dir);
   name = name + "T_F";
   GridPage.changeGRD(layer.getID().getPath(), paletteTable.getTable());

   File temp = File.createTempFile(name, ".grd", dirF);
   GridPage.changeGRD(temp.getPath(), paletteTable.getTable());

   GridPage.createPNG(temp.getPath());
   temp.delete();
}
/****************************************************************/

So how can I refresh this png file to see the new changes? We are not using any Blackboard.
I am enclosing a gridfile example. Thank you for your help.
Hope, I've made myself understood :)
Regards,
Magna
 <<gridfile.zip>> 

Attachment: gridfile.zip
Description: gridfile.zip


Back to the top