UI¶
ShowPanel¶
Show or hide setting panel.
Name | Required | Description |
---|---|---|
panel | Yes | Name of the panel, can be one of:
|
enable | Yes | Show or hide panel |
Example
1 2 3 4 5 | {
"cmd": "ShowPanel",
"panel":"viewPointPanel",
"enable":false
}
|
CreatePlacemarkTemplate¶
Create new UI panel.
Name | Required | Description |
---|---|---|
template | Yes | Panel settings, see below sample code for details |
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | {
"cmd": "CreatePlacemarkTemplate",
"template":{
"name": "Template Example",
//panel size
"bgWidth": 243,
"bgHeight": 149,
//position of panel axis
"horizontalAlignment":"LEFT", // horizontal position, can be one of LEFT CENTER RIGHT
"verticalAlignment":"TOP", // vertical position, can be one of TOP CENTER BOTTOM
//controls included in panel
"showMapping": {
"Background": {
//parameters
"type": "image",
"sortOrder": 0,
"drawPos": [0, 0],
"drawSize": [ 243, 149 ],
//control axis position
"horizontalAlignment":"LEFT", //horizontal position, can be one of LEFT CENTER RIGHT
"horizontalAlignmentOffset":0, //horizontal offset
"verticalAlignment":"TOP", //vertical position, can be one of TOP CENTER BOTTOM
"verticalAlignmentOffset":0, //vertical offset
//private parameters
"image":"userimage/4815/CustomTexture/20151023824126.png",
"color":[0,0,1], //color settings may mix with image
//data source settings
"getMethod": "objectPropertyMapping",
"propertyPath":"MonitorDatas/RealTimeData/status",
"objectPropertyMapping":{
"_default_":"userimage/4815/CustomTexture/1.png", //image location
"alarms":{"color":[1,0.2,0.2]}, //change color
"error":{ //change color and texture at the same time
"image":"userimage/4815/CustomTexture/3.png",
"color":[1,0,0]
}
}
},
"name": {
//parameters
"type": "text",
"sortOrder": 1,
"drawPos": [0, 0],
"drawSize": [243, 39],
//axis position
"horizontalAlignment":"LEFT", //horizontal position, can be one of LEFT CENTER RIGHT
"horizontalAlignmentOffset":0, //horizontal offset
"verticalAlignment":"TOP", //vertical position, can be one of TOP CENTER BOTTOM
"verticalAlignmentOffset":0, //vertical offset
//private parameters
"fontFamily": "Arial", //font family
"fontSize": 14,
"fontColor": [1,1,1,1],
"fontStyle": "Bold",
"fontShadow": false,
"fontShadowThickness": 2,
"fontShadowColour": [0,0,0],
"fontShadowOffset": [2, 2],
"fontOutline": true,
"fontOutlineThickness": 2,
"horizontalOverflow": false,
"verticalOverflow": true,
"fontOutlineColour": [0,0,0],
"horizontalTextAlignment": "CENTER",
"verticalTextAlignment": "CENTER",
"horizontalWriterAlignment": "TOP",
"verticalWriterAlignment": "LEFT",
//data source
"getMethod": "objectProperty",
"propertyPath": "UserID"
},
"status": {
//control parameters
"type": "text",
"sortOrder": 1,
"drawPos": [26,80],
"drawSize": [50,30],
//control private paramters, list only common ones
"fontSize": 14,
"fontColor": [1,1,1,1],
//data source
"getMethod": "objectPropertyMapping",
"propertyPath": "MonitorDatas/RealTimeData/status",
"objectPropertyMapping":{
"_default_":{"text":"Normal", "fontColor":[0,1,0]},
"false":{"text": "Error", "fontColor":[1,0,0]}
}
},
"progressBar": {
//parameters
"type": "progressBar",
"sortOrder": 1,
"drawPos": [74, 40],
"drawSize": [128, 20],
//axis position
"horizontalAlignment":"LEFT", //horizontal position, can be one of LEFT CENTER RIGHT
"horizontalAlignmentOffset":0, //horizontal offset
"verticalAlignment":"TOP", //vertical position, can be one of TOP CENTER BOTTOM
"verticalAlignmentOffset":0, //vertical offset
//private parameters
"fillDir": "right", //"up" "down" "left" "right"
"barImage":"uGUI/ProgressBar/img_0",
"min": 20,
"max": 30,
"color": [0.513,0.874,0.552,1],
"styleConfig": {
"0.25": [0.36,0.58,0.16],
"0.50": [1,0.83,0.4],
"0.75": [1,0.4,0],
"0.90": [1,0.15,0.15]
},
//data source
"getMethod": "objectProperty",
"propertyPath": "MonitorDatas/RealTimeData/humidity"
},
"pieChart": {
//parameters
"type": "progressPie",
"sortOrder": 1,
"drawPos": [99,90],
"drawSize": [50,50],
//axis position
"horizontalAlignment":"LEFT", //horizontal position, can be one of LEFT CENTER RIGHT
"horizontalAlignmentOffset":0, //horizontal offset
"verticalAlignment":"TOP", //vertical position, can be one of TOP CENTER BOTTOM
"verticalAlignmentOffset":0, //vertical offset
//private parameters
"openAngle":"360",
"fillDirClockwise":true, //clockwise
"ringImage":"uGUI/ProgressBar/img_3", //image path
"rotation":0,
"min": 20,
"max": 30,
"color": [0.513,0.874,0.552,1],
"styleConfig": {
"0.25": [0.36,0.58,0.16],
"0.50": [1,0.83,0.4],
"0.75": [1,0.4,0],
"0.90": [1,0.15,0.15]
},
//data source
"getMethod": "objectProperty",
"propertyPath": "MonitorDatas/RealTimeData/humidity"
},
"ringChart": {
//parameters
"type": "progressRing",
"sortOrder": 1,
"drawPos": [149,90],
"drawSize": [50,50],
//axis
"verticalAlignment":"CENTER",
"verticalAlignmentOffset":0,
"horizontalAlignment":"CENTER",
"horizontalAlignmentOffset":0,
//private control
"openAngle":"360",
"fillDirClockwise":false, // counter clockwise
"ringImage":"uGUI/ProgressBar/img_2", //image path
"rotation":0,
"min": 20,
"max": 30,
"color": [0.513,0.874,0.552,1],
"styleConfig": {
"0.25": [0.36,0.58,0.16],
"0.50": [1,0.83,0.4],
"0.75": [1,0.4,0],
"0.90": [1,0.15,0.15]
},
//data source
"getMethod": "objectProperty",
"propertyPath": "MonitorDatas/RealTimeData/humidity",
},
"DisplyValue": {
//parameters
"type": "text",
"sortOrder": 2,
"drawPos": [74,65],
"drawSize": [128,20],
//data source
"getMethod": "objectProperty",
"propertyPath": "MonitorDatas/RealTimeData/humidity"
},
"Button": {
//parameters
"type": "button",
"sortOrder": 1,
"drawPos": [194,98],
"drawSize": [35,22],
//private parameters
"fontSize": 12,
"fontColor": [0.235,0.792,0.501,1],
"title":"Details",
"normalColor": [0.3,0.5,0.3,0],
"highlightedColor": [1,1,1],
"pressedColor": [0.6,0.5,0.2,0],
"cmds":[
{"cmd":"OpenUrl", "uid":{"objectManager":"Runbuffer/Button1"} }
],
"cmdsImmediate":false
},
"SwitchButton": {
//parameters
"type": "toggle",
"sortOrder": 1,
"drawPos": [194,98],
"drawSize": [35,22],
//private parameters
"images":["http://www.3momoda.com/images/add_01.png","images/add_02.png","images/add_02.png"], //images use for normal, mouse over and mouse leave events. image url can be absolute,or relative to mmd server url
"fontSize": 12,
"fontColor": [0.235,0.792,0.501,1],
"title":"Open",
"checked":true,
"setCheckedExe":false, //if run command while checked
"checkCmds":[
{ "cmd":"SetPlacemarkProperty","uid":"obj01" ,"templateName":"Template" ,"widgetName":"SwitchButton" ,"property":"title" ,"value":"Close" }
],
"unCheckCmds":[
{ "cmd":"SetPlacemarkProperty","uid":"obj01" ,"templateName":"Template" ,"widgetName":"SwitchButton" ,"property":"title" ,"value":"开" }
],
"cmdsImmediate":false
}
}
}
}
|
CopyPlacemarkTemplate¶
Create new control by clone existing one.
Name | Required | Description |
---|---|---|
originName | Yes | The control panel to be cloned |
newName | Yes | Name of new control panel |
Example
1 2 3 4 5 | {
"cmd": "CopyPlacemarkTemplate",
"originName":"Temperatureplacemark",
"newName":"Powerplacemark"
}
|
DestroyPlacemarkTemplate¶
Delete Control.
Name | Required | Description |
---|---|---|
name | Yes | Name of Control to be deleted. |
Example
1 2 3 4 | {
"cmd": "DestroyPlacemarkTemplate",
"name":"Temperatureplacemark"
}
|
SetPlacemarkTemplateConfig¶
Modify Control configuration.
注解
this command will not modify look and feel of the control, to change control look and feel, please use command ‘SetPlacemarkProperty’.
Name | Required | Description |
---|---|---|
name | Yes | Name of Control to be deleted. |
path | Yes | List of properties to be modified, seperated by ‘/’ |
config | Yes | Target value |
Example
1 2 3 4 5 6 7 8 9 10 11 | {
"cmd": "SetPlacemarkTemplateConfig",
"name":"MonitoringPanel",
"path":"ProgressBar2/styleConfig",
"config":{
"0.25":[0.36,0.58,0.16],
"0.50":[1,0.83,0.4],
"0.75":[1,0.4,0],
"0.90":[1,0.15,0.15]
}
}
|
CreatePlacemark¶
Placemark Creator.
Name | Required | Default | Description |
---|---|---|---|
Object Reference | Yes | Object Reference | |
templateName | Yes | Name of the placemark template | |
placemarkId | No | Name of the placemark 注解 if placemark is created on the surface of object, placemarkId can be ignored. system will generate placemakrkId automatically using name conversion: |
|
type | No | Screen |
|
scale | No | [0.2,0.2,0.2] | placemark scale, used to control sizes of placemark |
presetPos | No | placemark position. if placemark type is ‘Plane’, use (x,y,z) as coordinate, if placemark type is ‘screen’, use (x,y) as coordinate. 注解 if ‘presetPos’ is not specified, and placemark is created against object, the placemark is located on the top of the object by default. |
|
posFromBuffer | No | Same as presetPos,set placemark position by buffer | |
layoutOffset | No | offset from target object, if placemark type is ‘Plane’, use (x,y,z) as coordinate, if placemark type is ‘screen’, use (x,y) as coordinate. | |
turnWhenNegative | No | Apply to (x,y) coordinate
|
|
countPerFrame | No | Number of placemark object can be shown simultaneously | |
additiveDataObjects | No | While placemark is created against object, target object be used as data source. If placemark need multiple data source , or not created against object, this parameter can be used to specifiy data source can be key-value, id, uid or buffer | |
updateTime | No | 1 | Data refresh interval in seconds, if placemark is linked to external data source |
Example
- Create a monitoring panel to an object without placemarkId
1 2 3 4 5 6 7 8 | {
"cmd": "CreatePlacemark",
"uid":"senser01",
"type":"Plane",
"templateName":"T&H Template",
"layoutOffset":[0,1,0],
"scale":[0.1,0.1,0.1]
}
|
- Create monitoring panel to multiple objects
1 2 3 4 5 6 7 8 | {
"cmd": "CreatePlacemark",
"fromBuffer":"allSenser",
"type":"Screen",
"templateName":"T&H Panel",
"layoutOffset":[0,50],
"countPerFrame":5
}
|
- Create 2D placemark with multiple data source
1 2 3 4 5 6 7 8 9 10 11 | {
"cmd": "CreatePlacemark",
"placemarkId":"Monitor01",
"type":"Screen",
"templateName":"MonitorPanel",
"presetPos":[0.5,50],
"additiveDataObjects":{
"ds1": "obj01" , //object id or uid
"ds2": {"ObjectManager": "RunBuffer/obj02"} //use buffer as data source
}
}
|
DestroyPlacemark¶
Destroy Placemark.
Name | Required | Description |
---|---|---|
Object Reference | Yes | Object Reference |
placemarkId | No | placemarkId |
templateName | No | If no placemarkId is specified while placemark is created, use {object uid}_{template name} as placemarkId,so templateName is need to delete placemark |
Example
- use object id and template name to destroy placemark
1 2 3 4 5 | {
"cmd": "DestroyPlacemark",
"uid":"obj01",
"templateName":"T&H Panel"
}
|
- use templateName to bulk delete placemark
1 2 3 4 5 | {
"cmd": "DestroyPlacemark",
"fromBuffer":"allSenser",
"templateName":"T&H Panel Template"
}
|
- use placemarkId to delete placemark
1 2 3 4 | {
"cmd": "DestroyPlacemark",
"placemarkId":"TH01"
}
|
GetLastClickedButtonPlacemarkHost¶
Simular to GetLastEventObj and GetLastMonitorRespondObj,click on placemark will return object reference.
Name | Required | Description |
---|---|---|
toBuffer | Yes | buffer which store the object |
Example
1 2 3 4 | {
"cmd": "GetLastClickedButtonPlacemarkHost",
"toBuffer":"lastPlacemarkHost"
}
|
SetPlacemarkProperty¶
Modify property of existing placemark.
Name | Required | Description |
---|---|---|
Object Reference | Yes | Object Reference |
placemarkId | No | Must specify placemarkId if placemark is created with placemarkId |
templateName | No | TemplateName, note that if placemark is created without placemarkId, system will use {object_uid}_{template name} as placemarkId |
widgetName | Yes | Control name |
property | Yes | Control property name |
value | Yes | “Value to be modified. 注解 system use strong type internally. String, number or boolean can be used as normal, for other data type, the name of data type need to be specified. for instance, vector3,color should be wrote as:
“ |
Example
- String, number or boolean used as normal
1 2 3 4 5 6 7 8 | {
"cmd": "SetPlacemarkProperty",
"uid":"obj01",
"templateName":"T&H Panel",
"widgetName":"Status",
"property":"text",
"value":"Normal"
}
|
- Specify data type if data type is vector3,color, etc.
1 2 3 4 5 6 7 8 | {
"cmd": "SetPlacemarkProperty",
"uid":"obj01",
"templateName":"T&H Panel",
"widgetName":"Progressbar2",
"property":"Color",
"value":{"Color":[1,0,0]}
}
|
CreateLayerPanel¶
A build-in, easy to use, multi-function Panel provided by system.
Name | Required | Description |
---|---|---|
config | Yes | config |
presetPos | No | Position, use (x,y) as coordinate 注解 default position is on top of object. |
posFromBuffer | No | Same as presetPos,set position from buffer |
turnWhenNegative | No | Apply to (x,y) coordinate
|
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | {
"cmd": "CreateLayerPanel",
"presetPos":[-100, 0.5],
"turnWhenNegative":true,
"config":{
//set panel size
"bgWidth": 150,
"bgHeight": 330,
//function groups
"groups":[
{
"name":"basic function",
"icon":"userimage/3534/CustomTexture/20150708325991.png", //icon path
"textConfig":{ //set text
"fontFamily": "Arial",
"fontSize": 18,
"drawSize": [100,38],
"verticalTextAlignment": "CENTER",
"fontColor": [1,1,1,1]
},
//multiable functions inside one function group
"items":[
{
"name":"warehouse_index",
"textConfig":{
"fontFamily": "Arial",
"fontSize": 14,
"fontColor": [0,0,0,1]
},
"initCmds":[ //run command after creation
{ "cmd":"ChangeLayerPanelItems","items":["warehouse_index"],"state":true } //set status as checked
],
"checkCmds":[ //run command if checked
{ "cmd":"ChangeLayerPanelItems","items":["TemperatureControl","humidityControl"],"state":false }, //uncheck other items
{ "cmd":"CreatePlacemark", "fromBuffer":{"ObjectManager": "RunBuffer/warehouse"}, "templateName" : "warehouse_index", "type":"screen", "countPerFrame":100000}
],
"unCheckCmds":[ //run command if unchecked
{ "cmd":"DestroyPlacemark", "fromBuffer":{"ObjectManager": "RunBuffer/warehouse"}, "templateName" : "warehouse_index"}
]
},
{
"name":"temperature monitoring",
//......
},
//......
]
},
{
"name":"advance settings",
//......
},
//......
]
}
}
|
DestroyLayerPanel¶
Destroy Layer Panel.
Parameters
No parameters.
Example
1 2 3 | {
"cmd": "DestroyLayerPanel"
}
|
ChangeLayerPanelItems¶
Check or uncheck panel item.
Name | Required | Description |
---|---|---|
items | Yes | Set check status by array |
state | Yes | true means check, false means uncheck |
Example
1 2 3 4 5 | {
"cmd": "ChangeLayerPanelItems",
"items":["Temperature Monitoring","Power Monitoring"],
"state":true
}
|
ShowLayerPanel¶
Show or hide Panel.
Name | Required | Description |
---|---|---|
enable | Yes | Panel name |
Example
1 2 3 4 5 | {
"cmd": "ChangeLayerPanelItems",
"items":["temperature monitoring","power monitoring"],
"enable":true
}
|
ShowHideLayerPanel¶
Show or hide panel.
Parameters
No parameters.
Example
1 2 3 | {
"cmd": "ShowHideLayerPanel"
}
|
ShowPropListPanel¶
A build-in, easy to use ‘object property panel’, can be also used to config function buttons.
Name | Required | Description |
---|---|---|
Object Reference | Yes | Object Reference |
config | Yes | Panel position, use (x,y) as coordinate. 注解 Default position is on top of object. |
posFromBuffer | No | Same as presetPos,set position from buffer |
turnWhenNegative | No | Apply to (x,y) coordinate
|
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | {
"cmd": "ShowPropListPanel",
"fromBuffer":{"ObjectManager": "RunBuffer/lastEventObj"},
"presetPos":[100, 0.5],
"turnWhenNegative":true,
"config":{
"initCmds":[ //run command after creation
{ "cmd":"CopyBuffer", "fromBuffer":{"ObjectManager":"RunBuffer/lastEventObj"}, "toBuffer":{"ObjectManager":"RunBuffer/curShowPanelObj"}} ,
{ "cmd":"ChangePropListPanelItems", "items":["basicInfo"], "state":true, "exeCommands":true } //set which button is clicked after creation
],
"items":[
{
"name":"basicInfo",
"normalColor":[0.415,0.839,0.462,1],//color on normal status
"highlightedColor":[0.337,0.666,0.372,1], //color on mouse over
"pressedColor":[0.415,0.839,0.462,1], //color on mouse click
"clickCmds":[
{ "cmd": "ChangePropListPanelItems", "items":["warehouseInfo","alarmInfo"], "state":false, "exeCommands":false},//uncheck other function button.
{ "cmd": "GetValue", "fromBuffer":{"ObjectManager":"RunBuffer/curShowPanelObj"}, "path":"MonitorDatas/RealTimeData", "toBuffer":{"ObjectManager":"RunBuffer/panelData"}},
{ "cmd": "SetPropListPanelKeyValue", "valueBuffer":{"ObjectManager":"RunBuffer/panelData"} ,"names":["warehouse_index","Catelog","Qualtity","Manager","UpdateTime","Power Consumption","CheckNumber"]}
]
},
{
"name":"Warehouse Info",
"clickCmds":[
{ "cmd": "ChangePropListPanelItems", "items":["basicInfo","alarmInfo"], "state":false, "exeCommands":false},
{ "cmd": "GetValue", "fromBuffer":{"ObjectManager":"RunBuffer/curShowPanelObj"}, "path":"MonitorDatas/RealTimeData", "toBuffer":{"ObjectManager":"RunBuffer/panelData"}},
{ "cmd": "SetPropListPanelKeyValue", "valueBuffer":{"ObjectManager":"RunBuffer/panelData"} ,"names":["Temperature","WarehouseTemperature"," Up"," MiddleUp"," MiddleDown"," Down","AvgTemperature","Humidity","InsectControl"]}
]
},
{
"name":"alarmInfo",
"clickCmds":[
{ "cmd": "ChangePropListPanelItems", "items":["basicInfo","warehouseInfo"], "state":"unclicked", "exeCommands":false},
{ "cmd": "GetValue", "fromBuffer":{"ObjectManager":"RunBuffer/curShowPanelObj"}, "path":"MonitorDatas/RealTimeData", "toBuffer":{"ObjectManager":"RunBuffer/panelData"}},
{ "cmd": "SetPropListPanelKeyValue", "valueBuffer":{"ObjectManager":"RunBuffer/panelData"} ,"names":["Temperature","Fire","InsectControl"]}
]
},
{
"name":"Barcode",
"clickCmds":[
{ "cmd": "GetValue", "fromBuffer":{"ObjectManager":"RunBuffer/curShowPanelObj"}, "path":"MonitorDatas/RealTimeData/barcode_url", "toBuffer":{"ObjectManager":"RunBuffer/barcode_url"}},
{ "cmd": "UrlWindow" ,"urlBuffer":{"ObjectManager":"RunBuffer/barcode_url"} ,"title":"Barcode", "width":"250" , "height":"250"}
]
}
]
}
}
|
HidePropListPanel¶
Hide property list panel.
Parameters
No parameters.
Example
1 2 3 | {
"cmd": "HidePropListPanel"
}
|
ChangePropListPanelItems¶
Change panel button status.
Name | Required | Description |
---|---|---|
items | Yes | Array to set button status in bulk |
state | Yes | ture means clicked, false means unclicked |
exeCommands | No | Run command while state changed to clicked |
Example
1 2 3 4 5 6 | {
"cmd": "ChangePropListPanelItems",
"items":["warehouseInfo","alarmInfo"],
"state":false,
"exeCommands":false
}
|
SetPropListPanelKeyValue¶
Show object property on panel.
Name | Required | Description |
---|---|---|
valueBuffer | Yes | Buffer name |
names | No | Get data from buffer by order of name array |
Example
1 2 3 4 5 | {
"cmd": "SetPropListPanelKeyValue",
"valueBuffer":{"ObjectManager":"RunBuffer/panelData"},
"names":["Temperature","Fire","InsectControl"]
}
|