示例#1
0
        void automation_UnlockObject(object sender, AnnLockObjectEventArgs e)
        {
            e.Cancel = true;
            //PasswordDialog
            AutomationPasswordDialog passwordDialog = new AutomationPasswordDialog();

            if (passwordDialog.ShowDialog(this) == DialogResult.OK)
            {
                e.Object.Unlock(passwordDialog.Password);

                AnnObject checkObject = null;

                AnnSelectionObject selectionObject = e.Object as AnnSelectionObject;
                if (selectionObject != null)
                {
                    if (selectionObject.SelectedObjects.Count > 0)
                    {
                        //checking first object is enough
                        checkObject = selectionObject.SelectedObjects[0];
                    }
                }
                else
                {
                    checkObject = e.Object;
                }

                if (checkObject.IsLocked)
                {
                    MessageBox.Show("You've entered an invalid password.", "Invalid Password", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                Automation.Invalidate(LeadRectD.Empty);
            }
        }
示例#2
0
        public void CopyReviewsFrom(AnnObject annObject)
        {
            if (annObject == null)
            {
                throw new ArgumentNullException("annObject");
            }

            // Add the content (if available)
            UpdateContent(annObject);

            _treeView.SuspendLayout();
            _treeView.Nodes.Clear();

            foreach (var review in annObject.Reviews)
            {
                AddNode(_treeView, null, true, review);
            }

            _treeView.ResumeLayout();
            _treeView.ExpandAll();

            if (_treeView.SelectedNode == null && _treeView.Nodes.Count > 0)
            {
                _treeView.SelectedNode = _treeView.Nodes[0];
            }

            UpdateUIState();
        }
示例#3
0
        void automation_EditContent(object sender, AnnEditContentEventArgs e)
        {
            AnnObject annObject = e.TargetObject;

            if (annObject == null || !annObject.SupportsContent || annObject is AnnSelectionObject)
            {
                return;
            }

            if (sender is AnnDrawDesigner && annObject.Id != AnnObject.StickyNoteObjectId)
            {
                return;
            }

            using (var dlg = new AutomationUpdateObjectDialog())
            {
                dlg.Automation = this.Automation;
                dlg.SetPageVisible(AutomationUpdateObjectDialogPage.Properties, false);
                dlg.SetPageVisible(AutomationUpdateObjectDialogPage.Reviews, false);
                dlg.TargetObject = annObject;

                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    Automation.InvalidateObject(annObject);
                }
            }
        }
示例#4
0
        private void PropertyForm_Load(object sender, EventArgs e)
        {
            AnnObject     annObject = TifEditor.GetCurrentEditor().AnnAutomation.CurrentEditObject;
            AnnTextObject obj       = annObject as AnnTextObject;

            if (obj != null && obj.GetType() != typeof(AnnStampObject))
            {
                this.Opacity = 100;
                InitializeValue();
            }
            else
            {
                /* if (obj != null && obj.GetType() == typeof(AnnStampObject))
                 * {
                 * */
                if (obj == null)
                {
                    MessageBox.Show("The property form is not supported for selected object in this version.");
                }

                /*
                 * }*/
                this.Close();
            }
        }
        /// <summary>
        /// Shows Ann Object Properties Page.
        /// </summary>
        private async void ShowAnnPropertiesPage()
        {
            var automation = _documentViewer.Annotations.Automation;

            if (automation.CanShowProperties)
            {
                // Prevent fast tapping.
                AnnotationsPropertiesButton.IsEnabled = false;

                AnnObject currentObject = automation.CurrentEditObject;

                if (currentObject.Id == AnnObject.GroupObjectId || currentObject.Id == AnnObject.SelectObjectId)
                {
                    await DisplayAlert("Error", "Cannot change properties for a group", "OK");

                    return;
                }

                if (currentObject.IsLocked)
                {
                    await DisplayAlert("Error", "Cannot change properties for a locked object", "OK");

                    return;
                }

                AutomationUpdateObjectPage page = new AutomationUpdateObjectPage(automation, currentObject);
                page.Disappearing += AutomationUpdateObjectPage_Disappearing;
                await PopupNavigation.Instance.PushAsync(page);
            }
        }
示例#6
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService svc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            AnnObject annObj = (context.Instance as AutomationObjectDescriptor).Object;

            if (svc != null && annObj != null)
            {
                using (FillDialog fillDialog = new FillDialog(annObj.Fill))
                {
                    if (svc.ShowDialog(fillDialog) == DialogResult.OK)
                    {
                        if (annObj is AnnHiliteObject)
                        {
                            if (fillDialog.Fill is AnnSolidColorBrush)
                            {
                                (annObj as AnnHiliteObject).HiliteColor = (fillDialog.Fill as AnnSolidColorBrush).Color;
                            }
                            else if (fillDialog.Fill is AnnHatchBrush)
                            {
                                (annObj as AnnHiliteObject).HiliteColor = (fillDialog.Fill as AnnHatchBrush).BackgroundColor;
                            }
                        }

                        annObj.Fill = fillDialog.Fill;
                    }
                }
            }
            return(value); // can also replace the wrapper object here
        }
        public override void Render(AnnContainerMapper mapper, AnnObject annObject)
        {
            if (mapper == null)
            {
                ExceptionHelper.ArgumentNullException("mapper");
            }
            if (annObject == null)
            {
                ExceptionHelper.ArgumentNullException("annObject");
            }

            AnnProtractorObject firstProtractorObject = annObject.Clone() as AnnProtractorObject;

            firstProtractorObject.Points.Clear();
            firstProtractorObject.Points.Add(annObject.Points[0]);
            firstProtractorObject.Points.Add(annObject.Points[1]);
            firstProtractorObject.Points.Add(annObject.Points[2]);
            base.Render(mapper, firstProtractorObject);

            AnnProtractorObject secondProtractorObject = annObject.Clone() as AnnProtractorObject;

            secondProtractorObject.Points.Clear();
            secondProtractorObject.Points.Add(annObject.Points[1]);
            secondProtractorObject.Points.Add(annObject.Points[2]);
            secondProtractorObject.Points.Add(annObject.Points[3]);
            base.Render(mapper, secondProtractorObject);

            annObject.Labels["FirstAngle"]  = firstProtractorObject.Labels["AngleText"].Clone();
            annObject.Labels["SecondAngle"] = secondProtractorObject.Labels["AngleText"].Clone();
        }
示例#8
0
        public override void Render(AnnContainerMapper mapper, AnnObject annObject)
        {
            if (mapper == null)
            {
                ExceptionHelper.ArgumentNullException("mapper");
            }
            if (annObject == null)
            {
                ExceptionHelper.ArgumentNullException("annObject");
            }

            IAnnDrawEngine engine = RenderingEngine as IAnnDrawEngine;

            if (engine != null)
            {
                base.Render(mapper, annObject);

                AnnIntersectionPointObject annIntersectionPointObject = annObject as AnnIntersectionPointObject;
                if (annIntersectionPointObject != null)
                {
                    int count = annIntersectionPointObject.Points.Count;
                    if (count < 2)
                    {
                        return;
                    }

                    LeadPointD[] leadPoints = mapper.PointsFromContainerCoordinates(annIntersectionPointObject.Points.ToArray(), annIntersectionPointObject.FixedStateOperations);

                    if (annIntersectionPointObject.SupportsStroke && annIntersectionPointObject.Stroke != null)
                    {
                        AnnStroke stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), annIntersectionPointObject.Stroke.StrokeThickness);
                        stroke.StrokeDashArray = new double[] { 3, 1, 1, 1, 1, 1 }; // DashDotDot

                        IAnnDrawPen pen = engine.ToPen(mapper.StrokeFromContainerCoordinates(stroke, annIntersectionPointObject.FixedStateOperations), annIntersectionPointObject.Opacity);
                        try
                        {
                            if (leadPoints.Length > 2)
                            {
                                LeadPointD intersectionPoint = annIntersectionPointObject.IntersectionPoint;
                                intersectionPoint = mapper.PointFromContainerCoordinates(intersectionPoint, annIntersectionPointObject.FixedStateOperations);

                                double radius = mapper.LengthFromContainerCoordinates(annIntersectionPointObject.IntersectionPointRadius, annIntersectionPointObject.FixedStateOperations);
                                DrawPoint(annIntersectionPointObject, engine, intersectionPoint, radius);

                                if (leadPoints.Length < 5 && annIntersectionPointObject.IntersectionInsideContainer)
                                {
                                    engine.DrawLine(pen, leadPoints[3], intersectionPoint);
                                }
                            }
                        }
                        finally
                        {
                            engine.Destroy(pen);
                        }
                    }
                }
            }
        }
示例#9
0
        public override void Render(AnnContainerMapper mapper, AnnObject annObject)
        {
            if (mapper == null)
            {
                ExceptionHelper.ArgumentNullException("mapper");
            }
            if (annObject == null)
            {
                ExceptionHelper.ArgumentNullException("annObject");
            }

            AnnWinFormsRenderingEngine engine = RenderingEngine as AnnWinFormsRenderingEngine;

            if (engine != null && engine.Context != null)
            {
                base.Render(mapper, annObject);

                AnnMidlineObject annMidlineObject = annObject as AnnMidlineObject;
                if (annMidlineObject != null)
                {
                    LeadPointD[] leadPoints = annMidlineObject.Points.ToArray();
                    int          linesCount = leadPoints.Length / 2;
                    if (linesCount > 0)
                    {
                        PointF[] linesCenters = new PointF[linesCount];
                        leadPoints = mapper.PointsFromContainerCoordinates(leadPoints, annMidlineObject.FixedStateOperations);
                        PointF[] points = AnnWinFormsRenderingEngine.ToPoints(leadPoints);

                        if (annMidlineObject.SupportsStroke && annMidlineObject.Stroke != null)
                        {
                            double radius = mapper.LengthFromContainerCoordinates(annMidlineObject.CenterPointRadius, annMidlineObject.FixedStateOperations);
                            using (Pen pen = AnnWinFormsRenderingEngine.ToPen(mapper.StrokeFromContainerCoordinates(annMidlineObject.Stroke, annMidlineObject.FixedStateOperations), annMidlineObject.Opacity))
                            {
                                for (int i = 0; i < linesCount; ++i)
                                {
                                    PointF firstPoint  = points[2 * i];
                                    PointF secondPoint = points[2 * i + 1];

                                    PointF center = new PointF((firstPoint.X + secondPoint.X) / 2, (firstPoint.Y + secondPoint.Y) / 2);
                                    DrawPoint(annMidlineObject, engine.Context, center, radius);

                                    linesCenters[i] = center;
                                }

                                if (linesCount > 1)
                                {
                                    int count = linesCount - 1;
                                    for (int i = 0; i < count; ++i)
                                    {
                                        engine.Context.DrawLine(pen, linesCenters[i], linesCenters[i + 1]); // draw midline
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#10
0
        private void DrawLeadAnnotationObject(AnnObject annObject)
        {
            if (_automation == null || _automation.Container == null || annObject == null)
            {
                return;
            }

            _automation.Container.Children.Add(annObject);
        }
示例#11
0
 private void GetReviews(AnnObject annObject, AutomationTreeNode parent, IList <AnnReview> reviews)
 {
     foreach (AnnReview reply in reviews)
     {
         ReviewTreeNode reviewNode = new ReviewTreeNode(annObject, reviews, reply, parent, _automation, Tree);
         parent.ChildNodes.Add(reviewNode);
         GetReviews(annObject, reviewNode, reply.Replies);
     }
 }
示例#12
0
        private void SetPolyRulerTickMarks(AnnObject annObject)
        {
            var polyRulerObject = annObject as AnnPolyRulerObject;

            if (polyRulerObject != null)
            {
                polyRulerObject.TickMarksStroke = polyRulerObject.Stroke;
            }
        }
示例#13
0
        private LeadRectD BoundsToAnnotations(AnnObject annObject, RectangleF rect)
        {
            // Convert a rectangle from logical (top-left) to annotation object coordinates
            LeadRectD rc = LeadRectD.Create(rect.Left + System.Convert.ToDouble(rect.Width < 0) * rect.Width, rect.Top + System.Convert.ToDouble(rect.Height < 0) * rect.Height, Math.Abs(rect.Width), Math.Abs(rect.Height));

            rc = _filledFormViewer.ConvertRect(null, ImageViewerCoordinateType.Image, ImageViewerCoordinateType.Control, rc);
            rc = automation.Container.Mapper.RectToContainerCoordinates(rc);
            return(rc);
        }
示例#14
0
        public override void Render(AnnContainerMapper mapper, AnnObject annObject)
        {
            if (mapper == null)
            {
                ExceptionHelper.ArgumentNullException("mapper");
            }
            if (annObject == null)
            {
                ExceptionHelper.ArgumentNullException("annObject");
            }

            AnnWinFormsRenderingEngine engine = RenderingEngine as AnnWinFormsRenderingEngine;

            if (engine != null && engine.Context != null)
            {
                LeadPointD[] leadPoints = annObject.Points.ToArray();
                int          linesCount = leadPoints.Length / 2;
                if (linesCount > 0)
                {
                    if (annObject.SupportsStroke && annObject.Stroke != null)
                    {
                        leadPoints = mapper.PointsFromContainerCoordinates(leadPoints, annObject.FixedStateOperations);
                        PointF[] points = AnnWinFormsRenderingEngine.ToPoints(leadPoints);

                        using (Pen pen = AnnWinFormsRenderingEngine.ToPen(mapper.StrokeFromContainerCoordinates(annObject.Stroke, annObject.FixedStateOperations), annObject.Opacity))
                        {
                            for (int i = 0; i < linesCount; ++i)
                            {
                                if (_linesAsRulers)
                                {
                                    AnnPolyRulerObject ruler = new AnnPolyRulerObject();
                                    ruler.Stroke               = annObject.Stroke.Clone();
                                    ruler.TickMarksStroke      = ruler.Stroke;
                                    ruler.Opacity              = annObject.Opacity;
                                    ruler.FixedStateOperations = annObject.FixedStateOperations;

                                    ruler.Points.Clear();
                                    ruler.Points.Add(annObject.Points[2 * i]);
                                    ruler.Points.Add(annObject.Points[2 * i + 1]);

                                    annObject.Labels["angle" + i.ToString()] = ruler.Labels["RulerLength"];

                                    AnnPolyRulerObjectRenderer renderer = new AnnPolyRulerObjectRenderer();
                                    renderer.Initialize(engine);
                                    renderer.Render(mapper, ruler);
                                }
                                else
                                {
                                    engine.Context.DrawLine(pen, points[2 * i], points[2 * i + 1]);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#15
0
        private void SetObjectValue()
        {
            AnnObject     annObject = TifEditor.GetCurrentEditor().AnnAutomation.CurrentEditObject;
            AnnTextObject obj       = annObject as AnnTextObject;

            if (obj != null)
            {
                obj.Text = txtData.Text;
            }
        }
示例#16
0
        public AnnotationObjectEditNoteForm(AnnObject annObject)
        {
            InitializeComponent();

            _annObject        = annObject;
            _noteTextBox.Text = _annObject.Note;
            Text = string.Format("{0}, {1}", Environment.UserName, _annObject.FriendlyName);

            FormClosed += new FormClosedEventHandler(AnnotationObjectEditNoteForm_FormClosed);
        }
示例#17
0
        public override void Render(AnnContainerMapper mapper, AnnObject annObject)
        {
            if (mapper == null)
            {
                ExceptionHelper.ArgumentNullException("mapper");
            }
            if (annObject == null)
            {
                ExceptionHelper.ArgumentNullException("annObject");
            }

            AnnWinFormsRenderingEngine engine = RenderingEngine as AnnWinFormsRenderingEngine;

            if (engine != null && engine.Context != null)
            {
                base.Render(mapper, annObject);

                AnnIntersectionPointObject annIntersectionPointObject = annObject as AnnIntersectionPointObject;
                if (annIntersectionPointObject != null)
                {
                    int count = annIntersectionPointObject.Points.Count;
                    if (count < 2)
                    {
                        return;
                    }

                    LeadPointD[] leadPoints = mapper.PointsFromContainerCoordinates(annIntersectionPointObject.Points.ToArray(), annIntersectionPointObject.FixedStateOperations);
                    PointF[]     points     = AnnWinFormsRenderingEngine.ToPoints(leadPoints);

                    if (annIntersectionPointObject.SupportsStroke && annIntersectionPointObject.Stroke != null)
                    {
                        using (Pen pen = AnnWinFormsRenderingEngine.ToPen(mapper.StrokeFromContainerCoordinates(annIntersectionPointObject.Stroke, annIntersectionPointObject.FixedStateOperations), annIntersectionPointObject.Opacity))
                        {
                            if (points.Length > 2)
                            {
                                LeadPointD LeadIntersectionPoint = annIntersectionPointObject.IntersectionPoint;
                                LeadIntersectionPoint = mapper.PointFromContainerCoordinates(LeadIntersectionPoint, annIntersectionPointObject.FixedStateOperations);
                                PointF intersectionPoint = new PointF((float)LeadIntersectionPoint.X, (float)LeadIntersectionPoint.Y);

                                double radius = mapper.LengthFromContainerCoordinates(annIntersectionPointObject.IntersectionPointRadius, annIntersectionPointObject.FixedStateOperations);
                                DrawPoint(annIntersectionPointObject, engine.Context, intersectionPoint, radius);

                                if (points.Length < 5 && annIntersectionPointObject.IntersectionInsideContainer)
                                {
                                    pen.Brush     = Brushes.Blue;
                                    pen.DashStyle = DashStyle.DashDotDot;
                                    engine.Context.DrawLine(pen, points[3], intersectionPoint);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#18
0
        private bool IsEligible(AnnObject annObject)
        {
            string[] objectList = new string[] { "AnnTextObject", "AnnNoteObject" };
            Type     type       = annObject.GetType();

            if (Array.IndexOf(objectList, type.Name) >= 0)
            {
                return(true);
            }
            return(false);
        }
示例#19
0
        public AnnotationPropertiesDialog(MedicalViewerMultiCell cell)
        {
            InitializeComponent();
            _cell = cell;

            _annObj = _cell.Automation.CurrentEditObject;

            if (!_annObj.SupportsStroke)
            {
                _tabAnnProperties.TabPages.Remove(_penTab);
            }
            if (!_annObj.SupportsFill && !(_annObj is AnnHiliteObject))
            {
                _tabAnnProperties.TabPages.Remove(_brushTab);
            }
            if (!_annObj.SupportsFont)
            {
                _tabAnnProperties.TabPages.Remove(_fontTab);
            }

            _chkUsePen.Checked = _annObj.SupportsStroke;

            _chkUseBrush.Checked = _annObj.SupportsFill | (_annObj is AnnHiliteObject);

            if (_annObj is AnnHiliteObject)
            {
                _chkUseBrush.Visible = false;
                _brushTab.Text       = "Hilite";
            }

            //if (_annObj.SupportsStroke)
            //{
            //   foreach (AnnStrokeLineCap dash in (AnnStrokeLineCap[])Enum.GetValues(typeof(AnnStrokeLineCap)))
            //   {
            //      _cmbDashStyle.Items.Add(dash.ToString());
            //   }
            //}
            //else
            //   _cmbDashStyle.Enabled = false;

            if (_annObj.SupportsFont)
            {
                AnnTextObject AnnTempText = _annObj as AnnTextObject;
                AnnFont       objFont     = _annObj.Font;
                _annFont           = new AnnFont(objFont.FontFamilyName.ToString(), objFont.FontSize);
                _annFont.FontStyle = objFont.FontStyle;
                AnnSolidColorBrush CurrentBrush = AnnTempText.TextForeground as AnnSolidColorBrush;
                _fontColor = Color.FromName(CurrentBrush.Color);
            }

            UpdateFont();
            UpdateBrush();
            UpdatePen();
        }
示例#20
0
        public void ReplacesReviewsIn(AnnObject annObject)
        {
            if (annObject == null)
            {
                throw new ArgumentNullException("annObject");
            }

            annObject.Reviews.Clear();

            foreach (TreeNode node in _treeView.Nodes)
            {
                GetNode(_treeView, node, annObject, null);
            }
        }
示例#21
0
        private void UpdateContent(AnnObject annObject)
        {
            var metadata = annObject.Metadata;

            string author = null;

            if (metadata.ContainsKey(AnnObject.AuthorMetadataKey))
            {
                author = metadata[AnnObject.AuthorMetadataKey];
            }

            if (string.IsNullOrEmpty(author))
            {
                author = "[author]";
            }

            string lastModified = null;

            if (metadata.ContainsKey(AnnObject.ModifiedMetadataKey))
            {
                lastModified = AnnObjectTreeNode.ToLocalTimeString(AnnObject.ModifiedMetadataKey);
            }

            if (string.IsNullOrEmpty(lastModified))
            {
                lastModified = "[date]";
            }

            _contentGroupBox.Text = string.Format("By {0} at {1}", author, lastModified);

            string text = null;

            var textObject = annObject as AnnTextObject;

            if (textObject != null)
            {
                text = textObject.Text;
            }
            else
            {
                // Get it from the content
                if (metadata.ContainsKey(AnnObject.ContentMetadataKey))
                {
                    text = metadata[AnnObject.ContentMetadataKey];
                }
            }

            _contentTextBox.Text = text;
        }
示例#22
0
 private void ShowPropertyDialog(AnnObject annObject)
 {
     if (IsEligible(annObject))
     {
         AnnTextObject textObj = annObject as AnnTextObject;
         if (textObj != null)
         {
             PropertyForm.userData = textObj.Text;
             editor.AnnAutomation.ShowObjectPropertiesDialog();
             textObj.Text = PropertyForm.userData;
             editor.AnnAutomation.Container.Objects.Add(textObj);
             editor.AnnAutomation.Viewer.Invalidate(textObj.InvalidRectangle);
         }
     }
 }
示例#23
0
        protected override void MoveThumb(int thumbIndex, LeadPointD offset)
        {
            AnnObject  targetObject = TargetObject;
            LeadPointD point        = targetObject.Points[thumbIndex];

            targetObject.Points[thumbIndex] = ClipPoint(AnnTransformer.TranslatePoint(point, offset.X, offset.Y), ClipRectangle);

            AnnIntersectionPointObject intersectionPointObject = targetObject as AnnIntersectionPointObject;

            if (intersectionPointObject != null)
            {
                intersectionPointObject.IntersectionInsideContainer = ClipRectangle.ContainsPoint(intersectionPointObject.IntersectionPoint);
            }

            base.MoveThumb(thumbIndex, offset);
        }
示例#24
0
        public AnnObjectTreeNode(AnnObject annObject, AutomationTreeNode treeParentNode, AnnAutomation automation, AutomationObjectsListControl tree) : base(tree)
        {
            InitializeComponent();

            if (annObject == null)
            {
                throw new ArgumentNullException("annObject");
            }
            if (annObject.Id == AnnObject.SelectObjectId || annObject.Id == AnnObject.None)
            {
                throw new ArgumentException("Cannot create this item with a selection or none annotation object", "annObject");
            }

            if (treeParentNode == null)
            {
                throw new ArgumentNullException("treeParentNode");
            }
            if (automation == null)
            {
                throw new ArgumentNullException("automation");
            }

            _annObject  = annObject;
            _automation = automation;

            _tbComment.Visible = _annObject.SupportsContent;

            AnnAutomationObject automationObject = _automation.Manager.FindObjectById(_annObject.Id);

            if (automationObject != null)
            {
                _lblObjectName.Text = automationObject.Name;
                _pbObjetIcon.Image  = automationObject.ToolBarImage as Image;
            }
            else
            {
                _lblObjectName.Text = _annObject.FriendlyName;
                _pbObjetIcon.Image  = null;
            }

            UpdateMetadata();

            Width          = Tree.TreeRootNode.Width - Margin.Left;
            TreeParentNode = treeParentNode;
            IsExpanded     = false;
            GetReviews(AnnObject, this, AnnObject.Reviews);
        }
示例#25
0
        public void automation_AfterObjectChanged(object sender, AnnAfterObjectChangedEventArgs e)
        {
            //if (e.ChangeType == AnnObjectChangedType.
            AnnEditDesigner annDes;

            annDes = editor.AnnAutomation.CurrentDesigner as AnnEditDesigner;
            //if (typeof(editor.AnnAutomation.CurrentDesigner)) is AnnEditDesigner)
            if (annDes != null)
            {
                AnnObject ann = annDes.EditObject;
                // if (e.Objects.Count > 0)
                {
                    //ShowPropertyDialog(e.Objects[0]);
                }
                ShowPropertyDialog(ann);
            }
        }
示例#26
0
        private void automation_EditContent(object sender, AnnEditContentEventArgs e)
        {
            var automation = _documentViewer.Annotations.Automation;

            if (automation == null)
            {
                return;
            }

            e.Cancel = true;

            RemoveAutomationTextBox(true);

            AnnObject targetObject = e.TargetObject;

            if (targetObject == null)
            {
                return;
            }

            // if text object, we cannot do that. Ignore, the EditText will fire
            var textObject = targetObject as AnnTextObject;

            if (textObject != null)
            {
                return;
            }

            if (sender is AnnDrawDesigner && targetObject.Id != AnnObject.StickyNoteObjectId)
            {
                return;
            }

            using (var dlg = new AutomationUpdateObjectDialog())
            {
                dlg.SetPageVisible(AutomationUpdateObjectDialogPage.Properties, false);
                dlg.SetPageVisible(AutomationUpdateObjectDialogPage.Reviews, false);
                dlg.TargetObject = targetObject;

                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    e.Cancel = false;
                    automation.InvalidateObject(targetObject);
                }
            }
        }
        public AutomationSimpleObjectsListItem(AnnContainer annContainer, AnnObject annObject)
        {
            if (annContainer == null)
            {
                throw new ArgumentNullException("annContainer");
            }
            if (annObject == null)
            {
                throw new ArgumentNullException("annObject");
            }
            if (annObject.Id == AnnObject.SelectObjectId || annObject.Id == AnnObject.None)
            {
                throw new ArgumentException("Cannot create this item with a selection or none annotation object", "annObject");
            }

            _annContainer = annContainer;
            _annObject    = annObject;
        }
示例#28
0
        private AnnContainer GetContainer(MedicalViewerMultiCell cell, AnnObject annotationObject)
        {
            int index  = 0;
            int length = cell.SubCells.Count;

            AnnContainer container;

            for (index = 0; index < length; index++)
            {
                container = cell.SubCells[index].AnnotationContainer;

                if (container.Children.IndexOf(annotationObject) != -1)
                {
                    return(container);
                }
            }
            return(null);
        }
        public AutomationObjectDescriptor(AnnObject editObject, AnnResources resources, AnnAutomation automation)
        {
            if (editObject == null)
            {
                throw new ArgumentNullException("editObject");
            }
            if (resources == null)
            {
                throw new ArgumentNullException("resources");
            }

            _object          = editObject;
            _type            = _object.GetType();
            _friendlyName    = GetFriendlyName();
            _resources       = resources;
            _automation      = automation;
            _selectionObject = automation.CurrentEditObject as AnnSelectionObject;
        }
示例#30
0
        private void HandleObject(AnnObject annObject)
        {
            Type t = annObject.GetType();
            
            if ("AnnStampObject".Equals(t.Name, StringComparison.CurrentCultureIgnoreCase))
             {
                 string fileName = null;
                 
                if ( TifEditor._CHECK_MARK_NAME.Equals(annObject.Name,StringComparison.OrdinalIgnoreCase ) )
                {
                    
                    AnnStampObject obj = (AnnStampObject)annObject; 
                    if (obj.Picture.Image == null)
                    {
                        obj.Picture = new AnnPicture(Image.FromHbitmap(ImageEdit.CheckmarkOnly.GetHbitmap()));
                        editor.Viewer.Invalidate(obj.InvalidRectangle);
                    }

                    // keep selecting
                    this.Editor.AnnAutomation.Manager.CurrentObjectId = AnnAutomationManager.UserObjectId;
                  
                }
                else 
                {
                    fileName = GetSignatureFileName();
                    AnnStampObject obj = (AnnStampObject)annObject;
                    obj.Text = "";
                    if (obj.Picture.Image == null)
                    {
                        if (fileName != null && File.Exists(fileName))
                        {
                            obj.Picture = new AnnPicture(Image.FromFile(fileName));
                            editor.Viewer.Invalidate(obj.InvalidRectangle);
                        }
                        else
                        {
                            obj.Text = "Signature is missing";
                        }
                    }
                
               }

            }          
        }
示例#31
0
        private static void GetNode(TreeView treeView, TreeNode node, AnnObject annObject, AnnReview parentReview)
        {
            var nodeReview = node != null ? node.Tag as AnnReview : null;
            var review     = nodeReview != null?nodeReview.Clone() : null;

            foreach (TreeNode childNode in node.Nodes)
            {
                GetNode(treeView, childNode, annObject, review);
            }

            if (parentReview != null)
            {
                parentReview.Replies.Add(review);
            }
            else
            {
                annObject.Reviews.Add(review);
            }
        }
示例#32
0
 private void ShowPropertyDialog(AnnObject annObject)
 {
         if (IsEligible(annObject))
         {
             AnnTextObject textObj = annObject as AnnTextObject;
             if (textObj != null)
             {
                 PropertyForm.userData = textObj.Text;
                 editor.AnnAutomation.ShowObjectPropertiesDialog();
                 textObj.Text = PropertyForm.userData;
                 editor.AnnAutomation.Container.Objects.Add(textObj);
                 editor.AnnAutomation.Viewer.Invalidate(textObj.InvalidRectangle);                        
             }
             
         }
 }
示例#33
0
 private bool IsEligible(AnnObject annObject)
 {
     string[] objectList = new string[] { "AnnTextObject", "AnnNoteObject" };
     Type type = annObject.GetType();
     if (Array.IndexOf(objectList,type.Name) >= 0){
         return true;
     }
     return false;
 }
示例#34
0
文件: DROC.cs 项目: khaha2210/radio
 /// <summary>
 /// Hàm xác định Boundary thực của một Rectangle trên ảnh. Phục vụ việc Crop ảnh đúng vị trí được khoang vùng.
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 private AnnRectangle GetObjectRealBoundingRectangle(AnnObject obj)
 {
     return _DicomMedicalViewer.GetObjectRealBoundingRectangle(obj);
 }
示例#35
0
文件: DROC.cs 项目: khaha2210/radio
 private AnnRectangle GetObjectRealBoundingRectangle(AnnObject obj,AnnContainer container)
 {
     return _DicomMedicalViewer.GetObjectRealBoundingRectangle(obj, container);
 }