ArcEngine implements capturing nodes and arcengine captures nodes.

Source: Internet
Author: User
Tags ipoint

ArcEngine implements capturing nodes and arcengine captures nodes.

From: http://blog.sina.com.cn/s/blog_4d0b75870100o960.html

// Obtain the nearest node and display it in OnMouseMove

// Pnt: move the cursor

// MapSize: Specifies the geographic range.

Public static IPoint GetNearestVertex (IActiveView actview, IPoint pnt, double mapSize)
{
IPoint vetex = null;
IPoint hitPnt = new PointClass ();
IHitTest hitTest = null;
IPointCollection pntColl = new MultipointClass ();
IProximityOperator prox = null;
Double hitdis = 0;
Int hitpartindex = 0, hitsegindex = 0;
Boolean rside = false;
IFeatureCache2 featCache = new FeatureCacheClass ();
Double pixelSize = ConvertMapUnitsToPixels (actview, mapSize); // converts a geographical range to a pixel
FeatCache. Initialize (pnt, pixelSize); // Initialize the cache
For (int I = 0; I <actview. FocusMap. LayerCount; I ++)
{

// Cache is added only for vertices, lines, and surfaces and visible layers.
IFeatureLayer featLayer = (IFeatureLayer) actview. FocusMap. get_Layer (I );
If (featLayer! = Null & featLayer. Visible = true &&
(FeatLayer. FeatureClass. ShapeType = esriGeometryType. esriGeometryPolyline |
FeatLayer. FeatureClass. ShapeType = esriGeometryType. esriGeometryPolygon |
FeatLayer. FeatureClass. ShapeType = esriGeometryType. esriGeometryPoint ))
{
FeatCache. AddFeatures (featLayer. FeatureClass, null );
For (int j = 0; j <featCache. Count; j ++)
{
IFeature feat = featCache. get_Feature (j );
HitTest = (IHitTest) feat. Shape;

// Capture nodes. You can also set esriGeometryHitPartType, Edge Point capturing, and intermediate point.
If (hitTest. HitTest (pnt, mapSize, esriGeometryHitPartType. esriGeometryPartVertex, hitPnt, ref hitdis, ref hitpartindex, ref hitsegindex, ref rside ))
{
Object obj = Type. Missing;
PntColl. AddPoint (hitPnt, ref obj, ref obj );
Break;
}
}
}
}
Prox = (IProximityOperator) pnt;
Double minDis = 0, dis = 0;
For (int I = 0; I <pntColl. PointCount; I ++)
{
IPoint tmpPnt = pntColl. get_Point (I );
Dis = prox. ReturnDistance (tmpPnt );
If (I = 0)
{
MinDis = dis;
Vetex = tmpPnt;
}
Else
{
If (dis <minDis)
{
MinDis = dis;
Vetex = tmpPnt;
}
}
}
Return vetex;
}


In ArcEngine, how does one highlight the line between two nodes by using the second development in c #?

Dynamic Segmentation can be done, which is a little complicated and requires data processing;
For more information, see bbs.esrichina-bj.cn/ESRI/thread-56565-1-1.html.
You can implement the function process (How do you get the two nodes? Just highlight it ?) So that we can further explore other methods!

I used arcengine to develop a line extraction node, and assigned coordinates using longitude and latitude values. However, when the point location is offset, It is not online. Why?

Do not understand, Please master it.
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.