Hello All
Could you help me with my problem. I'm using MapX 4.5, work with road network. My aim 
is to define point of crossings, where roads intersect in such a way that for at least 
one road intersection point is not the end or start point of this line. I'll try to 
show this as an example:
 
\  /     or      =======
 X                      |
/  \                     |
 
 
1. Define such intersection points
2. Divide each line into two at this intersection point
 
1. problem I've already solved but it's quite slow - 20 minutes for 4000 objects. May 
be I do something wrong. Below is my code. Have you some ideas for optimizing it?
 
Map1.DisplayCoordSys = CurLayer.CoordSys
Map1.NumericCoordSys = CurLayer.CoordSys

CurLayer.BeginAccess miAccessRead
Clayer.BeginAccess miAccessReadWrite

For iCount = 1 To CurLayer.AllFeatures.Count
Set ftr1 = CurLayer.AllFeatures.Item(iCount)

StartPtX = ftr1.Parts.Item(1).Item(1).X
STartPtY = ftr1.Parts.Item(1).Item(1).Y
EndPtX = 
ftr1.Parts.Item(ftr1.Parts.Count).Item(ftr1.Parts.Item(ftr1.Parts.Count).Count).X
EndPtY = 
ftr1.Parts.Item(ftr1.Parts.Count).Item(ftr1.Parts.Item(ftr1.Parts.Count).Count).Y

Set ftrs = CurLayer.SearchWithinFeature(ftr1, miSearchTypePartiallyWithin)
For i = 1 To ftrs.Count
Set ftr2 = ftrs.Item(i)
If ftr2.FeatureKey <> ftr1.FeatureKey Then

Set pts = Map1.FeatureFactory.IntersectionPoints(ftr1, ftr2, miIntersectAll)
For j = 1 To pts.Count
If Not (pts.Item(j).X = StartPtX And pts.Item(j).Y = STartPtY) And Not (pts.Item(j).X 
= EndPtX And pts.Item(j).Y = EndPtY) Then
Set AddFtr = Map1.FeatureFactory.CreateSymbol(pts.Item(j))
AddFtr.Attach Map1
Clayer.AddFeature AddFtr, RVals2
End If
Next
End If
Next
Next
CurLayer.EndAccess miAccessEnd
Clayer.EndAccess miAccessEnd

2. I can't imagine how to do this more effective than define (while loop through the 
whole polyline segment) where the intersection point lies and create two polylines. I 
doubt it won't take much time. May be there's another, more simple way to make two 
polylines from one dividing them at definite point.

I'll be very gratefull for any answers


Best Regards,
Katerinka

---------------------------------
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

Reply via email to