home *** CD-ROM | disk | FTP | other *** search
- ' Nodes.ave
- ' version: 1.1.
- ' date : 6/1998
- '
- ' This script draws active theme nodes and vertices. The node errors are distinguished.
- ' The theme must have line or polygon topology. It is reccomended to associate this script
- ' with popup menu on right mouse button to enable running it during editing process.
- ' (The nodes are drawn only in actual View extent without saving them.)
- '
- ' Color coding: BLUE - vertices
- ' GREEN - regular nodes
- ' CYAN - pseudo nodes
- ' RED - dangle nodes
- '
- ' author : Stepan Kafka, Kutna Hora District Council, Czech republic
- ' e-mail : kafka@email.cz
- '
- '---------------------------------------------------------------------------------------
- 'Example of update script:
- 'ActiveThemes = av.GetActiveDoc.GetActiveThemes
- 'if (ActiveThemes.Count <> 0) then
- ' theTheme = ActiveThemes.Get(0)
- ' if (theTheme.Is(FTheme)) then
- ' S = theTheme.GetFTab.FindField("Shape")
- ' if (S <> nil) then
- ' SELF.SetEnabled((S.GetType = #FIELD_SHAPELINE) or (S.GetType = #FIELD_SHAPEPOLY))
- ' exit
- ' end
- ' end
- 'end
- 'SELF.SetEnabled(false)
- '---------------------------------------------------------------------------------------
-
-
- '--- Symbol settings for Node representation -----
- '- vertex
- SVert = av.GetSymbolWin.GetPalette.GetList(#PALETTE_LIST_MARKER).Get(1).Clone
- SVert.SetColor(Color.GetBlue)
- SVert.SetSize(4)
-
- '- Regular Node
- SNode = av.GetSymbolWin.GetPalette.GetList(#PALETTE_LIST_MARKER).Get(1).Clone
- SNode.SetColor(Color.GetGreen)
- SNode.SetSize(6)
-
- '- Pseudo Node
- SPseudo = av.GetSymbolWin.GetPalette.GetList(#PALETTE_LIST_MARKER).Get(1).Clone
- SPseudo.SetColor(Color.GetCyan)
- SPseudo.SetSize(6)
-
- '- Dangle Node
- SDangle = av.GetSymbolWin.GetPalette.GetList(#PALETTE_LIST_MARKER).Get(1).Clone
- SDangle.SetColor(Color.GetRed)
- SDangle.SetSize(6)
- '---------------------------------------------------------------------------------------
-
- '--- Initializing
- theView = av.GetActiveDoc
- thePrj = theView.GetProjection
- theSelMode = theView.GetSelectMode
- theView.SetSelectMode(#GRAPHICS_SELECT_NORMAL)
- theTheme = theView.GetActiveThemes.Get(0)
- theTable = theTheme.GetFTab
- D = theView.GetDisplay
- theShape = theTable.FindField("Shape")
- NodeList = {}
-
- '---- Selecting the shapes
- OldSel = theTable.GetSelection.Clone
- DExt = D.ReturnVisExtent
- theTheme.SelectByRect(DExt, #VTAB_SELTYPE_NEW)
- CurrSel = theTable.GetSelection.Clone
- theTable.SetSelection(OldSel)
-
- ' --- Vertices drawing and Nodes collecting ------
- D.BeginClip
- for each rec in CurrSel
- theLines = theTable.ReturnValue(theShape, rec).AsPolyLine.Explode
- for each L in theLines
- thePoints = L.AsMultiPoint.ReturnProjected(thePrj)
- D.DrawMultiPoint(thePoints, SVert)
- NodeList.Add(thePoints.AsList.Get(0))
- NodeList.Add(thePoints.AsList.Get(thePoints.Count-1))
- end
- end
-
- ' --- Nodes processing -------------------------
- AllNodes = NodeList.Count-1
- av.ShowMsg("Searching nodes...")
- av.ShowStopButton
- while (NodeList.Count > 0)
- OverPos = 0
- thePoint= NodeList.Get(0)
- NodeList.Remove(0)
- Nodes = NodeList.Count-1
- if (av.SetStatus((AllNodes-Nodes)/AllNodes*100).not) then
- av.SetStatus(100)
- av.ShowMsg("Cancelled by operator.")
- exit
- end
- C = 0
- while (C <= Nodes)
- if (thePoint.Intersects(NodeList.Get(C))) then
- NodeList.Remove(C)
- Nodes = Nodes - 1
- OverPos = OverPos + 1
- else
- C = C + 1
- end
- end
- if (OverPos > 1) then
- D.DrawPoint(thePoint, SNode)
- elseif (OverPos = 1) then
- D.DrawPoint(thePoint, SPseudo)
- else
- D.DrawPoint(thePoint, SDangle)
- end
- end
- D.EndClip
- av.SetStatus(100)
- av.ClearMsg
- theView.SetSelectMode(theSelMode)
- av.PurgeObjects
-
-
-