Exemplo n.º 1
0
    protected Graph3D SelectDataGrapg3D(string id, string readable, string rich, string timely, string url, string name)
    {
        Graph3D sel = new Graph3D();

        sel.id = int.Parse(id);
        if (readable.Length >= 5)
        {
            readable = readable.Substring(0, 5);
        }
        sel.x = float.Parse(readable);
        if (rich.Length >= 5)
        {
            rich = rich.Substring(0, 5);
        }
        sel.y = float.Parse(rich);
        if (timely.Length >= 5)
        {
            timely = timely.Substring(0, 5);
        }
        sel.z = float.Parse(timely);

        sel.style = "#7DC1FF";
        if (name.Length > 10)
        {
            name  = name.Replace("\"", "");
            sel.h = name.Substring(0, 10) + "...";
        }
        else
        {
            sel.h = name;
        }
        sel.url = url;
        return(sel);
    }
Exemplo n.º 2
0
 /// <summary>
 /// Scales three matrices of equal size to point vectors in space.
 /// </summary>
 /// <param name="MatrixX">X-matrix.</param>
 /// <param name="MatrixY">Y-matrix.</param>
 /// <param name="MatrixZ">Z-matrix.</param>
 public Vector4[,] Scale(IMatrix MatrixX, IMatrix MatrixY, IMatrix MatrixZ)
 {
     return(Graph3D.Scale(MatrixX, MatrixY, MatrixZ, this.minX, this.maxX,
                          this.minY, this.maxY, this.minZ, this.maxZ,
                          this.offsetX, this.offsetY, this.offsetZ,
                          this.width, this.height, this.depth));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Draws the graph on a canvas.
        /// </summary>
        /// <param name="Canvas">Canvas to draw on.</param>
        /// <param name="Points">Points to draw.</param>
        /// <param name="Normals">Optional normals.</param>
        /// <param name="Parameters">Graph-specific parameters.</param>
        /// <param name="PrevPoints">Points of previous graph of same type (if available), null (if not available).</param>
        /// <param name="PrevNormals">Optional normals of previous graph of same type (if available), null (if not available).</param>
        /// <param name="PrevParameters">Parameters of previous graph of same type (if available), null (if not available).</param>
        /// <param name="DrawingVolume">Current drawing volume.</param>
        public void DrawGraph(Graphs3D.Canvas3D Canvas, Vector4[,] Points, Vector4[,] Normals,
                              object[] Parameters, Vector4[,] PrevPoints, Vector4[,] PrevNormals,
                              object[] PrevParameters, DrawingVolume DrawingVolume)
        {
            int       i, c = Points.GetLength(0);
            int       j, d = Points.GetLength(1);
            I3DShader Shader   = Graph3D.ToShader(Parameters[0]);
            bool      TwoSided = Expression.ToDouble(Parameters[1]) != 0;

            Vector4[] Nodes = new Vector4[4];

            c--;
            d--;

            for (i = 0; i < c; i++)
            {
                for (j = 0; j < d; j++)
                {
                    Nodes[0] = Points[i, j];
                    Nodes[1] = Points[i + 1, j];
                    Nodes[2] = Points[i + 1, j + 1];
                    Nodes[3] = Points[i, j + 1];

                    Canvas.Polygon(Nodes, Shader, TwoSided);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Draws the graph on a canvas.
        /// </summary>
        /// <param name="Canvas">Canvas to draw on.</param>
        /// <param name="Points">Points to draw.</param>
        /// <param name="Normals">Optional normals.</param>
        /// <param name="Parameters">Graph-specific parameters.</param>
        /// <param name="PrevPoints">Points of previous graph of same type (if available), null (if not available).</param>
        /// <param name="PrevNormals">Optional normals of previous graph of same type (if available), null (if not available).</param>
        /// <param name="PrevParameters">Parameters of previous graph of same type (if available), null (if not available).</param>
        /// <param name="DrawingVolume">Current drawing volume.</param>
        public void DrawGraph(Graphs3D.Canvas3D Canvas, Vector4[,] Points, Vector4[,] Normals,
                              object[] Parameters, Vector4[,] PrevPoints, Vector4[,] PrevNormals,
                              object[] PrevParameters, DrawingVolume DrawingVolume)
        {
            int       i, c = Points.GetLength(0);
            int       j, d = Points.GetLength(1);
            I3DShader Shader = Graph3D.ToShader(Parameters[0]);
            Vector3   P1, P2;
            float     dx, dz;
            int       i0, j0;

            double[] v      = DrawingVolume.ScaleY(new DoubleVector(0));
            float    OrigoY = (float)v[0];

            for (i = 0; i < c; i++)
            {
                i0 = i == 0 ? i : i - 1;

                for (j = 0; j < d; j++)
                {
                    j0 = j == 0 ? j : j - 1;

                    P1 = Graphs3D.Canvas3D.ToVector3(Points[i0, j0]);
                    P2 = Graphs3D.Canvas3D.ToVector3(Points[i0 + 1, j0 + 1]);

                    dx = P2.X - P1.X;
                    dz = P2.Z - P1.Z;

                    P1  = Graphs3D.Canvas3D.ToVector3(Points[i, j]);
                    dx /= 2;
                    dz /= 2;

                    Canvas.Box(P1.X - dx, OrigoY, P1.Z - dz, P1.X + dx, P1.Y, P1.Z + dz, Shader);
                }
            }
        }
Exemplo n.º 5
0
 public void SetGraph(Graph3D graph3D)
 {
     SetGraph(graph3D.xGraph);
     SetGraph(graph3D.yGraph);
     SetGraph(graph3D.zGraph);
 }
 private GraphField3D GetField(Graph3D graph3D)
 {
     return(new GraphField3D(graph3D.Width,
                             graph3D.Length, graph3D.Height));
 }
		/// <summary>
		/// Prepares the scale of this plot style.
		/// </summary>
		/// <param name="layer">The parent layer.</param>
		public void PrepareScales(Graph3D.IPlotArea layer)
		{
			var dataColumn = DataColumn;
			if (null != dataColumn)
			{
				if (_doesScaleNeedsDataUpdate)
					InternalUpdateScaleWithNewData();
			}
		}
		public void Paint(IGraphicsContext3D g, Graph3D.IPlotArea layer, Graph3D.Plot.Data.Processed3DPlotData pdata, Graph3D.Plot.Data.Processed3DPlotData prevItemData, Graph3D.Plot.Data.Processed3DPlotData nextItemData)
		{
			// this is not a visible style, thus doing nothing
		}
		public void ApplyGroupStyles(Graph3D.Plot.Groups.PlotGroupStyleCollection externalGroups, Graph3D.Plot.Groups.PlotGroupStyleCollection localGroups)
		{
			// there is nothing to apply here, because it is only a provider
		}
		public void PrepareGroupStyles(Graph3D.Plot.Groups.PlotGroupStyleCollection externalGroups, Graph3D.Plot.Groups.PlotGroupStyleCollection localGroups, Graph3D.IPlotArea layer, Graph3D.Plot.Data.Processed3DPlotData pdata)
		{
			VariableSymbolSizeGroupStyle.PrepareStyle(externalGroups, localGroups, GetSymbolSize);
		}
		public void CollectExternalGroupStyles(Graph3D.Plot.Groups.PlotGroupStyleCollection externalGroups)
		{
			// this is only for internal use inside one plot item
		}
Exemplo n.º 12
0
 private void Initialize()
 {
     _graph3D = new Graph3D();
 }
Exemplo n.º 13
0
 /// <summary>
 /// Scales a matrix with z-coordinates to fit a given volume.
 /// </summary>
 /// <param name="Matrix">Matrix.</param>
 public double[,] ScaleZ(IMatrix Matrix)
 {
     return(Graph3D.Scale(Matrix, this.maxZ, this.minZ, this.offsetZ, this.depth));
 }
Exemplo n.º 14
0
 /// <summary>
 /// Scales a matrix with y-coordinates to fit a given volume.
 /// </summary>
 /// <param name="Matrix">Matrix.</param>
 public double[,] ScaleY(IMatrix Matrix)
 {
     return(Graph3D.Scale(Matrix, this.minY, this.maxY, this.offsetY, this.height));
 }
Exemplo n.º 15
0
 /// <summary>
 /// Scales a matrix with x-coordinates to fit a given volume.
 /// </summary>
 /// <param name="Matrix">Matrix.</param>
 public double[,] ScaleX(IMatrix Matrix)
 {
     return(Graph3D.Scale(Matrix, this.minX, this.maxX, this.offsetX, this.width));
 }
Exemplo n.º 16
0
        /// <summary>
        /// Draws the graph on a canvas.
        /// </summary>
        /// <param name="Canvas">Canvas to draw on.</param>
        /// <param name="Points">Points to draw.</param>
        /// <param name="Normals">Optional normals.</param>
        /// <param name="Parameters">Graph-specific parameters.</param>
        /// <param name="PrevPoints">Points of previous graph of same type (if available), null (if not available).</param>
        /// <param name="PrevNormals">Optional normals of previous graph of same type (if available), null (if not available).</param>
        /// <param name="PrevParameters">Parameters of previous graph of same type (if available), null (if not available).</param>
        /// <param name="DrawingVolume">Current drawing volume.</param>
        public void DrawGraph(Graphs3D.Canvas3D Canvas, Vector4[,] Points, Vector4[,] Normals,
                              object[] Parameters, Vector4[,] PrevPoints, Vector4[,] PrevNormals,
                              object[] PrevParameters, DrawingVolume DrawingVolume)
        {
            int       i, c = Points.GetLength(0);
            int       j, d = Points.GetLength(1);
            I3DShader Shader   = Graph3D.ToShader(Parameters[0]);
            bool      TwoSided = Expression.ToDouble(Parameters[1]) != 0;

            Vector4[] Nodes       = new Vector4[4];
            Vector4[] NodeNormals = new Vector4[4];

            c--;
            d--;

            if (Normals is null)
            {
                Vector4[,] N = new Vector4[c + 1, d + 1];
                Vector4 P1, P2, P3;
                int     n;

                for (i = 0; i < c; i++)
                {
                    for (j = 0; j < d; j++)
                    {
                        P1 = Points[i, j];
                        P2 = Points[i + 1, j];
                        if (P1 == P2)
                        {
                            P2 = Points[i + 1, j + 1];
                        }
                        P3 = Points[i, j + 1];
                        if (P1 == P3)
                        {
                            P3 = Points[i + 1, j + 1];
                        }

                        N[i, j] = Graphs3D.Canvas3D.CalcNormal(P1, P2, P3);
                    }

                    if (Vector4.Distance(Points[i, d], Points[i, 0]) < 1e-10f)
                    {
                        N[i, d] = N[i, 0];
                    }
                    else
                    {
                        N[i, d] = N[i, d - 1];
                    }
                }

                for (j = 0; j <= d; j++)
                {
                    if (Vector4.Distance(Points[c, j], Points[0, j]) < 1e-10f)
                    {
                        N[c, j] = N[0, j];
                    }
                    else
                    {
                        N[c, j] = N[c - 1, j];
                    }
                }

                Normals = new Vector4[c + 1, d + 1];

                for (i = 0; i <= c; i++)
                {
                    for (j = 0; j <= d; j++)
                    {
                        P1 = N[i, j];
                        n  = 1;

                        if (i > 0)
                        {
                            P1 += N[i - 1, j];
                            n++;

                            if (j > 0)
                            {
                                P1 += N[i - 1, j - 1];
                                n++;
                            }
                        }

                        if (j > 0)
                        {
                            P1 += N[i, j - 1];
                            n++;
                        }

                        Normals[i, j] = P1 / n;
                    }
                }
            }

            for (i = 0; i < c; i++)
            {
                for (j = 0; j < d; j++)
                {
                    Nodes[0] = Points[i, j];
                    Nodes[1] = Points[i + 1, j];
                    Nodes[2] = Points[i + 1, j + 1];
                    Nodes[3] = Points[i, j + 1];

                    NodeNormals[0] = Normals[i, j];
                    NodeNormals[1] = Normals[i + 1, j];
                    NodeNormals[2] = Normals[i + 1, j + 1];
                    NodeNormals[3] = Normals[i, j + 1];

                    Canvas.Polygon(Nodes, NodeNormals, Shader, TwoSided);
                }
            }
        }
Exemplo n.º 17
0
		/// <summary>
		/// Prepares the scale of this plot style. Since this style does not utilize a scale, this function does nothing.
		/// </summary>
		/// <param name="layer">The parent layer.</param>
		public void PrepareScales(Graph3D.IPlotArea layer)
		{
		}
		public void CollectLocalGroupStyles(Graph3D.Plot.Groups.PlotGroupStyleCollection externalGroups, Graph3D.Plot.Groups.PlotGroupStyleCollection localGroups)
		{
			VariableSymbolSizeGroupStyle.AddLocalGroupStyle(externalGroups, localGroups);
		}