本文整理汇总了C#中IMathTransform.Transform方法的典型用法代码示例。如果您正苦于以下问题:C# IMathTransform.Transform方法的具体用法?C# IMathTransform.Transform怎么用?C# IMathTransform.Transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMathTransform
的用法示例。
在下文中一共展示了IMathTransform.Transform方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TransformBox
/// <summary>
/// Transforms a <see cref="Envelope"/>.
/// </summary>
/// <param name="box">BoundingBox to transform</param>
/// <param name="transform">Math Transform</param>
/// <returns>Transformed object</returns>
public static Envelope TransformBox(Envelope box, IMathTransform transform)
{
if (box == null)
return null;
var corners = new Coordinate[4];
#if PCL
var ll = new Coordinate(box.MinX, box.MinY);
var ur = new Coordinate(box.MaxX, box.MaxY);
var llTrans = transform.Transform(ll);
var urTrans = transform.Transform(ur);
corners[0] = new Coordinate(llTrans.X, llTrans.Y); //lower left
corners[2] = new Coordinate(llTrans.X, urTrans.Y); //upper left
corners[1] = new Coordinate(urTrans.X, urTrans.Y); //upper right
corners[3] = new Coordinate(urTrans.X, llTrans.Y); //lower right
#else
var ll = box.Min().ToDoubleArray();
var ur = box.Max().ToDoubleArray();
var llTrans = transform.Transform(ll);
var urTrans = transform.Transform(ur);
corners[0] = new Coordinate(llTrans[0], llTrans[1]); //lower left
corners[2] = new Coordinate(llTrans[0], urTrans[1]); //upper left
corners[1] = new Coordinate(urTrans[0], urTrans[1]); //upper right
corners[3] = new Coordinate(urTrans[0], llTrans[1]); //lower right
#endif
var result = new Envelope(corners[0]);
for (var i = 1; i < 4; i++)
result.ExpandToInclude(corners[i]);
return result;
}
示例2: TransformBoundingRectangle
/// <summary>
/// Transforms coordinates of the bounding rectangle.
/// </summary>
/// <param name="box">Rectangle to transform</param>
/// <param name="transform">The transformation to apply</param>
/// <returns>The transformed rectangle</returns>
public static BoundingRectangle TransformBoundingRectangle(BoundingRectangle box, IMathTransform transform)
{
if (box == null)
return null;
ICoordinate[] corners = new ICoordinate[4];
corners[0] = PlanimetryEnvironment.NewCoordinate(transform.Transform(box.Min.Values()));
corners[1] = PlanimetryEnvironment.NewCoordinate(transform.Transform(box.Max.Values()));
corners[2] = PlanimetryEnvironment.NewCoordinate(transform.Transform(PlanimetryEnvironment.NewCoordinate(box.MinX, box.MaxY).Values()));
corners[3] = PlanimetryEnvironment.NewCoordinate(transform.Transform(PlanimetryEnvironment.NewCoordinate(box.MaxX, box.MinY).Values()));
BoundingRectangle result = new BoundingRectangle();
for (int i = 0; i < 4; i++)
result.Join(corners[i]);
return result;
}
示例3: TransformBox
/// <summary>
/// Transforms a <see cref="SharpMap.Geometries.BoundingBox"/>.
/// </summary>
/// <param name="box">BoundingBox to transform</param>
/// <param name="transform">Math Transform</param>
/// <returns>Transformed object</returns>
public static BoundingBox TransformBox(BoundingBox box, IMathTransform transform)
{
if (box == null)
return null;
SharpMap.Geometries.Point[] corners = new Point[4];
corners[0] = transform.Transform(box.Min); //LL
corners[1] = transform.Transform(box.Max); //UR
corners[2] = transform.Transform(new Point(box.Min.X, box.Max.Y)); //UL
corners[3] = transform.Transform(new Point(box.Max.X, box.Min.Y)); //LR
BoundingBox result = corners[0].GetBoundingBox();
for (int i = 1; i < 4; i++)
result = result.Join(corners[i].GetBoundingBox());
return result;
}
示例4: TransformBox
/// <summary>
/// Transforms a <see cref="SharpMap.Geometries.BoundingBox"/>.
/// </summary>
/// <param name="box">BoundingBox to transform</param>
/// <param name="transform">Math Transform</param>
/// <returns>Transformed object</returns>
public static BoundingBox TransformBox(BoundingBox box, IMathTransform transform)
{
if (box == null)
return null;
Point[] corners = new Point[4];
corners[0] = new Point(transform.Transform(box.Min.ToDoubleArray())); //LL
corners[1] = new Point(transform.Transform(box.Max.ToDoubleArray())); //UR
corners[2] = new Point(transform.Transform(new Point(box.Min.X, box.Max.Y).ToDoubleArray())); //UL
corners[3] = new Point(transform.Transform(new Point(box.Max.X, box.Min.Y).ToDoubleArray())); //LR
BoundingBox result = corners[0].GetBoundingBox();
for (int i = 1; i < 4; i++)
result = result.Join(corners[i].GetBoundingBox());
return result;
}
示例5: TransformBox
/// <summary>
/// Transforms a <see cref="Envelope"/>.
/// </summary>
/// <param name="box">BoundingBox to transform</param>
/// <param name="transform">Math Transform</param>
/// <returns>Transformed object</returns>
public static GeoAPI.Geometries.IEnvelope TransformBox(GeoAPI.Geometries.IEnvelope box, IMathTransform transform)
{
if (box == null)
return null;
double[][] corners = new double[4][];
corners[0] = transform.Transform(ToLightStruct(box.MinX, box.MinY)); //LL
corners[1] = transform.Transform(ToLightStruct(box.MaxX, box.MaxY)); //UR
corners[2] = transform.Transform(ToLightStruct(box.MinX, box.MaxY)); //UL
corners[3] = transform.Transform(ToLightStruct(box.MaxX, box.MinY)); //LR
IEnvelope result = GeometryFactory.CreateEnvelope();
foreach (double[] p in corners)
result.ExpandToInclude(p[0], p[1]);
return result;
}
示例6: TransformBox
/// <summary>
/// Transforms a <see cref="IEnvelope" /> object.
/// </summary>
/// <param name="box"></param>
/// <param name="transform"></param>
/// <returns></returns>
public static IEnvelope TransformBox(IEnvelope box, IMathTransform transform)
{
if (box == null) return null;
double[][] corners = new double[4][];
corners[0] = transform.Transform(ToArray(box.MinX, box.MinY)); //LL
corners[1] = transform.Transform(ToArray(box.MaxX, box.MaxY)); //UR
corners[2] = transform.Transform(ToArray(box.MinX, box.MaxY)); //UL
corners[3] = transform.Transform(ToArray(box.MaxX, box.MinY)); //LR
IEnvelope result = new Envelope();
foreach (double[] p in corners)
result.ExpandToInclude(p[0], p[1]);
return result;
}
示例7: TransformBox
/// <summary>
/// Transforms a <see cref="Envelope"/>.
/// </summary>
/// <param name="box">BoundingBox to transform</param>
/// <param name="transform">Math Transform</param>
/// <returns>Transformed object</returns>
public static Envelope TransformBox(Envelope box, IMathTransform transform)
{
if (box == null)
return null;
var corners = new [] {
transform.Transform(new Coordinate(box.MinX, box.MinY)),
transform.Transform(new Coordinate(box.MinX, box.MaxY)),
transform.Transform(new Coordinate(box.MaxX, box.MinY)),
transform.Transform(new Coordinate(box.MaxX, box.MaxY)) };
var result = new Envelope(corners[0]);
for (var i = 1; i < 4; i++)
result.ExpandToInclude(corners[i]);
return result;
}
示例8: Transform
private static Coordinate Transform(IMathTransform transform, Coordinate input)
{
var ordinates = transform.Transform(input.ToDoubleArray());
if (ordinates.Length == 2)
return new Coordinate(ordinates[0], ordinates[1]);
return new Coordinate(ordinates[0], ordinates[1], ordinates[2]);
}
示例9: TestDirectTransform
protected void TestDirectTransform(IMathTransform t, double original, double transformated, double sigma)
{
double[] transformado = t.Transform(new double[] { original });
Assert.AreNotEqual(transformado[0], double.NaN);
Assert.AreNotEqual(transformado[0], double.PositiveInfinity);
Assert.AreNotEqual(transformado[0], double.NegativeInfinity);
Assert.AreEqual(transformated, transformado[0], sigma);
}
开发者ID:digi21,项目名称:PruebasUnitariasImplementacionOpenGisCoordinateTransformations,代码行数:9,代码来源:VerticalCoordinateSystemTestBase.cs
示例10: TransformBox
/// <summary>
/// Transforms a <see cref="SharpMap.Geometries.BoundingBox"/>.
/// </summary>
/// <param name="box">BoundingBox to transform</param>
/// <param name="transform">Math Transform</param>
/// <returns>Transformed object</returns>
public static BoundingBox TransformBox(BoundingBox box, IMathTransform transform)
{
if (box == null)
return null;
Point[] corners = new Point[4];
var ll = box.Min.ToDoubleArray();
var ur = box.Max.ToDoubleArray();
var llTrans = transform.Transform(ll);
var urTrans = transform.Transform(ur);
corners[0] = new Point(llTrans); //lower left
corners[2] = new Point(llTrans[0], urTrans[1]); //upper left
corners[1] = new Point(urTrans); //upper right
corners[3] = new Point(urTrans[0], llTrans[1]); //lower right
BoundingBox result = corners[0].GetBoundingBox();
for (int i = 1; i < 4; i++)
result = result.Join(corners[i].GetBoundingBox());
return result;
}
示例11: TransformBox
/// <summary>
/// Transforms a <see cref="SharpMap.Geometries.BoundingBox"/>.
/// </summary>
/// <param name="box">BoundingBox to transform</param>
/// <param name="transform">Math Transform</param>
/// <returns>Transformed object</returns>
public static BoundingBox TransformBox(BoundingBox box, IMathTransform transform)
{
if (box == BoundingBox.Empty)
return BoundingBox.Empty;
Point[] corners = new Point[4];
corners[0] = transform.Transform(box.Min); //LL
corners[1] = transform.Transform(box.Max); //UR
corners[2] = transform.Transform(new Point(box.Min.X, box.Max.Y)); //UL
corners[3] = transform.Transform(new Point(box.Max.X, box.Min.Y)); //LR
BoundingBox result = new BoundingBox(
corners[0].GetBoundingBox(),
corners[1].GetBoundingBox(),
corners[2].GetBoundingBox(),
corners[3].GetBoundingBox());
return result;
}
示例12: TestGeocentricInverse
static void TestGeocentricInverse(IMathTransform t, double x1, double y1, double z1, double x2, double y2, double z2, double sigma)
{
double[] transformado = t.Transform(new double[] { x2, y2, z2 });
Assert.AreNotEqual(transformado[0], double.NaN);
Assert.AreNotEqual(transformado[1], double.NaN);
Assert.AreNotEqual(transformado[2], double.NaN);
Assert.AreNotEqual(transformado[0], double.PositiveInfinity);
Assert.AreNotEqual(transformado[1], double.PositiveInfinity);
Assert.AreNotEqual(transformado[2], double.PositiveInfinity);
Assert.AreNotEqual(transformado[0], double.NegativeInfinity);
Assert.AreNotEqual(transformado[1], double.NegativeInfinity);
Assert.AreNotEqual(transformado[2], double.NegativeInfinity);
Assert.AreEqual(x1, transformado[0], sigma);
Assert.AreEqual(y1, transformado[1], sigma);
Assert.AreEqual(z1, transformado[2], sigma);
}
开发者ID:digi21,项目名称:PruebasUnitariasImplementacionOpenGisCoordinateTransformations,代码行数:17,代码来源:Test5211Part1.cs
示例13: ExecuteIterations
protected void ExecuteIterations(IMathTransform d, IMathTransform i, double lat, double lon, double sigma)
{
var transformado = new double[] { lat, lon };
bool sw = true;
for (int _i = 0; _i < 1000; _i++)
{
if (sw)
transformado = d.Transform(transformado);
else
transformado = i.Transform(transformado);
Assert.AreNotEqual(transformado[0], double.NaN);
Assert.AreNotEqual(transformado[1], double.NaN);
Assert.AreNotEqual(transformado[0], double.PositiveInfinity);
Assert.AreNotEqual(transformado[1], double.PositiveInfinity);
Assert.AreNotEqual(transformado[0], double.NegativeInfinity);
Assert.AreNotEqual(transformado[1], double.NegativeInfinity);
sw = !sw;
}
Assert.AreEqual(lat, transformado[0], sigma);
Assert.AreEqual(lon, transformado[1], sigma);
}
开发者ID:digi21,项目名称:PruebasUnitariasImplementacionOpenGisCoordinateTransformations,代码行数:23,代码来源:MapProjectionTestBase.cs
示例14: TestForwardAndBackProjNet
private static double[] TestForwardAndBackProjNet(IMathTransform transform, double[] ordinates,
ref int succeed, ref int failed, ref int exception)
{
try
{
var forward = transform.Transform(ordinates);
transform.Invert();
var back = transform.Transform(ordinates);
transform.Invert();
if (Math.Abs(ordinates[0] - back[0]) <= Tolerance &&
Math.Abs(ordinates[1] - back[1]) <= Tolerance)
{
succeed++;
}
else
{
failed++;
}
return forward;
}
catch
{
exception++;
}
return ordinates;
}
示例15: TransformPoint
/// <summary>
/// Transforms coordinates of the point geometry.
/// </summary>
/// <param name="p">Point to transform</param>
/// <param name="transform">The transformation to apply</param>
/// <returns>The transformed point</returns>
public static PointD TransformPoint(PointD p, IMathTransform transform)
{
return new PointD(transform.Transform(p.CoordsArray()));
}