PyVrLine |
Top Previous Next |
Layer Class Reference (PyVrLine) Holds and manipulates VrOne line data More… Members Initialization
File Operations
Set Line Attributes
Get Line Attributes
Coordinate Input Output
Geometry
Graphics
The VrOne/Python Line class defines VrOne line data. A line consists of a header and a list of xyz points. An existing line class may be loaded from disk. Header information may be defined by a Python script or may be inherited from a VrOne Function Key. The user of this class should understand the VrOne Data Structure.
Example: # Loads all the lines in current workspace, change the layers # and graphic pointers and re-records them. # Filename: ChangeLines.py # WARNING: Changes data but is undoable
Ws = PyVrWs() # VrOne workspace manager object Line = PyVrLine() # VrOne line object WsNum = Ws.Aws() # Current workspace
Ws.UndoBegin (WsNum, "ChangeLines") # Begin undo
for LineNum in range (0, Ws.GetLineCount (WsNum)):
Line.Load (WsNum, LineNum) # Load line Line.Erase() # Erase it from graphics Line.SetLayer (23) # Change the layer Line.SetGpoint (15) # Change the graphic pointer Line.ReRec() # Re-record it Line.Plot() # Re-plot it
Ws.UndoEnd (WsNum) # End undo
Member Function Documentation Initializes a line by setting its header data to default values and setting its coordinate data to no points. This is useful when reusing a line class. Resets a line by setting its coordinate data to no points. The line header is not modified. This is useful when reusing a line class. Loads a line from disk.
Loads the last saved line. If a Python script is run as a Function Key’s OnEnd command it is possible for the script to further process the line that was just saved. See the AddPosts.py example.
Records a line at the end of a workspace.
Re-records a previously loaded line by marking the original location as deleted and placing the line at the end of the workspace.
Deletes a line by marking its layer number as a negative number on disk. Pack Vr removes deleted entities from a workspace
Allows interactive line selection. Returns a line number that may be used to load the line from disk.
Example: # Select (Id) a line and print it Ws = PyVrWs() # VrOne workspace manager Line = PyVrLine() # VrOne line object
if (Line.Id() != -1): # Did we get a line? # Print the points on the line for i in range (0, Line.GetNumXyz()): (x, y, z) = Line.GetPoint (i) print ("%d %.3f %.3f %.3f" % (i, x, y, z)) Returns the line point that was identified during the last Line.Id(). A Line.Id() must be called before GetIdPoint().
Example: # Select (Id) a line and print the line point number that was locked onto. Ws = PyVrWs() # VrOne workspace manager Line = PyVrLine() # VrOne line object
if (Line.Id() != -1): # Did we get a line? print “The line point we locked onto was”, Line.GetIdPoint()
Copies the current line to the target line.
Example: # Copy line Ws = PyVrWs() # VrOne workspace manager Line = PyVrLine() # VrOne line object TarLine = PyVrLine() # Line to copy to
if (Line.Id() != -1): # Did we get a line? print TarLine.GetLayer() # Print the current layer of TarLine Line.Copy (TarLine) # Copy the identified line to TarLine print TarLine.GetLayer() # Print new layer of TarLine Sets the layer of the line.
Sets the mode of the line. Mode 1 is a line and mode 2 is splined line.
Sets the graphic pointer of the line. The graphic pointer determines the graphic representation of a line such as a fence or a tree line.
Sets the pen number of a line, which determines the color to use. NOTE: If a Pen Table is active, this command has no effect.
Sets the line's non-graphic pointer.
Sets the link of the line.
Sets the Feature Code of the line.
Sets the Construction display of the line. The display of lines that have their construction flags set to 1 may be turned off.
Constr Construction flag (0-1) Example Line.SetConstr (0) Sets the width of the line. A line width defines the number of lines that will be drawn to the left and right of the centerline. The distance between these lines may be defined in Vr Configuration.
Sets the orientation of the line if used by VrMosaic.
If used by VrMosaic, sets the image side of the first image.
If used by VrMosaic, sets the image side of the second image.
SetPointFlags (PntNum, p=-1, a=-1, c=-1, f=-1, m=-1) Sets the point flags to a line coordinate. If the point number is out of range then nothing is done. See the VrOne Data Structure for information on the p (Pen command), a (Arc flag), c (Code), f (Flags), and m (Mosaic width) parameters.
Fills the line header data from a previously defined VrOne function key. If the function key requested does not exist, the line header is filled with default parameters.
Returns the workspace number from which a loaded line was retrieved.
Example # Select (Id) a line and print its workspace and line number Ws = PyVrWs() # VrOne workspace manager Line = PyVrLine() # VrOne line object
if (Line.Id() != -1): # Did we get a line? print “Workspace ”, Line.GetWsNum() print “Line number”, Line.GetLineNum() Returns the line number of a loaded line.
Example # Select (Id) a line and print its workspace and line number Ws = PyVrWs() # VrOne workspace manager Line = PyVrLine() # VrOne line object
if (Line.Id() != -1): # Did we get a line? print “Workspace ”, Line.GetWsNum() print “Line number”, Line.GetLineNum() Returns the number of points on the line.
Returns the line's layer.
Returns the mode of the line.
Returns the line's graphic pointer. The graphic pointer determines the graphic representation of a line such as a fence or a tree line.
Returns the pen number of the line. The pen number determines the color to use when drawing a line.
Returns the non-graphic pointer of the line.
Returns the link of the line.
Returns the feature code of the line
Returns the construction flag of the line. Lines with construction flags set to 1 may have their displays turned off.
Returns the width of the line. A line width defines the number of lines that will be drawn to the left and right of the centerline. The distance between these lines may be defined in Vr Configuration.
If used by VrMosaic, returns line orientation.
If used by VrMosaic, returns the image side of the first image.
If used by VrMosaic, returns the image side of the second image.
Returns the point flags to a line coordinate. If the point number requested is out of range, all parameters are returned as 0. See the VrOne Data Structure for information on the p (Pen command), a (Arc flag), c (Code), f(Flags), and m(Mosaic width) parameters.
AddPoint (x, y, z, p=0, a=0, c=0, f=0, m=0) Adds a coordinate point to the line at the end of line. See the VrOne Data Structure for more information on the p (Pen command), a (Arc flag), c (Code) , f(Flags), and m(Mosaic width) parameters. The p,a,c,f,m parameters are optional and default to 0.
InsPoint (PntNum, x, y, z, p=0, a=0, c=0, f=0, m=0) Inserts a coordinate point on the line after the point number specified. See the VrOne Data Structure for information on the p (Pen command), a (Arc flag), c (Code) , f(Flags), and m(Mosaic width) parameters. The p,a,c,f,m parameters are optional and default to 0. If the point number is out of range, the command is ignored.
ChgPoint (PntNum, x, y, z=0.0, p=0, a=0, c=0, f=0, m=0) Changes an existing coordinate point on the line. See the VrOne Data Structure for information on the p (Pen command), a (Arc flag), c (Code), f(Flags), and m(Mosaic width) parameters. The z, p, a, c, f,m parameters are optional and default to 0. If the point number is out of range, the command is ignored.
Returns a coordinate point from the line. If the point number requested is out of range, the coordinate position is returned as 0.
Backs the line up by deleting its last point.
Deletes a point from the line. If the point number is out of range, nothing is done.
Deletes a group of points from a line.
Prints the coordinate points on the line to the standard output device. This is useful when debugging. Reverses the direction of the line. Offsets the line by a defined distance. Line segment intersections are mitered.
Moves the line in the xyz direction by defined distances.
Scale (PivotX, PivotY, SclFac) Scales the line from the specified point.
Rotate (PivotX, PivotY, RotAng) Rotates the line about the specified point.
Mirrors the line in the X direction about a line point.
Mirrors the line in the Y direction about a line point.
Returns the line length.
Returns the line area.
Returns the line direction.
Returns the line Z range.
Example (MinZ, MaxZ) = Line.ZRange()
See also Mbr() Returns the line's XY MBR (Minimum Bounding Rectangle).
Example (MinX, MinY, MaxX, MaxY) = Line.Mbr() See also ZRange() Returns the line's mean azimuth.
Returns the closest line end to the specified point.
Returns the closure status of the line.
Returns the distance between the two endpoints on a line.
Closes the line.
Returns the closest line point number to the coordinate sent.
X, y Coordinate position Returns Closest point line number Example ClosePntNum = Line.ClosePoint (x, y) Snaps the point sent to the line.
SnapPointAdd (SnapX, SnapY, SnapZ, p=0, a=0, c=0, f=0, m=0) Snaps and adds a point to the line based on the coordinate sent. The point flags of p, a, c, f, m are optional.
Adds a point to the line based on a distance from beginning of the line.
Tests if the point is inside the line polygon. If the line is open, it is closed for this calculation.
Plots the line to all open graphics devices. The current header parameters are used.
Erases the line from all open graphics devices.
|