From e68f1da78bc96da5410d19e0486446917d263fc6 Mon Sep 17 00:00:00 2001
From: Alejandro Acuña <alejandro.acuna@aluvisagrupo.com>
Date: Mon, 07 Oct 2024 06:39:12 +0000
Subject: [PATCH] bacl
---
svgDevicesTest/src/Rtz/RtzMapComplex.java | 307 +++++++++++++++++++++++++--------------------------
1 files changed, 151 insertions(+), 156 deletions(-)
diff --git a/svgDevicesTest/src/Rtz/RtzMapComplex.java b/svgDevicesTest/src/Rtz/RtzMapComplex.java
index 0f36ffb..cad8a33 100644
--- a/svgDevicesTest/src/Rtz/RtzMapComplex.java
+++ b/svgDevicesTest/src/Rtz/RtzMapComplex.java
@@ -17,7 +17,7 @@
super(device, commands, diagram);
}
- public void status()
+ public void status()
{
try
{
@@ -28,7 +28,12 @@
}
public void statusSubcontroller()
- {
+ {
+ 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;
+
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();
@@ -36,11 +41,6 @@
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");
@@ -58,87 +58,103 @@
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 number", String.format("%04d", 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");
+ try
+ {
+ if (art.client.models.Shared.configuration.general.darkMap == true)
+ {
+ setAttribute("Text number", "fill", "#FFFFFF");
+ setAttribute("Text information", "fill", "#FFFFFF");
+ setAttribute("Text offset", "fill", "#FFFFFF");
+ setAttribute("Text cycle", "fill", "#FFFFFF");
+ } else
+ {
+ setAttribute("Text number", "fill", "#000000");
+ setAttribute("Text information", "fill", "#000000");
+ setAttribute("Text offset", "fill", "#000000");
+ setAttribute("Text cycle", "fill", "#000000");
+ }
+ } catch (Exception ex)
+ {
+ }
+
setAttribute(elapsed1, "display", "none");
setAttribute(elapsed2, "display", "none");
- setAttribute(border, "stroke", "#800080");
+ /* 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");
+ setAttribute(border, "stroke", "#FFFFFF",999);
+ setAttribute(background, "fill", "#FFFFFF",999);
+ setAttribute(ribbon, "stroke", "#FFFFFF",999);
}
+ else
+ {
+ setAttribute(border, "display", "none", 999);
+
+ if (controllerStatus.rtz32.centralized.centralized == false)
+ {
+ setAttribute(border, "fill", "#808080", 999);
+ setAttribute(background, "fill", "#808080", 999);
+ setAttribute(ribbon, "stroke", "#808080", 999);
+ }
+ else
+ {
+ boolean semiactuated = controllerStatus.rtz32.general.semiactuated ;
+ boolean offline = false;
+
+ if (device.getAlarm("alarm_controller_offline") > 0 || device.getAlarm("alarm_offline") > 0)
+ {
+ offline = true;
+ setAttribute(background, "display", even ? "inline" : "none", 999);
+ }
+
+ if (controllerStatus.rtz32.general.control == art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.CONTROL_COMPUTER)
+ {
+ setAttribute(background, "fill", "#00FF00", 999);
+ setAttribute(ribbon, "stroke", "#00FF00", 999);
+
+ if(offline == true)
+ {
+ setAttribute(background, "display", even || semiactuated ? "none" : "inline", 999);
+ }
+ }
+ else if (controllerStatus.rtz32.general.control == art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.CONTROL_LOCAL)
+ {
+ setAttribute(background, "fill", "#FF0000", 999);
+ setAttribute(ribbon, "stroke", "#FF0000", 999);
+
+ if (offline == true)
+ {
+ setAttribute(background, "display", even ? "none" : "inline", 999);
+ }
+ }
+ if (device.getAlarm("alarm_controller_offline") <= 0 && device.getAlarm("alarm_offline") <= 0)
+ {
+ if (art.library.model.devices.colors.controller.RTZ32.RTZ32_Controller.class.cast(device).getDeviceAlarms().rtz32.flashing.getServerityAlarm() > 0)
+ {
+ setAttribute(background, "fill", "#FFFF00", 999);
+ setAttribute(ribbon, "stroke", "#FFFF00", 999);
+ setAttribute(background, "display", even ? "inline" : "none", 999);
+
+ }
+ }
+ }
+ }
+
if (subcontrollerStatus.forcings != null
&& (subcontrollerStatus.forcings.centralized != null
|| subcontrollerStatus.forcings.colorsMode != null
@@ -148,13 +164,12 @@
{
setAttribute(lock, "fill-opacity", "1.0", 999);
setAttribute(lock, "fill", "#FF0000", 999);
- }
- else
+ } else
{
setAttribute(lock, "fill-opacity", "0.15", 999);
setAttribute(lock, "fill", "#000000", 999);
}
- if (subcontrollerStatus.general.emergency == true)
+ if (subcontrollerStatus.general.emergency == true)
{
setAttribute(emergency, "fill-opacity", "1.0", 999);
} else if (subcontrollerStatus.general.emergency == false)
@@ -162,21 +177,8 @@
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);
@@ -186,7 +188,7 @@
{
setAttribute(remote, "fill-opacity", "1.0", 999);
setAttribute(remote, "fill", "#0000FF", 999);
- } else
+ } else
{
setAttribute(remote, "fill-opacity", "0.15", 999);
setAttribute(remote, "fill", "#000000", 999);
@@ -200,8 +202,10 @@
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)
+
+ /* if (controller.getDeviceAlarms().getServerityAlarm() > 0)
{
setAttribute(border, "display", "inline");
setAttribute(border, "stroke", "#FF0000");
@@ -213,31 +217,33 @@
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(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);
+ 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(background, "fill", "#FFFF00");
+ setAttribute(ribbon, "stroke", "#FFFF00");*/
setAttribute(elapsed2, "fill", "#FFFF00");
} else
{
- setAttribute(background, "fill", "#808000");
- setAttribute(ribbon, "stroke", "#808000");
+ /* setAttribute(background, "fill", "#808000");
+ setAttribute(ribbon, "stroke", "#808000");*/
setAttribute(elapsed2, "fill", "#808000");
}
setText("Text information", "Y^");
@@ -245,36 +251,37 @@
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(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");
+ /* 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(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(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)
+ }
+ 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(background, "fill", "#008000");
+ setAttribute(ribbon, "stroke", "#008000");*/
setAttribute(elapsed2, "fill", "#008000");
} else
{
- setAttribute(background, "fill", "#00FF00");
- setAttribute(ribbon, "stroke", "#00FF00");
+ /* setAttribute(background, "fill", "#00FF00");
+ setAttribute(ribbon, "stroke", "#00FF00");*/
setAttribute(elapsed2, "fill", "#00FF00");
}
break;
@@ -285,46 +292,36 @@
try
{
plan = subcontrollerConfiguration.rtz32.getProgram(subcontrollerStatus.plan.number);
- }
- catch (Exception e)
+ } catch (Exception e)
{
}
}
-
+
if (plan != null)
{
-
+
String information = "";
- if(controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_CENTRALIZED)
- {
- information = art.client.models.Shared.getMessage("C");
- }
- else if(controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_CENTRALIZED_TROLLEY)
- {
- information = art.client.models.Shared.getMessage("CTw");
- }
- else if(controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_CENTRALIZED_MASTER_SLAVE)
- {
- information = art.client.models.Shared.getMessage("M-E");
- }
- else if(controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_CENTRALIZED_MASTER)
- {
- information = art.client.models.Shared.getMessage("M");
- }
- else if(controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_CENTRALIZED_SLAVE)
- {
- information = art.client.models.Shared.getMessage("E");
- }
- else if(controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_NON_CENTRALIZED)
- {
- information = art.client.models.Shared.getMessage("N");
- }
-
+ if (controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_CENTRALIZED)
+ information = "C";
+ else if (controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_CENTRALIZED_MASTER)
+ information = "M";
+ else if (controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_CENTRALIZED_MASTER_SLAVE)
+ information = "M-E";
+ else if (controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_CENTRALIZED_SLAVE)
+ information = "E";
+ else if (controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_CENTRALIZED_SLAVE_MASTER)
+ information = "E-M";
+ else if (controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_CENTRALIZED_TROLLEY)
+ information = "CTw";
+ else if (controllerInformation.mode == art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation.MODE_NON_CENTRALIZED)
+ information = "NC";
+ else
+ information = "?";
information = information + plan.number;
- /* switch (subcontrollerStatus.general.planMode)
+ switch (subcontrollerStatus.general.planMode)
{
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.PLAN_MODE_DELAYED_ORDERS:
information = information + "d";
@@ -342,7 +339,7 @@
information = information + "t";
break;
}
- */
+
setText("Text information", information);
if (plan.offset > 0)
{
@@ -351,9 +348,8 @@
{
setText("Text offset", "");
}
-
setText("Text cycle", "" + plan.cycle);
-
+
if (subcontrollerRealtime != null)
{
try
@@ -367,12 +363,11 @@
float ratio = 1;
setAttribute(elapsed2, "width", (elapsedWidth * Math.min(1.0f, ratio)));
update(elapsed2);
- }
- catch (Exception ex)
+ } 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());
@@ -414,7 +409,7 @@
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 number", String.format("%04d", controller.getDeviceInformation().number));
setText("Text information", "");
setText("Text offset", "");
setText("Text cycle", "");
@@ -434,10 +429,10 @@
{
final String colorNoCommandsBorder = "#00007C";
final String colorNoCommandsBackground = "#7C7CFA";
-
+
final String colorCommandsBorder = "#007C00";
final String colorCommandsBackground = "#7CFA7C";
-
+
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_ControllerInformation controllerInformation = (art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation) controller.getDeviceInformation();
@@ -446,7 +441,6 @@
SVGElement ribbon = getElement("Ribbon");
SVGElement emergency = getElement("Emergency");
-
SVGElement lock = getElement("Lock");
SVGElement run = getElement("Run");
SVGElement remote = getElement("Remote");
@@ -464,13 +458,14 @@
setAttribute(run, "fill", !getDeviceCommands().isEmpty() ? colorCommandsBackground : colorNoCommandsBackground, 999);
setAttribute(remote, "fill", !getDeviceCommands().isEmpty() ? colorCommandsBackground : colorNoCommandsBackground, 999);
- setText("Text number", String.format("%05d", controllerInformation.number));
+ setText("Text number", String.format("%04d", controllerInformation.number));
setAttribute("Text information", "display", "none", 999);
setAttribute("Text offset", "display", "none", 999);
setAttribute("Text cycle", "display", "none", 999);
setAttribute("Text elapsed", "display", "none", 999);
- }
+ }
+
// java.io.StringWriter sw = new java.io.StringWriter();
// art.library.gui.flat.FlatDialog.showDialog(null, "Error", e.getMessage() + "\n\n" + sw.toString(), true, art.library.gui.flat.FlatDialog.DIALOG_ERROR);
--
Gitblit v1.10.0