Revision 17833 branches/v10/extensions/extPublishMapserver/src/org/gvsig/publish/mapserver/model/Mapserver.java

View differences:

Mapserver.java
42 42

  
43 43
import java.io.File;
44 44

  
45
import org.gvsig.publish.PublishLogger;
45 46
import org.gvsig.publish.mapserver.conf.MapFile;
46 47
import org.gvsig.publish.mapserver.conf.SymbolsFile;
47 48
import org.gvsig.publish.serversmodel.PublishException;
......
49 50

  
50 51
import com.iver.andami.PluginServices;
51 52
import com.iver.utiles.FileUtils;
53
import com.iver.utiles.NotExistInXMLEntity;
52 54
import com.iver.utiles.XMLEntity;
53 55
/**
54 56
 * Server that represents Mapserver
......
70 72
	private File mapfile_file = null;
71 73
	private String symbolsfilename = null;
72 74
	private File imagepath_file = null;
75
	private String shapepath=null;
73 76
	/**
74 77
	 * Constructor
75 78
	 */
......
113 116
		if (getImagePath()!=null){
114 117
			mapfile.web.imagepath = getImagePath().getAbsolutePath();
115 118
		}
116
		
119
		//creates the SHAPEPATH
120
		if(getShapepath() !=null){
121
			mapfile.mapShapePath = getShapepath();
122
		}
117 123
		//generates the mapfile object MAP
118 124
		generateMapObject();				
119 125
	
......
131 137
		//TODO: I must create the method ProjectInfo.getBoundingBox() with the larger bbox (of all the views)
132 138
		//At the moment I'm using the bbox of the first view
133 139
		getConfigFile().extent = getProjectInfo().getViewsInfo()[0].getBBox();
134
		//set the symbolsfile
135
		getConfigFile().symbolset = symbolsfilename;
140
		//set the relative path to symbolsfile
141
		String aux[] = symbolsfilename.split(File.separator);
142
		getConfigFile().symbolset = aux[aux.length -1];		
143
		//set the absolute path to symbolsfile
144
		//getConfigFile().symbolset = symbolsfilename;
136 145
		//add projection object, the projection of the first view
137 146
		getConfigFile().projection = new MapFile.CRS(getProjectInfo().getViewsInfo()[0].getEPSG(),true);		
138 147
	}
......
205 214
		file = xml.getStringProperty("imagepath");
206 215
		if (file !=null)
207 216
			setImagePath(new File(file));
217
		try{
218
			setShapepath(xml.getStringProperty("shapepath"));
219
		}catch (NotExistInXMLEntity e){
220
			PublishLogger.getLog().warn("WARNING Mapserver: the property shapepath doesn't exist");
221
		}
208 222
		
209 223
	}
210 224
	/**
......
224 238
		}else{
225 239
			xml.putProperty("imagepath", getImagePath().toString());
226 240
		}
241
		if (shapepath !=null){
242
			xml.putProperty("shapepath", shapepath);
243
		}
227 244
		return xml;
228 245
	}
229 246

  
247
	public String getShapepath() {
248
		return shapepath;
249
	}
250

  
251
	public void setShapepath(String shapepath) {
252
		this.shapepath = shapepath;
253
	}
254

  
230 255
}

Also available in: Unified diff