예제 #1
0
        protected ShapeEngine(ShapeEngine src)
        {
            DrawingLayer = src.DrawingLayer;
            ShapeType    = src.ShapeType;
            AntiAliasing = src.AntiAliasing;
            Closed       = src.Closed;
            OutlineColor = src.OutlineColor.Clone();
            FillColor    = src.OutlineColor.Clone();
            BrushWidth   = src.BrushWidth;

            // Don't clone the GeneratedPoints or OrganizedPoints, as they will be calculated.
            ControlPoints = src.ControlPoints.Select(i => i.Clone()).ToList();
            DashPattern   = src.DashPattern;
        }
예제 #2
0
        protected ShapeEngine(ShapeEngine src)
        {
            DrawingLayer = src.DrawingLayer;
            ShapeType    = src.ShapeType;
            AntiAliasing = src.AntiAliasing;
            Closed       = src.Closed;
            OutlineColor = src.OutlineColor.Clone();
            FillColor    = src.FillColor.Clone();
            BrushWidth   = src.BrushWidth;

            // Don't clone the GeneratedPoints or OrganizedPoints, as they will be calculated.
            ControlPoints = src.ControlPoints.Select(i => i.Clone()).ToList();
            DashPattern   = src.DashPattern;
            parent_layer  = null !;           // NRT - This constructor needs to set parent_layer somehow as code expects it to be not-null
        }
예제 #3
0
        /// <summary>
        /// Converts the ShapeEngine instance into a new instance of a different ShapeEngine (child) type, copying the common data.
        /// </summary>
        /// <param name="newShapeType">The new ShapeEngine type to create.</param>
        /// <param name="shapeIndex">The index to insert the ShapeEngine clone into SEngines at.
        /// This ensures that the clone is as transparent as possible.</param>
        /// <returns>A new ShapeEngine instance of the specified type with the common data copied over.</returns>
        public ShapeEngine GenericClone(BaseEditEngine.ShapeTypes newShapeType, int shapeIndex)
        {
            //Remove the old ShapeEngine instance.
            BaseEditEngine.SEngines.Remove(this);

            ShapeEngine clonedEngine;

            switch (newShapeType)
            {
            case BaseEditEngine.ShapeTypes.ClosedLineCurveSeries:
                clonedEngine = new LineCurveSeriesEngine(parentLayer, DrawingLayer, newShapeType, AntiAliasing, true,
                                                         OutlineColor, FillColor, BrushWidth);

                break;

            case BaseEditEngine.ShapeTypes.Ellipse:
                clonedEngine = new EllipseEngine(parentLayer, DrawingLayer, AntiAliasing, OutlineColor, FillColor, BrushWidth);

                break;

            case BaseEditEngine.ShapeTypes.RoundedLineSeries:
                clonedEngine = new RoundedLineEngine(parentLayer, DrawingLayer, RoundedLineEditEngine.DefaultRadius,
                                                     AntiAliasing, OutlineColor, FillColor, BrushWidth);

                break;

            default:
                //Defaults to OpenLineCurveSeries.
                clonedEngine = new LineCurveSeriesEngine(parentLayer, DrawingLayer, newShapeType, AntiAliasing, false,
                                                         OutlineColor, FillColor, BrushWidth);

                break;
            }

            clonedEngine.ControlPoints = ControlPoints.Select(i => i.Clone()).ToList();

            //Don't clone the GeneratedPoints or OrganizedPoints, as they will be calculated.

            clonedEngine.DashPattern = DashPattern;

            //Add the new ShapeEngine instance at the specified index to ensure as transparent of a cloning as possible.
            BaseEditEngine.SEngines.Insert(shapeIndex, clonedEngine);

            return(clonedEngine);
        }
예제 #4
0
        /// <summary>
        /// Create a new ShapeEngine.
        /// </summary>
        /// <param name="passedParentLayer">The parent UserLayer for the ReEditable DrawingLayer.</param>
        /// <param name="passedDrawingLayer">An existing ReEditableLayer to reuse. This is for cloning only. If not cloning, pass in null.</param>
        /// <param name="passedShapeType">The type of shape to create.</param>
        /// <param name="passedAA">Whether or not antialiasing is enabled.</param>
        /// <param name="passedClosed">Whether or not the shape is closed (first and last points are connected).</param>
        /// <param name="passedOutlineColor">The outline color for the shape.</param>
        /// <param name="passedFillColor">The fill color for the shape.</param>
        /// <param name="passedBrushWidth">The width of the outline of the shape.</param>
        public ShapeEngine(UserLayer passedParentLayer, ReEditableLayer passedDrawingLayer, BaseEditEngine.ShapeTypes passedShapeType,
                           bool passedAA, bool passedClosed, Color passedOutlineColor, Color passedFillColor, int passedBrushWidth)
        {
            parentLayer = passedParentLayer;

            if (passedDrawingLayer == null)
            {
                DrawingLayer = new ReEditableLayer(parentLayer);
            }
            else
            {
                DrawingLayer = passedDrawingLayer;
            }

            ShapeType    = passedShapeType;
            AntiAliasing = passedAA;
            Closed       = passedClosed;
            OutlineColor = passedOutlineColor.Clone();
            FillColor    = passedFillColor.Clone();
            BrushWidth   = passedBrushWidth;
        }
예제 #5
0
        /// <summary>
        /// Create a new ShapeEngine.
        /// </summary>
        /// <param name="parent_layer">The parent UserLayer for the ReEditable DrawingLayer.</param>
        /// <param name="drawing_layer">An existing ReEditableLayer to reuse. This is for cloning only. If not cloning, pass in null.</param>
        /// <param name="shape_type">The type of shape to create.</param>
        /// <param name="antialiasing">Whether or not antialiasing is enabled.</param>
        /// <param name="closed">Whether or not the shape is closed (first and last points are connected).</param>
        /// <param name="outline_color">The outline color for the shape.</param>
        /// <param name="fill_color">The fill color for the shape.</param>
        /// <param name="brush_width">The width of the outline of the shape.</param>
        public ShapeEngine(UserLayer parent_layer, ReEditableLayer?drawing_layer,
                           BaseEditEngine.ShapeTypes shape_type, bool antialiasing,
                           bool closed, Color outline_color, Color fill_color,
                           int brush_width)
        {
            this.parent_layer = parent_layer;

            if (drawing_layer == null)
            {
                DrawingLayer = new ReEditableLayer(parent_layer);
            }
            else
            {
                DrawingLayer = drawing_layer;
            }

            ShapeType    = shape_type;
            AntiAliasing = antialiasing;
            Closed       = closed;
            OutlineColor = outline_color.Clone();
            FillColor    = fill_color.Clone();
            BrushWidth   = brush_width;
        }
예제 #6
0
 /// <summary>
 /// Create a new LineCurveSeriesEngine.
 /// </summary>
 /// <param name="parent_layer">The parent UserLayer for the re-editable DrawingLayer.</param>
 /// <param name="drawing_layer">An existing ReEditableLayer to reuse. This is for cloning only. If not cloning, pass in null.</param>
 /// <param name="shape_type">The owner EditEngine.</param>
 /// <param name="antialiasing">Whether or not antialiasing is enabled.</param>
 /// <param name="closed">Whether or not the shape is closed (first and last points are connected).</param>
 /// <param name="outline_color">The outline color for the shape.</param>
 /// <param name="fill_color">The fill color for the shape.</param>
 /// <param name="brush_width">The width of the outline of the shape.</param>
 public LineCurveSeriesEngine(UserLayer parentLayer, ReEditableLayer?passedDrawingLayer, BaseEditEngine.ShapeTypes passedShapeType,
                              bool passedAA, bool passedClosed, Color passedOutlineColor, Color passedFillColor, int passedBrushWidth) : base(parentLayer,
                                                                                                                                              passedDrawingLayer, passedShapeType, passedAA, passedClosed, passedOutlineColor, passedFillColor, passedBrushWidth)
 {
 }