Ejemplo n.º 1
0
 public HttpRequest(string url, string method, string body, string property, DrawsomeShape shape) : base(shape)
 {
     this.Type     = "Microsoft.HttpRequest";
     this.Url      = url;
     this.Method   = method;
     this.Body     = body;
     this.Property = property;
 }
Ejemplo n.º 2
0
        public SetProperty(string expression, DrawsomeShape shape) : base(shape)
        {
            var splitted = expression.Split(new char[] { '=' });

            this.Property = splitted.FirstOrDefault();
            this.Value    = splitted.LastOrDefault();
            this.Type     = "Microsoft.SetProperty";
        }
Ejemplo n.º 3
0
 public HttpRequest(string content, DrawsomeShape shape) : base(shape)
 {
     this.Type = "Microsoft.HttpRequest";
     if (content.ToLower().Contains("weather"))
     {
         this.Url    = "https://api.openweathermap.org/data/2.5/weather?q=Suzhou&appid=f6abd7e76544272a97a0f1e9c2188219";
         this.Method = "GET";
     }
 }
Ejemplo n.º 4
0
        public DrawsomePic(InkRecognitionRoot root, List <InkRecognizerStroke> inkStrokes, int hookUpDistance)
        {
            this.HookUpDistance = hookUpDistance;
            this.InkRoot        = root;
            if (root.GetShapes().Count() == 0)
            {
                throw new Exception("The Graph is Empty");
            }

            //this.Root = new DrawsomeShape(root.GetShapes().ToList().OrderBy(item => item.BoundingRect.TopY).First());

            // get all recognized shapes and set the text belonged to them
            foreach (var shape in root.GetShapes())
            {
                var shapeToAdd = new DrawsomeShape(shape)
                {
                    Text = root.GetLines().ToList().FindAll(item => shape.Contains(item)).FirstOrDefault()?.RecognizedText
                };
                if (shapeToAdd.Type != ShapeType.Drawing)
                {
                    // add all shapes except line
                    this.AllShapes.Add(shapeToAdd);
                }
            }

            // units include lines and shapes and texts
            foreach (var unit in root.GetUnits())
            {
                var unitToAdd = new DrawsomeObj(unit);
                this.AllUnits.Add(unitToAdd);
            }

            var inkLines = root.GetUnits().Where(item => (item as InkDrawing)?.RecognizedShape == DrawingShapeKind.Drawing).Where(item => item.BoundingRect.Width + item.BoundingRect.Height > 20);



            foreach (var line in inkLines)
            {
                this.AllLines.Add(new DrawsomeLine(line, inkStrokes, 3, HookUpDistance));
            }

            // we iterate each shape to detect the next and previous line
            foreach (var dShape in this.AllShapes)
            {
                var nextLines = this.AllLines.OrderByDescending(item => dShape.OverlapSizeWithLinesBegin(item, item.LittleRects.Count / 10)).Where(item => dShape.OverlapSizeWithLinesBegin(item, item.LittleRects.Count / 10) != 0);
                foreach (var nextLine in nextLines)
                {
                    dShape.Next.Add(nextLine);
                }

                var prevLines = this.AllLines.OrderByDescending(item => dShape.OverlapSizeWithLinesEnd(item, item.LittleRects.Count / 10)).Where(item => dShape.OverlapSizeWithLinesEnd(item, item.LittleRects.Count / 10) != 0);
                foreach (var prevLine in prevLines)
                {
                    prevLine.Next.Add(dShape);
                }
            }

            // reorder the next of each shape to ensure the colored lines behind
            foreach (var dShape in this.AllShapes)
            {
                dShape.Next.Sort((A, B) => (A as DrawsomeLine)?.MainStroke.inkStrokeInternal.DrawingAttributes.Color.R > (B as DrawsomeLine)?.MainStroke.inkStrokeInternal.DrawingAttributes.Color.R ? 1 : -1);
            }

            this.Root = this.AllShapes.OrderBy(item => item.RecogUnit.BoundingRect.TopY).FirstOrDefault();
        }
Ejemplo n.º 5
0
 public DrawsomePic(DrawsomeShape root)
 {
     this.Root = root;
 }
Ejemplo n.º 6
0
 public TextInput(string content, string property, DrawsomeShape shape) : base(shape)
 {
     this.Prompt   = content;
     this.Type     = "Microsoft.TextInput";
     this.Property = property;
 }
Ejemplo n.º 7
0
 public IfCondition(string condition, DrawsomeShape shape) : base(shape)
 {
     this.Condition = condition;
     this.Type      = "Microsoft.IfCondition";
 }
Ejemplo n.º 8
0
 public SendActivity(string text, DrawsomeShape shape) : base(shape)
 {
     this.Activity = text;
     this.Type     = "Microsoft.SendActivity";
 }
Ejemplo n.º 9
0
 public ComposerStep(DrawsomeObj shape)
 {
     this.RelatedShape = shape as DrawsomeShape;
 }