PyVrPunt Class Reference
VrOne Python Point class More...
Members
Description
This class allows you to manage points. Points in Vr are normally used as an efficient method to store LiDAR data. Points are managed in buffers, and each point contains an x,y,z location along with many attribute fields. Each buffer is currently set to hold 1000 points.
Several methods use a point attribute dictionary to specify the point attributes. The attribute dictionary is a standard Python dictionary holding the attributes for a single point. A dictionary may be created using the standard Python syntax or with the InitPuntA convenience method of this class. An attribute dictionary is returned from the GetPunt, GetPuntA methods, and is set using ChgPunt, ChgPuntA, or InsPunt. The same thing can be accomplished using the direct methods for changing attributes such as SetInt, SetDsp, etc., but it may be more convenient to create and work with dictionary objects. Using attribute dictionaries is more efficient when changing multiple attributes.
The available keys in the dictionary and their default values are as follows:
"Lay" = 1 - Layer (1-30001)
"Int" = 0 - Intensity (0-65535)
"Dsp" = 1 - Display flag (0-1)
"Ret" = 0 - Return number (1-5)
"Nre" = 0 - Number of returns (1-5)
"Sdf" = 0 - Scan direction flag (0-1)
"Edg" = 0 - Edge of flight line flag (0-1)
"Cla" = 0 - Classification (0-31)
"Syn" = 0 - Synthetic flag (0-1)
"Key" = 0 - Key-point flag (0-1)
"Del" = 0 - Delete flag (0-1)
"Ang" = 0 - Scan angle (-90 - +90)
"Flt" = 0 - Flight number (0-255)
"Sou" = 0 - Point source Id (0-65535)
"Red" = 255 - Red component color (0-255)
"Green" = 255 - Green component color (0-255)
"Blue" = 255 - Blue component color (0-255)
"GpsTime" = 0.0 - GPS Time (Double precision number)
The following sample code demonstrates loading a Punt buffer, and then setting some attributes on one point.
Punt = PyVrPunt () # Create a new point
(ret) = Punt.Load (0, 0) # Load Punt buffer 0 from Workspace 0
if (ret == 0): # If the point loaded successfully
(x, y, z, PuntA) = Punt.GetPunt (0) # Get the first point in the point buffer
PuntA['Del'] = 1 # Set the deleted flag to 1
PuntA['Int'] = 500 # Set the intensity to 1
Punt.ChgPuntA (PuntA) # Change point attributes
Punt.ReRec() # Re-record the point buffer to the workspace
The following sample code demonstrates creating new Punt buffers. Notice how IsFull() is used to determine when the buffer should be recorded and reset.
Punt = PyVrPunt ()
# Get new set of point attributes
PuntA = Punt.InitPuntA ()
z = 0.0;
for i in range (0, 1000, 10):
for j in range (0, 1000, 10):
Punt.AddPunt (i, j, z, PuntA)
if Punt.IsFull():
(ret) = Punt.Rec (0)
Punt.Reset()
z = z + 1.0
(ret) = Punt.Rec (0)
Member Function Documentation
PyVrPunt ()
Point class constructor.
Init ()
Initializes the current point. Has same effect as allocating a new object.
Reset ()
Resets the point buffer.
Rec (WsNum)
Records a point entity.
WsNum
|
Workspace
|
returns
|
(ret)
|
|
ret
|
New Point entity number
|
ReRec ()
Re-records a point buffer.
Load (WsNum, BufNum)
Loads point buffer from Vr.
WsNum
|
Workspace.
|
BufNum
|
Point buffer number.
|
GetFormat ()
Gets LAS format for current point buffer.
returns
|
(format)
|
|
format
|
LAS Data format code (0 - 3).
|
GetMode ()
Sets the get mode
returns
|
(ret)
|
|
ret
|
Mode.
1= Line.
2= Spline.
3= Symbol.
4= Text.
5= Point.
|
GetPenNum (Aws)
Returns the entity color.
Aws
|
Currently active workspace.
|
returns
|
(ret)
|
|
ret
|
Pen number (1-256).
|
GetNpoint ()
Returns the entity non-graphic pointer.
returns
|
(ret)
|
|
ret
|
Non-graphic pointer number.
|
GetLink ()
Returns the entity link.
returns
|
(ret)
|
|
ret
|
Link number.
|
GetFc ()
Returns the entity feature code.
returns
|
(ret)
|
|
ret
|
Feature code (up to 48 characters).
|
GetConstr ()
Gets construction flag.
returns
|
(ret)
|
|
ret
|
Construction flag.
|
SetFormat (Format)
Sets LAS format for this point buffer.
Format
|
Data Format code (0 - 3).
|
SetPenNum (PenNum)
Sets the entity color.
PenNum
|
Pen number (1-256).
|
SetNpoint (Npoint)
Sets the entity non-graphic pointer.
Npoint
|
Non-graphic pointer (-2,147,483,648 to 2,147,483,648).
|
SetLink (Link)
Sets the entity link.
Link
|
Link (-2,147,483,648 to 2,147,483,648).
|
SetFc (Fc)
Sets the entity feature code.
Fc
|
Feature code (Up to 48 characters).
|
SetConstr (Constr)
Sets construction flag.
Constr
|
Construction flag (0-1).
0 = Off.
1 = On.
|
IsFull ()
Tests whether a point buffer is full. This should be used when creating new Punt entities to check if they are full and need to be recorded.
GetCount ()
Returns the current buffer point count.
AddPunt (x, y, z, PuntA)
Adds a point to the point buffer.
x
|
X coordinate of point to add.
|
y
|
Y coordinate of point to add.
|
z
|
Z coordinate of point to add.
|
PuntA
|
Point attributes dictionary.
|
returns
|
(ret)
|
|
ret
|
Point number in buffer.
|
AddPuntRgb (x, y, z, PuntA, r, g, b)
Adds a point with RGB data to the point buffer.
x
|
X coordinate of point to add.
|
y
|
Y coordinate of point to add.
|
z
|
Z coordinate of point to add.
|
PuntA
|
Point attributes dictionary.
|
r
|
Red channel.
|
g
|
Green channel.
|
b
|
Blue channel.
|
returns
|
(ret)
|
|
ret
|
Point number in buffer.
|
AddPuntNoDup (x, y, z, PuntA)
Adds a unique point to the point buffer. Does not allow point duplication.
x
|
X coordinate of point to add.
|
y
|
Y coordinate of point to add.
|
z
|
Z coordinate of point to add.
|
PuntA
|
Point attributes dictionary.
|
returns
|
(ret)
|
|
ret
|
Point number in buffer (-1 = Point is duplicate).
|
AddPuntNoDupRgb (x, y, z, PuntA, r, g, b)
Adds a unique point with RGB data to the point buffer. Does not allow point duplication.
x
|
X coordinate of point to add.
|
y
|
Y coordinate of point to add.
|
z
|
Z coordinate of point to add.
|
PuntA
|
Point attributes dictionary.
|
r
|
Red channel.
|
g
|
Green channel.
|
b
|
Blue channel.
|
returns
|
(ret)
|
|
ret
|
Point number in buffer (-1 = Punt is duplicate).
|
AddPuntNoDupXy (x, y, z)
Adds a unique point to the point buffer. Does not allow point duplication with the XY coordinates.
x
|
X coordinate of point to add.
|
y
|
Y coordinate of point to add.
|
z
|
Z coordinate of point to add.
|
returns
|
(ret)
|
|
ret
|
Point number in buffer.
-1 = Punt is duplicate.
|
ChgPunt (PuntNum, x, y, z, PuntA)
Changes a point in the point buffer.
PuntNum
|
Point number to change (LAST=Last).
|
x
|
X coordinate of point to add.
|
y
|
Y coordinate of point to add.
|
z
|
Z coordinate of point to add.
|
PuntA
|
Point attributes dictionary.
|
ChgPuntRgb (PuntNum, x, y, z, PuntA, r, g, b)
Changes a point in the point buffer.
PuntNum
|
Point number to change (LAST=Last).
|
x
|
X coordinate of point to add.
|
y
|
Y coordinate of point to add.
|
z
|
Z coordinate of point to add.
|
PuntA
|
Point attributes dictionary.
|
r
|
Red channel.
|
g
|
Green channel.
|
b
|
Blue channel.
|
ChgPuntGpsTime (PuntNum, GpsTime)
Changes the GPS Time of a point in the point buffer.
PuntNum
|
Point number to change (LAST=Last).
|
GpsTime
|
GPS Time.
|
ChgPuntA (PuntNum, PuntA)
Changes a point's attributes.
PuntNum
|
Point number to change (LAST=Last).
|
PuntA
|
Point attributes dictionary.
|
DelPunt (PuntNum)
Deletes a point in the point buffer.
PuntNum
|
Number of the point to delete
|
InsPunt (PuntNum, x, y, z, PuntA)
Inserts a point into the point buffer.
PuntNum
|
Point after which to insert new point.
|
x
|
X coordinate of new point.
|
y
|
Y coordinate of new point.
|
z
|
Z coordinate of new point.
|
PuntA
|
Point attributes dictionary.
|
InsPuntRgb (PuntNum, x, y, z, PuntA, r, g, b)
Inserts a point with RGB data into the point buffer.
PuntNum
|
Point to insert after
|
x
|
X coordinate of new point.
|
y
|
Y coordinate of new point.
|
z
|
Z coordinate of new point.
|
PuntA
|
Point attributes dictionary.
|
r
|
Red channel.
|
g
|
Green channel.
|
b
|
Blue channel.
|
GetPunt (PuntNum)
Gets a point from the point buffer.
PuntNum
|
Number of point to get (LAST=Last).
|
returns
|
(x, y, z, PuntA).
|
|
x
|
X coordinate of new point.
|
|
y
|
Y coordinate of new point.
|
|
z
|
Z coordinate of new point.
|
|
PuntA
|
Point attributes dictionary.
|
GetPuntRgb (PuntNum)
Gets a point with RGB data from the point buffer.
PuntNum
|
Number of point to get (LAST=Last).
|
returns
|
(x, y, z, PuntA, r, g, b)
|
|
x
|
X coordinate of new point.
|
|
y
|
Y coordinate of new point.
|
|
z
|
Z coordinate of new point.
|
|
PuntA
|
Point attributes dictionary.
|
|
r
|
Red channel.
|
|
g
|
Green channel.
|
|
b
|
Blue channel.
|
GetPuntGpsTime (PuntNum)
Gets the GPS Time for point.
PuntNum
|
Number of point for which to get GPS time.
|
|
GetPuntA (PuntNum)
Gets a point attribute structure.
PuntNum
|
Number of point to get (LAST=Last).
|
returns
|
(PuntA).
|
|
PuntA
|
Coordinate attributes dictionary
|
CopyHead (TarPunt)
Copies the header of the current punt to the punt sent.
TarPunt
|
Punt to which to copy header.
|
SetRad (Rad)
Sets radius.
GetRad ()
Gets radius.
SetRot (Rot)
Sets rotation.
GetRot ()
Gets rotation.
SetF1 (f1)
Sets F1
GetF1 (), F1()
Gets F1
SetF2 (f2)
Sets F2
GetF2 (), F2()
Gets F2.
SetX (PuntNum, x)
Sets X coordinate of a point.
PuntNum
|
Number of point for which to set X coordinate.
|
x
|
X coordinate.
|
SetY (PuntNum, y)
Sets Y coordinate of a punt.
PuntNum
|
Number of point for which to set Y coordinate.
|
y
|
Y coordinate.
|
SetZ (PuntNum, z)
Sets z coordinate of a point.
PuntNum
|
Point number for which to set Z coordinate.
|
z
|
Z coordinate.
|
x (PuntNum)
Gets X coordinate of a point.
PuntNum
|
Number of point for which to get X coordinate.
|
y (PuntNum)
Gets Y coordinate of a point.
PuntNum
|
Number of point for which to get Y coordinate.
|
z (PuntNum)
Gets Z coordinate of a point.
PuntNum
|
Number of point for which to get Z coordinate.
|
SetLay (PuntNum, Lay)
Sets a point's layer number.
PuntNum
|
Number of point to be modified.
|
Lay
|
Layer into which to place the point (1-32001).
|
SetInt (PuntNum, Int)
Sets a point's intensity.
PuntNum
|
Number of point to be modified.
|
Int
|
Point intensity attribute (0-65535)
|
SetDsp (PuntNum, Dsp)
Sets a point's display flag
PuntNum
|
Number of point to be modified.
|
Dsp
|
Display attribute (0-1).
|
SetRet (PuntNum, Ret)
Sets a point's return number.
PuntNum
|
Number of point to be modified.
|
Ret
|
Return number attribute (1-5).
|
SetNre (PuntNum, Nre)
Sets a point's number of returns.
PuntNum
|
Number of point to be modified.
|
Nre
|
Number of returns attribute (1-5).
|
SetSdf (PuntNum, Sdf)
Sets a point's Scan Direction flag
PuntNum
|
Number of point to be modified.
|
Sdf
|
Scan Direction flag attribute (0-1).
|
SetEdg (PuntNum, Edg)
Sets a point's Edge of Flight Line flag.
PuntNum
|
Number of point to be modified.
|
Edg
|
Edge of Flight Line flag attribute (0-1).
|
SetCla (PuntNum, Cla)
Sets a point's Classification.
PuntNum
|
Number of point to be modified.
|
Cla
|
Point Classification attribute (0-65535).
|
SetSyn (PuntNum, Syn)
Sets a point's Synthetic flag.
PuntNum
|
Number of point to be modified.
|
Syn
|
Synthetic flag attribute (0-1).
|
SetKey (PuntNum, Key)
Sets a point's Key Point flag.
PuntNum
|
Number of point to be modified.
|
Key
|
Key Point flag attribute (0-1).
|
SetDel (PuntNum, Del)
Sets a point's Delete flag.
PuntNum
|
Number of point to be modified.
|
Del
|
Point Delete flag attribute (0-1).
|
SetAng (PuntNum, Ang)
Sets a point's Scan Angle.
PuntNum
|
Number of point to modify.
|
Ang
|
Scan Angle attribute (-90 to +90).
|
SetFlt (PuntNum, Flt)
Sets a point's Flight Line number.
PuntNum
|
Number of point to modify.
|
Flt
|
Flight Line number attribute (0-255).
|
SetSou (PuntNum, Sou)
Sets a point's Source Id.
PuntNum
|
Number of point to modify.
|
Sou
|
Point Source Id attribute (0-65535).
|
Lay (PuntNum)
Gets Layer attribute (1-30001).
PuntNum
|
Number of point to check.
|
Int (PuntNum)
Gets Intensity attribute (0-65535).
PuntNum
|
Number of point to check.
|
Dsp (PuntNum)
Gets Display flag attribute (0-1).
PuntNum
|
Number of point to check.
|
Ret (PuntNum)
Gets Return Number attribute (1-5).
PuntNum
|
Number of point to check.
|
Nre (PuntNum)
Gets Number of Returns attribute (1-5).
PuntNum
|
Number of point to check.
|
Sdf (PuntNum)
Gets Scan Direction flag attribute (0-1).
PuntNum
|
Number of point to check.
|
Edg (PuntNum)
Gets Edge of Flight Line attribute (0-1).
PuntNum
|
Number of point to check.
|
Cla (PuntNum)
Gets Classification attribute (0-31).
PuntNum
|
Number of point to check.
|
Syn (PuntNum)
Gets Synthetic flag attribute (0-1).
PuntNum
|
Number of point to check.
|
Key (PuntNum)
Gets Key Point flag attribute (0-1).
PuntNum
|
Number of point to check.
|
Del (PuntNum)
Gets Delete flag attribute (0-1).
PuntNum
|
Number of point to check.
|
Ang (get</arg)
Gets Scan Angle attribute (-90 to +90).
PuntNum
|
Number of point to check.
|
Flt (PuntNum)
Gets Flight Number attribute (0-255).
PuntNum
|
Number of point to check.
|
Sou (PuntNum)
Gets Point Source Id attribute (0-65535).
PuntNum
|
Number of point to check.
|
UpdateHeader ()
Updates header information, minimum and maximum coordinates, minimum and maximum intensities, and classes that have been used.
GetMinMax ()
Gets minimum and maximum buffer coordinates.
returns
|
(MinX, MinY, MinZ, MaxX, MaxY, MaxZ)
|
|
MinX
|
Minimum X coordinate.
|
|
MinY
|
Minimum Y coordinate.
|
|
MinZ
|
Minimum Z coordinate.
|
|
MaxX
|
Maximum X coordinate.
|
|
MaxY
|
Maximum Y coordinate.
|
|
MaxZ
|
Maximum Z coordinate.
|
GetClosest (x, y, z, SeaRad)
Gets the closest point in the point buffer to the search point.
x
|
X coordinate of search point.
|
y
|
Y coordinate of search point.
|
z
|
Z coordinate of search point.
|
SeaRad
|
Search radius in ground units.
|
returns
|
(ret)
|
|
ret
|
Closest point number (-1=No points in buffer)
|
GetIntMinMax ()
Gets the intensity minimum and maximum for points in buffer. Deleted points are not considered.
returns
|
(Min, Max)
|
|
Min
|
Minimum intensity.
|
|
Max
|
Maximum intensity.
|
GetClassUsed (Class[32])
Gets the classifications of points in buffer.
Class[32]
|
|
returns
|
(Class)
|
|
Class
|
Classification flags as a Python list with 32 entries. NOTE: The Class array is not initialized, so multiple calls can be made with it. No item is ever set to 0.
|
Backup ()
Deletes the last point in the buffer.
Hack (PuntNum)
Hacks from the specified point number to the end of the buffer. Leaves the point of PuntNum as last point in buffer.
PuntNum
|
Point number from which to hack.
|
Dist (PuntNum, x, y)
Computes the distance from a point in the buffer to the specified coordinates.
PuntNum
|
Point number (0-Count-1 LAST=Last)
|
x
|
X coordinate to which to compute distance.
|
y
|
Y coordinate to which to compute distance.
|
returns
|
(ret)
|
|
ret
|
Distance.
|
Sort (Axis)
Sorts point buffer
Axis
|
Sorting method.
0=X axis location..
1=Y axis location.
2=Z axis location (elevation).
3=Intensity.
4=Return.
|
Copy (TarPunt)
Copies the content of the current Vr Point to the specified VrPoint
TarPunt
|
Vr Point to which to copy content.
|
Print ()
Prints the point buffer
SetCurBufNum (CurBufNum)
CurBufNum
|
Buffer number to become current.
|
GetCurBufNum ()
returns
|
(ret)
|
|
ret
|
Current buffer number.
|
SetCurPuntNum (CurPuntNum)
Sets current point number
CurPuntNum
|
Point number to become current.
|
GetCurPuntNum ()
returns
|
(ret)
|
|
ret
|
Current point number.
|
InitPuntA ()
Initializes the Vr Point Attributes
returns
|
(ret, PuntA)
|
|
PuntA
|
Vr Point Attributes dictionary
|
CopyPuntA (TarPuntA, SorPuntA)
Copies the Vr Point Attributes of one dictionary to a target dictionary.
TarPuntA
|
Target Vr Point Attributes dictionary.
|
SorPuntA
|
Source Vr Point Attributes dictionary.
|
ComparePuntA (PuntA1, PuntA2)
Compares two coordinate attribute dictionaries.
PuntA1
|
Vr Point Attributes dictionary 1.
|
PuntA2
|
Vr Point Attributes dictionary 2.
|
returns
|
(ret)
|
|
ret
|
0= Equal.
1= Not equal.
|
|