svn-gvsig-desktop / tags / v10_RC2c / libraries / libFMap / src / com / iver / cit / gvsig / fmap / edition / writers / gml / GMLBoundedBy.java @ 8745
History | View | Annotate | Download (2.54 KB)
1 |
package com.iver.cit.gvsig.fmap.edition.writers.gml; |
---|---|
2 |
|
3 |
import org.cresques.cts.IProjection; |
4 |
import org.cresques.cts.ProjectionPool; |
5 |
|
6 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
7 |
import com.iver.utiles.StringUtilities; |
8 |
|
9 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
10 |
*
|
11 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
12 |
*
|
13 |
* This program is free software; you can redistribute it and/or
|
14 |
* modify it under the terms of the GNU General Public License
|
15 |
* as published by the Free Software Foundation; either version 2
|
16 |
* of the License, or (at your option) any later version.
|
17 |
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
26 |
*
|
27 |
* For more information, contact:
|
28 |
*
|
29 |
* Generalitat Valenciana
|
30 |
* Conselleria d'Infraestructures i Transport
|
31 |
* Av. Blasco Ib??ez, 50
|
32 |
* 46010 VALENCIA
|
33 |
* SPAIN
|
34 |
*
|
35 |
* +34 963862235
|
36 |
* gvsig@gva.es
|
37 |
* www.gvsig.gva.es
|
38 |
*
|
39 |
* or
|
40 |
*
|
41 |
* IVER T.I. S.A
|
42 |
* Salamanca 50
|
43 |
* 46005 Valencia
|
44 |
* Spain
|
45 |
*
|
46 |
* +34 963163400
|
47 |
* dac@iver.es
|
48 |
*/
|
49 |
/* CVS MESSAGES:
|
50 |
*
|
51 |
* $Id: GMLBoundedBy.java 8745 2006-11-14 13:14:23Z $
|
52 |
* $Log$
|
53 |
* Revision 1.2.4.1 2006-09-29 14:12:57 luisw2
|
54 |
* CRSFactory.getCRS substitutes ProjectionPool.get
|
55 |
*
|
56 |
* Revision 1.2 2006/08/10 12:03:43 jorpiell
|
57 |
* Se usa el nuevo driver de GML de remoteServices
|
58 |
*
|
59 |
* Revision 1.1 2006/07/19 12:29:39 jorpiell
|
60 |
* A?adido el driver de GML
|
61 |
*
|
62 |
*
|
63 |
*/
|
64 |
/**
|
65 |
* This class is used to get a GML projection tag
|
66 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
67 |
*/
|
68 |
public class GMLBoundedBy { |
69 |
private static final String EPSG_URL = "http://www.opengis.net/gml/srs/epsg.xml#"; |
70 |
|
71 |
public static String fromGvSigToGML(IProjection proj){ |
72 |
if (proj == null){ |
73 |
return EPSG_URL + "23030"; |
74 |
} |
75 |
|
76 |
String srs = proj.getAbrev();
|
77 |
if (srs.compareTo("EPSG") == 0){ |
78 |
if (srs.split(":").length > 1){ |
79 |
return EPSG_URL + srs.split(":")[1]; |
80 |
} |
81 |
} |
82 |
return "http://www.opengis.net/gml/srs/epsg.xml#23030"; |
83 |
} |
84 |
|
85 |
public static IProjection fromGMLToGvSIG(String srs){ |
86 |
srs = StringUtilities.replace(srs,EPSG_URL,"");
|
87 |
srs = "EPSG:" + srs;
|
88 |
IProjection projection = CRSFactory.getCRS(srs); |
89 |
if (projection != null){ |
90 |
return projection;
|
91 |
} |
92 |
return CRSFactory.getCRS("EPSG:23030"); |
93 |
|
94 |
} |
95 |
|
96 |
} |