本文整理汇总了C#中ICoordinateSystem类的典型用法代码示例。如果您正苦于以下问题:C# ICoordinateSystem类的具体用法?C# ICoordinateSystem怎么用?C# ICoordinateSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICoordinateSystem类属于命名空间,在下文中一共展示了ICoordinateSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ActualCoordinateSystem
internal ActualCoordinateSystem(ICoordinateSystem coordinateSystem)
{
if (coordinateSystem == null)
throw new ArgumentNullException("coordinateSystem"); //NOXLATE
CoordinateTransformationFactory f = new CoordinateTransformationFactory();
CoordinateSystemFactory cf = new CoordinateSystemFactory();
m_transform = f.CreateFromCoordinateSystems(coordinateSystem, cf.CreateFromWkt(XY_M));
}
示例2: CreateFromCoordinateSystems
/// <summary>
/// Creates a transformation between two coordinate systems.
/// </summary>
/// <remarks>
/// This method will examine the coordinate systems in order to construct
/// a transformation between them. This method may fail if no path between
/// the coordinate systems is found, using the normal failing behavior of
/// the DCP (e.g. throwing an exception).</remarks>
/// <param name="sourceCS">Source coordinate system</param>
/// <param name="targetCS">Target coordinate system</param>
/// <returns></returns>
public ICoordinateTransformation CreateFromCoordinateSystems(ICoordinateSystem sourceCS, ICoordinateSystem targetCS)
{
ICoordinateTransformation trans;
if (sourceCS is IProjectedCoordinateSystem && targetCS is IGeographicCoordinateSystem) //Projected -> Geographic
trans = Proj2Geog((IProjectedCoordinateSystem)sourceCS, (IGeographicCoordinateSystem)targetCS);
else if (sourceCS is IGeographicCoordinateSystem && targetCS is IProjectedCoordinateSystem) //Geographic -> Projected
trans = Geog2Proj((IGeographicCoordinateSystem)sourceCS, (IProjectedCoordinateSystem)targetCS);
else if (sourceCS is IGeographicCoordinateSystem && targetCS is IGeocentricCoordinateSystem) //Geocentric -> Geographic
trans = Geog2Geoc((IGeographicCoordinateSystem)sourceCS, (IGeocentricCoordinateSystem)targetCS);
else if (sourceCS is IGeocentricCoordinateSystem && targetCS is IGeographicCoordinateSystem) //Geocentric -> Geographic
trans = Geoc2Geog((IGeocentricCoordinateSystem)sourceCS, (IGeographicCoordinateSystem)targetCS);
else if (sourceCS is IProjectedCoordinateSystem && targetCS is IProjectedCoordinateSystem) //Projected -> Projected
trans = Proj2Proj((sourceCS as IProjectedCoordinateSystem), (targetCS as IProjectedCoordinateSystem));
else if (sourceCS is IGeocentricCoordinateSystem && targetCS is IGeocentricCoordinateSystem) //Geocentric -> Geocentric
trans = CreateGeoc2Geoc((IGeocentricCoordinateSystem)sourceCS, (IGeocentricCoordinateSystem)targetCS);
else if (sourceCS is IGeographicCoordinateSystem && targetCS is IGeographicCoordinateSystem) //Geographic -> Geographic
trans = CreateGeog2Geog(sourceCS as IGeographicCoordinateSystem, targetCS as IGeographicCoordinateSystem);
else
throw new NotSupportedException("No support for transforming between the two specified coordinate systems");
//if (trans.MathTransform is ConcatenatedTransform) {
// List<ICoordinateTransformation> MTs = new List<ICoordinateTransformation>();
// SimplifyTrans(trans.MathTransform as ConcatenatedTransform, ref MTs);
// return new CoordinateTransformation(sourceCS,
// targetCS, TransformType.Transformation, new ConcatenatedTransform(MTs),
// String.Empty, String.Empty, -1, String.Empty, String.Empty);
//}
return trans;
}
示例3: CompoundCoordinateSystem
/// <summary>
/// Creates a compound coordinate system.
/// </summary>
/// <param name="headCRS">The first coordinate system.</param>
/// <param name="tailCRS">The second coordinate system.</param>
/// <param name="remarks">Remarks about this object.</param>
/// <param name="authority">The name of the authority.</param>
/// <param name="authorityCode">The code the authority uses to identidy this object.</param>
/// <param name="name">The name of the object.</param>
/// <param name="alias">The alias of the object.</param>
/// <param name="abbreviation">The abbreviated name of this object.</param>
internal CompoundCoordinateSystem(ICoordinateSystem headCRS,
ICoordinateSystem tailCRS,
string remarks, string authority, string authorityCode, string name, string alias, string abbreviation)
: base(remarks, authority, authorityCode, name, alias, abbreviation)
{
if (headCRS==null)
{
throw new ArgumentNullException("headCRS");
}
if (tailCRS==null)
{
throw new ArgumentNullException("tailCRS");
}
_headCRS = headCRS;
_tailCRS = tailCRS;
_axisInfo = new IAxisInfo[this.Dimension];
// copy axis information
for(int i=0;i<headCRS.Dimension;i++)
{
_axisInfo[i]=_headCRS.GetAxis(i);
}
int offset=headCRS.Dimension;
for (int i=0;i<tailCRS.Dimension;i++)
{
_axisInfo[i+offset]=_tailCRS.GetAxis(i);
}
}
示例4: Test
public void Test(string title, ICoordinateSystem source, ICoordinateSystem target,
double[] testPoint, double[] expectedPoint,
double tolerance, double reverseTolerance = double.NaN)
{
var ct = CoordinateTransformationFactory.CreateFromCoordinateSystems(source, target);
var forwardResult = ct.MathTransform.Transform(testPoint);
var reverseResult = Double.IsNaN(reverseTolerance)
? testPoint
: ct.MathTransform.Inverse().Transform(forwardResult);
var forward = ToleranceLessThan(forwardResult, expectedPoint, tolerance);
var reverse = Double.IsNaN(reverseTolerance) ||
ToleranceLessThan(reverseResult, testPoint, reverseTolerance);
if (!forward)
TransformationError(title, expectedPoint, forwardResult);
if (!reverse)
TransformationError(title, testPoint, reverseResult, true);
Assert.IsTrue(forward && reverse);
}
示例5: Transform2Lambert
public static ProjNet.CoordinateSystems.Transformations.ICoordinateTransformation Transform2Lambert(ICoordinateSystem source)
{
if (source == null)
throw new ArgumentException("Source coordinate system is null");
if (!(source is IGeographicCoordinateSystem))
throw new ArgumentException("Source coordinate system must be geographic");
CoordinateSystemFactory cFac = new CoordinateSystemFactory();
List<ProjectionParameter> parameters = new List<ProjectionParameter>();
parameters.Add(new ProjectionParameter("latitude_of_origin", 50));
parameters.Add(new ProjectionParameter("central_meridian", -95));
parameters.Add(new ProjectionParameter("standard_parallel_1", 33));
parameters.Add(new ProjectionParameter("standard_parallel_2", 45));
parameters.Add(new ProjectionParameter("false_easting", 0));
parameters.Add(new ProjectionParameter("false_northing", 0));
IProjection projection = cFac.CreateProjection("Lambert Conformal Conic 2SP", "lambert_conformal_conic_2sp",
parameters);
IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Lambert Conformal Conic 2SP",
source as IGeographicCoordinateSystem,
projection, ProjNet.CoordinateSystems.LinearUnit.Metre,
new AxisInfo("East",
AxisOrientationEnum.East),
new AxisInfo("North",
AxisOrientationEnum.
North));
return new CoordinateTransformationFactory().CreateFromCoordinateSystems(source, coordsys);
}
示例6: CreateFromCoordinateSystems
/// <summary>
/// Creates a transformation between two coordinate systems.
/// </summary>
/// <remarks>
/// This method will examine the coordinate systems in order to construct
/// a transformation between them. This method may fail if no path between
/// the coordinate systems is found, using the normal failing behavior of
/// the DCP (e.g. throwing an exception).</remarks>
/// <param name="sourceCS">Source coordinate system</param>
/// <param name="targetCS">Target coordinate system</param>
/// <returns></returns>
public ICoordinateTransformation CreateFromCoordinateSystems(ICoordinateSystem sourceCS, ICoordinateSystem targetCS)
{
if ((sourceCS is IProjectedCoordinateSystem) && (targetCS is IGeographicCoordinateSystem))
{
return Proj2Geog((IProjectedCoordinateSystem) sourceCS, (IGeographicCoordinateSystem) targetCS);
}
if ((sourceCS is IGeographicCoordinateSystem) && (targetCS is IProjectedCoordinateSystem))
{
return Geog2Proj((IGeographicCoordinateSystem) sourceCS, (IProjectedCoordinateSystem) targetCS);
}
if ((sourceCS is IGeographicCoordinateSystem) && (targetCS is IGeocentricCoordinateSystem))
{
return Geog2Geoc((IGeographicCoordinateSystem) sourceCS, (IGeocentricCoordinateSystem) targetCS);
}
if ((sourceCS is IGeocentricCoordinateSystem) && (targetCS is IGeographicCoordinateSystem))
{
return Geoc2Geog((IGeocentricCoordinateSystem) sourceCS, (IGeographicCoordinateSystem) targetCS);
}
if ((sourceCS is IProjectedCoordinateSystem) && (targetCS is IProjectedCoordinateSystem))
{
return Proj2Proj(sourceCS as IProjectedCoordinateSystem, targetCS as IProjectedCoordinateSystem);
}
if ((sourceCS is IGeocentricCoordinateSystem) && (targetCS is IGeocentricCoordinateSystem))
{
return CreateGeoc2Geoc((IGeocentricCoordinateSystem) sourceCS, (IGeocentricCoordinateSystem) targetCS);
}
if (!(sourceCS is IGeographicCoordinateSystem) || !(targetCS is IGeographicCoordinateSystem))
{
throw new NotSupportedException("No support for transforming between the two specified coordinate systems");
}
return this.CreateGeog2Geog(sourceCS as IGeographicCoordinateSystem, targetCS as IGeographicCoordinateSystem);
}
示例7: CreateFromCoordinateSystems
/// <summary>
/// Creates a transformation between two coordinate systems.
/// </summary>
/// <remarks>
/// This method will examine the coordinate systems in order to construct
/// a transformation between them. This method may fail if no path between
/// the coordinate systems is found, using the normal failing behavior of
/// the DCP (e.g. throwing an exception).</remarks>
/// <param name="sourceCS">Source coordinate system</param>
/// <param name="targetCS">Target coordinate system</param>
/// <returns></returns>
public ICoordinateTransformation CreateFromCoordinateSystems(ICoordinateSystem sourceCS, ICoordinateSystem targetCS)
{
if (sourceCS is IProjectedCoordinateSystem && targetCS is IGeographicCoordinateSystem) //Projected -> Geographic
return Proj2Geog((IProjectedCoordinateSystem)sourceCS, (IGeographicCoordinateSystem)targetCS);
else if (sourceCS is IGeographicCoordinateSystem && targetCS is IProjectedCoordinateSystem) //Geographic -> Projected
return Geog2Proj((IGeographicCoordinateSystem)sourceCS, (IProjectedCoordinateSystem)targetCS);
else if (sourceCS is IGeographicCoordinateSystem && targetCS is IGeocentricCoordinateSystem) //Geocentric -> Geographic
return Geog2Geoc((IGeographicCoordinateSystem)sourceCS, (IGeocentricCoordinateSystem)targetCS);
else if (sourceCS is IGeocentricCoordinateSystem && targetCS is IGeographicCoordinateSystem) //Geocentric -> Geographic
return Geoc2Geog((IGeocentricCoordinateSystem)sourceCS, (IGeographicCoordinateSystem)targetCS);
else if (sourceCS is IProjectedCoordinateSystem && targetCS is IProjectedCoordinateSystem) //Projected -> Projected
return Proj2Proj((sourceCS as IProjectedCoordinateSystem),(targetCS as IProjectedCoordinateSystem));
else if (sourceCS is IGeocentricCoordinateSystem && targetCS is IGeocentricCoordinateSystem) //Geocentric -> Geocentric
return CreateGeoc2Geoc((IGeocentricCoordinateSystem)sourceCS, (IGeocentricCoordinateSystem)targetCS);
else if (sourceCS is IGeographicCoordinateSystem && targetCS is IGeographicCoordinateSystem) //Geographic -> Geographic
return CreateGeog2Geog(sourceCS as IGeographicCoordinateSystem, targetCS as IGeographicCoordinateSystem);
throw new NotSupportedException("No support for transforming between the two specified coordinate systems");
}
示例8: RenderFeatures
public void RenderFeatures(ICoordinateSystem coordsys, IEnumerable<IFeature> items)
{
if (items == null) return;
m_sourceCoordsys = coordsys;
foreach (IFeature g in items)
{
IGeometry geom = g.Geometry;
if (ProjectionConverter != null)
{
geom = ProjectionConverter(this, geom);
if (geom == null) continue;
}
if (Generalizer != null)
{
geom = Generalizer(this, geom);
if (geom == null) continue;
}
if (CoordinateMapper != null)
geom = CoordinateMapper(this, geom);
else
geom = PrimitiveCoordinateMapper(geom);
if (geom == null) continue;
Draw(geom, g.Style);
}
m_sourceCoordsys = null;
}
示例9: SqlGeography
internal SqlGeography(SqlTypes.SqlGeography sg, ICoordinateSystem coordinateSystem)
{
Debug.Assert(sg!=null);
if (sg==null)
throw new ArgumentNullException("sg");
_Geography=sg;
_CoordinateSystem=coordinateSystem;
}
示例10: SpatialGeometry
internal SpatialGeometry(DbGeometry g, ICoordinateSystem coordinateSystem)
{
Debug.Assert(g!=null);
if (g==null)
throw new ArgumentNullException("g");
_Geometry=g;
_CoordinateSystem=coordinateSystem;
}
示例11: Parse
/// <summary>Parses the geometry defined by the specified WKT representation, in the specified coordinate system.</summary>
/// <param name="text">The WKT representation of the geometry.</param>
/// <param name="system">The coordinate system of the WKT representation.</param>
public void Parse(string text, ICoordinateSystem system)
{
Debug.Assert(system!=null);
if (system==null)
throw new ArgumentNullException("system");
_Builder=new Gml.GmlGeometryBuilder(system);
_Builder.Parse(text, system);
}
示例12: IsEquivalentTo
/// <summary>Indicates whether the current coordinate system is equivalent to the specified one.</summary>
/// <param name="other">The coordinate system to compare the current one against.</param>
/// <returns><c>true</c> if the coordinate systems are equivalent; or else <c>false</c>.</returns>
public bool IsEquivalentTo(ICoordinateSystem other)
{
if (other==null)
return false;
if (Equals(other))
return true;
return false;
}
示例13: ProjNetSpatialReference
public ProjNetSpatialReference(ICoordinateSystem cs)
{
var authorityCode = cs.AuthorityCode;
if (authorityCode <= 0)
{
authorityCode = ++_newId;
}
_oid = cs.Authority ?? "SM" + ":" + authorityCode;
Definition = cs.WKT;
CoordinateSystem = cs;
}
示例14: Convert
public static DsProjections.ProjectionInfo Convert(ICoordinateSystem system)
{
if (system==null)
return null;
var cs=system as CoordinateSystem;
if (cs==null)
return DsProjections.ProjectionInfo.FromEsriString(system.ToString());
return cs.Projection;
}
示例15: Equals
/// <summary>Indicates whether the current coordinate system is equal to the specified one.</summary>
/// <param name="other">The coordinate system to compare the current one against.</param>
/// <returns><c>true</c> if the coordinate systems are equal; or else <c>false</c>.</returns>
public bool Equals(ICoordinateSystem other)
{
if (other==null)
return false;
var cs=other as CoordinateSystem;
if (cs!=null)
return _System.Equals(cs._System) || _System.EqualParams(cs._System);
return false;
}