本文整理汇总了C#中CoordinateSystem类的典型用法代码示例。如果您正苦于以下问题:C# CoordinateSystem类的具体用法?C# CoordinateSystem怎么用?C# CoordinateSystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CoordinateSystem类属于命名空间,在下文中一共展示了CoordinateSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadMultiLineString
/// <summary>
/// Reads a <see cref="IMultiLineString"/> geometry.
/// </summary>
/// <param name="reader">The reader</param>
/// <param name="cs">The coordinate system</param>
///<param name="srid">The spatial reference id for the geometry.</param>
///<returns>A <see cref="IMultiLineString"/> geometry</returns>
protected IGeometry ReadMultiLineString(BinaryReader reader, CoordinateSystem cs, int srid)
{
IGeometryFactory factory = _geometryServices.CreateGeometryFactory(_precisionModel, srid, _sequenceFactory);
int numGeometries = reader.ReadInt32();
ILineString[] strings = new ILineString[numGeometries];
for (int i = 0; i < numGeometries; i++)
{
ReadByteOrder(reader);
CoordinateSystem cs2;
int srid2;
WKBGeometryTypes geometryType = ReadGeometryType(reader, out cs2, out srid2);//(WKBGeometryTypes) reader.ReadInt32();
if (geometryType != WKBGeometryTypes.WKBLineString)
throw new ArgumentException("ILineString feature expected");
strings[i] = ReadLineString(reader, cs2, srid2) as ILineString;
}
return factory.CreateMultiLineString(strings);
}
示例2: CalculateCalloutLocation
public override bool CalculateCalloutLocation(out PointF location, out CoordinateSystem coordinateSystem)
{
// if the user has manually positioned the callout, we won't override it
if (_manuallyPositionedCallout)
{
location = PointF.Empty;
coordinateSystem = CoordinateSystem.Destination;
return false;
}
Callout.CoordinateSystem = CoordinateSystem.Destination;
AnnotationSubject.CoordinateSystem = CoordinateSystem.Destination;
try
{
var roiBoundingBox = AnnotationSubject.BoundingBox;
var clientRectangle = AnnotationSubject.ParentPresentationImage.ClientRectangle;
var textSize = Callout.TextBoundingBox.Size;
if (textSize.IsEmpty)
textSize = new SizeF(100, 50);
coordinateSystem = CoordinateSystem.Destination;
location = new PointF(ComputeCalloutLocationX(textSize, clientRectangle, roiBoundingBox), ComputeCalloutLocationY(textSize, clientRectangle, roiBoundingBox));
}
finally
{
Callout.ResetCoordinateSystem();
AnnotationSubject.ResetCoordinateSystem();
}
return true;
}
示例3: InvalidOperationException
AnnotationGraphic IDrawProtractor.Draw(CoordinateSystem coordinateSystem, string name, PointF point1, PointF vertex, PointF point2)
{
var image = Context.Viewer.SelectedPresentationImage;
if (!CanStart(image))
throw new InvalidOperationException("Can't draw a protractor at this time.");
var imageGraphic = ((IImageGraphicProvider) image).ImageGraphic;
if (coordinateSystem == CoordinateSystem.Destination)
{
point1 = imageGraphic.SpatialTransform.ConvertToSource(point1);
vertex = imageGraphic.SpatialTransform.ConvertToSource(vertex);
point2 = imageGraphic.SpatialTransform.ConvertToSource(point2);
}
var overlayProvider = (IOverlayGraphicsProvider) image;
var roiGraphic = CreateRoiGraphic(false);
roiGraphic.Name = name;
AddRoiGraphic(image, roiGraphic, overlayProvider);
var subject = (IPointsGraphic) roiGraphic.Subject;
subject.Points.Add(point1);
subject.Points.Add(vertex);
subject.Points.Add(point2);
roiGraphic.Callout.Update();
roiGraphic.State = roiGraphic.CreateSelectedState();
return roiGraphic;
}
示例4: Geometry
/// <summary>Initializes a new instance of the <see cref="T:Microsoft.Spatial.Geometry" /> class.</summary>
/// <param name="coordinateSystem">The coordinate system of this instance.</param>
/// <param name="creator">The implementation that created this instance.</param>
protected Geometry(CoordinateSystem coordinateSystem, SpatialImplementation creator)
{
Util.CheckArgumentNull(coordinateSystem, "coordinateSystem");
Util.CheckArgumentNull(creator, "creator");
this.coordinateSystem = coordinateSystem;
this.creator = creator;
}
示例5: YuvPlanar
protected YuvPlanar(Buffer.Sized buffer, Geometry2D.Integer.Size size, CoordinateSystem coordinateSystem, Geometry2D.Integer.Shell crop) :
base(buffer, size, coordinateSystem, crop)
{
this.Y = this.CreateY();
this.U = this.CreateU();
this.V = this.CreateV();
}
示例6: Image
protected Image(Geometry2D.Integer.Size size, CoordinateSystem coordinateSystem, Geometry2D.Integer.Shell crop) :
base(size, coordinateSystem, crop)
{
this.LeftTop = new Geometry2D.Single.Point(0, 0);
this.RightTop = new Geometry2D.Single.Point(1, 0);
this.LeftBottom = new Geometry2D.Single.Point(0, 1);
this.RightBottom = new Geometry2D.Single.Point(1, 1);
}
示例7: Linear
public Linear(CoordinateSystem entity, Vector2 direction)
{
PathAwareEntity = entity as PathAware;
Position = entity.Position;
if (direction.X != 0 || direction.Y != 0)
{
direction.Normalize();
}
Direction = direction;
}
示例8: AreEqual
public static void AreEqual(CoordinateSystem expected, CoordinateSystem actual, double tolerance = 1e-6, string message = "")
{
if (string.IsNullOrEmpty(message))
message = string.Format("Expected {0} but was {1}", expected, actual);
if (expected.Values.Length != actual.Values.Length)
Assert.Fail();
for (int i = 0; i < expected.Values.Length; i++)
{
Assert.AreEqual(expected.Values[i], actual.Values[i], tolerance);
}
}
示例9: ReadPolygonTest
private void ReadPolygonTest(string input, CoordinateSystem expectedReference, params PositionData[][] expected)
{
var p = this.d4Formatter.Read<Geography>(new StringReader(input));
Assert.NotNull(p);
p.VerifyAsPolygon(expected);
if (expectedReference != null)
{
Assert.Equal(p.CoordinateSystem, expectedReference);
}
}
示例10: ReadPointTest
private static void ReadPointTest(SpatialFormatter<TextReader, TextWriter> formatter, TextReader input, PositionData expected, CoordinateSystem expectedCoordinateSystem = null)
{
var p = formatter.Read<Geography>(input);
Assert.NotNull(p);
p.VerifyAsPoint(expected);
if (expectedCoordinateSystem != null)
{
Assert.Equal(p.CoordinateSystem, expectedCoordinateSystem);
}
}
示例11: Create
public static GeographyPoint Create(CoordinateSystem coordinateSystem, double latitude, double longitude, double? z, double? m)
{
var builder = SpatialBuilder.Create();
var pipeline = builder.GeographyPipeline;
pipeline.SetCoordinateSystem(coordinateSystem);
pipeline.BeginGeography(SpatialType.Point);
pipeline.BeginFigure(new GeographyPosition(latitude, longitude, z, m));
pipeline.EndFigure();
pipeline.EndGeography();
return (GeographyPoint)builder.ConstructedGeography;
}
示例12: Create
public static GeometryPoint Create(CoordinateSystem coordinateSystem, double x, double y, double? z, double? m)
{
var builder = SpatialBuilder.Create();
var pipeline = builder.GeometryPipeline;
pipeline.SetCoordinateSystem(coordinateSystem);
pipeline.BeginGeometry(SpatialType.Point);
pipeline.BeginFigure(new GeometryPosition(x, y, z, m));
pipeline.EndFigure();
pipeline.EndGeometry();
return (GeometryPoint)builder.ConstructedGeometry;
}
示例13: CalculateCalloutEndPoint
public override void CalculateCalloutEndPoint(out PointF endPoint, out CoordinateSystem coordinateSystem)
{
if (_userMovedCallout)
{
base.CalculateCalloutEndPoint(out endPoint, out coordinateSystem);
}
else
{
coordinateSystem = AnnotationSubject.CoordinateSystem;
if (this.Roi.Points.Count < 3)
endPoint = this.Roi.Points[0];
else
endPoint = this.Roi.Points[1];
}
}
示例14: ShouldConvertPointsFromWgs84ToLambert93
public void ShouldConvertPointsFromWgs84ToLambert93()
{
var wgs84=new CoordinateSystem(new DotGeo.World().WGS1984);
var lam93=new CoordinateSystem(new DotPrj.NationalGrids().RGF1993Lambert93);
var ct=new CoordinatesTransformer(wgs84, lam93);
foreach (var coordinates in new double[][][] { _Paris, _NewYorkCity })
{
var input=coordinates[0];
var expected=coordinates[1];
var result=ct.Convert(input);
Assert.Equal(expected, result, new CoordinateComparer(2));
}
}
示例15: CalculateCalloutLocation
public override bool CalculateCalloutLocation(out PointF location, out CoordinateSystem coordinateSystem)
{
if (this.Roi.Points.Count < 3 || string.IsNullOrEmpty(this.Callout.Text))
base.Callout.Visible = false;
else
base.Callout.Visible = true;
if (!base.Callout.Visible || _userMovedCallout)
return base.CalculateCalloutLocation(out location, out coordinateSystem);
SizeF calloutOffsetDestination = GetCalloutOffsetDestination();
coordinateSystem = CoordinateSystem.Destination;
base.AnnotationGraphic.CoordinateSystem = coordinateSystem;
// first, move the callout by the same amount the vertex moved (if it moved at all).
location = base.Callout.TextLocation + calloutOffsetDestination;
PointF start = this.Roi.Points[0];
PointF vertex = this.Roi.Points[1];
PointF end = this.Roi.Points[2];
base.AnnotationGraphic.ResetCoordinateSystem();
double vectorAngle = -Vector.SubtendedAngle(start, vertex, end) / 2 + 180;
PointF[] points = new PointF[] { start, end };
using (Matrix rotation = new Matrix())
{
rotation.Rotate((float) vectorAngle);
rotation.Translate(-vertex.X, -vertex.Y);
rotation.TransformPoints(points);
}
float calloutMagnitude = new Vector3D(location.X - vertex.X, location.Y - vertex.Y, 0).Magnitude;
Vector3D startVector = new Vector3D(points[0].X, points[0].Y, 0);
if (FloatComparer.AreEqual(startVector.Magnitude, 0F, 0.01F))
startVector = new Vector3D(-1, 0, 0);
startVector = startVector / startVector.Magnitude * calloutMagnitude;
location = new PointF(startVector.X + vertex.X, startVector.Y + vertex.Y);
return true;
}