home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / Chip_2000-02_cd.bin / tema / ArcData / www / download / nodes.ave < prev    next >
Text File  |  1999-12-17  |  4KB  |  126 lines

  1. ' Nodes.ave
  2. ' version: 1.1.   
  3. ' date   : 6/1998
  4. '
  5. ' This script draws active theme nodes and vertices. The node errors are distinguished.
  6. ' The theme must have line or polygon topology. It is reccomended to associate this script
  7. ' with popup menu on right mouse button to enable running it during editing process. 
  8. ' (The nodes are drawn only in actual View extent without saving them.)
  9. ' Color coding:  BLUE  - vertices
  10. '                GREEN - regular nodes
  11. '                CYAN  - pseudo nodes
  12. '                RED   - dangle nodes
  13. '
  14. ' author : Stepan Kafka, Kutna Hora District Council, Czech republic
  15. ' e-mail : kafka@email.cz
  16. '--------------------------------------------------------------------------------------- 
  17. 'Example of update script:
  18. 'ActiveThemes = av.GetActiveDoc.GetActiveThemes
  19. 'if (ActiveThemes.Count <> 0) then
  20. '  theTheme = ActiveThemes.Get(0)
  21. '  if (theTheme.Is(FTheme)) then
  22. '    S = theTheme.GetFTab.FindField("Shape")
  23. '    if (S <> nil) then
  24. '      SELF.SetEnabled((S.GetType = #FIELD_SHAPELINE) or (S.GetType = #FIELD_SHAPEPOLY))
  25. '      exit
  26. '    end  
  27. '  end
  28. 'end  
  29. 'SELF.SetEnabled(false)
  30. '---------------------------------------------------------------------------------------
  31.  
  32.  
  33. '--- Symbol settings for Node representation -----
  34. '- vertex
  35. SVert = av.GetSymbolWin.GetPalette.GetList(#PALETTE_LIST_MARKER).Get(1).Clone
  36. SVert.SetColor(Color.GetBlue)
  37. SVert.SetSize(4)
  38.  
  39. '- Regular Node
  40. SNode = av.GetSymbolWin.GetPalette.GetList(#PALETTE_LIST_MARKER).Get(1).Clone
  41. SNode.SetColor(Color.GetGreen)
  42. SNode.SetSize(6)
  43.  
  44. '- Pseudo Node
  45. SPseudo = av.GetSymbolWin.GetPalette.GetList(#PALETTE_LIST_MARKER).Get(1).Clone
  46. SPseudo.SetColor(Color.GetCyan)
  47. SPseudo.SetSize(6)
  48.  
  49. '- Dangle Node
  50. SDangle = av.GetSymbolWin.GetPalette.GetList(#PALETTE_LIST_MARKER).Get(1).Clone
  51. SDangle.SetColor(Color.GetRed)
  52. SDangle.SetSize(6)
  53. '--------------------------------------------------------------------------------------- 
  54.  
  55. '--- Initializing
  56. theView = av.GetActiveDoc
  57. thePrj = theView.GetProjection
  58. theSelMode = theView.GetSelectMode
  59. theView.SetSelectMode(#GRAPHICS_SELECT_NORMAL)
  60. theTheme = theView.GetActiveThemes.Get(0)
  61. theTable = theTheme.GetFTab
  62. D = theView.GetDisplay
  63. theShape = theTable.FindField("Shape")
  64. NodeList = {}
  65.  
  66. '---- Selecting the shapes
  67. OldSel = theTable.GetSelection.Clone
  68. DExt = D.ReturnVisExtent
  69. theTheme.SelectByRect(DExt, #VTAB_SELTYPE_NEW)
  70. CurrSel = theTable.GetSelection.Clone
  71. theTable.SetSelection(OldSel)
  72.  
  73. ' --- Vertices drawing and Nodes collecting ------
  74. D.BeginClip
  75. for each rec in CurrSel
  76.   theLines = theTable.ReturnValue(theShape, rec).AsPolyLine.Explode
  77.   for each L in theLines
  78.     thePoints = L.AsMultiPoint.ReturnProjected(thePrj)
  79.     D.DrawMultiPoint(thePoints, SVert)
  80.     NodeList.Add(thePoints.AsList.Get(0))
  81.     NodeList.Add(thePoints.AsList.Get(thePoints.Count-1))
  82.   end  
  83. end
  84.  
  85. ' --- Nodes processing -------------------------
  86. AllNodes = NodeList.Count-1
  87. av.ShowMsg("Searching nodes...")
  88. av.ShowStopButton
  89. while (NodeList.Count > 0)
  90.   OverPos = 0
  91.   thePoint= NodeList.Get(0)
  92.   NodeList.Remove(0)
  93.   Nodes = NodeList.Count-1
  94.   if (av.SetStatus((AllNodes-Nodes)/AllNodes*100).not) then
  95.     av.SetStatus(100)
  96.     av.ShowMsg("Cancelled by operator.")
  97.     exit
  98.   end
  99.   C = 0
  100.   while (C <= Nodes)
  101.     if (thePoint.Intersects(NodeList.Get(C))) then
  102.       NodeList.Remove(C)
  103.       Nodes = Nodes - 1
  104.       OverPos = OverPos + 1
  105.     else
  106.       C = C + 1  
  107.     end  
  108.   end
  109.   if (OverPos > 1) then
  110.     D.DrawPoint(thePoint, SNode)
  111.   elseif (OverPos = 1) then
  112.     D.DrawPoint(thePoint, SPseudo)
  113.   else
  114.     D.DrawPoint(thePoint, SDangle)
  115.   end  
  116. end
  117. D.EndClip
  118. av.SetStatus(100)
  119. av.ClearMsg
  120. theView.SetSelectMode(theSelMode)
  121. av.PurgeObjects
  122.  
  123.  
  124.