本文整理汇总了C#中IPrecisionModel类的典型用法代码示例。如果您正苦于以下问题:C# IPrecisionModel类的具体用法?C# IPrecisionModel怎么用?C# IPrecisionModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPrecisionModel类属于命名空间,在下文中一共展示了IPrecisionModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DensifyPoints
/// <summary>
/// Densifies a coordinate sequence.
/// </summary>
/// <param name="pts">The coordinate sequence to densify</param>
/// <param name="distanceTolerance">The distance tolerance (<see cref="DistanceTolerance"/>)</param>
/// <param name="precModel">The precision model to apply on the new coordinates</param>
/// <returns>The densified coordinate sequence</returns>
private static Coordinate[] DensifyPoints(Coordinate[] pts,
double distanceTolerance, IPrecisionModel precModel)
{
var seg = new LineSegment();
var coordList = new CoordinateList();
for (int i = 0; i < pts.Length - 1; i++)
{
seg.P0 = pts[i];
seg.P1 = pts[i + 1];
coordList.Add(seg.P0, false);
double len = seg.Length;
int densifiedSegCount = (int) (len/distanceTolerance) + 1;
if (densifiedSegCount > 1)
{
double densifiedSegLen = len/densifiedSegCount;
for (int j = 1; j < densifiedSegCount; j++)
{
double segFract = (j*densifiedSegLen)/len;
var p = seg.PointAlong(segFract);
precModel.MakePrecise(p);
coordList.Add(p, false);
}
}
}
coordList.Add(pts[pts.Length - 1], false);
return coordList.ToCoordinateArray();
}
示例2: GeometryFactory
/// <summary>
/// Constructs a GeometryFactory that generates Geometries having the given
/// PrecisionModel, spatial-reference ID, and CoordinateSequence implementation.
/// </summary>
/// <param name="precisionModel"></param>
/// <param name="SRID"></param>
/// <param name="coordinateSequenceFactory"></param>
public GeometryFactory(IPrecisionModel precisionModel, int SRID,
ICoordinateSequenceFactory coordinateSequenceFactory)
{
this.precisionModel = precisionModel;
this.coordinateSequenceFactory = coordinateSequenceFactory;
this.srid = SRID;
}
示例3: OffsetCurveBuilder
public OffsetCurveBuilder(
IPrecisionModel precisionModel,
IBufferParameters bufParams
)
{
_precisionModel = precisionModel;
_bufParams = bufParams;
}
示例4: OffsetCurveBuilder
/// <summary>
///
/// </summary>
/// <param name="precisionModel"></param>
/// <param name="quadrantSegments"></param>
public OffsetCurveBuilder(IPrecisionModel precisionModel, int quadrantSegments)
{
this.precisionModel = precisionModel;
// compute intersections in full precision, to provide accuracy
// the points are rounded as they are inserted into the curve line
li = new RobustLineIntersector();
var limitedQuadSegs = quadrantSegments < 1 ? 1 : quadrantSegments;
filletAngleQuantum = Math.PI / 2.0 / limitedQuadSegs;
}
示例5: PreciseCoordinateTester
private static void PreciseCoordinateTester(IPrecisionModel pm,
double x1, double y1,
double x2, double y2)
{
var p = new Coordinate(x1, y1);
pm.MakePrecise(p);
var pPrecise = new Coordinate(x2, y2);
Assert.IsTrue(p.Equals2D(pPrecise), "Expected {0}, but got {1}", pPrecise, p);
}
示例6: OffsetSegmentGenerator
public OffsetSegmentGenerator(IPrecisionModel precisionModel,
IBufferParameters bufParams, double distance)
{
_precisionModel = precisionModel;
_bufParams = bufParams;
// compute intersections in full precision, to provide accuracy
// the points are rounded as they are inserted into the curve line
_li = new RobustLineIntersector();
_filletAngleQuantum = Math.PI / 2.0 / bufParams.QuadrantSegments;
/**
* Non-round joins cause issues with short closing segments, so don't use
* them. In any case, non-round joins only really make sense for relatively
* small buffer distances.
*/
if (bufParams.QuadrantSegments >= 8
&& bufParams.JoinStyle == JoinStyle.Round)
_closingSegLengthFactor = MaxClosingSegLenFactor;
Init(distance);
}
示例7: OldOffsetCurveBuilder
public OldOffsetCurveBuilder(
IPrecisionModel precisionModel,
IBufferParameters bufParams
)
{
_precisionModel = precisionModel;
_bufParams = bufParams;
// compute intersections in full precision, to provide accuracy
// the points are rounded as they are inserted into the curve line
_li = new RobustLineIntersector();
_filletAngleQuantum = Math.PI / 2.0 / bufParams.QuadrantSegments;
/**
* Non-round joins cause issues with short closing segments,
* so don't use them. In any case, non-round joins
* only really make sense for relatively small buffer distances.
*/
if (bufParams.QuadrantSegments >= 8
&& bufParams.JoinStyle == JoinStyle.Round)
closingSegFactor = MAX_CLOSING_SEG_FRACTION;
}
示例8: IteratedNoder
/// <summary>
/// Initializes a new instance of the <see cref="IteratedNoder"/> class.
/// </summary>
/// <param name="pm"></param>
public IteratedNoder(IPrecisionModel pm)
{
_li = new RobustLineIntersector {PrecisionModel = pm};
}
示例9: BufferFixedPrecision
/// <summary>
///
/// </summary>
/// <param name="fixedPM"></param>
private void BufferFixedPrecision(IPrecisionModel fixedPM)
{
INoder noder = new ScaledNoder(new MCIndexSnapRounder(new PrecisionModel(1.0)), fixedPM.Scale);
var bufBuilder = new BufferBuilder
{
WorkingPrecisionModel = fixedPM,
Noder = noder,
QuadrantSegments = quadrantSegments,
EndCapStyle = endCapStyle
};
// this may throw an exception, if robustness errors are encountered
resultGeometry = bufBuilder.Buffer(argGeom, distance);
}
示例10: RandomOrdinate
private static double RandomOrdinate(Ordinate o, IPrecisionModel pm)
{
switch (o)
{
case Ordinate.X:
return pm.MakePrecise(-180 + 360 * Rnd.NextDouble());
case Ordinate.Y:
return pm.MakePrecise(-90 + 180 * Rnd.NextDouble());
case Ordinate.Z:
return 200 * Rnd.NextDouble();
case Ordinate.M:
return 200 + 200 * Rnd.NextDouble();
default:
throw new NotSupportedException();
}
}
示例11: MCIndexSnapRounder
/// <summary>
/// Initializes a new instance of the <see cref="MCIndexSnapRounder"/> class.
/// </summary>
/// <param name="pm">The <see cref="PrecisionModel" /> to use.</param>
public MCIndexSnapRounder(IPrecisionModel pm)
{
_li = new RobustLineIntersector { PrecisionModel = pm };
_scaleFactor = pm.Scale;
}
示例12: GeometryNoder
//private bool isValidityChecked = false;
/// <summary>
/// Creates a new noder which snap-rounds to a grid specified by the given <see cref="IPrecisionModel"/>
/// </summary>
/// <param name="pm">The precision model for the grid to snap-round to.</param>
public GeometryNoder(IPrecisionModel pm)
{
_pm = pm;
}
示例13: GetEnvelopeExternal
/// <summary>
/// Get Envelope in external coordinates.
/// </summary>
/// <param name="precisionModel">The precision model to use</param>
/// <param name="envelope">The envelope to get</param>
/// <returns></returns>
public static Envelope GetEnvelopeExternal(IPrecisionModel precisionModel, Envelope envelope)
{
// Get envelope in external coordinates
var min = new Coordinate(envelope.MinX, envelope.MinY);
precisionModel.MakePrecise(min);
var max = new Coordinate(envelope.MaxX, envelope.MaxY);
precisionModel.MakePrecise(max);
var bounds = new Envelope(min.X, max.X, min.Y, max.Y);
return bounds;
//return GetEnvelopeExternal(envelope);
}
示例14: CompareTo
/// <summary>
///
/// </summary>
/// <param name="other"></param>
/// <returns></returns>
public int CompareTo(IPrecisionModel other)
{
int sigDigits = MaximumSignificantDigits;
int otherSigDigits = other.MaximumSignificantDigits;
return (sigDigits).CompareTo(otherSigDigits);
}
示例15: GetNoder
/// <summary>
///
/// </summary>
/// <param name="precisionModel"></param>
/// <returns></returns>
private INoder GetNoder(IPrecisionModel precisionModel)
{
if (workingNoder != null)
return workingNoder;
// otherwise use a fast (but non-robust) noder
LineIntersector li = new RobustLineIntersector();
li.PrecisionModel = precisionModel;
MCIndexNoder noder = new MCIndexNoder(new IntersectionAdder(li));
return noder;
}