1 | ///
|
---|
2 | /// This file is part of ILNumerics Community Edition.
|
---|
3 | ///
|
---|
4 | /// ILNumerics Community Edition - high performance computing for applications.
|
---|
5 | /// Copyright (C) 2006 - 2012 Haymo Kutschbach, http://ilnumerics.net
|
---|
6 | ///
|
---|
7 | /// ILNumerics Community Edition is free software: you can redistribute it and/or modify
|
---|
8 | /// it under the terms of the GNU General Public License version 3 as published by
|
---|
9 | /// the Free Software Foundation.
|
---|
10 | ///
|
---|
11 | /// ILNumerics Community Edition is distributed in the hope that it will be useful,
|
---|
12 | /// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | /// GNU General Public License for more details.
|
---|
15 | ///
|
---|
16 | /// You should have received a copy of the GNU General Public License
|
---|
17 | /// along with ILNumerics Community Edition. See the file License.txt in the root
|
---|
18 | /// of your distribution package. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | ///
|
---|
20 | /// In addition this software uses the following components and/or licenses:
|
---|
21 | ///
|
---|
22 | /// =================================================================================
|
---|
23 | /// The Open Toolkit Library License
|
---|
24 | ///
|
---|
25 | /// Copyright (c) 2006 - 2009 the Open Toolkit library.
|
---|
26 | ///
|
---|
27 | /// Permission is hereby granted, free of charge, to any person obtaining a copy
|
---|
28 | /// of this software and associated documentation files (the "Software"), to deal
|
---|
29 | /// in the Software without restriction, including without limitation the rights to
|
---|
30 | /// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
---|
31 | /// the Software, and to permit persons to whom the Software is furnished to do
|
---|
32 | /// so, subject to the following conditions:
|
---|
33 | ///
|
---|
34 | /// The above copyright notice and this permission notice shall be included in all
|
---|
35 | /// copies or substantial portions of the Software.
|
---|
36 | ///
|
---|
37 | /// =================================================================================
|
---|
38 | ///
|
---|
39 |
|
---|
40 | using System;
|
---|
41 | using System.Drawing;
|
---|
42 |
|
---|
43 |
|
---|
44 | namespace ILNumerics.Drawing.Shapes {
|
---|
45 |
|
---|
46 | public class ILLines
|
---|
47 | : ILCompositeShape<C4bV3f> {
|
---|
48 |
|
---|
49 | #region attributes
|
---|
50 | ILLineProperties m_properties;
|
---|
51 | void m_properties_Changed(object sender, EventArgs e) {
|
---|
52 | m_fillColor = m_properties.Color;
|
---|
53 | OnChanged();
|
---|
54 | }
|
---|
55 | #endregion
|
---|
56 |
|
---|
57 | #region properties
|
---|
58 | /// <summary>
|
---|
59 | /// all properties for the lines (in shading mode 'flat')
|
---|
60 | /// </summary>
|
---|
61 | public ILLineProperties Properties {
|
---|
62 | get { return m_properties; }
|
---|
63 | }
|
---|
64 | /// <summary>
|
---|
65 | /// determines, if the line is to be drawn antialiased (on width > 1 only)
|
---|
66 | /// </summary>
|
---|
67 | public bool Antialiasing {
|
---|
68 | get { return m_properties.Antialiasing; }
|
---|
69 | set { m_properties.Antialiasing = value; }
|
---|
70 | }
|
---|
71 | /// <summary>
|
---|
72 | /// stipple pattern for the line, if Style is set to custom pattern
|
---|
73 | /// </summary>
|
---|
74 | public short Pattern {
|
---|
75 | get { return m_properties.Pattern; }
|
---|
76 | set { m_properties.Pattern = value; }
|
---|
77 | }
|
---|
78 | /// <summary>
|
---|
79 | /// scaling for the stipple pattern
|
---|
80 | /// </summary>
|
---|
81 | public float PatternScale {
|
---|
82 | get { return m_properties.PatternScale; }
|
---|
83 | set { m_properties.PatternScale = value; }
|
---|
84 | }
|
---|
85 | /// <summary>
|
---|
86 | /// line style, default: solid
|
---|
87 | /// </summary>
|
---|
88 | public LineStyle Style {
|
---|
89 | get { return m_properties.Style; }
|
---|
90 | set { m_properties.Style = value; }
|
---|
91 | }
|
---|
92 | /// <summary>
|
---|
93 | /// line width (pixels)
|
---|
94 | /// </summary>
|
---|
95 | public int Width {
|
---|
96 | get { return m_properties.Width; }
|
---|
97 | set { m_properties.Width = value; }
|
---|
98 | }
|
---|
99 | /// <summary>
|
---|
100 | /// color for the lines (in shading mode 'flat')
|
---|
101 | /// </summary>
|
---|
102 | public override Color FillColor {
|
---|
103 | get {
|
---|
104 | return m_properties.Color;
|
---|
105 | }
|
---|
106 | set {
|
---|
107 | m_properties.Color = value;
|
---|
108 | }
|
---|
109 | }
|
---|
110 |
|
---|
111 | #endregion
|
---|
112 |
|
---|
113 | #region constructors
|
---|
114 | /// <summary>
|
---|
115 | /// Create new lines composite shapes, prepare memory for vertices only
|
---|
116 | /// </summary>
|
---|
117 | /// <param name="panel">panel hosting the scene</param>
|
---|
118 | /// <param name="numVertices">number of overall vertices in the shape</param>
|
---|
119 | public ILLines (ILPanel panel, int numVertices)
|
---|
120 | : base(panel, numVertices, 2) {
|
---|
121 | m_fillColor = Color.Blue;
|
---|
122 | m_properties = new ILLineProperties();
|
---|
123 | m_properties.Color = Color.Blue;
|
---|
124 | m_properties.Changed += new EventHandler(m_properties_Changed);
|
---|
125 | }
|
---|
126 | ///// <summary>
|
---|
127 | ///// create new lines composite shape
|
---|
128 | ///// </summary>
|
---|
129 | ///// <param name="panel">panel hosting the scene</param>
|
---|
130 | ///// <param name="X">x coordinates vector </param>
|
---|
131 | ///// <param name="Y">y coordinates vector </param>
|
---|
132 | ///// <param name="Z">z coordinates vector </param>
|
---|
133 | //public ILLines(ILPanel panel, ILBaseArray X, ILBaseArray Y, ILBaseArray Z)
|
---|
134 | // : base (panel,2,X,Y,Z) {
|
---|
135 | // m_fillColor = Color.Blue;
|
---|
136 | // m_properties = new ILLineProperties();
|
---|
137 | // m_properties.Color = Color.Blue;
|
---|
138 | // m_properties.Changed += new EventHandler(m_properties_Changed);
|
---|
139 | //}
|
---|
140 | ///// <summary>
|
---|
141 | ///// create new lines composite shape
|
---|
142 | ///// </summary>
|
---|
143 | ///// <param name="panel">panel hosting the scene</param>
|
---|
144 | ///// <param name="X">X coords vector</param>
|
---|
145 | ///// <param name="Y">Y coords vector</param>
|
---|
146 | ///// <param name="Z">Z coords vector</param>
|
---|
147 | ///// <param name="mapping">Mapping of shapes, composes shapes out of vertices. Matrix having
|
---|
148 | ///// 2 rows. Every element in a column specifies the index of a vertex according to its position in X,Y,Z.
|
---|
149 | ///// The 2 elements in a column therefore compose a single line. Vertices may get used arbitrary times
|
---|
150 | ///// (or not at all). All elements must be positive integer values in range
|
---|
151 | ///// 0...[<see cref="ILNumerics.Drawing.Shapes.ILShape.VertexCount"/>-1].</param>
|
---|
152 | //public ILLines(ILPanel panel, ILBaseArray X, ILBaseArray Y, ILBaseArray Z, ILBaseArray mapping)
|
---|
153 | // : base(panel, 2, X, Y, Z, mapping) {
|
---|
154 | // m_fillColor = Color.Blue;
|
---|
155 | // m_properties = new ILLineProperties();
|
---|
156 | // m_properties.Color = Color.Blue;
|
---|
157 | // m_properties.Changed += new EventHandler(m_properties_Changed);
|
---|
158 | // ILColorEnumerator colors = new ILColorEnumerator();
|
---|
159 | // for (int i = 0; i < m_vertCount; i++) {
|
---|
160 | // m_vertices[i].Color = colors.NextColor();
|
---|
161 | // }
|
---|
162 | //}
|
---|
163 | ///// <summary>
|
---|
164 | ///// create lines composite shape
|
---|
165 | ///// </summary>
|
---|
166 | ///// <param name="panel">hosting panel</param>
|
---|
167 | ///// <param name="X">x coordinates vector </param>
|
---|
168 | ///// <param name="Y">y coordinates vector </param>
|
---|
169 | ///// <param name="Z">z coordinates vector </param>
|
---|
170 | ///// <param name="colors">matrix with <see cref="ILNumerics.Drawing.Shapes.ILShape.VertexCount"/>
|
---|
171 | ///// rows, 3 columns for (R,G,B) or 4 columns for
|
---|
172 | ///// (A,R,G,B) for every vertex specified by X,Y,Z. Elements must range from 0..255. If colors
|
---|
173 | ///// has 3 columns only, alpha values of 255 are used as default.</param>
|
---|
174 | ///// <param name="mapping">Mapping of shapes, composes shapes out of vertices. Matrix having
|
---|
175 | ///// 2 rows. Every element in a column specifies the index of a vertex according to its position in X,Y,Z.
|
---|
176 | ///// The 2 elements in a column therefore compose a single line. Vertices may get used arbitrary times
|
---|
177 | ///// (or not at all). All elements must be positive integer values in range
|
---|
178 | ///// 0...[<see cref="ILNumerics.Drawing.Shapes.ILShape.VertexCount"/>-1].</param>
|
---|
179 | //public ILLines(ILPanel panel, ILInArray<float> X, ILInArray<float> Y, ILInArray<float> Z, ILInArray<int> mapping, ILInArray<float> colors)
|
---|
180 | // : base(panel, 2, X, Y, Z,colors, mapping) {
|
---|
181 | // m_fillColor = Color.Blue;
|
---|
182 | // m_properties = new ILLineProperties();
|
---|
183 | // m_properties.Color = Color.Blue;
|
---|
184 | // m_properties.Changed += new EventHandler(m_properties_Changed);
|
---|
185 | //}
|
---|
186 | #endregion
|
---|
187 |
|
---|
188 | }
|
---|
189 | }
|
---|