public override bool Add(Altaxo.Data.IReadableColumn col, int idx)
        {
            // if column is not numeric, use the index instead
            double d = (col is Altaxo.Data.INumericColumn) ? ((Altaxo.Data.INumericColumn)col)[idx] : idx;

            return(Add(d));
        }
        public void SetElements(bool bInit)
        {
            if (bInit)
            {
                m_xCol           = m_PlotAssociation.XColumn;
                m_yCol           = m_PlotAssociation.YColumn;
                m_labelCol       = m_PlotAssociation.LabelColumn;
                m_PlotRange_From = m_PlotAssociation.PlotRangeStart;
                m_PlotRange_To   = m_PlotAssociation.PlotRangeLength == int.MaxValue ? int.MaxValue : m_PlotAssociation.PlotRangeStart + m_PlotAssociation.PlotRangeLength - 1;
                CalcMaxPossiblePlotRangeTo();
            }

            if (null != View)
            {
                string[] tables = Current.Project.DataTableCollection.GetSortedTableNames();
                View.Tables_Initialize(tables, 0);

                string[] columns = Current.Project.DataTableCollection[tables[0]].DataColumns.GetColumnNames();
                View.Columns_Initialize(columns, 0);

                View.XColumn_Initialize(m_xCol == null ? String.Empty : m_xCol.FullName);
                View.YColumn_Initialize(m_yCol == null ? String.Empty : m_yCol.FullName);
                View.LabelColumn_Initialize(m_labelCol == null ? String.Empty : m_labelCol.FullName);
                View.PlotRangeFrom_Initialize(m_PlotRange_From);
                CalcMaxPossiblePlotRangeTo();
            }
        }
Пример #3
0
        public override bool Add(Altaxo.Data.IReadableColumn col, int idx)
        {
            var v = col[idx];
            // if column is not numeric, use the index instead
            double d = v.IsNativeNumeric ? v.ToDouble() : idx; // Note: string should _not_ convert to double, even if it represents a number!

            return(Add(d));
        }
 public void EhView_EraseLabel()
 {
     SetDirty();
     m_labelCol = null;
     if (null != View)
     {
         View.LabelColumn_Initialize(m_labelCol == null ? String.Empty : m_labelCol.FullName);
     }
 }
 public void EhView_ToLabel(int tableindex, string tablename, int columnindex, string columnname)
 {
     SetDirty();
     m_labelCol = Current.Project.DataTableCollection[tablename][columnname];
     if (null != View)
     {
         View.LabelColumn_Initialize(m_labelCol == null ? String.Empty : m_labelCol.FullName);
     }
 }
        public void SetElements(bool bInit)
        {
            if (bInit)
            {
                m_xCol           = m_PlotAssociation.XColumn;
                m_yCol           = m_PlotAssociation.YColumn;
                m_labelCol       = m_PlotAssociation.LabelColumn;
                m_PlotRange_From = m_PlotAssociation.PlotRangeStart;
                m_PlotRange_To   = m_PlotAssociation.PlotRangeLength == int.MaxValue ? int.MaxValue : m_PlotAssociation.PlotRangeStart + m_PlotAssociation.PlotRangeLength - 1;
                CalcMaxPossiblePlotRangeTo();
            }

            if (null != View)
            {
                string[] tables = Current.Project.DataTableCollection.GetSortedTableNames();

                Data.DataTable t1 = Data.DataTable.GetParentDataTableOf(m_xCol as Main.IDocumentNode);
                Data.DataTable t2 = Data.DataTable.GetParentDataTableOf(m_yCol as Main.IDocumentNode);
                Data.DataTable tg = null;
                if (t1 != null && t2 != null && t1 == t2)
                {
                    tg = t1;
                }
                else if (t1 == null)
                {
                    tg = t2;
                }
                else if (t2 == null)
                {
                    tg = t1;
                }

                int seltable = -1;
                if (tg != null)
                {
                    seltable = Array.IndexOf(tables, tg.Name);
                }

                View.Tables_Initialize(tables, seltable);

                if (seltable >= 0)
                {
                    string[] columns = Current.Project.DataTableCollection[tables[seltable]].DataColumns.GetColumnNames();
                    View.Columns_Initialize(columns, -1);
                }
                else
                {
                    View.Columns_Initialize(new string[] {}, -1);
                }

                View.XColumn_Initialize(m_xCol == null ? String.Empty : m_xCol.FullName);
                View.YColumn_Initialize(m_yCol == null ? String.Empty : m_yCol.FullName);
                View.PlotRangeFrom_Initialize(m_PlotRange_From);
                CalcMaxPossiblePlotRangeTo();
            }
        }
Пример #7
0
 public override bool Add(Altaxo.Data.IReadableColumn col, int idx)
 {
     // if column is not numeric, use the index instead
     if (!(col is Altaxo.Data.DateTimeColumn))
     {
         return(false);
     }
     else
     {
         return(Add(((Altaxo.Data.DateTimeColumn)col)[idx]));
     }
 }
Пример #8
0
        public LabelPlotStyle(Altaxo.Data.IReadableColumn labelColumn)
        {
            this._font                             = new Font(System.Drawing.FontFamily.GenericSansSerif, 8, GraphicsUnit.World);
            this._independentColor                 = false;
            this._brush                            = new BrushX(Color.Black);
            this._xOffset                          = 0;
            this._yOffset                          = 0;
            this._rotation                         = 0;
            this._backgroundStyle                  = null;
            this._cachedStringFormat               = new StringFormat(StringFormatFlags.NoWrap);
            this._cachedStringFormat.Alignment     = System.Drawing.StringAlignment.Center;
            this._cachedStringFormat.LineAlignment = System.Drawing.StringAlignment.Center;
            this._attachedPlane                    = null;
            this._labelColumn                      = new Altaxo.Data.ReadableColumnProxy(labelColumn);

            CreateEventChain();
        }
Пример #9
0
 public override bool Add(Altaxo.Data.IReadableColumn col, int idx)
 {
     return(true);
 }
Пример #10
0
 /// <summary>
 /// Processes a single value from a numeric column <paramref name="col"/>[<paramref name="idx"/>].
 /// If the data value is inside the considered value range, the boundaries are
 /// updated and the number of items is increased by one. The function has to return true
 /// in this case. On the other hand, if the value is outside the range, the function has to
 /// return false.
 /// </summary>
 /// <param name="col">The numeric data column</param>
 /// <param name="idx">The index into this numeric column where the data value is located</param>
 /// <returns>True if data is in the tracked range, false if the data is not in the tracked range.</returns>
 public abstract bool Add(Altaxo.Data.IReadableColumn col, int idx);
Пример #11
0
 /// <summary>
 /// Processes a single value from a data column.
 /// If the data value is text, the boundaries are
 /// updated and the number of items is increased by one (if not contained already). The function returns true
 /// in this case. On the other hand, if the value is outside the range, the function has to
 /// return false.
 /// </summary>
 /// <param name="col">The data column</param>
 /// <param name="idx">The index into this data column where the data value is located.</param>
 /// <returns>True if data is in the tracked range, false if the data is not in the tracked range.</returns>
 public bool Add(Altaxo.Data.IReadableColumn col, int idx)
 {
     return(Add(col[idx]));
 }
 public void EhView_EraseLabel()
 {
   SetDirty();
   m_labelCol = null;
   if(null!=View)
     View.LabelColumn_Initialize(m_labelCol==null ? String.Empty : m_labelCol.FullName);
 }
 public void EhView_ToLabel(int tableindex, string tablename, int columnindex, string columnname)
 {
   SetDirty();
   m_labelCol = Current.Project.DataTableCollection[tablename][columnname];
   if(null!=View)
     View.LabelColumn_Initialize(m_labelCol==null ? String.Empty : m_labelCol.FullName);
 }
    public void SetElements(bool bInit)
    {
      if(bInit)
      {
        m_xCol = m_PlotAssociation.XColumn;
        m_yCol = m_PlotAssociation.YColumn;
        m_labelCol = m_PlotAssociation.LabelColumn;
        m_PlotRange_From = m_PlotAssociation.PlotRangeStart;
        m_PlotRange_To   = m_PlotAssociation.PlotRangeLength==int.MaxValue ? int.MaxValue : m_PlotAssociation.PlotRangeStart+m_PlotAssociation.PlotRangeLength-1;
        CalcMaxPossiblePlotRangeTo();
      }

      if(null!=View)
      {
        string[] tables = Current.Project.DataTableCollection.GetSortedTableNames();
        View.Tables_Initialize(tables,0);
        
        string[] columns = Current.Project.DataTableCollection[tables[0]].DataColumns.GetColumnNames();
        View.Columns_Initialize(columns,0);

        View.XColumn_Initialize(m_xCol==null ? String.Empty : m_xCol.FullName);
        View.YColumn_Initialize(m_yCol==null ? String.Empty : m_yCol.FullName);
        View.LabelColumn_Initialize(m_labelCol==null ? String.Empty : m_labelCol.FullName);
        View.PlotRangeFrom_Initialize(m_PlotRange_From);
        CalcMaxPossiblePlotRangeTo();
      }
    }
Пример #15
0
        public void Paint(Graphics g,
                          IPlotArea layer,
                          Processed2DPlotData pdata)
        {
            if (this._labelColumn.Document == null)
            {
                return;
            }

            if (null != _attachedPlane)
            {
                layer.UpdateCSPlaneID(_attachedPlane);
            }


            PlotRangeList rangeList = pdata.RangeList;

            PointF[] ptArray = pdata.PlotPointsInAbsoluteLayerCoordinates;
            Altaxo.Data.IReadableColumn labelColumn = this._labelColumn.Document;


            // save the graphics stat since we have to translate the origin
            System.Drawing.Drawing2D.GraphicsState gs = g.Save();

            /*
             * double bottomPosition = 0;
             * double topPosition = 0;
             * double leftPosition = 0;
             * double rightPosition = 0;
             *
             * layer.CoordinateSystem.LogicalToLayerCoordinates(0, 0, out leftPosition, out bottomPosition);
             * layer.CoordinateSystem.LogicalToLayerCoordinates(1, 1, out rightPosition, out topPosition);
             */
            double xpos = 0, ypos = 0;
            double xpre, ypre;
            double xdiff, ydiff;

            for (int r = 0; r < rangeList.Count; r++)
            {
                int lower  = rangeList[r].LowerBound;
                int upper  = rangeList[r].UpperBound;
                int offset = rangeList[r].OffsetToOriginal;
                for (int j = lower; j < upper; j++)
                {
                    string label = labelColumn[j + offset].ToString();
                    if (label == null || label == string.Empty)
                    {
                        continue;
                    }

                    xpre = ptArray[j].X;
                    ypre = ptArray[j].Y;

                    if (null != this._attachedPlane)
                    {
                        Logical3D r3d = layer.GetLogical3D(pdata, j + offset);
                        PointF    pp  = layer.CoordinateSystem.GetPointOnPlane(this._attachedPlane, r3d);
                        xpre = pp.X;
                        ypre = pp.Y;
                    }


                    xdiff = xpre - xpos;
                    ydiff = ypre - ypos;
                    xpos  = xpre;
                    ypos  = ypre;
                    g.TranslateTransform((float)xdiff, (float)ydiff);
                    if (this._rotation != 0)
                    {
                        g.RotateTransform((float)-this._rotation);
                    }
                    this.Paint(g, label);
                    if (this._rotation != 0)
                    {
                        g.RotateTransform((float)this._rotation);
                    }
                } // end for
            }

            g.Restore(gs); // Restore the graphics state
        }
    public void SetElements(bool bInit)
    {
      if(bInit)
      {
        m_xCol = m_PlotAssociation.XColumn;
        m_yCol = m_PlotAssociation.YColumn;
        m_labelCol = m_PlotAssociation.LabelColumn;
        m_PlotRange_From = m_PlotAssociation.PlotRangeStart;
        m_PlotRange_To   = m_PlotAssociation.PlotRangeLength==int.MaxValue ? int.MaxValue : m_PlotAssociation.PlotRangeStart+m_PlotAssociation.PlotRangeLength-1;
        CalcMaxPossiblePlotRangeTo();
      }

      if(null!=View)
      {
        string[] tables = Current.Project.DataTableCollection.GetSortedTableNames();

        Data.DataTable t1 = Data.DataTable.GetParentDataTableOf(m_xCol as Main.IDocumentNode);
        Data.DataTable t2 = Data.DataTable.GetParentDataTableOf(m_yCol as Main.IDocumentNode);
        Data.DataTable tg = null;
        if (t1 != null && t2!=null && t1 == t2)
          tg = t1;
        else if (t1 == null)
          tg = t2;
        else if (t2 == null)
          tg = t1;

        int seltable = -1;
        if (tg != null)
        {
          seltable = Array.IndexOf(tables, tg.Name);
        }
     
        View.Tables_Initialize(tables,seltable);

        if (seltable >= 0)
        {
          string[] columns = Current.Project.DataTableCollection[tables[seltable]].DataColumns.GetColumnNames();
          View.Columns_Initialize(columns, -1);
        }
        else
        {
          View.Columns_Initialize(new string[]{}, -1);
        }

        View.XColumn_Initialize(m_xCol==null ? String.Empty : m_xCol.FullName);
        View.YColumn_Initialize(m_yCol==null ? String.Empty : m_yCol.FullName);
        View.PlotRangeFrom_Initialize(m_PlotRange_From);
        CalcMaxPossiblePlotRangeTo();
      }
    }