Пример #1
0
        /// <summary>
        /// Adds a column to a bundle identified by a string <paramref name="identifier"/>.
        /// </summary>
        /// <param name="identifier">Identifier (key) to identifiy the bundle to which the data column is added.</param>
        /// <param name="column">Column to add. Must have ColumnKind.V and a group number equal to <see cref="GroupNumber"/>. Otherwise, this column will be removed in the next call to <see cref="Update"/>.</param>
        public void AddDataColumn(string identifier, IReadableColumn column)
        {
            if (null == identifier)
            {
                throw new ArgumentNullException("identifier");
            }

            if (identifier == "" && !_dataColumnBundles.ContainsKey(identifier))
            {
                _dataColumnBundles.Add("", new ColumnBundleInfo());
            }

            if (!_dataColumnBundles.ContainsKey(identifier))
            {
                throw new InvalidOperationException(string.Format("Identifier {0} was not found in the collection", identifier));
            }

            var bundle = _dataColumnBundles[identifier];

            if (null != column)
            {
                InternalAddDataColumnNoClone(bundle, ReadableColumnProxyBase.FromColumn(column));
                _isDirty = true;
            }
        }
Пример #2
0
        /// <summary>
        /// Gets the name of the z column, depending on the provided level.
        /// </summary>
        /// <param name="level">The level (0..2).</param>
        /// <returns>The name of the z-column, depending on the provided level: 0: only name of the data column. 1: table name and column name. 2: table name, collection, and column name.</returns>
        public string GetZName(int level)
        {
            IReadableColumn col = _zColumn.Document;

            if (col is Altaxo.Data.DataColumn)
            {
                var    table          = Altaxo.Data.DataTable.GetParentDataTableOf((DataColumn)col);
                string tablename      = table == null ? string.Empty : table.Name + "\\";
                string collectionname = table == null ? string.Empty : (table.PropertyColumns.ContainsColumn((DataColumn)col) ? "PropCols\\" : "DataCols\\");
                if (level <= 0)
                {
                    return(((DataColumn)col).Name);
                }
                else if (level == 1)
                {
                    return(tablename + ((DataColumn)col).Name);
                }
                else
                {
                    return(tablename + collectionname + ((DataColumn)col).Name);
                }
            }
            else if (col != null)
            {
                return(col.FullName);
            }
            else
            {
                return(_zColumn.GetName(level) + " (broken)");
            }
        }
Пример #3
0
 /// <summary>
 /// Creates an <see cref="IReadableColumnProxy"/> from a given column.
 /// </summary>
 /// <param name="column">The column.</param>
 /// <returns>An instance of <see cref="IReadableColumnProxy"/>. The type of instance returned depends on the type of the provided column (e.g. whether the column is part of the document or not).</returns>
 public static IReadableColumnProxy FromColumn(IReadableColumn column)
 {
     if (column is ITransformedReadableColumn)
     {
         var tcolumn = (ITransformedReadableColumn)column;
         if (tcolumn.UnderlyingReadableColumn is IDocumentLeafNode)
         {
             return(TransformedReadableColumnProxy.FromColumn(tcolumn));
         }
         else
         {
             return(TransformedReadableColumnProxyForStandaloneColumns.FromColumn(tcolumn));
         }
     }
     else
     {
         if (column is IDocumentLeafNode)
         {
             return(ReadableColumnProxy.FromColumn(column));
         }
         else
         {
             return(ReadableColumnProxyForStandaloneColumns.FromColumn(column));
         }
     }
 }
Пример #4
0
        public void CalculateCachedData()
        {
            if (IsDisposeInProgress)
            {
                return;
            }

            // we can calulate the bounds only if they are set before
            if (null == _xBoundaries && null == _yBoundaries && null == _zBoundaries)
            {
                return;
            }

            ISuspendToken suspendTokenX = null;
            ISuspendToken suspendTokenY = null;
            ISuspendToken suspendTokenZ = null;

            suspendTokenX = _xBoundaries?.SuspendGetToken();
            suspendTokenY = _yBoundaries?.SuspendGetToken();
            suspendTokenZ = _zBoundaries?.SuspendGetToken();

            try
            {
                _xBoundaries?.Reset();
                _yBoundaries?.Reset();
                _zBoundaries?.Reset();

                _pointCount = GetMaximumRowIndexFromDataColumns();

                IReadableColumn xColumn = XColumn;
                IReadableColumn yColumn = YColumn;
                IReadableColumn zColumn = ZColumn;

                foreach (var segment in _dataRowSelection.GetSelectedRowIndexSegmentsFromTo(0, _pointCount, _dataTable?.Document?.DataColumns, _pointCount))
                {
                    for (int rowIdx = segment.start; rowIdx < segment.endExclusive; ++rowIdx)
                    {
                        if (!xColumn.IsElementEmpty(rowIdx) && !yColumn.IsElementEmpty(rowIdx) && !zColumn.IsElementEmpty(rowIdx))
                        {
                            _xBoundaries?.Add(xColumn, rowIdx);
                            _yBoundaries?.Add(yColumn, rowIdx);
                            _zBoundaries?.Add(zColumn, rowIdx);
                        }
                    }
                }

                // now the cached data are valid
                _isCachedDataValidX = null != _xBoundaries;
                _isCachedDataValidY = null != _yBoundaries;
                _isCachedDataValidZ = null != _zBoundaries;

                // now when the cached data are valid, we can reenable the events
            }
            finally
            {
                suspendTokenX?.Resume();
                suspendTokenY?.Resume();
                suspendTokenZ?.Resume();
            }
        }
Пример #5
0
        }                                                                    // not used here


        void Initialize(bool bInit)
        {
            if (bInit)
            {
                _font             = _doc.Font;
                _independentColor = _doc.IndependentColor;
                _color            = _doc.Color;

                _horizontalAlignment = _doc.HorizontalAlignment;
                _verticalAlignment   = _doc.VerticalAlignment;
                _attachToEdge        = _doc.AttachedAxis != null;
                _attachedEdge        = _doc.AttachedAxis;
                _xOffset             = _doc.XOffset;
                _yOffset             = _doc.YOffset;
                _labelColumn         = _doc.LabelColumn;
                _backgroundStyle     = _doc.BackgroundStyle;
            }

            if (null != View)
            {
                View.Font_Initialize(_font);
                View.IndependentColor_Initialize(_independentColor);
                View.Color_Initialize(_color);
                View.HorizontalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)), System.Enum.GetName(typeof(System.Drawing.StringAlignment), _horizontalAlignment));
                View.VerticalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)), System.Enum.GetName(typeof(System.Drawing.StringAlignment), _verticalAlignment));
                View.AttachToAxis_Initialize(_attachToEdge);
                SetAttachmentDirection();
                View.Rotation = (float)_doc.Rotation;
                View.XOffset_Initialize(Serialization.NumberConversion.ToString(_xOffset * 100));
                View.YOffset_Initialize(Serialization.NumberConversion.ToString(_yOffset * 100));
                View.Background = _backgroundStyle;

                InitializeLabelColumnText();
            }
        }
Пример #6
0
 void IDataColumnController.SetDataColumn(IReadableColumn column, DataTable supposedParentDataTable, int supposedGroupNumber)
 {
     _supposedParentDataTable = supposedParentDataTable;
     _supposedGroupNumber     = supposedGroupNumber;
     _doc.Column = column;
     View_InitializeColumn();
 }
		public static ReadableColumnProxyForStandaloneColumns FromColumn(IReadableColumn column)
		{
			var colAsDocumentNode = column as IDocumentLeafNode;
			if (null != colAsDocumentNode)
				throw new ArgumentException(string.Format("column does implement {0}. The actual type of column is {1}", typeof(IDocumentLeafNode), column.GetType()));

			return new ReadableColumnProxyForStandaloneColumns(column); ;
		}
Пример #8
0
        /// <summary>
        /// Warning! This function is intended for use with <see cref="ColumnPlotDataExchangeColumnsController"/> only, because there we only have column names, but no real columns.
        /// For all other controllers, use <see cref="UnderlyingColumn"/>, because in this case, you have a table at hand, where the column belongs to.
        /// Sets the name of underlying data column, and update the <see cref="_plotColumnBoxText"/>.
        /// </summary>
        /// <value>
        /// The name of underlying data column.
        /// </value>
        public void UpdateWithNameOfUnderlyingDataColumn(string nameOfColumn)
        {
            _nameOfUnderlyingDataColumn = nameOfColumn;
            _underlyingColumn           = null;
            _plotColumnBoxText          = nameOfColumn;

            _isDirty = true;
        }
 void IDataColumnController.SetDataColumn(IReadableColumn column, DataTable supposedParentDataTable, int supposedGroupNumber)
 {
     _supposedParentDataTable = supposedParentDataTable;
     _supposedGroupNumber     = supposedGroupNumber;
     _doc.Column = column;
     View_InitializeColumn();
     _view.ActionString     = "that is text:";
     _view.TextFieldToolTip = "Enter text that should be equal to data";
 }
Пример #10
0
		// This type has not serialization.
		// Serialization should be done via the corresponding Proxy type.

		#endregion Serialization

		public TransformedReadableColumn(IReadableColumn column, IVariantToVariantTransformation transformation)
		{
			if (null == column)
				throw new ArgumentNullException(nameof(column));

			if (null == transformation)
				throw new ArgumentNullException(nameof(transformation));

			_originalColumn = column;
			_transformation = transformation;
		}
        public static ReadableColumnProxyForStandaloneColumns FromColumn(IReadableColumn column)
        {
            var colAsDocumentNode = column as IDocumentLeafNode;

            if (null != colAsDocumentNode)
            {
                throw new ArgumentException(string.Format("column does implement {0}. The actual type of column is {1}", typeof(IDocumentLeafNode), column.GetType()));
            }

            return(new ReadableColumnProxyForStandaloneColumns(column));

            ;
        }
Пример #12
0
        public string GetName(int level)
        {
            IReadableColumn col = this.Document; // this may have the side effect that the object is tried to resolve, is this o.k.?

            if (col is Data.DataColumn)
            {
                Altaxo.Data.DataTable table = Altaxo.Data.DataTable.GetParentDataTableOf((DataColumn)col);
                string tablename            = table == null ? string.Empty : table.Name + "\\";
                string collectionname       = table == null ? string.Empty : (table.PropertyColumns.ContainsColumn((DataColumn)col) ? "PropCols\\" : "DataCols\\");
                if (level <= 0)
                {
                    return(((DataColumn)col).Name);
                }
                else if (level == 1)
                {
                    return(tablename + ((DataColumn)col).Name);
                }
                else
                {
                    return(tablename + collectionname + ((DataColumn)col).Name);
                }
            }
            else if (base._docNodePath != null)
            {
                string path = _docNodePath.ToString();
                int    idx  = 0;
                if (level <= 0)
                {
                    idx = path.LastIndexOf('/');
                    if (idx < 0)
                    {
                        idx = 0;
                    }
                    else
                    {
                        idx++;
                    }
                }

                return(path.Substring(idx));
            }
            else if (col != null)
            {
                return(col.ToString());
            }
            else
            {
                return(string.Empty);
            }
        }
Пример #13
0
        // This type has not serialization.
        // Serialization should be done via the corresponding Proxy type.

        #endregion Serialization

        public TransformedReadableColumn(IReadableColumn column, IVariantToVariantTransformation transformation)
        {
            if (null == column)
            {
                throw new ArgumentNullException(nameof(column));
            }

            if (null == transformation)
            {
                throw new ArgumentNullException(nameof(transformation));
            }

            _originalColumn = column;
            _transformation = transformation;
        }
Пример #14
0
        public static ReadableColumnProxy FromColumn(IReadableColumn column)
        {
            if (null == column)
            {
                throw new ArgumentNullException(nameof(column));
            }
            var colAsDocumentNode = column as IDocumentLeafNode;

            if (null == colAsDocumentNode)
            {
                throw new ArgumentException(string.Format("column does not implement {0}. The actual type of column is {1}", typeof(IDocumentLeafNode), column.GetType()));
            }

            return(new ReadableColumnProxy(colAsDocumentNode));
        }
Пример #15
0
        /// <summary>
        /// Try to get a common data table and a group number from all columns (here we don't rely on <see cref="DataTable"/> and GroupNumber of this document).
        /// </summary>
        /// <param name="columns">The columns to consider. <see cref="ITransformedReadableColumn"/> will be stripped to get the underlying data column.</param>
        /// <param name="dataTableIsNotUniform">If the columns gives different result for their underlying data table, the result here will be true.</param>
        /// <param name="commonDataTable">If the previous parameter results in false, this is the common data table of all columns. If the previous parameter is true, this is the first underlying data table that could be deduced from the columns. The result is null if no underlying table could be deduced from the columns.</param>
        /// <param name="groupNumberIsNotUniform">If the columns gives different result for their group number, the result here will be true.</param>
        /// <param name="commonGroupNumber">If the previous parameter results in false, this is the common group number of all columns. If the previous parameter results in true, this is the first group number that could be deduced from the columns. The result is null if no group number could be deduced from the columns.</param>
        public static void GetCommonDataTableAndGroupNumberFromColumns(this IEnumerable <IReadableColumn> columns, out bool dataTableIsNotUniform, out DataTable commonDataTable, out bool groupNumberIsNotUniform, out int?commonGroupNumber)
        {
            dataTableIsNotUniform   = false;
            groupNumberIsNotUniform = false;
            commonDataTable         = null;
            commonGroupNumber       = null;

            foreach (var col in columns)
            {
                IReadableColumn underlyingColumn = col;

                while (underlyingColumn is ITransformedReadableColumn)
                {
                    underlyingColumn = (underlyingColumn as ITransformedReadableColumn).UnderlyingReadableColumn;
                }

                if (underlyingColumn is DataColumn)
                {
                    var colColl     = DataColumnCollection.GetParentDataColumnCollectionOf((DataColumn)underlyingColumn);
                    var dataTable   = DataTable.GetParentDataTableOf(colColl);
                    int?groupNumber = colColl?.GetColumnGroup((DataColumn)underlyingColumn);

                    if (null != dataTable)
                    {
                        if (null == commonDataTable)
                        {
                            commonDataTable = dataTable;
                        }
                        else if (!object.ReferenceEquals(commonDataTable, dataTable))
                        {
                            dataTableIsNotUniform = true;
                        }
                    }

                    if (null != groupNumber)
                    {
                        if (null == commonGroupNumber)
                        {
                            commonGroupNumber = groupNumber;
                        }
                        else if (!(commonGroupNumber == groupNumber))
                        {
                            groupNumberIsNotUniform = true;
                        }
                    }
                }
            }
        }
Пример #16
0
        public void EhView_SelectLabelColumn()
        {
            SingleColumnChoice choice = new SingleColumnChoice();

            choice.SelectedColumn = _doc.LabelColumn as DataColumn;
            object choiceAsObject = choice;

            if (Current.Gui.ShowDialog(ref choiceAsObject, "Select label column"))
            {
                choice = (SingleColumnChoice)choiceAsObject;


                _labelColumn = choice.SelectedColumn;
                InitializeLabelColumnText();
            }
        }
Пример #17
0
 public ITransformedReadableColumn WithUnderlyingReadableColumn(IReadableColumn originalReadableColumn)
 {
     if (object.Equals(_originalColumn, originalReadableColumn))
     {
         return(this);
     }
     else
     {
         if (null == originalReadableColumn)
         {
             throw new ArgumentNullException(nameof(originalReadableColumn));
         }
         var result = (TransformedReadableColumn)MemberwiseClone();
         result._originalColumn = originalReadableColumn;
         return(result);
     }
 }
Пример #18
0
		/// <summary>
		/// Creates an <see cref="IReadableColumnProxy"/> from a given column.
		/// </summary>
		/// <param name="column">The column.</param>
		/// <returns>An instance of <see cref="IReadableColumnProxy"/>. The type of instance returned depends on the type of the provided column (e.g. whether the column is part of the document or not).</returns>
		public static IReadableColumnProxy FromColumn(IReadableColumn column)
		{
			if (column is ITransformedReadableColumn)
			{
				var tcolumn = (ITransformedReadableColumn)column;
				if (tcolumn.UnderlyingReadableColumn is IDocumentLeafNode)
					return TransformedReadableColumnProxy.FromColumn(tcolumn);
				else
					return TransformedReadableColumnProxyForStandaloneColumns.FromColumn(tcolumn);
			}
			else
			{
				if (column is IDocumentLeafNode)
					return ReadableColumnProxy.FromColumn(column);
				else
					return ReadableColumnProxyForStandaloneColumns.FromColumn(column);
			}
		}
 /// <summary>
 /// Gets the underlying data column (of type <see cref="DataColumn"/>) or the default value null.
 /// </summary>
 /// <param name="c">The transformed column for which to search the underlying <see cref="DataColumn"/>.</param>
 /// <returns>The underlying data column (of type <see cref="DataColumn"/>) or the default value null.</returns>
 public static DataColumn GetUnderlyingDataColumnOrDefault(this IReadableColumn c)
 {
     if (c is DataColumn)
     {
         return((DataColumn)c);
     }
     else if (c is ITransformedReadableColumn it)
     {
         while (null != it)
         {
             if (it.UnderlyingReadableColumn is DataColumn)
             {
                 return((DataColumn)it.UnderlyingReadableColumn);
             }
             else if (it.UnderlyingReadableColumn is ITransformedReadableColumn)
             {
                 it = (ITransformedReadableColumn)it.UnderlyingReadableColumn;
             }
         }
     }
     return(null);
 }
Пример #20
0
        /// <summary>
        /// Gets the maximum row index that can be deduced from the data columns. The calculation does <b>not</b> include the DataRowSelection.
        /// </summary>
        /// <returns>The maximum row index that can be deduced from the data columns.</returns>
        public int GetMaximumRowIndexFromDataColumns()
        {
            IReadableColumn xColumn = XColumn;
            IReadableColumn yColumn = YColumn;
            IReadableColumn zColumn = ZColumn;

            int maxRowIndex;

            if (xColumn == null || yColumn == null || zColumn == null)
            {
                maxRowIndex = 0;
            }
            else
            {
                maxRowIndex = int.MaxValue;

                if (xColumn.Count.HasValue)
                {
                    maxRowIndex = System.Math.Min(maxRowIndex, xColumn.Count.Value);
                }
                if (yColumn.Count.HasValue)
                {
                    maxRowIndex = System.Math.Min(maxRowIndex, yColumn.Count.Value);
                }
                if (zColumn.Count.HasValue)
                {
                    maxRowIndex = System.Math.Min(maxRowIndex, zColumn.Count.Value);
                }

                // if both columns are indefinite long, we set the length to zero
                if (maxRowIndex == int.MaxValue || maxRowIndex < 0)
                {
                    maxRowIndex = 0;
                }
            }

            return(maxRowIndex);
        }
Пример #21
0
		/// <summary>
		/// Determines which of the rows of a set of columns is truly numeric, i.e. all columns in this row contains a value, which is not double.NaN.
		/// </summary>
		/// <param name="table">Array of numeric columns.</param>
		/// <param name="selectedCols">The indizes of the columns in question into the collection.</param>
		/// <param name="selectedRowIndices">The selected data row indices.</param>
		/// <param name="rowCount">The minimum row count of all the selected columns.</param>
		/// <returns>A boolean array. If an element of the array is true at a given index, that row contains valid numeric values in all columns.</returns>
		public static bool[] GetValidNumericRows(IReadableColumn[] table, IAscendingIntegerCollection selectedCols, IEnumerable<int> selectedRowIndices, int rowCount)
		{
			// determine the number of valid rows
			bool[] rowValid = new bool[rowCount];

			foreach (int i in selectedRowIndices)
				rowValid[i] = true;

			for (int i = 0; i < selectedCols.Count; i++)
			{
				var col = table[selectedCols[i]];
				for (int j = 0; j < rowCount; j++)
				{
					if (double.IsNaN(col[j]))
						rowValid[j] = false;
				}
			}
			return rowValid;
		}
 /// <summary>
 /// Constructor by giving a numeric column.
 /// </summary>
 /// <param name="column">The numeric column to hold.</param>
 protected ReadableColumnProxyForStandaloneColumns(IReadableColumn column)
 {
     _column = column;
 }
Пример #23
0
 public ReadableColumnProxy(IReadableColumn column)
   : base(column)
 {
 }
Пример #24
0
 public PlotColumnInformation(IReadableColumn column, string nameOfUnderlyingDataColumn)
 {
     _nameOfUnderlyingDataColumn = nameOfUnderlyingDataColumn;
     Column = column;
 }
		/// <summary>
		/// Constructor by giving a numeric column.
		/// </summary>
		/// <param name="column">The numeric column to hold.</param>
		protected TransformedReadableColumnProxyForStandaloneColumns(ITransformedReadableColumn column)
		{
			_underlyingColumn = column.UnderlyingReadableColumn;
			_transformation = column.Transformation;
			_cachedResultingColumn = column;
		}
Пример #26
0
        public override bool Add(IReadableColumn col, int idx)
        {
            var v = col[idx];

            return(Add((v.IsNativeNumeric) ? v.ToDouble() : idx));
        }
    public UseDocument UseDocumentCopy { set { _useDocumentCopy = value; } } // not used here


    void Initialize(bool bInit)
    {
      if(bInit)
      {
        _font = _doc.Font;
        _independentColor = _doc.IndependentColor;
        _color = _doc.Color;
        
        _horizontalAlignment = _doc.HorizontalAlignment;
        _verticalAlignment = _doc.VerticalAlignment;
        _attachToEdge = _doc.AttachedAxis!=null;
        _attachedEdge = _doc.AttachedAxis;
        _xOffset      = _doc.XOffset;
        _yOffset      = _doc.YOffset;
        _labelColumn = _doc.LabelColumn;
        _backgroundStyle = _doc.BackgroundStyle;
      }

      if(null!=View)
      {
        View.Font_Initialize(_font);
        View.IndependentColor_Initialize(_independentColor);
        View.Color_Initialize(_color);
        View.HorizontalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)),System.Enum.GetName(typeof(System.Drawing.StringAlignment),_horizontalAlignment));
        View.VerticalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)),System.Enum.GetName(typeof(System.Drawing.StringAlignment),_verticalAlignment));
        View.AttachToAxis_Initialize(_attachToEdge);
        SetAttachmentDirection();
        View.Rotation = (float)_doc.Rotation;
        View.XOffset_Initialize(Serialization.NumberConversion.ToString(_xOffset*100));
        View.YOffset_Initialize(Serialization.NumberConversion.ToString(_yOffset*100));
        View.Background = _backgroundStyle;

        InitializeLabelColumnText();
      }
    }
Пример #28
0
 public ReadableColumnProxy(IReadableColumn column)
     : base(column)
 {
 }
Пример #29
0
		/// <summary>
		/// Calculates the valid numeric rows of the data source, i.e. that rows that can be used for fitting. Both dependent and independent variable sources are considered. A row is considered valid, if
		/// all (independent and dependent) variables of this row have finite numeric values.
		/// </summary>
		/// <returns>The set of rows that can be used for fitting.</returns>
		public IAscendingIntegerCollection CalculateValidNumericRows()
		{
			// also obtain the valid rows both of the independent and of the dependent variables
			var cols = new IReadableColumn[_independentVariables.Length + _dependentVariables.Length];
			int i;
			AscendingIntegerCollection selectedCols = new AscendingIntegerCollection();
			// note: for a fitting session all independent variables columns must
			// be not null
			int maxLength = int.MaxValue;
			for (i = 0; i < _independentVariables.Length; i++)
			{
				cols[i] = _independentVariables[i].Document;
				selectedCols.Add(i);
				if (cols[i].Count.HasValue)
					maxLength = Math.Min(maxLength, cols[i].Count.Value);
			}

			// note: for a fitting session some of the dependent variables can be null
			for (int j = 0; j < _dependentVariables.Length; ++j, ++i)
			{
				if (_dependentVariables[j] != null && _dependentVariables[j].Document != null)
				{
					cols[i] = _dependentVariables[j].Document;
					selectedCols.Add(i);
					if (cols[i].Count.HasValue)
						maxLength = Math.Min(maxLength, cols[i].Count.Value);
				}
			}
			if (maxLength == int.MaxValue)
				maxLength = 0; // in case non of the columns has a defined length

			bool[] arr = Altaxo.Calc.LinearAlgebra.DataTableWrapper.GetValidNumericRows(cols, selectedCols, _rangeOfRows.GetSelectedRowIndicesFromTo(0, maxLength, _dataTable?.Document.DataColumns, maxLength), maxLength);

			return Altaxo.Calc.LinearAlgebra.DataTableWrapper.GetCollectionOfValidNumericRows(arr);
		}
Пример #30
0
 public IncludeSingleNumericalValue(double value, IReadableColumn column)
 {
     _value = value;
     ChildSetMember(ref _columnProxy, ReadableColumnProxyBase.FromColumn(column));
 }
Пример #31
0
		public ITransformedReadableColumn WithUnderlyingReadableColumn(IReadableColumn originalReadableColumn)
		{
			if (object.Equals(_originalColumn, originalReadableColumn))
			{
				return this;
			}
			else
			{
				if (null == originalReadableColumn)
					throw new ArgumentNullException(nameof(originalReadableColumn));
				var result = (TransformedReadableColumn)this.MemberwiseClone();
				result._originalColumn = originalReadableColumn;
				return result;
			}
		}
 public override bool Add(IReadableColumn col, int idx)
 {
     return(Add((col is INumericColumn) ? ((INumericColumn)col)[idx] : idx));
 }
Пример #33
0
		public FitElement(DataTable table, int groupNumber, IRowSelection rowSelection, IReadableColumn xColumn, IReadableColumn yColumn)
		{
			if (null == table)
				throw new ArgumentNullException(nameof(table));
			if (null == rowSelection)
				throw new ArgumentNullException(nameof(rowSelection));

			ChildSetMember(ref _dataTable, new DataTableProxy(table));
			_groupNumber = groupNumber;
			ChildCloneToMember(ref _rangeOfRows, rowSelection);

			_independentVariables = new IReadableColumnProxy[1];
			_independentVariables[0] = ReadableColumnProxyBase.FromColumn(xColumn);

			_dependentVariables = new IReadableColumnProxy[1];
			_dependentVariables[0] = ReadableColumnProxyBase.FromColumn(yColumn);

			_errorEvaluation = new IVarianceScaling[1];
			_errorEvaluation[0] = new ConstantVarianceScaling();
		}
Пример #34
0
		public static string GetName(int level, IReadableColumn Document, AbsoluteDocumentPath InternalDocumentPath)
		{
			IReadableColumn col = Document; // this may have the side effect that the object is tried to resolve, is this o.k.?
			if (col is Data.DataColumn)
			{
				Altaxo.Data.DataTable table = Altaxo.Data.DataTable.GetParentDataTableOf((DataColumn)col);
				string tablename = table == null ? string.Empty : table.Name + "\\";
				string collectionname = table == null ? string.Empty : (table.PropertyColumns.ContainsColumn((DataColumn)col) ? "PropCols\\" : "DataCols\\");
				if (level <= 0)
					return ((DataColumn)col).Name;
				else if (level == 1)
					return tablename + ((DataColumn)col).Name;
				else
					return tablename + collectionname + ((DataColumn)col).Name;
			}
			else
			{
				string path = InternalDocumentPath.ToString();
				int idx = 0;
				if (level <= 0)
				{
					idx = path.LastIndexOf('/');
					if (idx < 0)
						idx = 0;
					else
						idx++;
				}

				return path.Substring(idx);
			}
		}
Пример #35
0
 public RangeOfNumericalValues(double lower, bool isLowerInclusive, double upper, bool isUpperInclusive, IReadableColumn column)
 {
     _lowerValue       = lower;
     _isLowerInclusive = isLowerInclusive;
     _upperValue       = upper;
     _isUpperInclusive = isUpperInclusive;
     ChildSetMember(ref _columnProxy, ReadableColumnProxyBase.FromColumn(column));
 }
Пример #36
0
		public RangeOfNumericalValues(double lower, bool isLowerInclusive, double upper, bool isUpperInclusive, IReadableColumn column)
		{
			_lowerValue = lower;
			_isLowerInclusive = isLowerInclusive;
			_upperValue = upper;
			_isUpperInclusive = isUpperInclusive;
			ChildSetMember(ref _columnProxy, ReadableColumnProxyBase.FromColumn(column));
		}
Пример #37
0
			public MyPlotData(IReadableColumn xc, IReadableColumn yc)
			{
				_xColumn = xc;
				_yColumm = yc;
			}
Пример #38
0
 /// <summary>
 /// Constructor by giving a numeric column.
 /// </summary>
 /// <param name="column">The numeric column to hold.</param>
 protected TransformedReadableColumnProxyForStandaloneColumns(ITransformedReadableColumn column)
 {
     _underlyingColumn      = column.UnderlyingReadableColumn;
     _transformation        = column.Transformation;
     _cachedResultingColumn = column;
 }
Пример #39
0
		public static ReadableColumnProxy FromColumn(IReadableColumn column)
		{
			if (null == column)
				throw new ArgumentNullException(nameof(column));
			var colAsDocumentNode = column as IDocumentLeafNode;
			if (null == colAsDocumentNode)
				throw new ArgumentException(string.Format("column does not implement {0}. The actual type of column is {1}", typeof(IDocumentLeafNode), column.GetType()));

			return new ReadableColumnProxy(colAsDocumentNode);
		}
 public override bool Add(IReadableColumn col, int idx)
 {
   return Add((col is INumericColumn) ? ((INumericColumn)col)[idx] : idx);
 }
Пример #41
0
        public void CalculateCachedData()
        {
            // we can calulate the bounds only if they are set before
            if (null == _xBoundaries || null == _yBoundaries)
            {
                return;
            }


            _plottablePoints = 0;


            this._xBoundaries.BeginUpdate(); // disable events
            this._yBoundaries.BeginUpdate(); // disable events

            this._xBoundaries.Reset();
            this._yBoundaries.Reset();

            System.Diagnostics.Debug.Assert(_plotRangeStart >= 0);
            System.Diagnostics.Debug.Assert(_plotRangeLength >= 0);


            _pointCount = _plotRangeLength == int.MaxValue ? int.MaxValue : _plotRangeStart + _plotRangeLength;

            IReadableColumn xColumn = this.XColumn;
            IReadableColumn yColumn = this.YColumn;

            if (xColumn == null || yColumn == null)
            {
                _pointCount      = 0;
                _plottablePoints = 0;
            }
            else
            {
                if (xColumn is IDefinedCount)
                {
                    _pointCount = System.Math.Min(_pointCount, ((IDefinedCount)xColumn).Count);
                }
                if (yColumn is IDefinedCount)
                {
                    _pointCount = System.Math.Min(_pointCount, ((IDefinedCount)yColumn).Count);
                }

                // if both columns are indefinite long, we set the length to zero
                if (_pointCount == int.MaxValue || _pointCount < 0)
                {
                    _pointCount = 0;
                }


                for (int i = _plotRangeStart; i < _pointCount; i++)
                {
                    if (!xColumn.IsElementEmpty(i) && !yColumn.IsElementEmpty(i))
                    {
                        bool x_added = this._xBoundaries.Add(xColumn, i);
                        bool y_added = this._yBoundaries.Add(yColumn, i);
                        if (x_added && y_added)
                        {
                            _plottablePoints++;
                        }
                    }
                }
            }

            // now the cached data are valid
            _isCachedDataValid = true;


            // now when the cached data are valid, we can reenable the events
            this._xBoundaries.EndUpdate(); // enable events
            this._yBoundaries.EndUpdate(); // enable events
        }
    public void EhView_SelectLabelColumn()
    {
      SingleColumnChoice choice = new SingleColumnChoice();
      choice.SelectedColumn = _doc.LabelColumn as DataColumn;
      object choiceAsObject = choice;
      if(Current.Gui.ShowDialog(ref choiceAsObject,"Select label column"))
      {
        choice = (SingleColumnChoice)choiceAsObject;

       
        _labelColumn = choice.SelectedColumn;
        InitializeLabelColumnText();
        
      }
    }
Пример #43
0
        public FitElement(DataTable table, int groupNumber, IRowSelection rowSelection, IReadableColumn xColumn, IReadableColumn yColumn)
        {
            if (null == rowSelection)
            {
                throw new ArgumentNullException(nameof(rowSelection));
            }

            ChildSetMember(ref _dataTable, new DataTableProxy(table));
            _groupNumber = groupNumber;
            ChildCloneToMember(ref _rangeOfRows, rowSelection);

            _independentVariables = new IReadableColumnProxy[1];
            ChildSetMember(ref _independentVariables[0], ReadableColumnProxyBase.FromColumn(xColumn));

            _dependentVariables = new IReadableColumnProxy[1];
            ChildSetMember(ref _dependentVariables[0], ReadableColumnProxyBase.FromColumn(yColumn));

            _errorEvaluation    = new IVarianceScaling[1];
            _errorEvaluation[0] = new ConstantVarianceScaling();
        }
Пример #44
0
 public MyPlotData(IReadableColumn xc, IReadableColumn yc, IReadableColumn zc)
 {
     _xColumn = xc;
     _yColumm = yc;
     _zColumm = zc;
 }
		/// <summary>
		/// Constructor by giving a numeric column.
		/// </summary>
		/// <param name="column">The numeric column to hold.</param>
		protected ReadableColumnProxyForStandaloneColumns(IReadableColumn column)
		{
			_column = column;
		}
Пример #46
0
		/// <summary>
		/// Sets the ith independent variable column. The column is hold by a reference aware of disposed events, so that it can be null if retrieved afterwards.
		/// </summary>
		/// <param name="i">Index.</param>
		/// <param name="col">Independent variable column to set.</param>
		public void SetIndependentVariable(int i, IReadableColumn col)
		{
			this._independentVariables[i] = ReadableColumnProxyBase.FromColumn(col);

			EhSelfChanged(EventArgs.Empty);
		}
Пример #47
0
		/// <summary>
		/// Adds a column to a bundle identified by a string <paramref name="identifier"/>.
		/// </summary>
		/// <param name="identifier">Identifier (key) to identifiy the bundle to which the data column is added.</param>
		/// <param name="column">Column to add. Must have ColumnKind.V and a group number equal to <see cref="GroupNumber"/>. Otherwise, this column will be removed in the next call to <see cref="Update"/>.</param>
		public void AddDataColumn(string identifier, IReadableColumn column)
		{
			if (null == identifier)
				throw new ArgumentNullException("identifier");

			if (identifier == "" && !_dataColumnBundles.ContainsKey(identifier))
				_dataColumnBundles.Add("", new ColumnBundleInfo());

			if (!_dataColumnBundles.ContainsKey(identifier))
				throw new InvalidOperationException(string.Format("Identifier {0} was not found in the collection", identifier));

			var bundle = _dataColumnBundles[identifier];

			if (null != column)
			{
				InternalAddDataColumnNoClone(bundle, ReadableColumnProxyBase.FromColumn(column));
				_isDirty = true;
			}
		}
Пример #48
0
 public IncludeTextContains(string value, bool ignoreCase, IReadableColumn column)
 {
     _value      = value;
     _ignoreCase = ignoreCase;
     ChildSetMember(ref _columnProxy, ReadableColumnProxyBase.FromColumn(column));
 }
Пример #49
0
		/// <summary>
		/// Sets the ith dependent variable column. The column is hold by a reference aware of disposed events, so that it can be null if retrieved afterwards.
		/// </summary>
		/// <param name="i">Index.</param>
		/// <param name="col">Dependent variable column to set.</param>
		public void SetDependentVariable(int i, IReadableColumn col)
		{
			this._dependentVariables[i] = ReadableColumnProxyBase.FromColumn(col);

			if (col != null)
			{
				if (this._errorEvaluation[i] == null)
					this._errorEvaluation[i] = new ConstantVarianceScaling();
			}
			else
			{
				this._errorEvaluation[i] = null;
			}
		}