Revision 7102
trunk/extensions/extPublish/config/text.properties | ||
---|---|---|
6 | 6 |
accept=Aceptar |
7 | 7 |
select_server_type=Selecciona el tipo de servidor |
8 | 8 |
select_server_options=Selecciona las opciones del servidor |
9 |
onlineResource=Onlineresource |
|
10 | 9 |
shapePath=ShapePath |
11 | 10 |
fonts=Fonts |
12 | 11 |
symbols=Symbols |
13 |
mapFile=MapFile |
|
12 |
mapFile=MapFile |
|
13 |
imageURL=ImageURL |
|
14 |
imagePath=ImagePath |
trunk/extensions/extPublish/src/com/iver/cit/gvsig/publish/servers/mapserver/MapServer.java | ||
---|---|---|
50 | 50 |
* |
51 | 51 |
* $Id$ |
52 | 52 |
* $Log$ |
53 |
* Revision 1.1 2006-09-01 13:40:59 jorpiell |
|
53 |
* Revision 1.2 2006-09-07 12:51:54 jorpiell |
|
54 |
* Enganchada la interfaz gr?fica con el generador de ficheros |
|
55 |
* |
|
56 |
* Revision 1.1 2006/09/01 13:40:59 jorpiell |
|
54 | 57 |
* Primer gran commit de la extension |
55 | 58 |
* |
56 | 59 |
* |
... | ... | |
62 | 65 |
public static final String WMS_MAPFILE = "mapFile"; |
63 | 66 |
public static final String WMS_SYMBOLS = "symbols"; |
64 | 67 |
public static final String WMS_FONTS = "fonts"; |
65 |
public static final String WMS_SHAPEPATH = "shapePath";
|
|
66 |
public static final String WMS_ONLINERESOURCE = "onlineResource";
|
|
68 |
public static final String WMS_IMAGEURL = "imageURL";
|
|
69 |
public static final String WMS_IMAGEPATH = "imagePath";
|
|
67 | 70 |
|
68 | 71 |
public MapServer() { |
69 | 72 |
addJPanel(Servers.SERVER_TYPE_WMS, ServiceWMSPanel.class); |
trunk/extensions/extPublish/src/com/iver/cit/gvsig/publish/servers/mapserver/ServiceWMSPanel.java | ||
---|---|---|
58 | 58 |
* |
59 | 59 |
* $Id$ |
60 | 60 |
* $Log$ |
61 |
* Revision 1.4 2006-09-03 14:31:00 jorpiell |
|
61 |
* Revision 1.5 2006-09-07 12:51:54 jorpiell |
|
62 |
* Enganchada la interfaz gr?fica con el generador de ficheros |
|
63 |
* |
|
64 |
* Revision 1.4 2006/09/03 14:31:00 jorpiell |
|
62 | 65 |
* Ahora se cargan todos los datos desde el fichero de configuraci?n. Se han a?adido algunos comentarios |
63 | 66 |
* |
64 | 67 |
* Revision 1.3 2006/09/01 13:40:49 jorpiell |
... | ... | |
80 | 83 |
private JPanel mapFileLabelPanel = null; |
81 | 84 |
private JPanel symbolsLabelPanel = null; |
82 | 85 |
private JPanel fontsLabelPanel = null; |
83 |
private JPanel shapePathLabelPanel = null;
|
|
84 |
private JPanel onlineResourceLabelPanel = null;
|
|
86 |
private JPanel imageURLLabelPanel = null;
|
|
87 |
private JPanel imagePathLabelPanel = null;
|
|
85 | 88 |
private JPanel mapFileTextPanel = null; |
86 | 89 |
private JPanel symbolsTextPanel = null; |
87 | 90 |
private JPanel fontsTextPanel = null; |
88 |
private JPanel shapePathTextPanel = null;
|
|
89 |
private JPanel onlineResourceTextPanel = null;
|
|
91 |
private JPanel imageURLTextPanel = null;
|
|
92 |
private JPanel imagePathTextPanel = null;
|
|
90 | 93 |
private JLabel lbMapFile = null; |
91 | 94 |
private JLabel lbSymbols = null; |
92 | 95 |
private JLabel lbFonts = null; |
93 |
private JLabel lbShapePath = null;
|
|
94 |
private JLabel lbOnlineResource = null;
|
|
96 |
private JLabel lbImageURL = null;
|
|
97 |
private JLabel lbImagePath = null;
|
|
95 | 98 |
private JTextField tbMapFile = null; |
96 | 99 |
private JTextField tbSymbols = null; |
97 | 100 |
private JTextField tbFonts = null; |
98 |
private JTextField tbShapePath = null;
|
|
99 |
private JTextField tbOnlineResource = null;
|
|
101 |
private JTextField tbImageURL = null;
|
|
102 |
private JTextField tbImagePath = null;
|
|
100 | 103 |
|
101 | 104 |
/** |
102 | 105 |
* This method initializes |
... | ... | |
138 | 141 |
labelsPanel.add(getMapFileLabelPanel(), null); |
139 | 142 |
labelsPanel.add(getSymbolsLabelPanel(), null); |
140 | 143 |
labelsPanel.add(getFontsLabelPanel(), null); |
141 |
labelsPanel.add(getShapePathLabelPanel(), null);
|
|
142 |
labelsPanel.add(getOnlineResourceLabelPanel(), null);
|
|
144 |
labelsPanel.add(getImageURLLabelPanel(), null);
|
|
145 |
labelsPanel.add(getImagePathLabelPanel(), null);
|
|
143 | 146 |
} |
144 | 147 |
return labelsPanel; |
145 | 148 |
} |
... | ... | |
156 | 159 |
textsPanel.add(getMapFileTextPanel(), null); |
157 | 160 |
textsPanel.add(getSymbolsTextPanel(), null); |
158 | 161 |
textsPanel.add(getFontsTextPanel(), null); |
159 |
textsPanel.add(getShapePathTextPanel(), null);
|
|
160 |
textsPanel.add(getOnlineResourceTextPanel(), null);
|
|
162 |
textsPanel.add(getImageURLTextPanel(), null);
|
|
163 |
textsPanel.add(getImagePathTextPanel(), null);
|
|
161 | 164 |
} |
162 | 165 |
return textsPanel; |
163 | 166 |
} |
... | ... | |
224 | 227 |
* |
225 | 228 |
* @return javax.swing.JPanel |
226 | 229 |
*/ |
227 |
private JPanel getShapePathLabelPanel() {
|
|
228 |
if (shapePathLabelPanel == null) {
|
|
230 |
private JPanel getImageURLLabelPanel() {
|
|
231 |
if (imageURLLabelPanel == null) {
|
|
229 | 232 |
FlowLayout flowLayout3 = new FlowLayout(); |
230 | 233 |
flowLayout3.setAlignment(java.awt.FlowLayout.LEFT); |
231 |
lbShapePath = new JLabel();
|
|
232 |
lbShapePath.setText(PluginServices.getText(this, "shapePath"));
|
|
233 |
shapePathLabelPanel = new JPanel();
|
|
234 |
shapePathLabelPanel.setLayout(flowLayout3);
|
|
235 |
shapePathLabelPanel.setPreferredSize(new Dimension(lbWIDTH,lbHEIGHT + 5));
|
|
236 |
shapePathLabelPanel.add(lbShapePath, null);
|
|
234 |
lbImageURL = new JLabel();
|
|
235 |
lbImageURL.setText(PluginServices.getText(this, "imageURL"));
|
|
236 |
imageURLLabelPanel = new JPanel();
|
|
237 |
imageURLLabelPanel.setLayout(flowLayout3);
|
|
238 |
imageURLLabelPanel.setPreferredSize(new Dimension(lbWIDTH,lbHEIGHT + 5));
|
|
239 |
imageURLLabelPanel.add(lbImageURL, null);
|
|
237 | 240 |
} |
238 |
return shapePathLabelPanel;
|
|
241 |
return imageURLLabelPanel;
|
|
239 | 242 |
} |
240 | 243 |
|
241 | 244 |
/** |
... | ... | |
243 | 246 |
* |
244 | 247 |
* @return javax.swing.JPanel |
245 | 248 |
*/ |
246 |
private JPanel getOnlineResourceLabelPanel() {
|
|
247 |
if (onlineResourceLabelPanel == null) {
|
|
249 |
private JPanel getImagePathLabelPanel() {
|
|
250 |
if (imagePathLabelPanel == null) {
|
|
248 | 251 |
FlowLayout flowLayout4 = new FlowLayout(); |
249 | 252 |
flowLayout4.setAlignment(java.awt.FlowLayout.LEFT); |
250 |
lbOnlineResource = new JLabel();
|
|
251 |
lbOnlineResource.setText(PluginServices.getText(this, "onlineResource"));
|
|
252 |
onlineResourceLabelPanel = new JPanel();
|
|
253 |
onlineResourceLabelPanel.setLayout(flowLayout4);
|
|
254 |
onlineResourceLabelPanel.setPreferredSize(new Dimension(lbWIDTH,lbHEIGHT + 5));
|
|
255 |
onlineResourceLabelPanel.add(lbOnlineResource, null);
|
|
253 |
lbImagePath = new JLabel();
|
|
254 |
lbImagePath.setText(PluginServices.getText(this, "imagePath"));
|
|
255 |
imagePathLabelPanel = new JPanel();
|
|
256 |
imagePathLabelPanel.setLayout(flowLayout4);
|
|
257 |
imagePathLabelPanel.setPreferredSize(new Dimension(lbWIDTH,lbHEIGHT + 5));
|
|
258 |
imagePathLabelPanel.add(lbImagePath, null);
|
|
256 | 259 |
} |
257 |
return onlineResourceLabelPanel;
|
|
260 |
return imagePathLabelPanel;
|
|
258 | 261 |
} |
259 | 262 |
|
260 | 263 |
/** |
... | ... | |
304 | 307 |
* |
305 | 308 |
* @return javax.swing.JPanel |
306 | 309 |
*/ |
307 |
private JPanel getShapePathTextPanel() {
|
|
308 |
if (shapePathTextPanel == null) {
|
|
309 |
shapePathTextPanel = new JPanel();
|
|
310 |
shapePathTextPanel.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT + 5));
|
|
311 |
shapePathTextPanel.add(getTbShapePath(), null);
|
|
310 |
private JPanel getImageURLTextPanel() {
|
|
311 |
if (imageURLTextPanel == null) {
|
|
312 |
imageURLTextPanel = new JPanel();
|
|
313 |
imageURLTextPanel.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT + 5));
|
|
314 |
imageURLTextPanel.add(getTbImageURL(), null);
|
|
312 | 315 |
} |
313 |
return shapePathTextPanel;
|
|
316 |
return imageURLTextPanel;
|
|
314 | 317 |
} |
315 | 318 |
|
316 | 319 |
/** |
... | ... | |
318 | 321 |
* |
319 | 322 |
* @return javax.swing.JPanel |
320 | 323 |
*/ |
321 |
private JPanel getOnlineResourceTextPanel() {
|
|
322 |
if (onlineResourceTextPanel == null) {
|
|
323 |
onlineResourceTextPanel = new JPanel();
|
|
324 |
onlineResourceTextPanel.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT + 5));
|
|
325 |
onlineResourceTextPanel.add(getTbOnlineResource(), null);
|
|
324 |
private JPanel getImagePathTextPanel() {
|
|
325 |
if (imagePathTextPanel == null) {
|
|
326 |
imagePathTextPanel = new JPanel();
|
|
327 |
imagePathTextPanel.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT + 5));
|
|
328 |
imagePathTextPanel.add(getTbImagePath(), null);
|
|
326 | 329 |
} |
327 |
return onlineResourceTextPanel;
|
|
330 |
return imagePathTextPanel;
|
|
328 | 331 |
} |
329 | 332 |
|
330 | 333 |
/** |
... | ... | |
371 | 374 |
* |
372 | 375 |
* @return javax.swing.JTextField |
373 | 376 |
*/ |
374 |
private JTextField getTbShapePath() {
|
|
375 |
if (tbShapePath == null) {
|
|
376 |
tbShapePath = new JTextField();
|
|
377 |
tbShapePath.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT));
|
|
377 |
private JTextField getTbImageURL() {
|
|
378 |
if (tbImageURL == null) {
|
|
379 |
tbImageURL = new JTextField();
|
|
380 |
tbImageURL.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT));
|
|
378 | 381 |
} |
379 |
return tbShapePath;
|
|
382 |
return tbImageURL;
|
|
380 | 383 |
} |
381 | 384 |
|
382 | 385 |
/** |
... | ... | |
384 | 387 |
* |
385 | 388 |
* @return javax.swing.JTextField |
386 | 389 |
*/ |
387 |
private JTextField getTbOnlineResource() {
|
|
388 |
if (tbOnlineResource == null) {
|
|
389 |
tbOnlineResource = new JTextField();
|
|
390 |
tbOnlineResource.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT));
|
|
390 |
private JTextField getTbImagePath() {
|
|
391 |
if (tbImagePath == null) {
|
|
392 |
tbImagePath = new JTextField();
|
|
393 |
tbImagePath.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT));
|
|
391 | 394 |
} |
392 |
return tbOnlineResource;
|
|
395 |
return tbImagePath;
|
|
393 | 396 |
} |
394 | 397 |
|
395 | 398 |
/* |
... | ... | |
401 | 404 |
properties.put(MapServer.WMS_MAPFILE,getTbMapFile().getText()); |
402 | 405 |
properties.put(MapServer.WMS_SYMBOLS,getTbSymbols().getText()); |
403 | 406 |
properties.put(MapServer.WMS_FONTS,getTbFonts().getText()); |
404 |
properties.put(MapServer.WMS_SHAPEPATH,getTbShapePath().getText());
|
|
405 |
properties.put(MapServer.WMS_ONLINERESOURCE,getTbOnlineResource().getText());
|
|
407 |
properties.put(MapServer.WMS_IMAGEURL,getTbImageURL().getText());
|
|
408 |
properties.put(MapServer.WMS_IMAGEPATH,getTbImagePath().getText());
|
|
406 | 409 |
return properties; |
407 | 410 |
} |
408 | 411 |
|
... | ... | |
414 | 417 |
getTbMapFile().setText((String)properties.get(MapServer.WMS_MAPFILE)); |
415 | 418 |
getTbSymbols().setText((String)properties.get(MapServer.WMS_SYMBOLS)); |
416 | 419 |
getTbFonts().setText((String)properties.get(MapServer.WMS_FONTS)); |
417 |
getTbShapePath().setText((String)properties.get(MapServer.WMS_SHAPEPATH));
|
|
418 |
getTbOnlineResource().setText((String)properties.get(MapServer.WMS_ONLINERESOURCE));
|
|
420 |
getTbImageURL().setText((String)properties.get(MapServer.WMS_IMAGEURL));
|
|
421 |
getTbImagePath().setText((String)properties.get(MapServer.WMS_IMAGEPATH));
|
|
419 | 422 |
} |
420 | 423 |
|
421 | 424 |
} |
trunk/extensions/extPublish/src/com/iver/cit/gvsig/publish/layers/LayerFactory.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.publish.layers; |
|
2 |
|
|
3 |
import org.gvsig.remoteservices.conf.mapserver.MapServer; |
|
4 |
import org.gvsig.remoteservices.conf.mapserver.MapServer.MapLayer; |
|
5 |
import org.gvsig.remoteservices.conf.mapserver.MapServer.ShpLayer; |
|
6 |
|
|
7 |
import com.iver.cit.gvsig.fmap.drivers.jdbc.postgis.PostGisDriver; |
|
8 |
import com.iver.cit.gvsig.fmap.drivers.shp.IndexedShpDriver; |
|
9 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
10 |
import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
|
11 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
|
12 |
|
|
13 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
14 |
* |
|
15 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
16 |
* |
|
17 |
* This program is free software; you can redistribute it and/or |
|
18 |
* modify it under the terms of the GNU General Public License |
|
19 |
* as published by the Free Software Foundation; either version 2 |
|
20 |
* of the License, or (at your option) any later version. |
|
21 |
* |
|
22 |
* This program is distributed in the hope that it will be useful, |
|
23 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
24 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
25 |
* GNU General Public License for more details. |
|
26 |
* |
|
27 |
* You should have received a copy of the GNU General Public License |
|
28 |
* along with this program; if not, write to the Free Software |
|
29 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
30 |
* |
|
31 |
* For more information, contact: |
|
32 |
* |
|
33 |
* Generalitat Valenciana |
|
34 |
* Conselleria d'Infraestructures i Transport |
|
35 |
* Av. Blasco Ib??ez, 50 |
|
36 |
* 46010 VALENCIA |
|
37 |
* SPAIN |
|
38 |
* |
|
39 |
* +34 963862235 |
|
40 |
* gvsig@gva.es |
|
41 |
* www.gvsig.gva.es |
|
42 |
* |
|
43 |
* or |
|
44 |
* |
|
45 |
* IVER T.I. S.A |
|
46 |
* Salamanca 50 |
|
47 |
* 46005 Valencia |
|
48 |
* Spain |
|
49 |
* |
|
50 |
* +34 963163400 |
|
51 |
* dac@iver.es |
|
52 |
*/ |
|
53 |
/* CVS MESSAGES: |
|
54 |
* |
|
55 |
* $Id$ |
|
56 |
* $Log$ |
|
57 |
* Revision 1.1 2006-09-07 12:51:54 jorpiell |
|
58 |
* Enganchada la interfaz gr?fica con el generador de ficheros |
|
59 |
* |
|
60 |
* |
|
61 |
*/ |
|
62 |
/** |
|
63 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
64 |
*/ |
|
65 |
public class LayerFactory { |
|
66 |
|
|
67 |
public static MapLayer getMapLayer(FLayer lyr){ |
|
68 |
if (lyr instanceof FLyrVect){ |
|
69 |
FLyrVect lyrVect = (FLyrVect) lyr; |
|
70 |
if (lyrVect.getSource().getDriver() instanceof IndexedShpDriver){ |
|
71 |
return new MapServer.ShpLayer(); |
|
72 |
}else if(lyrVect.getSource().getDriver() instanceof PostGisDriver){ |
|
73 |
return new MapServer.PostgisLayer(); |
|
74 |
} |
|
75 |
}else if (lyr instanceof FLyrRaster){ |
|
76 |
return new MapServer.RasterLayer(); |
|
77 |
} |
|
78 |
return null; |
|
79 |
} |
|
80 |
|
|
81 |
} |
|
0 | 82 |
trunk/extensions/extPublish/src/com/iver/cit/gvsig/publish/ConfServerWMSExtension.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
public class ConfServerWMSExtension extends Extension{ |
11 | 11 |
|
12 |
|
|
12 |
/* |
|
13 |
* (non-Javadoc) |
|
14 |
* @see com.iver.andami.plugins.IExtension#initialize() |
|
15 |
*/ |
|
13 | 16 |
public void initialize() { |
14 | 17 |
// TODO Auto-generated method stub |
15 | 18 |
System.out.println("Initializing config server WMS prototype"); |
16 | 19 |
|
17 | 20 |
} |
18 |
/** |
|
19 |
* We are printing to the console the atributes of all layers |
|
20 |
*/ |
|
21 |
|
|
22 |
/* |
|
23 |
* (non-Javadoc) |
|
24 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String) |
|
25 |
*/ |
|
21 | 26 |
public void execute(String actionCommand) { |
22 |
//PublishWMSControler publishCtrl = new PublishWMSControler(); |
|
23 | 27 |
PluginServices.getMDIManager().addCentredWindow(new SelectServerWindow()); |
24 | 28 |
} |
25 | 29 |
|
30 |
/* |
|
31 |
* (non-Javadoc) |
|
32 |
* @see com.iver.andami.plugins.IExtension#isEnabled() |
|
33 |
*/ |
|
26 | 34 |
public boolean isEnabled() { |
27 | 35 |
// TODO Auto-generated method stub |
28 |
|
|
29 | 36 |
return true; |
30 | 37 |
} |
31 | 38 |
|
39 |
/* |
|
40 |
* (non-Javadoc) |
|
41 |
* @see com.iver.andami.plugins.IExtension#isVisible() |
|
42 |
*/ |
|
32 | 43 |
public boolean isVisible() { |
33 | 44 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
34 | 45 |
if (f == null) { |
35 | 46 |
return false; |
36 | 47 |
} |
37 |
return (f.getClass() == View.class);
|
|
48 |
return (f instanceof View);
|
|
38 | 49 |
|
39 | 50 |
} |
40 | 51 |
|
trunk/extensions/extPublish/src/com/iver/cit/gvsig/publish/gui/MapserverPanel.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.publish.gui; |
|
2 |
|
|
3 |
import javax.swing.JButton; |
|
4 |
import javax.swing.JLabel; |
|
5 |
import javax.swing.JPanel; |
|
6 |
import javax.swing.JTextField; |
|
7 |
|
|
8 |
import com.iver.cit.gvsig.publish.PublishWMSControler; |
|
9 |
|
|
10 |
import com.iver.andami.PluginServices; |
|
11 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
12 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
|
13 |
|
|
14 |
/** |
|
15 |
* Panel de carga de datos generales del mapserver. |
|
16 |
* @author "Jos? Vicente Hig?n" <higon_jos@gva.es> |
|
17 |
*/ |
|
18 |
public class MapserverPanel extends JPanel implements IWindow { |
|
19 |
|
|
20 |
/** |
|
21 |
* |
|
22 |
*/ |
|
23 |
private static final long serialVersionUID = 1L; |
|
24 |
private WindowInfo mViewInfo = null; |
|
25 |
private JButton jButton = null; |
|
26 |
private JLabel jLabel1 = null; |
|
27 |
private JLabel jLabel2 = null; |
|
28 |
private JTextField jTextFieldMapFile = null; |
|
29 |
private JLabel jLabel3 = null; |
|
30 |
private JLabel jLabel4 = null; |
|
31 |
private JLabel jLabel = null; |
|
32 |
private JTextField jTextFieldSymbolsFile = null; |
|
33 |
private JTextField jTextFieldFontsFile = null; |
|
34 |
private JTextField jTextFieldShapePath = null; |
|
35 |
private JTextField jTextFieldOnlineresource = null; |
|
36 |
private JButton jButton1 = null; |
|
37 |
|
|
38 |
private PublishWMSControler publishWMSControler = null; |
|
39 |
/** |
|
40 |
* This is the default constructor |
|
41 |
*/ |
|
42 |
public MapserverPanel(PublishWMSControler pub) { |
|
43 |
super(); |
|
44 |
initialize(); |
|
45 |
publishWMSControler = pub; |
|
46 |
jTextFieldMapFile.setText("/etc/mapserver/test.map"); |
|
47 |
jTextFieldSymbolsFile.setText("/etc/mapserver/symbols/symbols.sym"); |
|
48 |
jTextFieldFontsFile.setText("/etc/mapserver/fonts/fonts.txt"); |
|
49 |
jTextFieldShapePath.setText("/mnt/sercart/cartografia/cv300/shapes/Carreteras"); |
|
50 |
jTextFieldOnlineresource.setText("http://sercartlin/cgi-bin/wms?map=/etc/mapserver/test.map"); |
|
51 |
|
|
52 |
} |
|
53 |
|
|
54 |
/** |
|
55 |
* This method initializes this |
|
56 |
* |
|
57 |
* @return void |
|
58 |
*/ |
|
59 |
private void initialize() { |
|
60 |
jLabel = new JLabel(); |
|
61 |
jLabel.setBounds(new java.awt.Rectangle(15,139,120,24)); |
|
62 |
jLabel.setText("Onlineresource"); |
|
63 |
jLabel4 = new JLabel(); |
|
64 |
jLabel4.setBounds(new java.awt.Rectangle(15,106,120,23)); |
|
65 |
jLabel4.setText("Shape Path"); |
|
66 |
jLabel3 = new JLabel(); |
|
67 |
jLabel3.setBounds(new java.awt.Rectangle(15,76,120,22)); |
|
68 |
jLabel3.setText("Fonts"); |
|
69 |
jLabel2 = new JLabel(); |
|
70 |
jLabel2.setBounds(new java.awt.Rectangle(15,45,118,23)); |
|
71 |
jLabel2.setText("Symbols:"); |
|
72 |
jLabel1 = new JLabel(); |
|
73 |
jLabel1.setBounds(new java.awt.Rectangle(15,16,116,22)); |
|
74 |
jLabel1.setText("Mapfile:"); |
|
75 |
this.setLayout(null); |
|
76 |
this.setSize(428, 235); |
|
77 |
this.add(getJButton(), null); |
|
78 |
this.add(jLabel1, null); |
|
79 |
this.add(jLabel2, null); |
|
80 |
this.add(getJTextField(), null); |
|
81 |
this.add(jLabel3, null); |
|
82 |
this.add(jLabel4, null); |
|
83 |
this.add(jLabel, null); |
|
84 |
this.add(getJTextField1(), null); |
|
85 |
this.add(getJTextFieldFontsFile(), null); |
|
86 |
this.add(getJTextFieldShapePath(), null); |
|
87 |
this.add(getJTextFieldOnlineresource(), null); |
|
88 |
this.add(getJButton1(), null); |
|
89 |
} |
|
90 |
|
|
91 |
public WindowInfo getWindowInfo() { |
|
92 |
if (mViewInfo == null) |
|
93 |
{ |
|
94 |
mViewInfo=new WindowInfo(WindowInfo.MODELESSDIALOG); |
|
95 |
mViewInfo.setTitle("Mapserver Configuration"); |
|
96 |
} |
|
97 |
return mViewInfo; |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* This method initializes jButton |
|
102 |
* |
|
103 |
* @return javax.swing.JButton |
|
104 |
*/ |
|
105 |
private JButton getJButton() { |
|
106 |
if (jButton == null) { |
|
107 |
jButton = new JButton(); |
|
108 |
jButton.setBounds(new java.awt.Rectangle(159,187,111,25)); |
|
109 |
jButton.setText("Aceptar"); |
|
110 |
jButton.addActionListener(new java.awt.event.ActionListener() { |
|
111 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
112 |
publishWMSControler.publish( |
|
113 |
jTextFieldMapFile.getText(), |
|
114 |
jTextFieldSymbolsFile.getText(), |
|
115 |
jTextFieldFontsFile.getText(), |
|
116 |
jTextFieldOnlineresource.getText(), |
|
117 |
jTextFieldShapePath.getText()); |
|
118 |
} |
|
119 |
}); |
|
120 |
} |
|
121 |
return jButton; |
|
122 |
} |
|
123 |
|
|
124 |
/** |
|
125 |
* This method initializes jTextField |
|
126 |
* |
|
127 |
* @return javax.swing.JTextField |
|
128 |
*/ |
|
129 |
private JTextField getJTextField() { |
|
130 |
if (jTextFieldMapFile == null) { |
|
131 |
jTextFieldMapFile = new JTextField(); |
|
132 |
jTextFieldMapFile.setBounds(new java.awt.Rectangle(150,15,264,22)); |
|
133 |
} |
|
134 |
return jTextFieldMapFile; |
|
135 |
} |
|
136 |
|
|
137 |
/** |
|
138 |
* This method initializes jTextField1 |
|
139 |
* |
|
140 |
* @return javax.swing.JTextField |
|
141 |
*/ |
|
142 |
private JTextField getJTextField1() { |
|
143 |
if (jTextFieldSymbolsFile == null) { |
|
144 |
jTextFieldSymbolsFile = new JTextField(); |
|
145 |
jTextFieldSymbolsFile.setBounds(new java.awt.Rectangle(150,45,263,17)); |
|
146 |
} |
|
147 |
return jTextFieldSymbolsFile; |
|
148 |
} |
|
149 |
|
|
150 |
/** |
|
151 |
* This method initializes jTextField2 |
|
152 |
* |
|
153 |
* @return javax.swing.JTextField |
|
154 |
*/ |
|
155 |
private JTextField getJTextFieldFontsFile() { |
|
156 |
if (jTextFieldFontsFile == null) { |
|
157 |
jTextFieldFontsFile = new JTextField(); |
|
158 |
jTextFieldFontsFile.setBounds(new java.awt.Rectangle(149,75,261,21)); |
|
159 |
} |
|
160 |
return jTextFieldFontsFile; |
|
161 |
} |
|
162 |
|
|
163 |
/** |
|
164 |
* This method initializes jTextField3 |
|
165 |
* |
|
166 |
* @return javax.swing.JTextField |
|
167 |
*/ |
|
168 |
private JTextField getJTextFieldShapePath() { |
|
169 |
if (jTextFieldShapePath == null) { |
|
170 |
jTextFieldShapePath = new JTextField(); |
|
171 |
jTextFieldShapePath.setBounds(new java.awt.Rectangle(148,108,263,19)); |
|
172 |
} |
|
173 |
return jTextFieldShapePath; |
|
174 |
} |
|
175 |
|
|
176 |
/** |
|
177 |
* This method initializes jTextField4 |
|
178 |
* |
|
179 |
* @return javax.swing.JTextField |
|
180 |
*/ |
|
181 |
private JTextField getJTextFieldOnlineresource() { |
|
182 |
if (jTextFieldOnlineresource == null) { |
|
183 |
jTextFieldOnlineresource = new JTextField(); |
|
184 |
jTextFieldOnlineresource.setBounds(new java.awt.Rectangle(149,141,262,17)); |
|
185 |
} |
|
186 |
return jTextFieldOnlineresource; |
|
187 |
} |
|
188 |
|
|
189 |
/** |
|
190 |
* This method initializes jButton1 |
|
191 |
* |
|
192 |
* @return javax.swing.JButton |
|
193 |
*/ |
|
194 |
private JButton getJButton1() { |
|
195 |
if (jButton1 == null) { |
|
196 |
jButton1 = new JButton(); |
|
197 |
jButton1.setBounds(new java.awt.Rectangle(286,187,120,22)); |
|
198 |
jButton1.setText("Cancelar"); |
|
199 |
jButton1.addActionListener(new java.awt.event.ActionListener() { |
|
200 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
201 |
//System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed() |
|
202 |
closeDialog(); |
|
203 |
} |
|
204 |
}); |
|
205 |
} |
|
206 |
return jButton1; |
|
207 |
} |
|
208 |
public void closeDialog(){ |
|
209 |
PluginServices.getMDIManager().closeWindow(MapserverPanel.this); |
|
210 |
} |
|
211 |
|
|
212 |
} // @jve:decl-index=0:visual-constraint="12,19" |
trunk/extensions/extPublish/src/com/iver/cit/gvsig/publish/gui/listeners/OptionsServerWindowListener.java | ||
---|---|---|
6 | 6 |
|
7 | 7 |
import com.iver.andami.PluginServices; |
8 | 8 |
import com.iver.andami.persistence.serverData.ServerDataPersistence; |
9 |
import com.iver.cit.gvsig.publish.PublishWMSControler; |
|
9 | 10 |
import com.iver.cit.gvsig.publish.Servers; |
10 | 11 |
import com.iver.cit.gvsig.publish.gui.OptionsServerWindow; |
11 | 12 |
import com.iver.cit.gvsig.publish.gui.SelectServerWindow; |
12 | 13 |
import com.iver.cit.gvsig.publish.servers.GenericServer; |
14 |
import com.iver.cit.gvsig.publish.servers.mapserver.MapServer; |
|
13 | 15 |
import com.iver.utiles.swing.jcomboServer.ServerData; |
14 | 16 |
|
15 | 17 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
... | ... | |
56 | 58 |
* |
57 | 59 |
* $Id$ |
58 | 60 |
* $Log$ |
59 |
* Revision 1.3 2006-09-03 14:34:03 jorpiell |
|
61 |
* Revision 1.4 2006-09-07 12:51:54 jorpiell |
|
62 |
* Enganchada la interfaz gr?fica con el generador de ficheros |
|
63 |
* |
|
64 |
* Revision 1.3 2006/09/03 14:34:03 jorpiell |
|
60 | 65 |
* Se ha cambiado el nombre del servidor a SERVER_BRAND |
61 | 66 |
* |
62 | 67 |
* Revision 1.2 2006/09/03 14:31:00 jorpiell |
... | ... | |
138 | 143 |
if (brand.compareTo(Servers.SERVER_BRAND_MAPSERVER) == 0){ |
139 | 144 |
if (type.compareTo(Servers.SERVER_TYPE_WMS) == 0){ |
140 | 145 |
System.out.println("Mapserver WMS"); |
146 |
PublishWMSControler publishWMS = new PublishWMSControler(); |
|
147 |
publishWMS.publish(serverData.getServerAddress(), |
|
148 |
serverData.getProperty(GenericServer.GENERIC_SERVER_PATH), |
|
149 |
serverData.getProperty(MapServer.WMS_MAPFILE), |
|
150 |
serverData.getProperty(MapServer.WMS_SYMBOLS), |
|
151 |
serverData.getProperty(MapServer.WMS_FONTS), |
|
152 |
serverData.getProperty(MapServer.WMS_IMAGEURL), |
|
153 |
serverData.getProperty(MapServer.WMS_IMAGEPATH)); |
|
141 | 154 |
}else if (type.compareTo(Servers.SERVER_TYPE_WFS) == 0){ |
142 | 155 |
System.out.println("Mapserver WFS"); |
143 | 156 |
} |
trunk/extensions/extPublish/src/com/iver/cit/gvsig/publish/gui/listeners/SelectServerWindowListener.java | ||
---|---|---|
4 | 4 |
import java.awt.event.ActionListener; |
5 | 5 |
|
6 | 6 |
import com.iver.andami.PluginServices; |
7 |
import com.iver.cit.gvsig.publish.PublishWMSControler; |
|
8 |
import com.iver.cit.gvsig.publish.gui.MapserverPanel; |
|
9 | 7 |
import com.iver.cit.gvsig.publish.gui.OptionsServerWindow; |
10 | 8 |
import com.iver.cit.gvsig.publish.gui.SelectServerWindow; |
11 | 9 |
|
... | ... | |
53 | 51 |
* |
54 | 52 |
* $Id$ |
55 | 53 |
* $Log$ |
56 |
* Revision 1.3 2006-09-03 14:31:00 jorpiell |
|
54 |
* Revision 1.4 2006-09-07 12:51:54 jorpiell |
|
55 |
* Enganchada la interfaz gr?fica con el generador de ficheros |
|
56 |
* |
|
57 |
* Revision 1.3 2006/09/03 14:31:00 jorpiell |
|
57 | 58 |
* Ahora se cargan todos los datos desde el fichero de configuraci?n. Se han a?adido algunos comentarios |
58 | 59 |
* |
59 | 60 |
* Revision 1.2 2006/09/01 13:40:59 jorpiell |
trunk/extensions/extPublish/src/com/iver/cit/gvsig/publish/PublishWMSControler.java | ||
---|---|---|
1 | 1 |
package com.iver.cit.gvsig.publish; |
2 | 2 |
|
3 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
4 |
* |
|
5 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 2 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
20 |
* |
|
21 |
* For more information, contact: |
|
22 |
* |
|
23 |
* Generalitat Valenciana |
|
24 |
* Conselleria d'Infraestructures i Transport |
|
25 |
* Av. Blasco Ib??ez, 50 |
|
26 |
* 46010 VALENCIA |
|
27 |
* SPAIN |
|
28 |
* |
|
29 |
* +34 963862235 |
|
30 |
* gvsig@gva.es |
|
31 |
* www.gvsig.gva.es |
|
32 |
* |
|
33 |
* or |
|
34 |
* |
|
35 |
* IVER T.I. S.A |
|
36 |
* Salamanca 50 |
|
37 |
* 46005 Valencia |
|
38 |
* Spain |
|
39 |
* |
|
40 |
* +34 963163400 |
|
41 |
* dac@iver.es |
|
42 |
*/ |
|
3 | 43 |
import java.awt.Color; |
4 | 44 |
import java.awt.geom.Rectangle2D; |
45 |
import java.util.ArrayList; |
|
5 | 46 |
|
6 | 47 |
import org.gvsig.remoteservices.conf.mapserver.MapServer; |
7 | 48 |
import org.gvsig.remoteservices.conf.mapserver.MapServer.CRS; |
8 | 49 |
import org.gvsig.remoteservices.conf.mapserver.MapServer.ConfigFile; |
9 | 50 |
import org.gvsig.remoteservices.conf.mapserver.MapServer.MapClass; |
51 |
import org.gvsig.remoteservices.conf.mapserver.MapServer.MapLayer; |
|
52 |
import org.gvsig.remoteservices.conf.mapserver.MapServer.PostgisLayer; |
|
10 | 53 |
import org.gvsig.remoteservices.conf.mapserver.MapServer.RGB; |
11 | 54 |
import org.gvsig.remoteservices.conf.mapserver.MapServer.ShpLayer; |
12 | 55 |
|
13 | 56 |
import com.iver.andami.PluginServices; |
14 | 57 |
import com.iver.cit.gvsig.fmap.DriverException; |
15 | 58 |
import com.iver.cit.gvsig.fmap.MapControl; |
59 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
60 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
|
61 |
import com.iver.cit.gvsig.fmap.drivers.jdbc.postgis.PostGisDriver; |
|
62 |
import com.iver.cit.gvsig.fmap.drivers.shp.IndexedShpDriver; |
|
16 | 63 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
17 | 64 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
18 | 65 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
19 | 66 |
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial; |
20 | 67 |
import com.iver.cit.gvsig.fmap.layers.VectorialFileAdapter; |
68 |
import com.iver.cit.gvsig.fmap.rendering.Legend; |
|
69 |
import com.iver.cit.gvsig.fmap.rendering.SingleSymbolLegend; |
|
70 |
import com.iver.cit.gvsig.fmap.rendering.VectorialIntervalLegend; |
|
71 |
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend; |
|
21 | 72 |
import com.iver.cit.gvsig.gui.View; |
22 |
import com.iver.cit.gvsig.publish.gui.MapserverPanel;
|
|
73 |
import com.iver.cit.gvsig.publish.layers.LayerFactory;
|
|
23 | 74 |
|
24 | 75 |
/** |
25 |
* This class implements the mapserver wms publication use case. |
|
26 |
* Responsability:
|
|
27 |
* This class must create the dialog, get the specific mapserver parameters and
|
|
28 |
* get the view atributes in order to
|
|
76 |
* This class implements the mapserver wms publication use case. Responsability:
|
|
77 |
* This class must create the dialog, get the specific mapserver parameters and
|
|
78 |
* get the view atributes in order to
|
|
79 |
* |
|
29 | 80 |
* @author jvhigon |
30 |
* |
|
81 |
*
|
|
31 | 82 |
*/ |
32 |
public class PublishWMSControler{ |
|
33 |
private View view=null; |
|
34 |
private MapControl mapCtrl= null; |
|
35 |
private FLayers layers=null; |
|
36 |
MapserverPanel dlg = null; |
|
83 |
public class PublishWMSControler { |
|
84 |
private View view = null; |
|
85 |
|
|
86 |
private MapControl mapCtrl = null; |
|
87 |
|
|
88 |
private FLayers layers = null; |
|
89 |
|
|
37 | 90 |
/** |
38 | 91 |
* Constructor |
39 |
* |
|
92 |
*
|
|
40 | 93 |
*/ |
41 |
PublishWMSControler(){
|
|
94 |
public PublishWMSControler() {
|
|
42 | 95 |
view = (View) PluginServices.getMDIManager().getActiveWindow(); |
43 | 96 |
mapCtrl = view.getMapControl(); |
44 |
layers= mapCtrl.getMapContext().getLayers(); |
|
45 |
createMapserverPanel(); |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* Create de Dialog in order to get the specific mapserver's atributes |
|
50 |
* |
|
51 |
*/ |
|
52 |
private void createMapserverPanel(){ |
|
53 |
//Show panel |
|
54 |
dlg = new MapserverPanel(this); |
|
55 |
dlg = (MapserverPanel) PluginServices.getMDIManager().addWindow(dlg); |
|
97 |
layers = mapCtrl.getMapContext().getLayers(); |
|
56 | 98 |
} |
57 |
private void closeMapserverPanel(){ |
|
58 |
dlg.closeDialog(); |
|
59 |
} |
|
60 |
|
|
99 |
|
|
61 | 100 |
/** |
62 | 101 |
* |
102 |
* @param url |
|
103 |
* @param path |
|
63 | 104 |
* @param mapFile |
64 |
* @param symbolFile |
|
105 |
* @param symbolsFile
|
|
65 | 106 |
* @param fontsFile |
66 |
* @param Onlineresource
|
|
67 |
* @param shapePath
|
|
107 |
* @param ImageURL
|
|
108 |
* @param imagePath
|
|
68 | 109 |
*/ |
69 |
|
|
70 |
public void publish(String mapFile, String symbolsFile, String fontsFile, String onlineResource, String shapePath ){ |
|
71 |
ConfigFile map = new ConfigFile(); |
|
72 |
map.mapName= "TEST_MAPSERVER"; |
|
73 |
map.mapStatus="ON"; |
|
74 |
map.mapUnits="METERS"; |
|
75 |
map.mapShapePath = shapePath; |
|
76 |
map.mapcrs = new CRS(mapCtrl.getMapContext().getViewPort().getProjection().getAbrev(),true); |
|
77 |
map.setExtent(-1,-1,1,1); |
|
110 |
public void publish(String onlineResource, String path, String mapFile, |
|
111 |
String symbolsFile, String fontsFile, String ImageURL, |
|
112 |
String imagePath) { |
|
78 | 113 |
|
79 |
MapServer.WebMap web = new MapServer.WebMap(); |
|
80 |
web.imagepath="/var/tmp/"; |
|
81 |
web.imageurl="/var/tmp/"; |
|
82 |
web.metadata=new MapServer.MetadataWeb(); |
|
83 |
web.metadata.crs= new CRS(mapCtrl.getMapContext().getViewPort().getProjection().getAbrev(),false); |
|
84 |
|
|
85 |
web.metadata.title="test shape"; |
|
86 |
web.metadata.onlineresource=onlineResource; |
|
87 |
map.www=web; |
|
88 |
|
|
89 |
for (int i= 0; i < layers.getLayersCount(); i++ ){ |
|
90 |
FLayer lyr= layers.getLayer(i); |
|
91 |
|
|
92 |
ShpLayer capa1 = new ShpLayer(); |
|
93 |
MapClass clase = new MapClass("autopistas"); |
|
94 |
capa1.name = lyr.getName(); |
|
95 |
capa1.title = lyr.getName(); |
|
114 |
ConfigFile map = getConfigFile(path); |
|
115 |
map.www = getWebMap(onlineResource,imagePath,ImageURL); |
|
96 | 116 |
|
97 |
//vectorial file path |
|
98 |
FLyrVect lyrvec = (FLyrVect) lyr; |
|
99 |
try { |
|
100 |
System.out.println(lyrvec.getShapeType()); |
|
101 |
} catch (DriverException e1) { |
|
102 |
// TODO Auto-generated catch block |
|
103 |
e1.printStackTrace(); |
|
117 |
for (int i = 0; i < layers.getLayersCount(); i++) { |
|
118 |
FLayer lyr = layers.getLayer(i); |
|
119 |
MapLayer mapLayer = createLayer(lyr); |
|
120 |
if (lyr != null){ |
|
121 |
map.layers.add(mapLayer); |
|
104 | 122 |
} |
105 |
ReadableVectorial rv = lyrvec.getSource(); |
|
106 |
if (rv instanceof VectorialFileAdapter){ |
|
107 |
VectorialFileAdapter vfa = (VectorialFileAdapter) rv; |
|
108 |
capa1.data = vfa.getFile().getName(); |
|
109 |
} |
|
110 |
//TODO: I need know which is the type's layer |
|
111 |
capa1.type="LINE"; |
|
112 |
capa1.addClass(clase); |
|
113 |
|
|
114 |
//color and transparency LINE !!! |
|
115 |
if(lyr instanceof FLyrVect){ |
|
116 |
FLyrVect lyrvec2 = (FLyrVect) lyr; |
|
117 |
Color clr = lyrvec2.getLegend().getDefaultSymbol().getColor(); |
|
118 |
clase.estilo = new ConfigFile.StyleMap( |
|
119 |
new RGB(clr.getRed(),clr.getGreen(),clr.getBlue()),new RGB(clr.getRed(),clr.getGreen(),clr.getBlue())); |
|
120 |
|
|
121 |
int alpha = lyrvec2.getLegend().getDefaultSymbol().getColor().getAlpha(); |
|
122 |
System.out.println("Tranparency: " + (255 - alpha)); |
|
123 |
|
|
124 |
}else{ |
|
125 |
System.out.println("Esto no es una capa vectorial"); |
|
126 |
} |
|
127 |
capa1.metadata=new ConfigFile.MetadataLayer(); |
|
128 |
Rectangle2D extent = null; |
|
129 |
try { |
|
130 |
extent = lyr.getFullExtent(); |
|
131 |
} catch (DriverException e) { |
|
132 |
// TODO Auto-generated catch block |
|
133 |
e.printStackTrace(); |
|
134 |
} |
|
135 |
capa1.metadata.setExtent(extent.getMinX(),extent.getMinY(),extent.getMaxX(),extent.getMaxY()); |
|
136 |
capa1.metadata.metalayertitle="Autopistas gv"; |
|
137 |
map.layers.add(capa1); |
|
138 |
|
|
139 |
} //end for |
|
140 |
|
|
141 |
map.generate(mapFile); |
|
142 |
this.closeMapserverPanel(); |
|
123 |
|
|
124 |
} |
|
125 |
map.generate(mapFile); |
|
143 | 126 |
} |
144 |
} |
|
145 |
|
|
146 |
//print specific mapserver's atributes |
|
147 |
/*System.out.println("Ruta mapFile:"+ mapFile); |
|
148 |
System.out.println("Ruta symbolsFile:" + symbolsFile); |
|
149 |
System.out.println("Ruta fonstFile:" + fontsFile); |
|
150 |
System.out.println("Ruta onlineResource:" + onlineResource ); |
|
151 |
System.out.println("Ruta onlineResource:" + shapePath); |
|
152 |
|
|
153 |
//print atributes for all layers |
|
154 |
for (int i= 0; i < layers.getLayersCount(); i++ ){ |
|
155 |
FLayer lyr= layers.getLayer(i); |
|
156 |
//name layer |
|
157 |
System.out.println("Nombre de la capa: " + lyr.getName()); |
|
158 | 127 |
|
159 |
//vectorial file path |
|
160 |
FLyrVect lyrvec = (FLyrVect) lyr; |
|
161 |
ReadableVectorial rv = lyrvec.getSource(); |
|
162 |
if (rv instanceof VectorialFileAdapter){ |
|
163 |
VectorialFileAdapter vfa = (VectorialFileAdapter) rv; |
|
164 |
System.out.println("Absolute Path: " + vfa.getFile().getAbsoluteFile()); |
|
165 |
System.out.println("File Name: " + vfa.getFile().getName()); |
|
128 |
private MapLayer createLayer(FLayer layer){ |
|
129 |
MapLayer mLayer = LayerFactory.getMapLayer(layer); |
|
130 |
mLayer.name = getLayerName(layer.getName()); |
|
131 |
mLayer.title = layer.getName(); |
|
132 |
if (layer instanceof FLyrVect){ |
|
133 |
createLayerVect((FLyrVect)layer,mLayer); |
|
134 |
} |
|
135 |
return mLayer; |
|
166 | 136 |
} |
167 | 137 |
|
168 |
// extext |
|
169 |
Rectangle2D rect = null; |
|
170 |
try { |
|
171 |
rect = lyr.getFullExtent(); |
|
172 |
} catch (DriverException e) { |
|
173 |
// TODO Auto-generated catch block |
|
174 |
e.printStackTrace(); |
|
138 |
private void createLayerVect(FLyrVect lyrVect,MapLayer mLayer){ |
|
139 |
ReadableVectorial rv = lyrVect.getSource(); |
|
140 |
if (rv instanceof VectorialFileAdapter) { |
|
141 |
VectorialFileAdapter vfa = (VectorialFileAdapter) rv; |
|
142 |
mLayer.data = vfa.getFile().getName(); |
|
143 |
} |
|
144 |
|
|
145 |
mLayer.type = getShpType(lyrVect); |
|
146 |
mLayer.classList = getMapClassList(lyrVect); |
|
147 |
mLayer.metadata = new ConfigFile.MetadataLayer(); |
|
148 |
mLayer.transparency = 255 - lyrVect.getLegend().getDefaultSymbol().getColor().getAlpha(); |
|
149 |
|
|
150 |
try { |
|
151 |
mLayer.metadata.setExtent(lyrVect.getFullExtent()); |
|
152 |
} catch (DriverException e) { |
|
153 |
// TODO Auto-generated catch block |
|
154 |
e.printStackTrace(); |
|
155 |
} |
|
175 | 156 |
} |
176 |
System.out.println("Extent: " + rect.getMinX() + " " + rect.getMinY() + " " + rect.getMaxX() + " " + rect.getMaxY()); |
|
177 | 157 |
|
158 |
private ArrayList getMapClassList(FLyrVect lyrVect){ |
|
159 |
ArrayList mapClasses = new ArrayList(); |
|
160 |
Legend legend = lyrVect.getLegend(); |
|
161 |
if (legend instanceof SingleSymbolLegend){ |
|
162 |
MapClass mapClass = new MapClass(getLayerName(lyrVect.getName())); |
|
163 |
Color clr = legend.getDefaultSymbol().getColor(); |
|
164 |
Color outLineclr = legend.getDefaultSymbol().getOutlineColor(); |
|
165 |
mapClass.estilo = new ConfigFile.StyleMap(new RGB(outLineclr.getRed(), |
|
166 |
outLineclr.getGreen(), outLineclr.getBlue()), new RGB(clr.getRed(), |
|
167 |
clr.getGreen(), clr.getBlue())); |
|
168 |
mapClasses.add(mapClass); |
|
169 |
}else if(legend instanceof VectorialUniqueValueLegend){ |
|
170 |
VectorialUniqueValueLegend uniqueValueLegend = (VectorialUniqueValueLegend)legend; |
|
171 |
FSymbol[] symbols = uniqueValueLegend.getSymbols(); |
|
172 |
for (int i=0 ; i<symbols.length ; i++){ |
|
173 |
MapClass mapClass = new MapClass(symbols[i].getDescription()); |
|
174 |
Color clr = symbols[i].getColor(); |
|
175 |
Color outLineclr = symbols[i].getOutlineColor(); |
|
176 |
mapClass.estilo = new ConfigFile.StyleMap(new RGB(outLineclr.getRed(), |
|
177 |
outLineclr.getGreen(), outLineclr.getBlue()), new RGB(clr.getRed(), |
|
178 |
clr.getGreen(), clr.getBlue())); |
|
179 |
mapClass.expression = "('[" + uniqueValueLegend.getFieldName() + "]' = '" + |
|
180 |
symbols[i].getDescription() + "')"; |
|
181 |
mapClasses.add(mapClass); |
|
182 |
} |
|
183 |
|
|
184 |
}else if(legend instanceof VectorialIntervalLegend){ |
|
185 |
MapClass mapClass = new MapClass(getLayerName(lyrVect.getName())); |
|
186 |
Color clr = legend.getDefaultSymbol().getColor(); |
|
187 |
Color outLineclr = legend.getDefaultSymbol().getOutlineColor(); |
|
188 |
mapClass.estilo = new ConfigFile.StyleMap(new RGB(outLineclr.getRed(), |
|
189 |
outLineclr.getGreen(), outLineclr.getBlue()), new RGB(clr.getRed(), |
|
190 |
clr.getGreen(), clr.getBlue())); |
|
191 |
mapClasses.add(mapClass); |
|
192 |
} |
|
193 |
return mapClasses; |
|
194 |
} |
|
178 | 195 |
|
179 |
//maxscale |
|
180 |
System.out.println("Maxscale: " + lyr.getMaxScale()); |
|
196 |
private ConfigFile getConfigFile(String path){ |
|
197 |
ConfigFile map = new ConfigFile(); |
|
198 |
map.mapName = "TEST_MAPSERVER"; |
|
199 |
map.mapStatus = "ON"; |
|
200 |
map.mapUnits = "METERS"; |
|
201 |
map.mapShapePath = path; |
|
202 |
map.mapcrs = new CRS(mapCtrl.getMapContext().getViewPort() |
|
203 |
.getProjection().getAbrev(), true); |
|
204 |
map.setExtent(mapCtrl.getMapContext().getViewPort().getExtent()); |
|
205 |
return map; |
|
206 |
} |
|
181 | 207 |
|
182 |
//minscale |
|
183 |
System.out.println("Minscale: " + lyr.getMinScale()); |
|
208 |
private MapServer.WebMap getWebMap(String onlineResource, |
|
209 |
String imagePath, |
|
210 |
String imageURL){ |
|
211 |
MapServer.WebMap webMap = new MapServer.WebMap(); |
|
212 |
webMap.imagepath = imagePath; |
|
213 |
webMap.imageurl = imageURL; |
|
214 |
webMap.metadata = new MapServer.MetadataWeb(); |
|
215 |
webMap.metadata.crs = new CRS(mapCtrl.getMapContext().getViewPort() |
|
216 |
.getProjection().getAbrev(), false); |
|
217 |
|
|
218 |
webMap.metadata.title = "test shape"; |
|
219 |
webMap.metadata.onlineresource = onlineResource; |
|
220 |
return webMap; |
|
221 |
} |
|
184 | 222 |
|
185 |
//color and transparency |
|
186 |
if(lyr instanceof FLyrVect){ |
|
187 |
System.out.println("This is a vectorial datasource"); |
|
188 |
FLyrVect lyrvec2 = (FLyrVect) lyr; |
|
189 |
Color clr = lyrvec2.getLegend().getDefaultSymbol().getColor(); |
|
190 |
System.out.println("R: " + clr.getRed() + " G: " + clr.getGreen() + " B: " + clr.getBlue()); |
|
191 |
|
|
192 |
int alpha = lyrvec2.getLegend().getDefaultSymbol().getColor().getAlpha(); |
|
193 |
System.out.println("Tranparency: " + (255 - alpha)); |
|
194 |
|
|
195 |
}else{ |
|
196 |
System.out.println("Esto no es una capa vectorial"); |
|
197 |
} |
|
223 |
/** |
|
224 |
* Remove the "." from the file name |
|
225 |
* @param file |
|
226 |
* @return |
|
227 |
*/ |
|
228 |
private String getLayerName(String file){ |
|
229 |
String[] s = file.split("\\."); |
|
230 |
if ((s != null) && (s.length > 0)){ |
|
231 |
return s[0]; |
|
232 |
} |
|
233 |
return file; |
|
234 |
} |
|
198 | 235 |
|
199 |
//srs viewPort |
|
200 |
System.out.println(mapCtrl.getMapContext().getViewPort().getProjection().getAbrev()); |
|
201 |
*/ |
|
236 |
/** |
|
237 |
* Gets the geometry type from a shape |
|
238 |
* @param lyrVect |
|
239 |
* @return |
|
240 |
*/ |
|
241 |
private String getShpType(FLyrVect lyrVect){ |
|
242 |
try { |
|
243 |
int lyrType = lyrVect.getShapeType(); |
|
244 |
switch(lyrType){ |
|
245 |
case (FShape.POLYGON): |
|
246 |
return MapServer.SHP_TYPE_POLYGON; |
|
247 |
case FShape.LINE: |
|
248 |
return MapServer.SHP_TYPE_LINE; |
|
249 |
case (FShape.POINT | FShape.MULTIPOINT): |
|
250 |
return MapServer.SHP_TYPE_POINT; |
|
251 |
} |
|
252 |
} catch (DriverException e) { |
|
253 |
// TODO Auto-generated catch block |
|
254 |
e.printStackTrace(); |
|
255 |
} |
|
256 |
return MapServer.SHP_TYPE_POLYGON; |
|
257 |
} |
|
258 |
} |
|
259 |
|
|
260 |
// print specific mapserver's atributes |
|
261 |
/* |
|
262 |
* System.out.println("Ruta mapFile:"+ mapFile); System.out.println("Ruta |
|
263 |
* symbolsFile:" + symbolsFile); System.out.println("Ruta fonstFile:" + |
|
264 |
* fontsFile); System.out.println("Ruta onlineResource:" + onlineResource ); |
|
265 |
* System.out.println("Ruta onlineResource:" + shapePath); |
|
266 |
* |
|
267 |
* //print atributes for all layers for (int i= 0; i < layers.getLayersCount(); |
|
268 |
* i++ ){ FLayer lyr= layers.getLayer(i); //name layer |
|
269 |
* System.out.println("Nombre de la capa: " + lyr.getName()); |
|
270 |
* |
|
271 |
* //vectorial file path FLyrVect lyrvec = (FLyrVect) lyr; ReadableVectorial rv = |
|
272 |
* lyrvec.getSource(); if (rv instanceof VectorialFileAdapter){ |
|
273 |
* VectorialFileAdapter vfa = (VectorialFileAdapter) rv; |
|
274 |
* System.out.println("Absolute Path: " + vfa.getFile().getAbsoluteFile()); |
|
275 |
* System.out.println("File Name: " + vfa.getFile().getName()); } |
|
276 |
* // extext Rectangle2D rect = null; try { rect = lyr.getFullExtent(); } catch |
|
277 |
* (DriverException e) { // TODO Auto-generated catch block e.printStackTrace(); } |
|
278 |
* System.out.println("Extent: " + rect.getMinX() + " " + rect.getMinY() + " " + |
|
279 |
* rect.getMaxX() + " " + rect.getMaxY()); |
|
280 |
* |
|
281 |
* |
|
282 |
* //maxscale System.out.println("Maxscale: " + lyr.getMaxScale()); |
|
283 |
* |
|
284 |
* //minscale System.out.println("Minscale: " + lyr.getMinScale()); |
|
285 |
* |
|
286 |
* //color and transparency if(lyr instanceof FLyrVect){ |
|
287 |
* System.out.println("This is a vectorial datasource"); FLyrVect lyrvec2 = |
|
288 |
* (FLyrVect) lyr; Color clr = |
|
289 |
* lyrvec2.getLegend().getDefaultSymbol().getColor(); System.out.println("R: " + |
|
290 |
* clr.getRed() + " G: " + clr.getGreen() + " B: " + clr.getBlue()); |
|
291 |
* |
|
292 |
* int alpha = lyrvec2.getLegend().getDefaultSymbol().getColor().getAlpha(); |
|
293 |
* System.out.println("Tranparency: " + (255 - alpha)); |
|
294 |
* |
|
295 |
* }else{ System.out.println("Esto no es una capa vectorial"); } |
|
296 |
* |
|
297 |
* //srs viewPort |
|
298 |
* System.out.println(mapCtrl.getMapContext().getViewPort().getProjection().getAbrev()); |
|
299 |
*/ |
trunk/extensions/extPublish/src/org/gvsig/remoteservices/conf/mapserver/MapServer.java | ||
---|---|---|
44 | 44 |
* |
45 | 45 |
* $Id$ |
46 | 46 |
* $Log$ |
47 |
* Revision 1.5 2006-09-07 12:47:39 jorpiell |
|
47 |
* Revision 1.6 2006-09-07 12:51:54 jorpiell |
|
48 |
* Enganchada la interfaz gr?fica con el generador de ficheros |
|
49 |
* |
|
50 |
* Revision 1.5 2006/09/07 12:47:39 jorpiell |
|
48 | 51 |
* A?adida la expression en el classMap |
49 | 52 |
* |
50 | 53 |
* Revision 1.4 2006/09/07 11:19:40 jvhigon |
... | ... | |
338 | 341 |
public String title; |
339 | 342 |
public String status = "ON"; |
340 | 343 |
public String type = null; |
344 |
public int transparency = 0; |
|
341 | 345 |
public ArrayList classList = null; |
342 | 346 |
public ArrayList layerList = null; |
343 | 347 |
public String data; |
... | ... | |
354 | 358 |
tabIn(); |
355 | 359 |
toMapln("NAME \""+name+"\""); |
356 | 360 |
toMapln("STATUS "+status); |
361 |
toMapln("TRANSPARENCY " + transparency); |
|
357 | 362 |
if (type != null) |
358 | 363 |
toMapln("TYPE "+type); |
359 | 364 |
if (dump) |
Also available in: Unified diff