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;
|
---|
45 | using ILNumerics.Drawing.Interfaces;
|
---|
46 |
|
---|
47 | namespace ILNumerics.Drawing.Graphs {
|
---|
48 | /// <summary>
|
---|
49 | /// class rendering plain color-coded area graphs
|
---|
50 | /// </summary>
|
---|
51 | /// <remarks>This class derives from ILFilledGraph and adds a ZPosition property.</remarks>
|
---|
52 | public abstract class ILImageSCGraph : ILFilledGraph, IILLegendRenderer, IILPanelConfigurator {
|
---|
53 |
|
---|
54 | #region attributes
|
---|
55 | protected float m_zPosition;
|
---|
56 | #endregion
|
---|
57 |
|
---|
58 | #region Properties
|
---|
59 | /// <summary>
|
---|
60 | /// Z position for ImageSC graph (default: -Inf)
|
---|
61 | /// </summary>
|
---|
62 | /// <remarks>The position of the ImageSC plane is specified by a Z coordinate.
|
---|
63 | /// The coordinate can set to the following values:
|
---|
64 | /// <list type="bullet">
|
---|
65 | /// <item>any single precision value, will position the plane on that specific value</item>
|
---|
66 | /// <item><i>negative infinity</i>, will position the plane on the bottom of the viewing cube</item>
|
---|
67 | /// <item><i>positive infinity</i>, position the plane on top of the unit cube.</item></list>
|
---|
68 | /// </remarks>
|
---|
69 | public float ZPosition {
|
---|
70 | get {
|
---|
71 | return m_zPosition;
|
---|
72 | }
|
---|
73 | set {
|
---|
74 | m_zPosition = value;
|
---|
75 | OnChanged("ZPosition");
|
---|
76 | }
|
---|
77 | }
|
---|
78 | #endregion
|
---|
79 |
|
---|
80 | #region constructor
|
---|
81 | public ILImageSCGraph(ILPanel panel, ILArray<float> X, ILArray<float> Y,
|
---|
82 | ILArray<float> Z, ILArray<float> C,
|
---|
83 | ILClippingData clippingContainer)
|
---|
84 | : base(panel, X, Y, Z, C, clippingContainer) {
|
---|
85 | using (ILScope.Enter(X, Y, Z, C)) {
|
---|
86 | m_cols = m_sourceArray.Size[1] + 1;
|
---|
87 | m_rows = m_sourceArray.Size[0] + 1;
|
---|
88 | m_Vertcount = m_rows * m_cols;
|
---|
89 | // defaults
|
---|
90 | m_zPosition = float.NegativeInfinity;
|
---|
91 | }
|
---|
92 | }
|
---|
93 | #endregion
|
---|
94 |
|
---|
95 | public override bool Is3DGraph() {
|
---|
96 | return true;
|
---|
97 | }
|
---|
98 |
|
---|
99 | #region IILPanelConfigurator
|
---|
100 | public void ConfigurePanel(ILPanel panel) {
|
---|
101 | panel.InteractiveMode = InteractiveModes.ZoomRectangle;
|
---|
102 | panel.AspectRatio = AspectRatioMode.StretchToFill;
|
---|
103 | panel.PlotBoxScreenSizeMode = PlotBoxScreenSizeMode.StrictOptimal;
|
---|
104 | panel.ClipViewData = false;
|
---|
105 | panel.DefaultView.Set(0f, 0f, panel.DefaultView.Distance);
|
---|
106 | }
|
---|
107 | #endregion
|
---|
108 |
|
---|
109 | #region IILRenderToLegend
|
---|
110 | public abstract void DrawToLegend(ILRenderProperties p, Rectangle sampleRect, Rectangle labelRect);
|
---|
111 | public Size LabelSize { get { return m_label.Size; } }
|
---|
112 | #endregion
|
---|
113 |
|
---|
114 | }
|
---|
115 | }
|
---|