scenepic 1.1.0
3D Visualization Made Easy
Public Member Functions | Friends | List of all members
scenepic::Canvas2D Class Reference

A 2D canvas that can contain a number of Frame2Ds. More...

#include <canvas2d.h>

Public Member Functions

const std::string & canvas_id () const
 A unique identifier for the canvas. More...
 
std::shared_ptr< Frame2Dcreate_frame (const std::string &frame_id="")
 Creates a new Frame2D object and appends to the list of Frame2Ds in the Canvas2D. More...
 
void clear_script ()
 Call this if you are dumping a ScenePic script in multiple parts, e.g. More...
 
std::string to_string () const
 Return a JSON string representing the object. More...
 
JsonValue to_json () const
 Convert this object into ScenePic json. More...
 
const Colorbackground_color () const
 The background color of the frame. More...
 
Canvas2Dbackground_color (const Color &color)
 Set the background color of the frame. More...
 
double width () const
 The width of the canvas. More...
 
double height () const
 The width of the canvas. More...
 
const std::string & media_id () const
 The unique ID of the media file associated with this canvas. More...
 
void set_layer_settings (const std::map< std::string, LayerSettings > layer_settings)
 Specify the visibilities and opacities of certain mesh layers. More...
 
Canvas2Dmedia_id (const std::string &media_id)
 

Friends

class Scene
 

Detailed Description

A 2D canvas that can contain a number of Frame2Ds.

Member Function Documentation

◆ background_color() [1/2]

const Color & scenepic::Canvas2D::background_color ( ) const

The background color of the frame.

◆ background_color() [2/2]

Canvas2D & scenepic::Canvas2D::background_color ( const Color color)

Set the background color of the frame.

◆ canvas_id()

const std::string & scenepic::Canvas2D::canvas_id ( ) const

A unique identifier for the canvas.

◆ clear_script()

void scenepic::Canvas2D::clear_script ( )

Call this if you are dumping a ScenePic script in multiple parts, e.g.

for client-server interactions, or when chunking a large visualization into multiple files.

◆ create_frame()

std::shared_ptr< Frame2D > scenepic::Canvas2D::create_frame ( const std::string &  frame_id = "")

Creates a new Frame2D object and appends to the list of Frame2Ds in the Canvas2D.

Parameters
frame_ida unique identifier for the Frame3D (will be automatically populated if not provided).
Returns
a Frame2D object

◆ height()

double scenepic::Canvas2D::height ( ) const

The width of the canvas.

◆ media_id() [1/2]

const std::string & scenepic::Canvas2D::media_id ( ) const

The unique ID of the media file associated with this canvas.

This file will be used to drive playback, i.e. frames will be displayed in time with the playback of the media file.

◆ media_id() [2/2]

Canvas2D & scenepic::Canvas2D::media_id ( const std::string &  media_id)

◆ set_layer_settings()

void scenepic::Canvas2D::set_layer_settings ( const std::map< std::string, LayerSettings layer_settings)

Specify the visibilities and opacities of certain mesh layers.

Each Mesh object can optionally be part of a user-identified layer (see Mesh constructor). Calling set_layer_settings will result in an additional drop-down selector in the ScenePic user interface. Currently, opacity is only guaranteed to be correct for Meshes that do not overlap. If you know one mesh should be rendered before another for opacity purposes, use the renderOrder setting: low numbers will be drawn before high numbers, and layers with no renderOrder set will be drawn first. Meshes without layer ids, or with layer ids that are not specified in this dictionary, will be drawn filled, without wireframe, at opacity 1.0, and before any layers with renderOrder set.

◆ to_json()

JsonValue scenepic::Canvas2D::to_json ( ) const

Convert this object into ScenePic json.

Returns
a json value

◆ to_string()

std::string scenepic::Canvas2D::to_string ( ) const

Return a JSON string representing the object.

◆ width()

double scenepic::Canvas2D::width ( ) const

The width of the canvas.

Friends And Related Function Documentation

◆ Scene

friend class Scene
friend

The documentation for this class was generated from the following file: