|
10 | 10 | axis_data = get(obj.State.Plot(contourIndex).AssociatedAxis); |
11 | 11 |
|
12 | 12 | %-PLOT DATA STRUCTURE- % |
13 | | -contour_data = get(obj.State.Plot(contourIndex).Handle) |
| 13 | +contour_data = get(obj.State.Plot(contourIndex).Handle); |
14 | 14 |
|
15 | 15 | %-CHECK FOR MULTIPLE AXES-% |
16 | 16 | [xsource, ysource] = findSourceAxis(obj,axIndex); |
|
40 | 40 | xdata = contour_data.XData; |
41 | 41 | ydata = contour_data.YData; |
42 | 42 | zdata = contour_data.ZData; |
43 | | - |
44 | | -if isvector(zdata) |
45 | | - |
46 | | - %-contour type-% |
47 | | - obj.data{contourIndex}.type = 'contour'; |
48 | 43 |
|
49 | | - %-contour x data-% |
50 | | - if ~isvector(x) |
51 | | - obj.data{contourIndex}.xdata = xdata(1,:); |
52 | | - else |
53 | | - obj.data{contourIndex}.xdata = xdata; |
54 | | - end |
| 44 | +%-contour type-% |
| 45 | +obj.data{contourIndex}.type = 'surface'; |
55 | 46 |
|
56 | | - %-contour y data-% |
57 | | - if ~isvector(y) |
58 | | - obj.data{contourIndex}.ydata = ydata'; |
59 | | - else |
60 | | - obj.data{contourIndex}.ydata = ydata'; |
61 | | - end |
62 | | - |
63 | | - %-contour z data-% |
64 | | - obj.data{contourIndex}.z = zdata; |
65 | | - |
66 | | -else |
67 | | - |
68 | | - %-contour type-% |
69 | | - obj.data{contourIndex}.type = 'surface'; |
70 | | - |
71 | | - %-contour x and y data |
72 | | -% [xmesh, ymesh] = meshgrid(xdata, ydata); |
73 | | - obj.data{contourIndex}.x = xdata; |
74 | | - obj.data{contourIndex}.y = ydata; |
75 | | - |
76 | | - %-contour z data-% |
77 | | - obj.data{contourIndex}.z = zdata;%-2*ones(size(zdata)); |
78 | | - |
79 | | - %-setting for contour lines z-direction-% |
80 | | - obj.data{contourIndex}.contours.z.start = contour_data.LevelList(1); |
81 | | - obj.data{contourIndex}.contours.z.end = contour_data.LevelList(end); |
82 | | - obj.data{contourIndex}.contours.z.size = contour_data.LevelStep; |
83 | | - obj.data{contourIndex}.contours.z.show = true; |
84 | | - obj.data{contourIndex}.contours.z.usecolormap = true; |
85 | | - obj.data{contourIndex}.hidesurface = true; |
86 | | - obj.data{contourIndex}.surfacecolor = zdata; |
87 | | - |
88 | | - obj.data{contourIndex}.contours.z.project.x = true; |
89 | | - obj.data{contourIndex}.contours.z.project.y = true; |
90 | | - obj.data{contourIndex}.contours.z.project.z = true; |
91 | | - |
92 | | -end |
| 47 | +%-contour x and y data |
| 48 | +obj.data{contourIndex}.x = xdata; |
| 49 | +obj.data{contourIndex}.y = ydata; |
93 | 50 |
|
94 | | -%-------------------------------------------------------------------------% |
| 51 | +%-contour z data-% |
| 52 | +obj.data{contourIndex}.z = zdata;%-2*ones(size(zdata)); |
95 | 53 |
|
96 | | -%-contour x type-% |
| 54 | +%-setting for contour lines z-direction-% |
| 55 | +obj.data{contourIndex}.contours.z.start = contour_data.LevelList(1); |
| 56 | +obj.data{contourIndex}.contours.z.end = contour_data.LevelList(end); |
| 57 | +obj.data{contourIndex}.contours.z.size = contour_data.LevelStep; |
| 58 | +obj.data{contourIndex}.contours.z.show = true; |
| 59 | +obj.data{contourIndex}.contours.z.usecolormap = true; |
| 60 | +obj.data{contourIndex}.hidesurface = true; |
| 61 | +obj.data{contourIndex}.surfacecolor = zdata; |
97 | 62 |
|
98 | | -obj.data{contourIndex}.xtype = 'array'; |
99 | | - |
100 | | -%-------------------------------------------------------------------------% |
101 | | - |
102 | | -%-contour y type-% |
103 | | - |
104 | | -obj.data{contourIndex}.ytype = 'array'; |
| 63 | +obj.data{contourIndex}.contours.z.project.x = true; |
| 64 | +obj.data{contourIndex}.contours.z.project.y = true; |
| 65 | +obj.data{contourIndex}.contours.z.project.z = true; |
105 | 66 |
|
106 | 67 | %-------------------------------------------------------------------------% |
107 | 68 |
|
|
116 | 77 |
|
117 | 78 | %-------------------------------------------------------------------------% |
118 | 79 |
|
119 | | -%-zauto-% |
120 | | -obj.data{contourIndex}.zauto = false; |
121 | | - |
122 | | -%-------------------------------------------------------------------------% |
123 | | - |
124 | | -%-zmin-% |
125 | | -obj.data{contourIndex}.zmin = axis_data.CLim(1); |
126 | | - |
127 | | -%-------------------------------------------------------------------------% |
128 | | - |
129 | | -%-zmax-% |
130 | | -obj.data{contourIndex}.zmax = axis_data.CLim(2); |
131 | | - |
132 | | -%-------------------------------------------------------------------------% |
133 | | - |
134 | 80 | %-colorscale (ASSUMES PATCH CDATAMAP IS 'SCALED')-% |
135 | 81 | colormap = figure_data.Colormap; |
136 | 82 |
|
|
144 | 90 | %-contour reverse scale-% |
145 | 91 | obj.data{contourIndex}.reversescale = false; |
146 | 92 |
|
147 | | -%-------------------------------------------------------------------------% |
148 | | - |
149 | | -%-autocontour-% |
150 | | -obj.data{contourIndex}.autocontour = false; |
| 93 | +%---------------------------------------------------------------------% |
151 | 94 |
|
152 | | -%-------------------------------------------------------------------------% |
| 95 | +%-aspect ratio-% |
| 96 | +ar = obj.PlotOptions.AspectRatio; |
153 | 97 |
|
154 | | -%-contour contours-% |
| 98 | +if ~isempty(ar) |
| 99 | + if ischar(ar) |
| 100 | + obj.layout.scene.aspectmode = ar; |
| 101 | + elseif isvector(ar) && length(ar) == 3 |
| 102 | + xar = ar(1); |
| 103 | + yar = ar(2); |
| 104 | + zar = ar(3); |
| 105 | + end |
| 106 | +else |
155 | 107 |
|
156 | | -%-coloring-% |
157 | | -switch contour_data.Fill |
158 | | - case 'off' |
159 | | - obj.data{contourIndex}.contours.coloring = 'lines'; |
160 | | - case 'on' |
161 | | - obj.data{contourIndex}.contours.coloring = 'fill'; |
| 108 | + %-define as default-% |
| 109 | + xar = max(xdata(:)); |
| 110 | + yar = max(ydata(:)); |
| 111 | + xyar = max([xar, yar]); |
| 112 | + zar = 0.6*xyar; |
162 | 113 | end |
163 | 114 |
|
164 | | -%-start-% |
165 | | -obj.data{contourIndex}.contours.start = contour_data.TextList(1); |
| 115 | +obj.layout.scene.aspectratio.x = xyar; |
| 116 | +obj.layout.scene.aspectratio.y = xyar; |
| 117 | +obj.layout.scene.aspectratio.z = zar; |
166 | 118 |
|
167 | | -%-end-% |
168 | | -obj.data{contourIndex}.contours.end = contour_data.TextList(end); |
| 119 | +%---------------------------------------------------------------------% |
169 | 120 |
|
170 | | -%-step-% |
171 | | -obj.data{contourIndex}.contours.size = diff(contour_data.TextList(1:2)); |
| 121 | +%-camera eye-% |
| 122 | +ey = obj.PlotOptions.CameraEye; |
172 | 123 |
|
173 | | -%-------------------------------------------------------------------------% |
174 | | - |
175 | | -if(~strcmp(contour_data.LineStyle,'none')) |
176 | | - |
177 | | - %-contour line colour-% |
178 | | - if isnumeric(contour_data.LineColor) |
179 | | - col = 255*contour_data.LineColor; |
180 | | - obj.data{contourIndex}.line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')']; |
181 | | - else |
182 | | - obj.data{contourIndex}.line.color = 'rgba(0,0,0,0)'; |
183 | | - end |
184 | | - |
185 | | - %-contour line width-% |
186 | | - obj.data{contourIndex}.line.width = contour_data.LineWidth; |
187 | | - |
188 | | - %-contour line dash-% |
189 | | - switch contour_data.LineStyle |
190 | | - case '-' |
191 | | - LineStyle = 'solid'; |
192 | | - case '--' |
193 | | - LineStyle = 'dash'; |
194 | | - case ':' |
195 | | - LineStyle = 'dot'; |
196 | | - case '-.' |
197 | | - LineStyle = 'dashdot'; |
| 124 | +if ~isempty(ey) |
| 125 | + if isvector(ey) && length(ey) == 3 |
| 126 | + obj.layout.scene.camera.eye.x = ey(1); |
| 127 | + obj.layout.scene.camera.eye.y = ey(2); |
| 128 | + obj.layout.scene.camera.eye.z = ey(3); |
198 | 129 | end |
199 | | - |
200 | | - obj.data{contourIndex}.line.dash = LineStyle; |
201 | | - |
202 | | - %-contour smoothing-% |
203 | | - obj.data{contourIndex}.line.smoothing = 0; |
204 | | - |
205 | 130 | else |
| 131 | + |
| 132 | + %-define as default-% |
| 133 | + xey = - xyar; if xey>0 xfac = -0.2; else xfac = 0.2; end |
| 134 | + yey = - xyar; if yey>0 yfac = -0.2; else yfac = 0.2; end |
| 135 | + if zar>0 zfac = 0.2; else zfac = -0.2; end |
206 | 136 |
|
207 | | - %-contours showlines-% |
208 | | - obj.data{contourIndex}.contours.showlines = false; |
209 | | - |
| 137 | + obj.layout.scene.camera.eye.x = xey + xfac*xey; |
| 138 | + obj.layout.scene.camera.eye.y = yey + yfac*yey; |
| 139 | + obj.layout.scene.camera.eye.z = zar + zfac*zar; |
210 | 140 | end |
211 | 141 |
|
212 | 142 | %-------------------------------------------------------------------------% |
|
0 commit comments