IdfViewer is a class designed to view geometry of an Idf and map simulation results to the geometries.

idf_viewer(geometry)

Arguments

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.

Value

An IdfViewer object.

See also

Author

Hongyuan Jia

Methods


Method new()

Create an IdfViewer object

Usage

IdfViewer$new(geometry)

Arguments

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.

Returns

An IdfViewer object.

Examples

\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 parent()

Get parent Idf object

Usage

IdfViewer$parent()

Details

$parent() returns the parent Idf object of current IdfGeometry object.

Returns

An Idf object.

Examples

\dontrun{
viewer$parent()
}


Method geometry()

Get parent IdfGeometry object

Usage

IdfViewer$geometry()

Details

$geometry() returns the parent IdfGeometry object.

Returns

An IdfGeometry object.

Examples

\dontrun{
viewer$geometry()
}


Method device()

Get Rgl device ID

Usage

IdfViewer$device()

Details

If Rgl is used, the Rgl device ID is returned. If WebGL is used, the elementID is returned. If no viewer has been open, NULL is returned.

Returns

A number or NULL

Examples

\dontrun{
viewer$device()
}


Method background()

Set the background color of the scene

Usage

IdfViewer$background(color = "white")

Arguments

color

A single string giving the background color. Default: white.

Examples

\dontrun{
viewer$background("blue")
}


Method viewpoint()

Set the viewpoint orientation of the scene

Usage

IdfViewer$viewpoint(
  look_at = "iso",
  theta = NULL,
  phi = NULL,
  fov = NULL,
  zoom = NULL,
  scale = NULL
)

Arguments

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.

Examples

\dontrun{
viewer$viewpoint()
}


Method win_size()

Set the window size

Usage

IdfViewer$win_size(left = 0, top = 0, right = 600, bottom = 600)

Arguments

left, top, right, bottom

A single number indicating the pixels of the displayed window. Defaults: 0 (left), 0 (top), 600 (right) and 600 (bottom).

Examples

\dontrun{
viewer$win_size(0, 0, 400, 500)
}


Method mouse_mode()

Set the handlers of mouse control

Usage

IdfViewer$mouse_mode(
  left = "trackball",
  right = "pan",
  middle = "fov",
  wheel = "pull"
)

Arguments

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".

Details

Possible values are:

ModeDescription
"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

Examples

\dontrun{
viewer$mouse_mode()
}


Method axis()

Toggle axis in the scene

Usage

IdfViewer$axis(
  add = TRUE,
  expand = 2,
  width = 1.5,
  color = c("red", "green", "blue", "orange"),
  alpha = 1
)

Arguments

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.

Details

$axis() adds or removes X, Y and Z axis in the scene.

Returns

A single logical value as add.

Examples

\dontrun{
viewer$axis()
}


Method ground()

Toggle ground in the scene

Usage

IdfViewer$ground(add = TRUE, expand = 1.02, color = "#EDEDEB", alpha = 1)

Arguments

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.

Details

$ground() adds or removes ground in the scene.

Returns

A single logical value as add.

Examples

\dontrun{
viewer$ground()
}


Method wireframe()

Toggle wireframe

Usage

IdfViewer$wireframe(add = TRUE, width = 1.5, color = "black", alpha = 1)

Arguments

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.

Details

$wireframe() turns on/off wireframes.

Returns

A single logical value as add.

Examples

\dontrun{
viewer$wireframe()
}


Method x_ray()

Toggle X-ray face style

Usage

IdfViewer$x_ray(on = TRUE)

Arguments

on

If TRUE, X-ray is turned on. If FALSE, X-ray is turned off. Default: TRUE.

Details

$x_ray() turns on/off X-ray face style.

Returns

A single logical value as on.

Examples

\dontrun{
viewer$x_ray()
}


Method render_by()

Set render style

Usage

IdfViewer$render_by(type = "surface_type")

Arguments

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.

Details

$render_by() sets the render style of geometries.

Returns

A same value as style.

Examples

\dontrun{
viewer$render_by()
}


Method show()

Show Idf geometry

Usage

IdfViewer$show(
  type = "all",
  zone = NULL,
  space = NULL,
  surface = NULL,
  width = 1.5,
  dayl_color = "red",
  dayl_size = 5
)

Arguments

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).

Returns

The IdfViewer itself, invisibly.

Examples

\dontrun{
viewer$show()
}


Method focus()

Bring the scene window to the top

Usage

IdfViewer$focus()

Examples

\dontrun{
viewer$top()
}


Method close()

Close the scene window

Usage

IdfViewer$close()

Examples

\dontrun{
viewer$close()
}


Method snapshot()

Capture and save current rgl view as an image

Usage

IdfViewer$snapshot(filename, webshot = FALSE, ...)

Arguments

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().

Details

$snapshot() captures the current rgl view and saves it as an image file to disk using rgl::snapshot3d() and rgl::rgl.postscript().

Returns

A single string of the file path.

Examples

\dontrun{
viewer$show()
viewer$snapshot(tempfile(fileext = ".png"))
}


Method print()

Print an IdfViewer object

Usage

IdfViewer$print()

Returns

The IdfViewer itself, invisibly.

Examples

\dontrun{
viewer$print()
}

Examples


## ------------------------------------------------
## 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()
} # }