package Rtz;
|
|
import art.library.model.devices.DeviceGraphicsRuntime;
|
import com.kitfox.svg.SVGDiagram;
|
import com.kitfox.svg.SVGElement;
|
|
public class RTZSchematic extends DeviceGraphicsRuntime
|
{
|
|
public RTZSchematic(art.library.model.devices.Device device, SVGDiagram diagram)
|
{
|
super(device, diagram);
|
}
|
|
private int position = 0;
|
|
private VAR_ColorQueue colorQueue = new VAR_ColorQueue();
|
|
public void timer()
|
{
|
position = (position + 1) % 2;
|
realtimeGroups();
|
}
|
|
public void status()
|
{
|
try
|
{
|
statusSubcontroller();
|
} catch (Exception e)
|
{
|
}
|
}
|
|
public void statusSubcontroller()
|
{
|
art.library.model.devices.colors.controller.RTZ32.RTZ32_Controller controller = (art.library.model.devices.colors.controller.RTZ32.RTZ32_Controller) getDevice();
|
art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerStatus controllerStatus = (art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerStatus) controller.getDeviceStatus();
|
art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation controllerInformation = (art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation) controller.getDeviceInformation();
|
art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status subcontrollerStatus = controllerStatus.rtz32;
|
art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerRealtime subcontrollerRealtime = (art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerRealtime) device.getDeviceRealtime();
|
art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerConfiguration subcontrollerConfiguration = (art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerConfiguration) device.getDeviceConfiguration();
|
|
java.util.Calendar calendardate = java.util.Calendar.getInstance();
|
calendardate.set(java.util.Calendar.MILLISECOND, 0);
|
long seconds = calendardate.getTimeInMillis() / 1000;
|
boolean even = seconds % 2 == 0;
|
|
SVGElement emergency = getElement("Emergency");
|
SVGElement lock = getElement("Lock");
|
SVGElement run = getElement("Run");
|
SVGElement remote = getElement("Remote");
|
SVGElement background = getElement("Background");
|
SVGElement border = getElement("Border");
|
SVGElement ribbon = getElement("Ribbon");
|
SVGElement elapsed1 = getElement("Elapsed1");
|
SVGElement elapsed2 = getElement("Elapsed2");
|
setAttribute(emergency, "fill-opacity", "1.0", 999);
|
setAttribute(lock, "fill-opacity", "1.0", 999);
|
setAttribute(run, "fill-opacity", "1.0", 999);
|
setAttribute(remote, "fill-opacity", "1.0", 999);
|
setAttribute(emergency, "fill", "#804080", 999);
|
setAttribute(lock, "fill", "#804080", 999);
|
setAttribute(run, "fill", "#804080", 999);
|
setAttribute(remote, "fill", "#804080", 999);
|
setText("Text number", String.format("%05d", controllerInformation.number));
|
setText("Text information", "");
|
setText("Text offset", "");
|
setText("Text cycle", "");
|
setText("Text elapsed", "");
|
|
setAttribute("Text information", "fill", "#FFFFFF");
|
setAttribute("Text offset", "fill", "#FFFFFF");
|
setAttribute("Text cycle", "fill", "#FFFFFF");
|
|
setAttribute(elapsed1, "display", "none");
|
setAttribute(elapsed2, "display", "none");
|
setAttribute(border, "stroke", "#800080");
|
setAttribute(border, "display", "inline");
|
setAttribute(border, "stroke-width", 6.5);
|
setAttribute(border, "stroke-opacity", 0.75);
|
setAttribute(ribbon, "stroke-opacity", 0.50);
|
setAttribute(ribbon, "stroke", "#FF80FF");
|
setAttribute(background, "fill", "#FF80FF");
|
|
switch (controllerStatus.status)
|
{
|
case art.library.model.devices.DeviceStatus.STATUS_ONLINE:
|
break;
|
case art.library.model.devices.DeviceStatus.STATUS_WARNING:
|
break;
|
case art.library.model.devices.DeviceStatus.STATUS_ALARM:
|
break;
|
case art.library.model.devices.DeviceStatus.STATUS_DISABLE:
|
setAttribute(background, "fill", "#404040");
|
setAttribute(ribbon, "stroke", "#404040");
|
setAttribute(border, "stroke", "#808080");
|
setAttribute(border, "display", "inline");
|
setAttribute(border, "stroke-width", 6.5);
|
setAttribute(border, "stroke-opacity", 1.0);
|
setAttribute(emergency, "fill-opacity", "0.0", 999);
|
setAttribute(lock, "fill-opacity", "0.0", 999);
|
setAttribute(run, "fill-opacity", "0.0", 999);
|
setAttribute(remote, "fill-opacity", "0.0", 999);
|
return;
|
case art.library.model.devices.DeviceStatus.STATUS_SIMULATION:
|
setAttribute(background, "fill", "#0000FF");
|
setAttribute(ribbon, "stroke", "#0000FF");
|
setAttribute(border, "stroke", "#000080");
|
setAttribute(border, "display", "inline");
|
setAttribute(border, "stroke-width", 6.5);
|
setAttribute(border, "stroke-opacity", 1.0);
|
break;
|
case art.library.model.devices.DeviceStatus.STATUS_INVALID:
|
case art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerStatus.STATUS_OFFLINE_CONTROLLER:
|
case art.library.model.devices.DeviceStatus.STATUS_OFFLINE:
|
case art.library.model.devices.DeviceStatus.STATUS_UNKNOWN:
|
|
java.awt.Color offline = java.awt.Color.decode("#FF00FF");
|
String offlineHex = String.format("#%02x%02x%02x", offline.getRed(), offline.getGreen(), offline.getBlue());
|
String offlineDarkerHex = String.format("#%02x%02x%02x", offline.darker().darker().getRed(), offline.darker().darker().getGreen(), offline.darker().darker().getBlue());
|
|
setAttribute(background, "fill", even ? offlineHex : offlineDarkerHex);
|
setAttribute(ribbon, "stroke", even ? offlineHex : offlineDarkerHex);
|
setAttribute(border, "stroke", even ? offlineHex : offlineDarkerHex);
|
setAttribute(border, "display", "inline");
|
setAttribute(border, "stroke-width", 6.5);
|
setAttribute(border, "stroke-opacity", 1.0);
|
|
if (controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_NON_CENTRALIZED)
|
{
|
setAttribute(background, "fill", "#80531c");
|
setAttribute(ribbon, "stroke", "#80531c");
|
setAttribute(border, "stroke", "#80531c");
|
}
|
|
return;
|
}
|
|
if (controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_NON_CENTRALIZED)
|
{
|
setAttribute(background, "fill", "#80531c");
|
setAttribute(ribbon, "stroke", "#80531c");
|
setAttribute(border, "stroke", "#80531c");
|
}
|
|
if (subcontrollerStatus.forcings != null
|
&& (subcontrollerStatus.forcings.centralized != null
|
|| subcontrollerStatus.forcings.colorsMode != null
|
|| subcontrollerStatus.forcings.computerMode != null
|
|| subcontrollerStatus.forcings.control != null
|
|| subcontrollerStatus.forcings.plan != null))
|
{
|
setAttribute(lock, "fill-opacity", "1.0", 999);
|
setAttribute(lock, "fill", "#FF0000", 999);
|
}
|
else
|
{
|
setAttribute(lock, "fill-opacity", "0.15", 999);
|
setAttribute(lock, "fill", "#000000", 999);
|
}
|
if (subcontrollerStatus.general.emergency == true)
|
{
|
setAttribute(emergency, "fill-opacity", "1.0", 999);
|
} else if (subcontrollerStatus.general.emergency == false)
|
{
|
setAttribute(emergency, "fill-opacity", "0.15", 999);
|
setAttribute(emergency, "fill", "#000000", 999);
|
}
|
|
switch (subcontrollerStatus.general.planMode)
|
{
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.PLAN_MODE_ONLINE_ORDERS:
|
{
|
break;
|
}
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.PLAN_MODE_TIMETABLE:
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.PLAN_MODE_DELAYED_ORDERS:
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.PLAN_MODE_DYNAMIC_SELECTION:
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.PLAN_MODE_FORCED:
|
{
|
break;
|
}
|
}
|
|
setAttribute("Text information", "display", "iniline", 999);
|
setAttribute("Text offset", "display", "iniline", 999);
|
setAttribute("Text cycle", "display", "iniline", 999);
|
|
if ((subcontrollerStatus.general.control == art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.CONTROL_COMPUTER))
|
{
|
setAttribute(remote, "fill-opacity", "1.0", 999);
|
setAttribute(remote, "fill", "#0000FF", 999);
|
} else
|
{
|
setAttribute(remote, "fill-opacity", "0.15", 999);
|
setAttribute(remote, "fill", "#000000", 999);
|
}
|
if (subcontrollerRealtime != null && subcontrollerRealtime.rtz32 != null && subcontrollerRealtime.rtz32.junctionRealtime == true)
|
{
|
setAttribute(run, "fill-opacity", "1.0", 999);
|
setAttribute(run, "fill", "#0000FF", 999);
|
} else
|
{
|
setAttribute(run, "fill-opacity", "0.15", 999);
|
setAttribute(run, "fill", "#000000", 999);
|
}
|
double strokeopacity = Math.pow(2, controller.getDeviceAlarms().getServerityAlarm()) / 32;
|
if (controller.getDeviceAlarms().getServerityAlarm() > 0)
|
{
|
setAttribute(border, "display", "inline");
|
setAttribute(border, "stroke", "#FF0000");
|
setAttribute(border, "stroke-opacity", strokeopacity);
|
setAttribute(border, "stroke-width", 6.5 + (6.5 * strokeopacity));
|
} else
|
{
|
setAttribute(border, "stroke", "#808080");
|
setAttribute(border, "display", "inline");
|
setAttribute(border, "stroke-width", 6.5);
|
setAttribute(border, "stroke-opacity", 1.0);
|
}
|
|
|
|
|
switch (subcontrollerStatus.general.state)
|
{
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.STATE_UNKNOWN:
|
setAttribute(background, "fill", "#808080");
|
setAttribute(ribbon, "stroke", "#808080");
|
setAttribute(elapsed2, "fill", "#808080");
|
setText("Text information", "OFF");
|
return;
|
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.STATE_FLASHING:
|
setAttribute("Text information", "display","none",999);
|
setAttribute("Text offset", "display","none",999);
|
setAttribute("Text cycle", "display","none",999);
|
|
if (even)
|
{
|
setAttribute(background, "fill", "#FFFF00");
|
setAttribute(ribbon, "stroke", "#FFFF00");
|
setAttribute(elapsed2, "fill", "#FFFF00");
|
} else
|
{
|
setAttribute(background, "fill", "#808000");
|
setAttribute(ribbon, "stroke", "#808000");
|
setAttribute(elapsed2, "fill", "#808000");
|
}
|
setText("Text information", "Y^");
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.STATE_STARTUP:
|
if (subcontrollerStatus.general.emergency == true)
|
{
|
setAttribute(background, "fill", even ? "#FF8000" : "#804000");
|
setAttribute(ribbon, "stroke", even ? "#FF8000" : "#804000");
|
setAttribute(elapsed2, "fill", even ? "#FF8000" : "#804000");
|
} else if (subcontrollerStatus.general.control == art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.CONTROL_LOCAL)
|
{
|
setAttribute(background, "fill", even ? "#008000" : "#004000");
|
setAttribute(ribbon, "stroke", even ?"#008000" : "#004000");
|
setAttribute(elapsed2, "fill",even ? "#008000" : "#004000");
|
} else
|
{
|
setAttribute(background, "fill", even ? "#00FF00" : "#008000");
|
setAttribute(ribbon, "stroke", even ? "#00FF00" : "#008000");
|
setAttribute(elapsed2, "fill", even ? "#00FF00" : "#008000");
|
}
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.STATE_COLORS:
|
if (subcontrollerStatus.general.emergency == true)
|
{
|
setAttribute(background, "fill", "#FF8000");
|
setAttribute(ribbon, "stroke", "#FF8000");
|
setAttribute(elapsed2, "fill", "#FF8000");
|
}
|
else if (subcontrollerStatus.general.control == art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.CONTROL_LOCAL)
|
{
|
setAttribute(background, "fill", "#008000");
|
setAttribute(ribbon, "stroke", "#008000");
|
setAttribute(elapsed2, "fill", "#008000");
|
} else
|
{
|
setAttribute(background, "fill", "#00FF00");
|
setAttribute(ribbon, "stroke", "#00FF00");
|
setAttribute(elapsed2, "fill", "#00FF00");
|
}
|
break;
|
}
|
art.library.model.devices.colors.controller.RTZ32.configuration.RTZ32_Configuration_Program plan = null;
|
if (subcontrollerStatus.plan != null && subcontrollerStatus.plan.number > 0)
|
{
|
try
|
{
|
plan = subcontrollerConfiguration.rtz32.getProgram(subcontrollerStatus.plan.number);
|
} catch (Exception e)
|
{
|
}
|
}
|
|
if (plan != null)
|
{
|
|
String information = "";
|
|
if (subcontrollerStatus.general.master)
|
information = "M";
|
else if (subcontrollerStatus.general.slave)
|
information = "SL";
|
else if (subcontrollerStatus.general.microregulated)
|
information = "MR";
|
else if (subcontrollerStatus.general.semiactuated)
|
information = "S";
|
else if (subcontrollerStatus.general.actuated)
|
information = "A";
|
else
|
information = "N";
|
|
information = information + plan.number;
|
|
switch (subcontrollerStatus.general.planMode)
|
{
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.PLAN_MODE_DELAYED_ORDERS:
|
information = information + "d";
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.PLAN_MODE_DYNAMIC_SELECTION:
|
information = information + "ds";
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.PLAN_MODE_FORCED:
|
information = information + "f";
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.PLAN_MODE_ONLINE_ORDERS:
|
information = information + "o";
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.PLAN_MODE_TIMETABLE:
|
information = information + "t";
|
break;
|
}
|
|
setText("Text information", information);
|
if (plan.offset > 0)
|
{
|
setText("Text offset", "" + plan.offset);
|
} else
|
{
|
setText("Text offset", "");
|
}
|
setText("Text cycle", "" + plan.cycle);
|
|
if (subcontrollerRealtime != null)
|
{
|
try
|
{
|
String text = subcontrollerRealtime.rtz32.phase.phaseNumber + ":" + subcontrollerRealtime.rtz32.counters.cycle;
|
|
setText("Text elapsed", text);
|
setAttribute(elapsed1, "display", "inline");
|
setAttribute(elapsed2, "display", "inline");
|
int elapsedWidth = getAttributeInteger(elapsed1, "width") - 2;
|
float ratio = 1;
|
setAttribute(elapsed2, "width", (elapsedWidth * Math.min(1.0f, ratio)));
|
update(elapsed2);
|
} catch (Exception ex)
|
{
|
}
|
}
|
|
java.awt.Color bckColor = java.awt.Color.decode(background.getStyleAbsolute("fill").getStringValue());
|
java.awt.Color darkerColor = bckColor.darker();
|
String darkHex = String.format("#%02x%02x%02x", darkerColor.darker().getRed(), darkerColor.darker().getGreen(), darkerColor.darker().getBlue());
|
|
setAttribute("Text information", "fill", darkHex, 999);
|
setAttribute("Text offset", "fill", darkHex, 999);
|
setAttribute("Text cycle", "fill", darkHex, 999);
|
|
setAttribute(emergency, "fill", darkHex, 999);
|
setAttribute(lock, "fill", darkHex, 999);
|
setAttribute(run, "fill", darkHex, 999);
|
setAttribute(remote, "fill", darkHex, 999);
|
}
|
}
|
|
public void paintNoStatusAvailable()
|
{
|
art.library.model.devices.colors.controller.M.M_Controller controller = (art.library.model.devices.colors.controller.M.M_Controller) getDevice();
|
SVGElement thunderbolt = getElement("Thunderbolt");
|
SVGElement emergency = getElement("Emergency");
|
SVGElement lock = getElement("Lock");
|
SVGElement calendar = getElement("Calendar");
|
SVGElement run = getElement("Run");
|
SVGElement remote = getElement("Remote");
|
SVGElement background = getElement("Background");
|
SVGElement border = getElement("Border");
|
SVGElement ribbon = getElement("Ribbon");
|
SVGElement elapsed1 = getElement("Elapsed1");
|
SVGElement elapsed2 = getElement("Elapsed2");
|
setAttribute(thunderbolt, "fill-opacity", "1.0", 999);
|
setAttribute(emergency, "fill-opacity", "1.0", 999);
|
setAttribute(lock, "fill-opacity", "1.0", 999);
|
setAttribute(calendar, "fill-opacity", "1.0", 999);
|
setAttribute(run, "fill-opacity", "1.0", 999);
|
setAttribute(remote, "fill-opacity", "1.0", 999);
|
setAttribute(thunderbolt, "fill", "#804080", 999);
|
setAttribute(emergency, "fill", "#804080", 999);
|
setAttribute(lock, "fill", "#804080", 999);
|
setAttribute(calendar, "fill", "#804080", 999);
|
setAttribute(run, "fill", "#804080", 999);
|
setAttribute(remote, "fill", "#804080", 999);
|
setText("Text number", String.format("%05d", controller.getDeviceInformation().number));
|
setText("Text information", "");
|
setText("Text offset", "");
|
setText("Text cycle", "");
|
setText("Text elapsed", "");
|
setAttribute(elapsed1, "display", "none");
|
setAttribute(elapsed2, "display", "none");
|
setAttribute(ribbon, "stroke-opacity", 0.50);
|
setAttribute(background, "fill", "#FF00FF");
|
setAttribute(ribbon, "stroke", "#FF00FF");
|
setAttribute(border, "stroke", "#FF00FF");
|
setAttribute(border, "display", "inline");
|
setAttribute(border, "stroke-width", 6.5);
|
setAttribute(border, "stroke-opacity", 1.0);
|
}
|
|
private SVGElement getARTElement(String element)
|
{
|
return getElementsContainingField("art.id").stream().filter(el -> el.getPresAbsolute("art.id").getStringValue().equals(getDevice().getIdentifier() + "." + element)).findAny().orElse(null);
|
}
|
|
enum GROUP_COLORS
|
{
|
OFF("#4B4B4B"),
|
V("#00FF00"),
|
A("#FFFF000"),
|
R("#FF0000");
|
|
private final String color;
|
|
private GROUP_COLORS(String color)
|
{
|
this.color = color;
|
}
|
|
@Override
|
public String toString()
|
{
|
return color;
|
}
|
}
|
|
enum GROUP_STATE
|
{
|
OFF(null,null),
|
GO("#00FF00", null),
|
STOP(null,"#FF0000"),
|
UNKNWON("#FF00FF","#FF00FF");
|
|
private final String colorGo;
|
private final String colorStop;
|
|
private GROUP_STATE(String colorGo, String colorStop)
|
{
|
this.colorGo = colorGo;
|
this.colorStop = colorStop;
|
}
|
|
public static GROUP_STATE getState(int state)
|
{
|
switch (state)
|
{
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_OFF: return GROUP_STATE.OFF;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_V: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_A: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_R: return GROUP_STATE.STOP;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_VI: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_AI: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_RI: return GROUP_STATE.STOP;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_ViAI: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_RiAI: return GROUP_STATE.STOP;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_VAI: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_RAI: return GROUP_STATE.STOP;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_AIVI: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_AIRI: return GROUP_STATE.STOP;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_RiVi: return GROUP_STATE.STOP;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_AR: return GROUP_STATE.STOP;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_Vi: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_VA: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_VR: return GROUP_STATE.STOP;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_VAR: return GROUP_STATE.STOP;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_Vd: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_VId: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_Vid: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.Rd: return GROUP_STATE.STOP;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_AIe: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_Ae: return GROUP_STATE.GO;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_Re: return GROUP_STATE.STOP;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_OFFe: return GROUP_STATE.OFF;
|
default:
|
return GROUP_STATE.UNKNWON;
|
}
|
}
|
|
public java.util.Optional<String> getGoStateColor()
|
{
|
return java.util.Optional.ofNullable(colorGo);
|
}
|
|
public java.util.Optional<String> getStopStateColor()
|
{
|
return java.util.Optional.ofNullable(colorStop);
|
}
|
}
|
|
public void realtimeGroups()
|
{
|
art.library.model.devices.colors.controller.RTZ32.RTZ32_Controller controller = (art.library.model.devices.colors.controller.RTZ32.RTZ32_Controller) getDevice();
|
art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerRealtime controllerRealtime = controller.getDeviceRealtime();
|
/* Realtime groups */ java.util.List<SVGElement> groups = getElements("art.group");
|
|
java.util.List<SVGElement> lGoElements = getElements("art.type","go");
|
java.util.List<SVGElement> lStopElements = getElements("art.type","stop");
|
|
lGoElements.forEach(g -> setAttribute(g, "display", "none", 999));
|
lStopElements.forEach(g -> setAttribute(g, "display", "none", 999));
|
|
if (controllerRealtime == null)
|
{
|
groups.forEach(g -> setAttribute(g, "fill", "#FF00FF"));
|
|
return;
|
}
|
|
for (SVGElement group : groups.stream().filter(el -> !lGoElements.contains(el) && !lStopElements.contains(el)).toArray(SVGElement[]::new))
|
{
|
int number = getAttributeInteger(group, "art.group");
|
setAttribute(group, "fill", "#808000");
|
try
|
{
|
int color = controllerRealtime.rtz32.cycles.get(controllerRealtime.rtz32.cycles.size() - 1).impulsesGroups
|
.get(controllerRealtime.rtz32.cycles.get(controllerRealtime.rtz32.cycles.size() - 1).impulsesGroups.size() -1)
|
.colors[number - 1];
|
|
switch (color)
|
{
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_OFF:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.OFF.toString() : GROUP_COLORS.OFF.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_V:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.V.toString() : GROUP_COLORS.V.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_A:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.A.toString() : GROUP_COLORS.A.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_R:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.R.toString() : GROUP_COLORS.R.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_VI:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.V.toString() : GROUP_COLORS.OFF.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_AI:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.A.toString() : GROUP_COLORS.OFF.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_RI:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.R.toString() : GROUP_COLORS.OFF.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_ViAI:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.OFF.toString() : GROUP_COLORS.A.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_RiAI:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.OFF.toString() : GROUP_COLORS.A.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_VAI:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.V.toString() : GROUP_COLORS.A.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_RAI:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.R.toString() : GROUP_COLORS.A.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_AIVI:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.A.toString() : GROUP_COLORS.OFF.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_AIRI:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.A.toString() : GROUP_COLORS.OFF.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_RiVi:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.R.toString() : GROUP_COLORS.V.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_AR:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.A.toString() : GROUP_COLORS.R.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_Vi:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.V.toString() : GROUP_COLORS.OFF.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_VA:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.V.toString() : GROUP_COLORS.A.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_VR:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.V.toString() : GROUP_COLORS.R.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_VAR:
|
setAttribute(group, "fill", position == 0 ? colorQueue.getNextColor().toString() : colorQueue.getNextColor().toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_Vd:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.V.toString() : GROUP_COLORS.V.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_VId:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.V.toString() : GROUP_COLORS.OFF.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_Vid:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.V.toString() : GROUP_COLORS.OFF.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.Rd:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.R.toString() : GROUP_COLORS.R.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_AIe:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.A.toString() : GROUP_COLORS.OFF.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_Ae:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.A.toString() : GROUP_COLORS.A.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_Re:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.R.toString() : GROUP_COLORS.R.toString());
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.configuration.constants.RTZ32_Constants_Colors.COLOR_OFFe:
|
setAttribute(group, "fill", position == 0 ? GROUP_COLORS.OFF.toString() : GROUP_COLORS.OFF.toString());
|
break;
|
}
|
|
GROUP_STATE currentState = GROUP_STATE.getState(color);
|
|
lGoElements.stream().filter(element -> getAttributeInteger(element, "art.group") == number).forEach(element ->
|
{
|
java.util.Optional<String> stateColor = currentState.getGoStateColor();
|
|
if (stateColor.isPresent())
|
{
|
if (controllerRealtime != null) setAttribute(element, "display", "inline", 999);
|
setAttribute(element, "stroke", stateColor.get(), 999);
|
}
|
else setAttribute(element, "display", "none",999);
|
|
});
|
|
lStopElements.stream().filter(element -> getAttributeInteger(element, "art.group") == number).forEach(element ->
|
{
|
java.util.Optional<String> stateColor = currentState.getStopStateColor();
|
|
if(stateColor.isPresent())
|
{
|
if (controllerRealtime != null) setAttribute(element, "display", "inline",999);
|
setAttribute(element, "stroke", stateColor.get(),999);
|
}
|
else setAttribute(element, "display", "none",999);
|
});
|
}
|
catch (Exception e)
|
{
|
setAttribute(group, "fill", "#C000C0");
|
}
|
}
|
}
|
|
|
private class VAR_ColorQueue
|
{
|
final GROUP_COLORS[] colorSequence = new GROUP_COLORS[]
|
{
|
GROUP_COLORS.V,
|
GROUP_COLORS.A,
|
GROUP_COLORS.R
|
};
|
|
private int lastColor = 0;
|
|
|
public GROUP_COLORS getNextColor()
|
{
|
if(lastColor >= colorSequence.length - 1)
|
lastColor = 0;
|
else
|
lastColor++;
|
|
return colorSequence[lastColor];
|
}
|
}
|
|
}
|