本文整理汇总了C#中IProjection.GetParameter方法的典型用法代码示例。如果您正苦于以下问题:C# IProjection.GetParameter方法的具体用法?C# IProjection.GetParameter怎么用?C# IProjection.GetParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProjection
的用法示例。
在下文中一共展示了IProjection.GetParameter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCoordinateOperation
private static IMathTransform CreateCoordinateOperation(IProjection projection, IEllipsoid ellipsoid)
{
List<ProjectionParameter> parameterList = new List<ProjectionParameter>(projection.NumParameters);
for (int i = 0; i < projection.NumParameters; i++)
parameterList.Add(projection.GetParameter(i));
parameterList.Add(new ProjectionParameter("semi_major", ellipsoid.SemiMajorAxis));
parameterList.Add(new ProjectionParameter("semi_minor", ellipsoid.SemiMinorAxis));
IMathTransform transform = null;
switch (projection.ClassName.ToLower())
{
case "mercator_1sp":
case "mercator_2sp":
//1SP
transform = new Mercator(parameterList);
break;
case "transverse_mercator":
transform = new TransverseMercator(parameterList);
break;
case "albers":
transform = new AlbersProjection(parameterList);
break;
case "lambert_conformal_conic":
case "lambert_conformal_conic_2sp":
transform = new LambertConformalConic2SP(parameterList);
break;
default:
throw new NotSupportedException(String.Format("Projection {0} is not supported.", projection.ClassName));
}
return transform;
}
示例2: CreateCoordinateOperation
public static IMathTransform CreateCoordinateOperation(IProjection projection, IEllipsoid ellipsoid)
{
ParameterList parameterList = new ParameterList();
for(int i=0; i< projection.NumParameters; i++)
{
ProjectionParameter param = projection.GetParameter(i);
parameterList.Add(param.Name,param.Value);
}
parameterList.Add("semi_major",ellipsoid.SemiMajorAxis);
parameterList.Add("semi_minor",ellipsoid.SemiMinorAxis);
IMathTransform transform = null;
switch(projection.Name.ToLower())
{
case "mercator":
//1SP
transform = new MercatorProjection(parameterList);
break;
case "transverse_mercator":
transform = new TransverseMercatorProjection(parameterList);
break;
case "albers":
transform = new AlbersProjection(parameterList);
break;
case "lambert":
transform = new LambertConformalConic2SPProjection(parameterList);
break;
default:
throw new NotSupportedException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Projection {0} is not supported.",projection.AuthorityCode));
}
return transform;
}
示例3: CreateCoordinateOperation
/// <summary>
/// Given a IProjection and a IEllipsoid, createa a IMathTransform with the required parameters.
/// </summary>
/// <param name="projection">The projection information.</param>
/// <param name="ellipsoid">The ellipsoid to use.</param>
/// <returns>An object that implements the IMathTransform interface.</returns>
private IMathTransform CreateCoordinateOperation(IProjection projection, IEllipsoid ellipsoid)
{
ParameterList parameterList = new ParameterList();
for(int i=0; i< projection.NumParameters; i++)
{
ProjectionParameter param = projection.GetParameter(i);
parameterList.Add(param.Name,param.Value);
}
parameterList.Add("semi_major",ellipsoid.SemiMajorAxis);
parameterList.Add("semi_minor",ellipsoid.SemiMinorAxis);
IMathTransform transform = null;
switch(projection.AuthorityCode)
{
case "9804":
//1SP
transform = new MercatorProjection(parameterList);
break;
case "9805":
//2SP
transform = new MercatorProjection(parameterList);
break;
case "9807":
transform = new TransverseMercatorProjection(parameterList);
break;
case "9633":
// we should get these parameters from the file - but since we know them....
ParameterList param = new ParameterList();
parameterList.Add("latitude_of_natural_origin",49.0);
parameterList.Add("longitude_of_natural_origin",-2.0);
parameterList.Add("scale_factor_at_natural_origin",0.999601272);
parameterList.Add("false_easting",400000.0);
parameterList.Add("false_northing",-100000.0);
transform = new MercatorProjection(parameterList);
break;
default:
throw new NotSupportedException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Projection {0} is not supported.",projection.AuthorityCode));
}
return transform;
}
示例4: CreateCoordinateOperation
private static IMathTransform CreateCoordinateOperation(IProjection projection, IEllipsoid ellipsoid, ILinearUnit unit)
{
List<ProjectionParameter> parameterList = new List<ProjectionParameter>(projection.NumParameters);
for (int i = 0; i < projection.NumParameters; i++)
parameterList.Add(projection.GetParameter(i));
parameterList.Add(new ProjectionParameter("semi_major", ellipsoid.SemiMajorAxis));
parameterList.Add(new ProjectionParameter("semi_minor", ellipsoid.SemiMinorAxis));
parameterList.Add(new ProjectionParameter("unit", unit.MetersPerUnit));
IMathTransform transform = null;
switch (projection.ClassName.ToLower(CultureInfo.InvariantCulture).Replace(' ', '_'))
{
case "mercator":
case "mercator_1sp":
case "mercator_2sp":
//1SP
transform = new Mercator(parameterList);
break;
case "transverse_mercator":
transform = new TransverseMercator(parameterList);
break;
case "albers":
case "albers_conic_equal_area":
transform = new AlbersProjection(parameterList);
break;
case "krovak":
transform = new KrovakProjection(parameterList);
break;
case "lambert_conformal_conic":
case "lambert_conformal_conic_2sp":
case "lambert_conic_conformal_(2sp)":
transform = new LambertConformalConic2SP(parameterList);
break;
default:
throw new NotSupportedException(String.Format("Projection {0} is not supported.", projection.ClassName));
}
return transform;
}
示例5: CreateCoordinateOperation
private static IMathTransform CreateCoordinateOperation(IProjection projection, IEllipsoid ellipsoid, ILinearUnit unit)
{
var parameterList = new List<ProjectionParameter>(projection.NumParameters);
for (var i = 0; i < projection.NumParameters; i++)
parameterList.Add(projection.GetParameter(i));
//var toMeter = 1d/ellipsoid.AxisUnit.MetersPerUnit;
if (parameterList.Find((p) => p.Name.ToLowerInvariant().Replace(' ', '_').Equals("semi_major")) == null)
parameterList.Add(new ProjectionParameter("semi_major", /*toMeter * */ellipsoid.SemiMajorAxis));
if (parameterList.Find((p) => p.Name.ToLowerInvariant().Replace(' ', '_').Equals("semi_minor")) == null)
parameterList.Add(new ProjectionParameter("semi_minor", /*toMeter * */ellipsoid.SemiMinorAxis));
if (parameterList.Find((p) => p.Name.ToLowerInvariant().Replace(' ', '_').Equals("unit")) == null)
parameterList.Add(new ProjectionParameter("unit", unit.MetersPerUnit));
var operation = ProjectionsRegistry.CreateProjection(projection.ClassName, parameterList);
/*
var mpOperation = operation as MapProjection;
if (mpOperation != null && projection.AuthorityCode !=-1)
{
mpOperation.Authority = projection.Authority;
mpOperation.AuthorityCode = projection.AuthorityCode;
}
*/
return operation;
/*
switch (projection.ClassName.ToLower(CultureInfo.InvariantCulture).Replace(' ', '_'))
{
case "mercator":
case "mercator_1sp":
case "mercator_2sp":
//1SP
transform = new Mercator(parameterList);
break;
case "transverse_mercator":
transform = new TransverseMercator(parameterList);
break;
case "albers":
case "albers_conic_equal_area":
transform = new AlbersProjection(parameterList);
break;
case "krovak":
transform = new KrovakProjection(parameterList);
break;
case "polyconic":
transform = new PolyconicProjection(parameterList);
break;
case "lambert_conformal_conic":
case "lambert_conformal_conic_2sp":
case "lambert_conic_conformal_(2sp)":
transform = new LambertConformalConic2SP(parameterList);
break;
default:
throw new NotSupportedException(String.Format("Projection {0} is not supported.", projection.ClassName));
}
return transform;
*/
}
示例6: WriteProjection
private static void WriteProjection(IProjection projection, IndentedTextWriter writer)
{
writer.WriteLine(String.Format(System.Globalization.CultureInfo.InvariantCulture, "PROJECTION[\"{0}\"],",projection.Name));
for (int i=0;i<projection.NumParameters; i++)
{
string paramName = projection.GetParameter(i).Name;
double paramValue = projection.GetParameter(i).Value;
writer.WriteLine(String.Format(System.Globalization.CultureInfo.InvariantCulture, "PARAMETER[\"{0}\",{1}],",paramName,paramValue));
}
}