Пример #1
0
 public Mistake(int seriousness, string text, BoundingBox bbox, ALL_MISTAKES type)
 {
     Id          = Guid.NewGuid();
     Seriousness = seriousness;
     Text        = text;
     Bbox        = bbox;
     this.type   = type;
 }
        /**
         * Созадние ошибки, не содержащей ссылки не на какой элемент
         */
        public static void createMistake(Level level, string mistake, ALL_MISTAKES type)
        {
            if (diagram == null)
            {
                return;
            }
            var bbox = new BoundingBox(noCoordinates, noCoordinates, noCoordinates, noCoordinates);

            diagram.Mistakes.Add(new Mistake(levelAdapter(level), mistake, bbox, type));
        }
        public static Mistake Create(int seriousness, string text, Element element, ALL_MISTAKES type)
        {
            var bbox = new BoundingBox(element.X, element.Y, element.W, element.H);

            return(new Mistake(seriousness, text, bbox, type));
        }
        public static Mistake Create(int seriousness, string text, ALL_MISTAKES type)
        {
            var bbox = new BoundingBox(int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue);

            return(new Mistake(seriousness, text, bbox, type));
        }
        /**
         * Ошибки для переходов и для дорожек
         */
        public static void createMistake(Level level, string mistake, BaseNode element, ALL_MISTAKES type)
        {
            if (diagram == null)
            {
                return;
            }
            if (element is Swimlane)
            {
                mistake = "Дорожка участника '" + ((Swimlane)element).getName() + "': " + mistake;
            }
            if (element is ControlFlow)
            {
                mistake = "Переход '" + ((ControlFlow)element).getText() + "': " + mistake;
            }


            var bbox = new BoundingBox(element.X, element.Y, element.Width, element.Height);

            diagram.Mistakes.Add(new Mistake(levelAdapter(level), mistake, bbox, type));
        }
        /**
         * Создание ошибки, содержащей элемент диаграммы
         */

        public static void createMistake(Level level, string mistake, ADNodesList.ADNode element, ALL_MISTAKES type)
        {
            if (diagram == null)
            {
                return;
            }
            var    tmp   = (DiagramElement)element.getValue();
            string descr = tmp is DecisionNode ? ((DecisionNode)tmp).getQuestion() : tmp.getDescription();

            var bbox = new BoundingBox(tmp.X, tmp.Y, tmp.Width, tmp.Height);

            descr = descr == ""?descr:(" '" + descr + "'");
            diagram.Mistakes.Add(new Mistake(levelAdapter(level), ElementTypeAdapter.toString(tmp.getType()) + descr + ": " + mistake, bbox, type));
        }