如何根据其功能更改静脉车辆图标的颜色?
在tictoc 2示例中,可以通过从您的文件中更改@display(“ i =,青色”)来实现。
答案 0 :(得分:0)
在应用程序代码的开头添加以下行:
#define black TraCIColor(0,0,0,0)
#define red TraCIColor(255,0,0,0)
#define green TraCIColor(0,255,0,0)
#define yellow TraCIColor(255,255,0,0)
#define blue TraCIColor(0,0,255,0)
#define violet TraCIColor(255,0,255,0)
#define cyan TraCIColor(0,255,255,0)
#define white TraCIColor(255,255,255,0)
然后,要将颜色设置为编号为carId的汽车的绿色,请在代码中添加以下几行:
self = getParentModule()->getIndex();
traciVehicle = mobility->getVehicleCommandInterface();
if(self==carId) traciVehicle->setColor(green);