private void DrawOverlay(ImageViewerAddOn addOn, DateTime dateTime)
        {
            // We need to be on the UI thread for setting the overlay
            ClientControl.Instance.CallOnUiThread(() =>
            {
                try
                {
                    // number between 0 and 100 -counting 1/10 of seconds
                    int s = (dateTime.Second % 10) * 10 + dateTime.Millisecond / 100;
                    List <Shape> shapes = new List <Shape>();
                    shapes.Add(CreateBoxShape(addOn.PaintSize, s * 50 / _sampleRateOfOverlay, s * 50 / _sampleRateOfOverlay, 300, 300, Colors.Yellow, 0.7));
                    shapes.Add(CreateTextShape(addOn.PaintSize, s.ToString(), s * 50 / _sampleRateOfOverlay, s * 50 / _sampleRateOfOverlay, 100, Colors.Red));

                    if (!_dictShapes.ContainsKey(addOn))
                    {
                        _dictShapes.Add(addOn, addOn.ShapesOverlayAdd(shapes, new ShapesOverlayRenderParameters()
                        {
                            ZOrder = 100
                        }));
                    }
                    else
                    {
                        addOn.ShapesOverlayUpdate(_dictShapes[addOn], shapes, new ShapesOverlayRenderParameters()
                        {
                            ZOrder = 100
                        });
                    }
                }
                catch (Exception ex)            // Ignore exceptions during close
                {
                    Debug.WriteLine("DrawOverlay:" + ex.Message);
                }
            });
        }
Пример #2
0
        /// <summary>
        /// Draw the overlay on one specific imagevieweraddon
        /// </summary>
        /// <param name="addOn"></param>
        private void drawGraphOverlay(ImageViewerAddOn addOn)
        {
            try
            {
                AssociatedProperties associatedProperties;
                if (!_cameraAssociatedProperties.TryGetValue(addOn.CameraFQID.ObjectId, out associatedProperties))
                {
                    var cameraItem = Configuration.Instance.GetItem(addOn.CameraFQID);
                    associatedProperties = Configuration.Instance.GetAssociatedProperties(cameraItem, AdminTabPluginDefinition.AdminTabPluginTabPlugin);

                    _cameraAssociatedProperties[addOn.CameraFQID.ObjectId] = associatedProperties;
                }

                string property1 = associatedProperties.Properties.ContainsKey("Property1") ? associatedProperties.Properties["Property1"] : null;
                string property2 = associatedProperties.Properties.ContainsKey("Property2") ? associatedProperties.Properties["Property2"] : null;

                List <Shape> shapes = new List <Shape>();
                Size         size   = new Size(320, 240);
                if (property1 != null)
                {
                    shapes.Add(CreateTextShape(size, "Property1=" + property1, 100, 0, 100, System.Windows.Media.Colors.Red));
                }

                if (property2 != null)
                {
                    shapes.Add(CreateTextShape(size, "Property2=" + property2, 100, 100, 100, System.Windows.Media.Colors.Red));
                }

                if (!_dicShapes.ContainsKey(addOn))
                {
                    _dicShapes.Add(addOn, addOn.ShapesOverlayAdd(shapes, new ShapesOverlayRenderParameters()
                    {
                        ZOrder = 100
                    }));
                }
                else
                {
                    addOn.ShapesOverlayUpdate(_dicShapes[addOn], shapes, new ShapesOverlayRenderParameters()
                    {
                        ZOrder = 100
                    });
                }
            }
            catch (Exception ex)
            {
                EnvironmentManager.Instance.Log(true, "AdminTabBackgrounPlugin", "DrawOverlay(UI):" + ex.Message);
            }
        }
Пример #3
0
 private void UpdateShapeOverlay(ImageViewerAddOn addOn, List <Shape> shapes)
 {
     if (!_dicShapes.ContainsKey(addOn))
     {
         _dicShapes.Add(addOn, addOn.ShapesOverlayAdd(shapes, new ShapesOverlayRenderParameters()
         {
             ZOrder = 100
         }));
     }
     else
     {
         addOn.ShapesOverlayUpdate(_dicShapes[addOn], shapes, new ShapesOverlayRenderParameters()
         {
             ZOrder = 100
         });
     }
 }
        private void UI_DrawOverlay(ImageViewerAddOn addOn, DateTime dateTime)
        {
            try
            {
                if (_activeImageViewerAddOns.Contains(addOn)) // check if the ImageViewerAddOn might have been removed
                {
                    List <Shape> shapes = new List <Shape>();
                    shapes.Add(CreateTextShape(addOn.PaintSize, addOn.CameraName, 10, 0, 100, Colors.Red));
                    for (int i = 0; i <= 2; i++)
                    {
                        shapes.Add(CreateTextShape(
                                       addOn.PaintSize, _AnalyticsEventObjectString[i], 10, 200 + 60 * i, 50,
                                       colorIndicateSameCamera(_AnalyticsEventCameraFQID[i], addOn.CameraFQID.ObjectId)));
                        shapes.Add(CreateTextShape(
                                       addOn.PaintSize, _AlarmObjectString[i], 10, 400 + 60 * i, 50,
                                       colorIndicateSameCamera(_AlarmCameraFQID[i], addOn.CameraFQID.ObjectId)));
                        shapes.Add(CreateTextShape(
                                       addOn.PaintSize, _EventName[i], 2, 600 + 60 * i, 50,
                                       colorIndicateSameCamera(_EventCameraFQID[i], addOn.CameraFQID.ObjectId)));
                    }

                    if (!_dictShapes.ContainsKey(addOn))
                    {
                        _dictShapes.Add(addOn, addOn.ShapesOverlayAdd(shapes, new ShapesOverlayRenderParameters()
                        {
                            ZOrder = 100
                        }));
                    }
                    else
                    {
                        addOn.ShapesOverlayUpdate(_dictShapes[addOn], shapes, new ShapesOverlayRenderParameters()
                        {
                            ZOrder = 100
                        });
                    }
                }
            }
            catch (Exception ex) // Ignore exceptions during close
            {
                Debug.WriteLine("DrawOverlay(UI):" + ex.Message);
            }
        }