本文整理汇总了C#中PointClass.ConstructAngleDistance方法的典型用法代码示例。如果您正苦于以下问题:C# PointClass.ConstructAngleDistance方法的具体用法?C# PointClass.ConstructAngleDistance怎么用?C# PointClass.ConstructAngleDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointClass
的用法示例。
在下文中一共展示了PointClass.ConstructAngleDistance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RectanglePoint2
private PointClass RectanglePoint2(IPoint point, double angle,double height)
{
PointClass p = new PointClass();
p.SpatialReference = m_hookHelper.FocusMap.SpatialReference;
p.ConstructAngleDistance(point, angle, height/2);
return p;
}
示例2: MakeTextPath
public static IPath MakeTextPath(IPath pPath, double length)
{
try
{
double angle = GetAngle(pPath);
IPoint pPt = pPath.ToPoint;
IConstructPoint pCP = new PointClass();
double PI = 3.1415926535897;
double rad = angle * PI / 180;
pCP.ConstructAngleDistance(pPt, rad, 1);
IPoint pNew = pCP as IPoint;
IPath pNewPath = new PathClass();
pNewPath.FromPoint = pPt;
pNewPath.ToPoint = pNew;
if (ShouldFlip(angle))
{
pNewPath.ReverseOrientation();
}
return pNewPath;
}
catch (Exception eX)
{
MessageBox.Show(eX.Message);
return null;
}
}
示例3: distanceAngle_Disposed
void distanceAngle_Disposed(object sender, EventArgs e)
{
if (_isDistAngleFormDisposed) return;
double x = 0, y = 0;
IPoint anchor = new PointClass();
if (_segmentCollection.SegmentCount > 0)
{
try
{
ISegment seg = _segmentCollection.get_Segment(_segmentCollection.SegmentCount - 1);
x = seg.ToPoint.X;
y = seg.ToPoint.Y;
}
catch
{
}
}
else
{
x = _initialAnchorPoint.X;
y = _initialAnchorPoint.Y;
}
if (x > 0 && y > 0 && _distance > 10)
{
anchor.X = x;
anchor.Y = y;
IAngularConverter converter = new AngularConverterClass();
esriDirectionType dt = ((IEditProperties2)ExtensionInfo.Editor).DirectionType;// GISApplication.EditorDirectionType();
esriDirectionUnits ut = ((IEditProperties2)ExtensionInfo.Editor).DirectionUnits;// GISApplication.EditorDirectionUnit();
converter.SetAngle(_angle, esriDirectionType.esriDTPolar, ut);
_angle = converter.GetAngle(dt, ut);
IConstructPoint newPoint = new PointClass();
double radians = DisplayMap.DegreesToRadians(_angle);
newPoint.ConstructAngleDistance(anchor, radians, _distance);
ProcessSegment((IPoint)newPoint);
}
_isDistAngleFormDisposed = true;
}
示例4: CreateGSLine
private IGSLine CreateGSLine(String inCourse, esriDirectionUnits inDirectionUnits,
esriDirectionType inDirectionType, ISegment EntryTangent,
out ISegment ExitTangent, out ICircularArc outCircularArc)
{
//
string[] sCourse = inCourse.Split(' ');
Utilities UTILS = new Utilities();
double dToMeterUnitConversion = UTILS.ToMeterUnitConversion();
// ISegment ExitTangent = null;
string item = (string)sCourse.GetValue(0);
if (item.ToLower() == "dd")
{//Direction distance -- straight line course
IGSLine pLine = new GSLineClass();
double dBear = DirectionString_2_NorthAzimuth((string)sCourse.GetValue(1), inDirectionType, inDirectionUnits);
pLine.Bearing = dBear;
pLine.Distance = Convert.ToDouble(sCourse.GetValue(2)) * dToMeterUnitConversion;
pLine.FromPoint = m_count;
m_count += 1;
pLine.ToPoint = m_count;
//Now define the tangent exit segment
//in case it's needed for the next course (TC tangent curve, or Angle deflection)
double dPolar = DirectionString_2_PolarRadians((string)sCourse.GetValue(1),
inDirectionType, inDirectionUnits);
IPoint pFromPt = new PointClass();
pFromPt.PutCoords(1000, 1000);
IConstructPoint2 pToPt = new PointClass();
pToPt.ConstructAngleDistance(pFromPt, dPolar, 100);
ILine ExitTangentLine = new LineClass();
ExitTangentLine.PutCoords(pFromPt, (IPoint)pToPt);
ExitTangent = (ISegment)ExitTangentLine;
outCircularArc = null;
Marshal.ReleaseComObject(pFromPt);
Marshal.ReleaseComObject(pToPt);
return pLine;
}
if (item.ToLower() == "ad")
{//Angle deflection distance
IGSLine pLine = new GSLineClass();
double dDeflAngle = Angle_2_Radians((string)sCourse.GetValue(1), inDirectionUnits);
//now need to take the previous tangent segment, reverse its orientation and
//add +ve clockwise to get the bearing
ILine calcLine = (ILine)EntryTangent;
double dBear = PolarRAD_2_SouthAzimuthRAD(calcLine.Angle) + dDeflAngle;
pLine.Bearing = dBear;
pLine.Distance = Convert.ToDouble(sCourse.GetValue(2)) * dToMeterUnitConversion;
pLine.FromPoint = m_count;
m_count += 1;
pLine.ToPoint = m_count;
//Now define the tangent exit segment
//in case it's needed for the next course (TC tangent curve, or Angle deflection)
IPoint pFromPt = new PointClass();
pFromPt.PutCoords(1000, 1000);
IConstructPoint2 pToPt = new PointClass();
double dPolar = NorthAzimuthRAD_2_PolarRAD(dBear);
pToPt.ConstructAngleDistance(pFromPt, dPolar, 100);
ILine ExitTangentLine = new LineClass();
ExitTangentLine.PutCoords(pFromPt, (IPoint)pToPt);
ExitTangent = (ISegment)ExitTangentLine;
outCircularArc = null;
Marshal.ReleaseComObject(pFromPt);
Marshal.ReleaseComObject(pToPt);
return pLine;
}
else if ((item.ToLower() == "nc") || (item.ToLower() == "tc"))
{
double dChordlength;
double dChordBearing;
ICircularArc pArc = ConstructCurveFromString(inCourse, EntryTangent,
inDirectionType, inDirectionUnits, out dChordlength, out dChordBearing);
try
{
IGSLine pLine = new GSLineClass();
pLine.Bearing = PolarRAD_2_NorthAzimuthRAD(dChordBearing);
pLine.Radius = pArc.Radius * dToMeterUnitConversion;//convert to meters
if (pArc.IsCounterClockwise) { pLine.Radius = pLine.Radius * -1; }
pLine.Distance = dChordlength * dToMeterUnitConversion; //convert to meters
pLine.FromPoint = m_count;
m_count += 1;
pLine.ToPoint = m_count;
ILine pTangentLine = new LineClass();
pArc.QueryTangent(esriSegmentExtension.esriExtendTangentAtTo, 1, true, 100, pTangentLine);
//pass the exit tangent back out for use as next entry tangent
ExitTangent = (ISegment)pTangentLine;
outCircularArc = pArc;
return pLine;
}
catch { }
}
outCircularArc = null;
ExitTangent = null;
return null;
}
示例5: ConstructCurveFromString
private ICircularArc ConstructCurveFromString(string inString, ISegment ExitTangentFromPreviousCourse,
esriDirectionType inDirectionType, esriDirectionUnits inDirectionUnits,
out double outChordLength, out double outChordBearing)
{
//
IConstructCircularArc pConstArc = new CircularArcClass();
ICircularArc pArc = (ICircularArc)pConstArc;
IPoint pPt = new PointClass();
pPt.PutCoords(1000, 1000);
//initialize the curve params
bool bHasRadius = false; double dRadius = -1;
bool bHasChord = false; double dChord = -1;
bool bHasArc = false; double dArcLength = -1;
bool bHasDelta = false; double dDelta = -1;
bool bCCW = false; //assume curve to right unless proven otherwise
//now initialize bearing types for non-tangent curves
bool bHasRadialBearing = false; double dRadialBearing = -1;
bool bHasChordBearing = false; double dChordBearing = -1;
bool bHasTangentBearing = false; double dTangentBearing = -1;
ISegment EntryTangentSegment = null;
int iItemPosition = 0;
string[] sCourse = inString.Split(' ');
int UpperBound = sCourse.GetUpperBound(0);
bool bIsTangentCurve = (((string)sCourse.GetValue(0)).ToLower() == "tc");
foreach (string item in sCourse)
{
if (item == null)
break;
if ((item.ToLower() == "r") && (!bHasRadius) && (iItemPosition <= 3))
{// this r is for radius
dRadius = Convert.ToDouble(sCourse.GetValue(iItemPosition + 1));
bHasRadius = true; //found a radius
}
if ((item.ToLower()) == "c" && (!bHasChord) && (iItemPosition <= 3))
{// this c is for chord length
dChord = Convert.ToDouble(sCourse.GetValue(iItemPosition + 1));
bHasChord = true; //found a chord length
}
if ((item.ToLower()) == "a" && (!bHasArc) && (iItemPosition <= 3))
{// this a is for arc length
dArcLength = Convert.ToDouble(sCourse.GetValue(iItemPosition + 1));
bHasArc = true; //found an arc length
}
if ((item.ToLower()) == "d" && (!bHasDelta) && (iItemPosition <= 3))
{// this d is for delta or central angle
dDelta = Angle_2_Radians((string)sCourse.GetValue(iItemPosition + 1), inDirectionUnits);
bHasDelta = true; //found a central angle
}
if ((item.ToLower()) == "r" && (!bHasRadialBearing) && (iItemPosition > 3) && (UpperBound > 5))
{// this r is for radial bearing
try
{
dRadialBearing = DirectionString_2_PolarRadians((string)sCourse.GetValue(iItemPosition + 1), inDirectionType, inDirectionUnits);
if (!(dRadialBearing == -999)) { bHasRadialBearing = true; } //found a radial bearing
}
catch { }//this will catch case of final R meaning a curve right and not radial bearing
}
if ((item.ToLower()) == "c" && (!bHasChordBearing) && (iItemPosition > 3))
{// this c is for chord bearing
dChordBearing = DirectionString_2_PolarRadians((string)sCourse.GetValue(iItemPosition + 1), inDirectionType, inDirectionUnits);
bHasChordBearing = true; //found a chord bearing
}
if ((item.ToLower()) == "t" && (!bHasTangentBearing) && (iItemPosition > 3))
{// this t is for tangent bearing
dTangentBearing = DirectionString_2_PolarRadians((string)sCourse.GetValue(iItemPosition + 1), inDirectionType, inDirectionUnits);
bHasTangentBearing = true; //found a tangent bearing
IConstructPoint2 pToPt = new PointClass();
pToPt.ConstructAngleDistance(pPt, dTangentBearing, 100);
ILine EntryTangentLine = new LineClass();
EntryTangentLine.PutCoords(pPt, (IPoint)pToPt);
EntryTangentSegment = (ISegment)EntryTangentLine;
}
if ((item.ToLower()) == "l")
// this l is for defining a curve to the left
bCCW = true;
iItemPosition += 1;
}
if (!(bIsTangentCurve)) //non-tangent curve
{//chord bearing
if (bHasRadius && bHasChord && bHasChordBearing)
{
try
{
pConstArc.ConstructBearingRadiusChord(pPt, dChordBearing, bCCW, dRadius, dChord, true);
}
catch { };
}
if (bHasRadius && bHasArc && bHasChordBearing)
{
try
{
pConstArc.ConstructBearingRadiusArc(pPt, dChordBearing, bCCW, dRadius, dArcLength);
}
catch { };
}
//.........这里部分代码省略.........
示例6: ConstructPoint
private IPoint ConstructPoint(IPoint sourcePoint, double angle, double offsetAngle, double length, double width)
{
var p = new PointClass();
p.ConstructAngleDistance(sourcePoint, angle * Deg2Rad, width / 2);
var p2 = new PointClass();
p2.ConstructAngleDistance(p, offsetAngle * Deg2Rad, length);
return p2;
}
示例7: ContructGeometry
public void ContructGeometry(IPoint point, List<KeyValuePair<int, double>> datasources, out List<KeyValuePair<string, IPolygon>> polygons, out List<IPoint> lineStartPoints, out List<IPoint> txtPoints)
{
_centerPoint = new PointClass { X = point.X, Y = point.Y };
polygons = new List<KeyValuePair<string, IPolygon>>();
lineStartPoints = new List<IPoint>();
txtPoints = new List<IPoint>();
var polygonBlack = new PolygonClass();
var polygonWhite = new PolygonClass();
_linepoints = lineStartPoints;
_points = txtPoints;
var indexLine = 0;
var length = datasources.Sum(s => s.Value) * BL;
var totalLength = length / 2;
_halfHeight = length / 2;
_height3 = _halfHeight + GeometryHeight1;
_height4 = _halfHeight + GeometryHeight0 + GeometryHeight1;
IPoint lastFromPoint = null;
//IPoint lastToPoint = null;
foreach (var d in datasources)
{
double dd = d.Value * BL;
var list30 = new List<IPoint>
{
ConstructPoint(_centerPoint, 180, 90, totalLength),
ConstructPoint(_centerPoint, 0, 90, totalLength),
ConstructPoint(_centerPoint, 0, 90, totalLength - dd),
ConstructPoint(_centerPoint, 180, 90, totalLength - dd),
ConstructPoint(_centerPoint, 180, 90, totalLength)
};
// 生成面
var geometry = ConstructRing(list30);
if (d.Key == 0)
{
polygonWhite.AddGeometry(geometry);
}
else
{
polygonBlack.AddGeometry(geometry);
}
//int angleLine = indexLine % 2 == 0 ? 0 : 180;
var fromPoint = list30[indexLine % 2 + 2];
//var toPoint = ConstructPoint3(fromPoint, angleLine, LineWidth);
// 生成线
_linepoints.Add(fromPoint);
lastFromPoint = list30[3];
//lastToPoint = ConstructPoint3(lastFromPoint, Angle2, LineWidth * 2);
var txtPoint = new PointClass();
txtPoint.ConstructAngleDistance(fromPoint, (TextOffsetAngle + indexLine % 2 * 180) * Deg2Rad, TextOffsetDistance);
// 生成点
_points.Add(txtPoint);
totalLength -= dd;
indexLine++;
}
if (lastFromPoint != null)
{
var txtLastPoint = new PointClass();
txtLastPoint.ConstructAngleDistance(lastFromPoint, 180 * Deg2Rad, LastTextOffsetDistance);
// 生成点
_points.Add(txtLastPoint);
// 生成线
_linepoints.Add(lastFromPoint);
}
polygonWhite.Close();
polygonBlack.Close();
var tPolygon = new PolygonClass();
polygons.Add(new KeyValuePair<string, IPolygon>("top", ContructGeometry(out tPolygon)));
polygons.Add(new KeyValuePair<string, IPolygon>("top", tPolygon));
polygons.Add(new KeyValuePair<string, IPolygon>("white", polygonWhite));
polygons.Add(new KeyValuePair<string, IPolygon>("black", polygonBlack));
}