本文整理汇总了C#中ESRI.PutCoords方法的典型用法代码示例。如果您正苦于以下问题:C# ESRI.PutCoords方法的具体用法?C# ESRI.PutCoords怎么用?C# ESRI.PutCoords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ESRI
的用法示例。
在下文中一共展示了ESRI.PutCoords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QueryBoundsFromGeom
private void QueryBoundsFromGeom(int hDC, ref ESRI.ArcGIS.Display.IDisplayTransformation transform, ref ESRI.ArcGIS.Geometry.IPolygon boundary, ref ESRI.ArcGIS.Geometry.IPoint point)
{
// Calculate Size, XOffset and YOffset of the shape in Map units.
double dMapXOffset = 0;
double dMapSize = 0;
double dMapYOffset = 0;
dMapSize = PointsToMap(transform, m_dSize);
if (m_dXOffset != 0)
dMapXOffset = PointsToMap(transform, m_dXOffset);
if (m_dYOffset != 0)
dMapYOffset = PointsToMap(transform, m_dYOffset);
point.PutCoords(point.X + dMapXOffset, point.Y + dMapYOffset);
// Set up the device ratio.
SetupDeviceRatio(hDC, transform);
ESRI.ArcGIS.Geometry.IPointCollection ptColl = null;
ESRI.ArcGIS.Geometry.ISegmentCollection segColl = null;
double dVal = 0; // dVal is the measurement of the short side of a Triangles are based on.
double dRad = 0;
ptColl = (IPointCollection)boundary;
segColl = (ISegmentCollection)boundary;
dRad = dMapSize / 2;
dVal = System.Math.Sqrt((dRad * dRad) / 2);
object missing = System.Reflection.Missing.Value;
ptColl.AddPoint(Utility.CreatePoint(point.X + dVal, point.Y - dVal), ref missing, ref missing);
ptColl.AddPoint(Utility.CreatePoint(point.X - dVal, point.Y - dVal), ref missing, ref missing);
ptColl.AddPoint(Utility.CreatePoint(point.X - dVal, point.Y + dVal), ref missing, ref missing);
IPoint p = ptColl.get_Point(0);
segColl.AddSegment((ISegment)Utility.CreateCircArc(point, ptColl.get_Point(2), ref p), ref missing, ref missing);
// Account for rotation also.
ESRI.ArcGIS.Geometry.ITransform2D trans2D = null;
if ((m_dAngle + m_dMapRotation) != 0)
{
trans2D = boundary as ITransform2D;
trans2D.Rotate(point, Utility.Radians(m_dAngle + m_dMapRotation));
}
}
示例2: Snap
public bool Snap(ESRI.ArcGIS.Geometry.IGeometry geom,
ESRI.ArcGIS.Geometry.IPoint point, double tolerance)
{
GetFeatureClass();
bool b_setNewFeatureCache = false;
if (m_featureClass == null || m_engineeditor == null)
return false;
if (m_featureClass.ShapeType != esriGeometryType.esriGeometryPoint)
return false;
//Check if a feature cache has been created.
if (!b_setNewFeatureCache)
{
m_featureCache = new FeatureCache();
b_setNewFeatureCache = true;
}
//Fill the cache with the geometries.
//It is up to the developer to choose an appropriate value
//given the map units and the scale at which editing will be undertaken.
FillCache(m_featureClass, point, 10000);
IProximityOperator proximityOp = point as IProximityOperator;
double minDist = tolerance;
IPoint cachePt = new PointClass();
IPoint snapPt = new PointClass();
IPolygon outPoly = new PolygonClass();
ITopologicalOperator topoOp;
IFeature feature;
int Index = 0;
for (int Count = 0; Count < m_featureCache.Count; Count++)
{
feature = m_featureCache.get_Feature(Count);
cachePt = feature.Shape as IPoint;
topoOp = cachePt as ITopologicalOperator;
//Set the buffer distance to an appropriate value
//given the map units and data being edited
outPoly = topoOp.Buffer(1000) as IPolygon;
double Dist = proximityOp.ReturnDistance(outPoly);
if (Dist < minDist)
{
Index = Count;
minDist = Dist;
}
}
//Make sure minDist is within the search tolerance.
if (minDist >= tolerance)
return false;
//Retrieve the feature and its part again.
feature = m_featureCache.get_Feature(Index);
cachePt = feature.Shape as IPoint;
topoOp = cachePt as ITopologicalOperator;
//Set the buffer distance to an appropriate value
//given the map scale and data being edited
outPoly = topoOp.Buffer(1000) as IPolygon;
proximityOp = outPoly as IProximityOperator;
snapPt = proximityOp.ReturnNearestPoint(point,esriSegmentExtension.esriNoExtension);
//Since point was passed in ByValue, we have to modify its values instead.
//of giving it a new address.
point.PutCoords(snapPt.X, snapPt.Y);
return true;
}