Modificado Zindex para soportar los Frame

This commit is contained in:
Miguel 2025-02-13 14:00:47 +01:00
parent 9f41401e40
commit e63577e5c3
33 changed files with 967 additions and 134 deletions

View File

@ -0,0 +1,668 @@
[
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osExtraccionTag, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Ingresos E0.0",
"Extraer": false,
"New_Row": false,
"Id_Search_Templates": "Ingresos Plate Group",
"Tag_extract": "E3.0\n",
"Collumn_name": "IO",
"Collumn_number": 2,
"Copy_Number": 0,
"Show_Debug_Window": false,
"Opacity_oculto": 0.1,
"Id": {
"Value": 1202
},
"Show_On_This_Page": false,
"Left": 2.0471327,
"Top": 8.451157,
"Ancho": 1.3239104,
"Alto": 0.19122289,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_050.png",
"94102.80_SE00_Página_051.png",
"94102.80_SE00_Página_052.png",
"94102.80_SE00_Página_053.png",
"94102.80_SE00_Página_054.png",
"94102.80_SE00_Página_055.png",
"94102.80_SE00_Página_056.png",
"94102.80_SE00_Página_057.png",
"94102.80_SE00_Página_058.png",
"94102.80_SE00_Página_059.png",
"94102.80_SE00_Página_060.png",
"94102.80_SE00_Página_061.png",
"94102.80_SE00_Página_062.png",
"94102.80_SE00_Página_063.png",
"94102.80_SE00_Página_064.png",
"94102.80_SE00_Página_065.png",
"94102.80_SE00_Página_066.png",
"94102.80_SE00_Página_067.png",
"94102.80_SE00_Página_068.png",
"94102.80_SE00_Página_069.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osExtraccionTag, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Ingresos Desc Italiano",
"Extraer": false,
"New_Row": false,
"Id_Search_Templates": "Ingresos Plate Group",
"Tag_extract": "MARCIA ASCIUGATORE\n",
"Collumn_name": "Description Italian",
"Collumn_number": 3,
"Copy_Number": 0,
"Show_Debug_Window": false,
"Opacity_oculto": 0.1,
"Id": {
"Value": 1203
},
"Show_On_This_Page": false,
"Left": 2.0339866,
"Top": 9.252491,
"Ancho": 1.3151709,
"Alto": 0.26124278,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_050.png",
"94102.80_SE00_Página_051.png",
"94102.80_SE00_Página_052.png",
"94102.80_SE00_Página_053.png",
"94102.80_SE00_Página_054.png",
"94102.80_SE00_Página_055.png",
"94102.80_SE00_Página_056.png",
"94102.80_SE00_Página_057.png",
"94102.80_SE00_Página_058.png",
"94102.80_SE00_Página_059.png",
"94102.80_SE00_Página_060.png",
"94102.80_SE00_Página_061.png",
"94102.80_SE00_Página_062.png",
"94102.80_SE00_Página_063.png",
"94102.80_SE00_Página_064.png",
"94102.80_SE00_Página_065.png",
"94102.80_SE00_Página_066.png",
"94102.80_SE00_Página_067.png",
"94102.80_SE00_Página_068.png",
"94102.80_SE00_Página_069.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osExtraccionTag, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Ingresos Desc English",
"Extraer": false,
"New_Row": false,
"Id_Search_Templates": "Ingresos Plate Group",
"Tag_extract": "EMERGENCY PRESSED\nELECTRICAL CABINET\n",
"Collumn_name": "Description English",
"Collumn_number": 4,
"Copy_Number": 0,
"Show_Debug_Window": false,
"Opacity_oculto": 0.1,
"Id": {
"Value": 1204
},
"Show_On_This_Page": false,
"Left": 2.0329113,
"Top": 9.509013,
"Ancho": 1.323141,
"Alto": 0.2408835,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_050.png",
"94102.80_SE00_Página_051.png",
"94102.80_SE00_Página_052.png",
"94102.80_SE00_Página_053.png",
"94102.80_SE00_Página_054.png",
"94102.80_SE00_Página_055.png",
"94102.80_SE00_Página_056.png",
"94102.80_SE00_Página_057.png",
"94102.80_SE00_Página_058.png",
"94102.80_SE00_Página_059.png",
"94102.80_SE00_Página_060.png",
"94102.80_SE00_Página_061.png",
"94102.80_SE00_Página_062.png",
"94102.80_SE00_Página_063.png",
"94102.80_SE00_Página_064.png",
"94102.80_SE00_Página_065.png",
"94102.80_SE00_Página_066.png",
"94102.80_SE00_Página_067.png",
"94102.80_SE00_Página_068.png",
"94102.80_SE00_Página_069.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osExtraccionTag, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Ingresos Card",
"Extraer": false,
"New_Row": false,
"Id_Search_Templates": "Ingresos Plate Group",
"Tag_extract": "A45311\n",
"Collumn_name": "Card",
"Collumn_number": 5,
"Copy_Number": 0,
"Show_Debug_Window": false,
"Opacity_oculto": 0.1,
"Id": {
"Value": 1260
},
"Show_On_This_Page": false,
"Left": 2.2931812,
"Top": 9.125617,
"Ancho": 0.3932013,
"Alto": 0.11076093,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_050.png",
"94102.80_SE00_Página_051.png",
"94102.80_SE00_Página_052.png",
"94102.80_SE00_Página_053.png",
"94102.80_SE00_Página_054.png",
"94102.80_SE00_Página_055.png",
"94102.80_SE00_Página_056.png",
"94102.80_SE00_Página_057.png",
"94102.80_SE00_Página_058.png",
"94102.80_SE00_Página_059.png",
"94102.80_SE00_Página_060.png",
"94102.80_SE00_Página_061.png",
"94102.80_SE00_Página_062.png",
"94102.80_SE00_Página_063.png",
"94102.80_SE00_Página_064.png",
"94102.80_SE00_Página_065.png",
"94102.80_SE00_Página_066.png",
"94102.80_SE00_Página_067.png",
"94102.80_SE00_Página_068.png",
"94102.80_SE00_Página_069.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osExtraccionTag, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Ingresos Pin",
"Extraer": false,
"New_Row": false,
"Id_Search_Templates": "Ingresos Plate Group",
"Tag_extract": "",
"Collumn_name": "Pin",
"Collumn_number": 7,
"Copy_Number": 0,
"Show_Debug_Window": false,
"Opacity_oculto": 0.1,
"Id": {
"Value": 1264
},
"Show_On_This_Page": false,
"Left": 2.6119895,
"Top": 8.204032,
"Ancho": 0.16785541,
"Alto": 0.15966734,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_050.png",
"94102.80_SE00_Página_051.png",
"94102.80_SE00_Página_052.png",
"94102.80_SE00_Página_053.png",
"94102.80_SE00_Página_054.png",
"94102.80_SE00_Página_055.png",
"94102.80_SE00_Página_056.png",
"94102.80_SE00_Página_057.png",
"94102.80_SE00_Página_058.png",
"94102.80_SE00_Página_059.png",
"94102.80_SE00_Página_060.png",
"94102.80_SE00_Página_061.png",
"94102.80_SE00_Página_062.png",
"94102.80_SE00_Página_063.png",
"94102.80_SE00_Página_064.png",
"94102.80_SE00_Página_065.png",
"94102.80_SE00_Página_066.png",
"94102.80_SE00_Página_067.png",
"94102.80_SE00_Página_068.png",
"94102.80_SE00_Página_069.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osBuscarCoincidencias, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Ingresos Plate Group",
"Search_rectangles": [
"200.6319122314453,815.1671752929688,137.59445190429688,161.43350219726562",
"350.22589111328125,815.4871215820312,137.59445190429688,161.43350219726562",
"499.9798583984375,815.4871215820312,137.59445190429688,161.43350219726562",
"649.7338256835938,815.4871215820312,137.59445190429688,161.43350219726562",
"799.6477661132812,815.4871215820312,137.59445190429688,161.43350219726562",
"949.2417602539062,815.4871215820312,137.59445190429688,161.43350219726562",
"1099.15576171875,815.4871215820312,137.59445190429688,161.43350219726562",
"1248.90966796875,815.4871215820312,137.59445190429688,161.43350219726562"
],
"Search_templates": false,
"Export_ocr": false,
"Opacity_oculto": 0.1,
"Show_debug_ocr": false,
"Threshold": 0.6,
"Coincidencias": 8,
"Id": {
"Value": 1201
},
"Show_On_This_Page": false,
"Left": 2.0069747,
"Top": 8.15955,
"Ancho": 1.3769451,
"Alto": 1.6148156,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_050.png",
"94102.80_SE00_Página_051.png",
"94102.80_SE00_Página_052.png",
"94102.80_SE00_Página_053.png",
"94102.80_SE00_Página_054.png",
"94102.80_SE00_Página_055.png",
"94102.80_SE00_Página_056.png",
"94102.80_SE00_Página_057.png",
"94102.80_SE00_Página_058.png",
"94102.80_SE00_Página_059.png",
"94102.80_SE00_Página_060.png",
"94102.80_SE00_Página_061.png",
"94102.80_SE00_Página_062.png",
"94102.80_SE00_Página_063.png",
"94102.80_SE00_Página_064.png",
"94102.80_SE00_Página_065.png",
"94102.80_SE00_Página_066.png",
"94102.80_SE00_Página_067.png",
"94102.80_SE00_Página_068.png",
"94102.80_SE00_Página_069.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osExtraccionTag, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Page",
"Extraer": false,
"New_Row": false,
"Tag_extract": "690\n",
"Collumn_name": "Extraccion Tags",
"Collumn_number": 1,
"Copy_Number": 0,
"Show_Debug_Window": false,
"Opacity_oculto": 0.1,
"Id": {
"Value": 1231
},
"Show_On_This_Page": false,
"Left": 13.666122,
"Top": 10.413534,
"Ancho": 0.81436056,
"Alto": 0.2296054,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_050.png",
"94102.80_SE00_Página_051.png",
"94102.80_SE00_Página_052.png",
"94102.80_SE00_Página_053.png",
"94102.80_SE00_Página_054.png",
"94102.80_SE00_Página_055.png",
"94102.80_SE00_Página_056.png",
"94102.80_SE00_Página_057.png",
"94102.80_SE00_Página_058.png",
"94102.80_SE00_Página_059.png",
"94102.80_SE00_Página_060.png",
"94102.80_SE00_Página_061.png",
"94102.80_SE00_Página_062.png",
"94102.80_SE00_Página_063.png",
"94102.80_SE00_Página_064.png",
"94102.80_SE00_Página_065.png",
"94102.80_SE00_Página_066.png",
"94102.80_SE00_Página_067.png",
"94102.80_SE00_Página_068.png",
"94102.80_SE00_Página_069.png",
"94102.80_SE00_Página_070.png",
"94102.80_SE00_Página_071.png",
"94102.80_SE00_Página_072.png",
"94102.80_SE00_Página_073.png",
"94102.80_SE00_Página_074.png",
"94102.80_SE00_Página_075.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osExtraccionTag, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Salidas A0.0",
"Extraer": false,
"New_Row": false,
"Id_Search_Templates": "Salidas Plate Group",
"Tag_extract": "E3.0\n",
"Collumn_name": "IO",
"Collumn_number": 2,
"Copy_Number": 0,
"Show_Debug_Window": false,
"Opacity_oculto": 0.1,
"Id": {
"Value": 63
},
"Show_On_This_Page": false,
"Left": 2.038601,
"Top": 2.4818933,
"Ancho": 1.3239104,
"Alto": 0.19122289,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_070.png",
"94102.80_SE00_Página_071.png",
"94102.80_SE00_Página_072.png",
"94102.80_SE00_Página_073.png",
"94102.80_SE00_Página_074.png",
"94102.80_SE00_Página_075.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osExtraccionTag, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Salidas Desc Italiano",
"Extraer": false,
"New_Row": false,
"Id_Search_Templates": "Salidas Plate Group",
"Tag_extract": "MARCIA ASCIUGATORE\n",
"Collumn_name": "Description Italian",
"Collumn_number": 3,
"Copy_Number": 0,
"Show_Debug_Window": false,
"Opacity_oculto": 0.1,
"Id": {
"Value": 64
},
"Show_On_This_Page": false,
"Left": 2.0427365,
"Top": 1.3802159,
"Ancho": 1.3151709,
"Alto": 0.26124278,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_070.png",
"94102.80_SE00_Página_071.png",
"94102.80_SE00_Página_072.png",
"94102.80_SE00_Página_073.png",
"94102.80_SE00_Página_074.png",
"94102.80_SE00_Página_075.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osExtraccionTag, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Salidas Desc English",
"Extraer": false,
"New_Row": false,
"Id_Search_Templates": "Salidas Plate Group",
"Tag_extract": "EMERGENCY PRESSED\nELECTRICAL CABINET\n",
"Collumn_name": "Description English",
"Collumn_number": 4,
"Copy_Number": 0,
"Show_Debug_Window": false,
"Opacity_oculto": 0.1,
"Id": {
"Value": 65
},
"Show_On_This_Page": false,
"Left": 2.0372825,
"Top": 1.6332868,
"Ancho": 1.323141,
"Alto": 0.2408835,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_070.png",
"94102.80_SE00_Página_071.png",
"94102.80_SE00_Página_072.png",
"94102.80_SE00_Página_073.png",
"94102.80_SE00_Página_074.png",
"94102.80_SE00_Página_075.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osExtraccionTag, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Salidas Card",
"Extraer": false,
"New_Row": false,
"Id_Search_Templates": "Salidas Plate Group",
"Tag_extract": "A45311\n",
"Collumn_name": "Card",
"Collumn_number": 5,
"Copy_Number": 0,
"Show_Debug_Window": false,
"Opacity_oculto": 0.1,
"Id": {
"Value": 66
},
"Show_On_This_Page": false,
"Left": 2.3019588,
"Top": 1.9661419,
"Ancho": 0.3932013,
"Alto": 0.11076093,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_070.png",
"94102.80_SE00_Página_071.png",
"94102.80_SE00_Página_072.png",
"94102.80_SE00_Página_073.png",
"94102.80_SE00_Página_074.png",
"94102.80_SE00_Página_075.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osExtraccionTag, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Salidas Pin",
"Extraer": false,
"New_Row": false,
"Id_Search_Templates": "Salidas Plate Group",
"Tag_extract": "",
"Collumn_name": "Pin",
"Collumn_number": 7,
"Copy_Number": 0,
"Show_Debug_Window": false,
"Opacity_oculto": 0.1,
"Id": {
"Value": 68
},
"Show_On_This_Page": false,
"Left": 2.613817,
"Top": 2.771892,
"Ancho": 0.16785541,
"Alto": 0.15966734,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_070.png",
"94102.80_SE00_Página_071.png",
"94102.80_SE00_Página_072.png",
"94102.80_SE00_Página_073.png",
"94102.80_SE00_Página_074.png",
"94102.80_SE00_Página_075.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osBuscarCoincidencias, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Salidas Plate Group",
"Search_rectangles": [
"200.471923828125,134.23458862304688,137.59445190429688,161.43350219726562",
"350.22589111328125,134.39459228515625,137.59445190429688,161.43350219726562",
"499.8198547363281,134.55458068847656,137.59445190429688,161.43350219726562",
"649.5738525390625,134.55458068847656,137.59445190429688,161.43350219726562",
"799.3278198242188,134.55458068847656,137.59445190429688,161.43350219726562",
"949.2417602539062,134.55458068847656,137.59445190429688,161.43350219726562",
"1098.9957275390625,134.55458068847656,137.59445190429688,161.43350219726562",
"1248.749755859375,134.55458068847656,137.59445190429688,161.43350219726562",
"1398.503662109375,134.87457275390625,137.59445190429688,161.43350219726562"
],
"Search_templates": false,
"Export_ocr": false,
"Opacity_oculto": 0.1,
"Show_debug_ocr": false,
"Threshold": 0.6,
"Coincidencias": 9,
"Id": {
"Value": 69
},
"Show_On_This_Page": false,
"Left": 2.0056293,
"Top": 1.3495445,
"Ancho": 1.3769451,
"Alto": 1.6148156,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_070.png",
"94102.80_SE00_Página_071.png",
"94102.80_SE00_Página_072.png",
"94102.80_SE00_Página_073.png",
"94102.80_SE00_Página_074.png",
"94102.80_SE00_Página_075.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osExtraccionTag, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Descrip Pagina",
"Extraer": false,
"New_Row": false,
"Tag_extract": "690\n",
"Collumn_name": "Descrip Pagina",
"Collumn_number": 1,
"Copy_Number": 0,
"Show_Debug_Window": false,
"Opacity_oculto": 0.1,
"Id": {
"Value": 70
},
"Show_On_This_Page": false,
"Left": 7.490359,
"Top": 10.734316,
"Ancho": 1.8668232,
"Alto": 0.17921503,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_050.png",
"94102.80_SE00_Página_051.png",
"94102.80_SE00_Página_052.png",
"94102.80_SE00_Página_053.png",
"94102.80_SE00_Página_054.png",
"94102.80_SE00_Página_055.png",
"94102.80_SE00_Página_056.png",
"94102.80_SE00_Página_057.png",
"94102.80_SE00_Página_058.png",
"94102.80_SE00_Página_059.png",
"94102.80_SE00_Página_060.png",
"94102.80_SE00_Página_061.png",
"94102.80_SE00_Página_062.png",
"94102.80_SE00_Página_063.png",
"94102.80_SE00_Página_064.png",
"94102.80_SE00_Página_065.png",
"94102.80_SE00_Página_066.png",
"94102.80_SE00_Página_067.png",
"94102.80_SE00_Página_068.png",
"94102.80_SE00_Página_069.png",
"94102.80_SE00_Página_070.png",
"94102.80_SE00_Página_071.png",
"94102.80_SE00_Página_072.png",
"94102.80_SE00_Página_073.png",
"94102.80_SE00_Página_074.png",
"94102.80_SE00_Página_075.png"
],
"Cloned": false
},
{
"$type": "CtrEditor.ObjetosSim.Extraccion_Datos.osExtraccionTag, CtrEditor",
"AutoCreated": false,
"RemoverDesdeSimulacion": false,
"Nombre": "Comessa",
"Extraer": false,
"New_Row": false,
"Tag_extract": "690\n",
"Collumn_name": "Comessa",
"Collumn_number": 1,
"Copy_Number": 0,
"Show_Debug_Window": false,
"Opacity_oculto": 0.1,
"Id": {
"Value": 71
},
"Show_On_This_Page": false,
"Left": 11.119476,
"Top": 10.6297865,
"Ancho": 0.5749816,
"Alto": 0.14187858,
"Angulo": 0.0,
"Enable_On_All_Pages": true,
"ShowOnThisPagesList": [
"94102.80_SE00_Página_050.png",
"94102.80_SE00_Página_051.png",
"94102.80_SE00_Página_052.png",
"94102.80_SE00_Página_053.png",
"94102.80_SE00_Página_054.png",
"94102.80_SE00_Página_055.png",
"94102.80_SE00_Página_056.png",
"94102.80_SE00_Página_057.png",
"94102.80_SE00_Página_058.png",
"94102.80_SE00_Página_059.png",
"94102.80_SE00_Página_060.png",
"94102.80_SE00_Página_061.png",
"94102.80_SE00_Página_062.png",
"94102.80_SE00_Página_063.png",
"94102.80_SE00_Página_064.png",
"94102.80_SE00_Página_065.png",
"94102.80_SE00_Página_066.png",
"94102.80_SE00_Página_067.png",
"94102.80_SE00_Página_068.png",
"94102.80_SE00_Página_069.png",
"94102.80_SE00_Página_070.png",
"94102.80_SE00_Página_071.png",
"94102.80_SE00_Página_072.png",
"94102.80_SE00_Página_073.png",
"94102.80_SE00_Página_074.png",
"94102.80_SE00_Página_075.png"
],
"Cloned": false
}
]

View File

@ -19,6 +19,7 @@ using ClosedXML.Excel;
using CtrEditor.PopUps; using CtrEditor.PopUps;
using System.Windows.Data; using System.Windows.Data;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using System.Text.RegularExpressions;
namespace CtrEditor namespace CtrEditor
@ -246,7 +247,7 @@ namespace CtrEditor
PLCViewModel = new PLCViewModel(); PLCViewModel = new PLCViewModel();
_timerPLCUpdate = new DispatcherTimer(); _timerPLCUpdate = new DispatcherTimer();
_timerPLCUpdate.Interval = TimeSpan.FromMilliseconds(2); // ajusta el intervalo según sea necesario _timerPLCUpdate.Interval = TimeSpan.FromMilliseconds(50); // ajusta el intervalo según sea necesario
_timerPLCUpdate.Tick += OnRefreshEvent; _timerPLCUpdate.Tick += OnRefreshEvent;
InitializeTipoSimulableList(); InitializeTipoSimulableList();
@ -254,7 +255,7 @@ namespace CtrEditor
ItemDoubleClickCommand = new ParameterizedRelayCommand(ExecuteDoubleClick); ItemDoubleClickCommand = new ParameterizedRelayCommand(ExecuteDoubleClick);
_timerSimulacion = new DispatcherTimer(); _timerSimulacion = new DispatcherTimer();
_timerSimulacion.Interval = TimeSpan.FromMilliseconds(1); // ajusta el intervalo según sea necesario _timerSimulacion.Interval = TimeSpan.FromMilliseconds(10); // ajusta el intervalo según sea necesario
_timerSimulacion.Tick += OnTickSimulacion; _timerSimulacion.Tick += OnTickSimulacion;
StartSimulationCommand = new RelayCommand(StartSimulation); StartSimulationCommand = new RelayCommand(StartSimulation);
@ -398,7 +399,9 @@ namespace CtrEditor
if (NuevoObjetoDuplicado != null) if (NuevoObjetoDuplicado != null)
{ {
NuevoObjetoDuplicado.Id.ObtenerNuevaID(); NuevoObjetoDuplicado.Id.ObtenerNuevaID();
string nombre = NuevoObjetoDuplicado.Nombre + "_" + NuevoObjetoDuplicado.Id.Value; string nombre = Regex.IsMatch(NuevoObjetoDuplicado.Nombre, @"_\d+$")
? Regex.Replace(NuevoObjetoDuplicado.Nombre, @"_\d+$", $"_{NuevoObjetoDuplicado.Id.Value}")
: NuevoObjetoDuplicado.Nombre + "_" + NuevoObjetoDuplicado.Id.Value;
NuevoObjetoDuplicado.Nombre = nombre; NuevoObjetoDuplicado.Nombre = nombre;
NuevoObjetoDuplicado.Left += OffsetX; NuevoObjetoDuplicado.Left += OffsetX;
@ -724,6 +727,8 @@ namespace CtrEditor
private void OnTickSimulacion(object sender, EventArgs e) private void OnTickSimulacion(object sender, EventArgs e)
{ {
var stopwatch = Stopwatch.StartNew(); // Start measuring time
// Detener el cronómetro y obtener el tiempo transcurrido en milisegundos // Detener el cronómetro y obtener el tiempo transcurrido en milisegundos
var elapsedMilliseconds = stopwatch_Sim.Elapsed.TotalMilliseconds - stopwatch_SimModel_last; var elapsedMilliseconds = stopwatch_Sim.Elapsed.TotalMilliseconds - stopwatch_SimModel_last;
stopwatch_SimModel_last = stopwatch_Sim.Elapsed.TotalMilliseconds; stopwatch_SimModel_last = stopwatch_Sim.Elapsed.TotalMilliseconds;
@ -749,6 +754,8 @@ namespace CtrEditor
RemoverObjetoSimulable(objetoSimulable); RemoverObjetoSimulable(objetoSimulable);
} }
stopwatch.Stop(); // Stop measuring time
//Debug.WriteLine($"OnTickSimulacion execution time: {stopwatch.TotalMilliseconds} ms");
} }
private void ConnectPLC() private void ConnectPLC()
@ -768,19 +775,41 @@ namespace CtrEditor
} }
private List<osBase> objetosSimulablesLlamados = new List<osBase>();
private void OnRefreshEvent(object sender, EventArgs e) private void OnRefreshEvent(object sender, EventArgs e)
{ {
var stopwatch = Stopwatch.StartNew(); // Start measuring time
if (PLCViewModel.IsConnected) if (PLCViewModel.IsConnected)
{ {
// Detener el cronómetro y obtener el tiempo transcurrido en milisegundos // Detener el cronómetro y obtener el tiempo transcurrido en milisegundos
var elapsedMilliseconds = stopwatch_Sim.Elapsed.TotalMilliseconds - stopwatch_SimPLC_last; var elapsedMilliseconds = stopwatch_Sim.Elapsed.TotalMilliseconds - stopwatch_SimPLC_last;
stopwatch_SimPLC_last = stopwatch_Sim.Elapsed.TotalMilliseconds; stopwatch_SimPLC_last = stopwatch_Sim.Elapsed.TotalMilliseconds;
// Reiniciar el cronómetro para la próxima medición // Reiniciar el cronómetro para la próxima medición
foreach (var objetoSimulable in ObjetosSimulables) var remainingObjetosSimulables = ObjetosSimulables.Except(objetosSimulablesLlamados).ToList();
foreach (var objetoSimulable in remainingObjetosSimulables)
{
var objStopwatch = Stopwatch.StartNew();
objetoSimulable.UpdatePLC(PLCViewModel, (int)elapsedMilliseconds); objetoSimulable.UpdatePLC(PLCViewModel, (int)elapsedMilliseconds);
objStopwatch.Stop();
objetosSimulablesLlamados.Add(objetoSimulable);
if (stopwatch.Elapsed.TotalMilliseconds >= 10)
break;
}
if (remainingObjetosSimulables.Count == 0)
{
objetosSimulablesLlamados.Clear();
}
} }
stopwatch.Stop(); // Stop measuring time
Debug.WriteLine($"OnRefreshEvent: {stopwatch.Elapsed.TotalMilliseconds} ms");
} }
private void OpenWorkDirectory() private void OpenWorkDirectory()

View File

@ -103,7 +103,7 @@ namespace CtrEditor
SuscribirEventos(userControl); SuscribirEventos(userControl);
// Añade el UserControl al Canvas // Añade el UserControl al Canvas
Canvas.SetZIndex(userControl, ((int)dataContainer.ZIndex())); Canvas.SetZIndex(userControl, ((int)dataContainer.ZIndex_Base() + dataContainer.zIndex_fromFrames));
ImagenEnTrabajoCanvas.Children.Add(userControl); ImagenEnTrabajoCanvas.Children.Add(userControl);
} }
} }
@ -227,11 +227,14 @@ namespace CtrEditor
private async void TimerCallbackRemoveResizeRectangles(object state) private async void TimerCallbackRemoveResizeRectangles(object state)
{ {
Application.Current.Dispatcher.Invoke(() => if (Application.Current != null)
{ {
// Realiza tus cambios en la interfaz de usuario aquí Application.Current.Dispatcher.Invoke(() =>
MakeResizeRectanglesTransparent(); {
}); // Realiza tus cambios en la interfaz de usuario aquí
MakeResizeRectanglesTransparent();
});
}
} }
public void PauseTimerRemoveResizeRectangles() public void PauseTimerRemoveResizeRectangles()
@ -711,7 +714,7 @@ namespace CtrEditor
private void ZoomTimer_Tick(object sender, EventArgs e) private void ZoomTimer_Tick(object sender, EventArgs e)
{ {
double elapsedMilliseconds = _stopwatch.ElapsedMilliseconds; double elapsedMilliseconds = _stopwatch.Elapsed.TotalMilliseconds;
if (elapsedMilliseconds >= _ZoomDuration) if (elapsedMilliseconds >= _ZoomDuration)
{ {

View File

@ -36,6 +36,16 @@ namespace CtrEditor.ObjetosSim
set => SetProperty(ref nombre, value); set => SetProperty(ref nombre, value);
} }
[ObservableProperty]
[property: Description("Layer index to add to Objects on the Frame")]
[property: Category("Layer:")]
int zindex_FramePlate;
partial void OnZindex_FramePlateChanged(int value)
{
UpdateZIndex(value);
}
[ObservableProperty] [ObservableProperty]
Color color; Color color;
[ObservableProperty] [ObservableProperty]
@ -63,29 +73,59 @@ namespace CtrEditor.ObjetosSim
[property: Category("Encoders:")] [property: Category("Encoders:")]
public float offset_encoder_X; public float offset_encoder_X;
partial void OnK_encoder_XChanged(float value)
{
UpdatePosition();
}
partial void OnOffset_encoder_XChanged(float value)
{
UpdatePosition();
}
[JsonIgnore] [JsonIgnore]
private osEncoderMotorLineal EncoderX; private osEncoderMotorLineal EncoderX;
[JsonIgnore] [JsonIgnore]
private float EncoderXValue; private bool isUpdatingFromEncoderX = false;
partial void OnEncoder_XChanged(string value) partial void OnEncoder_XChanged(string value)
{ {
if (EncoderX != null)
EncoderX.PropertyChanged -= OnEncoderXPropertyChanged;
if (_mainViewModel != null && value != null && value.Length > 0) if (_mainViewModel != null && value != null && value.Length > 0)
{ {
EncoderX = (osEncoderMotorLineal)_mainViewModel.ObjetosSimulables.FirstOrDefault(s => (s is osEncoderMotorLineal && s.Nombre == value), null); EncoderX = (osEncoderMotorLineal)_mainViewModel.ObjetosSimulables.FirstOrDefault(s => (s is osEncoderMotorLineal && s.Nombre == value), null);
if (EncoderX != null)
EncoderX.PropertyChanged += OnEncoderXPropertyChanged;
} }
} }
public override void UpdateControl(int elapsedMilliseconds) private void OnEncoderXPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (!isUpdatingFromEncoderX)
{
isUpdatingFromEncoderX = true;
// Actualizamos el nombre si este fue modificado
if (e.PropertyName == nameof(osEncoderMotorLineal.Nombre))
Group_Panel = ((osEncoderMotorLineal)sender).Nombre;
if (e.PropertyName == nameof(osEncoderMotorLineal.Valor_Actual))
{
UpdatePosition();
}
isUpdatingFromEncoderX = false;
}
}
public void UpdatePosition()
{ {
if (EncoderX == null) if (EncoderX == null)
return; return;
if (K_encoder_X == 0) if (K_encoder_X == 0)
return; return;
if (EncoderXValue != EncoderX.Valor_Actual) Left = (EncoderX.Valor_Actual / k_encoder_X) + offset_encoder_X;
Left = (EncoderX.Valor_Actual / k_encoder_X) + offset_encoder_X;
EncoderXValue = EncoderX.Valor_Actual;
} }
public override void TopChanging(float oldValue, float newValue) public override void TopChanging(float oldValue, float newValue)
@ -104,6 +144,7 @@ namespace CtrEditor.ObjetosSim
Alto_Titulo = 0.2f; Alto_Titulo = 0.2f;
Color = Colors.WhiteSmoke; Color = Colors.WhiteSmoke;
Titulo = "Frame"; Titulo = "Frame";
Zindex_FramePlate = 0;
} }
public override void ucLoaded() public override void ucLoaded()
@ -111,6 +152,7 @@ namespace CtrEditor.ObjetosSim
base.ucLoaded(); base.ucLoaded();
// El UserControl se ha cargado // El UserControl se ha cargado
OnEncoder_XChanged(Encoder_X); OnEncoder_XChanged(Encoder_X);
UpdateZIndex(Zindex_FramePlate);
} }
public override void ucUnLoaded() public override void ucUnLoaded()
@ -125,6 +167,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucFramePlate : UserControl, IDataContainer public partial class ucFramePlate : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucFramePlate() public ucFramePlate()
{ {
@ -141,7 +184,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Decorativos; return ZIndexEnum.Decorativos;
} }

View File

@ -70,6 +70,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucTextPlate : UserControl, IDataContainer public partial class ucTextPlate : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucTextPlate() public ucTextPlate()
{ {
@ -86,7 +87,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Decorativos; return ZIndexEnum.Decorativos;
} }

View File

@ -168,6 +168,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucBotella : UserControl, IDataContainer public partial class ucBotella : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucBotella() public ucBotella()
{ {
@ -185,7 +186,7 @@ namespace CtrEditor.ObjetosSim
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Dinamicos; return ZIndexEnum.Dinamicos;
} }

View File

@ -154,6 +154,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucBotellaCuello : UserControl, IDataContainer public partial class ucBotellaCuello : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucBotellaCuello() public ucBotellaCuello()
{ {
@ -171,7 +172,7 @@ namespace CtrEditor.ObjetosSim
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Dinamicos; return ZIndexEnum.Dinamicos;
} }

View File

@ -194,6 +194,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucBottGenerator : UserControl, IDataContainer public partial class ucBottGenerator : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucBottGenerator() public ucBottGenerator()
{ {
@ -210,7 +211,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Generadores; return ZIndexEnum.Generadores;
} }

View File

@ -157,6 +157,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucFiller : UserControl, IDataContainer public partial class ucFiller : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucFiller() public ucFiller()
{ {
@ -181,7 +182,7 @@ namespace CtrEditor.ObjetosSim
} }
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Generadores; return ZIndexEnum.Generadores;
} }

View File

@ -89,6 +89,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucTanque : UserControl, IDataContainer public partial class ucTanque : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucTanque() public ucTanque()
{ {
@ -105,7 +106,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Generadores; return ZIndexEnum.Generadores;
} }

View File

@ -110,6 +110,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucDescarte : UserControl, IDataContainer public partial class ucDescarte : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucDescarte() public ucDescarte()
{ {
@ -131,7 +132,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Descarte; return ZIndexEnum.Descarte;
} }

View File

@ -80,6 +80,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucGuia : UserControl, IDataContainer public partial class ucGuia : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucGuia() public ucGuia()
{ {
@ -96,7 +97,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Guias; return ZIndexEnum.Guias;
} }

View File

@ -6,6 +6,7 @@ using LibS7Adv;
using CtrEditor.Simulacion; using CtrEditor.Simulacion;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
using CtrEditor.FuncionesBase; using CtrEditor.FuncionesBase;
using System.Text.Json.Serialization;
namespace CtrEditor.ObjetosSim namespace CtrEditor.ObjetosSim
{ {
@ -66,23 +67,28 @@ namespace CtrEditor.ObjetosSim
[property: ItemsSource(typeof(osBaseItemsSource<osVMmotorSim>))] [property: ItemsSource(typeof(osBaseItemsSource<osVMmotorSim>))]
string id_Motor; string id_Motor;
[JsonIgnore]
private PropertyChangedEventHandler motorPropertyChangedHandler;
partial void OnId_MotorChanged(string value) partial void OnId_MotorChanged(string value)
{ {
if (Motor != null) if (Motor != null && motorPropertyChangedHandler != null)
Motor.PropertyChanged -= OnMotorPropertyChanged; Motor.PropertyChanged -= motorPropertyChangedHandler;
if (_mainViewModel != null && value != null && value.Length > 0)
{
Motor = (osVMmotorSim)_mainViewModel.ObjetosSimulables.FirstOrDefault(s => (s is osVMmotorSim && s.Nombre == value), null);
if (Motor != null)
Motor.PropertyChanged += OnMotorPropertyChanged;
}
}
private void OnMotorPropertyChanged(object sender, PropertyChangedEventArgs e) if (_mainViewModel != null && !string.IsNullOrEmpty(value))
{
if (e.PropertyName == nameof(osVMmotorSim.Nombre))
{ {
Id_Motor = ((osVMmotorSim)sender).Nombre; Motor = (osVMmotorSim)_mainViewModel.ObjetosSimulables.FirstOrDefault(s => s is osVMmotorSim motor && motor.Nombre == value);
if (Motor != null)
{
motorPropertyChangedHandler = (sender, e) =>
{
if (e.PropertyName == nameof(osVMmotorSim.Nombre))
{
Id_Motor = ((osVMmotorSim)sender).Nombre;
}
};
Motor.PropertyChanged += motorPropertyChangedHandler;
}
} }
} }
@ -172,6 +178,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucTransporteCurva : UserControl, IDataContainer public partial class ucTransporteCurva : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucTransporteCurva() public ucTransporteCurva()
{ {
@ -188,7 +195,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }

View File

@ -7,6 +7,7 @@ using LibS7Adv;
using CtrEditor.Simulacion; using CtrEditor.Simulacion;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
using CtrEditor.FuncionesBase; using CtrEditor.FuncionesBase;
using System.Text.Json.Serialization;
namespace CtrEditor.ObjetosSim namespace CtrEditor.ObjetosSim
{ {
@ -74,23 +75,28 @@ namespace CtrEditor.ObjetosSim
[property: ItemsSource(typeof(osBaseItemsSource<osVMmotorSim>))] [property: ItemsSource(typeof(osBaseItemsSource<osVMmotorSim>))]
string id_Motor; string id_Motor;
[JsonIgnore]
private PropertyChangedEventHandler motorPropertyChangedHandler;
partial void OnId_MotorChanged(string value) partial void OnId_MotorChanged(string value)
{ {
if (Motor != null) if (Motor != null && motorPropertyChangedHandler != null)
Motor.PropertyChanged -= OnMotorPropertyChanged; Motor.PropertyChanged -= motorPropertyChangedHandler;
if (_mainViewModel != null && value != null && value.Length > 0)
{
Motor = (osVMmotorSim)_mainViewModel.ObjetosSimulables.FirstOrDefault(s => (s is osVMmotorSim && s.Nombre == value), null);
if (Motor != null)
Motor.PropertyChanged += OnMotorPropertyChanged;
}
}
private void OnMotorPropertyChanged(object sender, PropertyChangedEventArgs e) if (_mainViewModel != null && !string.IsNullOrEmpty(value))
{
if (e.PropertyName == nameof(osVMmotorSim.Nombre))
{ {
Id_Motor = ((osVMmotorSim)sender).Nombre; Motor = (osVMmotorSim)_mainViewModel.ObjetosSimulables.FirstOrDefault(s => s is osVMmotorSim motor && motor.Nombre == value);
if (Motor != null)
{
motorPropertyChangedHandler = (sender, e) =>
{
if (e.PropertyName == nameof(osVMmotorSim.Nombre))
{
Id_Motor = ((osVMmotorSim)sender).Nombre;
}
};
Motor.PropertyChanged += motorPropertyChangedHandler;
}
} }
} }
@ -200,6 +206,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucTransporteGuias : UserControl, IDataContainer public partial class ucTransporteGuias : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucTransporteGuias() public ucTransporteGuias()
{ {
@ -216,7 +223,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }

View File

@ -369,6 +369,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucTransporteGuiasUnion : UserControl, IDataContainer public partial class ucTransporteGuiasUnion : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucTransporteGuiasUnion() public ucTransporteGuiasUnion()
{ {
@ -385,7 +386,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }

View File

@ -42,7 +42,7 @@
Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}" Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}"
Fill="{StaticResource BeltBrush}"> Fill="{StaticResource BeltBrush}">
</Rectangle> </Rectangle>
<Viewbox Canvas.Top="{Binding AltoGuia, Converter={StaticResource MeterToPixelConverter}}" <Viewbox
Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}" Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}"
Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}" Stretch="Uniform"> Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}" Stretch="Uniform">
<Label Content="{Binding Nombre}" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" <Label Content="{Binding Nombre}" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold"

View File

@ -6,6 +6,7 @@ using CtrEditor.Simulacion;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
using System.ComponentModel; using System.ComponentModel;
using CtrEditor.FuncionesBase; using CtrEditor.FuncionesBase;
using System.Text.Json.Serialization;
namespace CtrEditor.ObjetosSim namespace CtrEditor.ObjetosSim
{ {
@ -71,23 +72,28 @@ namespace CtrEditor.ObjetosSim
[property: ItemsSource(typeof(osBaseItemsSource<osVMmotorSim>))] [property: ItemsSource(typeof(osBaseItemsSource<osVMmotorSim>))]
string id_Motor; string id_Motor;
[JsonIgnore]
private PropertyChangedEventHandler motorPropertyChangedHandler;
partial void OnId_MotorChanged(string value) partial void OnId_MotorChanged(string value)
{ {
if (Motor != null) if (Motor != null && motorPropertyChangedHandler != null)
Motor.PropertyChanged -= OnMotorPropertyChanged; Motor.PropertyChanged -= motorPropertyChangedHandler;
if (_mainViewModel != null && value != null && value.Length > 0)
{
Motor = (osVMmotorSim)_mainViewModel.ObjetosSimulables.FirstOrDefault(s => (s is osVMmotorSim && s.Nombre == value), null);
if (Motor != null)
Motor.PropertyChanged += OnMotorPropertyChanged;
}
}
private void OnMotorPropertyChanged(object sender, PropertyChangedEventArgs e) if (_mainViewModel != null && !string.IsNullOrEmpty(value))
{
if (e.PropertyName == nameof(osVMmotorSim.Nombre))
{ {
Id_Motor = ((osVMmotorSim)sender).Nombre; Motor = (osVMmotorSim)_mainViewModel.ObjetosSimulables.FirstOrDefault(s => s is osVMmotorSim motor && motor.Nombre == value);
if (Motor != null)
{
motorPropertyChangedHandler = (sender, e) =>
{
if (e.PropertyName == nameof(osVMmotorSim.Nombre))
{
Id_Motor = ((osVMmotorSim)sender).Nombre;
}
};
Motor.PropertyChanged += motorPropertyChangedHandler;
}
} }
} }
@ -170,6 +176,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucTransporteTTop : UserControl, IDataContainer public partial class ucTransporteTTop : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucTransporteTTop() public ucTransporteTTop()
{ {
@ -186,7 +193,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }

View File

@ -3,6 +3,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CtrEditor.FuncionesBase; using CtrEditor.FuncionesBase;
using LibS7Adv; using LibS7Adv;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Diagnostics;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Media; using System.Windows.Media;
@ -44,6 +45,9 @@ namespace CtrEditor.ObjetosSim
Tamano += Delta_Width + Delta_Height; Tamano += Delta_Width + Delta_Height;
} }
[ObservableProperty]
public float refresh_Time_ms;
[ObservableProperty] [ObservableProperty]
public float proporcional_Speed; public float proporcional_Speed;
@ -106,6 +110,7 @@ namespace CtrEditor.ObjetosSim
Max_Speed_for_Ramp = 100; Max_Speed_for_Ramp = 100;
TiempoRampa = 3; TiempoRampa = 3;
ImageSource_oculta = ImageFromPath("/imagenes/motor2.png"); ImageSource_oculta = ImageFromPath("/imagenes/motor2.png");
Refresh_Time_ms = 500;
} }
public override void UpdateGeometryStart() public override void UpdateGeometryStart()
@ -113,17 +118,36 @@ namespace CtrEditor.ObjetosSim
// Se llama antes de la simulacion // Se llama antes de la simulacion
} }
public override void UpdatePLC(PLCViewModel plc, int elapsedMilliseconds)
[JsonIgnore]
private float elapsedTimeAccumulator = 0;
public override void UpdatePLC(PLCViewModel plc, int TotalMilliseconds)
{ {
motState.UpdatePLC(plc, this, elapsedMilliseconds); Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
elapsedTimeAccumulator += TotalMilliseconds;
float randomFactor = (float)(new Random().NextDouble() * 0.1); // 10% random factor
float adjustedRefreshTime = Refresh_Time_ms * (1 + randomFactor);
if (elapsedTimeAccumulator >= adjustedRefreshTime)
{
motState.UpdatePLC(plc, this, TotalMilliseconds);
elapsedTimeAccumulator = 0;
}
Velocidad = (Proporcional_Speed / 100) * (motState.STATUS_VFD_ACT_Speed_Hz / 10); Velocidad = (Proporcional_Speed / 100) * (motState.STATUS_VFD_ACT_Speed_Hz / 10);
Sentido_contrario = motState.OUT_Reversal; Sentido_contrario = motState.OUT_Reversal;
stopwatch.Stop();
Debug.WriteLine($" osVMmotorSim : {Nombre} : {stopwatch.Elapsed.TotalMilliseconds} ms");
} }
public override void UpdateControl(int elapsedMilliseconds) public override void UpdateControl(int TotalMilliseconds)
{ {
// Calculamos la velocidad // Calculamos la velocidad
motState.UpdateSpeed(Max_Speed_for_Ramp, TiempoRampa, elapsedMilliseconds); motState.UpdateSpeed(Max_Speed_for_Ramp, TiempoRampa, TotalMilliseconds);
} }
@ -140,6 +164,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucVMmotorSim : UserControl, IDataContainer public partial class ucVMmotorSim : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucVMmotorSim() public ucVMmotorSim()
{ {
@ -156,7 +181,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }
@ -176,7 +201,7 @@ namespace CtrEditor.ObjetosSim
public bool OUT_Reversal; public bool OUT_Reversal;
public float OUT_OUT_VFD_REQ_Speed_Hz; public float OUT_OUT_VFD_REQ_Speed_Hz;
public void UpdatePLC(PLCViewModel plc, osVMmotorSim Data, int elapsedMilliseconds) public void UpdatePLC(PLCViewModel plc, osVMmotorSim Data, int TotalMilliseconds)
{ {
var DB_Motor = Data.PLC_DB_Motor; var DB_Motor = Data.PLC_DB_Motor;
@ -220,9 +245,9 @@ namespace CtrEditor.ObjetosSim
} }
private float CalcSpeedRamp(float max_Speed_for_Ramp, float TiempoRampa, float actual, float expected, int elapsedMilliseconds) private float CalcSpeedRamp(float max_Speed_for_Ramp, float TiempoRampa, float actual, float expected, int TotalMilliseconds)
{ {
float hzIncrementsRamp = (max_Speed_for_Ramp * 10) / (TiempoRampa * (1000.0f / elapsedMilliseconds)); float hzIncrementsRamp = (max_Speed_for_Ramp * 10) / (TiempoRampa * (1000.0f / TotalMilliseconds));
float delta = expected - actual; float delta = expected - actual;
// Conrtolar si la diferencia no es mayor de lo que falta // Conrtolar si la diferencia no es mayor de lo que falta
if (Math.Abs(hzIncrementsRamp) > Math.Abs(delta)) if (Math.Abs(hzIncrementsRamp) > Math.Abs(delta))
@ -233,12 +258,14 @@ namespace CtrEditor.ObjetosSim
return hzIncrementsRamp; return hzIncrementsRamp;
} }
public void UpdateSpeed(float max_Speed_for_Ramp, float TiempoRampa, int elapsedMilliseconds) public void UpdateSpeed(float max_Speed_for_Ramp, float TiempoRampa, int TotalMilliseconds)
{ {
// Calculamos la velocidad // Calculamos la velocidad
STATUS_VFD_ACT_Speed_Hz += CalcSpeedRamp(max_Speed_for_Ramp, TiempoRampa, STATUS_VFD_ACT_Speed_Hz, OUT_OUT_VFD_REQ_Speed_Hz, elapsedMilliseconds); STATUS_VFD_ACT_Speed_Hz += CalcSpeedRamp(max_Speed_for_Ramp, TiempoRampa, STATUS_VFD_ACT_Speed_Hz, OUT_OUT_VFD_REQ_Speed_Hz, TotalMilliseconds);
} }
} }
} }

View File

@ -19,6 +19,10 @@ using System.ComponentModel;
using ClosedXML.Excel; using ClosedXML.Excel;
using Colors = System.Windows.Media.Colors; using Colors = System.Windows.Media.Colors;
using CtrEditor.FuncionesBase; using CtrEditor.FuncionesBase;
using System.Drawing;
using System.Windows.Shapes;
using System.Drawing.Imaging;
using Emgu.CV.Structure;
namespace CtrEditor.ObjetosSim.Extraccion_Datos namespace CtrEditor.ObjetosSim.Extraccion_Datos
{ {
@ -373,6 +377,10 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos
// Método para convertir BitmapSource a Mat // Método para convertir BitmapSource a Mat
private Mat BitmapSourceToMat(BitmapSource bitmapSource) private Mat BitmapSourceToMat(BitmapSource bitmapSource)
{ {
if (bitmapSource == null)
throw new ArgumentNullException(nameof(bitmapSource));
// Convierte BitmapSource a Bitmap
Bitmap bitmap; Bitmap bitmap;
using (MemoryStream outStream = new MemoryStream()) using (MemoryStream outStream = new MemoryStream())
{ {
@ -381,7 +389,10 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos
enc.Save(outStream); enc.Save(outStream);
bitmap = new Bitmap(outStream); bitmap = new Bitmap(outStream);
} }
return bitmap.ToMat();
// Convierte directamente a Mat usando Image<Bgr, byte>
Image<Bgr, byte> image = bitmap.ToImage<Bgr, byte>();
return image.Mat;
} }
public override void ucLoaded() public override void ucLoaded()
@ -397,6 +408,7 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos
public partial class ucBuscarCoincidencias : UserControl, IDataContainer public partial class ucBuscarCoincidencias : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucBuscarCoincidencias() public ucBuscarCoincidencias()
{ {
@ -413,7 +425,7 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }

View File

@ -175,6 +175,7 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos
public partial class ucExtraccionTag : UserControl, IDataContainer public partial class ucExtraccionTag : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucExtraccionTag() public ucExtraccionTag()
{ {
@ -220,7 +221,7 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos
datos.Angulo += Angle; datos.Angulo += Angle;
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.ExtraccionTag; return ZIndexEnum.ExtraccionTag;
} }

View File

@ -143,6 +143,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucBoton : UserControl, IDataContainer public partial class ucBoton : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucBoton() public ucBoton()
{ {
@ -183,7 +184,7 @@ namespace CtrEditor.ObjetosSim
} }
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }

View File

@ -132,6 +132,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucEncoderMotor : UserControl, IDataContainer public partial class ucEncoderMotor : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucEncoderMotor() public ucEncoderMotor()
{ {
@ -152,7 +153,7 @@ namespace CtrEditor.ObjetosSim
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }

View File

@ -124,6 +124,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucEncoderMotorLineal : UserControl, IDataContainer public partial class ucEncoderMotorLineal : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucEncoderMotorLineal() public ucEncoderMotorLineal()
{ {
@ -144,7 +145,7 @@ namespace CtrEditor.ObjetosSim
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }

View File

@ -43,8 +43,8 @@ namespace CtrEditor.ObjetosSim
{ {
if (value) if (value)
{ {
var dTime = Stopwatch.ElapsedMilliseconds - stopwatch_last; var dTime = Stopwatch.Elapsed.TotalMilliseconds - stopwatch_last;
stopwatch_last = Stopwatch.ElapsedMilliseconds; stopwatch_last = Stopwatch.Elapsed.TotalMilliseconds;
Tiempo_Pulso = (float)dTime; Tiempo_Pulso = (float)dTime;
} }
@ -146,25 +146,7 @@ namespace CtrEditor.ObjetosSim
} }
public override void UpdatePLC(PLCViewModel plc, int elapsedMilliseconds) public override void UpdatePLC(PLCViewModel plc, int elapsedMilliseconds)
{ {
if (Motor != null)
{
if (Motor is osVMmotorSim motor)
{
VelocidadActual = motor.Velocidad;
// Calcular la cantidad de giros por segundo
double girosPorSegundo = (VelocidadActual / 100.0) * Giros_segundo_a_100;
// Calcular la fracción del segundo que ha pasado
double segundosTranscurridos = elapsedMilliseconds / 1000.0;
// Calcular el incremento de ángulo
double incrementoAngulo = (girosPorSegundo * 360.0) * segundosTranscurridos;
// Actualizar el ángulo
Angulo = (float) (Angulo + incrementoAngulo) % 360;
}
}
} }
public bool DetectarDiente() public bool DetectarDiente()
@ -207,7 +189,28 @@ namespace CtrEditor.ObjetosSim
public override void UpdateControl(int elapsedMilliseconds) public override void UpdateControl(int elapsedMilliseconds)
{ {
// Calculamos la velocidad // Calculamos la velocidad
if (Motor != null)
{
if (Motor is osVMmotorSim motor)
{
if (motor.Sentido_contrario)
VelocidadActual = -motor.Velocidad;
else
VelocidadActual = motor.Velocidad;
// Calcular la cantidad de giros por segundo
double girosPorSegundo = (VelocidadActual / 100.0) * Giros_segundo_a_100;
// Calcular la fracción del segundo que ha pasado
double segundosTranscurridos = elapsedMilliseconds / 1000.0;
// Calcular el incremento de ángulo
double incrementoAngulo = (girosPorSegundo * 360.0) * segundosTranscurridos;
// Actualizar el ángulo
Angulo = (float)(Angulo + incrementoAngulo) % 360;
}
}
} }
public override void ucLoaded() public override void ucLoaded()
@ -222,6 +225,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucGearEncoder : UserControl, IDataContainer public partial class ucGearEncoder : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucGearEncoder() public ucGearEncoder()
{ {
@ -238,7 +242,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }

View File

@ -61,12 +61,12 @@ namespace CtrEditor.ObjetosSim
} }
if (!value) { if (!value) {
Lenght_positive_pulse = (float) (timer.ElapsedMilliseconds- timer_lastPositive); Lenght_positive_pulse = (float) (timer.Elapsed.TotalMilliseconds - timer_lastPositive);
timer_lastNegative = timer.ElapsedMilliseconds; timer_lastNegative = timer.Elapsed.TotalMilliseconds;
} else } else
{ {
Lenght_negative_pulse = (float)(timer.ElapsedMilliseconds - timer_lastNegative); Lenght_negative_pulse = (float)(timer.Elapsed.TotalMilliseconds - timer_lastNegative);
timer_lastPositive = timer.ElapsedMilliseconds; timer_lastPositive = timer.Elapsed.TotalMilliseconds;
Lenght_FP_to_FP = Lenght_positive_pulse + Lenght_negative_pulse; Lenght_FP_to_FP = Lenght_positive_pulse + Lenght_negative_pulse;
Frecuency = (Frecuency * (filter_Frecuency - 1) + (1000 / Lenght_FP_to_FP)) / filter_Frecuency; Frecuency = (Frecuency * (filter_Frecuency - 1) + (1000 / Lenght_FP_to_FP)) / filter_Frecuency;
} }
@ -223,6 +223,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucPhotocell : UserControl, IDataContainer public partial class ucPhotocell : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucPhotocell() public ucPhotocell()
{ {
@ -239,7 +240,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Fotocelula; return ZIndexEnum.Fotocelula;
} }

View File

@ -72,6 +72,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucSensTemperatura : UserControl, IDataContainer public partial class ucSensTemperatura : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucSensTemperatura() public ucSensTemperatura()
{ {
@ -88,7 +89,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }

View File

@ -109,6 +109,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucAnalogTag : UserControl, IDataContainer public partial class ucAnalogTag : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucAnalogTag() public ucAnalogTag()
{ {
@ -125,7 +126,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }

View File

@ -89,6 +89,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucBoolTag : UserControl, IDataContainer public partial class ucBoolTag : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucBoolTag() public ucBoolTag()
{ {
@ -105,7 +106,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }

View File

@ -53,6 +53,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucConsensGeneric : UserControl, IDataContainer public partial class ucConsensGeneric : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucConsensGeneric() public ucConsensGeneric()
{ {
@ -69,7 +70,7 @@ namespace CtrEditor.ObjetosSim
Datos?.ucUnLoaded(); Datos?.ucUnLoaded();
} }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Estaticos; return ZIndexEnum.Estaticos;
} }

View File

@ -263,6 +263,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucTrace3 : UserControl, IDataContainer public partial class ucTrace3 : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucTrace3() public ucTrace3()
{ {
@ -295,7 +296,7 @@ namespace CtrEditor.ObjetosSim
} }
public float Angle() { return 0; } public void Rotate(float Angle) { } public float Angle() { return 0; } public void Rotate(float Angle) { }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Trace; return ZIndexEnum.Trace;
} }

View File

@ -96,7 +96,7 @@ namespace CtrEditor.ObjetosSim
} }
if (data.Count > 50) if (data.Count > 50)
data.RemoveAt(0); data.RemoveAt(0);
if (stopwatch.ElapsedMilliseconds > 1000) if (stopwatch.Elapsed.TotalMilliseconds > 1000)
{ {
stopwatch.Reset(); stopwatch.Reset();
stopwatch.Start(); stopwatch.Start();
@ -128,6 +128,7 @@ namespace CtrEditor.ObjetosSim
public partial class ucTraceSimple : UserControl, IDataContainer public partial class ucTraceSimple : UserControl, IDataContainer
{ {
public osBase? Datos { get; set; } public osBase? Datos { get; set; }
public int zIndex_fromFrames { get; set; }
public ucTraceSimple() public ucTraceSimple()
{ {
@ -160,7 +161,7 @@ namespace CtrEditor.ObjetosSim
} }
public float Angle() { return 0; } public void Rotate(float Angle) { } public float Angle() { return 0; } public void Rotate(float Angle) { }
public void Highlight(bool State) { } public void Highlight(bool State) { }
public ZIndexEnum ZIndex() public ZIndexEnum ZIndex_Base()
{ {
return ZIndexEnum.Trace; return ZIndexEnum.Trace;
} }

View File

@ -9,14 +9,17 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Shapes; using System.Windows.Shapes;
using Tesseract; using Tesseract;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
using Application = System.Windows.Application;
using ItemCollection = Xceed.Wpf.Toolkit.PropertyGrid.Attributes.ItemCollection; using ItemCollection = Xceed.Wpf.Toolkit.PropertyGrid.Attributes.ItemCollection;
using JsonIgnoreAttribute = Newtonsoft.Json.JsonIgnoreAttribute; using JsonIgnoreAttribute = Newtonsoft.Json.JsonIgnoreAttribute;
using UserControl = System.Windows.Controls.UserControl;
namespace CtrEditor.ObjetosSim namespace CtrEditor.ObjetosSim
{ {
@ -30,8 +33,9 @@ namespace CtrEditor.ObjetosSim
{ {
[JsonIgnore] [JsonIgnore]
osBase? Datos { get; set; } osBase? Datos { get; set; }
int zIndex_fromFrames { get; set; }
void Highlight(bool State); void Highlight(bool State);
ZIndexEnum ZIndex(); ZIndexEnum ZIndex_Base();
} }
public class DataSaveToSerialize public class DataSaveToSerialize
@ -60,19 +64,6 @@ namespace CtrEditor.ObjetosSim
{ {
public virtual string Nombre { get; set; } = "osBase"; public virtual string Nombre { get; set; } = "osBase";
public osBase()
{
if (float.IsNaN(Left))
{
Left = 0;
}
if (float.IsNaN(Top))
{
Top = 0;
}
}
[JsonIgnore] [JsonIgnore]
private Storyboard _storyboard; private Storyboard _storyboard;
[JsonIgnore] [JsonIgnore]
@ -287,7 +278,19 @@ namespace CtrEditor.ObjetosSim
{ {
FramePlate = (osFramePlate)_mainViewModel.ObjetosSimulables.FirstOrDefault(s => (s is osFramePlate && s.Nombre == value), null); FramePlate = (osFramePlate)_mainViewModel.ObjetosSimulables.FirstOrDefault(s => (s is osFramePlate && s.Nombre == value), null);
if (FramePlate != null) if (FramePlate != null)
{
FramePlate.PropertyChanged += OnFramePlatePropertyChanged; FramePlate.PropertyChanged += OnFramePlatePropertyChanged;
UpdateZIndex(FramePlate.Zindex_FramePlate);
}
}
}
protected void UpdateZIndex(int zIndex)
{
if (_visualRepresentation is IDataContainer dataContainer)
{
dataContainer.zIndex_fromFrames = zIndex;
Canvas.SetZIndex(_visualRepresentation, zIndex + ((int)dataContainer.ZIndex_Base()));
} }
} }
@ -312,6 +315,9 @@ namespace CtrEditor.ObjetosSim
OnMoveResizeRotate(); OnMoveResizeRotate();
} }
if (e.PropertyName == nameof(osFramePlate.Zindex_FramePlate))
UpdateZIndex(((osFramePlate)sender).Zindex_FramePlate);
isUpdatingFromFramePlate = false; isUpdatingFromFramePlate = false;
} }
} }
@ -1156,9 +1162,9 @@ namespace CtrEditor.ObjetosSim
public bool SenalFiltrada() public bool SenalFiltrada()
{ {
if (_stopwatch_ON.ElapsedMilliseconds > (Tiempo_ON_s * 1000)) if (_stopwatch_ON.Elapsed.TotalMilliseconds > (Tiempo_ON_s * 1000))
_senalFiltrada = true; _senalFiltrada = true;
if (_stopwatch_OFF.ElapsedMilliseconds > (Tiempo_OFF_s * 1000)) if (_stopwatch_OFF.Elapsed.TotalMilliseconds > (Tiempo_OFF_s * 1000))
_senalFiltrada = false; _senalFiltrada = false;
return _senalFiltrada; return _senalFiltrada;