Adds initial intermediate qt6 porting state

This commit is contained in:
torsten committed 2026-08-17 17:54:56 +02:00
1 parent 99136e9460
commit d176b5e0d7
11247 files changed
+1891537

No files matched your search

@@ -0,0 +1,57 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep WARN /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,56 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="A2 A3a A3b A3c A4a A4b A4c A4d A5 A6a A6b A6c A7 B1 B2 B3 B4 B5 B6 B7 B8 B9a B9b B9c B9d B9e B9f B9g B9h B9i B9j B9k B9l B9m B9n B9o B9p B9q B9r B10a B10b B10c B10d B10e B10f B10g B10h B10i B10j B10k B10l B10m B10n B11a B11b B11c B11d"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshesAHTC/opt/BuildingModels/StaticMeshes//bldg_BN_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshesAHTC/opt/BuildingModels/StaticMeshes//bldg_BN_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,62 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "------------------------------------";
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,66 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "------------------------------------";
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,68 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "------------------------------------";
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,72 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "------------------------------------";
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,79 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "------------------------------------";
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,84 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "------------------------------------";
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,95 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "------------------------------------";
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,101 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "------------------------------------";
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,107 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "------------------------------------";
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,120 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
numOk=0;
numFailure=0;
BLDG_STR="";
for BLDG in ${BLDGS}
do
BLDG_STR="${BLDG_STR} bldg_${BLDG}*"
done
echo " copy and paste template: zip bldgs_2021-XX-XX_rev5000.XXXXX import_baX.csv $BLDG_STR"
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,125 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
numOk=0;
numFailure=0;
BLDG_STR="";
for BLDG in ${BLDGS}
do
BLDG_STR="${BLDG_STR} bldg_${BLDG}*"
done
echo " copy and paste template: zip bldgs_2021-XX-XX_rev5000.XXXXX import_baX.csv $BLDG_STR"
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,130 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
numOk=0;
numFailure=0;
BLDG_STR="";
for BLDG in ${BLDGS}
do
BLDG_STR="${BLDG_STR} bldg_${BLDG}*"
done
echo " copy and paste template: zip bldgs_2021-XX-XX_rev5000.XXXXX.zip import_baX.csv $BLDG_STR"
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,133 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
BLDGS="3259 3262 3267 3269 3270 3272 3273 3275 3276 4116 4139 4144 4148 4149"
numOk=0;
numFailure=0;
BLDG_STR="";
for BLDG in ${BLDGS}
do
BLDG_STR="${BLDG_STR} bldg_${BLDG}*"
done
echo " copy and paste template: zip bldgs_2021-XX-XX_rev5000.XXXXX.zip import_baX.csv $BLDG_STR"
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,139 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
BLDGS="3259 3262 3267 3269 3270 3272 3273 3275 3276 4116 4139 4144 4148 4149"
BLDGS="3120 3123 3124 3129 3132 3136 3246 3248 3249 3256 3257 3258 3259 3260 3261 3263 3268 3278 3281 3282 3283 3284 3285 3287 3288 3289 3290 3291 3292 3293 3294 3295 4108 4113 4133 4141 4145 4146 4150 4151 4152 4153 4154 4156 4157 4158 4159 4160 4161 4162 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193"
numOk=0;
numFailure=0;
BLDG_STR="";
for BLDG in ${BLDGS}
do
BLDG_STR="${BLDG_STR} bldg_${BLDG}*"
done
echo " copy and paste template: zip bldgs_2021-XX-XX_rev5000.XXXXX.zip import_baX.csv $BLDG_STR"
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,152 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
BLDGS="3259 3262 3267 3269 3270 3272 3273 3275 3276 4116 4139 4144 4148 4149"
BLDGS="3120 3123 3124 3129 3132 3136 3246 3248 3249 3256 3257 3258 3259 3260 3261 3263 3268 3278 3281 3282 3283 3284 3285 3287 3288 3289 3290 3291 3292 3293 3294 3295 4108 4113 4133 4141 4145 4146 4150 4151 4152 4153 4154 4156 4157 4158 4159 4160 4161 4162 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193"
BLDGS="1205 1250 1272 3125 3126 3127 3128 3133 3134 3141_26 3141_27 3234 3235 3236 3237 3238 3239 3240 3244 3245 3247 3250 3251 3252 3253 3255 3265 3271 3274 3277 3296 3297 4104 4105 4109 4110 4114 4135 4136 4142 4163 4181 4182 4194 4196"
numOk=0;
numFailure=0;
BLDG_STR="";
for BLDG in ${BLDGS}
do
BLDG_STR="${BLDG_STR} bldg_${BLDG}*"
done
echo " copy and paste template: zip bldgs_2021-XX-XX_rev5000.XXXXX.zip import_baX.csv $BLDG_STR"
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,161 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
BLDGS="3259 3262 3267 3269 3270 3272 3273 3275 3276 4116 4139 4144 4148 4149"
BLDGS="3120 3123 3124 3129 3132 3136 3246 3248 3249 3256 3257 3258 3259 3260 3261 3263 3268 3278 3281 3282 3283 3284 3285 3287 3288 3289 3290 3291 3292 3293 3294 3295 4108 4113 4133 4141 4145 4146 4150 4151 4152 4153 4154 4156 4157 4158 4159 4160 4161 4162 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193"
BLDGS="1205 1250 1272 3125 3126 3127 3128 3133 3134 3141_26 3141_27 3234 3235 3236 3237 3238 3239 3240 3244 3245 3247 3250 3251 3252 3253 3255 3265 3271 3274 3277 3296 3297 4104 4105 4109 4110 4114 4135 4136 4142 4163 4181 4182 4194 4196"
BLDGS="1148 1150 1151 1152 1154 1155 1156 1157 1169 1171 1214 1242 1247 1263 1284 3137 3138 3139 3140 3142 3143 3144 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161"
numOk=0;
numFailure=0;
BLDG_STR="";
for BLDG in ${BLDGS}
do
BLDG_STR="${BLDG_STR} bldg_${BLDG}*"
done
echo " copy and paste template: zip bldgs_2021-XX-XX_rev5000.XXXXX.zip import_baX.csv $BLDG_STR"
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,167 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
BLDGS="3259 3262 3267 3269 3270 3272 3273 3275 3276 4116 4139 4144 4148 4149"
BLDGS="3120 3123 3124 3129 3132 3136 3246 3248 3249 3256 3257 3258 3259 3260 3261 3263 3268 3278 3281 3282 3283 3284 3285 3287 3288 3289 3290 3291 3292 3293 3294 3295 4108 4113 4133 4141 4145 4146 4150 4151 4152 4153 4154 4156 4157 4158 4159 4160 4161 4162 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193"
BLDGS="1205 1250 1272 3125 3126 3127 3128 3133 3134 3141_26 3141_27 3234 3235 3236 3237 3238 3239 3240 3244 3245 3247 3250 3251 3252 3253 3255 3265 3271 3274 3277 3296 3297 4104 4105 4109 4110 4114 4135 4136 4142 4163 4181 4182 4194 4196"
BLDGS="1148 1150 1151 1152 1154 1155 1156 1157 1169 1171 1214 1242 1247 1263 1284 3137 3138 3139 3140 3142 3143 3144 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161"
BLDGS="0910 2100 2101 2205 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3254 4115 4147 4155 4194"
numOk=0;
numFailure=0;
BLDG_STR="";
for BLDG in ${BLDGS}
do
BLDG_STR="${BLDG_STR} bldg_${BLDG}*"
done
echo " copy and paste template: zip bldgs_2021-XX-XX_rev5000.XXXXX.zip import_baX.csv $BLDG_STR"
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,174 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
BLDGS="3259 3262 3267 3269 3270 3272 3273 3275 3276 4116 4139 4144 4148 4149"
BLDGS="3120 3123 3124 3129 3132 3136 3246 3248 3249 3256 3257 3258 3259 3260 3261 3263 3268 3278 3281 3282 3283 3284 3285 3287 3288 3289 3290 3291 3292 3293 3294 3295 4108 4113 4133 4141 4145 4146 4150 4151 4152 4153 4154 4156 4157 4158 4159 4160 4161 4162 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193"
BLDGS="1205 1250 1272 3125 3126 3127 3128 3133 3134 3141_26 3141_27 3234 3235 3236 3237 3238 3239 3240 3244 3245 3247 3250 3251 3252 3253 3255 3265 3271 3274 3277 3296 3297 4104 4105 4109 4110 4114 4135 4136 4142 4163 4181 4182 4194 4196"
BLDGS="1148 1150 1151 1152 1154 1155 1156 1157 1169 1171 1214 1242 1247 1263 1284 3137 3138 3139 3140 3142 3143 3144 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161"
BLDGS="0910 2100 2101 2205 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3254 4115 4147 4155 4194"
BLDGS="2106 2107 2108 2109 2110 2112 2116 2117 2118 2121 2122 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3221 3223 3225 3286 3301 4103 4118 4119 4120 4121 4122 4123 4124 4130"
numOk=0;
numFailure=0;
BLDG_STR="";
for BLDG in ${BLDGS}
do
BLDG_STR="${BLDG_STR} bldg_${BLDG}*"
done
echo " copy and paste template: zip bldgs_2021-XX-XX_rev5000.XXXXX.zip import_baX.csv $BLDG_STR"
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,178 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
BLDGS="3259 3262 3267 3269 3270 3272 3273 3275 3276 4116 4139 4144 4148 4149"
BLDGS="3120 3123 3124 3129 3132 3136 3246 3248 3249 3256 3257 3258 3259 3260 3261 3263 3268 3278 3281 3282 3283 3284 3285 3287 3288 3289 3290 3291 3292 3293 3294 3295 4108 4113 4133 4141 4145 4146 4150 4151 4152 4153 4154 4156 4157 4158 4159 4160 4161 4162 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193"
BLDGS="1205 1250 1272 3125 3126 3127 3128 3133 3134 3141_26 3141_27 3234 3235 3236 3237 3238 3239 3240 3244 3245 3247 3250 3251 3252 3253 3255 3265 3271 3274 3277 3296 3297 4104 4105 4109 4110 4114 4135 4136 4142 4163 4181 4182 4194 4196"
BLDGS="1148 1150 1151 1152 1154 1155 1156 1157 1169 1171 1214 1242 1247 1263 1284 3137 3138 3139 3140 3142 3143 3144 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161"
BLDGS="0910 2100 2101 2205 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3254 4115 4147 4155 4194"
BLDGS="2106 2107 2108 2109 2110 2112 2116 2117 2118 2121 2122 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3221 3223 3225 3286 3301 4103 4118 4119 4120 4121 4122 4123 4124 4130"
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287"
BLDGS="1104"
numOk=0;
numFailure=0;
BLDG_STR="";
for BLDG in ${BLDGS}
do
BLDG_STR="${BLDG_STR} bldg_${BLDG}*"
done
echo " copy and paste template: zip bldgs_2021-XX-XX_rev5000.XXXXX.zip import_baX.csv $BLDG_STR"
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build-3dws/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/bldg_${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep..";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log*
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,78 @@
#
# $Id$
# $HeadURL$
# $Author$
#
SET(vwm_SRCS
vwm_api.cpp
vwm_api.h
vwm_building.cpp
vwm_building.h
vwm_building_room_geometry.cpp
vwm_building_room_geometry.h
vwm_deposition.cpp
vwm_deposition.h
vwm_math.cpp
vwm_math.h
vwm_state_store.cpp
vwm_state_store.h
vwm_types.h
vwm_xml_reader.cpp
vwm_xml_reader.h
)
NGL_ADD_LIBRARY2(AAR SV BuildingControlVwm SHARED ${vwm_SRCS})
NGL_TARGET_LINK_LIBRARIES(BuildingControlVwm
PRIVATE
ngltools
Qt5::Xml
PUBLIC
Qt5::Core
Qt5::Gui
LtsUtilsCoreHeaderOnly
BuildingControlCommon
)
################################
### Test
################################
NGL_ADD_EXECUTABLE(AAR SV BuildingControlTestVwm test_read_xml.cpp test_read_xml.h)
NGL_TARGET_LINK_LIBRARIES(BuildingControlTestVwm
NGLLogger
ngltools
LtsUtilsCoreHeaderOnly
Qt5::Xml
Qt5::Core
BuildingControlCommon
BuildingControlVwm
nglcoreapplication
LtsCoordTrans
)
NGL_ADD_EXECUTABLE(AAR SV BuildingControlTestVwmXml test_vwm_xml.cpp)
NGL_TARGET_LINK_LIBRARIES(BuildingControlTestVwmXml
LtsUtilsCoreHeaderOnly
Qt5::Xml
Qt5::Core
Qt5::Gui
BuildingControlVwm
BuildingControlCommon
nglcoreapplication
)
IF(BUILD_TESTING AND TARGET BuildingControlVwm)
SET(test_SRCS
vwm_math_unit_test.cpp
vwm_math_unit_test.h
)
ADD_EXECUTABLE(bld_vwm_math_unit_test ${test_SRCS})
TARGET_LINK_LIBRARIES(bld_vwm_math_unit_test
Qt5::Gui
Qt5::Core
Qt5::Test
BuildingControlVwm
BuildingControlCommon
nglcoreapplication
)
ADD_TEST(NAME bld_vwm_math_unit_test COMMAND $<TARGET_FILE:bld_vwm_math_unit_test>)
ENDIF()
@@ -0,0 +1,50 @@
#!/bin/sh
BLDG="1101"
COORDS=""
COORDS="${COORDS} HeAz_${BLDG}Dach_SekWirk;371;0.20255028;0.91609673"
for COORD in ${COORDS}
do
NAME=`echo $COORD | awk -F ";" '{print $1}'`
AMMO=`echo $COORD | awk -F ";" '{print $2}'`
X=`echo $COORD | awk -F ";" '{print $3}'`
Y=`echo $COORD | awk -F ";" '{print $4}'`
echo "Trigger AWES with: Name='$NAME' ; AMMO=$AMMO ; X=$X - Y=$Y"
/shd/CTC/TOOLS/TDS/TDS-build/bin//aes_test_explosion_single -d 139 -e42 name $NAME ammoId ${AMMO} x $X y $Y
if [ $? -eq 0 ];
then
echo "'$NAME' okay";
else
echo " failure on -> '$NAME' ";
fi
sleep 10
done
FILE=`ls -tr /tmp/ShotResult_bldg_${BLDG}* | tail -n 1`
echo " libreoffice $FILE"
@@ -0,0 +1,57 @@
#!/bin/sh
BLDG="1101"
COORDS=""
COORDS="${COORDS} HeAZ_${BLDG}Dach_11;371;0.202550;0.916097"
COORDS="${COORDS} HeAZ_${BLDG}Dach_12;371;0.202551;0.916097"
COORDS="${COORDS} HeAZ_${BLDG}Dach_13;371;0.202552;0.916097"
COORDS="${COORDS} HeAZ_${BLDG}Dach_14;371;0.202553;0.916096"
COORDS="${COORDS} HeAZ_${BLDG}Dach_15;371;0.202554;0.916096"
COORDS="${COORDS} HeAZ_${BLDG}Dach_16;371;0.202549;0.9160965"
COORDS="${COORDS} HeAZ_${BLDG}Dach_17;371;0.202550;0.9160964"
COORDS="${COORDS} HeAZ_${BLDG}Dach_18;371;0.202551;0.9160962"
COORDS="${COORDS} HeAZ_${BLDG}Dach_19;371;0.202552;0.9160960"
COORDS="${COORDS} HeAZ_${BLDG}Dach_20;371;0.202553;0.9160959"
for COORD in ${COORDS}
do
NAME=`echo $COORD | awk -F ";" '{print $1}'`
AMMO=`echo $COORD | awk -F ";" '{print $2}'`
X=`echo $COORD | awk -F ";" '{print $3}'`
Y=`echo $COORD | awk -F ";" '{print $4}'`
echo "Trigger AWES with: Name='$NAME' ; AMMO=$AMMO ; X=$X - Y=$Y"
/shd/CTC/TOOLS/TDS/TDS-build/bin//aes_test_explosion_single -d 139 -e42 name $NAME ammoId ${AMMO} x $X y $Y
if [ $? -eq 0 ];
then
echo "'$NAME' okay";
else
echo " failure on -> '$NAME' ";
fi
sleep 5
done
FILE=`ls -tr /tmp/ShotResult_bldg_${BLDG}* | tail -n 1`
echo " libreoffice $FILE"
libreoffice $FILE &
@@ -0,0 +1,49 @@
#!/bin/sh
BLDG="1108"
COORDS=""
COORDS="${COORDS} HeAZ_${BLDG}Dach_11;371;0.202567;0.91609"
COORDS="${COORDS} HeAZ_${BLDG}Dach_12;371;0.202567;0.91609"
COORDS="${COORDS} HeAZ_${BLDG}Dach_13;371;0.202567;0.91609"
COORDS="${COORDS} HeAZ_${BLDG}Dach_14;371;0.202567;0.91609"
COORDS="${COORDS} HeAZ_${BLDG}Dach_15;371;0.202567;0.91609"
COORDS="${COORDS} HeAZ_${BLDG}Dach_16;371;0.202567;0.91609"
COORDS="${COORDS} HeAZ_${BLDG}Dach_17;371;0.202567;0.91609"
COORDS="${COORDS} HeAZ_${BLDG}Dach_18;371;0.202567;0.91609"
for COORD in ${COORDS}
do
NAME=`echo $COORD | awk -F ";" '{print $1}'`
AMMO=`echo $COORD | awk -F ";" '{print $2}'`
X=`echo $COORD | awk -F ";" '{print $3}'`
Y=`echo $COORD | awk -F ";" '{print $4}'`
echo "Trigger AWES with: Name='$NAME' ; AMMO=$AMMO ; X=$X - Y=$Y"
/shd/CTC/TOOLS/TDS/TDS-build/bin//aes_test_explosion_single -d 139 -e42 name $NAME ammoId ${AMMO} x $X y $Y
if [ $? -eq 0 ];
then
echo "'$NAME' okay";
else
echo " failure on -> '$NAME' ";
fi
sleep 10
done
FILE=`ls -tr /tmp/ShotResult_bldg_${BLDG}* | tail -n 1`
echo " libreoffice $FILE"
libreoffice $FILE &
@@ -0,0 +1,51 @@
#!/bin/sh
BLDG="1115"
COORDS=""
COORDS="${COORDS} HeAZ_${BLDG}Dach_11;371;0.2025585;0.9160916"
COORDS="${COORDS} HeAZ_${BLDG}Dach_12;371;0.2025580;0.9160911"
COORDS="${COORDS} HeAZ_${BLDG}Dach_13;371;0.2025589;0.9160907"
COORDS="${COORDS} HeAZ_${BLDG}Dach_14;371;0.2025585;0.9160904"
COORDS="${COORDS} HeAZ_${BLDG}Dach_15;371;0.2025582;0.9160907"
COORDS="${COORDS} HeAZ_${BLDG}Dach_16;371;0.2025588;0.9160913"
for COORD in ${COORDS}
do
NAME=`echo $COORD | awk -F ";" '{print $1}'`
AMMO=`echo $COORD | awk -F ";" '{print $2}'`
X=`echo $COORD | awk -F ";" '{print $3}'`
Y=`echo $COORD | awk -F ";" '{print $4}'`
echo "Trigger AWES with: Name='$NAME' ; AMMO=$AMMO ; X=$X - Y=$Y"
/shd/CTC/TOOLS/TDS/TDS-build/bin//aes_test_explosion_single -d 139 -e42 name $NAME ammoId ${AMMO} x $X y $Y
if [ $? -eq 0 ];
then
echo "'$NAME' okay";
else
echo " failure on -> '$NAME' ";
fi
done
FILE=`ls -tr /tmp/ShotResult_bldg_${BLDG}* | tail -n 1`
echo " libreoffice $FILE"
libreoffice $FILE &
@@ -0,0 +1,44 @@
#!/bin/sh
BLDG="1116"
COORDS=""
COORDS="${COORDS} HeAZ_${BLDG}Dach_11;371;0.202561;0.916094"
COORDS="${COORDS} HeAZ_${BLDG}Dach_12;371;0.202561;0.916094"
COORDS="${COORDS} HeAZ_${BLDG}Dach_13;371;0.202561;0.916094"
for COORD in ${COORDS}
do
NAME=`echo $COORD | awk -F ";" '{print $1}'`
AMMO=`echo $COORD | awk -F ";" '{print $2}'`
X=`echo $COORD | awk -F ";" '{print $3}'`
Y=`echo $COORD | awk -F ";" '{print $4}'`
echo "Trigger AWES with: Name='$NAME' ; AMMO=$AMMO ; X=$X - Y=$Y"
/shd/CTC/TOOLS/TDS/TDS-build/bin//aes_test_explosion_single -d 139 -e42 name $NAME ammoId ${AMMO} x $X y $Y
if [ $? -eq 0 ];
then
echo "'$NAME' okay";
else
echo " failure on -> '$NAME' ";
fi
sleep 10
done
FILE=`ls -tr /tmp/ShotResult_bldg_${BLDG}* | tail -n 1`
echo " libreoffice $FILE"
libreoffice $FILE &
@@ -0,0 +1,72 @@
#!/bin/sh
BLDG="3101"
COORDS=""
COORDS="${COORDS} HeAZ_${BLDG}Dach_XX;371;32_U_PD_77230_18558"
for COORD in ${COORDS}
do
NAME=`echo $COORD | awk -F ";" '{print $1}'`
AMMO=`echo $COORD | awk -F ";" '{print $2}'`
MGRS=`echo $COORD | awk -F ";" '{print $3}'`
MGRS2=`echo $MGRS | sed -e 's/_//g'`
echo "XXX $MGRS2 "
LATLON=`/shd/CTC/TOOLS/TDS/TDS-build/bin/mgrs2lonlat $MGRS2`
echo " '$LATLON' "
X=`echo $LATLON | cut -d "(" -f2 | awk -F " " '{print $1}'`
Y=`echo $LATLON | cut -d "(" -f2 | awk -F " " '{print $2}'`
echo "Trigger AWES with: Name='$NAME' ; AMMO=$AMMO ; X=$X - Y=$Y ($MGRS)"
/shd/CTC/TOOLS/TDS/TDS-build/bin//aes_test_explosion_single -d 139 -e42 name $NAME ammoId ${AMMO} x $X y $Y
if [ $? -eq 0 ];
then
echo "'$NAME' okay";
else
echo " failure on -> '$NAME' ";
fi
sleep 5
done
FILE=`ls -tr /tmp/ShotResult_bldg_${BLDG}* | tail -n 1`
echo " libreoffice $FILE"
@@ -0,0 +1,75 @@
#!/bin/sh
BLDG="BN_Kanaele"
COORDS=""
COORDS="${COORDS} HeAZ_${BLDG}GULLY109_01;371;32_U_PD_76914_18571"
COORDS="${COORDS} HeAZ_${BLDG}NordOst_11;371;32_U_PD_76945_18588"
COORDS="${COORDS} HeAZ_${BLDG}NordOst_12;371;32_U_PD_76945_18588"
COORDS="${COORDS} HeAZ_${BLDG}NordOst_13;371;32_U_PD_76945_18588"
COORDS="${COORDS} HeAZ_${BLDG}NordWest_21;371;32_U_PD_76891_18588"
COORDS="${COORDS} HeAZ_${BLDG}NordWest_22;371;32_U_PD_76891_18588"
COORDS="${COORDS} HeAZ_${BLDG}NordWest_23;371;32_U_PD_76891_18588"
COORDS="${COORDS} HeAZ_${BLDG}Sued_31;371;32_U_PD_76880_18508"
COORDS="${COORDS} HeAZ_${BLDG}Sued_32;371;32_U_PD_76880_18508"
COORDS="${COORDS} HeAZ_${BLDG}Sued_33;371;32_U_PD_76880_18508"
COORDS="${COORDS} HeAZ_${BLDG}Ost_41;371;32_U_PD_77000_18515"
COORDS="${COORDS} HeAZ_${BLDG}Ost_42;371;32_U_PD_77000_18515"
COORDS="${COORDS} HeAZ_${BLDG}Ost_43;371;32_U_PD_77000_18515"
COORDS="${COORDS} HeAZ_${BLDG}Ost_43;371;32_U_PD_76825_18550"
COORDS="${COORDS} HeAZ_${BLDG}Ost_43;371;32_U_PD_76825_18550"
COORDS="${COORDS} HeAZ_${BLDG}Ost_43;371;32_U_PD_76825_18550"
for COORD in ${COORDS}
do
NAME=`echo $COORD | awk -F ";" '{print $1}'`
AMMO=`echo $COORD | awk -F ";" '{print $2}'`
MGRS=`echo $COORD | awk -F ";" '{print $3}'`
MGRS2=`echo $MGRS | sed -e 's/_//g'`
echo "XXX $MGRS2 "
LATLON=`/shd/CTC/TOOLS/TDS/TDS-build/bin/mgrs2lonlat $MGRS2`
echo " '$LATLON' "
X=`echo $LATLON | cut -d "(" -f2 | awk -F " " '{print $1}'`
Y=`echo $LATLON | cut -d "(" -f2 | awk -F " " '{print $2}'`
echo "Trigger AWES with: Name='$NAME' ; AMMO=$AMMO ; X=$X - Y=$Y ($MGRS)"
/shd/CTC/TOOLS/TDS/TDS-build/bin//aes_test_explosion_single -d 139 -e42 name $NAME ammoId ${AMMO} x $X y $Y
if [ $? -eq 0 ];
then
echo "'$NAME' okay";
else
echo " failure on -> '$NAME' ";
fi
sleep 5
done
FILE=`ls -tr /tmp/ShotResult_bldg_${BLDG}* | tail -n 1`
echo " libreoffice $FILE"
libreoffice $FILE &
@@ -0,0 +1,54 @@
#!/bin/sh
BLDG="U_Bahn"
COORDS=""
COORDS="${COORDS} HeAZ_${BLDG}EgN_11;371;0.202619;0.916077"
COORDS="${COORDS} HeAZ_${BLDG}EgN_12;371;0.202619;0.916077"
COORDS="${COORDS} HeAZ_${BLDG}EgN_13;371;0.202619;0.916077"
COORDS="${COORDS} HeAZ_${BLDG}EgM_21;371;0.202603;0.916049"
COORDS="${COORDS} HeAZ_${BLDG}EgM_22;371;0.202603;0.916049"
COORDS="${COORDS} HeAZ_${BLDG}EgM_23;371;0.202603;0.916049"
COORDS="${COORDS} HeAZ_${BLDG}EgS_31;371;0.202592;0.91603"
COORDS="${COORDS} HeAZ_${BLDG}EgS_32;371;0.202592;0.91603"
COORDS="${COORDS} HeAZ_${BLDG}EgS_33;371;0.202592;0.91603"
for COORD in ${COORDS}
do
NAME=`echo $COORD | awk -F ";" '{print $1}'`
AMMO=`echo $COORD | awk -F ";" '{print $2}'`
X=`echo $COORD | awk -F ";" '{print $3}'`
Y=`echo $COORD | awk -F ";" '{print $4}'`
echo "Trigger AWES with: Name='$NAME' ; AMMO=$AMMO ; X=$X - Y=$Y"
/shd/CTC/TOOLS/TDS/TDS-build/bin//aes_test_explosion_single -d 139 -e42 name $NAME ammoId ${AMMO} x $X y $Y
if [ $? -eq 0 ];
then
echo "'$NAME' okay";
else
echo " failure on -> '$NAME' ";
fi
sleep 10
done
FILE=`ls -tr /tmp/ShotResult_bldg_${BLDG}* | tail -n 1`
echo " libreoffice $FILE"
libreoffice $FILE &
@@ -0,0 +1,83 @@
#!/bin/sh
BLDG="U_Bahn"
COORDS=""
COORDS="${COORDS} HeAZ_${BLDG}EgS_31;371;32_U_PD_77065_18137"
COORDS="${COORDS} HeAZ_${BLDG}EgS_32;371;32_U_PD_77060_18136"
COORDS="${COORDS} HeAZ_${BLDG}EgS_33;371;32_U_PD_77062_18144"
COORDS="${COORDS} HeAZ_${BLDG}EgS_31;371;32_U_PD_77065_18137"
COORDS="${COORDS} HeAZ_${BLDG}EgS_32;371;32_U_PD_77060_18136"
COORDS="${COORDS} HeAZ_${BLDG}EgS_33;371;32_U_PD_77062_18144"
COORDS="${COORDS} HeAZ_${BLDG}EgS_31;371;32_U_PD_77065_18137"
COORDS="${COORDS} HeAZ_${BLDG}EgS_32;371;32_U_PD_77060_18136"
COORDS="${COORDS} HeAZ_${BLDG}EgS_33;371;32_U_PD_77062_18144"
COORDS="${COORDS} HeAZ_${BLDG}EgS_31;371;32_U_PD_77065_18137"
COORDS="${COORDS} HeAZ_${BLDG}EgS_32;371;32_U_PD_77060_18136"
COORDS="${COORDS} HeAZ_${BLDG}EgS_33;371;32_U_PD_77062_18144"
COORDS="${COORDS} HeAZ_${BLDG}EgS_31;371;32_U_PD_77065_18137"
COORDS="${COORDS} HeAZ_${BLDG}EgS_32;371;32_U_PD_77060_18136"
COORDS="${COORDS} HeAZ_${BLDG}EgS_33;371;32_U_PD_77062_18144"
COORDS="${COORDS} HeAZ_${BLDG}EgS_31;371;32_U_PD_77065_18137"
COORDS="${COORDS} HeAZ_${BLDG}EgS_32;371;32_U_PD_77060_18136"
COORDS="${COORDS} HeAZ_${BLDG}EgS_33;371;32_U_PD_77062_18144"
for COORD in ${COORDS}
do
NAME=`echo $COORD | awk -F ";" '{print $1}'`
AMMO=`echo $COORD | awk -F ";" '{print $2}'`
X=`echo $COORD | awk -F ";" '{print $3}'`
Y=`echo $COORD | awk -F ";" '{print $4}'`
MGRS=`echo $COORD | awk -F ";" '{print $3}'`
MGRS2=`echo $MGRS | sed -e 's/_//g'`
LATLON=`/shd/CTC/TOOLS/TDS/TDS-build/bin/mgrs2lonlat $MGRS2`
echo " '$LATLON' "
X=`echo $LATLON | cut -d "(" -f2 | awk -F " " '{print $1}'`
Y=`echo $LATLON | cut -d "(" -f2 | awk -F " " '{print $2}'`
echo "Trigger AWES with: Name='$NAME' ; AMMO=$AMMO ; X=$X - Y=$Y ($MGRS)"
/shd/CTC/TOOLS/TDS/TDS-build/bin//aes_test_explosion_single -d 139 -e42 name $NAME ammoId ${AMMO} x $X y $Y
if [ $? -eq 0 ];
then
echo "'$NAME' okay";
else
echo " failure on -> '$NAME' ";
fi
sleep 2
done
FILE=`ls -tr /tmp/ShotResult_bldg_${BLDG}* | tail -n 1`
echo " libreoffice $FILE"
libreoffice $FILE &
@@ -0,0 +1,34 @@
# @RDE_HEADER@
# $Id$
# $HeadURL$
# $Author$
https://devhub.defence-elec.de/jira/browse/GUEZE-688 U-Bahn: AWES ohne Wirkung
https://devhub.defence-elec.de/jira/browse/GUEZE-688?focusedCommentId=119903&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-119903
Stand 06/2021:
==============
Also, bei BT56 ist vor geraumer Zeit aufgefallen, das AWES auf das Dach seine Wirkung zwar entfaltet hat, die Wirkung aber im EG seinen Ursprung nahm.
In dem Zuge hat Christian Ehrlicher (so Philip Dassow) den Algorithmus angepasst. Es wird dann nach der nearest wall gesucht...
Damit wurde aber nicht nur AWES auf das Gebäude beeinflusst, sondern auch AWES neben das Gebäude. Der Source Code suggeriert, das dieses nicht unbedingt gewollte war... ("Detected hit was outside of the building - ignored" @ vwm_api.cpp)
Um die Wirkung von AWES neben das Gebäude zu berechnen (z.B. U-Bahn-Tunnel), wird der AWES-EinschlagOrt (z-Wert von "0") in der Koorinatensystem des Gebäudes verschoben. (BuildingProcess::sendCesHitOnBuilding). Die impactPosition bekommt dadurch einen z-Wert von ca. -90m, da Schnöggersburg bei 90m Höhe liegt.
Jetzt wird also die nearest Wall zu der (rel.) impactPosition gesucht. Dabei sind die Keller-Etage näher, als die Einstiegsgebäude - unglücklich.
Um bei der der Suche (Api::onHitCes) eine sinnvolle Wall (und damit room) zu finden, wird der z-Wert auf "1" gesetzt ("posImpactOnGround"; bei "0" würde dennoch eine unterirdische Wand gefunden, daher "1"). Somit wird dann eine passende Wall/room gefunden und der "direction"-Vector in die Hit-Structure eingetragen.
(Dabei wird noch die 3-dimensionale BoundingBox (bottomLeft, topRight) der Wand ermittelt, um Rundungsprobleme zu eleminieren.)
Somit wird für den Tunnel oberirdisch gesucht und gefunden - zumindest bei Einschläge neben die Einstiegsgebäude. bei Einschläge zw. den Einstiegsgebäuden (z.B. bei Raum 122) sollte der eine lange virtuelle Raum (derzeit "208") oberhalb von 116-129) gefunden werden. Die nearest-wall-Suche basiert allerdings "nur" auf den Stützpunkten der wall. Und die Stützpunkte von Raum 122 sind näher dran, als die von 208.
-> der virtuelle Raum oberhalb der begehbaren Räume 116-129 sollte analog zu diesen aufgeteilt werden. Für 104-112 gilt das gleiche.
Wie können Räume wie 122 unterhalb der Erdoberfläche stärker von AWES geschützt werden?
Dabei könnte man den (in Api::sendHitToVwm) den z-Wert des direction-Vectors nutzen. Bei U-Bahn-Tunnel führt dies z.B. zu ca- "-5" Meter.
Bei der Kanalisation funktioniert das nicht. Der Referenzpunkt des U-Bahn-Tunnel ist an der quasi an der Erdoblerfläche. D.h. unterirdische Räume (1nn, 2nn) haben neg. z-Werte, während 3nn positive hat.
Bei der Kanalisation ist der Referenzpunkt unten, es gibt keine neg. z-Werte!
Auch aufgrund der große Ausdehnung ist der Ansatz über den z-Wert der direction fragwürdig.
Und was ist mit dem Tunnel in Salchau?
Dieser Tunnel hat gar keine Wände! Daher bleibt die nearest-wall-Suche erfolglos. Der Tunnel erfährt keine Zerstörung. Auch mit mit einem Einschlag in den Brunnen keine Zerstörung erzielen...
@@ -0,0 +1,22 @@
Copyright (c) 2012, Vladimir Agafonkin
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,13 @@
Simplify.js is a high-performance JavaScript 2D/3D polyline simplification library by Vladimir Agafonkin, extracted from [Leaflet](http://leafletjs.com).
Docs and demo: http://mourner.github.io/simplify-js/
#### Ports
* Python: [omarestrella / simplify.py](https://github.com/omarestrella/simplify.py) (by Omar Estrella)
* PHP: [AKeN / simplify-php](https://github.com/AKeN/simplify-php) (by Rotari Gheorghe)
* Java: [ekeneijeoma / simplify-java](https://github.com/ekeneijeoma/simplify-java) (by Ekene Ijeoma)
* Java: [hgoebl / simplify-java](https://github.com/hgoebl/simplify-java) (by Heinrich Göbl)
* Processing: [ekeneijeoma / simplify-processing](https://github.com/ekeneijeoma/simplify-processing) (by Ekene Ijeoma)
* AS3: [fnicollet / simplify-as3](https://github.com/fnicollet/simplify-as3) (by Fabien Nicollet)
* Rust: [calvinmetcalf / simplify-rs](https://github.com/calvinmetcalf/simplify-rs) (by Calvin Metcalf)
@@ -0,0 +1,18 @@
{
"name": "simplify-js",
"description": "A high-performance JavaScript 2D/3D polyline simplification library",
"homepage": "http://mourner.github.com/simplify-js/",
"author": "Vladimir Agafonkin",
"keywords": [
"math",
"geometry",
"polyline",
"simplification"
],
"repository": {
"type": "git",
"url": "git://github.com/mourner/simplify-js.git"
},
"main": "simplify.js",
"version": "1.1.0"
}
@@ -0,0 +1,153 @@
/*
(c) 2013, Vladimir Agafonkin
Simplify.js, a high-performance JS polyline simplification library
mourner.github.io/simplify-js
*/
(function () { "use strict";
// to suit your point format, run search/replace for '.x', '.y' and '.z';
// (configurability would draw significant performance overhead)
// square distance between 2 points
function getSquareDistance(p1, p2) {
var dx = p1.x - p2.x,
dy = p1.y - p2.y,
dz = p1.z - p2.z;
return dx * dx + dy * dy + dz * dz;
}
// square distance from a point to a segment
function getSquareSegmentDistance(p, p1, p2) {
var x = p1.x,
y = p1.y,
z = p1.z,
dx = p2.x - x,
dy = p2.y - y,
dz = p2.z - z;
if (dx !== 0 || dy !== 0 || dz !== 0) {
var t = ((p.x - x) * dx + (p.y - y) * dy + (p.z - z) * dz) /
(dx * dx + dy * dy + dz * dz);
if (t > 1) {
x = p2.x;
y = p2.y;
z = p2.z;
} else if (t > 0) {
x += dx * t;
y += dy * t;
z += dz * t;
}
}
dx = p.x - x;
dy = p.y - y;
dz = p.z - z;
return dx * dx + dy * dy + dz * dz;
}
// the rest of the code doesn't care for the point format
// basic distance-based simplification
function simplifyRadialDistance(points, sqTolerance) {
var prevPoint = points[0],
newPoints = [prevPoint],
point;
for (var i = 1, len = points.length; i < len; i++) {
point = points[i];
if (getSquareDistance(point, prevPoint) > sqTolerance) {
newPoints.push(point);
prevPoint = point;
}
}
if (prevPoint !== point) {
newPoints.push(point);
}
return newPoints;
}
// simplification using optimized Douglas-Peucker algorithm with recursion elimination
function simplifyDouglasPeucker(points, sqTolerance) {
var len = points.length,
MarkerArray = typeof Uint8Array !== 'undefined' ? Uint8Array : Array,
markers = new MarkerArray(len),
first = 0,
last = len - 1,
stack = [],
newPoints = [],
i, maxSqDist, sqDist, index;
markers[first] = markers[last] = 1;
while (last) {
maxSqDist = 0;
for (i = first + 1; i < last; i++) {
sqDist = getSquareSegmentDistance(points[i], points[first], points[last]);
if (sqDist > maxSqDist) {
index = i;
maxSqDist = sqDist;
}
}
if (maxSqDist > sqTolerance) {
markers[index] = 1;
stack.push(first, index, index, last);
}
last = stack.pop();
first = stack.pop();
}
for (i = 0; i < len; i++) {
if (markers[i]) {
newPoints.push(points[i]);
}
}
return newPoints;
}
// both algorithms combined for awesome performance
function simplify(points, tolerance, highestQuality) {
var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1;
points = highestQuality ? points : simplifyRadialDistance(points, sqTolerance);
points = simplifyDouglasPeucker(points, sqTolerance);
return points;
}
// export as a Node module, an AMD module or a global browser variable
if (typeof module !== 'undefined') {
module.exports = simplify;
} else if (typeof define === 'function' && define.amd) {
define(function() {
return simplify;
});
} else {
window.simplify = simplify;
}
})();
@@ -0,0 +1,239 @@
// $Id$
// $HeadURL$
// $Author$
// Created by Norbert Thoden, 2021-11
//const fs = require('fs');
//const aa = require('./simplify.js')();
var util = require('util');
var pnts = [{x:100.11,y:100.15, z:1.23}, {x:500.11,y:100.14, z:1.23},{x:500.11,y:200.14, z:1.23},{x:100.1,y:200.15, z:1.23}]
var pointsArray = [];
pointsArray.push(pnts);
//static const QVector<LtsUtils::QPoint3D> polyBldg1116_206_9({
// {24.038, 11.995, 6.431},
// {23.858, 11.995, 6.431}, // dependent / will be removed
// {21.226, 11.995, 6.431},
// {21.226, 11.995, 6.449}
pointsArray.push([{x:24.038, y: 11.995, z: 6.431}, {x: 23.858, y: 11.995, z: 6.431}, {x: 21.226, y: 11.995, z: 6.431}, {x: 21.226, y: 11.995, z: 6.449}] );
//static const QVector<LtsUtils::QPoint3D> polyBldg3101_306_149({
// {10.905, 16.003, 5.480},
// {12.277, 16.003, 5.480}, // dependent / will be removed
// {17.839, 16.004, 5.480},
// {17.839, 16.004, 8.040},
// {10.905, 16.003, 8.040}
pointsArray.push([{x: 10.905, y: 16.003, z: 5.480}, {x: 12.277, y: 16.003, z: 5.480}, {x: 17.839, y: 16.004, z: 5.480}, {x: 17.839, y: 16.004, z: 8.040}, {x: 10.905, y: 16.003, z: 8.040} ]);
// static const QVector<LtsUtils::QPoint3D> polyBldg1108_103_X({
// {-0.000, 15.979, 2.278}, // idx=0
// {-0.000, 15.979, 0.975}, // idx=1 // problem 1: linear dependent
// {-0.000, 15.979, 0.000}, // idx=2
// { 0.180, 15.979, 0.000}, // idx=3
// { 0.180, 15.979, 2.490}, // idx=4
// {-0.000, 15.979, 2.490}, // idx=5
// {-0.000, 15.979, 0.000} // idx=6 identical to idx=2 - problem???
// });
pointsArray.push([{x: -0.000, y: 15.979,z: 2.278}, {x: -0.000, y: 15.979,z: 0.975}, {x: -0.000, y: 15.979,z: 0.000}, {x: 0.180, y: 15.979,z: 0.000}, {x: 0.180, y: 15.979,z: 2.490}, {x: -0.000, y: 15.979,z: 2.490}, {x: -0.000, y: 15.979,z: 0.000}]);
// static const QVector<LtsUtils::QPoint3D> polyBldg3101_608_387_Org({
// {10.726, 8.619, 16.787}, // idx=0
// {10.726, 8.716, 16.786}, // idx=1
// { 7.291, 8.716, 16.786}, // idx=2
// { 7.291, 8.619, 16.787}, // idx=3 // problem 1: linear dependent, wenn z gleich wäre...
// { 7.291, 4.281, 16.717}, // idx=4
// {10.726, 4.281, 16.717} // idx=5
// });
pointsArray.push([{x: 10.726,y: 8.619,z: 16.787}, {x: 10.726,y: 8.716,z: 16.786}, {x: 7.291,y: 8.716,z: 16.786}, {x: 7.291,y: 8.619,z: 16.787}, {x: 7.291,y: 4.281,z: 16.717}, {x: 10.726,y: 4.281,z: 16.717}] );
// static const QVector<LtsUtils::QPoint3D> polyBldg1131_201_3({ // sollte eigentlich waagerechte Wand darstellen
// {0.000, 5.987, 2.689}, // idx=0
// {0.000, 5.791, 2.695}, // idx=1 // idx=1 "stört"
// {0.000, 0.170, 2.859}, // idx=2
// {3.098, 0.170, 2.859}, // idx=3
// {3.098, 5.791, 2.695}, // idx=4
// {2.928, 5.987, 2.689} // idx=5
// });
pointsArray.push([{x: 0.000,y: 5.987,z: 2.689}, {x: 0.000,y: 5.791,z: 2.695}, {x: 0.000,y: 0.170,z: 2.859}, {x: 3.098,y: 0.170,z: 2.859}, {x: 3.098,y: 5.791,z: 2.695}, {x: 2.928,y: 5.987,z: 2.689}]);
// 0910:
pointsArray.push([{x:22.337, y:0.064, z:5.232}, {x:14.362, y:0.064, z:5.232}, {x:14.362, y:-12.764, z:6.797}, {x:22.337, y:-12.764, z:6.797}]);
// 1275
pointsArray.push([{x:-0.105, y:1.606, z:2.240}, {x:-0.105, y:2.494, z:2.240}, {x:-0.105, y:2.494, z:2.311}, {x:-0.105, y:1.606, z:2.311}]);
var myArgs = process.argv.slice(2);
console.log('myArgs: ', myArgs);
const tolerance = myArgs[0];
const highQuality = myArgs[1];
console.log('tolerance: ', tolerance + " - highQuality: " + highQuality);
pointsArray.forEach(points => {
console.log("-------------------------------------------");
console.log("input: size=" + points.length + " \n data=" + util.inspect(points, {showHidden: false, depth: 2}));
var result = simplify(points, tolerance, highQuality);
console.log(" result: size=" + result.length + " \n data=" + util.inspect(result, {showHidden: false, depth: 2}));
});
/*****************************************************************************************/
// square distance between 2 points
function getSquareDistance(p1, p2) {
var dx = p1.x - p2.x,
dy = p1.y - p2.y,
dz = p1.z - p2.z;
return dx * dx + dy * dy + dz * dz;
}
// square distance from a point to a segment
function getSquareSegmentDistance(p, p1, p2) {
var x = p1.x,
y = p1.y,
z = p1.z,
dx = p2.x - x,
dy = p2.y - y,
dz = p2.z - z;
if (dx !== 0 || dy !== 0 || dz !== 0) {
var t = ((p.x - x) * dx + (p.y - y) * dy + (p.z - z) * dz) /
(dx * dx + dy * dy + dz * dz);
if (t > 1) {
x = p2.x;
y = p2.y;
z = p2.z;
} else if (t > 0) {
x += dx * t;
y += dy * t;
z += dz * t;
}
}
dx = p.x - x;
dy = p.y - y;
dz = p.z - z;
return dx * dx + dy * dy + dz * dz;
}
// the rest of the code doesn't care for the point format
// basic distance-based simplification
function simplifyRadialDistance(points, sqTolerance) {
console.log("use simplifyRadialDis");
var prevPoint = points[0],
newPoints = [prevPoint],
point;
for (var i = 1, len = points.length; i < len; i++) {
point = points[i];
if (getSquareDistance(point, prevPoint) > sqTolerance) {
newPoints.push(point);
prevPoint = point;
}
}
if (prevPoint !== point) {
newPoints.push(point);
}
console.log("simplifyRadialDis -> lenght= " + newPoints.length);
return newPoints;
}
// simplification using optimized Douglas-Peucker algorithm with recursion elimination
function simplifyDouglasPeucker(points, sqTolerance) {
var len = points.length,
MarkerArray = typeof Uint8Array !== 'undefined' ? Uint8Array : Array,
markers = new MarkerArray(len),
first = 0,
last = len - 1,
stack = [],
newPoints = [],
i, maxSqDist, sqDist, index;
markers[first] = markers[last] = 1;
while (last) {
maxSqDist = 0;
for (i = first + 1; i < last; i++) {
sqDist = getSquareSegmentDistance(points[i], points[first], points[last]);
if (sqDist > maxSqDist) {
index = i;
maxSqDist = sqDist;
}
}
if (maxSqDist > sqTolerance) {
markers[index] = 1;
stack.push(first, index, index, last);
}
last = stack.pop();
first = stack.pop();
}
for (i = 0; i < len; i++) {
if (markers[i]) {
newPoints.push(points[i]);
}
}
return newPoints;
}
// both algorithms combined for awesome performance
function simplify(points, tolerance, highestQuality) {
var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1;
points = highestQuality ? points : simplifyRadialDistance(points, sqTolerance);
points = simplifyDouglasPeucker(points, sqTolerance);
return points;
}
/*****************************************************************************************/
@@ -0,0 +1,91 @@
#!/bin/sh
rm -v /shd/CTC/LOG/ctc_bcu_1.log*
BLDGS="A1 A2 A3 A4"
numOk=0;
numFailure=0;
BLDG_STR="";
for BLDG in ${BLDGS}
do
BLDG_STR="${BLDG_STR} ${BLDG}*"
done
echo " copy and paste template: zip bldgs_2021-XX-XX_rev5000.XXXXX.zip import_baX.csv $BLDG_STR"
for BLDG in ${BLDGS}
do
/shd/CTC/TOOLS/TDS/TDS-build-3dws/bin/BuildingControlTestVwmXml /opt/BuildingModels/StaticMeshes/${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/${BLDG}.flt.VWM_Building.xml
if [ $? -eq 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo "------------------------------------";
echo " failure on -> '$BLDG' ";
echo " kate /opt/BuildingModels/StaticMeshes/${BLDG}.flt.xml /opt/BuildingModels/StaticMeshes/${BLDG}.flt.VWM_Building.xml &"
((numFailure=numFailure+1))
fi
echo "grep for '$BLDG':";
grep -E "WARN|ERROR|FATAL" /shd/CTC/LOG/ctc_bcu_1.log* | grep $BLDG
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,37 @@
#!/bin/sh
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1111 1112 1113 1118 1119 1120 1121 1122 1123 1124 1125 1128 1130 1132 1134 1136 1138 1140 1142 1163"
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
else
echo " failure on -> '$BLDG' ";
fi
done
@@ -0,0 +1,37 @@
#!/bin/sh
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1127 1129 1131 1133 1135 1137 1139 1141 1143 1144 1145 1146 1147 1153 1158 1167"
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
else
echo " failure on -> '$BLDG' ";
fi
done
@@ -0,0 +1,37 @@
#!/bin/sh
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1155 1159 1160 1161 1162 1164 1166 1168 1170 1172 1173"
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
else
echo " failure on -> '$BLDG' ";
fi
done
@@ -0,0 +1,39 @@
#!/bin/sh
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
else
echo " failure on -> '$BLDG' ";
fi
done
@@ -0,0 +1,41 @@
#!/bin/sh
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
else
echo " failure on -> '$BLDG' ";
fi
done
@@ -0,0 +1,45 @@
#!/bin/sh
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
else
echo " failure on -> '$BLDG' ";
fi
done
@@ -0,0 +1,49 @@
#!/bin/sh
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
else
echo " failure on -> '$BLDG' ";
fi
done
@@ -0,0 +1,52 @@
#!/bin/sh
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
else
echo " failure on -> '$BLDG' ";
fi
done
@@ -0,0 +1,55 @@
#!/bin/sh
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
else
echo " failure on -> '$BLDG' ";
fi
done
@@ -0,0 +1,58 @@
#!/bin/sh
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
else
echo " failure on -> '$BLDG' ";
fi
done
@@ -0,0 +1,61 @@
#!/bin/sh
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
else
echo " failure on -> '$BLDG' ";
fi
done
@@ -0,0 +1,71 @@
#!/bin/sh
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,75 @@
#!/bin/sh
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
BLDGS="3259 3262 3267 3269 3270 3272 3273 3275 3276 4116 4139 4144 4148 4149"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,79 @@
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
BLDGS="3259 3262 3267 3269 3270 3272 3273 3275 3276 4116 4139 4144 4148 4149"
BLDGS="3120 3123 3124 3129 3132 3136 3246 3248 3249 3256 3257 3258 3259 3260 3261 3263 3268 3278 3281 3282 3283 3284 3285 3287 3288 3289 3290 3291 3292 3293 3294 3295 4108 4113 4133 4141 4145 4146 4150 4151 4152 4153 4154 4156 4157 4158 4159 4160 4161 4162 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,81 @@
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
BLDGS="3259 3262 3267 3269 3270 3272 3273 3275 3276 4116 4139 4144 4148 4149"
BLDGS="3120 3123 3124 3129 3132 3136 3246 3248 3249 3256 3257 3258 3259 3260 3261 3263 3268 3278 3281 3282 3283 3284 3285 3287 3288 3289 3290 3291 3292 3293 3294 3295 4108 4113 4133 4141 4145 4146 4150 4151 4152 4153 4154 4156 4157 4158 4159 4160 4161 4162 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193"
BLDGS="1205 1250 1272 3125 3126 3127 3128 3133 3134 3141_26 3141_27 3234 3235 3236 3237 3238 3239 3240 3244 3245 3247 3250 3251 3252 3253 3255 3265 3271 3274 3277 3296 3297 4104 4105 4109 4110 4114 4135 4136 4142 4163 4181 4182 4194 4196"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,84 @@
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
BLDGS="3259 3262 3267 3269 3270 3272 3273 3275 3276 4116 4139 4144 4148 4149"
BLDGS="3120 3123 3124 3129 3132 3136 3246 3248 3249 3256 3257 3258 3259 3260 3261 3263 3268 3278 3281 3282 3283 3284 3285 3287 3288 3289 3290 3291 3292 3293 3294 3295 4108 4113 4133 4141 4145 4146 4150 4151 4152 4153 4154 4156 4157 4158 4159 4160 4161 4162 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193"
BLDGS="1205 1250 1272 3125 3126 3127 3128 3133 3134 3141_26 3141_27 3234 3235 3236 3237 3238 3239 3240 3244 3245 3247 3250 3251 3252 3253 3255 3265 3271 3274 3277 3296 3297 4104 4105 4109 4110 4114 4135 4136 4142 4163 4181 4182 4194 4196"
BLDGS="1148 1150 1151 1152 1154 1155 1156 1157 1169 1171 1214 1242 1247 1263 1284 3137 3138 3139 3140 3142 3143 3144 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,88 @@
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
BLDGS="3259 3262 3267 3269 3270 3272 3273 3275 3276 4116 4139 4144 4148 4149"
BLDGS="3120 3123 3124 3129 3132 3136 3246 3248 3249 3256 3257 3258 3259 3260 3261 3263 3268 3278 3281 3282 3283 3284 3285 3287 3288 3289 3290 3291 3292 3293 3294 3295 4108 4113 4133 4141 4145 4146 4150 4151 4152 4153 4154 4156 4157 4158 4159 4160 4161 4162 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193"
BLDGS="1205 1250 1272 3125 3126 3127 3128 3133 3134 3141_26 3141_27 3234 3235 3236 3237 3238 3239 3240 3244 3245 3247 3250 3251 3252 3253 3255 3265 3271 3274 3277 3296 3297 4104 4105 4109 4110 4114 4135 4136 4142 4163 4181 4182 4194 4196"
BLDGS="1148 1150 1151 1152 1154 1155 1156 1157 1169 1171 1214 1242 1247 1263 1284 3137 3138 3139 3140 3142 3143 3144 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161"
BLDGS="0910 2100 2101 2205 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3254 4115 4147 4155 4194"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,91 @@
BLDGS="1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1114 1115 1116 1117 1285 1286 1287 2119 3100 3101 3102 3279 3280 3298 3299 3300 4102 4197 4198 BN_Kanaele U_Bahn"
BLDGS="0910 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 2100 2101 2105 2106 2107 2108 2109 2110 2112 2114 2115 2116 2117 2118 2119 2120 2121 2122 2205 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141_26 3141_27 3142 3143 3144 3145_47 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 BN_Kanaele salchau_571 salchau_574 salchau_575 salchau_576 salchau_577 salchau_tunnel U_Bahn"
BLDGS="1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1185 1188 1191 1193 1194 1195 1196 1201 1202 1203 1204 1210 1211"
BLDGS="1213 1215 1216 1217 1218 1219 1220 1221 1222 1223 1225 1226 1227"
BLDGS="1224 1228 1229 1230 1231 1232 1235 1237 1239 1241 1243"
BLDGS="1197 1207 1234 1238 1240 1244 1245 1246 1248 1249 1257 1258 1259"
BLDGS="1165 1208 1209 1212 1236 1253 1260 1261 1262 1265 3103"
BLDGS="1253 1254 1255 1269 1270 1271 1273 1274 1276 1277 1278 1279 1280 1283 3104 3105 3106 3107"
BLDGS="1256 1268 1275 1281 1282 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122"
BLDGS="1251 1264 3220 3222 3224 3226 3228 3229 3266"
BLDGS="3120 3123 3124 3129 3130 3131 3135 3230 3231 3232 3233 3241 3243 3260 3264 4106 4107 4111 4112 4117 4126 4127 4128 4129 4131 4132 4134 4140 4143 4145"
BLDGS="3259 3262 3267 3269 3270 3272 3273 3275 3276 4116 4139 4144 4148 4149"
BLDGS="3120 3123 3124 3129 3132 3136 3246 3248 3249 3256 3257 3258 3259 3260 3261 3263 3268 3278 3281 3282 3283 3284 3285 3287 3288 3289 3290 3291 3292 3293 3294 3295 4108 4113 4133 4141 4145 4146 4150 4151 4152 4153 4154 4156 4157 4158 4159 4160 4161 4162 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193"
BLDGS="1205 1250 1272 3125 3126 3127 3128 3133 3134 3141_26 3141_27 3234 3235 3236 3237 3238 3239 3240 3244 3245 3247 3250 3251 3252 3253 3255 3265 3271 3274 3277 3296 3297 4104 4105 4109 4110 4114 4135 4136 4142 4163 4181 4182 4194 4196"
BLDGS="1148 1150 1151 1152 1154 1155 1156 1157 1169 1171 1214 1242 1247 1263 1284 3137 3138 3139 3140 3142 3143 3144 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161"
BLDGS="0910 2100 2101 2205 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3254 4115 4147 4155 4194"
BLDGS="2106 2107 2108 2109 2110 2112 2116 2117 2118 2121 2122 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3221 3223 3225 3286 3301 4103 4118 4119 4120 4121 4122 4123 4124 4130"
numOk=0;
numFailure=0;
for BLDG in ${BLDGS}
do
echo "Bldg: '$BLDG':";
MyFile=`find /opt/BuildingModels/StaticMeshes -iname "bldg_${BLDG}.flt.VWM_Building.xml"`
grep -E "OuterWallProtectiveFactor|ExclusionZoneProtectiveFactor" $MyFile | sort -u | grep -vE "usionZoneProtectiveFactor>0<|usionZoneProtectiveFactor>20|WallProtectiveFactor>200"
if [ $? -ne 0 ];
then
echo "'$BLDG' okay";
((numOk=numOk+1))
else
echo " failure on -> '$BLDG' ";
((numFailure=numFailure+1))
fi
done
echo " numOk = $numOk ";
echo " numFailure = $numFailure ";
@@ -0,0 +1,145 @@
#include <nglapplication/nglcoreapplication.h>
#include <QDateTime>
#include <QString>
#include <QTimer>
#include "vwm_api.h"
#include "vwm_math.h"
#include "test_read_xml.h"
#include "bcu_xml_reader.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
Test::Test()
: m_api(new BuildingControlUnit::VWM::Api(this))
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("BCU.VWM.Test"))
{
connect(m_api, &BuildingControlUnit::VWM::Api::hitResult,
this, &Test::hitResult);
QTimer::singleShot(0, this, &Test::test1);
}
Test::~Test()
{
delete m_api;
}
void Test::hitResult(const BuildingControlUnit::HitResult &result)
{
INFO_LOG(m_logger) << "Hit Result: sensorId = " << result.sensorId
<< ", originatorId = " << result.originatorId
<< ", chargeTypeId = " << result.chargeTypeId
<< ", dmgPercentOld = " << result.damagePercentOld
<< ", dmgPercentNew = " << result.damagePercentNew
<< ", effectSoundId = " << result.effectSoundId
<< ", effectTime = " << QDateTime::fromMSecsSinceEpoch(result.effectTimeMSec).toString(QStringLiteral("hh:mm:ss.zzz"))
<< ", damageState = " << result.damageState
<< ", #rooms = " << result.rooms.size();
}
void Test::test1()
{
const auto bsmMap = m_api->bsmMap();
for (const BuildingControlUnit::Bsm &bsm : bsmMap)
{
const auto rooms = m_api->building().rooms();
const auto hitPos = BuildingControlUnit::VWM::Math::checkBsmPosition(bsm.position, bsm.direction, rooms);
if (hitPos.state != BuildingControlUnit::VWM::HitPosition::State::OuterWall)
{
WARNING_LOG(m_logger) << "Effect on bsm " << bsm.id << " does not hit building ! - position: "
<< bsm.position << ", direction: " << bsm.direction;
}
else if (hitPos.distance < 0)
{
WARNING_LOG(m_logger) << "Effect on bsm " << bsm.id << " results in hit pos behind a wall ("
<< hitPos.distance << "m) instead in front - BSM is not modelled in the correct place: "
<< bsm.position << ", direction: " << bsm.direction << ", roomId which was hit: " << hitPos.roomId;
}
else
{
DEBUG_LOG(m_logger) << "BSM with id " << bsm.id << " looks fine - room which will be hit: " << hitPos.roomId;
}
}
QTimer::singleShot(1000, this, &Test::test2);
}
void Test::test2()
{
m_api->onHitOpticalOC(QDateTime::currentMSecsSinceEpoch(), 2, 0, 7, BuildingControlUnit::DamageState::Destroyed);
QTimer::singleShot(1000, this, &Test::test3);
}
void Test::test3()
{
m_api->onHitOpticalOC(QDateTime::currentMSecsSinceEpoch(), 2, 1, 8, BuildingControlUnit::DamageState::NoDamage);
QTimer::singleShot(1000, this, &Test::test4);
}
void Test::test4()
{
m_api->onHitEcc(2, BuildingControlUnit::DamageState::Destroyed, QVector<int>());
m_api->onHitEcc(2, BuildingControlUnit::DamageState::NoDamage, QVector<int>());
QTimer::singleShot(1000, this, &Test::test5);
}
void Test::test5()
{
m_api->onHitOptical(QDateTime::currentMSecsSinceEpoch(), 1, 4711, 5, 0, 0);
QTimer::singleShot(1000, this, &Test::test6);
}
void Test::test6()
{
m_api->onHitCes(QDateTime::currentMSecsSinceEpoch(), 112, 42, 55, 66, LtsUtils::QPoint3D(30,-30,0), {});
m_api->onHitCes(QDateTime::currentMSecsSinceEpoch(), 112, 42, 55, 66, LtsUtils::QPoint3D(2,2,0), QLatin1String(""));
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
int main(int argc, char *argv[])
{
NGLCoreApplication app(argc, argv);
app.createLogger("BCU", 1);
QString path = QCoreApplication::applicationDirPath();
QString chargesConfig = path + QLatin1String("/bldg_7_charges.xml");
QString vulConfig = path + QLatin1String("/bldg_7_vulnerability_model.xml");
QString bldConfigFile = path + QLatin1String("/bldg_7_building_config.xml");
if (app.arguments().size() > 1)
{
path = app.arguments().at(1);
chargesConfig = path + QLatin1String("_charges.xml");
vulConfig = path + QLatin1String("_vulnerability_model.xml");
bldConfigFile = path + QLatin1String("_building_config.xml");
}
BuildingControlUnit::BuildingBsmConfig bsmConfig;
BuildingControlUnit::BuildingEgcuConfig egcuConfig;
if (!BuildingControlUnit::parseBuildingConfigXml(bldConfigFile, bsmConfig, egcuConfig))
return 1;
Test *test = new Test;
if (!test->m_api->init(chargesConfig, vulConfig, bsmConfig, true))
{
delete test;
return 1;
}
app.exec();
delete test;
return 0;
}
@@ -0,0 +1,28 @@
#pragma once
#include <QObject>
#include <NGLLogger/INGLLogger.h>
#include "vwm_api.h"
class Test : public QObject
{
Q_OBJECT
public:
Test();
~Test();
BuildingControlUnit::VWM::Api *m_api;
private Q_SLOTS:
void hitResult(const BuildingControlUnit::HitResult &result);
void test1();
void test2();
void test3();
void test4();
void test5();
void test6();
private:
NGL::INGLLogger &m_logger;
};
@@ -0,0 +1,564 @@
#include "vwm_math.h"
#include "vwm_xml_reader.h"
#include "vwm_building_room_geometry.h"
#include "vwm_api.h"
#include <iostream>
#include <nglapplication/nglcoreapplication.h>
#include <NGLLogger/INGLLogger.h>
#include <bcu_xml_reader.h>
#include <QStringList>
#include <QFile>
#include <QPolygonF>
#include <QDomDocument>
#include <QDebug>
static QDomElement getChildElement(const QDomElement &parent, const QString &childTag, bool bThrow = true)
{
const QDomElement ret = parent.firstChildElement(childTag);
if (ret.isNull() && bThrow)
throw BuildingControlUnit::XmlReaderException(QStringLiteral("Invalid XML Structure - no '%1' tag").arg(childTag));
return ret;
}
static int getInteger(const QDomElement &element, const QString &attribute)
{
bool bOk = true;
const int ret = element.attribute(attribute).toInt(&bOk);
if (!bOk)
throw BuildingControlUnit::XmlReaderException(QStringLiteral("Can not find attribute %1 in xml element %2 (line %3:%4)")
.arg(attribute, element.tagName()).arg(element.lineNumber()).arg(element.columnNumber()));
return ret;
}
static inline bool checkRange(double d)
{
return (fabs(d) < 10000000);
}
static inline LtsUtils::QPoint3D positionFromElement(const QDomElement &elem)
{
bool bOkX, bOkY, bOkZ;
auto ret (LtsUtils::QPoint3D(elem.attribute(QStringLiteral("X")).toDouble(&bOkX),
elem.attribute(QStringLiteral("Y")).toDouble(&bOkY),
elem.attribute(QStringLiteral("Z")).toDouble(&bOkZ)));
if (!bOkX || !checkRange(ret.x()))
throw BuildingControlUnit::XmlReaderException(QStringLiteral("invalid value for X: %1 (line %2:%3)")
.arg(elem.attribute(QStringLiteral("X"))).arg(elem.lineNumber()).arg(elem.columnNumber()));
if (!bOkY || !checkRange(ret.y()))
throw BuildingControlUnit::XmlReaderException(QStringLiteral("invalid value for Y: %1 (line %2:%3)")
.arg(elem.attribute(QStringLiteral("Y"))).arg(elem.lineNumber()).arg(elem.columnNumber()));
if (!bOkZ || !checkRange(ret.z()))
throw BuildingControlUnit::XmlReaderException(QStringLiteral("invalid value for Z: %1 (line %2:%3)")
.arg(elem.attribute(QStringLiteral("Z"))).arg(elem.lineNumber()).arg(elem.columnNumber()));
return ret;
}
struct MyRoom
{
LtsUtils::QPoint3D bBoxMin;
LtsUtils::QPoint3D bBoxMax;
int id = 0;
LtsUtils::QPoint3D center() const
{
return (bBoxMin + bBoxMax) / 2;
}
double maxZ() const
{
return std::max(bBoxMax.z(), bBoxMin.z());
}
double minZ() const
{
return std::min(bBoxMax.z(), bBoxMin.z());
}
};
static BuildingControlUnit::Bsm getRefMod(const QDomElement &extRef)
{
BuildingControlUnit::Bsm bsm;
const QDomElement nameElement = getChildElement(extRef, QStringLiteral("Name"), false);
if (!nameElement.text().startsWith(QLatin1String("REF_MOD_AP_"), Qt::CaseInsensitive))
return bsm;
bsm.id = getInteger(getChildElement(extRef, QStringLiteral("SubId")), QStringLiteral("ID"));
bsm.position = positionFromElement(getChildElement(extRef, QStringLiteral("Coord")));
bsm.direction = positionFromElement(getChildElement(extRef, QStringLiteral("Dir")));
return bsm;
}
template <typename T>
static inline T positionFromElement(const QDomElement &elem)
{
return T(elem.attribute(QStringLiteral("X")).toDouble(),
elem.attribute(QStringLiteral("Y")).toDouble(),
elem.attribute(QStringLiteral("Z")).toDouble());
}
static void parseRooms(const QDomElement &domGroup,
BuildingControlUnit::BuildingBsmConfig &bsmConfig,
QMap<int, MyRoom> &rooms)
{
MyRoom room;
QDomElement domGroup1 = getChildElement(domGroup, QStringLiteral("Group"));
for ( ; !domGroup1.isNull(); domGroup1 = domGroup1.nextSiblingElement(domGroup1.tagName()))
{
const QDomElement nameElement = getChildElement(domGroup1, QStringLiteral("Name"), false);
if (!nameElement.text().startsWith(QLatin1String("floor_"), Qt::CaseInsensitive))
continue;
QDomElement domSwitch = getChildElement(domGroup1, QStringLiteral("Switch"), false);
for ( ; !domSwitch.isNull(); domSwitch = domSwitch.nextSiblingElement(domSwitch.tagName()))
{
const QDomElement roomNameElement = getChildElement(domSwitch, QStringLiteral("Name"), false);
if (!roomNameElement.text().startsWith(QLatin1String("SW_room_"), Qt::CaseInsensitive))
continue;
room.id = getInteger(getChildElement(domSwitch, QStringLiteral("SubId")), QStringLiteral("ID"));
QDomElement domGroup2 = getChildElement(domSwitch, QStringLiteral("Group"), false);
for ( ; !domGroup2.isNull(); domGroup2 = domGroup2.nextSiblingElement(domGroup2.tagName()))
{
const QDomElement domBBMin = getChildElement(domGroup2, QStringLiteral("BBox_Min"));
const QDomElement domBBMax = getChildElement(domGroup2, QStringLiteral("BBox_Max"));
room.bBoxMin = positionFromElement(domBBMin);
room.bBoxMax = positionFromElement(domBBMax);
rooms[room.id] = room;
QDomElement extRef = getChildElement(domGroup2, QStringLiteral("External_Reference"), false);
for ( ; !extRef.isNull(); extRef = extRef.nextSiblingElement(extRef.tagName()))
{
const BuildingControlUnit::Bsm bsm = getRefMod(extRef);
if (bsm.id)
bsmConfig.bsmMap.insert(bsm.id, bsm);
}
}
}
}
}
static bool parseFlt(NGL::INGLLogger &logger, const QString &fn,
BuildingControlUnit::BuildingBsmConfig &bsmConfig,
BuildingControlUnit::BuildingBsmConfig &bsmConfigOhneRaumbezug,
QMap<int, MyRoom> &rooms,
std::vector<LtsUtils::QPoint3D> &footprint_ref)
{
const QDomElement domRoot = BuildingControlUnit::readFile(fn, QStringLiteral("STREIF"));
if (domRoot.isNull())
{
WARNING_LOG(logger) << "domRoot isNull";
return false;
}
try
{
const QDomElement domHdr = domRoot.firstChildElement(QStringLiteral("Header"));
const QDomElement domGroup = domHdr.firstChildElement(QStringLiteral("Group"));
QDomElement extRef = getChildElement(domGroup, QStringLiteral("External_Reference"));
for ( ; !extRef.isNull(); extRef = extRef.nextSiblingElement(extRef.tagName()))
{
const BuildingControlUnit::Bsm bsm = getRefMod(extRef);
if (bsm.id)
bsmConfig.bsmMap.insert(bsm.id, bsm);
}
bsmConfigOhneRaumbezug = bsmConfig;
parseRooms(domGroup, bsmConfig, rooms);
{
const QDomElement domHdrFootprint = domRoot.firstChildElement(QStringLiteral("Header"));
const QDomElement domGroupFootprint = domHdrFootprint.firstChildElement(QStringLiteral("Group"));
QDomElement groupElem = domGroupFootprint.firstChildElement(QStringLiteral("Group"));
footprint_ref.clear();
for (; !groupElem.isNull(); groupElem = groupElem.nextSiblingElement(groupElem.tagName()))
{
const QDomElement nameElement = getChildElement(groupElem, QStringLiteral("Name"), false);
if (!nameElement.text().startsWith(QLatin1String("FOOTPRINT"), Qt::CaseInsensitive))
continue;
const QDomElement polygonElem = getChildElement(groupElem, QStringLiteral("Polygon"), false);
if (polygonElem.isNull())
continue;
QDomElement vertexElem = polygonElem.firstChildElement(QStringLiteral("Vertex"));
for (; !vertexElem.isNull(); vertexElem = vertexElem.nextSiblingElement(vertexElem.tagName()))
{
const QDomElement coordElem = vertexElem.firstChildElement(QStringLiteral("Coord"));
if (coordElem.isNull())
continue;
footprint_ref.emplace_back(positionFromElement(coordElem));
}
break;
}
}
}
catch (const BuildingControlUnit::XmlReaderException &ex)
{
WARNING_LOG(logger) << ex.what();
return false;
}
return !bsmConfig.bsmMap.isEmpty();
}
int main(int argc, char *argv[])
{
NGLCoreApplication app(argc, argv);
app.createLogger("BCU", 1);
if (app.arguments().size() != 3)
{
std::cerr << "Usage: " << app.arguments().constFirst().toStdString() << " <foo.flt.xml> <foo.vwm.xml>";
return -1;
}
const QString flt = app.arguments().at(1);
const QString vwm = app.arguments().at(2);
BuildingControlUnit::VWM::Building building;
if (!BuildingControlUnit::VWM::XmlReader::readBuilding(vwm, building))
{
WARNING_LOG(app.baseLogger()) << "parsing failed for '" << flt;
return 1;
}
bool bAllOk = true;
INFO_LOG(app.baseLogger()) << "******** Building '" << building.name() << "' -> checkPolygons for duplicate...";
int numberOfDuplicates = building.checkPolygons();
if (numberOfDuplicates == 0)
INFO_LOG(app.baseLogger()) << "Building '" << building.name() << "' -> " << "fine, no duplicates founds";
else
{
WARNING_LOG(app.baseLogger()) << "Building '" << building.name() << "' -> first search: " << numberOfDuplicates << " duplicates found";
bAllOk = false;
}
{
int numberOfRemoved = building.cleanupPolygons();
WARNING_LOG(app.baseLogger()) << "Building '" << building.name() << "' -> cleanupPolygons: " << numberOfRemoved << " removed";
int numberOfDuplicates2 = building.checkPolygons();
WARNING_LOG(app.baseLogger()) << "Building '" << building.name() << "' -> second search: " << numberOfDuplicates2 << " duplicates found"
<< " bAllOk=" << bAllOk;
bAllOk = true;
}
BuildingControlUnit::BuildingBsmConfig bsmConfig;
BuildingControlUnit::BuildingBsmConfig bsmConfigOhneRaumbezug;
QMap<int, MyRoom> rooms;
std::vector<LtsUtils::QPoint3D> footprint;
if (!parseFlt(app.baseLogger(), flt, bsmConfig, bsmConfigOhneRaumbezug, rooms, footprint) )
{
if (flt.contains(QStringLiteral("bldg_BN_Kanaele"))
|| flt.contains(QStringLiteral("bldg_0910"))
|| flt.contains(QStringLiteral("bldg_2105"))
|| flt.contains(QStringLiteral("bldg_2106"))
|| flt.contains(QStringLiteral("bldg_2107"))
|| flt.contains(QStringLiteral("bldg_2108"))
|| flt.contains(QStringLiteral("bldg_2109"))
|| flt.contains(QStringLiteral("bldg_2110"))
|| flt.contains(QStringLiteral("bldg_2112"))
|| flt.contains(QStringLiteral("bldg_2116"))
|| flt.contains(QStringLiteral("bldg_2117"))
|| flt.contains(QStringLiteral("bldg_2118"))
|| flt.contains(QStringLiteral("bldg_2121"))
|| flt.contains(QStringLiteral("bldg_2122"))
)
{
if (rooms.empty())
{
WARNING_LOG(app.baseLogger()) << "parsing failed for '" << flt
<< " (" << rooms.size() << ")";
return 2;
}
}
else
{
WARNING_LOG(app.baseLogger()) << "parsing failed for '" << flt
<< " (" << rooms.size() << ")";
return 2;
}
}
QPolygonF footprintPoly;
footprintPoly.reserve(footprint.size());
for (auto coord : qAsConst(footprint))
footprintPoly << coord.toPointF();
double maxZ = 0;
for(const MyRoom &room : qAsConst(rooms))
{
TRACE_LOG(app.baseLogger()) << "Room: " << room.id
<< ", bboxMin: " << room.bBoxMin
<< ", bboxMax: " << room.bBoxMax
<< ", center: " << room.center()
<< ", zMax: " << room.maxZ();
maxZ = std::max(maxZ, room.maxZ());
}
const QDomElement domRoot = BuildingControlUnit::readFile(flt, QStringLiteral("STREIF"));
if (domRoot.isNull())
{
WARNING_LOG(app.baseLogger()) << "domRoot isNull";
return 2;
}
#ifdef USE_BUILDINGROOMGEOMETRY
const QDomElement domHdr = domRoot.firstChildElement(QStringLiteral("Header"));
const QDomElement &domGroup = domHdr.firstChildElement(QStringLiteral("Group"));
BuildingControlUnit::VWM::BuildingRoomGeometry buildingRoomGeometry;
if (!buildingRoomGeometry.init(domGroup))
{
WARNING_LOG(app.baseLogger()) << " BuildingRoomGeometry failed for '" << flt;
return -2;
}
#endif
INFO_LOG(app.baseLogger()) << "******** Building '" << building.name() << "' -> BSMs ohne Raumbezug " << "(maxZ=" << maxZ << ")" ;
if (bsmConfigOhneRaumbezug.bsmMap.isEmpty())
{
INFO_LOG(app.baseLogger()) << "Building '" << building.name() << "' -> no outdoor BSM";
} else {
WARNING_LOG(app.baseLogger()) << "Building '" << building.name() << "' -> has outdoor BSMs. Size=" << bsmConfigOhneRaumbezug.bsmMap.size();
for (auto bsm : bsmConfigOhneRaumbezug.bsmMap)
{
WARNING_LOG(app.baseLogger()) << "Building '" << building.name() << "' -> has outdoor BSMs:"
<< "bsm " << bsm.id << " ; position: " << bsm.position
<< " ; bsm direction: " << bsm.direction;
}
}
INFO_LOG(app.baseLogger()) << "******** Building '" << building.name() << "' -> checkBsmPosition using rooms";
for(const MyRoom &myRoom : qAsConst(rooms))
{
const int roomIdToCheck = myRoom.id;
LtsUtils::QPoint3D center = myRoom.center();
center.setZ(maxZ);
center.rx() -= 0.1;
center.ry() -= 0.2;
const LtsUtils::QPoint3D direction(0,0,1);
auto hitPos = BuildingControlUnit::VWM::Math::checkBsmPosition(center, direction, building.rooms());
if (hitPos.state != BuildingControlUnit::VWM::HitPosition::State::OuterWall)
{
int numberOuterWalls = -1;
const BuildingControlUnit::VWM::Room &room = building.room(roomIdToCheck);
if (room.id() == roomIdToCheck)
numberOuterWalls = room.outerWalls().size();
if (numberOuterWalls == 0)
WARNING_LOG(app.baseLogger()) << "Building '" << building.name() << "' -> "
<< "Hit on center point for room " << roomIdToCheck << " will not hit building - no outterWalls"
<< " - position: " << center << ", bsm direction: " << direction
<< ", (hitPos=" << hitPos << ")";
else
{
const bool withinFootprint = footprintPoly.containsPoint(center.toPointF(), Qt::OddEvenFill);
if ((footprintPoly.size() >= 4) &&
withinFootprint)
{
WARNING_LOG(app.baseLogger()) << "Building '" << building.name() << "' -> "
<< "Hit on center point for room " << roomIdToCheck << " will not hit building - "
<< " maybe according outterWalls (#=" << numberOuterWalls << ") are vertical?"
<< " - position: " << center << ", bsm direction: " << direction
<< ", (hitPos=" << hitPos << ")";
} else {
WARNING_LOG(app.baseLogger()) << "Building '" << building.name() << "' -> "
<< "Hit on center point for room " << roomIdToCheck << " will not hit building - "
<< " it´s OUT OF FOOTPRINT"
<< " - position: " << center << ", bsm direction: " << direction;
bAllOk = false;
}
}
}
else if (hitPos.distance < -0.02)
{
WARNING_LOG(app.baseLogger()) << " Building '" << building.name() << "' -> "
<< "Hit on center point for room results in hit pos behind a wall ("
<< QString::number(hitPos.distance) << "m) instead in front - looks like the house is more than "
<< center.z() << "m high!?!?"
<< ", (hitPos=" << hitPos;
bAllOk = false;
}
else
{
center.setZ(rooms.value(hitPos.roomId).maxZ());
hitPos = BuildingControlUnit::VWM::Math::getHitPosition(center, direction * -1, building.rooms());
INFO_LOG(app.baseLogger()) << " Building '" << building.name() << "' -> "
<< "Hit on center point for room " << myRoom.id << " looks fine - room which will be hit: " << hitPos.roomId
<< ", " << QString::number(hitPos.distance) << "m away from outer wall"
<< ((hitPos.distance < 1) ? "" : " - to far away from ceiling!");
}
}
INFO_LOG(app.baseLogger()) << "******** Building '" << building.name() << "' -> checkBsmPosition using BSMs";
for (const BuildingControlUnit::Bsm &bsm : qAsConst(bsmConfig.bsmMap))
{
const auto hitPos = BuildingControlUnit::VWM::Math::checkBsmPosition(bsm.position, bsm.direction, building.rooms());
if (hitPos.state != BuildingControlUnit::VWM::HitPosition::State::OuterWall)
{
WARNING_LOG(app.baseLogger()) << "Building '" << building.name() << "' -> "
<< "Effect on bsm " << bsm.id << " will not hit building ! - position: "
<< bsm.position << ", bsm direction: " << bsm.direction << ", state: " << hitPos.state;
bAllOk = false;
}
else if (hitPos.distance < -0.02)
{
WARNING_LOG(app.baseLogger()) << "Building '" << building.name() << "' -> "
<< "Effect on bsm " << bsm.id << " results in hit pos behind a wall ("
<< QString::number(hitPos.distance) << "m) instead in front - BSM is not modelled in the correct place: "
<< bsm.position << ", bsm direction: " << bsm.direction << ", roomId which was hit: " << hitPos.roomId;
bAllOk = false;
}
else
{
INFO_LOG(app.baseLogger()) << "Building '" << building.name() << "' -> "
<< "BSM with id " << bsm.id << " looks fine - room which will be hit: " << hitPos.roomId
<< ", " << QString::number(hitPos.distance) << "m away from outer wall";
}
}
#ifdef USE_BUILDINGROOMGEOMETRY
int counterOk = 0;
int counterZero = 0;
int counterToMuch = 0;
INFO_LOG(app.baseLogger()) << "******** Building '" << building.name() << "' -> pointIsInWhichRooms using rooms";
int heightZOffset = 2;
for (int heightZ = 1; heightZ<maxZ; )
{
INFO_LOG(app.baseLogger()) << "**** Building '" << building.name() << "' heightZ = " << heightZ;
for(const MyRoom &myRoom : qAsConst(rooms))
{
const int roomIdToCheck = myRoom.id;
LtsUtils::QPoint3D center = myRoom.center();
LtsUtils::QPoint3D delayedDetonationLocation = center;
const bool withinFootprint = footprintPoly.containsPoint(delayedDetonationLocation.toPointF(), Qt::OddEvenFill);
if ((footprintPoly.size() >= 4) &&
withinFootprint)
{
QVector<int> roomsWithDetonation = buildingRoomGeometry.pointIsInWhichRooms(delayedDetonationLocation);
if (roomsWithDetonation.isEmpty())
++counterZero;
else if (roomsWithDetonation.size()==1)
++counterOk;
else
++counterToMuch;
if (roomsWithDetonation.size() == 1)
{
INFO_LOG(app.baseLogger()) << " Building / pointIsInWhichRooms '" << building.name() << "' -> "
<< ", roomIdToCheck = " << roomIdToCheck
<< ", detoLoc = " << delayedDetonationLocation
<< " fine, found just one room: " << roomsWithDetonation.first();
} else {
QString roomIdsStr(QStringLiteral("roomIds("));
for (auto roomId : qAsConst(roomsWithDetonation))
roomIdsStr.append(QString(QStringLiteral("%1 ")).arg(roomId));
roomIdsStr.append(QStringLiteral(")"));
WARNING_LOG(app.baseLogger()) << " Building / pointIsInWhichRooms '" << building.name() << "'"
<< ", roomIdToCheck = " << roomIdToCheck
<< ", delayedDetonationLocation = " << delayedDetonationLocation
<< " wrongSize roomsWithDetonation.size() != 1 , size=" << roomsWithDetonation.size()
<< ", roomIds=" << roomIdsStr;
bAllOk = false;
}
}
}
heightZ += heightZOffset;
}
INFO_LOG(app.baseLogger()) << "******** Building '" << building.name() << "' -> pointIsInWhichRooms using rooms RESULT"
<< ", counterZero = " << counterZero
<< ", counterOk = " << counterOk
<< ", counterToMuch = " << counterToMuch
<< ", percentOk = " << counterOk*100.0 / (counterZero+counterOk+counterToMuch);
#endif
return bAllOk ? 0 : 5;
}
@@ -0,0 +1,918 @@
#include "vwm_api.h"
#include "vwm_deposition.h"
#include "vwm_xml_reader.h"
#include "vwm_state_store.h"
#include "vwm_math.h"
#include <QDateTime>
#include <settings.h>
#include <QFile>
#include <initializer_list>
#ifdef LTS_DEBUG
# include <QTextStream>
# include <sstream>
#endif
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonParseError>
#include <QDebug>
namespace BuildingControlUnit
{
namespace VWM
{
Api::Api(QObject *parent)
: QObject(parent)
, m_lastHitResult(HitResult())
, m_logger(BuildingControlUnit::getLogger("VWM.Api"))
{}
bool Api::init(const QString &chargesConfig,
const QString &vulBuildingConfig,
const BuildingBsmConfig &bsmConfig,
const bool initBuilding)
{
DEBUG_LOG(m_logger) << "chargesConfig=" << chargesConfig;
if (!XmlReader::readCharges(chargesConfig, m_chargeMap))
return false;
if (!XmlReader::readBuilding(vulBuildingConfig, m_building))
return false;
QString fltXml = QString(QStringLiteral("/opt/BuildingModels/StaticMeshes/%1.flt.xml")).arg(m_building.name());
if (!XmlReader::readBuildingGeometry(fltXml, m_buildingRoomGeometry ))
{
ERROR_LOG(m_logger) << "Error reading buildingRoomGeometry from file: " << fltXml << "'";
}
DEBUG_LOG(m_logger) << "Building buildingRoomGeometry read successfully from file: " << fltXml << "'";
int numberOfRemoved = m_building.cleanupPolygons();
int numberOfDuplicates = m_building.checkPolygons();
DEBUG_LOG(m_logger) << "Building cleanupPolygons: " << m_building.name() << "' -> " << numberOfRemoved << " points removed";
if (numberOfDuplicates > 0)
ERROR_LOG(m_logger) << "Building checkPolygons: " << m_building.name() << "' -> " << numberOfDuplicates << " duplicates";
else
DEBUG_LOG(m_logger) << "Building checkPolygons: " << m_building.name() << "' -> " << numberOfDuplicates << " duplicates";
m_bsmMap = bsmConfig.bsmMap;
m_building.init();
if (!initBuilding)
StateStore::loadState(m_building, m_lastHitResult, m_contaminationStates);
else
StateStore::saveState(m_building, m_lastHitResult, m_contaminationStates);
m_lastHitResult.rooms = m_building.roomStates();
m_lastHitResult.damageState = m_building.damageState();
m_lastHitResult.damagePercentNew = m_building.damagePercent();
return true;
}
void Api::onHitOptical(qint64 timeMSec, int sensorId, int originatorId, int chargeTypeId, int deposition1, int deposition2)
{
const Bsm bsm = m_bsmMap.value(sensorId);
if (!bsm.isValid())
{
WARNING_LOG(m_logger) << "Given bsm id " << sensorId << " is not in our internal bsm list!";
return;
}
const LtsUtils::QPoint3D depositionRel = getDeposition(deposition1, deposition2, bsm.direction);
Hit hit;
hit.effectTimeMSec = timeMSec;
hit.sensorId = sensorId;
hit.originatorId = originatorId;
hit.originatorType = OriginatorType::DirectHit;
hit.chargeTypeId = chargeTypeId;
hit.position = bsm.position + depositionRel;
hit.direction = bsm.direction * -1;
sendHitToVwm(hit);
}
void Api::onSetEffectStatesRequest(const QString &hostname, const QVector<BcuEffectState> &effectStates)
{
DEBUG_LOG(m_logger) << "onSetEffectStatesRequest:"
<< " hostname= " << hostname
<< " effectStes.zize=" << effectStates.size();
QJsonObject overridesObj;
if (hostname.isEmpty())
{
for (const BcuEffectState &es : effectStates)
{
if (es.type == BcuEffectType::BET_BsmFlash)
{
if (es.effectOverride == BcuEffectOverride::BEO_Off)
{
overridesObj.insert(QStringLiteral("flash"), 0);
DEBUG_LOG(m_logger) << "flash = 0";
}
}
}
}
else
{
QJsonArray relayStateArray;
for (const BcuEffectState &es : effectStates)
{
if (es.effectOverride == BcuEffectOverride::BEO_Auto)
continue;
if (es.type == BcuEffectType::BET_Relay)
{
QJsonObject relayStateObj;
relayStateObj[QString::number(es.id)]=es.effectOverride;
DEBUG_LOG(m_logger) << "relay = " << QString::number(es.id)
<< " " << es.effectOverride;
relayStateArray.append(relayStateObj);
}
else if (es.type == BcuEffectType::BET_BackgroundSound)
{
overridesObj.insert(QStringLiteral("sound"), es.effectOverride);
DEBUG_LOG(m_logger) << "sound=" << es.effectOverride;
}
}
overridesObj.insert(QStringLiteral("relays"), relayStateArray);
}
QJsonObject propertiesObj;
propertiesObj[QStringLiteral("Overrides")] = overridesObj;
QString totalString = QString::fromLatin1(QJsonDocument(propertiesObj).toJson(QJsonDocument::Compact));
DEBUG_LOG(m_logger) << "totalString=" << totalString;
m_building.setSegmentProperties(hostname,totalString);
StateStore::saveState(m_building, m_lastHitResult, m_contaminationStates);
}
void Api::dumpHitResult(const Hit &hit, const HitResult &result, const Charge &chargeOrg, const Charge &charge, const QString &context)
{
static QString filename = QString(QLatin1String("/tmp/ShotResult_%1_%2.csv")).arg(m_building.name()).arg(result.effectTimeMSec);
QFile data(filename);
if(data.open(QFile::WriteOnly | QIODevice::Append ))
{
QTextStream output(&data);
output << "EffectTime at," << QDateTime::fromMSecsSinceEpoch(result.effectTimeMSec).toString(QStringLiteral("yyyy.MM.dd hh:mm::ss")) << "\n";
output << ",(" << result.effectTimeMSec << ")\n";
output << "Bldg-Name," << m_building.name() << "\n";
output << "Context," << context << "\n";
{
std::ostringstream stream;
stream << result.originatorType;
output << "OriginatorType," << QString::fromStdString(stream.str()) << "\n";
}
{
output << " [BCU]minimumRemainEffectThreshold," << Settings::minimumRemainEffectThreshold() << "\n";
output << " [BCU]transitionMultiplier," << Settings::transitionMultiplier() << "\n";
output << " buildingProtectionLevel," << m_building.buildingProtectionLevel() << "\n";
}
output << "ChargeTypeId," << result.chargeTypeId << "\n";
output << " Original dstrctvZF/pntrtnWF, "
<< QString::number(chargeOrg.destructiveFactor) << QStringLiteral("/") << QString::number(chargeOrg.penetrationEffect)<< "\n";
output << " Current dstrctvZF/pntrtnWF, "
<< QString::number(charge.destructiveFactor) << QStringLiteral("/") << QString::number(charge.penetrationEffect)<< "\n";
output << "OriginatorId," << result.originatorId << "\n";
{
std::ostringstream stream;
stream << hit.typeOfHit;
output << "TypeOfHit," << QString::fromStdString(stream.str()) << "\n";
output << "BelowGround(Hack)," << m_building.isLastHitPositionBelowGroundHack() << "\n";
}
output << "RoomId," << m_building.lastHitPosition().roomId << "\n";
{
std::ostringstream stream;
stream << result.damageState;
output << "DamageState," << QString::fromStdString(stream.str()) << "\n";
}
output << "DamagePercentNew," << result.damagePercentNew << "\n";
output << "DamagePercentOld," << result.damagePercentOld << "\n";
output << ",," << "\n";
output << "RoomId,damagePercent,remainingEffectPercent,directHit" << "\n";
for (const HitRoom &hitRoom : qAsConst(result.rooms))
{
output << hitRoom.roomId << ","
<< hitRoom.damagePercent << ","
<< hitRoom.remainingEffectPercent << ","
<< hitRoom.directHit << ","
<< "\n";
}
output << ",," << "\n";
output << ",," << "\n";
}
}
void Api::onHitOpticalOC(qint64 timeMSec, int sensorId, int originatorId, int chargeTypeId, DamageState damageState)
{
Hit hit;
const Bsm bsm = m_bsmMap.value(sensorId);
if (bsm.isValid())
{
hit.position = bsm.position;
hit.direction = bsm.direction * -1;
}
hit.sensorId = sensorId;
hit.effectTimeMSec = timeMSec;
hit.damageStateOverride = damageState;
hit.chargeTypeId = chargeTypeId;
hit.originatorId = originatorId;
hit.originatorType = OriginatorType::OC;
sendHitToVwm(hit);
}
void Api::onHitEcc(int originatorId, DamageState damageState, const QVector<int> &roomIds)
{
Hit hit;
hit.effectTimeMSec = QDateTime::currentMSecsSinceEpoch();
hit.damageStateOverride = damageState;
hit.originatorId = originatorId;
hit.originatorType = OriginatorType::ECC;
hit.affectedRoomIds = roomIds;
sendHitToVwm(hit);
}
void Api::onSetContaminationState(const std::vector<ContaminationState> &contaminationStates)
{
DEBUG_LOG(m_logger) << "contaminationStates.size=" << contaminationStates.size();
for (const auto &newcs : contaminationStates)
{
DEBUG_LOG(m_logger) << "newcs.damagePercentNew=" << newcs.damagePercentNew
<< " m_lastHitResult.damagePercentNew=" << m_lastHitResult.damagePercentNew;
if ( newcs.damagePercentNew > m_lastHitResult.damagePercentNew)
{
DEBUG_LOG(m_logger) << "newcs.damagePercentNew=" << newcs.damagePercentNew;
m_lastHitResult.damagePercentNew = newcs.damagePercentNew;
}
if (m_contaminationStates.contains(newcs.aesId))
{
#if QT_VERSION < QT_VERSION_CHECK(5,10,0)
QSet<int> roomsSet;
for (const auto i: qAsConst(newcs.rooms))
{
roomsSet.insert(i);
}
#else
QSet<int> roomsSet = QSet<int>(newcs.rooms.begin(), newcs.rooms.end());
#endif
const auto &rooms = m_contaminationStates.value(newcs.aesId).rooms;
for (const auto &oldRoom : rooms)
roomsSet.insert(oldRoom);
ContaminationState contaState;
contaState.aesId = newcs.aesId;
contaState.damagePercentNew = newcs.damagePercentNew;
contaState.rooms = std::vector<int>(roomsSet.begin(), roomsSet.end());
m_contaminationStates[newcs.aesId] = contaState;
}
else
m_contaminationStates.insert(newcs.aesId, newcs);
}
DEBUG_LOG(m_logger) << "onSetContaminationState emit hitResult "
<< " m_lastHitResult.damagePercentNew=" << m_lastHitResult.damagePercentNew;
emit hitResult(m_lastHitResult, m_contaminationStates, false);
StateStore::saveState(m_building, m_lastHitResult, m_contaminationStates);
}
void Api::onResetContaminations()
{
m_contaminationStates.clear();
DEBUG_LOG(m_logger) << "onResetContaminations emit hitResult";
m_lastHitResult.chargeTypeId = 0;
m_lastHitResult.originatorId = 0;
m_lastHitResult.originatorType = BuildingControlUnit::OriginatorType::ECC;
emit hitResult(m_lastHitResult, m_contaminationStates, false);
StateStore::saveState(m_building, m_lastHitResult, m_contaminationStates);
}
void Api::onHitCes(const qint64 effectTimeMSec, const int chargeTypeId,
const int destructiveFactor, const int penetrationFactor,
const int aesId, const LtsUtils::QPoint3D &posImpact,
const QString &properties)
{
Q_UNUSED(properties);
Hit hit;
hit.effectTimeMSec = effectTimeMSec;
hit.chargeTypeId = chargeTypeId;
hit.destructiveFactor = destructiveFactor;
hit.penetrationFactor = penetrationFactor;
hit.originatorId = aesId;
hit.originatorType = OriginatorType::CesHit;
hit.position = posImpact;
hit.position.setZ(1);
INFO_LOG(m_logger) << "XXXXX CES Hit = " << hit;
BuildingControlUnit::VWM::HitPosition hitPos;
hitPos.distance = +10000;
LtsUtils::QPoint3D posTmp(posImpact);
posTmp.setZ(10000);
const LtsUtils::QPoint3D direction(0,0,1);
const auto hitPosTmp = BuildingControlUnit::VWM::Math::checkBsmPosition(posTmp, direction, m_building.rooms());
INFO_LOG(m_logger) << "XXXXX hitPosTmp after checkBsmPosition = " << hitPosTmp;
if (hitPosTmp.state != BuildingControlUnit::VWM::HitPosition::State::NoHit)
{
auto room = m_building.rooms().value(hitPosTmp.roomId);
if (room.isValid())
{
{
hitPos = hitPosTmp;
hit.direction = direction * -1;
hit.position = posTmp;
}
}
hit.typeOfHit = TypeOfHit::InsideBuilding;
}
LtsUtils::QPoint3D posImpactOnGround(posImpact);
posImpactOnGround.setZ(1);
NearestWall nearestWall;
if (hitPos.state == BuildingControlUnit::VWM::HitPosition::State::NoHit)
{
INFO_LOG(m_logger) << "XXXXX CES Hit outside building - searching nearest wall ...";
double distanceOut = 0;
LtsUtils::QPoint3D directionWallElementPointToDetonationOut;
nearestWall = findNearestWall(posImpactOnGround, distanceOut, directionWallElementPointToDetonationOut);
if (nearestWall.isValid())
{
hitPos.state = BuildingControlUnit::VWM::HitPosition::State::OuterWall;
hitPos.distance = distanceOut;
hit.direction = directionWallElementPointToDetonationOut;
hit.typeOfHit = TypeOfHit::OutsideBuilding;
}
}
if (hitPos.state == BuildingControlUnit::VWM::HitPosition::State::NoHit)
{
WARNING_LOG(m_logger) << "Internal error - could not find impact position on building "
<< m_building.name() << " with impact pos " << posImpactOnGround;
}
INFO_LOG(m_logger) << "XXXXX Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
<< " (p=" << hit.direction+posImpactOnGround << ")"
<< " ; nearestWall.roomId=" << nearestWall.roomId;
for (auto item : qAsConst(nearestWall.wallElement))
DEBUG_LOG(m_logger) << "Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
<< " (p=" << hit.direction+posImpactOnGround
<< " - " << item;
if (nearestWall.wallElement.isEmpty())
{
sendHitToVwm(hit);
} else {
const LtsUtils::QPoint3D &center = centerOfWallElement3D(nearestWall.wallElement);
INFO_LOG(m_logger) << "XXXXX Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
<< ", m_building.name=" << m_building.name()
<< ", m_building.modelId=" << m_building.modelId()
<< ", nearestWall.roomId=" << nearestWall.roomId
<< ", hitPos.distance=" << hitPos.distance
<< ", center=" << center
<< ", direction would be " << center-posImpactOnGround;
hit.direction = center - posImpactOnGround;
sendHitToVwm(hit);
}
}
NearestWall Api::findNearestWall(const LtsUtils::QPoint3D &detonationLocation, double &distanceOut, LtsUtils::QPoint3D &directionWallElementPointToDetonationOut)
{
NearestWall nearestWall;
distanceOut = std::numeric_limits<double>::max();
INFO_LOG(m_logger) << "XXXXX searching nearest wall ...";
for (const Room &room : qAsConst(m_building.rooms()))
{
for (const OuterWall &wall : qAsConst(room.outerWalls()))
{
for (const WallElement &we : qAsConst(wall.elements()))
{
for (const LtsUtils::QPoint3D &p : qAsConst(we))
{
const double dist = (detonationLocation - p).length();
DEBUG_LOG(m_logger) << "Room[" << room.id() << "]: " << p << ", dist = " << dist;
if (dist >= distanceOut)
continue;
distanceOut = dist;
INFO_LOG(m_logger) << "New min distance " << dist << " Room[" << room.id() << "]: " << p;
directionWallElementPointToDetonationOut = p - detonationLocation;
nearestWall.roomId = room.id();
nearestWall.wallElement = we;
}
}
}
}
return nearestWall;
}
void Api::onHitCes3D_Evaluation(const qint64 effectTimeMSec,
const int chargeTypeId, const int destructiveFactor, const int penetrationFactor,
const int aesId,
const LtsUtils::QPoint3D &posImpact,
const LtsUtils::QPoint3D &detonationLocation,
const double detonationDistance,
const QString &properties)
{
Q_UNUSED(posImpact);
Q_UNUSED(properties);
Hit hit;
hit.effectTimeMSec = effectTimeMSec;
hit.chargeTypeId = chargeTypeId;
hit.originatorId = aesId;
hit.originatorType = OriginatorType::CesHit3D;
hit.position = detonationLocation;
INFO_LOG(m_logger) << "XXXXXXXXXX CES Hit 3D = " << hit
<< ", detonationLocation = " << detonationLocation
<< ", detonationDistance = " << detonationDistance
<< ", chargeTypeId = " << chargeTypeId
<< ", destructiveFactor = " << destructiveFactor
<< ", penetrationFactor = " << penetrationFactor;
QVector<int> roomsWithDetonation;
const bool bIsDelayed = detonationDistance > 0;
HitPosition hitPosPreCalculated;
hitPosPreCalculated.state = HitPosition::State::OuterWall;
hitPosPreCalculated.outerWallIdx = 0;
if (bIsDelayed)
{
roomsWithDetonation = m_buildingRoomGeometry.pointIsInWhichRooms(detonationLocation);
if (roomsWithDetonation.isEmpty())
{
INFO_LOG(m_logger) << "XXXX Building '" << m_building.name() << "'"
<< ", detonationLocation = " << detonationLocation
<< " -> found no room";
} else {
if (roomsWithDetonation.size() == 1)
INFO_LOG(m_logger) << "XXXX Building '" << m_building.name() << "'"
<< ", detonationLocation = " << detonationLocation
<< " -> found just one room: " << roomsWithDetonation.first();
else
INFO_LOG(m_logger) << "XXXX Building '" << m_building.name() << "'"
<< ", detonationLocation = " << detonationLocation
<< " -> found several rooms, choose first: " << roomsWithDetonation.first();
hitPosPreCalculated.roomId = roomsWithDetonation.first();
hitPosPreCalculated.exclusionZoneIdx = -1;
hitPosPreCalculated.distance = 0;
}
}
if (!bIsDelayed ||
roomsWithDetonation.isEmpty())
{
double distanceOut = 0;
LtsUtils::QPoint3D directionWallElementPointToDetonationOut;
NearestWall nearestWall = findNearestWall(detonationLocation, distanceOut, directionWallElementPointToDetonationOut);
INFO_LOG(m_logger) << "XXXXX CES Hit outside building - searching nearest wall ..."
<< ", detonationDistance = " << detonationDistance
<< ", nearestWall.roomId = " << nearestWall.roomId;
if (nearestWall.isValid())
{
hitPosPreCalculated.roomId = nearestWall.roomId;
hitPosPreCalculated.distance = distanceOut;
hit.direction = directionWallElementPointToDetonationOut;
if (bIsDelayed)
hit.typeOfHit = TypeOfHit::InsideBuilding;
else
hit.typeOfHit = TypeOfHit::OutsideBuilding;
}
}
HitResult result;
result.damagePercentOld = m_building.damagePercent();
result.effectTimeMSec = effectTimeMSec;
QString context(QStringLiteral("onHitCes-3D - "));
const Charge &chargeOrg = chargeFromChargeTypeId(chargeTypeId);
Charge charge = chargeOrg;
charge.destructiveFactor = destructiveFactor;
charge.penetrationEffect = penetrationFactor;
if (detonationDistance>0)
{
charge.destructiveFactor *= 2.1;
charge.penetrationEffect *= 2.1;
context += QStringLiteral("FtDelay");
} else if (detonationDistance<0)
{
charge.destructiveFactor *= 0.55;
charge.penetrationEffect *= 0.55;
context += QStringLiteral("FtProximity");
} else {
context += QStringLiteral("FtImpact");
}
bool hitSuccess = m_building.hit(LtsUtils::QPoint3D(), LtsUtils::QPoint3D(),
charge, &hitPosPreCalculated);
INFO_LOG(m_logger) << "onHitCes3D_Evaluation hitSuccess=" << hitSuccess;
result.rooms = m_building.roomStates();
result.damageState = m_building.damageState();
result.damagePercentNew = m_building.damagePercent();
result.chargeTypeId = chargeTypeId;
result.originatorType = OriginatorType::CesHit;
result.originatorId = aesId;
#ifdef LTS_DEBUG
dumpHitResult(hit, result, chargeOrg, charge, context);
#endif
emit hitResult(result, m_contaminationStates, true);
}
void Api::onFortifyFactorRequest(int originatorId, const QVector<FortifyInfo> &foritfyInfos)
{
HitResult result;
result.effectTimeMSec = QDateTime::currentMSecsSinceEpoch();
result.originatorId = originatorId;
result.originatorType = OriginatorType::ECC;
result.damagePercentOld = m_building.damagePercent();
m_building.setFortifyInfo(foritfyInfos);
result.rooms = m_building.roomStates();
result.damageState = m_building.damageState();
result.damagePercentNew = m_building.damagePercent();
emit hitResult(result, m_contaminationStates, true);
m_lastHitResult = result;
}
void Api::onRelayStatesRequest(const QString &hostname, const QVector<RelayStateInfo> &relayStateInfos)
{
DEBUG_LOG(m_logger) << "onRelayStateRequest hostname=" << hostname
<< " only hanlde in svcBuildings"
<< " relayStateInfos.size()=" << relayStateInfos.size();
}
void Api::sendOverrides()
{
const QMap<QString, QString> &segmentPropertyMap = m_building.segmentPropertyMap();
QVector<BcuEffectState> effectStates;
for (auto it = segmentPropertyMap.cbegin(); it != segmentPropertyMap.cend(); ++it)
{
QString hostname = it.key();
QString properties = it.value();
effectStates.clear();
QJsonParseError parserError;
const QJsonDocument doc(QJsonDocument::fromJson(properties.toUtf8(), &parserError));
if (parserError.error != QJsonParseError::NoError)
continue;
QJsonObject docObj = QJsonObject(doc.object());
DEBUG_LOG(m_logger) << "sendOverrides hostname=" << hostname
<< " properties=" << properties;
{
DEBUG_LOG(m_logger) << "sendOverrides hostname=" << hostname
<< " properties=" << properties << "BCU-Flash";
BcuEffectState bcuEffectState;
bcuEffectState.id = 1;
bcuEffectState.type = BcuEffectType::BET_BsmFlash;
BcuEffectOverride eo = BcuEffectOverride::BEO_Auto;
QJsonObject overrideObj;
QJsonObject flashObj;
if (docObj.contains(QStringLiteral("Overrides")))
{
overrideObj = docObj[QStringLiteral("Overrides")].toObject();
}
if (overrideObj.contains(QStringLiteral("flash")))
{
flashObj = docObj[QStringLiteral("flash")].toObject();
eo = static_cast<BuildingControlUnit::BcuEffectOverride>(flashObj.value(QStringLiteral("flash")).toInt());
}
if (eo != BcuEffectOverride::BEO_Auto)
{
DEBUG_LOG(m_logger) << "bcuEffectState.effectOverride = eo" << eo;
bcuEffectState.effectOverride = eo;
emit newOverrides({}, {bcuEffectState});
}
}
QJsonObject overridesObj = docObj.value(QStringLiteral("Overrides")).toObject();
QJsonArray arrEgcus = overridesObj.value(QStringLiteral("relays")).toArray();
for (int i=0; i<arrEgcus.size(); ++i)
{
QJsonObject objState = arrEgcus[i].toObject();
QStringList keys = objState.keys();
QString relayIdString = keys.at(0);
int relayId = relayIdString.toInt();
if (!objState.contains(relayIdString))
continue;
BcuEffectOverride eo = static_cast<BuildingControlUnit::BcuEffectOverride>(objState.value(relayIdString).toInt());
if (eo == BcuEffectOverride::BEO_Auto)
continue;
BuildingControlUnit::BcuEffectState bcuEffectState;
bcuEffectState.id = relayId;
bcuEffectState.type = BcuEffectType::BET_Relay;
bcuEffectState.effectOverride = eo;
effectStates.append(bcuEffectState);
}
{
BuildingControlUnit::BcuEffectState bcuEffectState;
bcuEffectState.id = 1;
bcuEffectState.type = BcuEffectType::BET_BackgroundSound;
BcuEffectOverride eo = BcuEffectOverride::BEO_Auto;
if (overridesObj.contains(QStringLiteral("sound")))
eo = static_cast<BuildingControlUnit::BcuEffectOverride>(overridesObj.value(QStringLiteral("sound")).toInt());
if (eo != BcuEffectOverride::BEO_Auto)
{
bcuEffectState.effectOverride = eo;
effectStates.append(bcuEffectState);
}
}
emit newOverrides(hostname,effectStates);
}
}
void Api::sendHitToVwm(const Hit &hit)
{
m_hitsSinceLastInit += hit;
INFO_LOG(m_logger) << " XXXXX sendHitToVwm, Incoming hit=" << hit
<< " hit.chargeTypeId=" << hit.chargeTypeId
<< " originatorId=" << hit.originatorId
<< " typeOfHit=" << hit.typeOfHit;
HitResult result;
result.sensorId = hit.sensorId;
result.effectTimeMSec = hit.effectTimeMSec;
result.originatorId = hit.originatorId;
result.originatorType = hit.originatorType;
result.damagePercentOld = m_building.damagePercent();
switch (hit.originatorType)
{
case OriginatorType::CesHit:
case OriginatorType::CesHit3D:
case OriginatorType::DirectHit:
{
Charge charge, chargeOrg;
charge = chargeFromChargeTypeId(hit.chargeTypeId);
if ( ( hit.originatorType == OriginatorType::CesHit)
|| ( hit.originatorType == OriginatorType::CesHit3D))
{
charge.destructiveFactor = hit.destructiveFactor;
charge.penetrationEffect = hit.penetrationFactor;
}
DEBUG_LOG(m_logger) << "charge=" << charge.chargeTypeId
<< " destructiveFactor" << charge.destructiveFactor
<< " penetrationEffect" << charge.penetrationEffect;
chargeOrg = charge;
result.chargeTypeId = hit.chargeTypeId;
result.effectSoundId = charge.effectSoundId;
if ( charge.destructiveFactor == 0
&& !charge.showHitLine)
return;
if ((hit.originatorType == OriginatorType::CesHit) &&
(hit.typeOfHit == TypeOfHit::OutsideBuilding))
{
LtsUtils::QPoint3D dummyDist = hit.position - hit.direction;
INFO_LOG(m_logger) << " XXXX CES outside bulding, reduce charge: " << charge
<< ", hit.position " << hit.position
<< ", hit.direction " << hit.direction
<< ", dummyDist " << dummyDist.length();
charge.destructiveFactor *= 0.5;
charge.penetrationEffect *= 0.5;
INFO_LOG(m_logger) << " XXXX CES outside bulding, reduce charge: " << charge;
}
if (!charge.isValid())
{
if (hit.originatorType == OriginatorType::CesHit)
WARNING_LOG(m_logger) << "Charge with id " << hit.chargeTypeId
<< " not configured - can not caluclate impact effect for this charge";
else
{
WARNING_LOG(m_logger) << "Direct charge with id " << hit.chargeTypeId
<< " not configured - can not caluclate impact effect for this charge";
emit unknownDirectHit(hit.sensorId);
}
break;
}
if (!m_building.hit(hit.position, hit.direction, charge))
{
WARNING_LOG(m_logger) << "Detected hit was outside of the building - ignored";
break;
}
result.rooms = m_building.roomStates();
result.damageState = m_building.damageState();
result.damagePercentNew = m_building.damagePercent();
emit hitResult(result, m_contaminationStates, true);
#ifdef LTS_DEBUG
dumpHitResult(hit, result, chargeOrg, charge, QStringLiteral("default"));
#endif
m_lastHitResult = result;
break;
}
case OriginatorType::ECC:
case OriginatorType::OC:
{
if (!hit.affectedRoomIds.isEmpty())
{
m_building.setRoomState(hit.damageStateOverride, hit.affectedRoomIds);
result.rooms = m_building.roomStates();
result.damageState = m_building.damageState();
result.damagePercentNew = m_building.damagePercent();
emit hitResult(result, m_contaminationStates, true);
m_lastHitResult = result;
break;
}
switch (hit.damageStateOverride)
{
case DamageState::NoDamage:
{
DEBUG_LOG(m_logger) << "Hit OC/ECC with NoDamage";
m_building.init();
result.effectSoundId = Settings::effectSoundIdEccActivate();
result.rooms = m_building.roomStates();
result.damageState = DamageState::NoDamage;
result.damagePercentNew = m_building.damagePercent();
emit hitResult(result, m_contaminationStates, true);
#ifdef LTS_DEBUG
dumpHitResult(hit, result, Charge(), Charge(), QStringLiteral("Reset by ECC/OC"));
#endif
m_hitsSinceLastInit.clear();
m_hitsSinceLastInit += hit;
m_lastHitResult = result;
break;
}
case DamageState::Destroyed:
{
DEBUG_LOG(m_logger) << "Hit OC/ECC with Destroyed";
const DamageState dsOld = m_building.damageState();
m_building.destroyAllRooms();
result.effectSoundId = Settings::effectSoundIdEccDestroy();
result.rooms = m_building.roomStates();
result.damageState = DamageState::Destroyed;
result.damagePercentNew = m_building.damagePercent();
if (dsOld != DamageState::Destroyed)
{
emit hitResult(result, m_contaminationStates, true);
#ifdef LTS_DEBUG
dumpHitResult(hit, result, Charge(), Charge(), QStringLiteral("Destroyed by ECC/OC"));
#endif
}
m_lastHitResult = result;
break;
}
default:
WARNING_LOG(m_logger) << "Invalid damage state override given: " << hit.damageStateOverride;
result = HitResult();
break;
}
break;
}
case OriginatorType::Unknown:
WARNING_LOG(m_logger) << "Unknown originator type given: " << hit.originatorType;
result = HitResult();
break;
}
StateStore::saveState(m_building, m_lastHitResult, m_contaminationStates);
}
const Charge Api::chargeFromChargeTypeId(int chargeTypeId) const
{
if (chargeTypeId > 4000)
{
chargeTypeId %= 1000;
chargeTypeId += 2000;
}
for (auto i = m_chargeMap.cbegin(), end = m_chargeMap.cend(); i != end; ++i)
{
TRACE_LOG(m_logger) << "key=" << i.key() << " value=" << i.value();
if ( chargeTypeId == i.value().id)
return m_chargeMap.value(i.key());
}
return m_chargeMap.value(chargeTypeId);
}
}
}
@@ -0,0 +1,92 @@
#pragma once
#include "vwm_building_room_geometry.h"
#include <QObject>
#include <logger.h>
#include "vwm_building.h"
#include "vwm_types.h"
#include <VWM/buildingcontrolvwm_export.h>
namespace BuildingControlUnit
{
namespace VWM
{
struct NearestWall
{
int roomId{0};
WallElement wallElement;
bool isValid() const { return roomId > 0; }
};
class BUILDINGCONTROLVWM_EXPORT Api : public QObject
{
Q_OBJECT
public:
explicit Api(QObject *parent = nullptr);
bool init(const QString &chargesConfig,
const QString &vulBuildingConfig,
const BuildingBsmConfig &bsmConfig,
const bool initBuilding);
const Building &building() const { return m_building; }
const QVector<Hit> &hitsSinceLastInit() const { return m_hitsSinceLastInit; }
const HitResult lastHitResult() const { return m_lastHitResult; }
const QMap<int, ContaminationState> contaminationStates() const {return m_contaminationStates;}
const QMap<int, Bsm> &bsmMap() const { return m_bsmMap; }
void sendOverrides();
const Charge chargeFromChargeTypeId(int chargeTypeId) const;
public Q_SLOTS:
void onHitOptical(qint64 timeMSec,
int sensorId,
int originatorId,
int chargeTypeId,
int deposition1,
int deposition2);
void onHitOpticalOC(qint64 timeMSec,
int sensorId,
int originatorId,
int chargeTypeId,
DamageState damageState);
void onHitEcc(int originatorId, DamageState damageState, const QVector<int> &roomIds);
void onSetContaminationState(const std::vector<ContaminationState> &contaminationStates);
void onResetContaminations();
void onHitCes(const qint64 effectTimeMSec, const int chargeTypeId,
const int destructiveFactor, const int penetrationFactor,
const int aesId, const LtsUtils::QPoint3D &posImpact,
const QString &properties);
NearestWall findNearestWall(const LtsUtils::QPoint3D &detonationLocation, double &distanceOut, LtsUtils::QPoint3D &directionWallElementPointToDetonationOut);
void onHitCes3D_Evaluation(const qint64 effectTimeMSec, const int chargeTypeId,
const int destructiveFactor, const int penetrationFactor,
const int aesId, const LtsUtils::QPoint3D &posImpact,
const LtsUtils::QPoint3D &detonationLocation, const double detonationDistance,
const QString &properties);
void onFortifyFactorRequest(int originatorId, const QVector<FortifyInfo> &foritfyInfos);
void onRelayStatesRequest(const QString &hostname, const QVector<RelayStateInfo> &relayStateInfos);
void onSetEffectStatesRequest(const QString &hostname, const QVector<BcuEffectState> &effectStates);
void dumpHitResult(const Hit &hit, const HitResult &result, const Charge &chargeOrg, const Charge &charge, const QString &context);
Q_SIGNALS:
void hitResult(const HitResult &result, const QMap <int, ContaminationState> &contaminationStates, bool playSound);
void newOverrides( const QString &hostname, const QVector<BcuEffectState> &effectStates);
void unknownDirectHit(int sensorId);
private:
void sendHitToVwm(const Hit &hit);
private:
QMap<int, Bsm> m_bsmMap;
QMap<int, Charge> m_chargeMap;
QVector<Hit> m_hitsSinceLastInit;
HitResult m_lastHitResult;
QMap <int, ContaminationState> m_contaminationStates;
Building m_building;
BuildingRoomGeometry m_buildingRoomGeometry;
NGL::INGLLogger &m_logger;
};
}
}
@@ -0,0 +1,922 @@
#include "vwm_building.h"
#include "vwm_math.h"
#include <QSet>
#include <QVector>
#include <QLineF>
#include <settings.h>
#include <algorithm>
namespace BuildingControlUnit
{
namespace VWM
{
static NGL::INGLLogger &logger()
{
return BuildingControlUnit::getLogger("VWM.Building");
}
static inline bool isEffectNegligible(double effect)
{
return (effect < Settings::minimumRemainEffectThreshold());
}
static inline bool isEffectNegligible(double RW, double ZF, double TF)
{
return isEffectNegligible(ZF * RW * TF);
}
static inline double calcProtectionOfWallAfterHit(double SG_alt, double RW, double ZF, double TF)
{
const double SG_diff = ZF * RW * TF;
if (isEffectNegligible(SG_diff))
return SG_alt;
return std::max(0.0, SG_alt - SG_diff);
}
void WallExclusionZoneBase::setInitalProtection(double initialProtection, bool bResetProtection)
{
m_initialProtection = initialProtection;
if (bResetProtection)
m_protection = initialProtection;
}
void WallExclusionZoneBase::updateProtection(const double RW, const double ZF, const double TF)
{
const double SG_alt = m_protection;
const double SG_neu = calcProtectionOfWallAfterHit(SG_alt, RW, ZF, TF);
m_protection = SG_neu;
}
void Room::setFortifyFactor(double factorNew, bool bRecalcValues)
{
const double factorOld = m_fortifyFactor;
if (qFuzzyIsNull(factorOld) || qFuzzyIsNull(factorNew))
return;
m_fortifyFactor = factorNew;
if (bRecalcValues)
{
for (OuterWall &wall : m_outerWalls)
{
wall.setProtection(wall.protection() / factorOld * factorNew);
wall.setInitalProtection(wall.initialProtection() / factorOld * factorNew, false);
for (ExclusionZone &exZone : wall.exclusionZones())
{
exZone.setProtection(exZone.protection() / factorOld * factorNew);
exZone.setInitalProtection(exZone.initialProtection() / factorOld * factorNew, false);
}
}
}
}
double Room::damagePercent() const
{
if (m_outerWalls.isEmpty())
return 0;
double currentProtection = 0.0;
double initialProtection = 0.0;
for (const OuterWall &wall : qAsConst(m_outerWalls))
{
currentProtection += wall.protection();
initialProtection += wall.initialProtection();
for (const ExclusionZone &exZone : qAsConst(wall.exclusionZones()))
{
currentProtection += exZone.protection();
initialProtection += exZone.initialProtection();
}
}
if (qFuzzyIsNull(initialProtection))
return 100;
return (1.0 - currentProtection / initialProtection) * 100.0;
}
double Room::calcRemainingEffect(const HitPosition &hitPos, const Charge &ammu) const
{
const double SG_alt = protectionForHitPosition(hitPos);
const double ZF = ammu.destructiveFactor;
const double WF = ammu.penetrationEffect;
const double RW = calcRemainingEffect(SG_alt, ZF, WF);
return RW;
}
void Room::updateProtectionDirectHit(const HitPosition &hitPos, const Charge &ammu)
{
Q_ASSERT(hitPos.state != HitPosition::State::NoHit);
const double SG_alt = protectionForHitPosition(hitPos);
const double ZF = ammu.destructiveFactor;
const double SG_neu = calcProtectionOfWallAfterHit(SG_alt, 1.0, ZF, 1.0);
setProtectionForHitPosition(hitPos, SG_neu);
}
static bool isDirectHitOuterWall(const HitPosition &hitPos, int roomId, int idxOw)
{
if (hitPos.state != HitPosition::State::OuterWall)
return false;
return hitPos.roomId == roomId && hitPos.outerWallIdx == idxOw;
}
static bool isDirectHitExlusionZone(const HitPosition &hitPos, int roomId, int idxOw, int idxEz)
{
if (hitPos.state != HitPosition::State::ExclusionZone)
return false;
return hitPos.roomId == roomId && hitPos.outerWallIdx == idxOw && hitPos.exclusionZoneIdx == idxEz;
}
void Room::updateProtectionIndirectHit(const HitPosition &hitPos, const Charge &ammu, double remainingEffect)
{
updateProtectionNeighbourHit(hitPos, ammu, remainingEffect, 1.0);
}
bool Room::updateProtectionNeighbourHit(const HitPosition &hitPos, const Charge &ammu, double remainingEffect, double transitionFactor)
{
const double ZF = ammu.destructiveFactor;
const double RW = remainingEffect;
const double TF = transitionFactor;
DEBUG_LOG(logger()) << "Effect for room " << m_id
<< " (RW="<< RW << ", ZF=" << ZF << " , TF=" << TF << ") ; effect=" << RW*ZF*TF
<< " -> damagePercent VOR= " << this->damagePercent();
if (isEffectNegligible(RW, ZF, TF))
{
DEBUG_LOG(logger()) << "Effect is Negligible for room " << m_id;
for (int idxOw = 0; idxOw < m_outerWalls.size(); ++idxOw)
{
OuterWall &ow = m_outerWalls[idxOw];
DEBUG_LOG(logger()) << "room " << m_id << "[ow=" << idxOw
<< "] new protection = " << ow.protection()
<< " (" << ow.protectionPercent() << "%)";
}
return false;
}
const char *hitReason = (hitPos.roomId == m_id ? "indirect hit" : "neighbour hit");
for (int idxOw = 0; idxOw < m_outerWalls.size(); ++idxOw)
{
OuterWall &ow = m_outerWalls[idxOw];
if (!isDirectHitOuterWall(hitPos, m_id, idxOw))
{
ow.updateProtection(RW, ZF, TF);
DEBUG_LOG(logger()) << "room " << m_id << "[ow=" << idxOw
<< "] new protection = " << ow.protection()
<< " (" << ow.protectionPercent() << "%) - " << hitReason;
}
for (int idxEz = 0; idxEz < ow.exclusionZones().size(); ++idxEz)
{
if (!isDirectHitExlusionZone(hitPos, m_id, idxOw, idxEz))
{
ExclusionZone &ez = ow.exclusionZones()[idxEz];
ez.updateProtection(RW, ZF, TF);
DEBUG_LOG(logger()) << "room " << m_id << "[ow=" << idxOw
<< "][ez=" << idxEz
<< "] new protection = " << ez.protection()
<< " (" << ez.protectionPercent() << "%) - " << hitReason;
}
}
}
DEBUG_LOG(logger()) << "Effect for room " << m_id << " -> damagePercent NACH = " << this->damagePercent();
return true;
}
double Room::protectionForHitPosition(const HitPosition &hitPos) const
{
const OuterWall &ow = m_outerWalls.at(hitPos.outerWallIdx);
if (hitPos.state == HitPosition::State::OuterWall)
return ow.protection();
return ow.exclusionZones().at(hitPos.exclusionZoneIdx).protection();
}
void Room::setProtectionForHitPosition(const HitPosition &hitPos, double SG_neu)
{
Q_ASSERT(hitPos.state != HitPosition::State::NoHit);
OuterWall &ow = m_outerWalls[hitPos.outerWallIdx];
if (hitPos.state == HitPosition::State::OuterWall)
{
ow.setProtection(SG_neu);
DEBUG_LOG(logger()) << "room " << m_id << "[ow=" << hitPos.outerWallIdx
<< "] new protection = " << ow.protection()
<< " (" << ow.protectionPercent() << "%)"
<< " - direct hit";
}
else
{
ExclusionZone &ez = ow.exclusionZones()[hitPos.exclusionZoneIdx];
ez.setProtection(SG_neu);
DEBUG_LOG(logger()) << "room " << m_id << "[ow=" << hitPos.outerWallIdx
<< "][ez=" << hitPos.exclusionZoneIdx
<< "] new protection = " << ez.protection()
<< " (" << ez.protectionPercent() << "%)"
<< " - direct hit";
}
}
double Room::calcRemainingEffect(double SG_alt, double ZF, double WF)
{
if (SG_alt < 0.0001)
return 1.0;
if (ZF < 0.0001)
return 0;
double D_Wand = 0.0;
if (SG_alt < ZF * 0.95)
D_Wand = ZF * 0.95 - SG_alt;
const double D_Zufall = ZF * WF * 0.05 / SG_alt;
double RW = 100.0 * (D_Wand + D_Zufall) / ZF;
if (RW > 1.0)
RW = 1.0;
return RW;
}
Building::Building()
: m_lastHitPosition(HitPosition())
, m_logger(BuildingControlUnit::getLogger("VWM.Building"))
{}
int Building::checkPolygons()
{
int numberOfDuplicates = 0;
for (const Room &room : qAsConst(m_rooms))
{
for (int owIdx = 0; owIdx < room.outerWalls().size(); ++owIdx)
{
const OuterWall &ow = room.outerWalls().at(owIdx);
for (int elemIdx = 0; elemIdx < ow.elements().size(); ++elemIdx)
{
const WallElement &wallElement = ow.elements().at(elemIdx);
numberOfDuplicates += checkDublicatePointsInPolygon(room.id(), owIdx, elemIdx, "QuterWall", wallElement);
}
}
}
return numberOfDuplicates;
}
int Building::cleanupPolygons()
{
int numberOfRemoved = 0;
for (Room &room : m_rooms)
{
for (int owIdx = 0; owIdx < room.outerWalls().size(); ++owIdx)
{
OuterWall &ow = room.outerWalls()[owIdx];
for (int elemIdx = 0; elemIdx < ow.elements().size(); ++elemIdx)
{
WallElement &wallElement = ow.elements()[elemIdx];
numberOfRemoved += cleanupDublicatePointsInPolygon(room.id(), owIdx, elemIdx, "room", wallElement);
bool bMakePlanarDone = false;
MakePlanar makePlanar(wallElement);
QVector<LtsUtils::QPoint3D> candidate = makePlanar.calculate(&bMakePlanarDone);
cleanupDublicatePointsInPolygon(room.id(), owIdx, elemIdx, "room", candidate);
if (candidate.size() < 4)
{
NOTICE_LOG(m_logger) << "wall was made planar: Building '" << m_name << "' -> "
<< " in room " << room.id() << " OuterWall[" << owIdx
<< "], element[" << elemIdx << "] "
<< " makePlanar and cleanupDublicatePointsInPolygon would generate short polygon, size=" << candidate.size();
for (auto point : qAsConst(candidate))
NOTICE_LOG(m_logger) << " point= " << point;
bMakePlanarDone = false;
} else {
wallElement = candidate;
}
if (bMakePlanarDone)
NOTICE_LOG(m_logger) << "wall was made planar: Building '" << m_name << "' -> "
<< " in room " << room.id() << " OuterWall[" << owIdx
<< "], element[" << elemIdx << "] "
<< " smallestDim=" << (int)makePlanar.getSmallestDim()
<< " smallestRange=" << makePlanar.getSmallestRange();
}
}
}
return numberOfRemoved;
}
int Building::cleanupDublicatePointsInPolygon(int roomId, int idx, int subIdx, const char *type, QVector<LtsUtils::QPoint3D> &points) const
{
QVector<int> idxToRemove;
idxToRemove.reserve(points.size());
for (int i = 0; i < points.size(); ++i)
{
const auto &p1 = points.at(i);
for (int j = i + 1; j < points.size(); ++j)
{
auto p2 = points.at(j);
if (qFuzzyCompare(p1, p2))
{
DEBUG_LOG(m_logger) << "Building '" << m_name << "' -> "
<< "Polygon point " << i << " (" << p1 << ") and " << j << " (" << p2
<< ") in room " << roomId << ", " << type << "[" << idx
<< "], element[" << subIdx << "] are the same! -> REMOVE";
if (!idxToRemove.contains(j))
idxToRemove.push_back(j);
}
}
}
std::sort(idxToRemove.begin(), idxToRemove.end(), std::greater<int>());
int numberOfRemoved = idxToRemove.size();
for (auto idxRemove : idxToRemove)
points.removeAt(idxRemove);
return numberOfRemoved;
}
Room Building::room(int roomId)
{
auto it = m_rooms.find(roomId);
if (it == m_rooms.end())
return {};
return *it;
}
int Building::damagePercent() const
{
double roomDamagePercent = 0.0;
for (const Room &room : m_rooms)
roomDamagePercent += room.damagePercent();
return qRound(roomDamagePercent / m_rooms.size());
}
QVector<HitRoom> Building::roomStates() const
{
QVector<HitRoom> ret;
ret.reserve(m_rooms.size() / 2);
for (const Room &room : m_rooms)
{
const int dmgPercent = qRound(room.damagePercent());
HitRoom hr;
hr.roomId = room.id();
hr.damagePercent = dmgPercent;
hr.remainingEffectPercent = qRound(room.remainingEffect() * 100);
hr.fortifyFactor = room.fortifyFactor();
hr.directHit = room.isDirectHit();
ret += hr;
DEBUG_LOG(m_logger) << "HitRoom " << hr.roomId
<< " damage: " << hr.damagePercent
<< "%, remainEffect: " << hr.remainingEffectPercent << "%"
<< ", remainingEffectChargeTypeId: " << hr.remainingEffectChargeTypeId << "%"
<< ", fortifyFactor: " << hr.fortifyFactor
<< ", isDirectHit:" << room.isDirectHit();
}
return ret;
}
DamageState Building::damageState() const
{
if (Building::damagePercent() >= Settings::killThreshold())
return DamageState::Destroyed;
return DamageState::NoDamage;
}
void Building::init()
{
for (Room &room : m_rooms)
initRoom(room);
}
void Building::destroyAllRooms()
{
for (Room &room : m_rooms)
destroyRoom(room);
}
void Building::setRoomState(DamageState damageState, const QVector<int> &afffectedRooms)
{
for (const int roomId : afffectedRooms)
{
auto it = m_rooms.find(roomId);
if (it == m_rooms.end())
{
WARNING_LOG(m_logger) << "Could not find room with id " << roomId;
continue;
}
if (damageState == DamageState::Destroyed)
destroyRoom(it.value());
else
initRoom(it.value());
}
}
void Building::setFortifyInfo(const QVector<FortifyInfo> &foritfyInfos)
{
for (const FortifyInfo &info : foritfyInfos)
{
auto it = m_rooms.find(info.roomId);
if (it == m_rooms.end())
{
WARNING_LOG(m_logger) << "Could not find room with id " << info.roomId;
continue;
}
Room &room = it.value();
room.setFortifyFactor(info.fortifyFactor);
}
}
void Building::initRoom(Room &room) const
{
const double BGPL = m_buildingProtectionLevel;
const double OWPL = m_outerWallProtectionLevel;
const double EZPL = m_exclusionZoneProtectionLevel;
room.setRemainingEffect(0);
room.setDirectHit(false);
const double fortifyFactor = room.fortifyFactor();
if (room.outerWalls().isEmpty())
{
room.outerWalls() += OuterWall();
}
for (OuterWall &ow : room.outerWalls())
{
if (ow.isDummyWall())
{
ow.setInitalProtection(250 * fortifyFactor, true);
}
else
{
const double OWPF = ow.protectiveFactor();
const double SG_0_Wall = BGPL * OWPL * OWPF * fortifyFactor;
ow.setInitalProtection(SG_0_Wall, true);
for (ExclusionZone &ez : ow.exclusionZones())
{
const double EZPF = ez.protectiveFactor();
const double SG_0_EZ = BGPL * EZPL * EZPF * fortifyFactor;
ez.setInitalProtection(SG_0_EZ, true);
}
}
}
}
void Building::destroyRoom(Room &room)
{
room.setRemainingEffect(1);
for (OuterWall &ow : room.outerWalls())
{
ow.setProtection(0);
for (ExclusionZone &ez : ow.exclusionZones())
ez.setProtection(0);
}
}
bool Building::hit(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &dir, Charge charge, HitPosition *preCalculatedHitPosition)
{
for (Room &room : m_rooms)
room.setDirectHit(false);
if (preCalculatedHitPosition)
{
m_lastHitPosition = *preCalculatedHitPosition;
} else {
m_lastHitPosition = Math::getHitPosition(pos, dir, m_rooms);
}
const bool bBelowGround = isLastHitPositionBelowGroundHack();
if (bBelowGround)
{
INFO_LOG(m_logger) << " XXXX CES belowGround, reduce charge: " << charge;
charge.destructiveFactor *= 0.25;
charge.penetrationEffect *= 0.25;
INFO_LOG(m_logger) << " XXXX CES belowGround, reduce charge: " << charge;
}
INFO_LOG(m_logger) << "XXXXX HitPosition: state=" << m_lastHitPosition.state
<< ", m_name=" << m_name
<< ", m_modelId=" << m_modelId
<< ", roomId=" << m_lastHitPosition.roomId
<< ", outerWallIndex=" << m_lastHitPosition.outerWallIdx
<< ", exclusionZoneIndex=" << m_lastHitPosition.exclusionZoneIdx
<< ", bBelowGround=" << bBelowGround;
if (m_lastHitPosition.state == HitPosition::State::NoHit)
return false;
Room &hitRoom = m_rooms[m_lastHitPosition.roomId];
if (!hitRoom.isValid())
{
ERROR_LOG(m_logger) << "Internal error in hit calculation - could not find room with id " << m_lastHitPosition.roomId;
return false;
}
hitRoom.setDirectHit(true);
for (Room &room : m_rooms)
room.setRemainingEffect(0);
const double remainingEffect = hitRoom.calcRemainingEffect(m_lastHitPosition, charge);
hitRoom.setRemainingEffect(remainingEffect);
hitRoom.updateProtectionDirectHit(m_lastHitPosition, charge);
hitRoom.updateProtectionIndirectHit(m_lastHitPosition, charge, remainingEffect);
const QMap<int, NeighbourRoom> &neighbours = hitRoom.neighbours();
QMap<int, NeighboursToCheck> neighboursToCheck;
QSet<int> currentGradeNeighbours;
for (const NeighbourRoom &neighbour : neighbours)
{
neighboursToCheck.insert(neighbour.id(), NeighboursToCheck(neighbour, hitRoom.remainingEffect()));
currentGradeNeighbours.insert(neighbour.id());
}
QSet<int> lowerGradeNeighbours;
lowerGradeNeighbours.insert(hitRoom.id());
auto ret = checkHitNeighbours(neighboursToCheck, charge, currentGradeNeighbours, lowerGradeNeighbours);
while (!ret.isEmpty())
{
ret = checkHitNeighbours(ret, charge, currentGradeNeighbours, lowerGradeNeighbours);
}
return true;
}
bool Building::isLastHitPositionBelowGroundHack() const
{
return
(m_name.contains(QStringLiteral("BN_Kanaele"))) ||
(m_name.contains(QStringLiteral("U_Bahn")) && m_lastHitPosition.roomId < 2300)
;
}
QMap<int, Building::NeighboursToCheck> Building::checkHitNeighbours(const QMap<int, NeighboursToCheck> &neighbours,
const Charge &charge,
QSet<int> &currentGradeNeighbours,
QSet<int> &lowerGradeNeighbours)
{
QMap<int, NeighboursToCheck> neighboursToCheck;
QSet<int> newCurrentGradeNeighbours;
for (const NeighboursToCheck &neighbourRoom : neighbours)
{
const int neighbourRoomId = neighbourRoom.room.id();
if (lowerGradeNeighbours.contains(neighbourRoomId))
continue;
auto itRoom = m_rooms.find(neighbourRoomId);
if (itRoom == m_rooms.end())
{
WARNING_LOG(m_logger) << "Could not find room with id " << neighbourRoomId;
continue;
}
Room &neighbour = itRoom.value();
double TF = Settings::transitionMultiplier() * neighbourRoom.room.transitionFactor();
if (TF > 1.0)
TF = 1.0;
if (!neighbour.updateProtectionNeighbourHit(m_lastHitPosition, charge, neighbourRoom.remainEffect, TF))
continue;
const double oldRe = neighbour.remainingEffect();
neighbour.setRemainingEffect(neighbourRoom.remainEffect * TF);
DEBUG_LOG(m_logger) << "room " << neighbourRoomId << " remaining effect old: "
<< oldRe << " -> new: " << neighbour.remainingEffect();
for (const NeighbourRoom &grade2Neighbour : qAsConst(neighbour.neighbours()))
{
if (lowerGradeNeighbours.contains(grade2Neighbour.id()) ||
currentGradeNeighbours.contains(grade2Neighbour.id()))
continue;
auto it = neighboursToCheck.find(grade2Neighbour.id());
if (it == neighboursToCheck.end())
{
neighboursToCheck.insert(grade2Neighbour.id(), NeighboursToCheck(grade2Neighbour, neighbour.remainingEffect()));
} else {
const NeighboursToCheck &curEntry = it.value();
if (neighbour.remainingEffect() > curEntry.remainEffect)
neighboursToCheck.insert(grade2Neighbour.id(), NeighboursToCheck(grade2Neighbour, neighbour.remainingEffect()));
}
newCurrentGradeNeighbours.insert(grade2Neighbour.id());
}
}
lowerGradeNeighbours += currentGradeNeighbours;
currentGradeNeighbours = newCurrentGradeNeighbours;
return neighboursToCheck;
}
QString Building::buildingProperties() const
{
return m_buildingProperties;
}
void Building::setBuildingProperties(const QString &buildingProperties)
{
m_buildingProperties = buildingProperties;
}
QString Building::segmentProperties(const QString &hostname) const
{
return m_segmentProperties.value(hostname);
}
void Building::setSegmentProperties(const QString &hostname, const QString &properties)
{
m_segmentProperties.insert(hostname, properties);
}
int Building::checkDublicatePointsInPolygon(int roomId, int idx, int subIdx, const char *type,
const QVector<LtsUtils::QPoint3D> &points) const
{
int numberOfDuplicates = 0;
for (int i = 0; i < points.size(); ++i)
{
const auto &p1 = points.at(i);
for (int j = i + 1; j < points.size(); ++j)
{
const auto &p2 = points.at(j);
if (qFuzzyCompare(p1, p2))
{
++numberOfDuplicates;
WARNING_LOG(m_logger) << "Building '" << m_name << "' -> "
<< "Polygon point " << i << " (" << p1 << ") and " << j << " (" << p2
<< ") in room " << roomId << ", " << type << "[" << idx
<< "], element[" << subIdx << "] are the same! (size=" << points.size() << ")";
}
}
}
if (numberOfDuplicates > 0)
for (auto point : points)
WARNING_LOG(m_logger) << "Building '" << m_name << "' -> " << "point =" << point << " (same points)";
return numberOfDuplicates;
}
QString Building::toString(const QVector<Building::NeighboursToCheck> &cont)
{
QString str;
for (auto item : cont)
str += QString(QStringLiteral("%1;")).arg(item.room.id());
return str;
}
QString Building::toString(const QMap<int, Building::NeighboursToCheck> &cont)
{
QString str;
for (auto item : cont)
str += QString(QStringLiteral("%1;")).arg(item.room.id());
return str;
}
QString Building::toString(const QSet<int> &cont)
{
QString str;
for (auto item : cont)
str += QString(QStringLiteral("%1;")).arg(item);
return str;
}
MakePlanar::MakePlanar(const QVector<LtsUtils::QPoint3D> &poly)
: m_poly(poly)
{
ranges.resize(3);
}
QVector<LtsUtils::QPoint3D> MakePlanar::calculate(bool *bMakePlanarDone)
{
if (ratioOfSmallestAndBiggestDimension() >= 10.0
&& getRange(m_smallestDim).range() < 0.20
)
{
makePlanar();
if (bMakePlanarDone)
{
*bMakePlanarDone = true;
}
}
return m_poly;
}
double MakePlanar::ratioOfSmallestAndBiggestDimension()
{
if (m_poly.size() < 4)
return -1;
MyRange &rangeX = ranges[static_cast<int>(DIMENSION::X)];
MyRange &rangeY = ranges[static_cast<int>(DIMENSION::Y)];
MyRange &rangeZ = ranges[static_cast<int>(DIMENSION::Z)];
rangeX.min = m_poly.first().x(); rangeX.max = m_poly.first().x();
rangeY.min = m_poly.first().y(); rangeY.max = m_poly.first().y();
rangeZ.min = m_poly.first().z(); rangeZ.max = m_poly.first().z();
for (const LtsUtils::QPoint3D &pnt : qAsConst(m_poly))
{
rangeX.min = std::min(rangeX.min, pnt.x());
rangeX.max = std::max(rangeX.max, pnt.x());
rangeY.min = std::min(rangeY.min, pnt.y());
rangeY.max = std::max(rangeY.max, pnt.y());
rangeZ.min = std::min(rangeZ.min, pnt.z());
rangeZ.max = std::max(rangeZ.max, pnt.z());
}
if (rangeY.range() < rangeX.range())
m_smallestDim = DIMENSION::Y;
if (rangeZ.range() < getRange(m_smallestDim).range())
m_smallestDim = DIMENSION::Z;
if (rangeY.range() > rangeX.range())
m_biggistDim = DIMENSION::Y;
if (rangeZ.range() > getRange(m_biggistDim).range())
m_biggistDim = DIMENSION::Z;
if (!qFuzzyIsNull(getRange(m_smallestDim).range()))
m_ratio = getRange(m_biggistDim).range() / getRange(m_smallestDim).range();
return m_ratio;
}
void MakePlanar::makePlanar()
{
const double newValue = (getRange(m_smallestDim).min + getRange(m_smallestDim).max) / 2.0;
switch (m_smallestDim)
{
case DIMENSION::X:
for (LtsUtils::QPoint3D &pnt_ref : m_poly)
pnt_ref.rx() = newValue;
break;
case DIMENSION::Y:
for (LtsUtils::QPoint3D &pnt_ref : m_poly)
pnt_ref.ry() = newValue;
break;
case DIMENSION::Z:
for (LtsUtils::QPoint3D &pnt_ref : m_poly)
pnt_ref.rz() = newValue;
break;
case DIMENSION::Undefined:
{
}
}
}
void wallElementToBottomLeftTopRight3D(const WallElement &wallElement,
LtsUtils::QPoint3D &bottomLeftOut,
LtsUtils::QPoint3D &topRightOut)
{
const LtsUtils::QPoint3D &frontItem = wallElement.front();
bottomLeftOut = frontItem;
topRightOut = frontItem;
for (auto coord : qAsConst(wallElement))
{
if (coord.x() < bottomLeftOut.x())
bottomLeftOut.setX(coord.x());
if (coord.y() < bottomLeftOut.y())
bottomLeftOut.setY(coord.y());
if (coord.z() < bottomLeftOut.z())
bottomLeftOut.setZ(coord.z());
if (coord.x() > topRightOut.x())
topRightOut.setX(coord.x());
if (coord.y() > topRightOut.y())
topRightOut.setY(coord.y());
if (coord.z() > topRightOut.z())
topRightOut.setZ(coord.z());
}
}
LtsUtils::QPoint3D centerOfWallElement3D(const WallElement &wallElement)
{
LtsUtils::QPoint3D bottomLeftOut, topRightOut;
wallElementToBottomLeftTopRight3D(wallElement, bottomLeftOut, topRightOut);
const LtsUtils::QPoint3D &center = (bottomLeftOut + topRightOut) / 2;
return center;
}
}
}
@@ -0,0 +1,313 @@
#pragma once
#include <QString>
#include <QMap>
#include <QVector>
#include <LtsUtilsCore/qpoint3d.h>
#include <logger.h>
#include "vwm_types.h"
#include <VWM/buildingcontrolvwm_export.h>
namespace BuildingControlUnit
{
namespace VWM
{
class NeighbourRoom
{
public:
void setId(int id) { m_id = id; }
int id() const { return m_id; }
void setTransitionFactor(double transitionFactor) { m_transitionFactor = transitionFactor; }
double transitionFactor() const { return m_transitionFactor; }
private:
int m_id = 0;
double m_transitionFactor = 0;
};
using WallElement = QVector<LtsUtils::QPoint3D>;
using ExclusionZoneElement = QVector<LtsUtils::QPoint3D>;
void wallElementToBottomLeftTopRight3D(const WallElement &wallElement,
LtsUtils::QPoint3D &bottomLeftOut,
LtsUtils::QPoint3D &topRightOut);
LtsUtils::QPoint3D centerOfWallElement3D(const WallElement &wallElement);
class WallExclusionZoneBase
{
public:
void setProtectiveFactor(double protectiveFactor) { m_protectiveFactor = protectiveFactor; }
double protectiveFactor() const { return m_protectiveFactor; }
void setInitalProtection(double initialProtection, bool bResetProtection);
double initialProtection() const { return m_initialProtection; }
double protectionPercent() const {
if (m_initialProtection<=0.0)
return 0.0;
return m_protection / m_initialProtection * 100;
}
void updateProtection(const double RW, const double ZF, const double TF);
void setProtection(double protection) { m_protection = protection; }
double protection() const { return m_protection; }
protected:
WallExclusionZoneBase() = default;
double m_protectiveFactor = 0;
double m_initialProtection = 0;
double m_protection = 0;
};
class ExclusionZone : public WallExclusionZoneBase
{
public:
QVector<ExclusionZoneElement> &elements() { return m_elements; }
const QVector<ExclusionZoneElement> &elements() const { return m_elements; }
private:
QVector<ExclusionZoneElement> m_elements;
};
class OuterWall : public WallExclusionZoneBase
{
public:
QVector<WallElement> &elements() { return m_elements; }
const QVector<WallElement> &elements() const { return m_elements; }
QVector<ExclusionZone> &exclusionZones() { return m_exclusionZones; }
const QVector<ExclusionZone> &exclusionZones() const { return m_exclusionZones; }
bool isDummyWall() const { return m_elements.isEmpty(); }
private:
QVector<ExclusionZone> m_exclusionZones;
QVector<WallElement> m_elements;
};
class Room
{
public:
void setId(int id) { m_id = id; }
int id() const { return m_id; }
bool isValid() const { return m_id != 0; }
bool isDirectHit() const { return m_directHit; }
void setDirectHit(bool directHit) { m_directHit = directHit; }
QMap<int, NeighbourRoom> &neighbours() { return m_neighbours; }
const QMap<int, NeighbourRoom> &neighbours() const { return m_neighbours; }
QVector<OuterWall> &outerWalls() { return m_outerWalls; }
const QVector<OuterWall> &outerWalls() const { return m_outerWalls; }
void setFortifyFactor(double factorNew, bool bRecalcValues = true);
double fortifyFactor() const { return m_fortifyFactor; }
double damagePercent() const;
void setRemainingEffect(double remainingEffect) { m_remainingEffect = remainingEffect; }
double remainingEffect() const { return m_remainingEffect; }
double calcRemainingEffect(const HitPosition &hitPos, const Charge &ammu) const;
void updateProtectionDirectHit(const HitPosition &hitPos, const Charge &ammu);
void updateProtectionIndirectHit(const HitPosition &hitPos, const Charge &ammu, double remainingEffect);
bool updateProtectionNeighbourHit(const HitPosition &hitPos, const Charge &ammu, double remainingEffect, double transitionFactor);
void init();
void destroy();
private:
int m_id = 0;
double m_remainingEffect = 0;
QMap<int, NeighbourRoom> m_neighbours;
QVector<OuterWall> m_outerWalls;
double m_fortifyFactor = 1.0;
bool m_directHit = false;
double protectionForHitPosition(const HitPosition &hitPos) const;
void setProtectionForHitPosition(const HitPosition &hitPos, double SG_neu);
static double calcRemainingEffect(double SG_alt, double ZF, double WF);
};
class BUILDINGCONTROLVWM_EXPORT Building
{
public:
Building();
int cleanupPolygons();
int checkPolygons();
QString name() const { return m_name; }
void setName(const QString &name) { m_name = name; }
int modelId() const { return m_modelId; }
void setModelId(int modelId) { m_modelId = modelId; }
double buildingProtectionLevel() const { return m_buildingProtectionLevel; }
void setBuildingProtectionLevel(double buildingProtectionLevel) { m_buildingProtectionLevel = buildingProtectionLevel; }
int exclusionZoneProtectionLevel() const { return m_exclusionZoneProtectionLevel; }
void setExclusionZoneProtectionLevel(int exclusionZoneProtectionLevel) { m_exclusionZoneProtectionLevel = exclusionZoneProtectionLevel; }
int outerWallProtectionLevel() const { return m_outerWallProtectionLevel; }
void setOuterWallProtectionLevel(int outerWallProtectionLevel) { m_outerWallProtectionLevel = outerWallProtectionLevel; }
Room room(int roomId);
QMap<int, Room> &rooms() { return m_rooms; }
const QMap<int, Room> &rooms() const { return m_rooms; }
int damagePercent() const;
QVector<HitRoom> roomStates() const;
DamageState damageState() const;
void init();
void destroyAllRooms();
void setRoomState(DamageState damageState, const QVector<int> &afffectedRooms);
void setFortifyInfo(const QVector<FortifyInfo> &foritfyInfos);
bool hit(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &dir, Charge charge, HitPosition *preCalculatedHitPosition = nullptr);
const HitPosition &lastHitPosition() const { return m_lastHitPosition; }
bool isLastHitPositionBelowGroundHack() const;
QString segmentProperties(const QString &hostname) const;
void setSegmentProperties(const QString &hostname, const QString &properties);
const QMap<QString, QString> segmentPropertyMap() const { return m_segmentProperties; }
void clearSegmentProperties() { m_segmentProperties.clear(); }
QString buildingProperties() const;
void setBuildingProperties(const QString &buildingProperties);
private:
void initRoom(Room &room) const;
static void destroyRoom(Room &room);
int checkDublicatePointsInPolygon(int roomId, int idx, int subIdx, const char *type,
const QVector<LtsUtils::QPoint3D> &points) const;
int cleanupDublicatePointsInPolygon(int roomId, int idx, int subIdx, const char *type,
QVector<LtsUtils::QPoint3D> &points) const;
struct NeighboursToCheck
{
NeighbourRoom room;
double remainEffect = 0;
NeighboursToCheck() = default;
NeighboursToCheck(const NeighbourRoom &r, double re)
: room(r), remainEffect(re)
{}
};
static QString toString(const QVector<Building::NeighboursToCheck> &cont);
static QString toString(const QMap<int, Building::NeighboursToCheck> &cont);
static QString toString(const QSet<int> &cont);
QMap<int, NeighboursToCheck> checkHitNeighbours(const QMap<int, NeighboursToCheck> &neighbours,
const Charge &charge,
QSet<int> &currentGradeNeighbours,
QSet<int> &lowerGradeNeighbours);
private:
QString m_name;
int m_modelId{0};
double m_buildingProtectionLevel{0.0};
int m_exclusionZoneProtectionLevel{0};
int m_outerWallProtectionLevel{0};
QMap<int, Room> m_rooms;
QString m_buildingProperties;
QMap<QString, QString> m_segmentProperties;
HitPosition m_lastHitPosition;
NGL::INGLLogger &m_logger;
};
class BUILDINGCONTROLVWM_EXPORT MakePlanar
{
public:
enum class DIMENSION
{
Undefined = -1,
X = 0,
Y = 1,
Z = 2
};
struct MyRange
{
double min{0.0};
double max{0.0};
double range() const { return fabs(max - min); }
};
explicit MakePlanar(const QVector<LtsUtils::QPoint3D> &poly);
QVector<LtsUtils::QPoint3D> calculate(bool *bMakePlanarDone = nullptr);
QVector<LtsUtils::QPoint3D> getPoly() const { return m_poly; }
double getRatio() const { return m_ratio; }
double getSmallestRange() const { return getRange(m_smallestDim).range(); }
DIMENSION getSmallestDim() const { return m_smallestDim; }
protected:
const MyRange &getRange(DIMENSION dim) const { return ranges[static_cast<int>(dim)]; }
double ratioOfSmallestAndBiggestDimension();
void makePlanar();
private:
QVector<LtsUtils::QPoint3D> m_poly;
std::vector<MyRange> ranges;
DIMENSION m_smallestDim{DIMENSION::X};
DIMENSION m_biggistDim{DIMENSION::X};
double m_ratio{0.0};
};
}
}
@@ -0,0 +1,197 @@
#include "vwm_building_room_geometry.h"
#include "bcu_xml_reader.h"
#include <LtsUtilsCore/qpoint3d.h>
#include <QDebug>
#include <algorithm>
namespace BuildingControlUnit
{
namespace VWM
{
BuildingRoomGeometry::BuildingRoomGeometry()
: m_logger(BuildingControlUnit::getLogger("VWM.BuildingRoomGeometry"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
BuildingRoomGeometry::~BuildingRoomGeometry()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
bool BuildingRoomGeometry::init(const QDomElement &domRoot)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
parse(domRoot);
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return true;
}
QVector<int> BuildingRoomGeometry::pointIsInWhichRooms(const LtsUtils::QPoint3D &pointToFind)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START, pointToFind" << pointToFind
<< ", m_roomOutlines.size() " << m_roomOutlines.size();
QVector<int> roomtIds;
QMapIterator<int, RoomOutlineData> it(m_roomOutlines);
while (it.hasNext())
{
it.next();
const int roomId = it.key();
const RoomOutlineData &rod = it.value();
DEBUG_LOG(m_logger) << LOGFUNCTION << " check room " << roomId << " (check maxZ " << rod.maxZ << " ; minZ " << rod.minZ;
if (m_logger.isDebugEnabled())
qCritical() << " check room " << roomId << ", outline: " << rod.outline;
if (rod.outline.containsPoint( {pointToFind.x(), pointToFind.y()}, Qt::OddEvenFill))
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " within room " << roomId;
if ((rod.maxZ > pointToFind.z()) &&
(pointToFind.z() > rod.minZ))
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " found roomId: " << roomId
<< " pointToFind: " << pointToFind.x() << " , " << pointToFind.y();
roomtIds.append(roomId);
}
}
}
TRACE_LOG(m_logger) << LOGFUNCTION << " END, roomtIds.size() " << roomtIds.size();
return roomtIds;
}
static QDomElement getChildElement(const QDomElement &parent, const QString &childTag, bool bThrow = true)
{
const QDomElement ret = parent.firstChildElement(childTag);
if (ret.isNull() && bThrow)
throw BuildingControlUnit::XmlReaderException(QStringLiteral("Invalid XML Structure - no '%1' tag").arg(childTag));
return ret;
}
static int getInteger(const QDomElement &element, const QString &attribute)
{
bool bOk = true;
const int ret = element.attribute(attribute).toInt(&bOk);
if (!bOk)
throw BuildingControlUnit::XmlReaderException(QStringLiteral("Can not find attribute %1 in xml element %2 (line %3:%4)")
.arg(attribute, element.tagName()).arg(element.lineNumber()).arg(element.columnNumber()));
return ret;
}
template <typename T>
static inline T positionFromElement(const QDomElement &elem)
{
return T(elem.attribute(QStringLiteral("X")).toDouble(),
elem.attribute(QStringLiteral("Y")).toDouble(),
elem.attribute(QStringLiteral("Z")).toDouble());
}
static inline bool checkRange(double d)
{
return (fabs(d) < 10000000);
}
static inline LtsUtils::QPoint3D positionFromElement(const QDomElement &elem)
{
bool bOkX, bOkY, bOkZ;
auto ret (LtsUtils::QPoint3D(elem.attribute(QStringLiteral("X")).toDouble(&bOkX),
elem.attribute(QStringLiteral("Y")).toDouble(&bOkY),
elem.attribute(QStringLiteral("Z")).toDouble(&bOkZ)));
if (!bOkX || !checkRange(ret.x()))
throw BuildingControlUnit::XmlReaderException(QStringLiteral("invalid value for X: %1 (line %2:%3)")
.arg(elem.attribute(QStringLiteral("X"))).arg(elem.lineNumber()).arg(elem.columnNumber()));
if (!bOkY || !checkRange(ret.y()))
throw BuildingControlUnit::XmlReaderException(QStringLiteral("invalid value for Y: %1 (line %2:%3)")
.arg(elem.attribute(QStringLiteral("Y"))).arg(elem.lineNumber()).arg(elem.columnNumber()));
if (!bOkZ || !checkRange(ret.z()))
throw BuildingControlUnit::XmlReaderException(QStringLiteral("invalid value for Z: %1 (line %2:%3)")
.arg(elem.attribute(QStringLiteral("Z"))).arg(elem.lineNumber()).arg(elem.columnNumber()));
return ret;
}
bool BuildingRoomGeometry::parse(const QDomElement &domGroup)
{
NGL::INGLLogger &loggerParse = BuildingControlUnit::getLogger("VWM.BuildingRoomGeometry.parse");
QDomElement domGroup1 = getChildElement(domGroup, QStringLiteral("Group"));
for ( ; !domGroup1.isNull(); domGroup1 = domGroup1.nextSiblingElement(domGroup1.tagName()))
{
const QDomElement nameElement = getChildElement(domGroup1, QStringLiteral("Name"), false);
DEBUG_LOG(loggerParse) << " * nameElement: " << nameElement.text();
QDomElement domSwitch = getChildElement(domGroup1, QStringLiteral("Switch"), false);
for ( ; !domSwitch.isNull(); domSwitch = domSwitch.nextSiblingElement(domSwitch.tagName()))
{
const QDomElement roomNameElement = getChildElement(domSwitch, QStringLiteral("Name"), false);
DEBUG_LOG(loggerParse) << " ** roomNameElement: " << roomNameElement.text();
const int roomId = getInteger(getChildElement(domSwitch, QStringLiteral("SubId")), QStringLiteral("ID"));
DEBUG_LOG(loggerParse) << " ** roomId: " << roomId;
QDomElement domGroup2 = getChildElement(domSwitch, QStringLiteral("Group"), false);
for ( ; !domGroup2.isNull(); domGroup2 = domGroup2.nextSiblingElement(domGroup2.tagName()))
{
const QDomElement &domBBMin = getChildElement(domGroup2, QStringLiteral("BBox_Min"));
const QDomElement &domBBMax = getChildElement(domGroup2, QStringLiteral("BBox_Max"));
const LtsUtils::QPoint3D &roomBBoxMin = positionFromElement(domBBMin);
const LtsUtils::QPoint3D &roomBBoxMax = positionFromElement(domBBMax);
DEBUG_LOG(loggerParse) << " ** roomBBoxMin: " << roomBBoxMin;
QDomElement domGroup3 = getChildElement(domGroup2, QStringLiteral("Group"), false);
for ( ; !domGroup3.isNull(); domGroup3 = domGroup3.nextSiblingElement(domGroup3.tagName()))
{
const QDomElement domPoly = getChildElement(domGroup3, QStringLiteral("Polygon"), false);
if (domPoly.isNull())
continue;
QDomElement vertexElem = domPoly.firstChildElement(QStringLiteral("Vertex"));
QPolygonF outlinePolygon;
for (; !vertexElem.isNull(); vertexElem = vertexElem.nextSiblingElement(vertexElem.tagName()))
{
const QDomElement coordElem = vertexElem.firstChildElement(QStringLiteral("Coord"));
if (coordElem.isNull())
continue;
const LtsUtils::QPoint3D &coord = positionFromElement<LtsUtils::QPoint3D>(coordElem);
outlinePolygon.append(coord.toPointF());
DEBUG_LOG(loggerParse) << " **** coord = " << coord.x() << " , " << coord.y() << " , " << coord.z();
}
RoomOutlineData rod;
rod.minZ = roomBBoxMin.z();
rod.maxZ = roomBBoxMax.z();
rod.outline = outlinePolygon;
m_roomOutlines.insert(roomId, rod);
DEBUG_LOG(loggerParse) << " *** insert roomId " << roomId << ", rod with " << outlinePolygon.size();
}
}
}
}
return true;
}
}
}
@@ -0,0 +1,51 @@
#pragma once
#include <QString>
#include <QMap>
#include <QPolygonF>
#include <QDomElement>
#include <LtsUtilsCore/qpoint3d.h>
#include <VWM/buildingcontrolvwm_export.h>
#include <logger.h>
namespace BuildingControlUnit
{
namespace VWM
{
struct BUILDINGCONTROLVWM_EXPORT RoomOutlineData
{
double minZ;
double maxZ;
QPolygonF outline;
};
class BUILDINGCONTROLVWM_EXPORT BuildingRoomGeometry
{
public:
BuildingRoomGeometry();
~BuildingRoomGeometry();
bool init(const QDomElement &domRoot);
QVector<int> pointIsInWhichRooms(const LtsUtils::QPoint3D &pointToFind);
private:
bool parse(const QDomElement &domGroup);
QMap<int, RoomOutlineData> m_roomOutlines;
NGL::INGLLogger &m_logger;
};
}
}
@@ -0,0 +1,116 @@
#include "vwm_deposition.h"
#include "vwm_math.h"
#include <cmath>
namespace BuildingControlUnit
{
namespace VWM
{
static double getDistPositionCode(char chDeposition)
{
double dist = 0.0;
unsigned char absDeposition = static_cast<unsigned char>(chDeposition);
if (absDeposition > 127)
absDeposition = 256 - absDeposition;
if (absDeposition < 28)
dist = 0.1 * absDeposition;
else if (absDeposition < 96)
dist = exp(absDeposition / 27.1828);
else
{
dist = 0.0;
}
if (static_cast<unsigned char>(chDeposition) > 127)
dist = -dist;
return dist;
}
static double getAngle(double x, double y)
{
if (qFuzzyIsNull(x) && qFuzzyIsNull(y))
return 0.0;
double phi;
if (!qFuzzyIsNull(x))
{
phi = atan(y / x);
if (x < 0)
{
if (y > 0)
phi += M_PI;
else
phi -= M_PI;
}
}
else
{
phi = M_PI / 2.0;
if (y < 0.0)
phi = -phi;
}
return phi;
}
LtsUtils::QPoint3D getDeposition(int deposition1, int deposition2, const LtsUtils::QPoint3D &bsmDirection)
{
LtsUtils::QPoint3D ret;
if (deposition1 == 0 && deposition2 == 0)
return ret;
const double alpha = 45.0;
const double dyAlpha = cos(alpha * M_PI / 180.0);
const double dzAlpha = sin(alpha * M_PI / 180.0);
const double dy1 = dyAlpha * getDistPositionCode(deposition1);
const double dz1 = -dzAlpha * getDistPositionCode(deposition1);
const double dy2 = -dyAlpha * getDistPositionCode(deposition2);
const double dz2 = -dzAlpha * getDistPositionCode(deposition2);
ret.setY(dy1 + dy2);
ret.setZ(dz1 + dz2);
const double x = bsmDirection.x();
const double y = bsmDirection.y();
const double z = bsmDirection.z();
const double phi = getAngle(x, y);
if (qFuzzyIsNull(z))
{
ret = Math::rotateAroundZAxis(ret, -phi);
}
else
{
const double theta = getAngle(sqrt(x * x + y * y), z);
ret = Math::rotateAroundYAxis(ret, theta);
ret = Math::rotateAroundZAxis(ret, -phi);
}
return ret;
}
}
}
@@ -0,0 +1,15 @@
#pragma once
#include <LtsUtilsCore/qpoint3d.h>
namespace BuildingControlUnit
{
namespace VWM
{
LtsUtils::QPoint3D getDeposition(int deposition1, int deposition2, const LtsUtils::QPoint3D &bsmDirection);
}
}
@@ -0,0 +1,653 @@
#include "vwm_math.h"
#include <logger.h>
#include <cmath>
#define epsilon 0.002
namespace BuildingControlUnit
{
namespace VWM
{
namespace Math
{
static NGL::INGLLogger &logger()
{
return BuildingControlUnit::getLogger("VWM.Math");
}
LtsUtils::QPoint3D rotateAroundYAxis(const LtsUtils::QPoint3D &in, double phi)
{
LtsUtils::QPoint3D a1( cos(phi), 0, -sin(phi));
LtsUtils::QPoint3D a2( 0, 1, 0);
LtsUtils::QPoint3D a3( sin(phi), 0, cos(phi));
return LtsUtils::QPoint3D(LtsUtils::QPoint3D::dotProduct(a1, in),
LtsUtils::QPoint3D::dotProduct(a2, in),
LtsUtils::QPoint3D::dotProduct(a3, in));
}
LtsUtils::QPoint3D rotateAroundZAxis(const LtsUtils::QPoint3D &in, double phi)
{
LtsUtils::QPoint3D a1( cos(phi), sin(phi), 0);
LtsUtils::QPoint3D a2(-sin(phi), cos(phi), 0);
LtsUtils::QPoint3D a3( 0, 0, 1);
return LtsUtils::QPoint3D(LtsUtils::QPoint3D::dotProduct(a1, in),
LtsUtils::QPoint3D::dotProduct(a2, in),
LtsUtils::QPoint3D::dotProduct(a3, in));
}
static inline double getDet2(double a11, double a12, double a21, double a22)
{
return a11 * a22 - a12 * a21;
}
static inline double getDet3(const LtsUtils::QPoint3D &a1, const LtsUtils::QPoint3D &a2, const LtsUtils::QPoint3D &a3)
{
double sum = 0;
sum += (a1.x() * a2.y() * a3.z() + a1.y() * a2.z() * a3.x() + a1.z() * a2.x() * a3.y());
sum -= (a1.z() * a2.y() * a3.x() - a1.y() * a2.x() * a3.z() - a1.x() * a2.z() * a3.y());
return sum;
}
VwmPlane::VwmPlane(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &vec1, const LtsUtils::QPoint3D &vec2)
: m_pos(pos)
, m_vec1(vec1 - pos)
, m_vec2(vec2 - pos)
{
m_det.setX(getDet2(m_vec1.y(), m_vec1.z(), m_vec2.y(), m_vec2.z()));
m_det.setY(getDet2(m_vec1.z(), m_vec1.x(), m_vec2.z(), m_vec2.x()));
m_det.setZ(getDet2(m_vec1.x(), m_vec1.y(), m_vec2.x(), m_vec2.y()));
m_planeC = LtsUtils::QPoint3D::dotProduct(m_pos, m_det);
}
bool VwmPlane::getPlaneEquation() const
{
if (qFuzzyIsNull(m_det.z()) && qFuzzyIsNull(m_det.x()) && qFuzzyIsNull(m_det.y()))
return false;
return true;
}
bool VwmPlane::isPlaneLineIntersection(const LtsUtils::QPoint3D &vec) const
{
const double det = getDet3(vec, m_vec1, m_vec2);
if (qFuzzyIsNull(det))
return false;
return true;
}
bool VwmPlane::isPlaneLineOrthogonal(const LtsUtils::QPoint3D &dir) const
{
const double nv = LtsUtils::QPoint3D::dotProduct(m_det, dir);
return (qFuzzyIsNull(nv));
}
double VwmPlane::getPlaneLineSkalar(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &dir) const
{
const double nv = LtsUtils::QPoint3D::dotProduct(m_det, dir);
if (qFuzzyIsNull(nv))
return 0;
const double np = LtsUtils::QPoint3D::dotProduct(m_det, pos);
return (m_planeC - np) / nv;
}
LtsUtils::QPoint3D VwmPlane::getPlaneLineIntersection(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &dir) const
{
const double lambda = getPlaneLineSkalar(pos, dir);
LtsUtils::QPoint3D ret (pos + (dir * lambda));
return ret;
}
double VwmPlane::distPlaneToPoint(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &dir) const
{
const double f = m_det.length();
const double dp = LtsUtils::QPoint3D::dotProduct(m_det, pos);
double dist = (m_planeC - dp) / f;
dist *= (LtsUtils::QPoint3D::dotProduct(m_det, dir) < 0) ? -1.0 : 1.0;
return dist;
}
bool vecIsLinearlyDependent(const LtsUtils::QPoint3D &v1, const LtsUtils::QPoint3D &v2)
{
double lambda;
if (fabs(v1.x()) > epsilon)
lambda = v2.x() / v1.x();
else if (fabs(v1.y()) > epsilon)
lambda = v2.y() / v1.y();
else if (fabs(v1.z()) > epsilon)
lambda = v2.z() / v1.z();
else
return true;
if ( (fabs(lambda*v1.x()-v2.x()) < epsilon)
&& (fabs(lambda*v1.y()-v2.y()) < epsilon)
&& (fabs(lambda*v1.z()-v2.z()) < epsilon))
{
return true;
}
return false;
}
QVector<LtsUtils::QPoint3D> getCoordsForPlane(const QVector<LtsUtils::QPoint3D> &poly)
{
NGL::INGLLogger &l = logger();
if (poly.size() < 3)
return {};
QVector<int> idxToRemove;
for (int i = 0; i < poly.size()-2; ++i)
{
const LtsUtils::QPoint3D &v1 = poly.at(i+1) - poly.at(i);
const LtsUtils::QPoint3D &v2 = poly.at(i+2) - poly.at(i);
bool isLinearlyDependent = vecIsLinearlyDependent(v1, v2);
DEBUG_LOG(l) << "isLinearlyDependent=" << isLinearlyDependent
<< " i=" << i
<< " v1=" << v1.x() << "/" << v1.y() << "/" << v1.z()
<< " v2=" << v2.x() << "/" << v2.y() << "/" << v2.z();
if (isLinearlyDependent)
idxToRemove.push_front(i+1);
}
QVector<LtsUtils::QPoint3D> ret = poly;
for (auto idx : idxToRemove)
ret.remove(idx);
return ret;
}
bool isPointInPolygon(const QVector<LtsUtils::QPoint3D> &poly, const LtsUtils::QPoint3D &pos)
{
NGL::INGLLogger &l = logger();
double anglesum = 0.0;
double vz = 1.0;
LtsUtils::QPoint3D vn;
if (poly.size() < 3)
return false;
for (int i = 0; i < poly.size(); ++i)
{
DEBUG_LOG(l) << "calculate point i=" << i;
const int nextIdx1 = (i + 1) % poly.size();
const int nextIdx2 = (i + 2) % poly.size();
const LtsUtils::QPoint3D &p1 = poly.at(i) - pos;
const LtsUtils::QPoint3D &p2 = poly.at(nextIdx1) - pos;
if (i == 0)
vn = LtsUtils::QPoint3D::crossProduct(p1,p2);
const double dist1 = p1.length();
const double dist2 = p2.length();
if (qFuzzyIsNull(dist1 * dist2))
{
DEBUG_LOG(l) << "isPointInPolygon = false";
return false;
}
const double cosTheta = LtsUtils::QPoint3D::dotProduct(p1, p2) / (dist1 * dist2);
anglesum += vz * acos(cosTheta);
const LtsUtils::QPoint3D &n = LtsUtils::QPoint3D::crossProduct(vn, p2);
const LtsUtils::QPoint3D &p3 = poly.at(nextIdx2) - pos;
const double dp = LtsUtils::QPoint3D::dotProduct(n, p3);
vz = (dp < 0) ? -1.0 : 1.0;
}
const double delta = 0.01;
const double sum = (M_PI * 2) - fabs(anglesum);
bool result = -delta < sum && sum < delta;
DEBUG_LOG(l) << "isPointInPolygon=" << std::boolalpha << result << " (sum=" << sum << ", anglesum=" << anglesum << ")"
<< ", pos=" << pos;
return result;
}
static inline bool getHitPositionInternal(const QVector<LtsUtils::QPoint3D> &planePoints,
const LtsUtils::QPoint3D &position,
const LtsUtils::QPoint3D &direction,
HitPosition &hitPos)
{
NGL::INGLLogger &l = logger();
if (planePoints.size() < 3)
{
WARNING_LOG(l) << "Wall with fewer than 3 points - modelling error!";
return false;
}
QVector<LtsUtils::QPoint3D> localPoly = getCoordsForPlane(planePoints);
if (localPoly.size() < 3)
{
ERROR_LOG(l) << "planePoints are not sufficiant";
for (auto coord : planePoints)
ERROR_LOG(l) << "planePoints are not sufficiant: << " << coord;
for (auto coord : qAsConst(localPoly))
ERROR_LOG(l) << "localPoly are not sufficiant: << " << coord;
return false;
}
const VwmPlane vwmPlane(localPoly.at(0), localPoly.at(1), localPoly.at(2));
for ( int i = 0; i < localPoly.size(); ++i)
{
DEBUG_LOG(l) << "vwmPlane at(" << i << ")=" << localPoly.at(i).x()
<< "/" << localPoly.at(i).y()
<< "/" << localPoly.at(i).z() ;
}
DEBUG_LOG(l) << " plane params: p1 = " << vwmPlane.pos()
<< ", p2 = " << vwmPlane.vec1()
<< ", p3 = " << vwmPlane.vec2()
<< ", det = " << vwmPlane.det()
<< ", C = " << vwmPlane.planeC()
<< ", isVertical=" << vwmPlane.isVertical();
if (!vwmPlane.getPlaneEquation())
return false;
DEBUG_LOG(l) << " getPlaneEquation = true";
if (!vwmPlane.isPlaneLineIntersection(direction))
return false;
DEBUG_LOG(l) << " isPlaneLineIntersection = true";
const double lambda = vwmPlane.getPlaneLineSkalar(position, direction);
if (lambda <= 0)
return false;
DEBUG_LOG(l) << " lambda = " << lambda;
const LtsUtils::QPoint3D pos = vwmPlane.getPlaneLineIntersection(position, direction);
DEBUG_LOG(l) << "pos=" << pos.x() << "/" << pos.y() << "/" << pos.z()
<< " position=" << position.x() << "/" << position.y() << "/" << position.z()
<< " direction=" << direction.x() << "/" << direction.y() << "/" << direction.z();
if (!isPointInPolygon(planePoints, pos))
return false;
DEBUG_LOG(l) << " isPointInPolygon = true (pos=" << pos << ")";
const double curDist = (pos - position).length();
DEBUG_LOG(l) << " distance = " << curDist;
if (curDist > hitPos.distance)
return false;
hitPos.distance = curDist;
return true;
}
HitPosition getHitPosition(const LtsUtils::QPoint3D &position, const LtsUtils::QPoint3D &direction, const QMap<int, Room> &rooms)
{
NGL::INGLLogger &l = logger();
INFO_LOG(l) << "XXXXX Searching hit position for position " << position
<< ", direction " << direction
<< ", #rooms = " << rooms.size();
HitPosition hitPos;
for (const Room &room : rooms)
{
DEBUG_LOG(l) << "****** roomId: " << room.id() << ", #walls = " << room.outerWalls().size();
for (int idxOuterWall = 0; idxOuterWall < room.outerWalls().size(); ++idxOuterWall)
{
const OuterWall &wall = room.outerWalls().at(idxOuterWall);
DEBUG_LOG(l) << " roomId: " << room.id() << ", wallIdx = " << idxOuterWall << ", #elements = " << wall.elements().size();
for (int idxWallElement = 0; idxWallElement < wall.elements().size(); ++idxWallElement)
{
const WallElement &wallElement = wall.elements().at(idxWallElement);
DEBUG_LOG(l) << " roomId: " << room.id() << ", wallIdx = " << idxOuterWall << ", wElementIdx = " << idxWallElement;
if (!getHitPositionInternal(wallElement, position, direction, hitPos))
continue;
DEBUG_LOG(l) << " nearest distance = " << hitPos.distance << " on outer wall: roomId: " << room.id() << ", wallIdx = " << idxOuterWall << ", wElementIdx = " << idxWallElement;
hitPos.state = HitPosition::State::OuterWall;
hitPos.roomId = room.id();
hitPos.outerWallIdx = idxOuterWall;
hitPos.exclusionZoneIdx = -1;
for (int idxExclusionZone = 0; idxExclusionZone < wall.exclusionZones().size(); ++idxExclusionZone)
{
const ExclusionZone &ez = wall.exclusionZones().at(idxExclusionZone);
DEBUG_LOG(l) << " roomId: " << room.id() << ", wallIdxx = " << idxOuterWall << ", wElementIdx = " << idxWallElement
<< " - exclusion zone element idx = " << idxExclusionZone << ", #elements = " << ez.elements().size();
for (int idxExclusionZoneElement = 0; idxExclusionZoneElement < ez.elements().size(); ++idxExclusionZoneElement)
{
const ExclusionZoneElement &ezElement = ez.elements().at(idxExclusionZoneElement);
DEBUG_LOG(l) << " roomId: " << room.id() << ", wallIdx = " << idxOuterWall << ", wElementIdx = " << idxWallElement
<< " - exclusion zone element idx = " << idxExclusionZoneElement;
if (!getHitPositionInternal(ezElement, position, direction, hitPos))
continue;
hitPos.state = HitPosition::State::ExclusionZone;
hitPos.exclusionZoneIdx = idxExclusionZone;
DEBUG_LOG(l) << " nearest distance = " << hitPos.distance << " on exclusion zone";
}
}
}
}
}
INFO_LOG(l) << "XXXXX HitPosition: " << hitPos.state
<< ", roomId = " << hitPos.roomId
<< ", outerWallIndex = " << hitPos.outerWallIdx
<< ", exclusionZoneIndex = " << hitPos.exclusionZoneIdx;
return hitPos;
}
HitPosition checkBsmPosition(const LtsUtils::QPoint3D &position, const LtsUtils::QPoint3D &bsmViewDirection, const QMap<int, Room> &rooms)
{
NGL::INGLLogger &l = logger();
const LtsUtils::QPoint3D direction(bsmViewDirection * -1);
INFO_LOG(l) << "XXXXX Searching nearest room for bsm position " << position
<< ", bsmViewDirection " << bsmViewDirection
<< ", hit direction " << direction
<< ", #rooms = " << rooms.size();
HitPosition hitPos;
for (const Room &room : rooms)
{
DEBUG_LOG(l) << "room[" << room.id() << "] #walls = " << room.outerWalls().size();
for (int idxOuterWall = 0; idxOuterWall < room.outerWalls().size(); ++idxOuterWall)
{
const OuterWall &wall = room.outerWalls().at(idxOuterWall);
DEBUG_LOG(l) << "room[" << room.id() << "]" << " wall[" << idxOuterWall << "] #elements = " << wall.elements().size();
for (int idxWallElement = 0; idxWallElement < wall.elements().size(); ++idxWallElement)
{
const WallElement &wallElement = wall.elements().at(idxWallElement);
DEBUG_LOG(l) << "room[" << room.id() << "]" << " wallElement[" << idxWallElement << "] #points = " << wallElement.size();
if (wallElement.size() < 3)
continue;
const QVector<LtsUtils::QPoint3D> &localWallElement = getCoordsForPlane(wallElement);
DEBUG_LOG(l) << "room[" << room.id() << "]" << " wallElement[" << idxWallElement << "] #points = " << localWallElement.size() << " after removing Linearly Dependent)";
if (localWallElement.size() < 3)
{
ERROR_LOG(l) << "localWallElement are not sufficiant";
for (auto coord : wallElement)
ERROR_LOG(l) << "wallElement are not sufficiant: << " << coord;
for (auto coord : qAsConst(localWallElement))
ERROR_LOG(l) << "localWallElement are not sufficiant: << " << coord;
continue;
}
for (auto pointOfWallElementLinear : qAsConst(localWallElement))
DEBUG_LOG(l) << "room[" << room.id() << "]" << " wall[" << idxOuterWall << "] " << " wallElement[" << idxWallElement << "] #points = " << localWallElement.size() << ", pointOfWallElementLinear=" << pointOfWallElementLinear;
const VwmPlane vwmPlaneOW(localWallElement.at(0), localWallElement.at(1), localWallElement.at(2));
DEBUG_LOG(l) << "room[" << room.id() << "]" << " wall[" << idxOuterWall << "]" << " wallElement[" << idxWallElement << "]"
<< ", planeOW params: p1 = " << vwmPlaneOW.pos()
<< ", p2 = " << vwmPlaneOW.vec1()
<< ", p3 = " << vwmPlaneOW.vec2()
<< ", det = " << vwmPlaneOW.det()
<< ", C = " << vwmPlaneOW.planeC()
<< ", vwmPlaneOW.isVertical=" << vwmPlaneOW.isVertical();
if (!vwmPlaneOW.getPlaneEquation())
continue;
DEBUG_LOG(l) << " getPlaneEquation() = true";
if (!vwmPlaneOW.isPlaneLineIntersection(direction))
continue;
DEBUG_LOG(l) << " isPlaneLineIntersection() = true -> direction=" << direction;
if (vwmPlaneOW.isPlaneLineOrthogonal(direction))
continue;
const LtsUtils::QPoint3D posOW = vwmPlaneOW.getPlaneLineIntersection(position, direction);
DEBUG_LOG(l) << " point to check: " << posOW;
if (!isPointInPolygon(localWallElement, posOW))
continue;
DEBUG_LOG(l) << " isPointInPolygon() = true";
const double curDistOW = vwmPlaneOW.distPlaneToPoint(position, direction);
const double absDistOW = fabs(curDistOW);
DEBUG_LOG(l) << " distance = " << curDistOW << " - room " << room.id();
if (absDistOW > fabs(hitPos.distance))
continue;
hitPos.distance = curDistOW;
hitPos.state = HitPosition::State::OuterWall;
hitPos.roomId = room.id();
hitPos.outerWallIdx = idxOuterWall;
DEBUG_LOG(l) << " XXXXX nearest distance = " << curDistOW << " on outer wall in room " << room.id()
<< "room[" << room.id() << "]" << " wall[" << idxOuterWall << "]" << " wallElement[" << idxWallElement << "]";
}
}
}
INFO_LOG(l) << "XXXXX HitPosition: " << hitPos.state
<< ", roomId = " << hitPos.roomId
<< ", outerWallIndex = " << hitPos.outerWallIdx
<< ", exclusionZoneIndex = " << hitPos.exclusionZoneIdx;
return hitPos;
}
LtsUtils::QPoint3D getIntersectionInternal(
const QVector<LtsUtils::QPoint3D> &planePoints, const LtsUtils::QPoint3D &position, const LtsUtils::QPoint3D &direction
)
{
NGL::INGLLogger &l = logger();
if (planePoints.size() < 3)
{
WARNING_LOG(l) << "Wall with fewer than 3 points - modelling error!";
return invalidPosition();
}
const QVector<LtsUtils::QPoint3D> &localPoly = getCoordsForPlane(planePoints);
if (localPoly.size() < 3)
{
ERROR_LOG(l) << "planePoints are not sufficiant";
for (auto coord : qAsConst(planePoints))
ERROR_LOG(l) << "planePoints are not sufficiant: << " << coord;
for (auto coord : qAsConst(localPoly))
ERROR_LOG(l) << "localPoly are not sufficiant: << " << coord;
return invalidPosition();
}
const VwmPlane vwmPlane(localPoly.at(0), localPoly.at(1), localPoly.at(2));
if (l.isDebugEnabled())
{
for ( int i = 0; i < localPoly.size(); ++i)
DEBUG_LOG(l) << "vwmPlane at(" << i << ")=" << localPoly.at(i).x() << "/" << localPoly.at(i).y() << "/"
<< localPoly.at(i).z();
DEBUG_LOG(l) << "plane params: p1 = " << vwmPlane.pos() << ", p2 = " << vwmPlane.vec1() << ", p3 = " << vwmPlane.vec2()
<< ", det = " << vwmPlane.det() << ", C = " << vwmPlane.planeC();
}
if (!vwmPlane.getPlaneEquation())
return invalidPosition();
DEBUG_LOG(l) << "getPlaneEquation() = true";
if (!vwmPlane.isPlaneLineIntersection(direction))
return invalidPosition();
DEBUG_LOG(l) << "isPlaneLineIntersection() = true";
const double planeLineScalar = vwmPlane.getPlaneLineSkalar(position, direction);
if (planeLineScalar <= 0)
return invalidPosition();
DEBUG_LOG(l) << "getPlaneLineSkalar() = " << planeLineScalar;
const LtsUtils::QPoint3D pos = vwmPlane.getPlaneLineIntersection(position, direction);
bool bIsPointInPolygon = isPointInPolygon(localPoly, pos);
DEBUG_LOG(l) << "bIsPoinliotInPolygon = " << bIsPointInPolygon;
return bIsPointInPolygon ? pos : invalidPosition();
}
LtsUtils::QPoint3D intersection(const LtsUtils::QPoint3D &start, const LtsUtils::QPoint3D &end, const QMap<int, Room> &rooms)
{
NGL::INGLLogger &l = logger();
DEBUG_LOG(l) << "Searching for intersection: start = " << start << ", end = " << end;
LtsUtils::QPoint3D intersectionPoint = invalidPosition();
double distance = (end - start).length();
const LtsUtils::QPoint3D direction = (end - start).normalized();
DEBUG_LOG(l) << "Searching for intersection: START"
<< ", intersectionPoint = " << intersectionPoint
<< ", distance = " << distance
<< ", direction = " << direction;
int cnt = 0;
int roomId4Debugging = 1;
for (const Room &room : qAsConst(rooms))
for (const OuterWall &outerWall : qAsConst(room.outerWalls()))
for (const WallElement &wallElement : qAsConst(outerWall.elements()))
{
const LtsUtils::QPoint3D point = getIntersectionInternal(wallElement, start, direction);
DEBUG_LOG(l) << "getIntersectionInternal:"
<< " cnt = " << cnt++
<< " room.id = " << room.id()
<< " - point=" << point;
if (point == invalidPosition())
continue;
const double dist = (point - start).length();
if (dist < distance)
{
DEBUG_LOG(l) << "Intersection found for room " << room.id() << ": " << point;
intersectionPoint = point;
distance = dist;
roomId4Debugging =room.id();
}
}
if (roomId4Debugging > 0)
DEBUG_LOG(l) << "Searching for intersection: FOUND"
<< ", intersectionPoint = " << intersectionPoint
<< ", distance = " << distance
<< ", direction = " << direction
<< ", at roomId=" << roomId4Debugging;
return intersectionPoint;
}
bool hasIntersection(const LtsUtils::QPoint3D &start, const LtsUtils::QPoint3D &end, const QMap<int, Room> &rooms)
{
const double distance = (end - start).length();
const LtsUtils::QPoint3D direction = (end - start).normalized();
for (const Room &room : qAsConst(rooms))
for (const OuterWall &outerWall : qAsConst(room.outerWalls()))
for (const WallElement &wallElement : qAsConst(outerWall.elements()))
{
const LtsUtils::QPoint3D point = getIntersectionInternal(wallElement, start, direction);
if (point == invalidPosition())
continue;
if ((start - point).length() > distance)
continue;
return true;
}
return false;
}
LtsUtils::QPoint3D invalidPosition()
{
return {100000., 100000., -10000.};
}
}
}
}
@@ -0,0 +1,63 @@
#pragma once
#include <LtsUtilsCore/qpoint3d.h>
#include <QVector>
#include "vwm_building.h"
#include "vwm_types.h"
#include <VWM/buildingcontrolvwm_export.h>
namespace BuildingControlUnit
{
namespace VWM
{
namespace Math
{
class BUILDINGCONTROLVWM_EXPORT VwmPlane
{
public:
VwmPlane(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &vec1, const LtsUtils::QPoint3D &vec2);
bool getPlaneEquation() const;
bool isPlaneLineIntersection(const LtsUtils::QPoint3D &vec) const;
bool isPlaneLineOrthogonal(const LtsUtils::QPoint3D &dir) const;
double getPlaneLineSkalar(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &dir) const;
LtsUtils::QPoint3D getPlaneLineIntersection(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &dir) const;
double distPlaneToPoint(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &dir) const;
const LtsUtils::QPoint3D &pos() const { return m_pos; }
const LtsUtils::QPoint3D &vec1() const { return m_vec1; }
const LtsUtils::QPoint3D &vec2() const { return m_vec2; }
const LtsUtils::QPoint3D &det() const { return m_det; }
double planeC() const { return m_planeC; }
bool isVertical() const { return qFuzzyIsNull(LtsUtils::QPoint3D::dotProduct({0., 0., 1.}, LtsUtils::QPoint3D::crossProduct(m_vec1, m_vec2))); }
private:
LtsUtils::QPoint3D m_pos;
LtsUtils::QPoint3D m_vec1;
LtsUtils::QPoint3D m_vec2;
LtsUtils::QPoint3D m_det;
double m_planeC{0.0};
};
BUILDINGCONTROLVWM_EXPORT LtsUtils::QPoint3D invalidPosition();
BUILDINGCONTROLVWM_EXPORT LtsUtils::QPoint3D rotateAroundYAxis(const LtsUtils::QPoint3D &in, double phi);
BUILDINGCONTROLVWM_EXPORT LtsUtils::QPoint3D rotateAroundZAxis(const LtsUtils::QPoint3D &in, double phi);
BUILDINGCONTROLVWM_EXPORT HitPosition getHitPosition(const LtsUtils::QPoint3D &position, const LtsUtils::QPoint3D &direction, const QMap<int, Room> &rooms);
BUILDINGCONTROLVWM_EXPORT HitPosition checkBsmPosition(const LtsUtils::QPoint3D &position, const LtsUtils::QPoint3D &bsmViewDirection, const QMap<int, Room> &rooms);
BUILDINGCONTROLVWM_EXPORT bool isPointInPolygon(const QVector<LtsUtils::QPoint3D> &poly, const LtsUtils::QPoint3D &pos);
BUILDINGCONTROLVWM_EXPORT LtsUtils::QPoint3D intersection(const LtsUtils::QPoint3D &start, const LtsUtils::QPoint3D &end, const QMap<int, Room> &rooms);
BUILDINGCONTROLVWM_EXPORT bool hasIntersection(const LtsUtils::QPoint3D &start, const LtsUtils::QPoint3D &end, const QMap<int, Room> &rooms);
BUILDINGCONTROLVWM_EXPORT bool vecIsLinearlyDependent(const LtsUtils::QPoint3D &v1, const LtsUtils::QPoint3D &v2);
BUILDINGCONTROLVWM_EXPORT QVector<LtsUtils::QPoint3D> getCoordsForPlane(const QVector<LtsUtils::QPoint3D> &poly);
}
}
}
@@ -0,0 +1,752 @@
#include <nglapplication/nglcoreapplication.h>
#include <QtTest/QtTest>
#include "vwm_math_unit_test.h"
#include "vwm_math.h"
#include "vwm_building.h"
#include <QVector3D>
int main(int argc, char *argv[])
{
NGLCoreApplication app(argc, argv);
app.createLogger("BCU", 1);
VwmMathUnitTest tc;
return QTest::qExec(&tc, argc, argv);
}
namespace QTest
{
template<>
char *toString(const LtsUtils::QPoint3D &p)
{
std::ostringstream s; s << p;
const std::string str = s.str();
char *ret = new char[str.size() + 1];
strcpy(ret, str.c_str());
return ret;
}
template<>
char *toString(const BuildingControlUnit::VWM::HitPosition::State &s)
{
const std::string str = std::to_string(static_cast<int>(s));
char *ret = new char[str.size() + 1];
strcpy(ret, str.c_str());
return ret;
}
}
void VwmMathUnitTest::testRotation()
{
const LtsUtils::QPoint3D pIn(1, 2, 3);
const LtsUtils::QPoint3D pRot1 = BuildingControlUnit::VWM::Math::rotateAroundYAxis(pIn, 0.12);
const LtsUtils::QPoint3D pRot2 = BuildingControlUnit::VWM::Math::rotateAroundZAxis(pIn, 0.12);
const LtsUtils::QPoint3D pExp1 = LtsUtils::QPoint3D(0.6336720139871, 2.0000000000000, 3.0981381148505);
const LtsUtils::QPoint3D pExp2 = LtsUtils::QPoint3D(1.2322330504317, 1.8659050644199, 3.0000000000000);
std::ostringstream s1, s2;
s1 << "Is: " << pRot1 << ", Expected: " << pExp1;
s1 << "Is: " << pRot2 << ", Expected: " << pExp2;
QVERIFY2(qFuzzyCompare(pRot1, pExp1), s1.str().c_str());
QVERIFY2(qFuzzyCompare(pRot2, pExp2), s2.str().c_str());
}
static const QVector<LtsUtils::QPoint3D> polyBldg1104_401_52({
{11.187, 0.000, 10.280},
{11.187, 0.400, 10.268},
{11.187, 2.517, 10.204},
{11.187, 4.362, 10.147},
{ 0.000, 4.362, 10.147},
{ 0.000, 0.403, 10.268},
{ 0.000, 0.000, 10.280},
{10.766, 0.000, 10.280},
{10.787, 0.000, 10.280}
});
static const QVector<LtsUtils::QPoint3D> polyBldg1104_401_52_adapted01({
{11.187, 0.000, 10.280},
{11.187, 0.400, 10.268},
{11.187, 2.517, 10.204},
{11.187, 2.517, 10.204},
{11.187, 2.517, 10.204},
{11.187, 4.362, 10.147},
{ 0.000, 4.362, 10.147},
{ 0.000, 0.403, 10.268},
{ 0.000, 0.000, 10.280},
{10.766, 0.000, 10.280},
{10.787, 0.000, 10.280}
});
static const QVector<LtsUtils::QPoint3D> polyBldg577_201_1({
{0.000, 2.167, -0.180},
{0.001, 4.506, -0.180},
{0.001, 4.506, 2.278},
{0.001, 4.506, 2.341},
{0.001, 4.506, 2.520},
{0.000, 4.506, 2.520}
});
static const QVector<LtsUtils::QPoint3D> polyBldg577_201_5({
{0.001, 4.506, -0.180},
{0.001, 6.233, -0.180},
{0.001, 6.233, 2.520},
{0.001, 4.506, 2.520},
{0.001, 4.506, 2.278},
{0.001, 4.506, 0.713}
});
static const QVector<LtsUtils::QPoint3D> polyBldg1116_206_8({
{21.226, 11.995, 6.431},
{23.858, 11.995, 6.431},
{24.038, 11.995, 6.431},
{24.038, 11.995, 6.223},
{23.858, 11.995, 6.223},
{21.226, 11.995, 6.223}
});
static const QVector<LtsUtils::QPoint3D> polyBldg1116_206_9({
{24.038, 11.995, 6.431},
{23.858, 11.995, 6.431},
{21.226, 11.995, 6.431},
{21.226, 11.995, 6.449}
});
static const QVector<LtsUtils::QPoint3D> polyBldg1116_206_X({
{24.038, 11.815, 3.210},
{24.858, 5.896, 3.210},
{24.038, 5.896, 6.393},
{24.038, 6.076, 6.393},
{24.038, 7.715, 5.513}
});
static const QVector<LtsUtils::QPoint3D> polyBldg3101_306_149({
{10.905, 16.003, 5.480},
{12.277, 16.003, 5.480},
{17.839, 16.004, 5.480},
{17.839, 16.004, 8.040},
{10.905, 16.003, 8.040}
});
static const QVector<LtsUtils::QPoint3D> polyBldg3101_506_276({
{10.905, 16.003, 10.990},
{12.277, 16.003, 10.990},
{17.839, 16.005, 10.990},
{17.839, 16.005, 13.602},
{10.905, 16.003, 13.602}
});
static const QVector<LtsUtils::QPoint3D> polyBldg3102_402_210({
{0.180, 9.676, 5.420},
{0.525, 9.676, 5.420},
{2.201, 9.676, 5.420},
{2.201, 9.676, 7.910},
{0.180, 9.676, 7.910},
});
static const QVector<LtsUtils::QPoint3D> polyBldgUBahn_303_333({
{140.006, 3.988, -1.945},
{140.006, 3.407, -1.945},
{140.006, 0.594, -1.945},
{140.006, 0.594, 0.545},
{140.006, 3.988, 0.545},
});
static const QVector<LtsUtils::QPoint3D> polyBldg1108_103_X({
{-0.000, 15.979, 2.278},
{-0.000, 15.979, 0.975},
{-0.000, 15.979, 0.000},
{ 0.180, 15.979, 0.000},
{ 0.180, 15.979, 2.490},
{-0.000, 15.979, 2.490},
{-0.000, 15.979, 0.000}
});
static const QVector<LtsUtils::QPoint3D> polyBldg3101_510_309({
{ 7.291, -0.225, 13.744},
{10.726, -0.225, 13.744},
{10.726, 4.462, 13.869},
{ 7.291, 4.462, 13.869}
});
static const QVector<LtsUtils::QPoint3D> polyBldg3101_608_387_Org({
{10.726, 8.619, 16.787},
{10.726, 8.716, 16.786},
{ 7.291, 8.716, 16.786},
{ 7.291, 8.619, 16.787},
{ 7.291, 4.281, 16.717},
{10.726, 4.281, 16.717}
});
static const QVector<LtsUtils::QPoint3D> polyBldg3101_608_387_Z_Gleichgezogen({
{10.726, 8.619, 16.786},
{10.726, 8.716, 16.786},
{ 7.291, 8.716, 16.786},
{ 7.291, 8.619, 16.786},
{ 7.291, 4.281, 16.786},
{10.726, 4.281, 16.786}
});
static const QVector<LtsUtils::QPoint3D> polyBldg3101_608_387_Z_ROUNDED({
{10.73, 8.62, 16.79},
{10.73, 8.72, 16.79},
{ 7.30, 8.72, 16.79},
{ 7.39, 8.62, 16.79},
{ 7.39, 4.28, 16.79},
{10.73, 4.28, 16.79}
});
static const QVector<LtsUtils::QPoint3D> polyBldg1103_205_5_ORG({
{11.639, 6.026, 5.412},
{11.639, 2.607, 5.513},
{11.639, 1.690, 5.540},
{14.659, 1.694, 5.539},
{14.659, 6.026, 5.412}
});
static const QVector<LtsUtils::QPoint3D> polyBldg1103_205_5_ROUNDED({
{11.64, 6.03, 5.41},
{11.64, 2.61, 5.51},
{11.64, 1.69, 5.54},
{14.66, 1.69, 5.54},
{14.66, 6.03, 5.41}
});
static const QVector<LtsUtils::QPoint3D> polyBldg1131_201_3({
{0.000, 5.987, 2.689},
{0.000, 5.791, 2.695},
{0.000, 0.170, 2.859},
{3.098, 0.170, 2.859},
{3.098, 5.791, 2.695},
{2.928, 5.987, 2.689}
});
const LtsUtils::QPoint3D pIn(10.6477, 6.13499, 10000);
void VwmMathUnitTest::testIsLinearlyDependent()
{
bool bVecIsLinearlyDependent = false;
{
const QVector<LtsUtils::QPoint3D> poly({{0.000, 0.000, 0.},
{0.000, 0.000, 0.},
{1.000, 2.000, 0.}
});
const LtsUtils::QPoint3D &v1 = poly.at(1) - poly.at(0);
const LtsUtils::QPoint3D &v2 = poly.at(2) - poly.at(0);
bVecIsLinearlyDependent = BuildingControlUnit::VWM::Math::vecIsLinearlyDependent(v1, v2);
QCOMPARE(bVecIsLinearlyDependent, true);
}
{
const QVector<LtsUtils::QPoint3D> poly({{0.000, 0.000, 0.},
{0.000, 1.000, 0.},
{0.000, 2.000, 0.}
});
const LtsUtils::QPoint3D &v1 = poly.at(1) - poly.at(0);
const LtsUtils::QPoint3D &v2 = poly.at(2) - poly.at(0);
bVecIsLinearlyDependent = BuildingControlUnit::VWM::Math::vecIsLinearlyDependent(v1, v2);
QCOMPARE(bVecIsLinearlyDependent, true);
}
{
const QVector<LtsUtils::QPoint3D> poly({{0.000, 0.000, 0.},
{0.000, 1.000, 0.},
{0.000, 2.000, 0.},
{0.000, 3.000, 0.},
{0.000, 4.000, 0.}
});
const LtsUtils::QPoint3D &v1 = poly.at(1) - poly.at(0);
const LtsUtils::QPoint3D &v2 = poly.at(2) - poly.at(0);
bVecIsLinearlyDependent = BuildingControlUnit::VWM::Math::vecIsLinearlyDependent(v1, v2);
QCOMPARE(bVecIsLinearlyDependent, true);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg1104_401_52;
const LtsUtils::QPoint3D &v1 = polyIN.at(1) - polyIN.at(0);
const LtsUtils::QPoint3D &v2 = polyIN.at(2) - polyIN.at(0);
bVecIsLinearlyDependent = BuildingControlUnit::VWM::Math::vecIsLinearlyDependent(v1, v2);
QCOMPARE(bVecIsLinearlyDependent, true);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg1104_401_52_adapted01;
const LtsUtils::QPoint3D &v1 = polyIN.at(1) - polyIN.at(0);
const LtsUtils::QPoint3D &v2 = polyIN.at(2) - polyIN.at(0);
bVecIsLinearlyDependent = BuildingControlUnit::VWM::Math::vecIsLinearlyDependent(v1, v2);
QCOMPARE(bVecIsLinearlyDependent, true);
}
{
const QVector<LtsUtils::QPoint3D> poly({{0.000, 0.000, 0.},
{0.000, 1.000, 0.},
{1.000, 1.000, 0.},
{1.000, 2.000, 0.},
{2.000, 2.000, 0.}
});
const LtsUtils::QPoint3D &v1 = poly.at(1) - poly.at(0);
const LtsUtils::QPoint3D &v2 = poly.at(2) - poly.at(0);
bVecIsLinearlyDependent = BuildingControlUnit::VWM::Math::vecIsLinearlyDependent(v1, v2);
QCOMPARE(bVecIsLinearlyDependent, false);
}
}
void printPoly(QVector<LtsUtils::QPoint3D> value)
{
std::ostringstream stream;
stream << "QVector<QPoint3D>(" << value.size() << "): ";
for (LtsUtils::QPoint3D i : value)
stream << i << ";";
std::cout << stream.str() << std::endl;
}
void VwmMathUnitTest::getCoordsForPlane()
{
{
const BuildingControlUnit::VWM::WallElement we({{0.000, 0.000, 0.},
{0.000, 1.000, 0.},
{0.000, 2.000, 0.}
});
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(we);
QCOMPARE(planeCoords.size(), 2);
}
{
const BuildingControlUnit::VWM::WallElement we({{0.000, 0.000, 0.},
{0.000, 1.000, 0.},
{1.000, 1.000, 0.}
});
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(we);
QCOMPARE(planeCoords.size(), 3);
}
{
const BuildingControlUnit::VWM::WallElement we({{0.000, 0.000, 0.},
{0.000, 1.000, 0.},
{1.000, 1.000, 0.},
{1.000, 0.000, 0.}
});
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(we);
QCOMPARE(planeCoords.size(), 4);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg1104_401_52;
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 5);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg1104_401_52_adapted01;
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 5);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg577_201_1;
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 3);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg577_201_5;
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 5);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg1116_206_8;
printPoly(polyIN);
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 4);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg1116_206_9;
printPoly(polyIN);
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 3);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg1116_206_X;
printPoly(polyIN);
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 5);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg3101_306_149;
printPoly(polyIN);
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 4);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg3101_506_276;
printPoly(polyIN);
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 4);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg3102_402_210;
printPoly(polyIN);
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 4);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldgUBahn_303_333;
printPoly(polyIN);
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 4);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg1108_103_X;
printPoly(polyIN);
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 6);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg3101_510_309;
printPoly(polyIN);
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 4);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg3101_608_387_Org;
printPoly(polyIN);
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 6);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg3101_608_387_Z_Gleichgezogen;
printPoly(polyIN);
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 5);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg1103_205_5_ORG;
printPoly(polyIN);
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 4);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg1103_205_5_ROUNDED;
printPoly(polyIN);
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(polyIN);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 5);
}
{
const QVector<LtsUtils::QPoint3D> &polyIN = polyBldg1131_201_3;
printPoly(polyIN);
BuildingControlUnit::VWM::MakePlanar makePlanar(polyIN);
QVector<LtsUtils::QPoint3D> planarPoly = makePlanar.calculate();
QVector<LtsUtils::QPoint3D> planeCoords = BuildingControlUnit::VWM::Math::getCoordsForPlane(planarPoly);
printPoly(planeCoords);
std::cout << " IN: " << polyIN.size() << " RESULT: " << planeCoords.size() << std::endl;
QCOMPARE(planeCoords.size(), 5);
}
}
void VwmMathUnitTest::testPlane()
{
QVector<LtsUtils::QPoint3D> poly({{3.629, 0, 2.53},
{ 0, 0, 2.53},
{ 0, 0, 0},
{3.627, 0, 0}});
const LtsUtils::QPoint3D pIn(1, 0, 1);
const LtsUtils::QPoint3D pOut(1, 0.2, 1);
QVERIFY2(BuildingControlUnit::VWM::Math::isPointInPolygon(poly, pIn), "Point is not in polygon!");
QVERIFY2(!BuildingControlUnit::VWM::Math::isPointInPolygon(poly, pOut), "Point is in polygon!");
LtsUtils::QPoint3D p1(100, 100, 3);
LtsUtils::QPoint3D p2( 2, 3, 4);
LtsUtils::QPoint3D p3( 3, 4, 5);
BuildingControlUnit::VWM::Math::VwmPlane plane(p1, p2, p3);
QVERIFY2(plane.getPlaneEquation(), "Can not determine plane equation ...");
QCOMPARE(plane.det(), LtsUtils::QPoint3D(-98,99,-1));
QCOMPARE(plane.planeC(), 97.);
LtsUtils::QPoint3D vec(1, 0, 2);
LtsUtils::QPoint3D pos(1, 3, 7);
QVERIFY2(plane.isPlaneLineIntersection(vec), "no intersection - error!");
QCOMPARE(plane.getPlaneLineSkalar(pos, vec), 0.95);
QCOMPARE(plane.getPlaneLineIntersection(pos, vec), LtsUtils::QPoint3D(1.95,3,8.9));
}
void VwmMathUnitTest::testBsmHit()
{
const BuildingControlUnit::VWM::WallElement we1({{4.486, -0.003, 0.111},
{0.000, 0.000, 0.111},
{0.000, 0.000, 2.910},
{4.486, -0.003, 2.910}});
const BuildingControlUnit::VWM::WallElement we2({{0.000, 0.000, 0.111},
{4.486, -0.003, 0.111},
{4.486, -0.003, 2.910},
{0.000, 0.000, 2.910}});
BuildingControlUnit::VWM::OuterWall ow1;
ow1.elements().push_back(we1);
BuildingControlUnit::VWM::OuterWall ow2;
ow2.elements().push_back(we2);
BuildingControlUnit::VWM::Room r1;
r1.setId(41);
r1.outerWalls().push_back(ow1);
BuildingControlUnit::VWM::Room r2;
r2.setId(42);
r2.outerWalls().push_back(ow2);
const QMap<int, BuildingControlUnit::VWM::Room> rooms1({{r1.id(), r1}});
const QMap<int, BuildingControlUnit::VWM::Room> rooms2({{r2.id(), r2}});
const LtsUtils::QPoint3D bsmPos1(2.344, +0.018, 2.799);
const LtsUtils::QPoint3D bsmPos2(2.344, -0.018, 2.799);
const LtsUtils::QPoint3D bsmDir1(0, +1, 0);
const LtsUtils::QPoint3D bsmDir2(0, -1, 0);
for (const auto &rooms : std::vector<QMap<int, BuildingControlUnit::VWM::Room>>({rooms1, rooms2}))
{
{
BuildingControlUnit::VWM::HitPosition hp1 = BuildingControlUnit::VWM::Math::checkBsmPosition(bsmPos1, bsmDir1, rooms);
std::cout << hp1 << std::endl;
QCOMPARE(hp1.state, BuildingControlUnit::VWM::HitPosition::State::OuterWall);
QVERIFY2(hp1.distance > 0, "Distance must be greater zero");
BuildingControlUnit::VWM::HitPosition hp2 = BuildingControlUnit::VWM::Math::checkBsmPosition(bsmPos1, bsmDir2, rooms);
std::cout << hp2 << std::endl;
QCOMPARE(hp2.state, BuildingControlUnit::VWM::HitPosition::State::OuterWall);
QVERIFY2(hp2.distance < 0, "Distance must be smaller zero");
BuildingControlUnit::VWM::HitPosition hp3 = BuildingControlUnit::VWM::Math::checkBsmPosition(bsmPos2, bsmDir1, rooms);
std::cout << hp3 << std::endl;
QCOMPARE(hp3.state, BuildingControlUnit::VWM::HitPosition::State::OuterWall);
QVERIFY2(hp3.distance < 0, "Distance must be smaller zero");
BuildingControlUnit::VWM::HitPosition hp4 = BuildingControlUnit::VWM::Math::checkBsmPosition(bsmPos2, bsmDir2, rooms);
std::cout << hp4 << std::endl;
QCOMPARE(hp4.state, BuildingControlUnit::VWM::HitPosition::State::OuterWall);
QVERIFY2(hp4.distance > 0, "Distance must be greater zero");
}
{
BuildingControlUnit::VWM::HitPosition hp1 = BuildingControlUnit::VWM::Math::getHitPosition(bsmPos1, bsmDir1 * -1, rooms);
std::cout << hp1 << std::endl;
QCOMPARE(hp1.state, BuildingControlUnit::VWM::HitPosition::State::OuterWall);
QVERIFY2(hp1.distance > 0, "Distance must be greater zero");
BuildingControlUnit::VWM::HitPosition hp2 = BuildingControlUnit::VWM::Math::getHitPosition(bsmPos1, bsmDir2 * -1, rooms);
std::cout << hp2 << std::endl;
QCOMPARE(hp2.state, BuildingControlUnit::VWM::HitPosition::State::NoHit);
BuildingControlUnit::VWM::HitPosition hp3 = BuildingControlUnit::VWM::Math::getHitPosition(bsmPos2, bsmDir1 * -1, rooms);
std::cout << hp3 << std::endl;
QCOMPARE(hp3.state, BuildingControlUnit::VWM::HitPosition::State::NoHit);
BuildingControlUnit::VWM::HitPosition hp4 = BuildingControlUnit::VWM::Math::getHitPosition(bsmPos2, bsmDir2 * -1, rooms);
std::cout << hp4 << std::endl;
QCOMPARE(hp4.state, BuildingControlUnit::VWM::HitPosition::State::OuterWall);
QVERIFY2(hp1.distance > 0, "Distance must be greater zero");
}
}
}
void VwmMathUnitTest::testSpecialCase()
{
LtsUtils::QPoint3D pIn(10.6477, 6.13499, 10000);
static const QVector<LtsUtils::QPoint3D> polyBldg3101_608_387_Simple({
{10.726, 8.716, 16.786},
{ 7.291, 8.716, 16.786},
{ 7.291, 4.281, 16.786},
{10.726, 4.281, 16.786}
});
const QVector<LtsUtils::QPoint3D> &polygon = polyBldg3101_608_387_Z_ROUNDED;
pIn.setZ(16.786);
QVERIFY2(BuildingControlUnit::VWM::Math::isPointInPolygon(polygon, pIn), "Point is not in polygon!");
QVERIFY2(BuildingControlUnit::VWM::Math::isPointInPolygon(polyBldg3101_608_387_Org, pIn), "Point is not in polygon!");
const LtsUtils::QPoint3D position(10.6477, 6.13499, 10000);
const LtsUtils::QPoint3D direction(0, 0, -1);
BuildingControlUnit::VWM::Math::VwmPlane plane(polygon[0], polygon[1], polygon[2]);
QVERIFY2(plane.getPlaneEquation(), "Can not determine plane equation ...");
QVERIFY2(plane.isPlaneLineIntersection(direction), "no intersection - error!");
const LtsUtils::QPoint3D posOW = plane.getPlaneLineIntersection(position, direction);
std::cout << " point to check: " << posOW.x() << std::endl;
std::cout << " point to check: " << posOW.y() << std::endl;
std::cout << " point to check: " << posOW.z() << std::endl;
QVERIFY2(BuildingControlUnit::VWM::Math::isPointInPolygon(polygon, posOW), "Point is not in polygon!");
}
void VwmMathUnitTest::testSpecialCase2()
{
LtsUtils::QPoint3D pIn(10.6477, 6.13499, 10000);
QVector<LtsUtils::QPoint3D> polygon = polyBldg3101_608_387_Org;
pIn.setZ(16.786);
QVERIFY2(BuildingControlUnit::VWM::Math::isPointInPolygon(polygon, pIn), "Point is not in polygon!");
QVERIFY2(BuildingControlUnit::VWM::Math::isPointInPolygon(polyBldg3101_608_387_Org, pIn), "Point is not in polygon!");
const LtsUtils::QPoint3D position(10.6477, 6.13499, 10000);
const LtsUtils::QPoint3D direction(0, 0, -1);
BuildingControlUnit::VWM::MakePlanar makePlanar(polygon);
polygon = makePlanar.calculate();
BuildingControlUnit::VWM::Math::VwmPlane plane(polygon[0], polygon[1], polygon[2]);
QVERIFY2(plane.getPlaneEquation(), "Can not determine plane equation ...");
QVERIFY2(plane.isPlaneLineIntersection(direction), "no intersection - error!");
const LtsUtils::QPoint3D posOW = plane.getPlaneLineIntersection(position, direction);
std::cout << " point to check: " << posOW.x() << std::endl;
std::cout << " point to check: " << posOW.y() << std::endl;
std::cout << " point to check: " << posOW.z() << std::endl;
QVERIFY2(BuildingControlUnit::VWM::Math::isPointInPolygon(polygon, posOW), "Point is not in polygon!");
}
bool isLinearDependend_QVector3D(const QVector3D &v1,
const QVector3D &v2,
const QVector3D &v3)
{
float distance1 = v2.distanceToPoint(v1);
float distance2 = v2.distanceToPoint(v3);
float distanceAll = v1.distanceToPoint(v3);
float abweichung = (distance1+distance2) - distanceAll;
std::cout << "abweichung: " << abweichung << " - qFuzzyIsNull = " << std::boolalpha << qFuzzyIsNull(abweichung) << std::endl;
return qFuzzyIsNull(
(v2.distanceToPoint(v1) + v2.distanceToPoint(v3)) - v1.distanceToPoint(v3)
);
}
void VwmMathUnitTest::testQVector3D()
{
QVector3D v1(1, 1, 0.0);
QVector3D v2(1, 2, 0.003);
QVector3D v3(1, 3, 0.0);
QCOMPARE(isLinearDependend_QVector3D(v1, v2, v3), true);
v2.setZ(0.0035);
QCOMPARE(isLinearDependend_QVector3D(v1, v2, v3), false);
}
@@ -0,0 +1,25 @@
#pragma once
#include <QObject>
class VwmMathUnitTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testRotation();
void testIsLinearlyDependent();
void getCoordsForPlane();
void testPlane();
void testBsmHit();
void testSpecialCase();
void testSpecialCase2();
void testQVector3D();
};
@@ -0,0 +1,246 @@
#include "vwm_state_store.h"
#include <logger.h>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QString>
#include <QFile>
#include <QStandardPaths>
#include <QDir>
namespace BuildingControlUnit
{
namespace VWM
{
namespace StateStore
{
static NGL::INGLLogger &logger()
{
return BuildingControlUnit::getLogger("VWM.StateStore");
}
static QJsonObject writeBuilding(const Building &building)
{
const QMap<int, Room> &rooms = building.rooms();
QJsonArray arrRooms;
for (auto it = rooms.begin(); it != rooms.end(); ++it)
{
QJsonArray arrOw;
const Room &room = it.value();
for (auto itW = room.outerWalls().begin(); itW != room.outerWalls().end(); ++itW)
{
QJsonArray arrEz;
const OuterWall &ow = (*itW);
for (auto itE = ow.exclusionZones().begin(); itE != ow.exclusionZones().end(); ++itE)
{
const ExclusionZone &ez = (*itE);
arrEz.append(QJsonObject({{QStringLiteral("ExclusionZoneProtection"), ez.protection()}}));
}
arrOw.append(QJsonObject({{QStringLiteral("OuterWallProtection"), ow.protection()},
{QStringLiteral("Ez"), arrEz}
}));
}
arrRooms.append(QJsonObject({{QStringLiteral("OuterWalls"), arrOw},
{QStringLiteral("room"), room.id()},
{QStringLiteral("fortifyFactor"), room.fortifyFactor()},
{QStringLiteral("remainingEffect"), room.remainingEffect()}}));
}
const QMap<QString, QString> &egcuProperties = building.segmentPropertyMap();
QJsonArray arrEgcuProperties;
for (auto it = egcuProperties.begin(); it != egcuProperties.end(); ++it)
{
arrEgcuProperties.append(QJsonObject({{QStringLiteral("Hostname"), it.key()},
{QStringLiteral("Properties"), it.value()}
}));
}
return QJsonObject({{QStringLiteral("BuildingName"), building.name()},
{QStringLiteral("Rooms"), arrRooms},
{QStringLiteral("SegmentProperties"), arrEgcuProperties},
{QStringLiteral("BuildingProperties"), building.buildingProperties()}});
}
static inline QJsonObject writeHitResult(const HitResult &hitResult)
{
return QJsonObject({{QStringLiteral("sensorId"), hitResult.sensorId},
{QStringLiteral("originatorId"), hitResult.originatorId},
{QStringLiteral("originatorType"),static_cast<int>(hitResult.originatorType)},
{QStringLiteral("chargeTypeId"), hitResult.chargeTypeId},
{QStringLiteral("damagePercentOld"), hitResult.damagePercentOld},
{QStringLiteral("damagePercentNew"), hitResult.damagePercentNew},
{QStringLiteral("effectSoundId"), hitResult.effectSoundId},
{QStringLiteral("effectTimeMSec"), hitResult.effectTimeMSec}});
}
static inline QJsonArray writeContaminationStates(const QMap<int, ContaminationState> & contaminationStates )
{
QJsonArray contaminationArr;
for (const auto &value : contaminationStates.values() )
{
QJsonArray roomArr;
for (const auto & roomId : qAsConst(value.rooms))
roomArr.append(QJsonValue(roomId));
contaminationArr.append(QJsonObject({ {QStringLiteral("aesId") , value.aesId},
{QStringLiteral("rooms"), roomArr}}));
}
return contaminationArr;
}
static void readEz(const QJsonObject &json, int ezIndex, OuterWall &outerWall)
{
if (ezIndex >= outerWall.exclusionZones().size())
return;
double protection = json[QStringLiteral("ExclusionZoneProtection")].toDouble();
outerWall.exclusionZones()[ezIndex].setProtection(protection);
}
static void readOw(const QJsonObject &json, OuterWall &outerWall)
{
int outerWallProtection = static_cast<int>( json[QStringLiteral("OuterWallProtection")].toDouble());
outerWall.setProtection(outerWallProtection);
QJsonArray ezArray = json[QStringLiteral("Ez")].toArray();
for (int ezIndex = 0; ezIndex < ezArray.size(); ++ezIndex)
{
QJsonObject ezObject = ezArray[ezIndex].toObject();
readEz(ezObject, ezIndex, outerWall);
}
}
static void readRoom(const QJsonObject &json, Building &building)
{
int id = json[QStringLiteral("room")].toInt();
auto room = building.rooms().find(id);
if (room == building.rooms().end())
return;
room.value().setRemainingEffect(json[QStringLiteral("remainingEffect")].toDouble());
room.value().setFortifyFactor(json[QStringLiteral("fortifyFactor")].toDouble());
QJsonArray owArray = json[QStringLiteral("OuterWalls")].toArray();
for (int owIndex = 0; owIndex < owArray.size(); ++owIndex)
{
if (owIndex >= room.value().outerWalls().size())
break;
QJsonObject owObject = owArray[owIndex].toObject();
if (room.value().outerWalls().size() > owIndex)
readOw(owObject, room.value().outerWalls()[owIndex]);
}
}
static void readBuilding(const QJsonObject &json, Building &building)
{
QJsonArray roomArray = json[QStringLiteral("Rooms")].toArray();
for (int roomIndex = 0; roomIndex < roomArray.size(); ++roomIndex)
{
QJsonObject roomObject = roomArray[roomIndex].toObject();
readRoom(roomObject, building);
}
building.clearSegmentProperties();
QJsonArray segmentArray = json[QStringLiteral("SegmentProperties")].toArray();
for (int segmentIndex = 0; segmentIndex < segmentArray.size(); ++segmentIndex)
{
QJsonObject segmentObject = segmentArray[segmentIndex].toObject();
QString hostname = segmentObject[QStringLiteral("Hostname")].toString();
QString properties = segmentObject[QStringLiteral("Properties")].toString();
building.setSegmentProperties(hostname,properties);
}
building.setBuildingProperties(json[QStringLiteral("BuildingProperties")].toString());
}
static void readHitResult(const QJsonObject &json, HitResult &hitResult)
{
hitResult.sensorId = json.value(QStringLiteral("sensorId")).toInt();
hitResult.originatorId = json.value(QStringLiteral("originatorId")).toInt();
hitResult.originatorType = static_cast<OriginatorType>(json.value(QStringLiteral("originatorType")).toInt());
hitResult.chargeTypeId = json.value(QStringLiteral("chargeTypeId")).toInt();
hitResult.damagePercentOld = json.value(QStringLiteral("damagePercentOld")).toInt();
hitResult.damagePercentNew = json.value(QStringLiteral("damagePercentNew")).toInt();
hitResult.effectSoundId = json.value(QStringLiteral("effectSoundId")).toInt();
hitResult.effectTimeMSec = json.value(QStringLiteral("effectTimeMSec")).toDouble();
}
static void readContaminationStates(const QJsonArray &jsArr, QMap<int, ContaminationState> &contaminationStates)
{
for (auto index : jsArr)
{
const QJsonObject &inObj = index.toObject();
ContaminationState contStates;
contStates.aesId = inObj[QStringLiteral("aesId")].toInt();
const QJsonArray &idsArr = inObj[QStringLiteral("rooms")].toArray();
contStates.rooms.reserve(idsArr.count());
for (const auto & id : idsArr)
contStates.rooms.push_back(id.toInt());
contaminationStates.insert(contStates.aesId, contStates);
}
}
static QString getStateFilename(const QString &name)
{
const QString folder = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/');
if (!QDir(folder).exists())
QDir().mkpath(folder);
return folder + name;
}
bool saveState(const Building &building, const HitResult &hitResult,const QMap <int, ContaminationState> &contaminationStates)
{
DEBUG_LOG(logger()) << "**********************";
DEBUG_LOG(logger()) << "*** SAVE STATE *** "<< getStateFilename(building.name());
DEBUG_LOG(logger()) << "**********************";
QFile saveFile(getStateFilename(building.name()));
if (!saveFile.open(QIODevice::WriteOnly))
{
WARNING_LOG(logger()) << "Couldn't open State file. " << getStateFilename(building.name());
return false;
}
QJsonObject saveObject;
saveObject[QStringLiteral("Building")] = writeBuilding(building);
saveObject[QStringLiteral("HitResult")] = writeHitResult(hitResult);
saveObject[QStringLiteral("contaminationStates")] = writeContaminationStates(contaminationStates);
const QJsonDocument saveDoc(saveObject);
saveFile.write(saveDoc.toJson());
return true;
}
bool loadState(Building &building, HitResult &hitResult, QMap <int, ContaminationState> &contaminationStates)
{
DEBUG_LOG(logger()) << "**********************";
DEBUG_LOG(logger()) << "*** LOAD STATE *** "<< getStateFilename(building.name());
DEBUG_LOG(logger()) << "**********************";
QFile loadFile(getStateFilename(building.name()));
if (!loadFile.open(QIODevice::ReadOnly))
{
WARNING_LOG(logger()) << "Couldn't open State file. " << getStateFilename(building.name());
return false;
}
QByteArray saveData = loadFile.readAll();
QJsonDocument loadDoc(QJsonDocument::fromJson(saveData));
readBuilding(loadDoc.object().value(QStringLiteral("Building")).toObject(), building);
readHitResult(loadDoc.object().value(QStringLiteral("HitResult")).toObject(), hitResult);
readContaminationStates(loadDoc.object().value(QStringLiteral("contaminationStates")).toArray(), contaminationStates);
return true;
}
}
}
}
@@ -0,0 +1,24 @@
#pragma once
#include "vwm_building.h"
#include "vwm_types.h"
#include <VWM/buildingcontrolvwm_export.h>
#include <QMap>
namespace BuildingControlUnit
{
namespace VWM
{
namespace StateStore
{
BUILDINGCONTROLVWM_EXPORT bool saveState(const Building &building,
const HitResult &hitResult,
const QMap <int, ContaminationState> &contaminationStates);
BUILDINGCONTROLVWM_EXPORT bool loadState(Building &building,
HitResult &hitResult,
QMap <int, ContaminationState> &contaminationStates);
}
}
}
@@ -0,0 +1,121 @@
#pragma once
#include <LtsUtilsCore/qpoint3d.h>
#include <QMap>
#include <QVector>
#include <cstdint>
#include <iostream>
#include <bcu_types.h>
namespace BuildingControlUnit
{
namespace VWM
{
struct Charge
{
int id = 0;
int chargeTypeId = 0;
int destructiveFactor = 0;
int penetrationEffect = 0;
int effectSoundId = 0;
bool difcueLight = false;
bool difcuePyro = false;
bool showHitLine = true;
bool isValid() const
{
return id != 0;
}
};
inline std::ostream &operator<< (std::ostream &stream, const Charge &c)
{
stream << "id = " << c.id
<< ", destructiveFactor = " << c.destructiveFactor
<< ", penetrationEffect = " << c.penetrationEffect
<< ", effectSoundId = " << c.effectSoundId
<< ", difcueLight = " << c.difcueLight
<< ", difcuePyro = " << c.difcuePyro;
return stream;
}
struct Hit
{
int sensorId = 0;
int originatorId = 0;
OriginatorType originatorType = OriginatorType::Unknown;
TypeOfHit typeOfHit = TypeOfHit::Unknown;
int chargeTypeId = 0;
int destructiveFactor = 0;
int penetrationFactor = 0;
int64_t effectTimeMSec = 0;
DamageState damageStateOverride = DamageState::Unknown;
QVector<int> affectedRoomIds;
LtsUtils::QPoint3D position;
LtsUtils::QPoint3D direction;
};
inline std::ostream &operator<< (std::ostream &stream, const Hit &hit)
{
stream << "sensorId = " << hit.sensorId
<< ", originatorId = " << hit.originatorId
<< ", originatorType = " << hit.originatorType
<< ", typeOfHit = " << hit.typeOfHit
<< ", chargeTypeId = " << hit.chargeTypeId
<< ", effectTimeMSec = " << hit.effectTimeMSec
<< ", damageStateOverride = " << hit.damageStateOverride;
stream << ", affectedRoomIds = (";
for (int id : qAsConst(hit.affectedRoomIds))
stream << id << ",";
stream << ")";
stream << ", position = " << hit.position
<< ", direction = " << hit.direction;
return stream;
}
struct HitPosition
{
enum class State
{
NoHit,
OuterWall,
ExclusionZone
} state = State::NoHit;
int roomId = 0;
int outerWallIdx = -1;
int exclusionZoneIdx = -1;
double distance = +100000;
};
inline std::ostream &operator<< (std::ostream &stream, const HitPosition::State &state)
{
switch (state)
{
case HitPosition::State::NoHit: stream << "HitPosition::State::NoHit"; break;
case HitPosition::State::OuterWall: stream << "HitPosition::State::OuterWall"; break;
case HitPosition::State::ExclusionZone: stream << "HitPosition::State::ExclusionZone"; break;
}
return stream;
}
inline std::ostream &operator<< (std::ostream &stream, const HitPosition &hitPos)
{
stream << "state = " << hitPos.state
<< ", roomId = " << hitPos.roomId
<< ", outerWallIdx = " << hitPos.outerWallIdx
<< ", exclusionZoneIdx = " << hitPos.exclusionZoneIdx
<< ", distance = " << hitPos.distance;
return stream;
}
}
}
@@ -0,0 +1,327 @@
#include "vwm_xml_reader.h"
#include "vwm_building_room_geometry.h"
#include <logger.h>
#include <QFile>
#include <QDomDocument>
#include <QSet>
#include <bcu_xml_reader.h>
namespace BuildingControlUnit
{
namespace VWM
{
namespace XmlReader
{
static NGL::INGLLogger &logger()
{
return BuildingControlUnit::getLogger("XmlReader");
}
static Charge parseCharge(const QDomElement &domCharge)
{
Charge charge;
charge.id = getTagText(domCharge, QStringLiteral("Id")).toInt();
charge.chargeTypeId = getTagText(domCharge, QStringLiteral("ChargeTypeId")).toInt();
charge.destructiveFactor = getTagText(domCharge, QStringLiteral("DestructiveFactor")).toInt();
charge.penetrationEffect = getTagText(domCharge, QStringLiteral("PenetrationEffect")).toInt();
charge.effectSoundId = getTagText(domCharge, QStringLiteral("EffectSound")).toInt();
charge.difcueLight = getTagText(domCharge, QStringLiteral("DifcueLight")).toInt() != 0;
charge.difcuePyro = getTagText(domCharge, QStringLiteral("DifcuePyro")).toInt() != 0;
if (hasTagText(domCharge, QStringLiteral("showHitLine")))
charge.showHitLine = getTagText(domCharge, QStringLiteral("showHitLine")).toInt() != 0;
else
charge.showHitLine = true;
DEBUG_LOG(logger()) << "Charge: " << charge;
return charge;
}
bool readCharges(const QString &fn, QMap<int, Charge> &charges)
{
charges.clear();
const QDomElement domRoot = readFile(fn, QStringLiteral("Charges"));
if (domRoot.isNull())
return false;
QDomElement domChargeType = domRoot.firstChildElement(QStringLiteral("Charge"));
while (!domChargeType.isNull())
{
try
{
const Charge c = parseCharge(domChargeType);
charges.insert(c.chargeTypeId, c);
}
catch (const XmlReaderException &ex)
{
QString errorString = QLatin1String("Error reading charge type: ") + QLatin1String(ex.what());
ERROR_LOG(logger()) << errorString;
return false;
}
domChargeType = domChargeType.nextSiblingElement(domChargeType.tagName());
}
return true;
}
static LtsUtils::QPoint3D getCoord3D(const QDomElement &domCoord)
{
LtsUtils::QPoint3D ret;
ret.rx() = getTagText(domCoord, QStringLiteral("X")).toDouble();
ret.ry() = getTagText(domCoord, QStringLiteral("Y")).toDouble();
ret.rz() = getTagText(domCoord, QStringLiteral("Z")).toDouble();
return ret;
}
static NeighbourRoom parseNeighbourRoom(const QDomElement &domNeighbour)
{
NeighbourRoom ret;
ret.setId(getTagText(domNeighbour, QStringLiteral("RoomId")).toInt());
ret.setTransitionFactor(getTagText(domNeighbour, QStringLiteral("TransitionFactor")).toDouble());
DEBUG_LOG(logger()) << " NeighbourRoom id=" << ret.id() << ", transitionFactor=" << ret.transitionFactor();
return ret;
}
static ExclusionZone parseExclusionZone(const QDomElement &domeExclusionZone)
{
ExclusionZone ret;
QVector<LtsUtils::QPoint3D> poly;
ret.setProtectiveFactor(getTagText(domeExclusionZone, QStringLiteral("ExclusionZoneProtectiveFactor")).toInt());
DEBUG_LOG(logger()) << " ExclusionZone protectiveFactor= " << ret.protectiveFactor();
QDomElement domExclusionZoneElement = domeExclusionZone.firstChildElement(QStringLiteral("ExclusionZoneElement"));
while (!domExclusionZoneElement.isNull())
{
poly.clear();
QDomElement domPolygonPoint = domExclusionZoneElement.firstChildElement(QStringLiteral("PolygonPoint"));
while (!domPolygonPoint.isNull())
{
poly += getCoord3D(domPolygonPoint);
domPolygonPoint = domPolygonPoint.nextSiblingElement(domPolygonPoint.tagName());
}
ret.elements() += poly;
domExclusionZoneElement = domExclusionZoneElement.nextSiblingElement(domExclusionZoneElement.tagName());
}
return ret;
}
static OuterWall parseOuterWall(const QDomElement &domOuterWall)
{
OuterWall ret;
QVector<LtsUtils::QPoint3D> poly;
ret.setProtectiveFactor(getTagText(domOuterWall, QStringLiteral("OuterWallProtectiveFactor")).toInt());
DEBUG_LOG(logger()) << " OuterWall protectiveFactor=" << ret.protectiveFactor();
{
DEBUG_LOG(logger()) << " OuterWallAreaElements:";
QDomElement domPolygonPoints = domOuterWall.firstChildElement(QStringLiteral("OuterWallAreaElement"));
while (!domPolygonPoints.isNull())
{
poly.clear();
QDomElement domPolygonPoint = domPolygonPoints.firstChildElement(QStringLiteral("PolygonPoint"));
while (!domPolygonPoint.isNull())
{
poly += getCoord3D(domPolygonPoint);
domPolygonPoint = domPolygonPoint.nextSiblingElement(domPolygonPoint.tagName());
}
ret.elements() += poly;
domPolygonPoints = domPolygonPoints.nextSiblingElement(domPolygonPoints.tagName());
}
}
{
QDomElement domExclusionZones = domOuterWall.firstChildElement(QStringLiteral("ExclusionZones"));
QDomElement domExclusionZone = domExclusionZones.firstChildElement(QStringLiteral("ExclusionZone"));
DEBUG_LOG(logger()) << " ExclusionZones:";
while (!domExclusionZone.isNull())
{
ret.exclusionZones() += parseExclusionZone(domExclusionZone);
domExclusionZone = domExclusionZone.nextSiblingElement(domExclusionZone.tagName());
}
}
return ret;
}
static Room parseRoom(const QDomElement &domRoom)
{
Room ret;
ret.setId(getTagText(domRoom, QStringLiteral("RoomId")).toInt());
DEBUG_LOG(logger()) << "Parsing Room id=" << ret.id();
{
QDomElement domNeighbours = domRoom.firstChildElement(QStringLiteral("NeighborRooms"));
QDomElement domNeighbour = domNeighbours.firstChildElement(QStringLiteral("NeighborRoom"));
while (!domNeighbour.isNull())
{
const NeighbourRoom n = parseNeighbourRoom(domNeighbour);
auto itNeighbourRoom = ret.neighbours().find(n.id());
if (itNeighbourRoom.value().id() == n.id())
{
WARNING_LOG(logger()) << "Room with id " << n.id()
<< " listed twice neighbour of room " << ret.id();
}
ret.neighbours().insert(n.id(), n);
domNeighbour = domNeighbour.nextSiblingElement(domNeighbour.tagName());
}
}
{
QDomElement domOuterWalls = domRoom.firstChildElement(QStringLiteral("RoomOuterWalls"));
QDomElement domOuterWall = domOuterWalls.firstChildElement(QStringLiteral("OuterWall"));
while (!domOuterWall.isNull())
{
const OuterWall w = parseOuterWall(domOuterWall);
ret.outerWalls() += w;
domOuterWall = domOuterWall.nextSiblingElement(domOuterWall.tagName());
}
}
return ret;
}
bool readBuilding(const QDomElement &domRoot, Building &cfg)
{
if (domRoot.isNull())
return false;
cfg.rooms().clear();
try
{
cfg.setName(getTagText(domRoot, QStringLiteral("BuildingName")));
cfg.setModelId(getTagText(domRoot, QStringLiteral("ModelId")).toInt());
cfg.setBuildingProtectionLevel(getTagText(domRoot, QStringLiteral("BuildingProtectionLevel")).toDouble());
cfg.setExclusionZoneProtectionLevel(getTagText(domRoot, QStringLiteral("ExclusionZoneProtectionLevel")).toInt());
cfg.setOuterWallProtectionLevel(getTagText(domRoot, QStringLiteral("OuterWallProtectionLevel")).toInt());
DEBUG_LOG(logger()) << "**********************";
DEBUG_LOG(logger()) << "*** BUILDING: ***";
DEBUG_LOG(logger()) << "**********************";
DEBUG_LOG(logger()) << "readBuilding name=" << cfg.name();
DEBUG_LOG(logger()) << "readBuilding modelId=" << cfg.modelId();
DEBUG_LOG(logger()) << "readBuilding buildingProtectionLevel=" << cfg.buildingProtectionLevel();
DEBUG_LOG(logger()) << "readBuilding exclusionZoneProtectionLevel=" << cfg.exclusionZoneProtectionLevel();
DEBUG_LOG(logger()) << "readBuilding outerWallProtectionLevel=" << cfg.outerWallProtectionLevel();
QDomElement domRooms = domRoot.firstChildElement(QStringLiteral("Rooms"));
QDomElement domRoom = domRooms.firstChildElement(QStringLiteral("Room"));
while (!domRoom.isNull())
{
try
{
const Room r = parseRoom(domRoom);
cfg.rooms().insert(r.id(), r);
}
catch (const XmlReaderException &ex)
{
QString errorString = QLatin1String("Error reading room config: ") + QLatin1String(ex.what());
ERROR_LOG(logger()) << errorString;
return false;
}
domRoom = domRoom.nextSiblingElement(domRoom.tagName());
}
}
catch (const XmlReaderException &ex)
{
QString errorString = QLatin1String("Error reading BSMConfiguration: ") + QLatin1String(ex.what());
ERROR_LOG(logger()) << errorString;
return false;
}
QMap<int, Room> rooms = cfg.rooms();
QMap<int, Room>::iterator room = rooms.begin();
while (room != rooms.end())
{
auto itNeighbourRoom = room.value().neighbours().find(room.value().id());
if (room.value().id() == itNeighbourRoom.value().id())
{
WARNING_LOG(logger()) << "Room with id " << itNeighbourRoom.value().id()
<< " was defined as neighbour of itself!";
}
QMap<int, NeighbourRoom> &neighbours = room.value().neighbours();
QMap<int, NeighbourRoom>::iterator neighbour = neighbours.begin();
while (neighbour != neighbours.end())
{
auto itRoom = rooms.find(neighbour.value().id());
if (neighbour.value().id() != itRoom.value().id())
{
WARNING_LOG(logger()) << "Could not find room with id " << neighbour.value().id()
<< " which was defined as neighbour of room " << room.value().id();
}
++neighbour;
}
++room;
}
return true;
}
bool readBuilding(const QString &fn, Building &cfg)
{
const QDomElement domRoot = readFile(fn, QStringLiteral("BuildingVulnerability"));
return readBuilding(domRoot, cfg);
}
bool readBuilding(const QByteArray &data, Building &cfg)
{
QDomDocument doc;
QString errorMsg;
int errorLine;
int errorColumn;
if (!doc.setContent(data, &errorMsg, &errorLine, &errorColumn))
{
ERROR_LOG(logger()) << "Line=" << errorLine << ", Column=" << errorColumn << ": " << errorMsg;
return false;
}
const QDomElement domRoot = doc.documentElement();
return readBuilding(domRoot, cfg);
}
bool readBuildingGeometry(const QDomElement &domRoot, BuildingRoomGeometry &bldgGeometry)
{
if (domRoot.isNull())
return false;
const QDomElement &domHdr = domRoot.firstChildElement(QStringLiteral("Header"));
const QDomElement &domGroup = domHdr.firstChildElement(QStringLiteral("Group"));
return bldgGeometry.init(domGroup);
}
bool readBuildingGeometry(const QString &fn, BuildingRoomGeometry &bldgGeometry)
{
const QDomElement domRoot = readFile(fn, QStringLiteral("STREIF"));
return readBuildingGeometry(domRoot, bldgGeometry);
}
}
}
}
@@ -0,0 +1,23 @@
#pragma once
#include "vwm_building.h"
#include "vwm_building_room_geometry.h"
#include "vwm_types.h"
#include <VWM/buildingcontrolvwm_export.h>
#include <QMap>
namespace BuildingControlUnit
{
namespace VWM
{
namespace XmlReader
{
BUILDINGCONTROLVWM_EXPORT bool readCharges(const QString &fn, QMap<int, Charge> &charges);
BUILDINGCONTROLVWM_EXPORT bool readBuilding(const QString &fn, Building &cfg);
BUILDINGCONTROLVWM_EXPORT bool readBuilding(const QByteArray &data, Building &cfg);
BUILDINGCONTROLVWM_EXPORT bool readBuildingGeometry(const QString &fn, BuildingRoomGeometry &bldgGeometry);
}
}
}