예제 #1
0
        public void Dispose()
        {
            _PxeAccess.Dispose();

            AlgClientInstances.InstanceNumber--;

            m_HistogramDisplay.Dispose();

            if (m_Annotations == null)
            {
                m_Annotations = new Dictionary <string, List <AnnotationInfo> >();
            }
            else
            {
                m_Annotations.Clear();
            }

            if (m_XrayImage != null)
            {
                foreach (XRayImage image in m_XrayImage)
                {
                    if (!m_Annotations.ContainsKey(image.ViewName))
                    {
                        List <Annotation>     annots = image.GetAnnotations();
                        List <AnnotationInfo> infos  = new List <AnnotationInfo>();
                        foreach (Annotation ann in annots)
                        {
                            infos.Add(new AnnotationInfo(ann.Marking.Rect.TopLeft, ann.Marking.Rect.Width, ann.Marking.Rect.Height, ann.Marking.RadiusX, ann.Marking.RadiusY, ann.CommentText));
                        }
                        m_Annotations.Add(image.ViewName, infos);
                    }
                }
            }

            if (Displays != null)
            {
                foreach (LayoutInfo layoutInfo in Displays)
                {
                    UserControl1 userControl1 = layoutInfo.Display as UserControl1;

                    if (userControl1 != null)
                    {
                        userControl1.Dispose();
                    }
                    else
                    {
                        HistogramDisplay histogramDisplay = layoutInfo.Display as HistogramDisplay;

                        if (histogramDisplay != null)
                        {
                            histogramDisplay.Dispose();
                        }
                    }
                }

                Displays.Clear();
            }

            DataAttachment dataAttachment = null;

            foreach (DataAttachment attachment in m_CaseObj.attachments.GetAnnotationsAttachments())
            {
                dataAttachment = attachment;
                break;
            }

            if (dataAttachment == null)
            {
                dataAttachment = new DataAttachment();
                dataAttachment.attachmentId   = "Annotations.xml";
                dataAttachment.attachmentType = AttachmentType.Annotations;
                dataAttachment.CreateTime     = CultureResources.ConvertDateTimeToStringForData(DateTime.Now);
            }

            dataAttachment.attachmentData = (MemoryStream)AnnotationsTranslator.CreateXML(m_Annotations);
            dataAttachment.IsNew          = true;
            m_CaseObj.NewAttachments.Add(dataAttachment);

            m_statusBarItems.StatusDisplay.Clear();
            m_statusBarItems = null;
            m_CaseObj        = null;
        }
예제 #2
0
        private void CreateXRayDisplays ()
        {
            List<ViewObject> views = GetImageData();

            if (views.Count > 0)
            {
                L3.Cargo.Workstation.Plugins.XRayImageBase.XRayImages xrayview = new L3.Cargo.Workstation.Plugins.XRayImageBase.XRayImages();
                m_XrayImage = xrayview.CreateImages(views, m_statusBarItems, m_CaseObj.CaseHistories, m_SysConfig);
                xrayview.AlgServerRequestEvent += new AlgServerRequestEventHandler(xrayview_AlgServerRequestEvent);

                foreach (XRayImage image in m_XrayImage)
                {
                    image.SetCreateNewAnnotation(m_CaseObj.IsCaseEditable);

                    XRayView xrayView = image.MainView;                    

                    Histogram histogram = new Histogram();
                    histogram.Setup(xrayView.XrayImageEffect, xrayView.Image, xrayView.History, xrayView.CurrentSource.Data);
                    m_HistogramDisplay.AddHistogram(histogram);
                }
                LayoutInfo layoutInfo = new LayoutInfo();
                layoutInfo.Name = "Histogram";
                layoutInfo.Panel = PanelAssignment.InfoPanel;
                layoutInfo.Display = m_HistogramDisplay;

                Displays.Add(layoutInfo);
            }

            if (m_XrayImage != null && m_XrayImage.Count > 0)
            {
                System.Windows.Forms.Screen[] screens = System.Windows.Forms.Screen.AllScreens;

                if (views[0].ImageIndex == 61 && views.Count > 1 && screens.Length > 1)
                {
                    UserControl1 panel0 = new UserControl1(m_XrayImage[0]);

                    LayoutInfo layoutInfo0 = new LayoutInfo();
                    layoutInfo0.Name = "XRayPlugin-View0";
                    layoutInfo0.Panel = PanelAssignment.MainPanel;
                    layoutInfo0.BringToFront = true;
                    layoutInfo0.Display = panel0;
                    layoutInfo0.StatusItems = m_statusBarItems.StatusDisplay;

                    Displays.Add(layoutInfo0);

                    UserControl1 panel1 = new UserControl1(m_XrayImage[1]);
                    panel1.Margin = new Thickness(20);
                    LayoutInfo layoutInfo1 = new LayoutInfo();
                    layoutInfo1.Name = "XRayPlugin-View1";
                    layoutInfo1.Panel = PanelAssignment.SecondaryPanel;
                    layoutInfo1.BringToFront = true;
                    layoutInfo1.Display = panel1;

                    Displays.Add(layoutInfo1);
                }
                else
                {
                    UserControl1 panel = new UserControl1(m_XrayImage);

                    LayoutInfo layoutInfo = new LayoutInfo();
                    layoutInfo.Name = "XRayPlugin";
                    layoutInfo.Panel = PanelAssignment.MainPanel;
                    layoutInfo.BringToFront = true;
                    layoutInfo.Display = panel;
                    layoutInfo.StatusItems = m_statusBarItems.StatusDisplay;

                    Displays.Add(layoutInfo);
                }

                if (m_DisplayFTIError)
                {
                    DisplayTIPError();
                }
            }
        }
예제 #3
0
        private void CreateXRayDisplays()
        {
            List <ViewObject> views = GetImageData();

            if (views.Count > 0)
            {
                L3.Cargo.Workstation.Plugins.XRayImageBase.XRayImages xrayview = new L3.Cargo.Workstation.Plugins.XRayImageBase.XRayImages();
                m_XrayImage = xrayview.CreateImages(views, m_statusBarItems, m_CaseObj.CaseHistories, m_SysConfig);
                xrayview.AlgServerRequestEvent += new AlgServerRequestEventHandler(xrayview_AlgServerRequestEvent);

                foreach (XRayImage image in m_XrayImage)
                {
                    image.SetCreateNewAnnotation(m_CaseObj.IsCaseEditable);

                    XRayView xrayView = image.MainView;

                    Histogram histogram = new Histogram();
                    histogram.Setup(xrayView.XrayImageEffect, xrayView.Image, xrayView.History, xrayView.CurrentSource.Data);
                    m_HistogramDisplay.AddHistogram(histogram);
                }
                LayoutInfo layoutInfo = new LayoutInfo();
                layoutInfo.Name    = "Histogram";
                layoutInfo.Panel   = PanelAssignment.InfoPanel;
                layoutInfo.Display = m_HistogramDisplay;

                Displays.Add(layoutInfo);
            }

            if (m_XrayImage != null && m_XrayImage.Count > 0)
            {
                System.Windows.Forms.Screen[] screens = System.Windows.Forms.Screen.AllScreens;

                if (views[0].ImageIndex == 61 && views.Count > 1 && screens.Length > 1)
                {
                    UserControl1 panel0 = new UserControl1(m_XrayImage[0]);

                    LayoutInfo layoutInfo0 = new LayoutInfo();
                    layoutInfo0.Name         = "XRayPlugin-View0";
                    layoutInfo0.Panel        = PanelAssignment.MainPanel;
                    layoutInfo0.BringToFront = true;
                    layoutInfo0.Display      = panel0;
                    layoutInfo0.StatusItems  = m_statusBarItems.StatusDisplay;

                    Displays.Add(layoutInfo0);

                    UserControl1 panel1 = new UserControl1(m_XrayImage[1]);
                    panel1.Margin = new Thickness(20);
                    LayoutInfo layoutInfo1 = new LayoutInfo();
                    layoutInfo1.Name         = "XRayPlugin-View1";
                    layoutInfo1.Panel        = PanelAssignment.SecondaryPanel;
                    layoutInfo1.BringToFront = true;
                    layoutInfo1.Display      = panel1;

                    Displays.Add(layoutInfo1);
                }
                else
                {
                    UserControl1 panel = new UserControl1(m_XrayImage);

                    LayoutInfo layoutInfo = new LayoutInfo();
                    layoutInfo.Name         = "XRayPlugin";
                    layoutInfo.Panel        = PanelAssignment.MainPanel;
                    layoutInfo.BringToFront = true;
                    layoutInfo.Display      = panel;
                    layoutInfo.StatusItems  = m_statusBarItems.StatusDisplay;

                    Displays.Add(layoutInfo);
                }

                if (m_DisplayFTIError)
                {
                    DisplayTIPError();
                }
            }
        }