コード例 #1
0
        public static G2DPlotStyleCollection GetTemplate(string name, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            var proc = (CreateCollectionProcedure)_CreationProcByName[name];

            if (null != proc)
            {
                return(proc(context));
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
ファイル: PlotCommands.cs プロジェクト: olesar/Altaxo
        public static G2DPlotStyleCollection PlotStyle_Line_Symbol(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            var result = new G2DPlotStyleCollection
            {
                new ScatterPlotStyle(context),
                new LinePlotStyle(context)
                {
                    UseSymbolGap = true
                }
            };

            return(result);
        }
コード例 #3
0
        public ClosedCardinalSpline(IEnumerable <PointD2D> points, double tension, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
            : base(new ItemLocationDirectAutoSize(), context)
        {
            _curvePoints.AddRange(points);
            _tension = Math.Abs(tension);

            if (!(_curvePoints.Count > 2))
            {
                throw new ArgumentException("Number of curve points has to be > 2");
            }

            CalculateAndSetBounds();
        }
コード例 #4
0
        protected OpenPathShapeBase(ItemLocationDirect location, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
            : base(location)
        {
            if (null == context)
            {
                context = PropertyExtensions.GetPropertyContextOfProject();
            }

            var penWidth  = GraphDocument.GetDefaultPenWidth(context);
            var foreColor = context.GetValue(GraphDocument.PropertyKeyDefaultForeColor);

            Pen = new PenX3D(foreColor, penWidth);
        }
コード例 #5
0
        /// <summary>
        /// Creates a new instance with default values.
        /// </summary>
        public ColumnDrivenSymbolSizePlotStyle(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            InternalSetScale(new LinearScale());
            InternalSetDataColumnProxy(ReadableColumnProxyBase.FromColumn(new Altaxo.Data.EquallySpacedColumn(0, 0.25)));

            var symbolSizeBase = GraphDocument.GetDefaultSymbolSize(context);

            _symbolSizeAt0     = symbolSizeBase / 2;
            _symbolSizeAt1     = symbolSizeBase * 2;
            _symbolSizeAbove   = symbolSizeBase * 2.5;
            _symbolSizeBelow   = symbolSizeBase / 4;
            _symbolSizeInvalid = 0;
            _numberOfSteps     = 0;
        }
コード例 #6
0
ファイル: TextGraphic.cs プロジェクト: olesar/Altaxo
        public TextGraphic(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
            : base(new ItemLocationDirectAutoSize())
        {
            if (null == context)
            {
                context = PropertyExtensions.GetPropertyContextOfProject();
            }

            _font      = context.GetValue(GraphDocument.PropertyKeyDefaultFont);
            _textBrush = new BrushX(context.GetValue(GraphDocument.PropertyKeyDefaultForeColor))
            {
                ParentObject = this
            };
        }
コード例 #7
0
        public DropLinePlotStyle(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            _dropTargets = new CSPlaneIDList(new[] { new CSPlaneID(2, 0) });

            var    color    = GraphDocument.GetDefaultPlotColor(context);
            double penWidth = GraphDocument.GetDefaultPenWidth(context);

            _pen = new PenX3D(color, penWidth);

            _lineWidth1Offset = penWidth;
            _lineWidth1Factor = 0;
            _lineWidth2Offset = penWidth;
            _lineWidth2Factor = 0;
        }
コード例 #8
0
ファイル: ClosedPathShapeBase.cs プロジェクト: olesar/Altaxo
        public ClosedPathShapeBase(ItemLocationDirect location, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
            : base(location)
        {
            if (null == context)
            {
                context = PropertyExtensions.GetPropertyContextOfProject();
            }

            var penWidth  = GraphDocument.GetDefaultPenWidth(context);
            var foreColor = context.GetValue(GraphDocument.PropertyKeyDefaultForeColor);

            Brush = new BrushX(NamedColors.Transparent);
            Pen   = new PenX(foreColor, penWidth);
        }
コード例 #9
0
ファイル: DropAreaPlotStyle.cs プロジェクト: olesar/Altaxo
        public DropAreaPlotStyle(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            var penWidth = GraphDocument.GetDefaultPenWidth(context);
            var color    = GraphDocument.GetDefaultPlotColor(context);

            ChildSetMember(ref _framePen, new PenX(NamedColors.Transparent, penWidth)
            {
                LineJoin = LineJoin.Bevel
            });
            _ignoreMissingDataPoints = false;
            ChildSetMember(ref _fillBrush, new BrushX(color));
            _fillDirection   = new CSPlaneID(1, 0);
            _connectionStyle = LineConnectionStyles.StraightConnection.Instance;
        }
コード例 #10
0
ファイル: ScatterPlotStyle.cs プロジェクト: olesar/Altaxo
        public ScatterPlotStyle(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            double penWidth   = GraphDocument.GetDefaultPenWidth(context);
            double symbolSize = GraphDocument.GetDefaultSymbolSize(context);
            var    color      = GraphDocument.GetDefaultPlotColor(context);

            _symbolShape      = ScatterSymbolListManager.Instance.BuiltinDefault[0];
            _material         = new MaterialWithUniformColor(color);
            _independentColor = false;

            _symbolSize = symbolSize;

            _skipFreq = 1;
        }
コード例 #11
0
        public LinePlotStyle(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            var penWidth = GraphDocument.GetDefaultPenWidth(context);
            var color    = GraphDocument.GetDefaultPlotColor(context);

            _linePen = new PenX(color, penWidth)
            {
                LineJoin = LineJoin.Bevel
            };
            _ignoreMissingDataPoints = false;
            _connectionStyle         = LineConnectionStyles.StraightConnection.Instance;
            _independentColor        = false;

            CreateEventChain();
        }
コード例 #12
0
        public G2DPlotStyleCollection(LineScatterPlotStyleKind kind, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            _innerList = new List <IG2DPlotStyle>();

            switch (kind)
            {
            case LineScatterPlotStyleKind.Line:
                Add(new LinePlotStyle(context));
                break;

            case LineScatterPlotStyleKind.Scatter:
                Add(new ScatterPlotStyle(context));
                break;

            case LineScatterPlotStyleKind.LineAndScatter:
                Add(new ScatterPlotStyle(context));
                Add(new LinePlotStyle(context));
                break;
            }
        }
コード例 #13
0
ファイル: GraphDocument.cs プロジェクト: olesar/Altaxo
        /// <summary>
        /// Gets the default major tick length for all graphics in this graph, using the provided property context.
        /// </summary>
        /// <param name="context">The property context.</param>
        /// <returns>Default major tick length in points (1/72 inch).</returns>
        public static double GetDefaultMajorTickLength(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            double result = 8;

            if (null != context)
            {
                var font = context.GetValue(PropertyKeyDefaultFont);
                using (var path = new GraphicsPath())
                {
                    path.AddString("0", GdiFontManager.ToGdi(font).FontFamily, (int)font.Style, (float)font.Size, new PointF(0, 0), StringFormat.GenericTypographic);
                    var bounds = path.GetBounds();

                    if (bounds.Width > 0)
                    {
                        result = 2 * Calc.Rounding.RoundToNumberOfSignificantDigits(bounds.Width / 2, 2, MidpointRounding.ToEven);
                    }
                }
            }
            return(result);
        }
コード例 #14
0
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                _context = _doc.GetPropertyContext();

                if (_doc.AxisLineStyle != null)
                {
                    _axisLineStyleController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc.AxisLineStyle }, typeof(IMVCAController), UseDocument.Directly);
                }
                else
                {
                    _axisLineStyleController = null;
                }

                if (_doc.TickSpacing != null)
                {
                    _tickSpacingController = new TickSpacingController()
                    {
                        UseDocumentCopy = UseDocument.Directly
                    };
                    _tickSpacingController.InitializeDocument(_doc.TickSpacing);
                    Current.Gui.FindAndAttachControlTo(_tickSpacingController);
                }
            }

            if (_view != null)
            {
                _view.AxisTitle             = _doc.TitleText;
                _view.ShowAxisLine          = _doc.IsAxisLineEnabled;
                _view.ShowMajorLabels       = _doc.AreMajorLabelsEnabled;
                _view.ShowMinorLabels       = _doc.AreMinorLabelsEnabled;
                _view.LineStyleView         = _axisLineStyleController == null ? null : _axisLineStyleController.ViewObject;
                _view.ShowCustomTickSpacing = _doc.TickSpacing != null;
                _view.TickSpacingView       = _tickSpacingController != null ? _tickSpacingController.ViewObject : null;
            }
        }
コード例 #15
0
ファイル: BarGraphPlotStyle.cs プロジェクト: olesar/Altaxo
        public BarGraphPlotStyle(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            var color = GraphDocument.GetDefaultPlotColor(context);

            _pen = new PenX3D(color, 1);
        }
コード例 #16
0
 public static G3DPlotStyleCollection GetTemplate(int idx, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
 {
     return(GetTemplate((string)_NamesInOrder[idx], context));
 }
コード例 #17
0
ファイル: EllipseShape.cs プロジェクト: olesar/Altaxo
 public EllipseShape(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
     : base(new ItemLocationDirect(), context)
 {
 }
コード例 #18
0
		private void InternalInitialize()
		{
			_context = _doc.GetPropertyContext();

			AxisStyleController = new AxisStyleController() { UseDocumentCopy = UseDocument.Directly };
			AxisStyleController.MadeDirty += this.EhAxisStyleControllerDirty;

			MajorLabelCondController = new ConditionalDocumentController<AxisLabelStyle>(CreateMajorLabel, RemoveMajorLabel) { UseDocumentCopy = UseDocument.Directly };
			MinorLabelCondController = new ConditionalDocumentController<AxisLabelStyle>(CreateMinorLabel, RemoveMinorLabel) { UseDocumentCopy = UseDocument.Directly };

			AxisStyleController.InitializeDocument(_doc);
			if (_doc.AreMajorLabelsEnabled)
				MajorLabelCondController.InitializeDocument(_doc.MajorLabelStyle);
			if (_doc.AreMinorLabelsEnabled)
				MinorLabelCondController.InitializeDocument(_doc.MinorLabelStyle);
		}
コード例 #19
0
        /// <summary>
        /// Creates a list of plot items from data columns, using a template plot style.
        /// </summary>
        /// <param name="selectedColumns">Columns for which to create plot items.</param>
        /// <param name="xColumnName">Name of the x column. If it is null or empty, or that column is not found in the table, the current assigned x column is used.</param>
        /// <param name="templatePlotStyle">The template plot style used to create the basic plot item.</param>
        /// <param name="processedColumns">On return, contains all columns that where used in creating the plot items. That are
        /// not only the columns given in the first argument, but maybe also columns that are right to those columns in the table and have special kinds, like
        /// labels, yerr, and so on.</param>
        /// <param name="context">Property context used to determine default values, e.g. for the pen width or symbol size.</param>
        /// <returns>List of plot items created.</returns>
        public static List <IGPlotItem> CreatePlotItems(IEnumerable <DataColumn> selectedColumns, string xColumnName, string yColumnName, G3DPlotStyleCollection templatePlotStyle, HashSet <DataColumn> processedColumns, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            var result = new List <IGPlotItem>();

            foreach (DataColumn vcol in selectedColumns)
            {
                if (processedColumns.Contains(vcol))
                {
                    continue;
                }
                else
                {
                    processedColumns.Add(vcol);
                }

                var table       = DataTable.GetParentDataTableOf(vcol);
                var tablecoll   = DataColumnCollection.GetParentDataColumnCollectionOf(vcol);
                int groupNumber = tablecoll.GetColumnGroup(vcol);

                Altaxo.Data.DataColumn xcol, ycol;
                if (!string.IsNullOrEmpty(xColumnName) && null != table && table.ContainsColumn(xColumnName))
                {
                    xcol = table[xColumnName];
                }
                else
                {
                    xcol = null == table ? null : tablecoll.FindXColumnOf(vcol);
                }

                if (!string.IsNullOrEmpty(yColumnName) && null != table && table.ContainsColumn(yColumnName))
                {
                    ycol = table[yColumnName];
                }
                else
                {
                    ycol = null == table ? null : tablecoll.FindYColumnOf(vcol);
                }

                var pa = new XYZColumnPlotData(
                    table,
                    groupNumber,
                    xcol ?? (IReadableColumn) new IndexerColumn(),
                    ycol ?? (IReadableColumn) new ConstantDoubleColumn(0),
                    vcol);

                var ps = templatePlotStyle != null?templatePlotStyle.Clone() : new G3DPlotStyleCollection();

                if (null == table)
                {
                    continue;
                }

                ErrorBarPlotStyle unpairedPositiveError = null;
                ErrorBarPlotStyle unpairedNegativeError = null;

                bool foundMoreColumns = true;
                for (int idx = 1 + tablecoll.GetColumnNumber(vcol); foundMoreColumns && idx < tablecoll.ColumnCount; idx++)
                {
                    DataColumn col = table[idx];
                    switch (tablecoll.GetColumnKind(idx))
                    {
                    case ColumnKind.Label:
                        var labelStyle = new LabelPlotStyle(col, context);
                        ps.Insert(0, labelStyle);
                        break;

                    case ColumnKind.Err:
                        var errStyle = new ErrorBarZPlotStyle(context)
                        {
                            UseCommonErrorColumn = true,
                            CommonErrorColumn    = col as INumericColumn
                        };
                        ps.Add(errStyle);
                        break;

                    case ColumnKind.pErr:
                        if (null != unpairedNegativeError)
                        {
                            unpairedNegativeError.PositiveErrorColumn = col as INumericColumn;
                            ;
                            unpairedNegativeError = null;
                        }
                        else
                        {
                            unpairedPositiveError = new ErrorBarZPlotStyle(context)
                            {
                                UseCommonErrorColumn = false
                            };

                            unpairedPositiveError.PositiveErrorColumn = col as INumericColumn;
                            ps.Add(unpairedPositiveError);
                        }
                        break;

                    case ColumnKind.mErr:
                        if (null != unpairedPositiveError)
                        {
                            unpairedPositiveError.NegativeErrorColumn = col as INumericColumn;
                            unpairedPositiveError = null;
                        }
                        else
                        {
                            unpairedNegativeError = new ErrorBarZPlotStyle(context)
                            {
                                UseCommonErrorColumn = false
                            };
                            unpairedNegativeError.NegativeErrorColumn = col as INumericColumn;
                            ps.Add(unpairedNegativeError);
                        }
                        break;

                    default:
                        foundMoreColumns = false;
                        break;
                    }

                    if (foundMoreColumns)
                    {
                        processedColumns.Add(table[idx]);
                    }
                }

                result.Add(new XYZColumnPlotItem(pa, ps));
            }
            return(result);
        }
コード例 #20
0
ファイル: FillToCurvePlotStyle.cs プロジェクト: olesar/Altaxo
 public FillToCurvePlotStyle(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
 {
     _cachedPaintOneRange = StraightConnection_PaintOneRange;
     FillBrush            = new BrushX(NamedColors.Aqua); // Exception: do not use one of the colors of the default plot color set. Instead, use a light color.
 }
コード例 #21
0
        public BarGraphPlotStyle(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            var color = GraphDocument.GetDefaultPlotColor(context);

            _fillBrush = new BrushX(color);
        }
コード例 #22
0
 public ClosedCardinalSpline(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
     : base(new ItemLocationDirectAutoSize(), context)
 {
 }
コード例 #23
0
ファイル: AxisLabelStyle.cs プロジェクト: olesar/Altaxo
 public AxisLabelStyle(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
     : this(null, context)
 {
 }
コード例 #24
0
ファイル: LineShape.cs プロジェクト: olesar/Altaxo
 public LineShape(double startX, double startY, double endX, double endY, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
     :
     this(new PointD2D(startX, startY), new PointD2D(endX, endY), context)
 {
 }
コード例 #25
0
 public ClosedCardinalSpline(IEnumerable <PointD2D> points, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
     : this(points, DefaultTension, context)
 {
 }
コード例 #26
0
ファイル: LineShape.cs プロジェクト: olesar/Altaxo
 public LineShape(double posX, double posY, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
     : this(new PointD2D(posX, posY), context)
 {
 }
コード例 #27
0
ファイル: LineShape.cs プロジェクト: olesar/Altaxo
 public LineShape(PointD2D startPosition, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
     : base(new ItemLocationDirect(), context)
 {
     Position = startPosition;
 }
コード例 #28
0
 public RegularPolygon(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
     : base(new ItemLocationDirect(), context)
 {
 }
コード例 #29
0
        public static RegularPolygon FromLTRB(double left, double top, double right, double bottom, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            if (left > right)
            {
                Exchange(ref left, ref right);
            }
            if (top > bottom)
            {
                Exchange(ref top, ref bottom);
            }

            var result = new RegularPolygon(context);

            result._location.SizeX     = RADouble.NewAbs(right - left);
            result._location.SizeY     = RADouble.NewAbs(bottom - top);
            result._location.PositionX = RADouble.NewAbs(left);
            result._location.PositionY = RADouble.NewAbs(top);

            return(result);
        }
コード例 #30
0
		private void InternalInitialize()
		{
			_context = _doc.GetPropertyContext();

			AxisStyleCondController = new ConditionalDocumentController<AxisStyle>(CreateAxisStyle, RemoveAxisStyle, CreateAxisStyleController) { UseDocumentCopy = UseDocument.Directly };
			MajorLabelCondController = new ConditionalDocumentController<AxisLabelStyle>(CreateMajorLabel, RemoveMajorLabel) { UseDocumentCopy = UseDocument.Directly };
			MinorLabelCondController = new ConditionalDocumentController<AxisLabelStyle>(CreateMinorLabel, RemoveMinorLabel) { UseDocumentCopy = UseDocument.Directly };

			if (_doc.Contains(AxisInformation.Identifier))
			{
				var axStyle = _doc[AxisInformation.Identifier];
				AxisStyleCondController.InitializeDocument(axStyle);
				if (axStyle.AreMajorLabelsEnabled)
					MajorLabelCondController.InitializeDocument(axStyle.MajorLabelStyle);
				if (axStyle.AreMinorLabelsEnabled)
					MinorLabelCondController.InitializeDocument(axStyle.MinorLabelStyle);
			}
		}
コード例 #31
0
ファイル: LineShape.cs プロジェクト: olesar/Altaxo
 public LineShape(double startX, double startY, PointD2D endPosition, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
     :
     this(new PointD2D(startX, startY), endPosition, context)
 {
 }
コード例 #32
0
 /// <summary>
 /// Creates a list of plot items from data columns, using a template plot style.
 /// </summary>
 /// <param name="selectedColumns">Columns for which to create plot items.</param>
 /// <param name="templatePlotStyle">The template plot style used to create the basic plot item.</param>
 /// <param name="processedColumns">On return, contains all columns that where used in creating the plot items. That are
 /// not only the columns given in the first argument, but maybe also columns that are right to those columns in the table and have special kinds, like
 /// labels, yerr, and so on.</param>
 /// <param name="context">Property context used to determine default values, e.g. for the pen width or symbol size.</param>
 /// <returns>List of plot items created.</returns>
 public static List <IGPlotItem> CreatePlotItems(IEnumerable <DataColumn> selectedColumns, G3DPlotStyleCollection templatePlotStyle, HashSet <DataColumn> processedColumns, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
 {
     return(CreatePlotItems(selectedColumns, null, null, templatePlotStyle, processedColumns, context));
 }