Revision 32206
trunk/extensions/extPublishMapserver/src/org/gvsig/publish/mapserver/conf/MapFile.java | ||
---|---|---|
212 | 212 |
public String imageMode = null; |
213 | 213 |
public String extension = null; |
214 | 214 |
public String mimetype = null; |
215 |
public String formatoption=null; |
|
215 | 216 |
|
216 | 217 |
/** |
217 | 218 |
* Creates a new OutputFormat. |
... | ... | |
227 | 228 |
this.extension = extension; |
228 | 229 |
this.mimetype = mimetype; |
229 | 230 |
} |
231 |
/** |
|
232 |
* Creates a new OutputFormat. |
|
233 |
* @param name |
|
234 |
* @param driver |
|
235 |
* @param imageMode |
|
236 |
* @param extension |
|
237 |
* @param formatoption |
|
238 |
*/ |
|
239 |
public OutputFormat(String name, String driver, String imageMode, String extension, String mimetype, String formatoption) { |
|
240 |
this.name = name; |
|
241 |
this.driver = driver; |
|
242 |
this.imageMode = imageMode; |
|
243 |
this.extension = extension; |
|
244 |
this.mimetype = mimetype; |
|
245 |
this.formatoption = formatoption; |
|
246 |
} |
|
230 | 247 |
|
231 | 248 |
public void toMap() { |
232 | 249 |
toMapln("OUTPUTFORMAT"); |
... | ... | |
236 | 253 |
if (imageMode != null) toMapln("IMAGEMODE "+imageMode+""); |
237 | 254 |
toMapln("EXTENSION \""+extension+"\""); |
238 | 255 |
toMapln("MIMETYPE \""+mimetype+"\""); |
256 |
if (formatoption != null) toMapln("FORMATOPTION \"" + formatoption + "\""); |
|
239 | 257 |
tabOut(); |
240 | 258 |
toMapln("END"); |
241 | 259 |
} |
trunk/extensions/extPublishMapserver/src/org/gvsig/publish/mapserver/model/MapserverProcess.java | ||
---|---|---|
33 | 33 |
import org.gvsig.publish.mapserver.conf.MapFile; |
34 | 34 |
import org.gvsig.publish.mapserver.conf.SymbolsFile; |
35 | 35 |
import org.gvsig.publish.mapserver.conf.MapFile.ConfigFile; |
36 |
import org.gvsig.publish.mapserver.conf.MapFile.OutputFormat; |
|
36 | 37 |
import org.gvsig.publish.serversmodel.Publication; |
37 | 38 |
import org.gvsig.publish.serversmodel.PublicationProcess; |
38 | 39 |
import org.gvsig.publish.serversmodel.Service; |
... | ... | |
203 | 204 |
//set the absolute path to symbolsfile |
204 | 205 |
//getConfigFile().symbolset = symbolsfilename; |
205 | 206 |
//add projection object, the projection of the first view |
206 |
mapfile.projection = new MapFile.CRS(mapserver.getPublication().getProjectInfo().getViewsInfo()[0].getEPSG(),true); |
|
207 |
mapfile.projection = new MapFile.CRS(mapserver.getPublication().getProjectInfo().getViewsInfo()[0].getEPSG(),true); |
|
208 |
if (mapserver.isAGGEnabled()){ |
|
209 |
OutputFormat of1 = new OutputFormat("AGG-PNG","AGG/PNG","RGB","png","image/png"); |
|
210 |
mapfile.add(of1); |
|
211 |
OutputFormat of2 = new OutputFormat("AGG-PNG-NOINTERLACED","AGG/PNG","RGB","png","image/png; interlaced=off", "INTERLACED=OFF"); |
|
212 |
mapfile.add(of2); |
|
213 |
} |
|
207 | 214 |
} |
208 | 215 |
|
209 | 216 |
private void checkServices() { |
trunk/extensions/extPublishMapserver/src/org/gvsig/publish/mapserver/model/Mapserver.java | ||
---|---|---|
49 | 49 |
import org.gvsig.publish.mapserver.conf.MapFile; |
50 | 50 |
import org.gvsig.publish.mapserver.conf.SymbolsFile; |
51 | 51 |
import org.gvsig.publish.mapserver.conf.MapFile.ConfigFile; |
52 |
import org.gvsig.publish.mapserver.conf.MapFile.OutputFormat; |
|
52 | 53 |
import org.gvsig.publish.serversmodel.PublicationProcess; |
53 | 54 |
import org.gvsig.publish.serversmodel.Server; |
54 | 55 |
|
... | ... | |
78 | 79 |
//private String symbolsfilename = null; |
79 | 80 |
private File imagepath_file = null; |
80 | 81 |
private String shapepath=null; |
82 |
private boolean isAGGEnabled=true; |
|
81 | 83 |
|
84 |
public boolean isAGGEnabled() { |
|
85 |
return isAGGEnabled; |
|
86 |
} |
|
87 |
|
|
88 |
public void setAGGEnabled(boolean isAGGEnabled) { |
|
89 |
this.isAGGEnabled = isAGGEnabled; |
|
90 |
} |
|
91 |
|
|
82 | 92 |
private boolean debug=false; |
83 | 93 |
/** |
84 | 94 |
* Constructor |
... | ... | |
87 | 97 |
super(); |
88 | 98 |
} |
89 | 99 |
|
90 |
/** |
|
91 |
* Generates the publication in Mapserver. |
|
92 |
* TODO: at the moment, you only can publish its first service |
|
93 |
* @see Server#publish() |
|
94 |
*/ |
|
95 |
public String publish() throws PublishException { |
|
96 |
//creates the mapfile |
|
97 |
config = new MapFile.ConfigFile(); |
|
98 |
//creates the symbols file |
|
99 |
symbolsconfig = new SymbolsFile.WellKnowSymbolsFile(); |
|
100 |
//creates the fonts file |
|
101 |
fontsconfig = new FontsFile.WellKnowFontsFile(); |
|
102 |
//check if there is anything to publish |
|
103 |
if (getService(0) == null){ |
|
104 |
throw new PublishException("publishms_no_services_defined"); |
|
105 |
} |
|
106 |
if (getService(0).getRemoteResourcesCount() == 0){ |
|
107 |
throw new PublishException("publishms_nothing_to_publish"); |
|
108 |
} |
|
109 |
//check if the mapfile is set |
|
110 |
if (getMapfileFile()==null){ |
|
111 |
throw new PublishException("publishms_the_mapfile_is_not_defined"); |
|
112 |
} |
|
113 | 100 |
|
114 |
String aux = FileUtils.getFileWithoutExtension(getMapfileFile()); |
|
115 |
|
|
116 |
symbolsfile = new File(aux+".sym"); |
|
117 |
symbolsconfig.generate(symbolsfile.getAbsolutePath()); |
|
118 |
fontsconfig.generate(symbolsfile.getParent() + "/" + "fonts.txt"); |
|
119 |
|
|
120 |
//creates IMAGEPATH |
|
121 |
if (getImagePath()!=null){ |
|
122 |
config.web.imagepath = getImagePath().getAbsolutePath(); |
|
123 |
} |
|
124 |
//creates the SHAPEPATH |
|
125 |
if(getShapepath() !=null){ |
|
126 |
config.mapShapePath = getShapepath(); |
|
127 |
} |
|
128 |
//debug |
|
129 |
config.debug = isDebug(); |
|
130 |
|
|
131 |
//generates the mapfile object MAP |
|
132 |
generateMapObject(); |
|
133 |
|
|
134 |
//call publish() method publish of its services |
|
135 |
super.publish(); |
|
136 |
//At the end write the configuration |
|
137 |
try { |
|
138 |
config.generate(getMapfileFile().getAbsolutePath(), "UTF-8"); |
|
139 |
} catch (FileNotFoundException e) { |
|
140 |
throw new PublishException("publihsms_permission_denied"); |
|
141 |
} |
|
142 |
//return message |
|
143 |
return "publishms_publish_message"; |
|
144 |
} |
|
145 | 101 |
/** |
146 |
* MAP |
|
147 |
*/ |
|
148 |
private void generateMapObject() { |
|
149 |
//set the map name |
|
150 |
getConfigFile().mapName = "map_generated_by_gvsig"; |
|
151 |
//TODO: I must create the method ProjectInfo.getBoundingBox() with the larger bbox (of all the views) |
|
152 |
//At the moment I'm using the bbox of the first view |
|
153 |
getConfigFile().extent = getPublication().getProjectInfo().getViewsInfo()[0].getBBox(); |
|
154 |
//set the relative path to symbolsfile |
|
155 |
|
|
156 |
getConfigFile().symbolset = symbolsfile.getName(); |
|
157 |
getConfigFile().fontset = "fonts.txt"; |
|
158 |
//set the absolute path to symbolsfile |
|
159 |
//getConfigFile().symbolset = symbolsfilename; |
|
160 |
//add projection object, the projection of the first view |
|
161 |
getConfigFile().projection = new MapFile.CRS(getPublication().getProjectInfo().getViewsInfo()[0].getEPSG(),true); |
|
162 |
} |
|
163 |
|
|
164 |
|
|
165 |
/** |
|
166 | 102 |
* check compatible |
167 | 103 |
* |
168 | 104 |
*/ |
Also available in: Unified diff