コード例 #1
0
ファイル: CurveToShow.cs プロジェクト: nearcoding/GAP
 public void AddAnnotationByAnnotationAndSubDatasetObject(AnnotationInfo annotation, SubDataset subDataset, CurveToShow curveToShow, string uniqueAnnotationName)
 {
     if (string.IsNullOrWhiteSpace(uniqueAnnotationName))
         throw new Exception("Annotation does not have unique name");
     var lineAnnotation = HelperMethods.Instance.GetLineAnnotationByAnnotationInfoAndSubDataset(annotation, subDataset, curveToShow);
     lineAnnotation.Id = uniqueAnnotationName;
     LineAnnotationExtendedBinding(lineAnnotation);
     AddAnnotation(lineAnnotation);
 }
コード例 #2
0
ファイル: CurveToShow.cs プロジェクト: nearcoding/GAP
        void AnnotationModifier_AnnotationCreated(object sender, EventArgs e)
        {
            if (CurrentSubDataset == null) throw new Exception("Current sub dataset is null while adding annotation");
            var currentAnnotation = AnnotationModifier.Annotation as LineAnnotationExtended;

            if (currentAnnotation == null) return;
            var lineAnnotation = ReplaceLineAnnotationWithLineAnnotationExtended();

            LineAnnotationExtendedBinding(lineAnnotation);

            lineAnnotation.CoordinateMode = AnnotationCoordinateMode.Absolute;

            lineAnnotation.IsEditable = false;
            lineAnnotation.IsEnabled = false;
            AnnotationModifier.IsEnabled = false;
            AnnotationModifier.IsEnabled = true;

            AnnotationInfo info = new AnnotationInfo
            {
                ID = lineAnnotation.Id,
                X1 = lineAnnotation.X1.ToString(),
                X2 = lineAnnotation.X2.ToString(),
                Y1 = lineAnnotation.Y1.ToString(),
                Y2 = lineAnnotation.Y2.ToString(),
                SubDatasetName = CurrentSubDataset.Dataset
            };

            var annotationRecorder = new AnnotationRecorder
                {
                    AnnotationInfo = info,
                    LineAnnotation = lineAnnotation,
                    ActionPerformed = BL.ActionPerformed.ItemAdded,
                    TrackToShow = TrackToShowObject
                };

            AnnotationAdded(annotationRecorder, this, lineAnnotation);
        }