Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

ArcEngine 10 .Net 4 c#

Hi I'm currently allowing user to select a point on a polyline and creating a point on the line. I am using snapping tool.

I just want to make sure that when the user clicks on the screen, the point feedback that I get lies on top of the polyline.

I was wondering if there is a method that I can check if the IPOINT is ON any of the polylines in the polyline layer.

Thanks and Regards

share|improve this question
2  
Sadly I think you mean .NET 3.5. 4.0 is not supported with ArcEngine –  patrick Jun 14 '11 at 15:46
1  
Do you mean on the polyline or on the symbology used to draw the polyline? –  Kirk Kuykendall Jun 14 '11 at 18:21
add comment

2 Answers

up vote 4 down vote accepted

There's probably an easier way to do it but this is what I do.

//layer is what layer you are checking
ESRI.ArcGIS.Carto.IIdentify identify1 = layer as IIdentify; 

//idGeo is IGeometry you want to query -in your case a point, but I'm using a square here    
IArray array = identify1.Identify(idGeo);  

if (array != null)
{
    object obj = array.get_Element(0);
    IFeatureIdentifyObj fobj = obj as IFeatureIdentifyObj;
    IRowIdentifyObject irow = fobj as IRowIdentifyObject;
    IFeature feature = irow.Row as IFeature;
    IGeometry geometry1 = feature.Shape;
    IPointCollection pc = geometry1 as IPointCollection;
    if(pc != null && pc.PointCount > 0) //then its a polyline
}
share|improve this answer
add comment

You could probably use the iHitTest interface for this. http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//002m0000021v000000

I only use VB so I don't have an example handy. Here is a version 9.3 example: http://resources.esri.com/help/9.3/ArcGISEngine/arcobjects/esriGeometry/IHittest_HitTest_Example.htm

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.