Absolute value
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
a = -6
b = abs(2 * a) # b = 12
print(b)
trigonometric arccosine
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
b = acos(0.5)
print(b)
# b = 1.0471975511965979
trigonometric arccosine (degree version)
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
hyperbolic arccosine
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
b = acosh(0.5)
print(b)
# b = NULL
hyperbolic arccotangent
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
b = acoth(0)
print(b)
# b = NULL
hyperbolic arccosecant
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
b = acsch(0)
print(b)
# b = Infinity
hyperbolic arcsecant
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
b = asech(1)
print(b) # b = 0
trigonometric arcsine
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
a = sqrt(3) / 2
b = deg * asin(a)
print(b)
# b = 59.99999999999999
trigonometric arcsine (degree version)
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
hyperbolic arcsine
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
a = (exp(0) - exp(-0)) / 2
b = asinh(a)
print(b) # b = 0
trigonometric arctangent
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
a = 1 ; b = deg * atan(a)
print(b) # b = 45
trigonometric arctangent
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
a = sqrt(3) / 2 ; b = -.5
c = deg * atan2(a, b)
print(c) # c = 120
trigonometric arctangent (degree version)
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
hyperbolic arctangent
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
a = exp(0) - exp(-0)
b = exp(0) + exp(-0)
c = atanh(a/b)
print(c) # c = 0
Force a value into given range.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of Bound()
Round decimal up to integer
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
a = ceil(7.499) # a = 8
b = ceil(7.001) # b = 8
c = ceil(-7.01) # c = -7
d = ceil(-7.99) # d = -7
print(a, b, c, d)
Converts polar coordinates to rectangular (radians).
Where:
Parameters:
Details:
Returns:
Create Date: 16-Jun-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ConvertPolartoXY()
Converts polar coordinates to rectangular (degrees).
Where:
Parameters:
Details:
Returns:
Create Date: 16-Jun-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ConvertPolartoXYd()
Converts polar coordinates to rectangular (radians).
Where:
Parameters:
Details:
Returns:
Create Date: 17-Jun-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ConvertSphericaltoXYZ()
Converts polar coordinates to rectangular (degrees).
Where:
Parameters:
Details:
Returns:
Create Date: 17-Jun-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ConvertSphericaltoXYZd()
Converts rectangular coordinates to polar (radians).
Where:
Parameters:
Details:
Returns:
Create Date: 16-Jun-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ConvertXYtoPolar()
Converts rectangular coordinates to polar (degrees).
Where:
Parameters:
Details:
Returns:
Create Date: 16-Jun-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ConvertXYtoPolard()
Converts rectangular coordinates to spherical (radians).
Where:
Parameters:
Details:
Returns:
Create Date: 17-Jun-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ConvertXYZtoSpherical()
Converts rectangular coordinates to spherical (degrees).
Where:
Parameters:
Details:
Returns:
Create Date: 17-Jun-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ConvertXYZtoSphericald()
Copies a given range of elements form one array into another.
Where:
Parameters:
Details:
Returns:
Create Date: 22-Jul-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
clear();
Array a1[10];
Array a2[10];
for x=1 to 10{
a1[x]=20+x;
a2[x]=x;
}
CopyArrayElements(a2,a1,3,6,5,8);
for x=1 to 10{
print(a2[x]);
}
trigonometric cosine
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(cos(60 / deg)) # prints .500000000000001
trigonometric cosine (degree version)
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
hyperbolic cosine
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(cosh(0)) # prints 1
trigonometric cosecant
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(csc(30 / deg)) # prints 2
trigonometric cosecant (degree version)
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
trigonometric cotangent
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(ctn(0 / deg)) # prints Infinity
trigonometric cotangent (degree version)
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Calculate the distance, azimuth, and elevation from the first point to the second (radians).
Where:
Parameters:
Details:
Returns:
Create Date: 17-Jun-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of Displacement3D()
Calculate the distance, azimuth, and elevation from the first point to the second (degrees).
Where:
Parameters:
Details:
Returns:
Create Date: 17-Jun-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of Displacement3Dd()
Exponential (e to the power of x)
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(exp(-1/0)) # prints 0
Exponential (10 to the power of x)
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(exp10(3)) # prints 1000
Round decimal down to integer
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(floor(7.5)) # prints 7
print(floor(-7.5)) # prints -8
Get scale factor for angle unit conversions.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of GetUnitConvAngle()
Get scale factor for area unit conversions.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of GetUnitConvArea()
Get scale factor for distance unit conversions.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of GetUnitConvDist()
Get scale factor for volume unit.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of GetUnitConvVolume()
Find hypotenuse of right triangle
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear(); dx = 3; dy = 4
print(hypot(dx, dy)) # 5
Integer portion of argument (truncate)
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
a = int(7.7) # a = 7
a = int(-7.7) # a = -8
Does the argument have the value NULL?
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(IsNull(NULL))
Calculate the linear regression coeficients for a group of points.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LinearRegression()
Natural logarithm of argument
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print("Enter a number.") ; a=input
print("log(x)=", log(x))
Base 10 logarithm of argument
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print("Enter a number.") ; a=input
print("log10(x)=", log10(x))
Computes an equation of given power that best fits the given points.
Where:
Parameters:
Details:
Returns:
Create Date: 22-Jun-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of PolynomialCurveFit()
clear();
array xpoints[4];
array ypoints[4];
array carray[3];
xpoints[1]=-1;
xpoints[2]=0;
xpoints[3]=1;
xpoints[4]=2;
ypoints[1]=4;
ypoints[2]=10;
ypoints[3]=20;
ypoints[4]=34;
string$=PolynomialCurveFit(xpoints,ypoints,4,2,carray,r);
printf("%s\n",string$);
printf("%f %f %f\n",carray[1],carray[2],carray[3]);
printf("r = %f\n",r);
return x to the power of y
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(pow(2, 3)) # 8
Returns random value between zero (0) and x
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
print(rand(1))
Computes a pair of random numbers based on a normal distibution.
Where:
Parameters:
Details:
Returns:
Create Date: 21-Jun-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of RandomGaussian()
Resize a one dimensional array ( a[col] ), or two dimensional array ( a[row, col] )
Where:
Parameters:
Details:
Returns:
Create Date: 08-Oct-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ResizeArrayClear()
array a[3];
array a2[3, 4];
ResizeArrayClear(a, 5); # increase size of one dimensional array
ResizeArrayClear(a, 2); # decrease size of one dimensional array
ResizeArrayClear(a2, 5, 6); # increase size of two dimensional array
ResizeArrayClear(a2, 2, 3); # decrease size of two dimensional array
Resize a one dimensional array ( a[col] ), or two dimensional array ( a[row, col] )
Where:
Parameters:
Details:
Returns:
Create Date: 08-Oct-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ResizeArrayPreserve()
array a[3];
array a2[3, 4];
ResizeArrayPreserve(a, 5); # increase size of one dimensional array
ResizeArrayPreserve(a, 2); # decrease size of one dimensional array
ResizeArrayPreserve(a2, 5, 6); # increase size of two dimensional array
ResizeArrayPreserve(a2, 2, 3); # decrease size of two dimensional array
Round x to nearest integer
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
print(round(10.5)) # 11
print(round(-10.5) #-10
trigonometric secant
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
print(sec(60/deg))
trigonometric secant (degree version)
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Return -1, 0 or 1 depending on sign of argument
Where:
Parameters:
Details:
Returns:
Create Date: 20-Jun-2000
Modify Date: none
Available in SML for Windows: Yes
trigonometric sine
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(sin(30/deg)) #.5
trigonometric sine (degree version)
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
hyperbolic sine
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(sinh(0)) # 0
Return the square of the argument
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(sqr(-3)) # 9
Returns the (positive) square root of the argument
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(sqrt(9)) # 3
print(sqrt(-9)) # 0
trigonometric tangent
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(tan(90/deg)) # -2147483648 (roundoff error)
trigonometric tangent (degree version)
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
hyperbolic tangent
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(tanh(0)) # 0
Returns the current date in YYYYMMDD format
Where:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
x=Date() ; print(x)
Returns number of days between two dates
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
x=DateDiff(19960101, 19970101)
print(x) # 365
Converts YYYYMMDD format to Julian date
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
x=DateToJulian(19960101)
print(x) ; print(JulianToDate(x))
Convert a number date to a string.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of DateToString()
Returns the current Julian date
Where:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
x=JulianDate() ; print(x)
Converts Julian date to YYYYMMDD format
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
x=DateToJulian(19960101)
print(x) ; print(JulianToDate(x))
Most frequently occurring value among arguments
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(SetMajority(1, 3, 3, 4, 4, 5)) # prints 3
Returns the largest of argument values
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(SetMax(1, 3, 3, 4, 4, 5)) # prints 5
Returns average of argument values
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(SetMean(1, 3, 5)) # prints 3
Returns the median of argument values
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(SetMean(1, 3, 7)) # prints 3
Returns minimum value among arguments
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(SetMean(1, 3, 5)) # prints 1
Least frequently occurring value among arguments
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(SetMinority(1, 3, 3, 4, 4, 5)) # prints 1
Returns the total number of elements
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(SetNum(2, 1, 3, 4, 99)) # returns 5
Returns standard deviation of argument values
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(SetSD(2, 1, 3, 4, 99))
Returns sum of arguments
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(SetSum(2, 1, 3, 4, 99)) # prints 109
Returns statistical variance of argument values
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(SetVariance(2, 1, 3, 4, 99))
Returns number of different values among arguments
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print(SetVariety(2, 1, 3, 4, 99))
Convert an angle in degress to an angle in degress, minutes, seconds format.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear();
print(DegToStr(94.345));
Returns file extension portion of path qualified filename
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of FileNameGetExt()
Returns filename portion of path qualified filename
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of FileNameGetName()
Returns path portion of path qualified filename
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of FileNameGetPath()
Get the nth token from a string
Where:
Parameters:
Details:
Returns:
Create Date: 25-Sep-1998
Modify Date: 05-Jun-2001
Available in SML for Windows: Yes
Example:
# Example of GetToken()
clear();
str$ = "a b c,d";
delimit$ = " ,";
n = NumberTokens(str$, delimit$);
for i = 1 to n {
token$ = GetToken(str$, delimit$, i);
print(i, token$);
}
Return leftmost n characters of string
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print("Enter a sentence.") ; a$=input$()
print("Enter # of chars to get.")) ; n=input()
print(left$(a$, n))
Return n characters of string$ starting at m
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print("Enter a sentence.") ; a$=input$()
print("Enter start position.")) ; m=input()
print("Enter # of chars to get.")) ; n=input()
print(mid$, m, n))
Returns number of tokens in a string
Where:
Parameters:
Details:
Returns:
Create Date: 25-Sep-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of NumberTokens()
clear();
str$ = "a b c,d";
delimit$ = " ,";
n = NumberTokens(str$, delimit$);
for i = 1 to n {
token$ = GetToken(str$, delimit$, i);
print(i, token$);
}
Convert a number to a string
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of NumToStr()
Return right-most n characters of string$
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
a$="Reenter this sentence."
print(a$) ; b$=input$()
print("Enter n.")
n=input()
print(right$(a$, n))
print(right$(b$, n))
Assign formatted text to a string variable
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
format$="%s%d%s\n%s"
str1$="This is line " ; str2$="you see."
str3$="This is line 2" ; number=1
s4$=sprintf(format$, str1$, 1, str2$, str3$)
print(s4$)
Returns number of characters in string variable
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print("Enter a string. ") ; a$=input$()
print(strlen(a$))
Return numerical value of string with number in it
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
print("Enter a string. ") ; a$=input$()
b=StrToNum(a$) ; print(b/10)
Convert string to lower case
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of tolower$()
Convert string to upper case
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of toupper$()
Get database table information
Where:
Parameters:
Details:
Returns:
Create Date: 29-May-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of DatabaseGetTableInfo()
Returns a field class.
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of FieldGetInfoByName()
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of FieldGetInfoByNumber()
Returns number of records in database table
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
GetInputVector(V)
# assume you know the table name, here we used the
# Crow Butte Soils Vector object. Note that 'YIELD'
# is the correct field name,not 'yield'.
n=NumRecords(V.poly.YIELD)
print("Record count:", n)
Open the database subobject of a CAD object
Where:
Parameters:
Details:
Returns:
Create Date: 20-Jun-2000
Modify Date: none
Available in SML for Windows: Yes
Example:
XXX
Open a main level database
Where:
Parameters:
Details:
Returns:
Create Date: 11-Sep-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of OpenDatabase()
Returns a database class for functions that need one.
Where:
Parameters:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of OpenRasterDatabase()
Open the database subobject of a TIN object
Where:
Parameters:
Details:
Returns:
Create Date: 20-Jun-2000
Modify Date: none
Available in SML for Windows: Yes
Returns a database class for functions that need one.
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of OpenVectorLineDatabase()
Open a Vector point database
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of OpenVectorPointDatabase()
Returns a database class for functions that need one.
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of OpenVectorPolyDatabase()
Delete one or more records.
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of RecordDelete()
Append a field to a table
Where:
Parameters:
Details:
Returns:
Create Date: 08-Jun-2001
Modify Date: none
Available in SML for Windows: Yes
Add a new field of type float but inserts it before field "before".
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableAddFieldFloat()
Add a new field of type integer but inserts it before field "before".
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableAddFieldInteger()
Add a new field of type string.
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableAddFieldString()
Copy a database table to a DBASE file
Where:
Parameters:
Details:
Returns:
Create Date: 11-Sep-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableCopyToDBASE()
Creates an empty table. Use TableAddField???() functions to add fields to it.
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableCreate()
returns 1 if table exists, -1 if table doesn't exist
Where:
Parameters:
Details:
Returns:
Create Date: 27-Nov-2000
Modify Date: none
Available in SML for Windows: Yes
Example:
XXX
Returns a table class.
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableGetInfo() # (Assume Vect is a vector object) class DBTABLEINFO table; table = TableGetInvo(Vect.poly.YIELD); # Another example: tablename$ = "YIELD"; table = TableGetInfo(Vect.poly.(tablename$));
Add a new field of type float but inserts it before field "before".
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableInsertFieldFloat()
Add a new field of type integer but inserts it before field "before".
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableInsertFieldInteger()
Add a new field of type string but inserts it before field "before".
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableInsertFieldString()
Find the first record in a table that matches a given key
Where:
Parameters:
Details:
Returns:
Create Date: 13-Jul-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableKeyFieldLookup()
Makes a link to a dBase file.
Where:
Parameters:
Details:
Returns:
Create Date: 06-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableLinkDBASE()
Add new record to a database
Where:
Parameters:
Details:
Returns:
Create Date: 29-May-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableNewRecord()
Open a database table
Where:
Parameters:
Details:
Returns:
Create Date: 26-May-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableOpen()
Returns records that are attached to or related to a given element in a object
Where:
Parameters:
Details:
Returns:
Create Date: 14-Nov-2000
Modify Date: none
Available in SML for Windows: Yes
Example:
XXX
Read a number from a table (using DBTABLEINFO)
Where:
Parameters:
Details:
Returns:
Create Date: 12-Jun-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableReadFieldNum()
Read a string from a table (using DBTABLEINFO)
Where:
Parameters:
Details:
Returns:
Create Date: 12-Jun-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableReadFieldStr()
Attaches records in a table to an element in a object
Where:
Parameters:
Details:
Returns:
Create Date: 14-Nov-2000
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example: # Have the user select a vector object. # attach records 5 and 7 to polygon number 12. VECTOR Vect; class DBTABLEINFO table; array records[2]; GetInputVector(Vect); table = TableGetInfo(Vect.poly.YIELD); records[1] = 5; records[2] = 7; TableWriteAttachment(table, 12, records, 2, "polygon");
Write values to an existing database record
Where:
Parameters:
Details:
Returns:
Create Date: 15-Jun-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TableWriteRecord()
Use a File/Object selection dialog to select an input Raster
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
lines=488 ; columns=361 # Crow Butte TM raster dimensions
type$="8-bit unsigned"
# allow only specific raster size and type
GetInputRaster(R, lines, columns, type$) ; CloseRaster(R)
# allow any size, but only a specific type
GetInputRaster(R, 0, 0, type$) ; CloseRaster(R)
Get more than one raster.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of GetInputRasters()
Use a File/Object selection dialog to select an output Raster
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
GetInputRaster(R)
lines=NumLins(R) ; columns=NumCols(R) ; type$=RastType(R)
# allow selection or creation of a raster identical
# in size and type to R.
GetOutputRaster(R2, lines, columns, type$)
CloseRaster(R) ; CloseRaster(R2)
Determine if a Raster exists. Made obsolete by ObjectExists()
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of RasterExists()
Popup dialog to select an object
Where:
Parameters:
Details:
Returns:
Create Date: 18-Nov-1998
Modify Date: 17-May-2000
Available in SML for Windows: Yes
Example:
# Example of SelectInputObject()
Close a Vector object.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# example of CloseVector()
GetInputVector(V);
# do something with V
CloseVector(V);
Create a temporary Vector object.
Where:
Parameters:
Details:
Returns:
Create Date: 10-Apr-1998
Modify Date: 19-May-1998
Available in SML for Windows: Yes
Example:
# Example of CreateTempVector()
CreateTempVector(VTemp)
# do something with it
CloseVector(VTemp)
Create a Vector without using a dialog using same flags as GetOutputVector().
Where:
Parameters:
Details:
Returns:
Create Date: 07-May-1998
Modify Date: 19-May-1998
Available in SML for Windows: Yes
Example:
# Example of CreateVector()
CreateVector(Vpoly, "c:/tnt/win32/createV.rvc", "Vpoly", "Polygonal", "Polygonal")
CreateVector(Vplanar, "c:/tnt/win32/createV.rvc", "Vplanar", "Planar", "Planar")
CreateVector(Vnetwork, "c:/tnt/win32/createV.rvc", "Vnetwork", "Network", "Network")
CreateVector(Vnotopo, "c:/tnt/win32/createV.rvc", "Vnotopo", "NoTopology", "NoTopology")
Find closest Vector label.
Where:
Parameters:
Details:
Returns:
Create Date: 22-Jun-1981
Modify Date: 24-Jun-1999
Available in SML for Windows: Yes
Example:
# example of FindClosestLabel()
GetOutputVector(VIn, 1)
georef = GetGeorefObject(VIn)
numberLabels = NumVectorLabels(VIn)
label = FindClosestLabel(VIn, 150000, 335000, georef, 1000000)
VectorDeleteLabel(Vin, label)
print("number, closest", numberLabels, label)
Return line element closest to x,y coordinates
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: 24-Jun-1999
Available in SML for Windows: Yes
Example:
clear()
GetInputVector(Vvar)
georef = GetGeorefObject(Vvar)
print("Enter x.") ; x = input()
print("Enter y.") ; y = input()
print("Enter maxDistance.") ; maxDistance = input()
num = FindClosestLine(Vvar, x, y, georef, maxDistance)
print(num)
Return node element closest to x,y coordinates
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: 24-Jun-1999
Available in SML for Windows: Yes
Example:
clear()
GetInputVector(Vvar)
georef = GetGeorefObject(Vvar)
print("Enter x.") ; x = input()
print("Enter y.") ; y = input()
print("Enter maxDistance.") ; maxDistance = input()
num=FindClosestNode(Vvar, x, y, georef, maxDistance)
print(num)
Return point element closest to x,y coordinates
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: 24-Jun-1999
Available in SML for Windows: Yes
Example:
clear()
GetInputVector(Vvar)
georef = GetGeorefObject(Vvar)
print("Enter x.") ; x = input()
print("Enter y.") ; y = input()
print("Enter maxDistance.") ; maxDistance = input()
num = FindClosestPoint(Vvar, x, y, georef, maxDistance)
print(num)
Return polygon element closest to x,y coordinates
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: 24-Jun-1999
Available in SML for Windows: Yes
Example:
clear()
GetInputVector(Vvar)
georef = GetGeorefObject(Vvar)
print("Enter x.") ; x = input()
print("Enter y.") ; y = input()
print("Enter maxDistance.") ; maxDistance = input()
num=FindClosestPoly(Vvar, x, y, georef, maxDistance)
print(num)
Use a File/Object selection dialog to select an input Vector
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
GetInputVector(Vvar)
# do something with it
Get multiple Vector objects.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of GetInputVectorList()
Open a vector object for use with vector toolkit funtions
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
array xPoints[10], yPoints[10]
clear()
# for multiple flags simply comma seperate them as below
GetOutputVector(V, "VectorToolkit", "NoQtree,NoDBStatTable")
# draw some boxes - this will create polygons
# all closed lines are converted to polygons
xPoints[1] = 0
yPoints[1] = 0
xPoints[2] = 100
yPoints[2] = 0
xPoints[3] = 100
yPoints[3] = 100
xPoints[4] = 0
yPoints[4] = 100
xPoints[5] = 0
yPoints[5] = 0
VectorAddLine(V, 5, xPoints, yPoints)
# now add some points
for i = 1 to 4 {
VectorAddPoint(V, xPoints[i] + 150, yPoints[i] + 150)
}
numPolys = NumVectorPolys(V)
numberPoints = NumVectorPoints(V)
print("number of polygons, points: ", numPolys, numberPoints)
Returns (via arrays xArray and yArray, and optional zArray) a list of points in a line.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
array xArray[10], yArray[10], zArray[10] # will be resized automatically
GetInputVector(Vvar)
numLines = NumVectorLines(Vvar)
nPoints = GetVectorLinePointList(Vvar, xArray, yArray, 1, zArray)
for i = 1 to nPoints {
print(xArray[i], yArray[i], zArray[i])
}
Returns (via array linesArray) a list of lines attached to node.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
array linelist[10] # will be resized automatically
GetVectorNodeLineList(Vvar, linelist, 1)
Returns list of all polygons that share a common line with a given polygon in a vector object
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# reads the poly list of all adjacent polygons to a given polygon
# it only returns polygons that have common lines !!!
# not a single common node
array polygonList[10] # array to hold poly list
clear()
GetInputVector(V)
polygonNumber = 150 # polygonNumber = 150 works for cb_soils/CBSOILS_Lite
numadjacent = GetVectorPolyAdjacentPolyList(V, polygonList, polygonNumber)
temp$ = "number of polygons adjacent to polygon:"
print(temp$, polygonNumber, " = ", numadjacent)
for i = 1 to numadjacent {
print(i, ":", polygonList[i])
}
print("Done")
Returns (via array islandsArray) a list of islands of a polygon.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
array islandlist[10] # will be resized automatically
GetVectorPolyIslandList(Vvar, islandlist, 1)
Returns (via array linesArray) a list of lines forming a polygon
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
array linelist[10] # will be resized automatically
GetVectorPolyLineList(Vvar, linelist, 1)
Returns number of labels in a vector object
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
GetInputVector(Vin)
numLabels = NumVectorLabels(Vin)
print("number of labels: ", numLabels)
Returns number of lines in vector object
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
GetInputVector(V)
n=NumVectorLines(V)
print("Line count: ", n)
Returns number of nodes in vector object
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
GetInputVector(V)
n=NumVectorNodes(V)
print("Node count: ", n)
Returns number of points in vector object
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
GetInputVector(V)
n=NumVectorPoints(V)
print("Point count: ", n)
Returns number of polygons in vector object
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
GetInputVector(V)
n=NumVectorPolys(V)
print("Polygon count: ", n)
Open multiple Vector objects
Where:
Parameters:
Details:
Returns:
Create Date: 19-May-1998
Modify Date: 19-May-1998
Available in SML for Windows: Yes
Example:
# Example of OpenInputVectorList()
Open a Vector without using a dialog using same flags as GetOutputVector().
Where:
Parameters:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of OpenVector()
fileName$ = "c:/tnt/win32/vcBound/bound/Create.rvc"
objectName$ = "VCreate"
OpenVector(VOut, fileName$, objectName$, "VectorToolkit")
Merge two or more Vector objects
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of VectMerge()
Returns Vector that is the logical result of two input vectors
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
See example for VectorOR()
Tests a Vector element against a region.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# example of VectorElementInRegion()
clear()
GetInputVector(VIn)
GetInputRegion(Region1)
elementNumber = 1
inRegion = VectorElementInRegion(Region1, VIn, elementNumber, "line", "CompletelyInside")
if (inRegion)
print( "element ", elem, "is CompletelyInside\n")
Determines if vector object exists in project file. Made obsolete by ObjectExists()
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
file$="d:/sf_data/haywsoil" ; ob$="hsoils"
if (VectorExists(file$, ob$)) then
print("Vector ", ob$, "Exists in ", file$)
Returns Vector that is the result of the operator applied to the source
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# get the input vectors
GetInputVector(Voperator)
GetInputVector(Vsource)
# get the output vector
GetOutputVector(Vout1)
# use default flags
Vout1 = VectorExtract(Voperator, Vsource, "PartInside")
GetOutputVector(Vout2)
operation$ = "CompInside"
flags$ = "TableRemoveDupRec,RemExRecords"
# using optional flags (example showing two flags)
Vout2 = VectorExtract(Voperator, Vout1, operation$, flag$)
Returns Vector that is the logical result of two input vectors
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Returns Vector that is the logical result of two input vectors
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
See sample for VectorOR()
Returns Vector that is the logical result of two input vectors
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
See example for VectorOR()
Initialize an open Vector object for use with vector toolkit functions.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of VectorToolkitInit()
Returns Vector that is the logical result of two input vectors
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
See example for VectorOR()
Close an open style object
Where:
Parameters:
Details:
Returns:
Create Date: 07-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of CloseStyleObject()
Copy object and all of its subobjects.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
srcfile$="/data/standard/cb_tm.rvc"
destfile$="/data/standard/temp.rvc"
CopyObject(srcfile$, 1, destfile$, 1)
same as CopyObject() except no subobjects are copied.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
srcfile$="/data/standard/cb_tm.rvc"
destfile$="/data/standard/temp.rvc"
CopyObject(srcfile$, 1, destfile$, 1)
Create a project file
Where:
Parameters:
Details:
Returns:
Create Date: 02-Sep-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of CreateProjectFile()
CreateProjectFile("c:/ProjName.rvc", "Project file created in SML");
Deletes an object, (and all subobjects), by object number
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
fileName$="/data/standard/cb_tm.rvc"
DeleteObject(fileName$, 1)
Determines if object exists in project file
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
array objnums[10];
max = GetAllObjectNumbers("c:/tnt/benchmarks/benchmrk.sml",objnums,"Raster");
print(max);
for x=1 to max {
print (objnums[x]);
}
Gets the description of an object by object number
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
fileName$="/data/standard/cb_tm.rvc"
GetObjectDescription(fileName$, 1)
Returns the x and y extents for a CAD, TIN, vector, or raster object
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
# vector object
GetInputVector(V)
GetObjectExtents(V, xMin, yMin, xMax, yMax)
print("vector extents xMin, yMin, xMax, yMax")
printf("%10.2f %10.2f %10.2f %10.2f \n", xMin, yMin, xMax, yMax)
vGeoref = GetLastUsedGeorefObject(V)
GetObjectExtents(V, xMin, yMin, xMax, yMax, vGeoref)
print("vector extents xMin, yMin, xMax, yMax")
printf("%10.2f %10.2f %10.2f %10.2f \n", xMin, yMin, xMax, yMax)
Get the extents of an object as a region
Where:
Parameters:
Details:
Returns:
Create Date: 16-Feb-2000
Modify Date: none
Available in SML for Windows: Yes
Returns the path qualified RVC file name for an object.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
GetInputRaster(Rin)
# get the RVC file name
str$ = GetObjectFileName(Rin)
objNum = GetObjectNumber(Rin)
print("Raster Object Number: ", objNum, "RVC file Name: ", str$)
GetInputVector(Vin)
# get the RVC file name
str$ = GetObjectFileName(Vin)
objNum = GetObjectNumber(Vin)
print("Vector Object Number: ", objNum, "RVC file Name: ", str$)
GetInputTIN(Tin)
# get the RVC file name
str$ = GetObjectFileName(Tin)
objNum = GetObjectNumber(Tin)
print("TIN Object Number: ", objNum, "RVC file Name: ", str$)
Gets the name of an object by object number
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
fileName$="/data/standard/cb_tm.rvc"
GetObjectName(fileName$, 1)
Returns the object number for a Raster, Vector, TIN, or CAD object
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
GetInputRaster(Rin)
# get the RVC file name
str$ = GetObjectFileName(Rin)
objNum = GetObjectNumber(Rin)
print("Raster Object Number: ", objNum, "RVC file Name: ", str$)
GetInputVector(Vin)
# get the RVC file name
str$ = GetObjectFileName(Vin)
objNum = GetObjectNumber(Vin)
print("Vector Object Number: ", objNum, "RVC file Name: ", str$)
GetInputTIN(Tin)
# get the RVC file name
str$ = GetObjectFileName(Tin)
objNum = GetObjectNumber(Tin)
print("Tin Object Number: ", objNum, "RVC file Name: ", str$)
Get the number of bytes in an object
Where:
Parameters:
Details:
Returns:
Create Date: 18-Dec-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of GetObjectSize()
Returns the z extents for a CAD, TIN, or vector object
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
# vector object
GetInputVector(V)
GetObjectZExtents(V, zMin, zMax)
print("vector z extents - zMin, zMax")
printf("%10.2f %10.2f \n", zMin, zMax)
Creates a folder in an RVC project.
Where:
Parameters:
Details:
Returns:
Create Date: 20-Jul-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
MakeRVCFolder("c:/tnt/testdata.rvc","NickFolder","A folder for Nick","Users");
Determines if object exists in project file
Where:
Parameters:
Details:
Returns:
Create Date: 24-Jun-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
clear()
file$="d:/sf_data/haywsoil" ; ob$="hsoils"
if (ObjectExists(file$, ob$)) then
print("Object ", ob$, "Exists in ", file$)
Returns an object number used by several object and display functions
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
fileName$="/data/standard/cb_tm.rvc"
obname$="TM_2"
objectNumberber=ObjectNumber(fileName$, obname$, "raster")
GetObjectDescription(fileName$, objectNumberber)
Open a style object
Where:
Parameters:
Details:
Returns:
Create Date: 07-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of OpenStyleObject()
Open a style subobject
Where:
Parameters:
Details:
Returns:
Create Date: 07-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of OpenStyleSubObject()
Reads an objects metadata as a string
Where:
Parameters:
Details:
Returns:
Create Date: 05-Jan-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ReadMetaData()
Changes the description of an object
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
fileName$="/data/standard/cb_tm.rvc"
obname$="TM_2"
objectNumberber=ObjectNumber(fileName$, obname$, "raster")
SetObjectDescription(fileName$, objectNumberber, "TM Band 2")
Returns an object number used by several object and display functions
(similar to ObjectNumber() but looks under "parent" object for valid subobject)
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
fileName$="/data/standard/cb_tm.rvc"
obname$="TM_2"
objectNumberber=ObjectNumber(fileName$, obname$, "raster")
subobjectNumber=SubObjectNumber(fileName$, objectNumberber, \
"histogram1","HISTO")
DeleteObject(fileName$, subobjectNumber) # delete histogram
Writes metadata to an object
Where:
Parameters:
Details:
Returns:
Create Date: 05-Jan-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of WriteMetaData()
Adds two matrices - (matrixOut = matrixLeft + matrixRight)
Where:
Parameters:
Details:
Returns:
Create Date: 20-Oct-1997
Modify Date: 08-Mar-1999
Available in SML for Windows: Yes
Example:
clear()
h1 = CreateMatrix(2, 2) # create three matrices
h2 = CreateMatrix(2, 2)
h3 = CreateMatrix(2, 2)
# fill the matrices with some values
for r = 0 to 1 {
for c = 0 to 1 {
SetMatrixItem(h1, r, c, r + c)
SetMatrixItem(h2, r, c, (r + c) * 2)
SetMatrixItem(h3, r, c, (r + c) * 3)
}
}
# now add h1 to h2, result is h3
AddMatrix(h3, h1, h2)
# print the resulting matrix h3
print("add h1 + h2")
for r = 0 to 1 {
for c = 0 to 1 {
a = GetMatrixItem(h3, r, c)
printf("%8.4f ", a)
}
print(" ")
}
# destroy the matrices
DestroyMatrix(h1)
DestroyMatrix(h2)
DestroyMatrix(h3)
Adds scalar to each element of a matrix
Where:
Parameters:
Details:
Returns:
Create Date: 20-Oct-1997
Modify Date: 08-Mar-1999
Available in SML for Windows: Yes
Example:
clear()
h1 = CreateMatrix(2, 2) # create a matrix
# fill the matrix with some values
for r = 0 to 1 {
for c = 0 to 1 {
SetMatrixItem(h1, r, c, r + c)
}
}
# print the matrix
print("original matrix")
for r = 0 to 1 {
for c = 0 to 1 {
a = GetMatrixItem(h1, r, c)
printf("%8.4f ", a)
}
print(" ")
}
AddMatrixScaler(h1, 100.0) # add 100.0 to each element
# print the resulting matrix
print("after adding 100.0 to each element")
for r = 0 to 1 {
for c = 0 to 1 {
a = GetMatrixItem(h1, r, c)
printf("%8.4f ", a)
}
print(" ")
}
# destroy the matrix
DestroyMatrix(h1)
Creates a matrix - returns a valid matrix handle
Where:
Parameters:
Details:
Returns:
Create Date: 20-Oct-1997
Modify Date: 08-Mar-1999
Available in SML for Windows: Yes
Example:
clear()
h1 = CreateMatrix(2, 2) # create a matrix
# fill the matrices with some values
for r = 0 to 1 {
for c = 0 to 1 {
SetMatrixItem(h1, r, c, r + c)
}
}
print("Printing the matrix:") # print the matrix
for r = 0 to 1 {
for c = 0 to 1 {
a = GetMatrixItem(h1, r, c)
printf("%8.4f ", a)
}
print(" ")
}
# destroy the matrix
DestroyMatrix(h1)
Destroys a previously created matrix
Where:
Parameters:
Details:
Returns:
Create Date: 20-Oct-1997
Modify Date: 08-Mar-1999
Available in SML for Windows: Yes
Example:
clear()
h1 = CreateMatrix(2, 2) # create a matrix
# fill the matrices with some values
for r = 0 to 1 {
for c = 0 to 1 {
SetMatrixItem(h1, r, c, r + c)
}
}
print("Printing the matrix:")
# print the matrix
for r = 0 to 1 {
for c = 0 to 1 {
a = GetMatrixItem(h1, r, c)
printf("%8.4f ", a)
}
print(" ")
}
# destroy the matrix
DestroyMatrix(h1)
Returns the number of columns in a matrix
Where:
Parameters:
Details:
Returns:
Create Date: 20-Oct-1997
Modify Date: 08-Mar-1999
Available in SML for Windows: Yes
Example:
#
# proc printMatrixToConsole(matHandle, formatStr$)
#
# procedure to print out a matrix to console - row major order
# parameters:
# matHandle a matrix handle
# format$ string to control output format
#
proc printMatrixToConsole(matHandle, formatStr$) {
# print the matrix handle
printf("%s%d\n", "Matrix: ", matHandle)
# get the size of the matrix
lastRow = GetMatrixRowSize(matHandle) - 1
lastCol = GetMatrixColSize(matHandle) - 1
for row = 0 to lastRow {
for col = 0 to lastCol {
printf(formatStr$, GetMatrixItem(matHandle, row, col))
}
print(" ")
}
print(" ") # print blank line after matrix output
} # end of proc printMatrix()
# start of code
clear()
h1 = CreateMatrix(2, 2) # create a matrix
# fill the matrix with some values
for r = 0 to 1 {
for c = 0 to 1 {
SetMatrixItem(h1, r, c, r + c)
}
}
# call procedure printMatrixToConsole()
printMatrixToConsole(h1, "%8.4f ")
# destroy the matrix
DestroyMatrix(h1)
Returns value of matrix element
Where:
Parameters:
Details:
Returns:
Create Date: 20-Oct-1997
Modify Date: 08-Mar-1999
Available in SML for Windows: Yes
Example:
#
# proc printMatrixToConsole(matHandle, formatStr$)
#
# procedure to print out a matrix to console - row major order
# parameters:
# matHandle a matrix handle
# format$ string to control output format
#
proc printMatrixToConsole(matHandle, formatStr$) {
# print the matrix handle
printf("%s%d\n", "Matrix: ", matHandle)
# get the size of the matrix
lastRow = GetMatrixRowSize(matHandle) - 1
lastCol = GetMatrixColSize(matHandle) - 1
for row = 0 to lastRow {
for col = 0 to lastCol {
printf(formatStr$, GetMatrixItem(matHandle, row, col))
}
print(" ")
}
print(" ") # print blank line after matrix output
} # end of proc printMatrix()
# start of code
clear()
h1 = CreateMatrix(2, 2) # create a matrix
# fill the matrix with some values
for r = 0 to 1 {
for c = 0 to 1 {
SetMatrixItem(h1, r, c, r + c)
}
}
# call procedure printMatrixToConsole()
printMatrixToConsole(h1, "%8.4f ")
# destroy the matrices
DestroyMatrix(h1)
Returns the number of rows in a matrix
Where:
Parameters:
Details:
Returns:
Create Date: 20-Oct-1997
Modify Date: 08-Mar-1999
Available in SML for Windows: Yes
Example:
#
# proc printMatrixToConsole(matHandle, formatStr$)
#
# procedure to print out a matrix to console - row major order
# parameters:
# matHandle a matrix handle
# format$ string to control output format
#
proc printMatrixToConsole(matHandle, formatStr$) {
# print the matrix handle
printf("%s%d\n", "Matrix: ", matHandle)
# get the size of the matrix
lastRow = GetMatrixRowSize(matHandle) - 1
lastCol = GetMatrixColSize(matHandle) - 1
for row = 0 to lastRow {
for col = 0 to lastCol {
printf(formatStr$, GetMatrixItem(matHandle, row, col))
}
print(" ")
}
printf(" ") # print blank line after matrix output
} # end of proc printMatrix()
# start of code
clear()
h1 = CreateMatrix(2, 2) # create a matrix
# fill the matrix with some values
for r = 0 to 1 {
for c = 0 to 1 {
SetMatrixItem(h1, r, c, r + c)
}
}
# call procedure printMatrixToConsole()
printMatrixToConsole(h1, "%8.4f ")
# destroy the matrices
DestroyMatrix(h1)
Inverts a matrix
Where:
Parameters:
Details:
Returns:
Create Date: 20-Oct-1997
Modify Date: 08-Mar-1999
Available in SML for Windows: Yes
Example:
#
# proc printMatrixToConsole(matHandle, formatStr$)
#
# procedure to print out a matrix to console - row major order
# parameters:
# matHandle a matrix handle
# format$ string to control output format
#
proc printMatrixToConsole(matHandle, formatStr$) {
# print the matrix handle
printf("%s%d\n", "Matrix: ", matHandle)
# get the size of the matrix
lastRow = GetMatrixRowSize(matHandle) - 1
lastCol = GetMatrixColSize(matHandle) - 1
for row = 0 to lastRow {
for col = 0 to lastCol {
printf(formatStr$, GetMatrixItem(matHandle, row, col))
}
print(" ")
}
print(" ") # print blank line after matrix output
} # end of proc printMatrix()
# start of program
clear()
h1 = CreateMatrix(2, 2) # create three matrices
h2 = CreateMatrix(2, 2)
h3 = CreateMatrix(2, 2)
# fill the matrices values known to produce matrix
# with an inverse
SetMatrixItem(h1, 0, 0, 1.0)
SetMatrixItem(h1, 0, 1, 2.0)
SetMatrixItem(h1, 1, 0, 3.0)
SetMatrixItem(h1, 1, 1, 4.0)
# print the resulting matrix
print("matrix before inverse")
printMatrixToConsole(h1, "%8.4f ")
# now calculate the inverse of h1
InvertMatrix(h2, h1)
# print the inverse matrix
# result should be | -2.0 1.0 |
# | 1.5 -.5 |
print("matrix after inverse")
printMatrixToConsole(h2, "%8.4f ")
# now multiply matrix 1 by it's inverse
# result matrix h3 should be identity matrix
MultiplyMatrix(h3, h1, h2)
print("matrix times its inverse")
printMatrixToConsole(h3, "%8.4f ")
# destroy the matrices
DestroyMatrix(h1)
DestroyMatrix(h2)
DestroyMatrix(h3)
Multiplies two matrices - (matrixOut = matrixLeft * matrixRight)
Where:
Parameters:
Details:
Returns:
Create Date: 20-Oct-1997
Modify Date: 08-Mar-1999
Available in SML for Windows: Yes
Example:
#
# proc printMatrixToConsole(matHandle, formatStr$)
#
# procedure to print out a matrix to console - row major order
# parameters:
# matHandle a matrix handle
# format$ string to control output format
#
proc printMatrixToConsole(matHandle, formatStr$) {
# print the matrix handle
printf("%s%d\n", "Matrix: ", matHandle)
# get the size of the matrix
lastRow = GetMatrixRowSize(matHandle) - 1
lastCol = GetMatrixColSize(matHandle) - 1
for row = 0 to lastRow {
for col = 0 to lastCol {
printf(formatStr$, \
GetMatrixItem(matHandle, row, col))
}
print(" ")
}
print(" ") # print blank line after matrix output
} # end of proc printMatrix()
# start of program
clear()
h1 = CreateMatrix(2, 2) # create three matrices
h2 = CreateMatrix(2, 2)
h3 = CreateMatrix(2, 2)
# create a matrix to test
# result should be | 1 2 |
# | 3 4 |
SetMatrixItem(h1, 0, 0, 1.0)
SetMatrixItem(h1, 0, 1, 2.0)
SetMatrixItem(h1, 1, 0, 3.0)
SetMatrixItem(h1, 1, 1, 4.0)
# print the resulting matrix
print("Original matrix:")
printMatrixToConsole(h1, "%8.4f ")
# create an identity matrix
# result should be | 1 0 |
# | 0 1 |
SetMatrixItem(h2, 0, 0, 1.0)
SetMatrixItem(h2, 0, 1, 0.0)
SetMatrixItem(h2, 1, 0, 0.0)
SetMatrixItem(h2, 1, 1, 1.0)
# print the resulting matrix
print("Identity matrix:")
printMatrixToConsole(h2, "%8.4f ")
# now multiply h1 by the h2 (identity matrix)
# result in h3
MultiplyMatrix(h3, h2, h1)
# print the result - should be same as original
print("Matrix after multiplication by identity:")
printMatrixToConsole(h3, "%8.4f ")
# destroy the matrices
DestroyMatrix(h1)
DestroyMatrix(h2)
DestroyMatrix(h3)
Multiplies each element of a matrix by a scaler
Where:
Parameters:
Details:
Returns:
Create Date: 20-Oct-1997
Modify Date: 08-Mar-1999
Available in SML for Windows: Yes
Example:
clear()
h1 = CreateMatrix(2, 2) # create a matrix
# fill the matrix with some values
for r = 0 to 1 {
for c = 0 to 1 {
SetMatrixItem(h1, r, c, r + c)
}
}
# print the matrix
print("original matrix")
for r = 0 to 1 {
for c = 0 to 1 {
a = GetMatrixItem(h1, r, c)
printf("%8.4f ", a)
}
print(" ")
}
# multiply each element by 100.0
MultiplyMatrixScaler(h1, 100.0)
# print the resulting matrix
print("After multiplying each element by 100.0")
for r = 0 to 1 {
for c = 0 to 1 {
a = GetMatrixItem(h1, r, c)
printf("%8.4f ", a)
}
print(" ")
}
# destroy the matrix
DestroyMatrix(h1)
Sets the element of a matrix to a value.
Where:
Parameters:
Details:
Returns:
Create Date: 20-Oct-1997
Modify Date: 08-Mar-1999
Available in SML for Windows: Yes
Example:
clear()
h1 = CreateMatrix(2, 2) # create a matrix
# fill the matrix with some values
for r = 0 to 1 {
for c = 0 to 1 {
SetMatrixItem(h1, r, c, r + c)
}
}
# print the matrix
print("The matrix:")
for r = 0 to 1 {
for c = 0 to 1 {
a = GetMatrixItem(h1, r, c)
printf("%8.4f ", a)
}
print(" ")
}
# destroy the matrix
DestroyMatrix(h1)
Subtracts two matrices - (matrixOut = matrixLeft - matrixRight)
Where:
Parameters:
Details:
Returns:
Create Date: 20-Oct-1997
Modify Date: 08-Mar-1999
Available in SML for Windows: Yes
Example:
clear()
h1 = CreateMatrix(2, 2) # create three matrices
h2 = CreateMatrix(2, 2)
h3 = CreateMatrix(2, 2)
# fill the matrices with some values
for r = 0 to 1 {
for c = 0 to 1 {
SetMatrixItem(h1, r, c, r + c)
SetMatrixItem(h2, r, c, (r + c) * 2)
SetMatrixItem(h3, r, c, (r + c) * 3)
}
}
# now subtract h2 from h1, result is h3
SubMatrix(h3, h1, h2)
print("Subtract h2 from h1")
# print the resulting matrix h3
for r = 0 to 1 {
for c = 0 to 1 {
a = GetMatrixItem(h3, r, c)
printf("%8.4f ", a)
}
print(" ")
}
# destroy the matrices
DestroyMatrix(h1)
DestroyMatrix(h2)
DestroyMatrix(h3)
Transposes rows and columns of a matrix
Where:
Parameters:
Details:
Returns:
Create Date: 20-Oct-1997
Modify Date: 08-Mar-1999
Available in SML for Windows: Yes
Example:
#
# proc printMatrixToConsole (matHandle, formatStr$)
#
# procedure to print out a matrix to console - row
# major order
# parameters:
# matHandle a matrix handle
# format$ string to control output format
#
proc printMatrixToConsole(matHandle, formatStr$) {
# print the matrix handle
printf("%s%d\n", "Matrix: ", matHandle)
# get the size of the matrix
lastRow = GetMatrixRowSize(matHandle) - 1
lastCol = GetMatrixColSize(matHandle) - 1
for row = 0 to lastRow {
for col = 0 to lastCol {
printf(formatStr$, \
GetMatrixItem(matHandle, row, col))
}
print(" ")
}
print( " " ) # print blank line after matrix output
} # end of proc printMatrix()
# start of program
clear()
h1 = CreateMatrix(2, 2) # create two matrices
h2 = CreateMatrix(2, 2)
# fill the matrix with some values
SetMatrixItem(h1, 0, 0, 1.0)
SetMatrixItem(h1, 0, 1, 2.0)
SetMatrixItem(h1, 1, 0, 3.0)
SetMatrixItem(h1, 1, 1, 4.0)
# print the resulting matrix
# result should be | 1 2 |
# | 3 4 |
print("matrix before transpose")
printMatrixToConsole(h1, "%8.4f ")
# now calculate the transpose of h1
TransposeMatrix(h2, h1)
# print the inverse matrix
# result should be | 1 3 |
# | 2 4 |
print("matrix after transpose")
printMatrixToConsole(h2, "%8.4f ")
# destroy the matrices
DestroyMatrix(h1)
DestroyMatrix(h2)
Write a georeference subobject
Where:
Parameters:
Details:
Returns:
Create Date: 18-Jun-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of CopyGeorefToObject()
Creates a control point georeference object.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# SML script to demonstrate creation of georef object in SML
#
# 1. opens a raster - cb_tm/blue
# 2. creates a new vector object and draws a box
# 3. georeferences the vector so that it bounds the raster
#
# NOTES:
# 1. you must use a minimum of three control points
# 2. they must not be all on the same line!
#
#################################################################
# alternate method to get extents of object
#
# can use this in general - if last parm is omitted then
# returns object coordinates
#
# rgeoref = GetLastUsedGeorefObject(Rin)
# GetObjectExtents(Rin, rxMin, ryMin, rxMax, ryMax, rgeoref)
#
# now do same for vector except do not use georef parm
# this will give object coordinates
# GetObjectExtents(Vout, vxMin, vyMin, vxMax, vyMax)
#
#################################################################
# the source arrays will hold the object coordinates
# for a raster this would be cell values
# for vector, CAD, TIN it would be object, (non-georeferenced),
# coordinates
array xsrc[5], ysrc[5], zsrc[5]
# the destination arrays will hold the appropriate,
# (georeferenced), values
array xdest[5], ydest[5], zdest[5]
# arrays to hold vector points to draw box
array xpoints[10]
array ypoints[10]
# fill in the control points (source and destination)
# need a minimum of three
# we will assume a georeferenced raster and a non-georeferenced
# vector that we wish to georeference to the raster
clear()
# get the raster and vector
GetInputRaster(Rin)
# get number of lines and columns
numlines = NumLins(Rin)
numcols = NumCols(Rin)
# get the upper left (UL), lower right (LR)
# upper right (UR), and lower left (LL) coordinates
rgeoref = GetLastUsedGeorefObject(Rin)
ObjectToMap(Rin, 0, 0, rgeoref, xUL, yUL)
ObjectToMap(Rin, numcols, numlines, rgeoref, xLR, yLR)
ObjectToMap(Rin, numcols, 0, rgeoref, xUR, yUR)
ObjectToMap(Rin, 0, numlines, rgeoref, xLL, yLL)
printf("UL: %7.2f %7.2f\n", xUL, yUL)
printf("UR: %7.2f %7.2f\n", xUR, yUR)
printf("LL: %7.2f %7.2f\n", xLL, yLL)
printf("LR: %7.2f %7.2f\n", xLR, yLR)
# create a new vector here !!!!
# we will draw a box and match it to the raster
GetOutputVector(Vout, "VectorToolkit")
# draw the box - this will create a polygon
# fill in the points
xpoints[1] = 0
ypoints[1] = 0
xpoints[2] = 100
ypoints[2] = 0
xpoints[3] = 100
ypoints[3] = 100
xpoints[4] = 0
ypoints[4] = 100
xpoints[5] = 0
ypoints[5] = 0
VectorAddLine(Vout, 5, xpoints, ypoints)
# fill in four control points - one for each corner
# the source values are for the vector
# control point 1 - upper left corner
xsrc[1] = 0
ysrc[1] = 100
zsrc[1] = 0
xdest[1] = xUL
ydest[1] = yUL
zdest[1] = 0
# control point 2 - lower right corner
xsrc[2] = 100
ysrc[2] = 0
zsrc[2] = 0
xdest[2] = xLR
ydest[2] = yLR
zdest[2] = 0
# control point 3 - upper right corner
xsrc[3] = 100
ysrc[3] = 100
zsrc[3] = 0
xdest[3] = xUR
ydest[3] = yUR
zdest[3] = 0
# control point 3 - lower left corner
xsrc[4] = 0
ysrc[4] = 0
zsrc[4] = 0
xdest[4] = xLL
ydest[4] = yLL
zdest[4] = 0
# print out the control points
for i = 1 to 4 {
printf("%s %2d %7.2f %7.2f %7.2f ",
"i: xsrc, ysrc, zsrc, xdest, ydest, zdest ",
i, xsrc[i], ysrc[i], zsrc[i])
printf("%7.2f %7.2f %7.2f\n", xdest[i], ydest[i], zdest[i])
}
# set number of control points
numberPoints = 4
# now create the georef via dialog
CreateControlPointGeoref(Vout, numberPoints, xsrc, ysrc, zsrc,
xdest, ydest, zdest)
GeorefFree(rgeoref) # clean up
CloseRaster(Rin)
Same as CreateControlPointGeoref but without accuracy parameters
Where:
Parameters:
Details:
Returns:
Create Date: 16-May-2001
Modify Date: none
Available in SML for Windows: Yes
Creates a control point georeference object using an existing georeference for the projection system.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of CreateControlPointGeorefFromGeoref()
array xsrc[5], ysrc[5], zsrc[5]
array xdest[5], ydest[5], zdest[5]
clear()
# get the raster
GetInputRaster(RIn)
#create a new raster
CreateRaster(RNew, "c:/tnt/win32/newras.rvc", "newras", "description", 200, 200, "8-bit unsigned");
# duplicate the corrosponding values
for r = 1 to 200 {
for c = 1 to 200 {
RNew[r,c] = RIn[r,c];
}
}
# get number of lines and columns
numlines = NumLins(RIn)
numcols = NumCols(RIn)
# get the upper left (UL), lower right (LR)
# upper right (UR), and lower left (LL) coordinates
# of the portion of the raster we are going to duplicate
geoOrg = GetLastUsedGeorefObject(RIn)
ObjectToMap(RIn, 0, 0, geoOrg, xUL, yUL)
ObjectToMap(RIn, 200, 200, geoOrg, xLR, yLR)
ObjectToMap(RIn, 200, 0, geoOrg, xUR, yUR)
ObjectToMap(RIn, 0, 200, geoOrg, xLL, yLL)
printf("UL: %7.2f %7.2f\n", xUL, yUL)
printf("UR: %7.2f %7.2f\n", xUR, yUR)
printf("LL: %7.2f %7.2f\n", xLL, yLL)
printf("LR: %7.2f %7.2f\n", xLR, yLR)
# fill in four control points - one for each corner
# control point 1 - upper left corner
xsrc[1] = 0
ysrc[1] = 0
zsrc[1] = 0
xdest[1] = xUL
ydest[1] = yUL
zdest[1] = 0
# control point 2 - lower right corner
xsrc[2] = 200
ysrc[2] = 200
zsrc[2] = 0
xdest[2] = xLR
ydest[2] = yLR
zdest[2] = 0
# control point 3 - upper right corner
xsrc[3] = 200
ysrc[3] = 0
zsrc[3] = 0
xdest[3] = xUR
ydest[3] = yUR
zdest[3] = 0
# control point 3 - lower left corner
xsrc[4] = 0
ysrc[4] = 200
zsrc[4] = 0
xdest[4] = xLL
ydest[4] = yLL
zdest[4] = 0
# print out the control points
for i = 1 to 4 {
printf("%s %2d %7.2f %7.2f %7.2f ", "i: xsrc, ysrc, zsrc, xdest, ydest, zdest ", i, xsrc[i], ysrc[i], zsrc[i])
printf("%7.2f %7.2f %7.2f\n", xdest[i], ydest[i], zdest[i])
}
# set number of control points
numpoints = 4
# now create the georef without dialog
geoNew = CreateControlPointGeorefFromGeoref(RNew, geoOrg, numpoints, xsrc, ysrc, zsrc, xdest, ydest, zdest)
GeorefFree(geoOrg)
GeorefFree(geoNew)
CloseRaster(RIn);
CloseRaster(RNew);
Create an implied georeference subobject
Where:
Parameters:
Details:
Returns:
Create Date: 16-May-2000
Modify Date: none
Available in SML for Windows: Yes
Returns number of a new georeference subobject
Where:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
geonum1 = GeorefAlloc() ; geonum2 = GeorefAlloc()
print(geonum1, geonum2)
GeorefFree(geonum1) ; GeorefFree(geonum2)
Returns the angle between north and a line from center to x,y
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
GetInputRaster(R)
georef = GetGeorefObject(R)
print("Enter x value.") ; x = input()
print("Enter y value.") ; y = input()
angle = GeorefAngleToNorth(georef, x, y)
print("Angle between line connecting center of object ",
"to x,y and true north:",angle/deg)
CloseRaster(R)
Free georeference object with num as its ID
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
geonum = GeorefAlloc() ; print(geonum)
GeorefFree(geonum)
Open dialog for selecting georeference subobject
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
GetInputRaster(R) # get input raster
g = GetGeorefObject(R) # get georeference of object
# change parameters of that georeference and
# copy the results to a new ID
h = GeorefGetParms(g)
print(g, h)
GeorefFree(g) ; CloseRaster(R)
Set the projection of a Georef
Where:
Parameters:
Details:
Returns:
Create Date: 17-Jun-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of GeorefSetProjection()
Transform point to new georeferenced value
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
GetInputRaster(R)
g1 = GetGeorefObject(R)
print("Enter x1") ; input x1
print("Enter x2") ; input x2
g2 = GeorefGetParms()
GeorefTrans(g1, x1, y1, g2, x2, y2)
print("Original: ", x1, y1)
print("\nNew: ", x2, y2)
GeorefFree(g) ; CloseRaster(R)
Return ID number of named georeference subobject
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
GetInputRaster(R)
g=GetGeorefObject(R)
# get georeference, change projection
GeorefGetParms(g)
# Do something with the georef here
GeorefFree(g)
Return number of a most recently used georeference subobject
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
GetInputRaster(R)
g=GetLastUsedGeorefObject(R)
# get most recent georeference
# Translate top left corner of raster to
# map coordinates last used by R
ObjectToMap(R, 0, 0, g, s, y)
print("Top left corner is at\nLat: ", y, "\nlon: ", x)
GeorefFree(g) ; CloseRaster(R)
Transform georeferenced location from map coordinates to object coordinates
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
GetInputRaster(R)
g=GetGeorefObject(R)
print("Enter x1.") ; input(x1)
print("Enter y1.") ; input(y1)
MapToObject(g, x1, y1, R, x2, y2)
print("Map: ", x1, y1) ; print("/nObject: ", x2, y2)
GeorefFree(g) ; CloseRaster(R)
Transform object coordinates to georeferenced location
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
GetInputRaster(R)
g=GetGeorefObject(R)
print("Enter ox.") ; input(x1)
print("Enter oy.") ; input(y1)
ObjectToMap(g, x1, y1, R, x2, y2)
print("Object: ", ox,o y) ; print("/nMap: ", mx, my)
GeorefFree(g) ; CloseRaster(R)
Compute distance in meters between two points in specified projection. If the coordinate system is Latitude-Longitude the distance along a geodetic is returned (actual distance over curved surface).
Where:
Parameters:
Details:
Returns:
Create Date: 09-Jan-2001
Modify Date: none
Available in SML for Windows: Yes
Reads the control points of the last used georeference attached to an object
Where:
Parameters:
Details:
Returns:
Create Date: 07-Jul-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ReadControlPoints()
array xS[5], yS[5], zS[5], xD[5], yD[5], zD[5]
clear();
GetInputRaster(R);
numPoints = ReadControlPoints(R, xS, yS, zS, xD, yD, zD);
for i = 1 to numPoints {
print(xS[i], yS[i], zS[i], " - ", xD[i], yD[i], zD[i]);
}
Transform 2D point using transparm
Where:
Parameters:
Details:
Returns:
Create Date: 22-May-1998
Modify Date: 22-May-1998
Available in SML for Windows: Yes
Example:
# Example of TransPoint2D()
Write control points to the last used georeference attached to an object
Where:
Parameters:
Details:
Returns:
Create Date: 07-Jul-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of WriteControlPoints()
array xS[5], yS[5], zS[5], xD[5], yD[5], zD[5]
xS[1] = 0;
yS[1] = 0;
zS[1] = 0;
xD[1] = 333354;
yD[1] = 162833;
zD[1] = 0;
xS[2] = 361;
yS[2] = 488;
zS[2] = 0;
xD[2] = 343050;
yD[2] = 148559;
zD[2] = 0;
xS[3] = 0;
yS[3] = 488;
zS[3] = 0;
xD[3] = 332803;
yD[3] = 148958;
zD[3] = 0;
xS[4] = 361;
yS[4] = 0;
zS[4] = 0;
xD[4] = 343000;
yD[4] = 162000;
zD[4] = 0;
GetInputRaster(R);
WriteControlPoints(R, 4, xS, yS, zS, xD, yD, zD);
Read colormap from under raster.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of ColorMapFromRastVar()
Get a color from a colormap
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of ColorMapGetColor()
Set a colormap color given a class color structure.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of ColorMapSetColor()
Set a colormap color to given HIS values.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of ColorMapSetColorHIS()
Set a colormap color to given RGB values.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of ColorMapSetColorRGB()
Write a colormap under a raster.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of ColorMapWriteToRastVar()
Read a BITMAPPATTERN from a style object
Where:
Parameters:
Details:
Returns:
Create Date: 07-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of StyleReadBitmapPattern()
Read a LINEPATTERN from a style object
Where:
Parameters:
Details:
Returns:
Create Date: 07-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of StyleReadLinePattern()
Read a line style from a style object
Where:
Parameters:
Details:
Returns:
Create Date: 28-Sep-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of StyleReadLineStyle()
Read a point style from a style object
Where:
Parameters:
Details:
Returns:
Create Date: 28-Sep-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of StyleReadPointStyle()
Read a POINTSYMBOL from a style object
Where:
Parameters:
Details:
Returns:
Create Date: 07-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of StyleReadPointSymbol()
Read a polygon style from a style object
Where:
Parameters:
Details:
Returns:
Create Date: 28-Sep-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of StyleReadPolyStyle()
Read a text style from a style object
Where:
Parameters:
Details:
Returns:
Create Date: 28-Sep-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of StyleReadTextStyle()
Add a user defined callback
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of AddCallback()
Exit the script (calls functions registered with OnExit).
Where:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of Exit()
Register function to call just before script exits.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of OnExit()
Runs another command
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
run("something", 0) # run in background
Runs application associated with passed file
Where:
Parameters:
Details:
Returns:
Create Date: 18-Oct-2000
Modify Date: none
Available in SML for Windows: Yes
Example:
RunAssociatedApplication("c:/temp/sample.txt"); # Opens sample.txt with associated application
Pause execution for a number of seconds.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of sleep()
Suspend script but process callbacks and events.
Where:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of WaitForExit()
Convert Cyan-Magenta-Yellow-Black to Red-Green-Blue
Where:
Parameters:
Details:
Returns:
Create Date: 08-Jul-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ConvertCMYKtoRGB()
clear();
c = 100;
m = 100;
y = 100;
k = 101;
ConvertCMYKtoRGB(255, c, m, y, k, red, green, blue);
format$ = "%3d %3d %3d %3d - %3d %3d %3d"
printf(format$, c, m, y, k, red, green, blue);
Convert hue, brightness, saturation to red, green, blue
Where:
Parameters:
Details:
Returns:
Create Date: 13-Jul-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ConvertHBStoRGB()
h = 180;
b = 50;
s = 50;
ConvertHBStoRGB(h, s, v, r, g, b);
printf("hbs - rgb %3d %3d %3d - %3d %3d %3d\n", h, s, v, r, g, b);
Convert from hue, intensity, saturation to red, green, blue
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# rgbhis.sml
# convert between rgb and his
# each function also takes a maximum rgb value for proper scaling
# max for 8-bit unsigned = 255
# max for 16-bit unsigned = 65535
clear()
maxrgb = 255
for h = 1 to 360 step 179 {
for i = 1 to 100 step 49 {
for s = 1 to 100 step 49 {
ConvertHIStoRGB(maxrgb, h, i, s, r, g, b)
printf("%s: %6d %6d %6d %6d %6d %6d \n",
"his -> rgb", h, i, s, r, g, b)
}
}
}
for r = 1 to 255 step 100 {
for g = 1 to 255 step 100 {
for b = 1 to 255 step 100 {
ConvertRGBtoHIS(maxrgb, r, g, b, h, i, s)
printf("%s: %6d %6d %6d %6d %6d %6d \n",
"rgb -> his", r, g, b, h, i, s)
}
}
}
Convert hue, saturation, value to red, green, blue
Where:
Parameters:
Details:
Returns:
Create Date: 10-Jul-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ConvertHSVtoRGB()
h = 180;
s = 50;
v = 50;
ConvertHSVoRGB(h, s, v, r, g, b);
printf("hsv - rgb %3d %3d %3d - %3d %3d %3d\n", h, s, v, r, g, b);
Convert red, green, blue, to hue, brightness, saturation
Where:
Parameters:
Details:
Returns:
Create Date: 13-Jul-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ConvertRGBtoHBS()
r = 127;
g = 127;
b = 127;
ConvertRGBtoHBS(r, g, b, h, s, v)
printf("rgb - hbs %3d %3d %3d - %3d %3d %3d\n", r, g, b, h, s, v);
Convert from red, green, blue to hue, intensity, saturation
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# rgbhis.sml
# convert between rgb and his
# each function also takes a maximum rgb value for proper scaling
# max for 8-bit unsigned = 255
# max for 16-bit unsigned = 65535
clear()
maxrgb = 255
for h = 1 to 360 step 179 {
for i = 1 to 100 step 49 {
for s = 1 to 100 step 49 {
ConvertHIStoRGB(maxrgb, h, i, s, r, g, b)
printf("%s: %6d %6d %6d %6d %6d %6d \n",
"his -> rgb", h, i, s, r, g, b)
}
}
}
for r = 1 to 255 step 100 {
for g = 1 to 255 step 100 {
for b = 1 to 255 step 100 {
ConvertRGBtoHIS(maxrgb, r, g, b, h, i, s)
printf("%s: %6d %6d %6d %6d %6d %6d \n",
"rgb -> his", r, g, b, h, i, s)
}
}
}
Convert red, green, blue to hue, saturation, value
Where:
Parameters:
Details:
Returns:
Create Date: 10-Jul-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ConvertRGBtoHSV()
r = 127;
g = 127;
b = 127;
ConvertRGBtoHBS(r, g, b, h, s, v)
printf("rgb - hsv %3d %3d %3d - %3d %3d %3d\n", r, g, b, h, s, v);
Popup dialog to select an object and return info
Where:
Parameters:
Details:
Returns:
Create Date: 17-Jun-1998
Modify Date: none
Available in SML for Windows: Yes
Prompt the user for an output object
Where:
Parameters:
Details:
Returns:
Create Date: 17-Jun-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of GetOutputObject()
Displays a popup window and displays the text associated with error_code
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
PopupError(-1012) # error codes are always negative
Open popup window with message and [OK] choice
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
PopupMessage("Hello!")
Open popup window asking for a number
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
PopupNum("Value?", 1, 10, 0, 2)
Popup dialog for user to select a table and field
Where:
Parameters:
Details:
Returns:
Create Date: 19-Oct-2000
Modify Date: none
Available in SML for Windows: No
Example:
database = OpenVectorPolyDatabase(vector); PopupSelectTableField(database, table$, field$);
Open popup window asking for a string
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
a$ = PopupString("Enter a string.", "Or use this default string.")
print(a$)
Open popup window asking for a yes or no input
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
print(PopupYesNo("Continue?", 1))
Open popup window asking for a yes, no or cancel
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
print(PopupYesNoCancel("Continue?", 1))
Use a File/Object selection dialog to select an input CAD
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# read elem.sml
# demonstrates how to read the number of blocks in a CAD object
# and loop through all the blocks and print out type of each
# element
clear()
GetInputCAD(C)
numBlocks = CADNumBlocks(C)
print("number of blocks: ", numBlocks)
# loop through all blocks
for blk = 1 to numBlocks {
numElements = CADNumElements(C, blk)
printf("block: %3d number of elements: %5d \n\n", blk,
numElements)
# loop through all elements
for elem = 1 to numElements {
# get the element type
elem$ = CADElementType(C, blk, elem)
printf("block: %3d element: %5d type: %s\n", blk, elem,
elem$)
}
}
CloseCAD(C)
Opens a CAD object for reading or writing
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# circle.sml
# demonstrate creating and reading a circle CAD element
clear()
# create a new file or open existing file
GetOutputCAD(C)
# write a circle
xin = 100; yin = 200; rin = 50;
CADWriteCircle(C, 1, xin, yin, rin)
# the elements are always appended to end of block
# so get number of elements - last element will be our circle
lastelem = CADNumElements(C, 1)
# now read cirle data for most recently added element
CADReadCircle(C, 1, lastelem, xCenter, yCenter, radius)
print("write and read CAD circle")
print("element xCenter yCenter radius")
printf("%7d %8.2f %8.2f %8.2f \n", lastelem,
xCenter, yCenter, radius)
CloseCAD(C)
Use a File/Object selection dialog to select an input TIN
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
GetInputTIN(Tin)
# get the RVC file name
str$ = GetObjectFileName(Tin)
objNum = GetObjectNumber(Tin) # and object number
clear()
print("TIN Object Number: ", objNum, "RVC file Name: ", str$)
Use a File/Object selection dialog to select an output TIN
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
GetOutputTIN(Tin)
# get the RVC file name
str$ = GetObjectFileName(Tin)
objNum = GetObjectNumber(Tin)
clear()
print("TIN Object Number: ", objNum, "RVC file Name: ", str$)
Popup dialog to select a Region object for input
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of GetInputRegion()
Open a Region for output via dialog.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# example of GetOutputRegion()
fileName$ = "c:/tnt/win32/PntInRgn/regions.rvc"
objectName$ = "Region1"
objdesc$ = "created via CreateRegion()"
OpenRegion(RegionIn, fileName$, objectName$)
GetOutputRegion(RegionOut)
# just copy the region
RgnOutSame = CopyRegion(RegionIn)
SaveRegion(RegionOut, fileName$, objectName$, objdesc$)
Copy a file
Where:
Parameters:
Details:
Returns:
Create Date: 22-Jun-1998
Modify Date: 22-Jun-1998
Available in SML for Windows: Yes
Example:
# Example of CopyFile()
class StatusHandle statusHandle;
# create and destroy default status dialog
result = CopyFile("c:/tnt/win32/data/Cb_elev.rvc", "c:/tnt/win32/data/Cb_elev_copy.rvc");
# don't display status - statusHandle is NULL
result = CopyFile("c:/tnt/win32/data/Cb_elev.rvc",
"c:/tnt/win32/data/Cb_elev_copy.rvc", statusHandle);
print(result);
Create a directory
Where:
Parameters:
Details:
Returns:
Create Date: 06-Mar-2001
Modify Date: none
Available in SML for Windows: Yes
Create a temporary file name.
Where:
Details:
Returns:
Create Date: 08-Dec-2000
Modify Date: none
Available in SML for Windows: Yes
Delete a file.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of DeleteFile()
Close a file previously opened with fopen()
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# assume file already exists
clear()
f=fopen("c:/junk.txt", "r")
# get next line of text from text file specified by fileNumber
str$ = fgetline$(f) ; print(str$)
fclose(f)
Detects end of file
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
if (fexists("c:\temp.txt", "r")) then {
handle = fopen("c:\temp.txt", "r")
while (!feof(handle)){
line$ = fgetline$(handle)
# do something with line
}
fclose(handle)
}
Checks for existence and i/o mode of file
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
if (fexists("c:\temp.txt", "r")) then
print("c:\temp.txt exists")
Get next line of text from a text file
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# assume file already exists
clear()
f=fopen("c:junk.txt", "r")
# get next line of text from text file specified by fileNumber
str$ = fgetline$(fileNumber) ; print(str$)
fclose(f)
Get next number from text file
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear();
Open text file
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# assume file already exists
clear();
f=fopen("c:junk.txt", "w+"); # create a file
fprint(f, "This is line 1.\nThis is line 2."); # write to it
fclose(f); # close it
f=fopen("c:junk.txt", "r"); # open the file for reading
print(fgetline$(f)); # read and print two lines
fclose(f); # close it
Print unformated text or values to text file
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear(); # assume file already exists
# Open a file, then write to the file, then close it
f=fopen("c:/junk.txt", "r+");
fprint(f, "This is line 1\nThis is line2.", "More line 2");
fclose(f);
f=fopen("c:/junk.txt", "r");
print(fgetline$(f));
print(fgetline$(f));
fclose(f);
Print formatted text or values to text file
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
str1$="This is line ";
str2$=" you see. ";
str3$="This is line 2. ";
number=1;
# Create a file, then write to the file, then close it
f=fopen("c:/junk.txt", "w+");
fprintf(f, "%s%d%sn%s", str1$, number, str2$, str3$);
fclose(f);
f=fopen("c:/junk.txt", "r");
print(fgetline$(f));
print(fgetline$(f));
fclose(f);
Read raw bytes a from a file.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of fread()
Read a byte from a file or port.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of freadbyte()
Read a string from a file.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of freadstring()
Write unformated data to a file.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of fwrite()
Write a byte to a file or port.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of fwritebyte()
Write a string to a file.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of fwritestring()
Popup a dialog for selecting a directory
Where:
Parameters:
Details:
Returns:
Create Date: 11-Sep-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of GetDirectory()
Popup dialog to select a file
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of GetInputFileName()
Open or create a text file for input/output via dialog
Where:
Parameters:
Details:
Returns:
Create Date: 06-Aug-1998
Modify Date: 01-Feb-2001
Available in SML for Windows: Yes
Example:
# Example of GetInputTextFile()
class FILE fIn;
clear()
fIn = GetInputTextFile("c:/default.txt", "Select text file for input", "txt");
# read a line from the text file
str$ = fgetline$(fIn)
print(str$);
Popup dialog to select an output file.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of GetOutputFileName()
Open a text file for output via dialog
Where:
Parameters:
Details:
Returns:
Create Date: 06-Aug-1998
Modify Date: 01-Feb-2001
Available in SML for Windows: Yes
Example:
# Example of GetOutputTextFile()
class FILE fOut;
clear()
fOut = GetOutputTextFile("c:/default.txt", "Select text file for input", "txt");
# write some lines to the text file
fwritestring(fOut, "string1\n");
fwritestring(fOut, "string2\n");
Used to register functions to call when data is available.
Procedure will be passed two parameters, the port, and the value passed as the
data parameter to PortAddCallback()
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of PortAddCallback()
Close a port.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of PortClose()
Open a port.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of PortOpen()
Rename a file.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of RenameFile()
Read a text file from a text subobject under the script or a file in the same directory
Where:
Parameters:
Details:
Returns:
Create Date: 20-Nov-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of ScriptResourceReadFull()
Read an entire text file into a string (keep the size "reasonable)\"
Where:
Parameters:
Details:
Returns:
Create Date: 01-Feb-1999
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of TextFileReadFull()
Close an ini file
Where:
Parameters:
Details:
Returns:
Create Date: 07-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of IniClose()
Open an ini file
Where:
Parameters:
Details:
Returns:
Create Date: 07-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of IniOpenFile()
Open an RVC text object
Where:
Parameters:
Details:
Returns:
Create Date: 07-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of IniOpenObject()
Open an INI file as a subobject of the script or file in same directory
Where:
Parameters:
Details:
Returns:
Create Date: 07-Apr-1998
Modify Date: none
Available in SML for Windows: Yes
Example:
# Example of IniOpenScriptResource()
Read a number from an ini file
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of IniReadNumber()
Read a string from an ini file
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of IniReadString()
Write a number to an ini file
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of IniWriteNumber()
Write a string to an ini file
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of IniWriteString()
Parameters:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Parameters:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Parameters:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Parameters:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Parameters:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Parameters:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Tabulate text string placement and dimension information and
optimize label placement for point labels.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleAddToOptimizer
# Optimize placement of text labels with
# names of towns for vector points.
# Use three rank classes based on population
# to control optimization and to vary height
# and color of label text.
# Label sizes for three sizes of towns
small = 2500; med = 3500; big = 4500
# Rank towns by population
pop = TownData.POP90
if (pop < 1000) then {
rank = 1; height = small
}
else {
if (pop >= 30000 ) then {
rank = 3; height = big
}
else {
rank = 2; height = med
}
}
# Draw circle with size based on rank
radius = rank * 500
LineStyleSetColor(255,0,0)
LineStyleDrawCircle(radius,1)
# Read label text and determine dimensions
LineStyleSetFont("ARIALBD.TTF")
LineStyleTextNextPosition(TownData.NAME,height,0,0,next_x,next_y,length)
# Define parameters for optimization
xstart = Internal.x; ystart = Internal.y
xlast = xstart + length; ylast = ystart + height
dooptimize = 1; dodelete = 0
LineStyleAddToOptimizer(xstart,ystart,xlast,ylast,rank,dooptimize,dodelete)
# Define required function to draw labels after optimization
func FuncDrawLabel() {
small = 2500; med = 3500; big = 4500
pop = TownData.POP90
if (pop < 1000) then {
height = small; LineStyleSetTextColor(0,0,0)
}
else {
if (pop >= 30000 ) then {
height = big; LineStyleSetTextColor(255,0,0)
}
else {
height = med; LineStyleSetTextColor(0,0,255)
}
}
LineStyleSetFont("ARIALBD.TTF")
LineStyleDrawText(TownData.NAME,height,0,0)
}
Draw an arc centered at location referenced from current position
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawArc()
# Draw filled elliptical 90 degree arc starting at 60 degrees
# and centered 45 degrees and 10 units from current position
angle = 45; dist = 10; radius_x = 10; radius_y = 15; startangle = 60
sweepangle = 90; rotangle = 0; isAngleAbs = 0; closemode = 1; dofill = 1
LineStyleSetColor(0,0,0)
LineStyleDrawArc(angle, dist, radius_x, radius_y, startangle, sweepangle,
rotangle, isAngleAbs, closemode, dofill)
Draw an arrow from current position to specified point
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawArrow()
# Draw black arrow 10 units long to 45 degrees, head lines 4 units long,
# with 40 degree sweepangle and head filled
angle = 45; dist = 10; length = 4; sweepangle = 40; dofill = 1
LineStyleSetColor(0,0,0)
LineStyleDrawArrow(angle, dist, length, sweepangle, dofill)
Draw a circle centered on the current position
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawCircle()
# Draw a filled red circle with a radius of 10 units
radius = 10; dofill = 1
LineStyleSetColor(255,0,0)
LineStyleDrawCircle(radius, dofill)
Draw a cone with the specified dimensions and fill color
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawCone()
# Draw cone symbol with base 40 by 20 units, and height 100 units
# with black edges and green fill color
long_axis = 40; short_axis = 20; height = 100;
color_red = 0; color_green = 255; color_blue = 0
LineStyleSetColor(0,0,0)
LineStyleDrawCone(long_axis, short_axis, height, color_red, color_green, color_blue)
Draw a rectangular solid shape with the specified dimensions and fill color
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawCube()
# Draw cube symbol with width and height
# of 16 units and depth of 8 units
# with black edges and red fill color
width = 16; depth = 0.5 * width; height = width;
color_red = 255; color_green = 0; color_blue = 0
LineStyleSetColor(0,0,0)
LineStyleDrawCube(width, depth, height, color_red, color_green, color_blue)
Draw a vertical cylinder with the specified dimensions and fill color
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawCylinder()
# Draw cylinder symbol with base 30 by 15
# units, height 100 units, and
# with black edges and yellow fill color
long_axis = 30; short_axis = 15; height = 60;
color_red = 255; color_green = 255; color_blue = 0
LineStyleSetColor(0,0,0)
LineStyleDrawCone(long_axis, short_axis, height, color_red, color_green, color_blue)
Draw an ellipse centered at location referenced from current position
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawEllipse()
# Draw filled green ellipse centered at the current
# position with long axis = 20 units and short
# axis = 10 units, and rotate 30 degrees counterclockwise
angle = 0; dist = 0; radius_x = 20; radius_y = 10;
rotangle = 30; isAngleAbs = 0; dofill = 1
LineStyleSetColor(0,0,0)
LineStyleDrawEllipse(angle, dist, radius_x, radius_y, rotangle, isAngleAbs, dofill)
Draw complete line element using currently set color and width
Where:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawLine()
# Draw line elements as solid black lines
# 3 units wide
LineStyleSetColor(0,0,0)
LineStyleSetLineWidth(3)
LineStyleDrawLine()
Draw a polygon from previously recorded sequence of points
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawPolygon()
# Draw blue filled equilateral triangle
# with sides 30 units long
LineStyleSetColor(0,0,255)
LineStyleDropAnchor(0)
LineStyleRecordPolygon(1)
LineStyleMoveTo(0,30)
LineStyleMoveTo(120,30)
LineStyleMoveToAnchor(0)
LineStyleDrawPolygon(1)
Draw a polyline connecting previously recorded sequence of points
Where:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawPolyline()
# Draw brown polyline representing
# overlapping triangles of different sizes
LineStyleSetColor(170,85,0)
LineStyleRecordPolygon(1)
LineStyleMoveTo(0,0)
LineStyleMoveTo(55,30)
LineStyleMoveTo(-55,20)
LineStyleMoveTo(55,10)
LineStyleMoveTo(-55,20)
LineStyleDrawPolyline()
Draw a rectangle
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawRectangle()
# Draw solid line with regularly spaced filled
# squares oriented with bases parallel to local
# line direction.
# Set parameters for squares
width = 10; height = width;
angle = 0 # no rotation of square
dofill = 1
isAbs = 0 # orient to local coordinate system
# Set spacing between squares
spacing = 30
# Set line color and width and draw line
LineStyleSetColor(0,0,0)
LineStyleSetLineWidth(3)
LineStyleDrawLine()
# Draw square at start of line
LineStyleDrawRectangle(width,height,angle,dofill,isAbs)
# Draw rest of squares
while (LineStyleRoll(spacing) <> 1) {
dist = LineStyleGetDistanceTo(3)
if ( dist > spacing ) {
LineStyleDrawRectangle(width,height,angle,dofill,isAbs)
}
}
Draw text string with specified height and orientation
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawText()
# Draw circle point symbols for towns,
# read town names from database, and draw text
# labels rotated 30 degrees counterclockwise.
# Draw red circle point symbol
LineStyleSetColor(255,0,0)
LineStyleDrawCircle(500,1)
# Read town name from database field to string variable
label$ = sprintf("%s",TownData.NAME)
# Set text color and font
LineStyleSetTextColor(0,0,0)
LineStyleSetFont("ARIALBD.TTF")
# Set label parameters
height = 2000; angle = 30; isAbs = 0
# Move pen to right of symbol and draw label
LineStyleMoveTo(0,2000)
LineStyleDrawText(label$,height,angle,isAbs)
Draw text string in a rectangular box
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawTextBox()
# Draw square point symbol and draw boxed text
# label with sample number from database field
# in black on yellow fill
# Draw red square point symbol
LineStyleSetColor(255,0,0)
LineStyleSetLineWidth(0)
LineStyleDrawRectangle(15,15,0,1)
# Read sample number from database field and convert
# to text string for use as a label
label$ = sprintf("%d", Samples.Number)
# String variable for label text font
font$ = "ARIALBD.TTF"
# Define color variables for text
t_red = 0; t_green= 0; t_blue = 0
# Define fill color variables for text box
fillred = 255; fillgreen = 255; fillblue = 170
# Define height, angle, and border width of text
t_height = 10; angle = 0; # no rotation of label
border = 2
isAbs = 0 # use local coordinate system
# Set color and font for text label
LineStyleSetTextColor(t_red,t_green,t_blue,fillred, fillgreen, fillblue)
LineStyleSetFont(font$)
# Move pen to right of symbol and draw label
LineStyleSetColor(0,0,0)
LineStyleMoveTo(0, 15)
LineStyleDrawTextBox(label$,t_height,angle,border,isAbs)
Draw an arc centered at current location and passing through three
points referenced from current position.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDrawThreePointArc()
# Draw arc through listed point positions,
# closed through the center and filled.
# Set parameters for arc
angle1 = 60; dist1 = 20
angle2 = 90; dist2 = 30
angle3 = 120; dist3 = 40
closemode = 2 # close through center
dofill = 1 # fill closed arc
LineStyleSetColor(0,0,0)
LineStyleDrawThreePointArc(angle1,dist1,angle2,dist2,angle3,dist3,closemode,dofill)
Record current pen position as numbered anchor for later use
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleDropAnchor()
# Draw flag symbol with anchor at base.
# Return to anchor to draw filled rectangle.
LineStyleSetColor(255,0,0)
LineStyleSetLineWidth(2)
LineStyleStyleDropAnchor(1)
LineStyleLineTo(90,20)
LineStyleLineTo(-30,8)
LineStyleLineTo(-150,8)
LineStyleMoveToAnchor(1)
LineStyleDrawRectangle(10,5,0,1)
Get minimum and maximum direction angles for portion of line
starting at current position
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Get distance from current position to specified line position
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleGetDistanceTo()
# Draw solid line with regularly spaced filled
# squares oriented with bases parallel to local
# line direction. Don't draw square within
# desired spacing distance from end of line.
# Set parameters for squares
width = 20; height = width;
angle = 0 # no rotation of square
dofill = 1
isAbs = 0 # orient to local coordinate system
# Set spacing between squares
spacing = 100
# Set line color and width and draw line
LineStyleSetColor(0,0,0)
LineStyleSetLineWidth(3)
LineStyleDrawLine()
# Draw square at start of line
LineStyleDrawRectangle(width,height,angle,dofill,isAbs)
# Draw rest of squares
while (LineStyleRoll(spacing) <> 1) {
dist = LineStyleGetDistanceTo(3)
if ( dist > spacing ) {
LineStyleDrawRectangle(width,height,angle,dofill,isAbs)
}
}
Find maximum deviation angles between successive line segments
for portion of line element starting at current position.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleGetLineCurvature()
# For vector lines representing fairly
# straight surface traces of geologic faults
# determine largest value of maximum deviation
# angle based on 50-meter segments, and
# assign different line color for lines
# exceeding specified maximum curvature value.
spacing = 50 # length of line to examine
# Find maximum deviation angle for first segment
LineStyleGetLineCurvature(spacing,maxangle)
max = maxangle # variable to record max deviation
# Check max deviation angles for remainder of line
# and record maximum value
while (LineStyleRoll(spacing) <> 1) {
LineStyleGetLineCurvature(spacing,maxangle)
if (maxangle > max) then
max = maxangle
}
# Assign values to color variables based on max
if (max > 4) then {
red = 255; green = 0; blue = 0
}
else {
red = 0; green = 0; blue = 0
}
# Draw solid line with appropriate color
LineStyleSetColor(red,green,blue)
LineStyleDrawLine()
Find maximum perpendicular distance from specified portion of
line to a straight line joining its start and end points.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleGetMaxDistance()
# Draw line elements as solid lines with
# regularly spaced filled triangle symbols
# on left side of line. Use function to avoid
# placing triangles on sharp bends of line.
# Triangle spacing and dimensions
spacing = 35
triWidth = spacing * 0.6
halfTri = triWidth * 0.5
height = triWidth * 0.6
tol = 0.2 * height
# Set line color and width and draw line
LineStyleSetColor(255,0,0)
LineStyleSetLineWidth(2)
LineStyleDrawLine()
# Draw triangles
while (LineStyleRoll(spacing) <> 1) {
dist = LineStyleGetDistanceTo(3) # distance to end of line
LineStyleGetMaxDistance(triWidth,angle,maxDist)
if (dist > triWidth and maxDist < tol) {
LineStyleDropAnchor(1)
LineStyleRoll(halfTri)
LineStyleMoveTo(0,0)
LineStyleMoveTo(90, height)
LineStyleDropAnchor(2)
LineStyleRoll(halfTri)
LineStyleDropAnchor(3)
LineStyleRecordPolygon()
LineStyleMoveToAnchor(2)
LineStyleMoveToAnchor(1)
LineStyleMoveToAnchor(3)
LineStyleDrawPolygon(1)
}
else LineStyleRoll(halfTri)
}
Get current position on line element
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleGetPosition
# Draw dashed line with red color from
# start to middle and blue color from
# middle to end
LineStyleSetLineWidth(2)
dashSize = 10
while (LineStyleRoll(dashSize) <> 1) {
pos = LineStyleGetPosition(0)
if ( pos <= 0.5)
LineStyleSetColor(255,0,0)
else
LineStyleSetColor(0,0,255)
LineStyleRollPen(dashSize)
}
Determine if line element closes to form polygon
Where:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleIsClosed
# Draw solid line, mark start with red
# arrow head and end with green filled circle.
# Omit circle if line forms closed polygon.
# Set line width, color, and draw solid line
LineStyleSetLineWidth(2)
LineStyleSetColor(0,0,0)
LineStyleDrawLine()
LineStyleSetColor(255,0,0)
LineStyleSetLineWidth(0)
LineStyleDrawArrow(0,13,15,60,1)
if (LineStyleIsClosed() <> 1) {
LineStyleSetPosition(1.0)
LineStyleSetColor(0,255,0)
LineStyleDrawCircle(7,1)
}
Draw a line from the current pen position to a point specified
relative to the current line element position.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleLineTo()
# Draw point symbol of triangular flag
# on vertical pole
LineStyleSetColor(225,0,0)
LineStyleSetLineWidth(1)
LineStyleLineTo(90,20)
LineStyleLineTo(-30,8)
LineStyleLineTo(-150,8)
# Example 2 of LineStyleLineTo()
# Draw line symbol approximating
# a sine wave for vector line elements.
# Set line color and width
LineStyleSetColor(0,0,0)
LineStyleSetLineWidth(3)
# Set sine wave parameters
angle = 0; space = 4
# Draw line
while (LineStyleRoll(space) <> 1) {
angle = angle + 1 # in radians
a = sin(angle) * 5 # amplitude
if (a > 0) Then LineStyleLineTo(90,a)
else LineStyleLineTo(-90,abs(a))
}
Draw a line from the current pen position to the specified
anchor location.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleLineToAnchor()
# Draw point symbol of unfilled triangle
# with lower left corner at point position.
LineStyleSetColor(0,0,255)
LineStyleSetLineWidth(2)
LineStyleDropAnchor(0)
LineStyleLineTo(60,15)
LineStyleLineTo(-60,15)
LineStyleLineToAnchor(0)
Move pen (without drawing) to a point specified
relative to the current line element position.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleMoveTo()
# Draw vector line element as solid
# line with regularly spaced "X" symbols
spacing = 30 # spacing between "X" symbols
length = 12 # length of lines in X
halfLength = 0.5 * length
# Set line width and color
LineStyleSetLineWidth(2)
LineStyleSetColor(0,0,255)
# Draw solid line
LineStyleDrawLine()
# Draw "X" symbols
while (LineStyleRoll(spacing) <> 1) {
LineStyleSetColor(0,0,255)
LineStyleMoveTo(0,0) # move pen to origin of local coordinate system
LineStyleMoveTo(45, halfLength)
LineStyleLineTo(-135, length)
LineStyleMoveTo(45, halfLength)
LineStyleMoveTo(-45, halfLength)
LineStyleLineTo(135, length)
}
Move pen position to the specified anchor location.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleMoveToAnchor()
# Draw point symbol as triangular flag on
# vertical pole with filled rectangle
# centered on base.
# Set line color and width
LineStyleSetColor(0,255,0)
LineStyleSetLineWidth(2)
# Draw flag
LineStyleDropAnchor(0) # anchor at origin
LineStyleLineTo(90,20)
LineStyleLineTo(-30,8)
LineStyleLineTo(-150,8)
# Move to origin and draw rectangle
LineStyleMoveToAnchor(0)
LineStyleDrawRectangle(10,5,0,1)
Move current position and pen position to next vertex along
vector line element.
Where:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleNextVertex()
# Draw vector line element as solid
# black line, then mark start with an
# open red circle and each subsequent
# vertex with an open green circle
# Set parameters for circles marking vertices
radius = 5; dofill = 0
# Draw solid black line
LineStyleSetLineWidth(3)
LineStyleSetColor(0,0,0)
LineStyleDrawLine()
# draw red circle at beginning of line
LineStyleSetColor(225,0,0)
LineStyleDrawCircle(radius,dofill)
# Move to next vertex and draw green circle
LineStyleSetColor(0,225,0)
while ( LineStyleNextVertex() <> 1 ) {
LineStyleDrawCircle(radius,dofill)
}
Move current position and pen position to previous vertex along
vector line element.
Where:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStylePrevVertex()
# Draw vector line element as dashed
# black line, then mark end with an
# open red circle and each subsequent
# vertex with an open green circle
# Set parameters for circles and dashes
radius = 5; dofill = 0; dashSize = 10
# Draw dashed black line
LineStyleSetLineWidth(3)
LineStyleSetColor(0,0,0)
while (LineStyleRoll(dashSize) <> 1) {
dist = LineStyleGetDistanceTo(3) # distance to end of line
if (dist > dashSize)
LineStyleRollPen(dashSize)
else
LineStyleRollPen(dist)
}
# draw red circle at end of line
LineStyleSetColor(225,0,0)
LineStyleDrawCircle(radius,dofill)
# Move to previous vertex and draw green circle
LineStyleSetColor(0,225,0)
while ( LineStylePrevVertex() <> 1 ) {
LineStyleDrawCircle(radius,dofill)
}
Start or stop recording a sequence of vertex locations for later
use in drawing a polygon or polyline.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleRecordPolygon()
# Draw point symbol of triangular flag
# on vertical pole, flag as filled polygon.
# Set line color and width
LineStyleSetColor(0,255,0)
LineStyleSetLineWidth(2)
# Draw flag
LineStyleLineTo(90,20)
LineStyleDropAnchor(1)
LineStyleRecordPolygon(1)
LineStyleLineTo(-30,8)
LineStyleLineTo(-150,8)
LineStyleMoveToAnchor(1)
LineStyleDrawPolygon(1)
Restore original vector line element coordinates after
modification by LineStyleSpline() or LineStyleThinLine() functions.
Where:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Shift the current position along a vector line element by the
specified distance without drawing.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleRoll()
# Draw dashed line symbol for line element.
# Set line color and width
LineStyleSetColor(0,0,0)
LineStyleSetLineWidth(2)
# set dash parameters
dashSize = 16
spacing = 0.6 * dashSize
# Draw dashed line
while (LineStyleRoll(spacing) <> 1) {
LineStyleRollPen(dashSize)
}
Draw line from the current position on vector line element
for the specified distance along the line element.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleRollPen()
# Draw dashed line symbol for line element.
# Set line color and width
LineStyleSetColor(0,0,0)
LineStyleSetLineWidth(2)
# set dash parameters
dashSize = 16
spacing = 0.6 * dashSize
# Draw dashed line
while (LineStyleRoll(spacing) <> 1) {
LineStyleRollPen(dashSize)
}
Set square or rounded ends for lines and polyline segments.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleSetCapJoinType()
# Draw cross point symbol with square line ends
# Set line color, width, and capstype
LineStyleSetColor(255,0,255)
LineStyleSetLineWidth(2)
LineStyleSetCapJoinType(1,1)
# Draw cross
LineStyleDropAnchor(0)
LineStyleMoveTo(90,10)
LineStyleLineTo(-90,20)
LineStyleMoveToAnchor(0)
LineStyleMoveTo(0,10)
LineStyleLineTo(180,20)
Set RGB color values for line color.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleSetColor()
# Draw point symbol with red flag and
# blue filled rectangle at base
# Set line width and color for flag
LineStyleSetLineWidth(2)
LineStyleSetColor(255,0,0)
# Draw flag
LineStyleDropAnchor(1)
LineStyleLineTo(90,20)
LineStyleLineTo(-30,8)
LineStyleLineTo(-150,8)
LineStyleMoveToAnchor(1)
# Change line color and draw rectangle
LineStyleSetColor(0,0,255)
LineStyleDrawRectangle(10,5,0,1)
Set coordinate type for input distance values.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleSetCoordType()
# Draw filled rectangle point symbol
# with constant size in millimeters
# Set dimensions of rectangle
LineStyleSetCoordType(1)
width = 4
height = 0.5 * width
# Set color for rectangle
LineStyleSetColor(255,0,0)
LineStyleSetLineWidth(0)
# Draw rectangle
LineStyleDrawRectangle(width,height,0,1)
Set name of font to use for text.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleSetFont()
# Draw circle point symbols for towns,
# read town names from database, and draw text
# labels.
# Draw red circle point symbol
LineStyleSetColor(255,0,0)
LineStyleDrawCircle(500,1)
# Read town name from database field to string variable
label$ = sprintf("%s",TownData.NAME)
# Set text color and font
LineStyleSetTextColor(0,0,0)
LineStyleSetFont("ARIALBD.TTF")
# Set label parameters
height = 2000; angle = 0; isAbs = 0
# Move pen to right of symbol and draw label
LineStyleMoveTo(0,2000)
LineStyleDrawText(label$,height,angle,isAbs)
Set width of lines to be drawn.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleSetLineWidth()
# Draw line elements as solid black lines
# 3 units wide
LineStyleSetColor(0,0,0)
LineStyleSetLineWidth(3)
LineStyleDrawLine()
Set position along vector line element.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleSetPosition()
# Draw line element as solid line with small
# red circles at start, middle, and end of line.
# Set radius parameters for circles
radius = 8; dofill = 0
# Set line color and width and draw line
LineStyleSetColor(0,0,0)
LineStyleSetLineWidth(4)
LineStyleDrawLine()
# Draw small red circle at beginning of line
LineStyleSetColor(225,0,0)
LineStyleDrawCircle(radius,dofill)
# Draw remaining circles
LineStyleSetPosition(0.5)
LineStyleDrawCircle(radius,dofill)
LineStyleSetPosition(1.0)
LineStyleDrawCircle(radius,dofill)
Set scale factor applied to all input distances and lengths.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleSetScale
# Draw dashed red line with dash
# lengths scaled by 0.5
# Set scale factor
LineStyleSetScale(0.5)
# Set color, width, and end type for lines
LineStyleSetColor(255,0,0)
LineStyleSetLineWidth(2)
LineStyleSetCapJoinType(1,1)
# draw dashed line
dashSize = 20
halfDash = 0.5 * dashSize
while (LineStyleRoll(halfDash) <> 1) {
LineStyleRollPen(dashSize)
}
Set RGB color values for text and for text box background.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleSetTextColor()
# Draw square point symbol with sample
# number (from database) in text box
# Set line color and width and draw square
LineStyleSetColor(255,0,0)
LineStyleSetLineWidth(0)
LineStyleDrawRectangle(15,15,0,1)
# Read sample number from database field and convert
# to text string for use as a label
label$ = sprintf("%d", Samples.Number)
# String variable for label text font
font$ = "ARIALBD.TTF"
# Define color variables for text
red = 0; green = 0; blue = 0
# Define fill color variables for text box
bgred = 255; bggreen = 255; bgblue = 170
# Define height, angle, and border width of text
t_height = 10; angle = 0; border = 2
# Set color and font for text label
LineStyleSetColor(0,0,0) # color for box outline
LineStyleSetTextColor(red,green,blue,bgred,bggreen,bgblue)
LineStyleSetFont(font$)
# Move pen to right of symbol and draw label
LineStyleMoveTo(0, 15)
LineStyleDrawTextBox(label$,t_height,angle,border,0)
Specify sequence of positions by direction and distance from
current pen position.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleSideshot()
# Draw line elements with regularly
# repeated diamond symbols.
LineStyleSetColor(128,128,128)
# Set dimensions for diamond symbols
length = 15; width = 8
halfLength = 0.5 * length
halfWidth = 0.5 * width
spacing = 25 # spacing between diamond centers
dodraw = 0
while (LineStyleRoll(spacing) <> 1) {
LineStyleMoveTo(0,0)
LineStyleRecordPolygon(1) # record sideshot points to make polygon
LineStyleSideshot(dodraw,0,halfLength,90,halfWidth,180,halfLength,-90,halfWidth)
LineStyleDrawPolygon(1) # draw and fill diamond polygon
}
Spline vector line elements (smooth by inserting additional vertices).
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleSpline
# Spline lines using BSpline method, with
# 5 inserted points between each pair of vertices,
# draw in red.
parameter = 5; method = 1
LineStyleSpline(parameter,method)
LineStyleSetColor(255,0,0)
LineStyleSetLineWidth(2)
LineStyleDrawLine()
Compute end coordinates and length of text string.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleTextNextPosition()
# Draw circle point symbols for towns,
# read town names from database, and draw text
# labels to the left of the points
# Draw red circle point symbol
LineStyleSetColor(255,0,0)
LineStyleDrawCircle(500,1)
# Read town name from database field to string variable
label$ = sprintf("%s",TownData.NAME)
# Set text color and font
LineStyleSetTextColor(0,0,0)
LineStyleSetFont("ARIALBD.TTF")
# Set label parameters and find length of text label
height = 2000; angle = 0; isAbs = 0
LineStyleTextNextPosition(label$,height,angle,isAbs,next_x,next_y,length)
# Move pen to left of symbol and draw label,
# using length of label to avoid overlap
LineStyleMoveTo(180,length + 500)
LineStyleDrawText(label$,height,angle,isAbs)
Thin (simplify) vector line elements by removing vertices.
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
# Example of LineStyleThinLine
# Thin lines with Douglas-Peucker method
# using thinning distance of 5
parameter = 5; method = 1
LineStyleSetColor(0,255,0)
LineStyleThinLine(parameter,method)
LineStyleDrawLine()
Sends unformated output to console
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
str1$="This is line "
str2$="you see."
str3$="The next is\nline 3."
number=1
print(str1$, number, str2$)
print(str3$)
Send formatted output to the console
Where:
Parameters:
Details:
Returns:
Create Date: 01-Dec-1997
Modify Date: none
Available in SML for Windows: No
Example:
clear()
format$="%s%d%s\n%s"
str1$="This is line "
str2$="you see."
str3$="This is line 2"
number = 1
print(str1$, number, str2$, str3$)
printf(format$, str1$, 1, str2$, str3$)
Total Number of Functions: 353