46 |
46 |
import javax.units.ConversionException;
|
47 |
47 |
import javax.units.Unit;
|
48 |
48 |
|
|
49 |
import org.geotools.referencing.CRS;
|
49 |
50 |
import org.geotools.referencing.crs.DefaultGeographicCRS;
|
50 |
51 |
import org.geotools.referencing.crs.DefaultProjectedCRS;
|
51 |
52 |
import org.geotools.referencing.datum.DefaultGeodeticDatum;
|
52 |
53 |
import org.geotools.referencing.datum.DefaultPrimeMeridian;
|
53 |
54 |
import org.opengis.metadata.Identifier;
|
|
55 |
import org.opengis.referencing.NoSuchAuthorityCodeException;
|
54 |
56 |
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
55 |
57 |
import org.opengis.referencing.datum.Ellipsoid;
|
56 |
58 |
import org.opengis.referencing.datum.PrimeMeridian;
|
... | ... | |
85 |
87 |
*/
|
86 |
88 |
private static final double EPS = 1E-8;
|
87 |
89 |
|
|
90 |
/**
|
|
91 |
* EPSG codes of the Swiss Oblique Mercator CRSs
|
|
92 |
*/
|
|
93 |
private static final Integer[] somerc_codes = { 2056, 21780, 21781, 21782, 23700 };
|
|
94 |
|
88 |
95 |
public Proj4() throws CrsException
|
89 |
96 |
{
|
90 |
97 |
//defineProjectionNames();
|
... | ... | |
3300 |
3307 |
if(projectionName.equals("Oblique_Mercator"))
|
3301 |
3308 |
{
|
3302 |
3309 |
isOmerc=true;
|
3303 |
|
if (crs.getCode()==21781)
|
3304 |
|
isSomerc=true;
|
|
3310 |
for (int i = 0; i < somerc_codes.length; i++) {
|
|
3311 |
if (crs.getCode() == somerc_codes[i])
|
|
3312 |
isSomerc=true;
|
|
3313 |
}
|
3305 |
3314 |
for(int j=0;j<gtParameterNames.length;j++)
|
3306 |
3315 |
{
|
3307 |
3316 |
String gtParameterName=gtParameterNames[j].trim();
|
... | ... | |
3383 |
3392 |
}
|
3384 |
3393 |
}
|
3385 |
3394 |
String strProjectionAcronym=projectionAcronym[0];
|
|
3395 |
if(isSomerc)
|
|
3396 |
strProjectionAcronym="somerc";
|
3386 |
3397 |
String strExtraProj4="";
|
3387 |
3398 |
// Control de casos especiales
|
3388 |
3399 |
boolean isLaborde=false;
|
... | ... | |
3586 |
3597 |
}
|
3587 |
3598 |
if(isSomerc)
|
3588 |
3599 |
{
|
3589 |
|
if(parameterName.equals("rectified_grid_angle"))
|
|
3600 |
if(parameterName.equals("rectified_grid_angle")
|
|
3601 |
||parameterName.equals("azimuth"))
|
3590 |
3602 |
control=false;
|
3591 |
|
if(parameterName.equals("azimuth"))
|
3592 |
|
control=false;
|
|
3603 |
if(parameterAcronym.equals("lonc"))
|
|
3604 |
parameterAcronym="lon_0";
|
|
3605 |
if(parameterAcronym.equals("k"))
|
|
3606 |
parameterAcronym="k_0";
|
3593 |
3607 |
}
|
3594 |
3608 |
if(isOmerc)
|
3595 |
3609 |
{
|
... | ... | |
3926 |
3941 |
if(projectionName.equals("Oblique_Mercator"))
|
3927 |
3942 |
{
|
3928 |
3943 |
isOmerc=true;
|
3929 |
|
// TODO Set isSomerc as true for EPSG:21781
|
3930 |
|
//if (crs.getCode()==21781)
|
3931 |
|
// isSomerc=true;
|
|
3944 |
try {
|
|
3945 |
for (int i = 0; i < somerc_codes.length; i++) {
|
|
3946 |
if (crs == CRS.decode("EPSG:" + somerc_codes[i].toString()))
|
|
3947 |
isSomerc=true;
|
|
3948 |
}
|
|
3949 |
} catch (NoSuchAuthorityCodeException e) {
|
|
3950 |
// TODO Auto-generated catch block
|
|
3951 |
e.printStackTrace();
|
|
3952 |
}
|
3932 |
3953 |
for(int j=0;j<gtParameterNames.length;j++)
|
3933 |
3954 |
{
|
3934 |
3955 |
String gtParameterName=gtParameterNames[j].trim();
|
... | ... | |
4010 |
4031 |
String projAcronym=projectionAcronym[0];
|
4011 |
4032 |
if(isLcc)
|
4012 |
4033 |
projAcronym="lcc";
|
|
4034 |
if(isSomerc)
|
|
4035 |
projAcronym="somerc";
|
4013 |
4036 |
String strExtraProj4="";
|
4014 |
4037 |
// Control de casos especiales
|
4015 |
4038 |
boolean isLaborde=false;
|
... | ... | |
4204 |
4227 |
}
|
4205 |
4228 |
if(isSomerc)
|
4206 |
4229 |
{
|
4207 |
|
if(parameterName.equals("rectified_grid_angle"))
|
|
4230 |
if(parameterName.equals("rectified_grid_angle")
|
|
4231 |
||parameterName.equals("azimuth"))
|
4208 |
4232 |
control=false;
|
4209 |
|
if(parameterName.equals("azimuth"))
|
4210 |
|
control=false;
|
|
4233 |
if(parameterAcronym.equals("lonc"))
|
|
4234 |
parameterAcronym="lon_0";
|
|
4235 |
if(parameterAcronym.equals("k"))
|
|
4236 |
parameterAcronym="k_0";
|
4211 |
4237 |
}
|
4212 |
4238 |
if(isOmerc)
|
4213 |
4239 |
{
|