Esempio n. 1
0
		public void Paint(Graphics g, IPlotArea layer, int axisnumber)
		{
			if (!_showGrid)
				return;

			Scale axis = layer.Scales[axisnumber];
			TickSpacing ticking = layer.Scales[axisnumber].TickSpacing;

			RectangleD2D layerRect = new RectangleD2D(PointD2D.Empty, layer.Size);

			if (_showZeroOnly)
			{
				Altaxo.Data.AltaxoVariant var = new Altaxo.Data.AltaxoVariant(0.0);
				double rel = axis.PhysicalVariantToNormal(var);
				_majorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1));
				if (rel >= 0 && rel <= 1)
				{
					if (axisnumber == 0)
						layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(rel, 0), new Logical3D(rel, 1));
					else
						layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, rel), new Logical3D(1, rel));

					//layer.DrawIsoLine(g, MajorPen, axisnumber, rel, 0, 1);
				}
			}
			else
			{
				double[] ticks;

				if (_showMinor)
				{
					_minorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1));
					ticks = ticking.GetMinorTicksNormal(axis);
					for (int i = 0; i < ticks.Length; ++i)
					{
						if (axisnumber == 0)
							layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1));
						else
							layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i]));

						//layer.DrawIsoLine(g, MinorPen, axisnumber, ticks[i], 0, 1);
					}
				}

				MajorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1));
				ticks = ticking.GetMajorTicksNormal(axis);
				for (int i = 0; i < ticks.Length; ++i)
				{
					if (axisnumber == 0)
						layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1));
					else
						layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i]));

					//layer.DrawIsoLine(g, MajorPen, axisnumber, ticks[i], 0, 1);
				}
			}
		}
Esempio n. 2
0
    public void Paint(Graphics g, IPlotArea layer, int axisnumber)
    {
      if (!_showGrid)
        return;

      Scales.Scale axis = axisnumber == 0 ? layer.XAxis : layer.YAxis;
      RectangleF layerRect = new RectangleF(new PointF(0, 0), layer.Size);

      if (_showZeroOnly)
      {
        Altaxo.Data.AltaxoVariant var = new Altaxo.Data.AltaxoVariant(0.0);
        double rel = axis.PhysicalVariantToNormal(var);
        _majorPen.BrushRectangle = layerRect;
        if (rel >= 0 && rel <= 1)
        {
          if (axisnumber == 0)
            layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(rel, 0), new Logical3D(rel, 1));
          else
            layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, rel), new Logical3D(1, rel));

          //layer.DrawIsoLine(g, MajorPen, axisnumber, rel, 0, 1);
        }
      }
      else
      {
        double[] ticks;

        if (_showMinor)
        {
          _minorPen.BrushRectangle = layerRect;
          ticks = axis.GetMinorTicksNormal();
          for (int i = 0; i < ticks.Length; ++i)
          {
            if (axisnumber == 0)
              layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1));
            else
              layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i]));
            
            //layer.DrawIsoLine(g, MinorPen, axisnumber, ticks[i], 0, 1);
          }
        }



        MajorPen.BrushRectangle = layerRect;
        ticks = axis.GetMajorTicksNormal();
        for (int i = 0; i < ticks.Length; ++i)
        {
          if(axisnumber==0)
            layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1));
          else
            layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i]));
          
          //layer.DrawIsoLine(g, MajorPen, axisnumber, ticks[i], 0, 1);
        }
      }
    }
Esempio n. 3
0
    /// <summary>
    /// This function searches for patterns like aaa=bbb in the provided string. If it finds such a item, it creates a column named aaa
    /// and stores the value bbb at the same position in it as in the text column.
    /// </summary>
    /// <param name="strg">The string where to search for the patterns described above.</param>
    /// <param name="store">The column collection where to store the newly created columns of properties.</param>
    /// <param name="index">The index into the column where to store the property value.</param>
    public static void ExtractPropertiesFromString(string strg, Altaxo.Data.DataColumnCollection store, int index)
    {
      string pat;
      pat = @"(\S+)=(\S+)";

      Regex r = new Regex(pat, RegexOptions.Compiled | RegexOptions.IgnoreCase);

      for ( Match m = r.Match(strg); m.Success; m = m.NextMatch()) 
      {
        string propname = m.Groups[1].ToString();
        string propvalue = m.Groups[2].ToString();

        // System.Diagnostics.Trace.WriteLine("Found the pair " + propname + " : " + propvalue);

        if(!store.ContainsColumn(propname))
        {
          Altaxo.Data.DataColumn col;
          if(Altaxo.Serialization.DateTimeParsing.IsDateTime(propvalue))
            col = new Altaxo.Data.DateTimeColumn();
          else if(Altaxo.Serialization.NumberConversion.IsNumeric(propvalue))
            col = new Altaxo.Data.DoubleColumn();
          else
            col = new Altaxo.Data.TextColumn();
        
          store.Add(col,propname); // add the column to the collection
        }

        // now the column is present we can store the value in it.
        store[propname][index] = new Altaxo.Data.AltaxoVariant(propvalue);
      }   
    }
Esempio n. 4
0
		public override void FinalProcessScaleBoundaries(Altaxo.Data.AltaxoVariant org, Altaxo.Data.AltaxoVariant end, Altaxo.Graph.Scales.Scale scale)
		{
			_org = org;
			_end = end;

			try
			{
				if (_showRatioEndOrg)
					_span = end / org;
				else
					_span = end - org;
			}
			catch (Exception)
			{
				_span = new Data.AltaxoVariant(string.Empty);
			}
		}
Esempio n. 5
0
		public void Paint(IGraphicsContext3D g, IPlotArea layer, CSPlaneID plane, int axisnumber)
		{
			if (!_showGrid)
				return;

			Scale axis = layer.Scales[axisnumber];
			TickSpacing ticking = layer.Scales[axisnumber].TickSpacing;

			RectangleD3D layerRect = new RectangleD3D(PointD3D.Empty, layer.Size);

			if (_showZeroOnly)
			{
				Altaxo.Data.AltaxoVariant var = new Altaxo.Data.AltaxoVariant(0.0);
				double rel = axis.PhysicalVariantToNormal(var);
				//_majorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1));
				if (rel >= 0 && rel <= 1)
				{
					Logical3D logV = new Logical3D();
					logV.SetR(plane.PerpendicularAxisNumber, plane.LogicalValue);
					logV.SetR(axisnumber, rel);
					var thirdAxisNumber = Logical3D.GetPerpendicularAxisNumber(plane.PerpendicularAxisNumber, axisnumber);
					var line = layer.CoordinateSystem.GetIsoline(logV.WithR(thirdAxisNumber, 0), logV.WithR(thirdAxisNumber, 1));
					g.DrawLine(MajorPen, line);
				}
			}
			else
			{
				double[] ticks;

				if (_showMinor)
				{
					//_minorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1));
					ticks = ticking.GetMinorTicksNormal(axis);
					for (int i = 0; i < ticks.Length; ++i)
					{
						Logical3D logV = new Logical3D();
						logV.SetR(plane.PerpendicularAxisNumber, plane.LogicalValue);
						logV.SetR(axisnumber, ticks[i]);
						var thirdAxisNumber = Logical3D.GetPerpendicularAxisNumber(plane.PerpendicularAxisNumber, axisnumber);
						var line = layer.CoordinateSystem.GetIsoline(logV.WithR(thirdAxisNumber, 0), logV.WithR(thirdAxisNumber, 1));
						g.DrawLine(MinorPen, line);
					}
				}

				//MajorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1));
				ticks = ticking.GetMajorTicksNormal(axis);
				for (int i = 0; i < ticks.Length; ++i)
				{
					Logical3D logV = new Logical3D();
					logV.SetR(plane.PerpendicularAxisNumber, plane.LogicalValue);
					logV.SetR(axisnumber, ticks[i]);
					var thirdAxisNumber = Logical3D.GetPerpendicularAxisNumber(plane.PerpendicularAxisNumber, axisnumber);
					var line = layer.CoordinateSystem.GetIsoline(logV.WithR(thirdAxisNumber, 0), logV.WithR(thirdAxisNumber, 1));
					g.DrawLine(MajorPen, line);
				}
			}
		}
    /// <summary>
    /// Moves on or more rows in to a new position.
    /// </summary>
    /// <param name="selectedIndices">The indices of the rows to move.</param>
    /// <param name="newPosition">The new position of the rows.</param>
    public void ChangeRowPosition(Altaxo.Collections.IAscendingIntegerCollection selectedIndices, int newPosition)
    {
      int numberSelected = selectedIndices.Count;
      if(numberSelected==0)
        return;

      int oldPosition = selectedIndices[0];
      if(oldPosition==newPosition)
        return;

      // check that the newPosition is ok
      if(newPosition<0)
        throw new ArgumentException("New row position is negative!");

      

      // Allocated tempory storage for the datacolumns
      Altaxo.Data.AltaxoVariant[] tempMoved = new Altaxo.Data.AltaxoVariant[numberSelected];
     
      int firstAffected;
      int maxAffected;

      if(newPosition<oldPosition) // move down to lower indices
      {
        firstAffected = newPosition;
        maxAffected  = Math.Max(newPosition+numberSelected,selectedIndices[numberSelected-1]+1);
      }
      else
      {
        firstAffected = selectedIndices[0];
        maxAffected = newPosition+numberSelected;
      }

      for(int nColumn=ColumnCount-1;nColumn>=0;nColumn--)
      {
        Altaxo.Data.DataColumn thiscolumn = this[nColumn];
        // fill temporary storage
        for(int i=0;i<numberSelected;i++)
          tempMoved[i]=thiscolumn[selectedIndices[i]];
  
        if(newPosition<oldPosition) // move down to lower indices
        {
          for(int i=selectedIndices[numberSelected-1],offset=0;i>=firstAffected;i--)
          {
            if(numberSelected>offset && i==selectedIndices[numberSelected-1-offset])
              offset++;
            else
              thiscolumn[i+offset] = thiscolumn[i];

          }
        }
        else // move up to higher
        {
          for(int i=selectedIndices[0],offset=0;i<maxAffected;i++)
          {
            if(offset<numberSelected && i==selectedIndices[offset])
              offset++;
            else
              thiscolumn[i-offset] = thiscolumn[i];

          }
        }

        // Fill in temporary stored columns on new position
        for(int i=0;i<numberSelected;i++)
          thiscolumn[newPosition+i] = tempMoved[i];

      }
      this.EhChildChanged(null,ChangeEventArgs.CreateRowMoveArgs(ColumnCount,firstAffected,maxAffected));
    }