You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - Linear Referencing and Dynamic Segmentation forum

Kirk, please help   Rachel Williams Mar 17, 2003
Re: Kirk, please help   Kirk Kuykendall Mar 17, 2003
Re: Kirk, please help   Rachel Williams Mar 18, 2003
Re: Kirk, please help   Kirk Kuykendall Mar 18, 2003
Re: Kirk, please help   Valeria Andronaco May 06, 2010
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Kirk, please help 
Author Rachel Williams 
Date Mar 17, 2003 
Message Kirk,
In another threadhttp://forums.esri.com/Thread.asp?c=93&f=993&t=73927&mc=1#195440
You posted code to use a rubberband to intersect a polyline to find the m value.
Instead of using a rubberline, would it be possible to use a rubberpoint?
How would I go about doing this?
Thanks,
Rachel
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Kirk, please help 
Author Kirk Kuykendall 
Date Mar 17, 2003 
Message I would just IDisplayTransformation.ToMapPoint to get the point, as shown below.

kkeywords imsegmentation2 imsegmentation 
 
Option Explicit

Private Function UIToolControl1_Deactivate() As Boolean
    UIToolControl1_Deactivate = True
End Function

Private Sub UIToolControl1_MouseDown _
           (ByVal button As Long, ByVal shift As Long, _
            ByVal x As Long, ByVal y As Long)
    '
    ' get the measure where the user clicks
    '
    Dim pMxDoc As IMxDocument
    Set pMxDoc = ThisDocument
    If pMxDoc.SelectedItem Is Nothing Then
        MsgBox "choose a layer in the TOC first"
        Exit Sub
    End If
    
    If Not TypeOf pMxDoc.SelectedItem Is IFeatureLayer Then
        MsgBox "choose a layer in the TOC first"
        Exit Sub
    End If
    
    Dim pFLayer As IFeatureLayer
    Set pFLayer = pMxDoc.SelectedItem
    
    Dim pAV As IActiveView
    Set pAV = pMxDoc.FocusMap
    
    Dim pPoint As IPoint
    Set pPoint = pAV.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y)
    
    Dim pEnv As IEnvelope
    Set pEnv = pPoint.Envelope
    pEnv.Expand pMxDoc.SearchTolerance, pMxDoc.SearchTolerance, False
    
    Dim pSF As ISpatialFilter
    Set pSF = New SpatialFilter
    Set pSF.Geometry = pEnv
    pSF.SpatialRel = esriSpatialRelEnvelopeIntersects
    pSF.GeometryField = pFLayer.FeatureClass.ShapeFieldName
    Set pSF.OutputSpatialReference(pFLayer.FeatureClass.ShapeFieldName) = _
        pMxDoc.FocusMap.SpatialReference
        
    Dim pFCur As IFeatureCursor
    Set pFCur = pFLayer.FeatureClass.Search(pSF, False)
    
    Dim pProxOp As IProximityOperator
    Set pProxOp = pPoint
    
    Dim pFeat As IFeature, pClosestFeat As IFeature
    Dim dDist As Double, dClosestDist As Double
    Set pFeat = pFCur.NextFeature
    Do Until pFeat Is Nothing
        dDist = pProxOp.ReturnDistance(pFeat.Shape)
        If pClosestFeat Is Nothing Then
            Set pClosestFeat = pFeat
            dClosestDist = dDist
        Else
            If dDist < dClosestDist Then
                Set pClosestFeat = pFeat
                dClosestDist = dDist
            End If
        End If
        Set pFeat = pFCur.NextFeature
    Loop
    If pClosestFeat Is Nothing Then Exit Sub
    
    If Not TypeOf pClosestFeat.Shape Is IMSegmentation2 Then
        MsgBox "no measures on feature"
        Exit Sub
    End If
        
    Dim pPolyline As IPolyline
    Set pPolyline = pClosestFeat.ShapeCopy
    Dim pOutPoint As IPoint
    Set pOutPoint = New Point
    Dim dAlong As Double, dFrom As Double, bRight As Boolean
    pPolyline.QueryPointAndDistance esriNoExtension, _
                                    pPoint, False, _
                                    pOutPoint, dAlong, _
                                    dFrom, bRight
    Dim pMSeg As IMSegmentation2, vMeasures As Variant
    Set pMSeg = pPolyline
    vMeasures = pMSeg.GetMsAtDistance(dAlong, False)
    Application.StatusBar.Message(0) = vMeasures(0)
    
        
End Sub
 
  Kirk Kuykendall
AmberGIS Programming Services & Sales
http://www.ambergis.com
Now Answering questions at:
http://gis.stackexchange.com/


 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Kirk, please help 
Author Rachel Williams 
Date Mar 18, 2003 
Message In all the books I have looked at, they have just used IMSegmentation to get the m value from a point. What does IMSegmentation2 do differently to IMSegmentation?
Thank you very much!!!
Rachel 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Kirk, please help 
Author Kirk Kuykendall 
Date Mar 18, 2003 
Message I could have used IMSegmentation instead, but since IMSegmentation2 inherits from it, I don't need to.

It doesn't do anything different, I just use IMSegmentation2 out of habit, since I can't ever remember whats on 2 and not on IMSegmentation. 
  Kirk Kuykendall
AmberGIS Programming Services & Sales
http://www.ambergis.com
Now Answering questions at:
http://gis.stackexchange.com/


 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Kirk, please help 
Author Valeria Andronaco 
Date May 06, 2010 
Message Hi Kirk
I use ArcMap, I have a Personal Geodatabase Feautre Class with polyline.
If I select a polyline, how can I get, or select, all the other polyline that intersect it (in C#)?

Can you help me please?
Thanks in advance.

Valeria