18 module subroutine surf_init(this, term, fname, err)
20 class(surface_plot),
intent(inout) :: this
21 integer(int32),
intent(in),
optional :: term
22 character(len = *),
intent(in),
optional :: fname
23 class(errors),
intent(inout),
optional,
target :: err
26 type(legend),
pointer :: lgnd
29 call this%plot_3d%initialize(term, fname, err)
32 lgnd => this%get_legend()
33 call lgnd%set_is_visible(.false.)
40 pure module function surf_get_show_hidden(this) result(x)
41 class(surface_plot),
intent(in) :: this
47 module subroutine surf_set_show_hidden(this, x)
48 class(surface_plot),
intent(inout) :: this
49 logical,
intent(in) :: x
54 module function surf_get_cmd(this) result(x)
56 class(surface_plot),
intent(in) :: this
57 character(len = :),
allocatable :: x
60 type(string_builder) :: str
67 call str%append(this%plot%get_command_string())
70 call str%append(new_line(
'a'))
71 if (this%get_show_hidden())
then
72 call str%append(
"unset hidden3d")
74 call str%append(
"set hidden3d")
85 if (this%get_allow_smoothing())
then
86 call str%append(new_line(
'a'))
87 call str%append(
"set pm3d interpolate 0,0")
91 if (this%get_show_contours())
then
92 call str%append(new_line(
'a'))
93 call str%append(
"set contour")
103 if (this%get_use_lighting())
then
104 call str%append(new_line(
'a'))
105 call str%append(
"set pm3d lighting primary ")
106 call str%append(to_string(this%get_light_intensity()))
107 call str%append(
" specular ")
108 call str%append(to_string(this%get_specular_intensity()))
112 if (this%get_transparency() < 1.0 .and. this%get_transparency() > 0.0)
then
113 call str%append(new_line(
'a'))
114 call str%append(
"set style fill transparent solid ")
115 call str%append(to_string(this%get_transparency()))
119 call str%append(new_line(
'a'))
120 call str%append(this%plot_3d%get_command_string())
123 x = char(str%to_string())
163 pure module function surf_get_smooth(this) result(x)
164 class(surface_plot),
intent(in) :: this
170 module subroutine surf_set_smooth(this, x)
171 class(surface_plot),
intent(inout) :: this
172 logical,
intent(in) :: x
177 pure module function surf_get_show_contours(this) result(x)
178 class(surface_plot),
intent(in) :: this
184 module subroutine surf_set_show_contours(this, x)
185 class(surface_plot),
intent(inout) :: this
186 logical,
intent(in) :: x
205 pure module function surf_get_use_lighting(this) result(x)
206 class(surface_plot),
intent(in) :: this
208 x = this%m_useLighting
212 module subroutine surf_set_use_lighting(this, x)
213 class(surface_plot),
intent(inout) :: this
214 logical,
intent(in) :: x
215 this%m_useLighting = x
219 pure module function surf_get_light_intensity(this) result(x)
220 class(surface_plot),
intent(in) :: this
222 x = this%m_lightIntensity
226 module subroutine surf_set_light_intensity(this, x)
227 class(surface_plot),
intent(inout) :: this
228 real(real32),
intent(in) :: x
230 this%m_lightIntensity = 0.0
231 else if (x > 1.0)
then
232 this%m_lightIntensity = 1.0
234 this%m_lightIntensity = x
239 pure module function surf_get_specular_intensity(this) result(x)
240 class(surface_plot),
intent(in) :: this
246 module subroutine surf_set_specular_intensity(this, x)
247 class(surface_plot),
intent(inout) :: this
248 real(real32),
intent(in) :: x
250 this%m_specular = 0.0
251 else if (x > 1.0)
then
252 this%m_specular = 1.0
259 pure module function surf_get_transparency(this) result(x)
260 class(surface_plot),
intent(in) :: this
262 x = this%m_transparency
266 module subroutine surf_set_transparency(this, x)
267 class(surface_plot),
intent(inout) :: this
268 real(real32),
intent(in) :: x
270 this%m_transparency = 1.0
271 else if (x <= 0.0)
then
272 this%m_transparency = 0.1
274 this%m_transparency = x