Exemple #1
0
        public DrawingPolyline(PointF origin, long timestamp, long averageTimeStampsPerFrame, DrawingStyle preset = null)
        {
            points["0"] = origin;
            points["1"] = origin;

            if (preset == null)
            {
                preset = ToolManager.GetStylePreset("Polyline");
            }

            style = preset.Clone();
            BindStyle();

            infosFading = new InfosFading(timestamp, averageTimeStampsPerFrame);

            mnuFinish.Click        += mnuFinish_Click;
            mnuAddThenFinish.Click += mnuAddThenFinish_Click;
            mnuCloseMenu.Click     += mnuCloseMenu_Click;

            mnuFinish.Image        = Properties.Drawings.tick_small;
            mnuAddThenFinish.Image = Properties.Drawings.plus_small;
            mnuCloseMenu.Image     = Properties.Drawings.cross_small;
        }
Exemple #2
0
        public DrawingCircle(PointF center, long timestamp, long averageTimeStampsPerFrame, DrawingStyle preset = null, IImageToViewportTransformer transformer = null)
        {
            this.center = center;

            if (transformer != null)
            {
                this.radius = transformer.Untransform(25);
            }

            this.radius      = Math.Min(radius, 10);
            this.infosFading = new InfosFading(timestamp, averageTimeStampsPerFrame);

            styleHelper.Color    = Color.Empty;
            styleHelper.LineSize = 1;

            if (preset == null)
            {
                preset = ToolManager.GetStylePreset("Circle");
            }

            style = preset.Clone();
            BindStyle();
        }
Exemple #3
0
 public DrawingPencil(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper, Metadata parent)
     : this(PointF.Empty, 0, 0, ToolManager.GetStylePreset("Pencil"))
 {
     ReadXml(xmlReader, scale, timestampMapper);
 }
Exemple #4
0
        /// <summary>
        /// Get the cursor for the passed tool.
        /// This must be called every time the active tool changes or the image scale changes.
        /// </summary>
        public Cursor GetToolCursor(AbstractDrawingTool tool, double stretchFactor)
        {
            if (tool is DrawingToolPointer)
            {
                return(((DrawingToolPointer)tool).GetCursor());
            }

            // Custom cursors.
            // The general guideline is that
            // - We try to use custom cursor where it make sense like for pencil.
            // - Otherwise we fallback to either precision cross or the tool icon.
            // - Drawings that splat themselves at once on the canvas (no dragging a second leg), should use the icon,
            // - Drawings that are created in several steps should use the precision cross.

            if (tool is DrawingToolGenericPosture || tool is DrawingToolAutoNumbers)
            {
                // Many of the GenericPosture tools have a color style element that doesn't really serve any purpose,
                // as the lines making the drawing can have their own color defined in the XML.
                // They are also drawn at once on the canvas like a stamp.
                // So for these we reuse the drawing tool icon as a cursor.
                return(GetCursorIcon(tool));
            }
            else if (tool is DrawingTool)
            {
                // These are the standard tool but defined in XML.
                // For these we try to use a precision cursor or a semantic one.
                DrawingStyle style = ToolManager.GetStylePreset(tool.Name);

                if (tool.Name == "Pencil")
                {
                    return(GetCursorPencil(style, stretchFactor));
                }
                else if (tool.Name == "CrossMark")
                {
                    return(GetCursorCrossMark(style));
                }
                else if (tool.Name == "Grid" ||
                         tool.Name == "Plane" ||
                         tool.Name == "DistortionGrid" ||
                         tool.Name == "Label")
                {
                    // These are stamp-like.
                    return(GetCursorIcon(tool));
                }
                else
                {
                    return(GetCursorPrecision(style, false));
                }
            }
            else if (tool is DrawingToolCoordinateSystem ||
                     tool is DrawingToolMagnifier ||
                     tool is DrawingToolSpotlight ||
                     tool is DrawingToolTestGrid)
            {
                // Special internal tools.
                // Still nice to use a precision cursor with them, but the color might not make sense.
                DrawingStyle style = ToolManager.GetStylePreset(tool.Name);
                return(GetCursorPrecision(style, false));
            }
            else
            {
                return(null);
            }
        }
 private void BindStyle()
 {
     DrawingStyle.SanityCheck(style, ToolManager.GetStylePreset("DistortionGrid"));
     style.Bind(styleHelper, "Color", "color");
 }
Exemple #6
0
 private void BindStyle()
 {
     DrawingStyle.SanityCheck(style, ToolManager.GetStylePreset("CrossMark"));
     style.Bind(styleHelper, "Color", "back color");
 }
Exemple #7
0
 public DrawingPlane(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper, Metadata parent)
     : this(false, 0, 0, ToolManager.GetStylePreset("Grid"))
 {
     ReadXml(xmlReader, scale, timestampMapper);
 }
 private void BindStyle()
 {
     DrawingStyle.SanityCheck(style, ToolManager.GetStylePreset("Angle"));
     style.Bind(styleHelper, "Bicolor", "line color");
 }
Exemple #9
0
 private void BtnOK_Click(object sender, EventArgs e)
 {
     ToolManager.SavePresets();
     manualClose = true;
 }
Exemple #10
0
 private void BindStyle()
 {
     DrawingStyle.SanityCheck(style, ToolManager.GetStylePreset("Label"));
     style.Bind(styleHelper, "Bicolor", "back color");
     style.Bind(styleHelper, "Font", "font size");
 }
Exemple #11
0
        private static AbstractDrawing CreateDrawing(Metadata metadata, long timestamp, OpenPosePerson person)
        {
            // We only support files created using the BODY_25 model, not COCO or MPI.
            if (person.pose_keypoints_2d != null && person.pose_keypoints_2d.Count != 75)
            {
                return(null);
            }

            string toolName = "OpenPoseBody25";
            DrawingToolGenericPosture tool = ToolManager.Tools[toolName] as DrawingToolGenericPosture;

            if (tool == null)
            {
                return(null);
            }

            GenericPosture posture = GenericPostureManager.Instanciate(tool.ToolId, true);

            ParsePosture(posture, person);

            DrawingGenericPosture drawing = new DrawingGenericPosture(tool.ToolId, PointF.Empty, posture, timestamp, metadata.AverageTimeStampsPerFrame, ToolManager.GetStylePreset(toolName));

            drawing.Name = "OpenPose";

            // Disable onion skinning.
            drawing.InfosFading.UseDefault                = false;
            drawing.InfosFading.ReferenceTimestamp        = timestamp;
            drawing.InfosFading.AverageTimeStampsPerFrame = metadata.AverageTimeStampsPerFrame;
            drawing.InfosFading.AlwaysVisible             = false;
            drawing.InfosFading.OpaqueFrames              = 1;
            drawing.InfosFading.FadingFrames              = 0;

            return(drawing);
        }
Exemple #12
0
 public DrawingText(PointF p, long timestamp, long averageTimeStampsPerFrame, string text)
     : this(p, timestamp, averageTimeStampsPerFrame, ToolManager.GetStylePreset("Label"))
 {
     this.text = TextHelper.FixMissingCarriageReturns(text);
     UpdateLabelRectangle();
 }
Exemple #13
0
 public DrawingCrossMark(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper, Metadata parent)
     : this(PointF.Empty, 0, 0, ToolManager.GetStylePreset("CrossMark"), null)
 {
     ReadXml(xmlReader, scale, timestampMapper);
 }