예제 #1
0
 public static void ValidateSettings(AnnotationRunnerSettings settings)
 {
     if (settings.ShapeType == AnnotationShapeType.Point)
     {
         if (!settings.AutoFinishAnnotation)
         {
             throw new ArgumentException("Point annotations must always be auto-finished");
         }
         if (settings.AnnotationPointCountRange.From != 1 ||
             settings.AnnotationPointCountRange.To != 1)
         {
             throw new ArgumentException($"Point count must be 1 for shape '{nameof(AnnotationShapeType.Point)}'");
         }
     }
     if (settings.ShapeType == AnnotationShapeType.Line)
     {
         if (!settings.AutoFinishAnnotation)
         {
             throw new ArgumentException("Line annotations must always be auto-finished");
         }
         if (settings.AnnotationPointCountRange.From != 2 ||
             settings.AnnotationPointCountRange.To != 2)
         {
             throw new ArgumentException($"Point count must be 2 for shape '{nameof(AnnotationShapeType.Line)}'");
         }
     }
 }
예제 #2
0
 protected AnnotationRunnerBase(AnnotationRunnerSettings settings)
 {
     this.settings = settings;
     AnnotationRunnerSettingsValidator.ValidateSettings(settings);
     Id          = settings.AnnotationRunnerId;
     ButtonText  = settings.InactiveButtonText;
     Instruction = settings.Instruction;
 }
 public DistanceMeasurementAnnotationRunner(AnnotationRunnerSettings settings, Calibration calibration)
     : base(settings)
 {
     if (settings.ShapeType != AnnotationShapeType.Line)
     {
         throw new ArgumentException(
                   $"Annotation shape type must be '{nameof(AnnotationShapeType.Line)}' " +
                   $"for {nameof(DistanceMeasurementAnnotationRunner)}");
     }
     pinholeToPlaneProjection = new PinholeToPlaneProjection(calibration);
     AnnotationFinished      += PerformMeasurement;
 }
예제 #4
0
 public ShapeAnnotationRunner(AnnotationRunnerSettings settings)
     : base(settings)
 {
 }