/// <summary> /// color settings helper /// </summary> /// <param name="quad">quad index</param> /// <param name="col0">color 1</param> /// <param name="col1">color 2</param> /// <param name="col2">color 3</param> /// <param name="col3">color 4</param> private void SetColorGradient( ILLitQuad quad, Color col0, Color col1, Color col2, Color col3) { quad.Vertices[0].Color = col0; quad.Vertices[0].Alpha = m_opacity; quad.Vertices[1].Color = col1; quad.Vertices[1].Alpha = m_opacity; quad.Vertices[2].Color = col2; quad.Vertices[2].Alpha = m_opacity; quad.Vertices[3].Color = col3; quad.Vertices[3].Alpha = m_opacity; }
/// <summary> /// create new lit 3D box /// </summary> /// <param name="panel">panel hosting the scene</param> /// <param name="min">minimum coordinates defining the box' dimensions (x,y,z)</param> /// <param name="max">minimum coordinates defining the box' dimensions (x,y,z)</param> /// <param name="fillColor">overall color for the box</param> /// <param name="topColor">color used to color the top edges of the box</param> public ILLitBox3D(ILPanel panel, ILPoint3Df min, ILPoint3Df max, Color fillColor, Color topColor) : base(panel) { m_lineProperties = new ILLineProperties(); m_lineProperties.Changed += new EventHandler(m_lineProperties_Changed); m_valLabel = new ILWorldLabel(panel); m_valLabel.Text = ""; // (max * 1000).Z.ToString("F3"); ILPoint3Df mi = ILPoint3Df.Min(min, max); ILPoint3Df ma = ILPoint3Df.Max(min, max); m_valLabel.PositionMax = new ILPoint3Df(ma.X,mi.Y,ma.Z); m_valLabel.PositionMin = new ILPoint3Df(mi.X, ma.Y, ma.Z); ; m_topLabel = new ILShapeLabel(panel); m_topLabel.Color = Color.Blue; //m_topLabel.Font = new Font("Arial", 10, FontStyle.Bold); string tval = max.Z.ToString("F2"); m_topLabel.Text = String.Format("{0}",tval); m_topLabel.Anchor = new PointF(0.5f, 1); m_topColor = topColor; #region setup quads m_quads = new ILLitQuad[6]; // front ILLitQuad quad = new ILLitQuad(m_panel); quad.Vertices[0].Position = new ILPoint3Df(min.X, min.Y, min.Z); quad.Vertices[1].Position = new ILPoint3Df(min.X, min.Y, max.Z); quad.Vertices[2].Position = new ILPoint3Df(max.X, min.Y, max.Z); quad.Vertices[3].Position = new ILPoint3Df(max.X, min.Y, min.Z); m_quads[QuadIndices.front] = quad; // right quad = new ILLitQuad(m_panel); quad.Vertices[0].Position = new ILPoint3Df(max.X, min.Y, min.Z); quad.Vertices[1].Position = new ILPoint3Df(max.X, min.Y, max.Z); quad.Vertices[2].Position = new ILPoint3Df(max.X, max.Y, max.Z); quad.Vertices[3].Position = new ILPoint3Df(max.X, max.Y, min.Z); m_quads[QuadIndices.right] = quad; // back quad = new ILLitQuad(m_panel); quad.Vertices[0].Position = new ILPoint3Df(max.X, max.Y, min.Z); quad.Vertices[1].Position = new ILPoint3Df(max.X, max.Y, max.Z); quad.Vertices[2].Position = new ILPoint3Df(min.X, max.Y, max.Z); quad.Vertices[3].Position = new ILPoint3Df(min.X, max.Y, min.Z); m_quads[QuadIndices.back] = quad; // left quad = new ILLitQuad(m_panel); quad.Vertices[0].Position = new ILPoint3Df(min.X, max.Y, min.Z); quad.Vertices[1].Position = new ILPoint3Df(min.X, max.Y, max.Z); quad.Vertices[2].Position = new ILPoint3Df(min.X, min.Y, max.Z); quad.Vertices[3].Position = new ILPoint3Df(min.X, min.Y, min.Z); m_quads[QuadIndices.left] = quad; // top quad = new ILLitQuad(m_panel); quad.Vertices[0].Position = new ILPoint3Df(min.X, min.Y, max.Z); quad.Vertices[1].Position = new ILPoint3Df(max.X, min.Y, max.Z); quad.Vertices[2].Position = new ILPoint3Df(max.X, max.Y, max.Z); quad.Vertices[3].Position = new ILPoint3Df(min.X, max.Y, max.Z); m_quads[QuadIndices.top] = quad; // bottom quad = new ILLitQuad(m_panel); quad.Vertices[0].Position = new ILPoint3Df(min.X, min.Y, min.Z); quad.Vertices[1].Position = new ILPoint3Df(max.X, min.Y, min.Z); quad.Vertices[2].Position = new ILPoint3Df(max.X, max.Y, min.Z); quad.Vertices[3].Position = new ILPoint3Df(min.X, max.Y, min.Z); m_quads[QuadIndices.bottom] = quad; #endregion EventingSuspend(); foreach (ILLitQuad s in m_quads) { s.Label.Text = ""; s.Shading = ShadingStyles.Interpolate; s.Opacity = m_opacity; s.Border.Color = Color.Gray; s.Border.Width = 1; s.Border.Visible = true; s.Border.Antialiasing = false; Add(s); } EventingResume(); m_fillColor = fillColor; updateColors(); }
/// <summary> /// create new lit 3D box /// </summary> /// <param name="panel">panel hosting the scene</param> /// <param name="min">minimum coordinates defining the box' dimensions (x,y,z)</param> /// <param name="max">minimum coordinates defining the box' dimensions (x,y,z)</param> /// <param name="fillColor">overall color for the box</param> /// <param name="topColor">color used to color the top edges of the box</param> public ILLitBox3D(ILPanel panel, ILPoint3Df min, ILPoint3Df max, Color fillColor, Color topColor) : base(panel) { m_lineProperties = new ILLineProperties(); m_lineProperties.Changed += new EventHandler(m_lineProperties_Changed); m_valLabel = new ILWorldLabel(panel); m_valLabel.Text = ""; // (max * 1000).Z.ToString("F3"); ILPoint3Df mi = ILPoint3Df.Min(min, max); ILPoint3Df ma = ILPoint3Df.Max(min, max); m_valLabel.PositionMax = new ILPoint3Df(ma.X, mi.Y, ma.Z); m_valLabel.PositionMin = new ILPoint3Df(mi.X, ma.Y, ma.Z);; m_topLabel = new ILShapeLabel(panel); m_topLabel.Color = Color.Blue; //m_topLabel.Font = new Font("Arial", 10, FontStyle.Bold); string tval = max.Z.ToString("F2"); m_topLabel.Text = String.Format("{0}", tval); m_topLabel.Anchor = new PointF(0.5f, 1); m_topColor = topColor; #region setup quads m_quads = new ILLitQuad[6]; // front ILLitQuad quad = new ILLitQuad(m_panel); quad.Vertices[0].Position = new ILPoint3Df(min.X, min.Y, min.Z); quad.Vertices[1].Position = new ILPoint3Df(min.X, min.Y, max.Z); quad.Vertices[2].Position = new ILPoint3Df(max.X, min.Y, max.Z); quad.Vertices[3].Position = new ILPoint3Df(max.X, min.Y, min.Z); m_quads[QuadIndices.front] = quad; // right quad = new ILLitQuad(m_panel); quad.Vertices[0].Position = new ILPoint3Df(max.X, min.Y, min.Z); quad.Vertices[1].Position = new ILPoint3Df(max.X, min.Y, max.Z); quad.Vertices[2].Position = new ILPoint3Df(max.X, max.Y, max.Z); quad.Vertices[3].Position = new ILPoint3Df(max.X, max.Y, min.Z); m_quads[QuadIndices.right] = quad; // back quad = new ILLitQuad(m_panel); quad.Vertices[0].Position = new ILPoint3Df(max.X, max.Y, min.Z); quad.Vertices[1].Position = new ILPoint3Df(max.X, max.Y, max.Z); quad.Vertices[2].Position = new ILPoint3Df(min.X, max.Y, max.Z); quad.Vertices[3].Position = new ILPoint3Df(min.X, max.Y, min.Z); m_quads[QuadIndices.back] = quad; // left quad = new ILLitQuad(m_panel); quad.Vertices[0].Position = new ILPoint3Df(min.X, max.Y, min.Z); quad.Vertices[1].Position = new ILPoint3Df(min.X, max.Y, max.Z); quad.Vertices[2].Position = new ILPoint3Df(min.X, min.Y, max.Z); quad.Vertices[3].Position = new ILPoint3Df(min.X, min.Y, min.Z); m_quads[QuadIndices.left] = quad; // top quad = new ILLitQuad(m_panel); quad.Vertices[0].Position = new ILPoint3Df(min.X, min.Y, max.Z); quad.Vertices[1].Position = new ILPoint3Df(max.X, min.Y, max.Z); quad.Vertices[2].Position = new ILPoint3Df(max.X, max.Y, max.Z); quad.Vertices[3].Position = new ILPoint3Df(min.X, max.Y, max.Z); m_quads[QuadIndices.top] = quad; // bottom quad = new ILLitQuad(m_panel); quad.Vertices[0].Position = new ILPoint3Df(min.X, min.Y, min.Z); quad.Vertices[1].Position = new ILPoint3Df(max.X, min.Y, min.Z); quad.Vertices[2].Position = new ILPoint3Df(max.X, max.Y, min.Z); quad.Vertices[3].Position = new ILPoint3Df(min.X, max.Y, min.Z); m_quads[QuadIndices.bottom] = quad; #endregion EventingSuspend(); foreach (ILLitQuad s in m_quads) { s.Label.Text = ""; s.Shading = ShadingStyles.Interpolate; s.Opacity = m_opacity; s.Border.Color = Color.Gray; s.Border.Width = 1; s.Border.Visible = true; s.Border.Antialiasing = false; Add(s); } EventingResume(); m_fillColor = fillColor; updateColors(); }