Example #2
0
        public static string AnnotationTargetPluralName(AnnotationTarget annotationTarget)
        {
            switch (annotationTarget)
            {
            case AnnotationTarget.protein:
                return(Resources.AnnotationDef_AnnotationTarget_Proteins);

            case AnnotationTarget.peptide:
                return(Resources.AnnotationDef_AnnotationTarget_Peptides);

            case AnnotationTarget.precursor:
                return(Resources.AnnotationDef_AnnotationTarget_Precursors);

            case AnnotationTarget.transition:
                return(Resources.AnnotationDef_AnnotationTarget_Transitions);

            case AnnotationTarget.replicate:
                return(Resources.AnnotationDef_AnnotationTarget_Replicates);

            case AnnotationTarget.precursor_result:
                return(Resources.AnnotationDef_AnnotationTarget_PrecursorResults);

            case AnnotationTarget.transition_result:
                return(Resources.AnnotationDef_AnnotationTarget_TransitionResults);

            default:
                throw new ArgumentException(string.Format(@"Invalid annotation target: {0}", annotationTarget), nameof(annotationTarget));     // CONSIDER: localize?
            }
        }
Example #3
0
 protected AnnotationBase(string name, AnnotationTarget target, int requiredArguments = 0, int?allowedArguments = 0, IReadOnlyList <AnnotationArgumentType> allowedArgumentTypes = null, bool allowMultiple = false)
 {
     Name                 = name;
     Target               = target;
     AllowMultiple        = allowMultiple;
     RequiredArguments    = requiredArguments;
     AllowedArguments     = allowedArguments;
     AllowedArgumentTypes = allowedArgumentTypes ?? new List <AnnotationArgumentType>();
 }
        public static AnnotationTargetModel ToModel(this AnnotationTarget entity)
        {
            AnnotationTargetModel model = null;

            if (entity != null)
            {
                model = new AnnotationTargetModel
                {
                    Id       = entity.AnnotationTargetId,
                    SourceId = entity.AnnotationSourceId,
                    // Source = entity.Source.ToModel(),
                    CoordinateX = entity.CoordinateX,
                    CoordinateY = entity.CoordinateY,
                    Height      = entity.Height,
                    Width       = entity.Width
                };
            }

            return(model);
        }
        public static AnnotationTarget ToEntity(this AnnotationTargetModel model, AnnotationTarget entity = null)
        {
            AnnotationTarget rt = null;

            if (model != null)
            {
                if (entity == null)
                {
                    rt = new AnnotationTarget
                    {
                        AnnotationTargetId = model.Id,
                    };
                }
                else
                {
                    rt = entity;
                }

                return(PopulateEntity(model, rt));
            }

            return(rt);
        }
 protected FlexibleAttributeAnnotationBase(string name, AnnotationTarget target, IReadOnlyList <AnnotationArgumentType> allowedArgumentType, bool allowMultiple = false)
     : base(name, target, 2, null, allowedArgumentType, allowMultiple) //We need at least the attribute name and one value for it.
 {
 }
Example #7
0
 protected FlexibleAttributeValueAnnotationBase(string name, AnnotationTarget target, string attribute, int numberOfValues)
     : base(name, target)
 {
     _attribute      = attribute;
     _numberOfValues = numberOfValues;
 }
Example #8
0
 public DescriptionAttributeAnnotationBase(string name, AnnotationTarget target, string attribute)
     : base(name, target, attribute, 1, new List <AnnotationArgumentType> {
     AnnotationArgumentType.Text
 })
 {
 }
Example #9
0
 public AnnotationBase(string name, AnnotationTarget target, bool allowMultiple = false)
 {
     Name          = name;
     Target        = target;
     AllowMultiple = allowMultiple;
 }
Example #10
0
 public DescriptionAttributeAnnotationBase(string name, AnnotationTarget target, string attribute, int valueCount)
     : base(name, target, attribute, valueCount)
 {
 }
 protected FlexibleAttributeValueAnnotationBase(string name, AnnotationTarget target, string attribute, int numberOfValues, IReadOnlyList <AnnotationArgumentType> argumentTypes)
     : base(name, target, numberOfValues, numberOfValues, argumentTypes)
 {
     _attribute      = attribute;
     _numberOfValues = numberOfValues;
 }
 protected FlexibleAttributeAnnotationBase(string name, AnnotationTarget target, bool allowMultiple = false)
     : base(name, target, allowMultiple)
 {
 }
 private static AnnotationTarget PopulateEntity(this AnnotationTargetModel model, AnnotationTarget entity)
 {
     if (model != null)
     {
         entity.CoordinateX        = model.CoordinateX;
         entity.CoordinateY        = model.CoordinateY;
         entity.Height             = model.Height;
         entity.Width              = model.Width;
         entity.AnnotationSourceId = model.SourceId;
     }
     return(entity);
 }