IdfViewer
is a class designed to view geometry of an Idf and map
simulation results to the geometries.
idf_viewer(geometry)
An IdfGeometry object. geometry
can also be a
path to an IDF file or an Idf object. In this case, an
IdfGeometry
is created based on input Idf.
An IdfViewer
object.
IdfGeometry class
new()
Create an IdfViewer
object
IdfViewer$new(geometry)
geometry
An IdfGeometry object. geometry
can also be a
path to an IDF file or an Idf object. In this case, an
IdfGeometry
is created based on input Idf.
\dontrun{
# example model shipped with eplusr from EnergyPlus v8.8
path_idf <- system.file("extdata/1ZoneUncontrolled.idf", package = "eplusr") # v8.8
# create from an Idf object
idf <- read_idf(path_idf, use_idd(8.8, "auto"))
viewer <- idf_viewer(idf)
viewer <- IdfViewer$new(idf)
# create from an IDF file
viewer <- idf_viewer(path_idf)
viewer <- IdfViewer$new(path_idf)
}
parent()
Get parent Idf object
$parent()
returns the parent Idf object of current IdfGeometry
object.
An Idf object.
geometry()
Get parent IdfGeometry object
$geometry()
returns the parent IdfGeometry object.
An IdfGeometry object.
device()
Get Rgl device ID
viewpoint()
Set the viewpoint orientation of the scene
IdfViewer$viewpoint(
look_at = "iso",
theta = NULL,
phi = NULL,
fov = NULL,
zoom = NULL,
scale = NULL
)
look_at
A single string indicating a standard view. If
specified, theta
and phi
will be ignored. Should be
one of c("top", "bottom", "left", "right", "front", "back", "iso")
. look_at
will be ignored if any of theta
and phi
is specified. Default: iso
(i.e. isometric).
theta
Theta in polar coordinates. If NULL
, no changes will
be made to current scene. Default: NULL
.
phi
Phi in polar coordinates. If NULL
, no changes will be
made to current scene. Default: NULL
.
fov
Field-of-view angle in degrees. If 0
, a parallel or
orthogonal projection is used. If NULL
, no changes will
be made to current scene. Default: NULL
.
zoom
Zoom factor. If NULL
, no changes will be made to
current scene. Default: NULL
.
scale
A numeric vector of length 3 giving the rescaling to
apply to each axis. If NULL
, no changes will be made to
current scene. Default: NULL
.
win_size()
Set the window size
mouse_mode()
Set the handlers of mouse control
left, right, middle
Refer to the buttons on a three button
mouse, or simulations of them on other mice. Defaults:
"trackball"
(left
), "pan"
(right
) and "fov"
(middle
).
wheel
Refer to the mouse wheel. Default: "pull"
.
Possible values are:
Mode | Description |
"none" | No action |
"trackball" | The mouse acts as a virtual trackball. Clicking and dragging rotates the scene |
"xAxis", "yAxis", "zAxis" | Like "trackball", but restricted to rotation about one axis |
"polar" | The mouse affects rotations by controlling polar coordinates directly |
"zoom" | The mouse zooms the display |
"fov" | The mouse affects perspective by changing the field of view |
"pull" | Rotating the mouse wheel towards the user “ pulls the scene closer” |
"push" | The same rotation “pushes the scene away” |
"pan" | Pan the camera view vertically or horizontally |
axis()
Toggle axis in the scene
IdfViewer$axis(
add = TRUE,
expand = 2,
width = 1.5,
color = c("red", "green", "blue", "orange"),
alpha = 1
)
add
If TRUE
, axis is added to the scene. If FALSE
, axis is
removed in the scene.
expand
A single number giving the factor to expand based on
the largest X, Y and Z coordinate values. Default: 2.0
.
width
A number giving the line width of axis. width * 2
is
used for the true north axis. Default: 1.5
.
color
A character of length 4 giving the color of X, Y, Z and
true north axis. Default: c("red", "green", "blue", "orange")
.
alpha
A number giving the alpha value of axis. Default: 1.0
.
ground()
Toggle ground in the scene
add
If TRUE
, ground is added to the scene. If FALSE
,
ground is removed in the scene.
expand
A single number giving the factor to expand based on
the largest X, Y and Z coordinate values. Default: 1.02
.
color
A string giving the color of ground. Default: #EDEDEB
.
alpha
A number giving the alpha value of ground. Default: 1.0
.
wireframe()
Toggle wireframe
add
If TRUE
, wireframe is turned on. If FALSE
, wireframe
is turned off. Default: TRUE
.
width
A number giving the line width of axis. Default: 1.5
.
color
A character of length 3 giving the color of X, Y and Z
axis. Default: c("red", "green", "blue")
.
alpha
A number giving the alpha value of axis. Default: 1.0
.
render_by()
Set render style
type
A single string giving the render style. Should be one of:
"surface_type"
: Default. Render the model by surface type
model. Walls, roofs, windows, doors, floors, and shading
surfaces will have unique colors.
"boundary"
: Render the model by outside boundary condition.
Only surfaces that have boundary conditions will be rendered
with a color. All other surfaces will be white.
"construction"
: Render the model by surface constructions.
"zone"
: Render the model by zones assigned.
"space"
: Render the model by spaces assigned.
"normal"
: Render the model by surface normal. The outside
face of a heat transfer face will be rendered as white and the
inside face will be rendered as red.
show()
Show Idf geometry
IdfViewer$show(
type = "all",
zone = NULL,
space = NULL,
surface = NULL,
width = 1.5,
dayl_color = "red",
dayl_size = 5
)
type
A character vector of geometry components to show. If
"all"
(default), all geometry components will be shown. If
NULL
, no geometry faces will be shown. Otherwise, should be
a subset of following:
"floor"
"wall"
"roof"
"window"
"door"
"shading"
"daylighting"
zone
A character vector of names or an integer vector of IDs
of zones in current Idf to show. If NULL
, no subsetting is
performed.
space
A character vector of names or an integer vector of IDs
of spaces in current Idf to show. If NULL
, no subsetting is
performed.
surface
A character vector of names or an integer vector of IDs
of surfaces in current Idf to show. If NULL
, no subsetting
is performed.
width
The line width for the geometry components. Default:
1.5
.
dayl_color, dayl_size
The color and size of daylighting
reference points. Defaults: "red"
(dayl_color
) and 5
(dayl_size
).
snapshot()
Capture and save current rgl view as an image
filename
A single string specifying the file name. Current
supported formats are png
, pdf
, svg
, ps
, eps
, tex
and pgf
.
webshot
Whether to use the 'webshot2' package to take the
snapshot. For more details, please see rgl::snapshot3d()
.
Default: FALSE
.
...
Arguments to pass to webshot2::webshot()
.
$snapshot()
captures the current rgl view and saves it as an image
file to disk using rgl::snapshot3d()
and rgl::rgl.postscript()
.
print()
Print an IdfViewer
object
## ------------------------------------------------
## Method `IdfViewer$new`
## ------------------------------------------------
if (FALSE) { # \dontrun{
# example model shipped with eplusr from EnergyPlus v8.8
path_idf <- system.file("extdata/1ZoneUncontrolled.idf", package = "eplusr") # v8.8
# create from an Idf object
idf <- read_idf(path_idf, use_idd(8.8, "auto"))
viewer <- idf_viewer(idf)
viewer <- IdfViewer$new(idf)
# create from an IDF file
viewer <- idf_viewer(path_idf)
viewer <- IdfViewer$new(path_idf)
} # }
## ------------------------------------------------
## Method `IdfViewer$parent`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$parent()
} # }
## ------------------------------------------------
## Method `IdfViewer$geometry`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$geometry()
} # }
## ------------------------------------------------
## Method `IdfViewer$device`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$device()
} # }
## ------------------------------------------------
## Method `IdfViewer$background`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$background("blue")
} # }
## ------------------------------------------------
## Method `IdfViewer$viewpoint`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$viewpoint()
} # }
## ------------------------------------------------
## Method `IdfViewer$win_size`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$win_size(0, 0, 400, 500)
} # }
## ------------------------------------------------
## Method `IdfViewer$mouse_mode`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$mouse_mode()
} # }
## ------------------------------------------------
## Method `IdfViewer$axis`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$axis()
} # }
## ------------------------------------------------
## Method `IdfViewer$ground`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$ground()
} # }
## ------------------------------------------------
## Method `IdfViewer$wireframe`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$wireframe()
} # }
## ------------------------------------------------
## Method `IdfViewer$x_ray`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$x_ray()
} # }
## ------------------------------------------------
## Method `IdfViewer$render_by`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$render_by()
} # }
## ------------------------------------------------
## Method `IdfViewer$show`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$show()
} # }
## ------------------------------------------------
## Method `IdfViewer$focus`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$top()
} # }
## ------------------------------------------------
## Method `IdfViewer$close`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$close()
} # }
## ------------------------------------------------
## Method `IdfViewer$snapshot`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$show()
viewer$snapshot(tempfile(fileext = ".png"))
} # }
## ------------------------------------------------
## Method `IdfViewer$print`
## ------------------------------------------------
if (FALSE) { # \dontrun{
viewer$print()
} # }