本文整理汇总了C#中System.Point.GetX方法的典型用法代码示例。如果您正苦于以下问题:C# Point.GetX方法的具体用法?C# Point.GetX怎么用?C# Point.GetX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Point
的用法示例。
在下文中一共展示了Point.GetX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RectangleImpl
public RectangleImpl(Point lowerLeft, Point upperRight)
{
this.minX = lowerLeft.GetX();
this.maxX = upperRight.GetX();
this.minY = lowerLeft.GetY();
this.maxY = upperRight.GetY();
}
示例2: GetHashCode
/// <summary>
/// All {@link Point} implementations should use this definition of {@link Object#hashCode()}.
/// </summary>
/// <param name="thiz"></param>
/// <returns></returns>
public static int GetHashCode(Point thiz)
{
if (thiz == null)
throw new ArgumentNullException("thiz");
long temp = thiz.GetX() != +0.0d ? BitConverter.DoubleToInt64Bits(thiz.GetX()) : 0L;
int result = (int)(temp ^ ((uint)temp >> 32));
temp = thiz.GetY() != +0.0d ? BitConverter.DoubleToInt64Bits(thiz.GetY()) : 0L;
result = 31 * result + (int)(temp ^ ((uint)temp >> 32));
return result;
}
示例3: Test_A2
static public void Test_A2(Point point)
{
double x = point.GetX();
double y = point.GetY();
double z = point.GetZ();
Debug.Assert(Program.IsApprox(x, 636784.74, 0.01));
Debug.Assert(Program.IsApprox(y, 849106.66, 0.01));
Debug.Assert(Program.IsApprox(z, 426.71, 0.01));
double time = point.GetTime();
Debug.Assert(Program.IsApprox(time, 245382.13595, 0.00001));
Debug.Assert(point.GetIntensity() == 118);
Debug.Assert(point.GetReturnNumber() == 1);
Debug.Assert(point.GetNumberOfReturns() == 1);
Classification classif = point.GetClassification();
Debug.Assert(classif.GetClassName() == "Unclassified");
Debug.Assert(!classif.IsKeyPoint());
Debug.Assert(!classif.IsSynthetic());
Debug.Assert(!classif.IsWithheld());
Color color = point.GetColor();
Debug.Assert(color.GetRed() == 112);
Debug.Assert(color.GetGreen() == 97);
Debug.Assert(color.GetBlue() == 114);
}
示例4: CalcBoxByDistFromPt
public override Rectangle CalcBoxByDistFromPt(Point from, double distDEG, SpatialContext ctx, Rectangle reuse)
{
double minX = from.GetX() - distDEG;
double maxX = from.GetX() + distDEG;
double minY = from.GetY() - distDEG;
double maxY = from.GetY() + distDEG;
if (reuse == null)
{
return ctx.MakeRectangle(minX, maxX, minY, maxY);
}
else
{
reuse.Reset(minX, maxX, minY, maxY);
return reuse;
}
}
示例5: Equals
/// <summary>
/// All {@link Point} implementations should use this definition of {@link Object#equals(Object)}.
/// </summary>
/// <param name="thiz"></param>
/// <param name="o"></param>
/// <returns></returns>
public static bool Equals(Point thiz, Object o)
{
if (thiz == null)
throw new ArgumentNullException("thiz");
if (thiz == o) return true;
var point = o as Point;
if (point == null) return false;
return thiz.GetX().Equals(point.GetX()) && thiz.GetY().Equals(point.GetY());
}
示例6: CreateIndexableFields
public Field[] CreateIndexableFields(Point point)
{
FieldType doubleFieldType = new FieldType(DoubleField.TYPE_NOT_STORED)
{
NumericPrecisionStep = precisionStep
};
var f = new Field[]
{
new DoubleField(fieldNameX, point.GetX(), doubleFieldType),
new DoubleField(fieldNameY, point.GetY(), doubleFieldType)
};
return f;
}
示例7: alignGeohash
/* NGeohash round-trip for given precision. */
private Point alignGeohash(Point p)
{
return GeohashUtils.Decode(GeohashUtils.EncodeLatLon(p.GetY(), p.GetX(), maxLength), ctx);
}
示例8: Distance
public override double Distance(Point from, double toX, double toY)
{
double result = 0;
double v = from.GetX() - toX;
result += (v * v);
v = from.GetY() - toY;
result += (v * v);
if (squared)
return result;
return Math.Sqrt(result);
}
示例9: CreateIndexableFields
public AbstractField[] CreateIndexableFields(Point point)
{
var f = new AbstractField[2];
var f0 = new NumericField(fieldNameX, precisionStep, Field.Store.NO, true)
{OmitNorms = true, OmitTermFreqAndPositions = true};
f0.SetDoubleValue(point.GetX());
f[0] = f0;
var f1 = new NumericField(fieldNameY, precisionStep, Field.Store.NO, true)
{OmitNorms = true, OmitTermFreqAndPositions = true};
f1.SetDoubleValue(point.GetY());
f[1] = f1;
return f;
}
示例10: PointOnBearing
public override Point PointOnBearing(Point from, double distDEG, double bearingDEG, SpatialContext ctx, Point reuse)
{
if (distDEG == 0)
{
if (reuse == null)
return from;
reuse.Reset(from.GetX(), from.GetY());
return reuse;
}
double bearingRAD = DistanceUtils.ToRadians(bearingDEG);
double x = from.GetX() + Math.Sin(bearingRAD)*distDEG;
double y = from.GetY() + Math.Cos(bearingRAD)*distDEG;
if (reuse == null)
{
return ctx.MakePoint(x, y);
}
else
{
reuse.Reset(x, y);
return reuse;
}
}
示例11: Relate
public SpatialRelation Relate(Point point, SpatialContext ctx)
{
return Contains(point.GetX(), point.GetY()) ? SpatialRelation.CONTAINS : SpatialRelation.DISJOINT;
}
示例12: Relate
public SpatialRelation Relate(Point point, SpatialContext ctx)
{
if (point.GetY() > GetMaxY() || point.GetY() < GetMinY())
return SpatialRelation.DISJOINT;
// all the below logic is rather unfortunate but some dateline cases demand it
double minX = this.minX;
double maxX = this.maxX;
double pX = point.GetX();
if (ctx.IsGeo())
{
//unwrap dateline and normalize +180 to become -180
double rawWidth = maxX - minX;
if (rawWidth < 0)
{
maxX = minX + (rawWidth + 360);
}
//shift to potentially overlap
if (pX < minX)
{
pX += 360;
}
else if (pX > maxX)
{
pX -= 360;
} else {
return SpatialRelation.CONTAINS; //short-circuit
}
}
if (pX < minX || pX > maxX)
return SpatialRelation.DISJOINT;
return SpatialRelation.CONTAINS;
}
示例13: CalcBoxByDistFromPt
public override Rectangle CalcBoxByDistFromPt(Point from, double distDEG, SpatialContext ctx, Rectangle reuse)
{
return DistanceUtils.CalcBoxByDistFromPtDEG(from.GetY(), from.GetX(), distDEG, ctx, reuse);
}
示例14: checkBBox
private void checkBBox(Point ctr, double distKm)
{
String msg = "ctr: " + ctr + " distKm: " + distKm;
double dist = distKm * DistanceUtils.KM_TO_DEG;
Rectangle r = dc().CalcBoxByDistFromPt(ctr, dist, ctx, null);
double horizAxisLat = dc().CalcBoxByDistFromPt_yHorizAxisDEG(ctr, dist, ctx);
if (!Double.IsNaN(horizAxisLat))
Assert.True(r.RelateYRange(horizAxisLat, horizAxisLat).Intersects());
//horizontal
if (r.GetWidth() >= 180)
{
double deg = dc().Distance(ctr, r.GetMinX(), r.GetMaxY() == 90 ? 90 : -90);
double calcDistKm = deg * DistanceUtils.DEG_TO_KM;
Assert.True(/*msg,*/ calcDistKm <= distKm + EPS);
//horizAxisLat is meaningless in this context
}
else
{
Point tPt = FindClosestPointOnVertToPoint(r.GetMinX(), r.GetMinY(), r.GetMaxY(), ctr);
double calcDistKm = dc().Distance(ctr, tPt) * DistanceUtils.DEG_TO_KM;
CustomAssert.EqualWithDelta(/*msg,*/ distKm, calcDistKm, EPS);
CustomAssert.EqualWithDelta(/*msg,*/ tPt.GetY(), horizAxisLat, EPS);
}
//vertical
double topDistKm = dc().Distance(ctr, ctr.GetX(), r.GetMaxY()) * DistanceUtils.DEG_TO_KM;
if (r.GetMaxY() == 90)
Assert.True(/*msg,*/ topDistKm <= distKm + EPS);
else
CustomAssert.EqualWithDelta(msg, distKm, topDistKm, EPS);
double botDistKm = dc().Distance(ctr, ctr.GetX(), r.GetMinY()) * DistanceUtils.DEG_TO_KM;
if (r.GetMinY() == -90)
Assert.True(/*msg,*/ botDistKm <= distKm + EPS);
else
CustomAssert.EqualWithDelta(/*msg,*/ distKm, botDistKm, EPS);
}
示例15: MakeRectangle
/// <summary>
/// Construct a rectangle. The parameters will be normalized.
/// </summary>
/// <param name="lowerLeft"></param>
/// <param name="upperRight"></param>
/// <returns></returns>
public Rectangle MakeRectangle(Point lowerLeft, Point upperRight)
{
return MakeRectangle(lowerLeft.GetX(), upperRight.GetX(),
lowerLeft.GetY(), upperRight.GetY());
}