当前位置: 首页>>代码示例>>C#>>正文


C# Altaxo.GetType方法代码示例

本文整理汇总了C#中Altaxo.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Altaxo.GetType方法的具体用法?C# Altaxo.GetType怎么用?C# Altaxo.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Altaxo的用法示例。


在下文中一共展示了Altaxo.GetType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Square

 public static Altaxo.Data.DoubleColumn Square(Altaxo.Data.DataColumn x)
 { 
   if(typeof(Altaxo.Data.DoubleColumn)==x.GetType())
     return ((Altaxo.Data.DoubleColumn)x)*((Altaxo.Data.DoubleColumn)x);
  
   else throw new ArgumentException("Error: Try to apply Square() to " + x.TypeAndName,"x");
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:ScriptExecutionBase.cs

示例2: DataItemToString

		/// <summary>
		/// Converts a data item to a string.
		/// </summary>
		/// <param name="col">The data column.</param>
		/// <param name="index">Index of the item in the data column, which should be converted.</param>
		/// <returns>The converted item as string.</returns>
		public string DataItemToString(Altaxo.Data.DataColumn col, int index)
		{
			if (col.IsElementEmpty(index))
				return string.Empty;

			string result;
			Func<Altaxo.Data.AltaxoVariant, string> func = null;
			if (_typeConverters.TryGetValue(col.GetType(), out func))
				result = func(col[index]);
			else
				result = DefaultTextConverter(col[index]);

			return result.Replace(SeparatorChar, SubstituteForSeparatorChar);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:20,代码来源:AsciiExportOptions.cs

示例3: Pow

 public static Altaxo.Data.DoubleColumn Pow(Altaxo.Data.DataColumn x, double y)
 { 
   if(typeof(Altaxo.Data.DoubleColumn)==x.GetType())
     return Altaxo.Data.DoubleColumn.Pow((Altaxo.Data.DoubleColumn)x,y);
   else throw new ArgumentException("Error: Try to apply Pow() to " + x.TypeAndName + " and " + y.GetType() + " " + y.ToString(),"x");
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:6,代码来源:ScriptExecutionBase.cs

示例4: Round

 public static Altaxo.Data.DoubleColumn Round(double x, Altaxo.Data.DataColumn y)
 { 
   if(typeof(Altaxo.Data.DoubleColumn)==y.GetType())
     return Altaxo.Data.DoubleColumn.Round(x,(Altaxo.Data.DoubleColumn)y);
   else throw new ArgumentException("Error: Try to apply Round() to " + x.GetType() + " " + x.ToString() + " and " + y.TypeAndName,"x");
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:6,代码来源:ScriptExecutionBase.cs

示例5: Atan2

 public static Altaxo.Data.DoubleColumn Atan2(double y, Altaxo.Data.DataColumn x)
 { 
   if(typeof(Altaxo.Data.DoubleColumn)==x.GetType())
     return Altaxo.Data.DoubleColumn.Atan2(y,(Altaxo.Data.DoubleColumn)x);
   else throw new ArgumentException("Error: Try to apply Atan2() to " + y.GetType() + " and " + x.TypeAndName ,"x");
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:6,代码来源:ScriptExecutionBase.cs

示例6: Min

 public static Altaxo.Data.DoubleColumn Min(Altaxo.Data.DataColumn x, Altaxo.Data.DataColumn y)
 { 
   if(typeof(Altaxo.Data.DoubleColumn)==x.GetType() && typeof(Altaxo.Data.DoubleColumn)==y.GetType())
     return Altaxo.Data.DoubleColumn.Min((Altaxo.Data.DoubleColumn)x,(Altaxo.Data.DoubleColumn)y);
   else throw new ArgumentException("Error: Try to apply Min() to " + x.TypeAndName + " and " + y.TypeAndName,"x");
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:6,代码来源:ScriptExecutionBase.cs

示例7: CopyDataFrom

    public override void CopyDataFrom(Altaxo.Data.DataColumn v)
    {
      if(v.GetType()!=typeof(Altaxo.Data.TextColumn))
      {
        throw new ArgumentException("Try to copy " + v.GetType() + " to " + this.GetType(),"v"); // throw exception
      }
      Altaxo.Data.TextColumn vd = (Altaxo.Data.TextColumn)v;

      // suggestion, but __not__ implemented:
      // if v is a standalone column, then simply take the dataarray
      // otherwise: copy the data by value  
      int oldCount = this.m_Count;      
      if(null==vd.m_Array || vd.m_Count==0)
      {
        m_Array=null;
        m_Capacity=0;
        m_Count=0;
      }
      else
      {
        m_Array = (string[])vd.m_Array.Clone();
        m_Capacity = m_Array.Length;
        m_Count = ((Altaxo.Data.TextColumn)v).m_Count;
      }
      if(oldCount>0 || m_Count>0) // message only if really was a change
        NotifyDataChanged(0,oldCount>m_Count? (oldCount):(m_Count),m_Count<oldCount);
    }       
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:27,代码来源:TextColumn.cs

示例8: CopyDataFrom

    public override void CopyDataFrom(Altaxo.Data.DataColumn v)
    {
      if(v.GetType()!=typeof(Altaxo.Data.DoubleColumn))
      {
        throw new ArgumentException("Try to copy " + v.GetType() + " to " + this.GetType(),"v"); // throw exception
      }

      this.CopyDataFrom(((Altaxo.Data.DoubleColumn)v).m_Array,v.Count);
    }       
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:9,代码来源:DoubleColumn.cs

示例9: ExportAsImageToStream

		/// <summary>
		/// Saves the project item as image to the provided stream.
		/// </summary>
		/// <param name="item">The item to export, for instance an item of type <see cref="Altaxo.Graph.Gdi.GraphDocument"/> or <see cref="Altaxo.Graph.Graph3D.GraphDocument"/>.</param>
		/// <param name="options">The export options.</param>
		/// <param name="toStream">The stream to save the image to.</param>
		public void ExportAsImageToStream(Altaxo.Main.IProjectItem item, Altaxo.Graph.Gdi.GraphExportOptions options, System.IO.Stream toStream)
		{
			if (item == null)
				throw new ArgumentNullException(nameof(item));
			if (!(item is Altaxo.Graph.Graph3D.GraphDocument))
				throw new ArgumentException(string.Format("Expected item of type {0}, but it is of type {1}", typeof(Altaxo.Graph.Graph3D.GraphDocument), item.GetType()));
			var doc = (Altaxo.Graph.Graph3D.GraphDocument)item;

			double sourceDpi = options.SourceDpiResolution;

			var exporter = new D3D10BitmapExporter();

			var scene = new Viewing.D3D10Scene();

			var g = new D3D10GraphicsContext();

			doc.Paint(g);

			var matrix = doc.Camera.LookAtRHMatrix;

			var rect = new RectangleD3D(PointD3D.Empty, doc.RootLayer.Size);
			var bounds = RectangleD3D.NewRectangleIncludingAllPoints(rect.Vertices.Select(x => matrix.Transform(x)));

			int pixelsX = (int)Math.Ceiling(sourceDpi * bounds.SizeX / 72.0);
			pixelsX = (int)(4 * Math.Ceiling((pixelsX + 3) / 4.0));

			int pixelsY = (int)(sourceDpi * bounds.SizeY / 72.0);

			double aspectRatio = pixelsY / (double)pixelsX;

			var sceneCamera = doc.Camera;

			if (sceneCamera is OrthographicCamera)
			{
				var orthoCamera = (OrthographicCamera)sceneCamera;
				orthoCamera = (OrthographicCamera)orthoCamera.WithWidthAtZNear(bounds.SizeX);

				double offsX = -(1 + 2 * bounds.X / bounds.SizeX);
				double offsY = -(1 + 2 * bounds.Y / bounds.SizeY);
				sceneCamera = orthoCamera.WithScreenOffset(new PointD2D(offsX, offsY));
			}
			else if (sceneCamera is PerspectiveCamera)
			{
				var viewProj = sceneCamera.GetViewProjectionMatrix(1); // here we transform the points with AspectRatio=1, in order to get the AspectRatio of the ScreenBounds
				var screenBounds = RectangleD3D.NewRectangleIncludingAllPoints(rect.Vertices.Select(x => viewProj.Transform(x)));
				aspectRatio = screenBounds.SizeY / screenBounds.SizeX; // this is the aspectRatio of our image
				viewProj = sceneCamera.GetViewProjectionMatrix(aspectRatio); // now we get the transform with our aspectRatio determined above
				screenBounds = RectangleD3D.NewRectangleIncludingAllPoints(rect.Vertices.Select(x => viewProj.Transform(x))); // this are our actual screenBounds, of course in relative screen coordinates, thus the ratio of sizeX and sizeY should now be 1

				double scaleFactor = 2 / screenBounds.SizeX; // since SizeX and SizeY should now be the same, we could have used SizeY alternatively
				double offsX = -(1 + scaleFactor * screenBounds.X);
				double offsY = -(1 + scaleFactor * screenBounds.Y);

				pixelsY = (int)(4 * Math.Ceiling((aspectRatio * pixelsX + 3) / 4.0)); // now calculate the size of the image in y direction from the aspectRatio

				var perspCamera = (PerspectiveCamera)sceneCamera;

				sceneCamera = perspCamera.WithWidthAtZNear(perspCamera.WidthAtZNear / scaleFactor);
				sceneCamera = sceneCamera.WithScreenOffset(new PointD2D(offsX, offsY));
			}
			else
			{
				throw new NotImplementedException();
			}

			scene.SetCamera(sceneCamera);
			scene.SetLighting(doc.Lighting);
			scene.SetDrawing(g);

			exporter.Export(pixelsX, pixelsY, scene, options, toStream);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:77,代码来源:D3D10BitmapExporter.cs

示例10: Map

		/// <summary>Applies the specified binary <paramref name="function"/> to the specified number <paramref name="x"/> and to each element in column <paramref name="x"/>.</summary>
		/// <param name="function">The function to apply.</param>
		/// <param name="x">A double-precision numeric value used as first argument of that function.</param>
		/// <param name="y">The column containing the numerical elements to which the specified <paramref name="function"/> should be applied (as second argument of that function).</param>
		/// <returns>A new column in which each element y[i] is the function applied to the specified value <paramref name="x"/> and the element y[i], i.e. y[i] = function(x, y[i]).</returns>
		public static Altaxo.Data.DoubleColumn Map(Func<double, double, double> function, double x, Altaxo.Data.DataColumn y)
		{
			if (typeof(Altaxo.Data.DoubleColumn) == y.GetType())
				return Altaxo.Data.DoubleColumn.Map(function, x, (Altaxo.Data.DoubleColumn)y);
			else throw new ArgumentException("Error: Try to apply Map(Func<double,double,double>, x, y) to " + "double" + " and " + y.TypeAndName, "x");
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:11,代码来源:ScriptExecutionBase.cs

示例11: Pow9

		/// <summary>Calculates the 9th power of each element of <paramref name="x"/>.</summary>
		/// <param name="x">A column containing numeric elements.</param>
		/// <returns>A new column in which each each element is the 9th power of the corresponding element of column <paramref name="x"/>.</returns>
		public static Altaxo.Data.DoubleColumn Pow9(Altaxo.Data.DataColumn x)
		{
			if (typeof(Altaxo.Data.DoubleColumn) == x.GetType())
				return Altaxo.Data.DoubleColumn.Pow9((Altaxo.Data.DoubleColumn)x);
			else throw new ArgumentException("Error: Try to apply Pow9(x) to " + x.TypeAndName);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:9,代码来源:ScriptExecutionBase.cs


注:本文中的Altaxo.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。