Ранг: Administration
Групи: Administrators
Присъединен: 29.9.2010 г.(UTC) Публикации: 3
Благодарности : 0 пъти Е получил : 5 благодарности в 2 публикации
|
Expressions (used in properties) Examples: 33 degrees in radians property POS (WGS84) latitude in radians Код:POS.Latitude * Math.PI / 180 if property SPEED is over 100, return text "over 100km/h", otherwise - return SPEED value Код:SPEED>100?"over 100km/h":SPEED.ToString() time period from last updating property SPEED Код:DateTime.UtcNow - __SPEED.LastUpdate
Operators ! (not) !true = not (!false) && (and) - logical and true && false = False || (or) true || false = True = equals (12+3 = 123) = false != (<>) not equal <, >, >=, <= comparisons +,-,*,/ arithmetic operations % (mod) modulus operator [,] array access
Keywords not, and, or, mod - see
Operators true - logical True value false - logical false value null object null/empty value iif (?:) conditional construction iif(1=2, 123, 32) is equivalent to 1=2 ? 123 : 23 Math - mathematical expressions constants Math.E, Math.PI methods with 1 parameter: Math.[method](x) Abs,Acos,Asin,Atan,Atan2,Ceiling,Cos,Cosh,Exp,Floor,Log,Log10,Round,Sign,Sin,Sinh,Sqrt,Tan,Tanh,Truncate with more parameters Log(x, base), Min(x, y), Pow(x, power), Round(x, decimalPlaces) Convert - conversions methods with 1 parameter: Convert.[method](obj) ToBoolean,ToByte,ToChar,ToDateTime,ToDecimal,ToDouble,ToInt16,ToInt32,ToInt64,ToSByte,ToSingle,ToString,ToUInt16,ToUInt32,ToUInt64
Types object – general unknown type (if not defined) bool (Boolean) – logical type true or false char (Char) – character string (String) – literal string sbyte (SByte) Signed 8-bit integer: –128 ... 127 byte (Byte) Unsigned 8-bit integer: 0 ... 255 short (Int16) Signed 16-bit integer: –32,768 ... 32,767 ushort (UInt16) Unsigned 16-bit integer: 0 ... 65,535 int (Int32) Signed 32-bit integer: –2,147,483,648 ... 2,147,483,647 uint (UInt32) Unsigned 32-bit integer: 0 ... 4,294,967,295 long (Int64) Signed 64-bit integer: -9,223,372,036,854,775,808 ... 9,223,372,036,854,775,807 ulong (UInt64) Unsigned 64-bit integer: 0 ... 18,446,744,073,709,551,615 float (Single) floating-point, 7 digits: ±1.5e−45 to ±3.4e38 double (Double) floating-point 15-16 digits ±5.0e−324 to ±1.7e308 decimal (Decimal) 28-29 significant digits, (-7.9 x 1028 to 7.9 x 1028) / (100 to 28) DateTime - date time, has variables DateTime.Now, DateTime.Today, DateTime.UtcNow DaysInMonth(year,month), IsLeapYear(year) DateTimeOffset like DateTime, with offset TimeSpan - time interval Guid - globally unique identifier WGS84 - World Geodetic System 1984, Latitude, Longitude in degrees WGS84.FromLatLong(latitude, longitude) WGS84.WGS84_RAD(latitudeRads, longitudeRads) WGS84.Parse(string), WGS84.ParseIso(string) WGS84Zone - geo zone, defined by set of WGS84 points and distantance WGS84Zone.Circle(center, radius) WGS84Zone.Line(distance, points) WGS84Zone.Area(points) WGS84Zone.Parse(string) IconsList - encapsulates icons list data IconsList.Create(id, name, prefix, idList) IconsList.Create( 10, "name", "issbg\\10\\orrange-", "18,18;18.png|22,22;22.png|34,34;34.png")
Object/Properties integration in expression Object properties could be used for Object CAR, with properties POS: WGS84 SPEED: double ALTITUDE: int DRIVER: string SPEED * ALTITUDE will return multiplication by SPEED and ALTITUDE properties values POS.Latutude*Math.PI/180 will return position Latitude in radians SPEED>100 ? "over 10km/h" : "slow" - will return differrent string, by SPEED value meta property data is accessible using prefix "__" __SPEED.LastUpdate will return DateTime value of timestamp when SPEED property value was updateed another property meta data is Category,DataType,Description,LastSet,LastUpdate,Label,PermissionsHex,Unit,IsEmpty,IsQueue,IsQuery,QueueLength,Queue __SPEED.QueueLength<2 ? 0 : (Convert.ToDouble(__SPEED.Queue[__SPEED.QueueLength-2].Value) - SPEED) will return SPEED difference if SPEED has last value (in values queue) __SPEED.Value is equal SPEED, but not equivalent!!! SPEED returns double type (type of property SPEED), so SPEED * 2 is valid expression, but __SPEED.Value returns object type, so __SPEED.Value * 2 is not valid, object should be casted to double like Convert.ToDouble(__SPEED.Value) * 2
|