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.Collections.Generic;
|
---|
42 | using System.Text;
|
---|
43 | using System.Drawing;
|
---|
44 | using ILNumerics.Drawing.Interfaces;
|
---|
45 | using ILNumerics.Drawing;
|
---|
46 |
|
---|
47 | namespace ILNumerics.Drawing.Labeling {
|
---|
48 | /// <summary>
|
---|
49 | /// general label, drawn in world coords
|
---|
50 | /// </summary>
|
---|
51 | public class ILWorldLabel : ILLabelingElement {
|
---|
52 |
|
---|
53 | #region attributes
|
---|
54 | private int m_padding;
|
---|
55 | private LabelAlign m_align;
|
---|
56 | private ILPoint3Df m_minPosition;
|
---|
57 | private ILPoint3Df m_maxPosition;
|
---|
58 | #endregion
|
---|
59 |
|
---|
60 | #region properties
|
---|
61 |
|
---|
62 | /// <summary>
|
---|
63 | /// get/ set the minimum position for the label
|
---|
64 | /// </summary>
|
---|
65 | public ILPoint3Df PositionMin {
|
---|
66 | get {
|
---|
67 | return m_minPosition;
|
---|
68 | }
|
---|
69 | set {
|
---|
70 | m_minPosition = value;
|
---|
71 | }
|
---|
72 | }
|
---|
73 | /// <summary>
|
---|
74 | /// get/ set the maximium position for the label
|
---|
75 | /// </summary>
|
---|
76 | public ILPoint3Df PositionMax {
|
---|
77 | get {
|
---|
78 | return m_maxPosition;
|
---|
79 | }
|
---|
80 | set {
|
---|
81 | m_maxPosition = value;
|
---|
82 | }
|
---|
83 | }
|
---|
84 | /// <summary>
|
---|
85 | /// Alignment along the axis value range. Possible values: lower, center, upper
|
---|
86 | /// </summary>
|
---|
87 | public LabelAlign Alignment {
|
---|
88 | get {
|
---|
89 | return m_align;
|
---|
90 | }
|
---|
91 | set {
|
---|
92 | m_align = value;
|
---|
93 | OnChanged();
|
---|
94 | }
|
---|
95 | }
|
---|
96 |
|
---|
97 | /// <summary>
|
---|
98 | /// Get/ set the padding used to seperate the label from the elements around it
|
---|
99 | /// </summary>
|
---|
100 | public int Padding {
|
---|
101 | get {
|
---|
102 | return m_padding;
|
---|
103 | }
|
---|
104 | set {
|
---|
105 | m_padding = value;
|
---|
106 | OnChanged();
|
---|
107 | }
|
---|
108 | }
|
---|
109 | #endregion
|
---|
110 |
|
---|
111 | #region constructor
|
---|
112 | /// <summary>
|
---|
113 | /// create a label for rendering
|
---|
114 | /// </summary>
|
---|
115 | public ILWorldLabel (ILPanel panel)
|
---|
116 | : base(panel,new Font(FontFamily.GenericSansSerif,10.0f)
|
---|
117 | ,Color.DarkBlue,CoordSystem.World3D) {
|
---|
118 | m_align = LabelAlign.Center;
|
---|
119 | m_padding = 3;
|
---|
120 | }
|
---|
121 | #endregion
|
---|
122 |
|
---|
123 | #region abstract overrides
|
---|
124 |
|
---|
125 | /// <summary>
|
---|
126 | /// draws the whole rendering queue
|
---|
127 | /// </summary>
|
---|
128 | public override void Draw(ILRenderProperties p) {
|
---|
129 | if (m_expression != m_cachedExpression)
|
---|
130 | interprete(m_expression);
|
---|
131 | m_renderer.Begin(p);
|
---|
132 | //offsetAlignment(m_size,ref m_position);
|
---|
133 | m_renderer.Draw(m_renderQueue
|
---|
134 | ,m_minPosition.X,m_minPosition.Y,m_minPosition.Z
|
---|
135 | ,m_maxPosition.X,m_maxPosition.Y,m_maxPosition.Z
|
---|
136 | ,m_color);
|
---|
137 | m_renderer.End(p);
|
---|
138 | }
|
---|
139 |
|
---|
140 | #endregion
|
---|
141 |
|
---|
142 | #region private helper
|
---|
143 |
|
---|
144 |
|
---|
145 | #endregion
|
---|
146 | }
|
---|
147 | }
|
---|