OpenStudio:utilities
Loading...
Searching...
No Matches
openstudio::FloorplanJS Class Reference

#include <FloorplanJS.hpp>

Public Member Functions

double elevation () const
 elevation from sea level
 
 FloorplanJS ()
 default constructor
 
 FloorplanJS (const std::string &json)
 constructor from JSON formatted string, will throw if error
 
double latitude () const
 degrees, North is positive, South is negative
 
double longitude () const
 degrees, West is negative, East is positive
 
double northAxis () const
 degrees from Building North to True North measured clockwise, opposite of EnergyPlus convention
 
void resetElevation ()
 
void resetLatitude ()
 
void resetLongitude ()
 
void resetNorthAxis ()
 
void resetUnits ()
 
bool setElevation (double elevation)
 
bool setLatitude (double latitude)
 
bool setLongitude (double longitude)
 
bool setNorthAxis (double northAxis)
 
bool setUnits (const std::string &units)
 
std::string toJSON (bool prettyPrint=false) const
 print to JSON
 
ThreeScene toThreeScene (bool openstudioFormat) const
 convert to ThreeJS, will throw if error if openstudioFormat is true, surfaces will be created with arbitrary number of vertices, not suitable for rendering using ThreeJS if openstudioFormat is false, surfaces will be created with with either 3 or 4 vertices, suitable for rendering using ThreeJS ThreeJS file produced will always be in metric units, NorthAxis will not be applied during this conversion
 
std::string units () const
 unit system, "ip" or "si"
 
void updateBuildingUnits (const std::vector< FloorplanObject > &objects, bool removeMissingObjects)
 
void updateConstructionSets (const std::vector< FloorplanObject > &objects, bool removeMissingObjects)
 
void updateSpaces (const std::vector< FloorplanObject > &objects, bool removeMissingObjects)
 
void updateSpaceTypes (const std::vector< FloorplanObject > &objects, bool removeMissingObjects)
 
void updateStories (const std::vector< FloorplanObject > &objects, bool removeMissingObjects)
 update object names in Floorplan with external data if object with same handle exists, name will be updated else if object with same name exists, handle will be assigned else new object will be added if removeMissingObjects is true, then existing objects not in input will be deleted
 
void updateThermalZones (const std::vector< FloorplanObject > &objects, bool removeMissingObjects)
 

Static Public Member Functions

static boost::optional< FloorplanJSload (const std::string &json)
 load from string
 

Detailed Description

FloorplanJS is an adapter for the FloorspaceJS JSON format.

This class includes code which transforms a FloorspaceJS JSON into a 3D model in ThreeJS format. There are two variations of the ThreeJS format, one which is suitable for rendering with ThreeJS and one that preserves all vertices in a surface for conversion to OpenStudio Model format. Converting from FloorspaceJS to ThreeJS to OpenStudio ensures that the ThreeJS preview of a FloorspaceJS model is as accurate as possible. These conversions can also be used to convert a FloorspaceJS file to a 3D model for translation to other 3D formats.

FloorplanJS does not support version translation of old FloorspaceJS files, that functionality is in the FloorspaceJS project.

The ThreeJSForwardTranslator in the Model project converts an OpenStudio Model to ThreeJS format, code should be shared between these two classes as much as possible.

The class is not impl-ized in hopes that it can be ported to JavaScript via emscripten

Constructor & Destructor Documentation

◆ FloorplanJS() [1/2]

openstudio::FloorplanJS::FloorplanJS ( )

default constructor

◆ FloorplanJS() [2/2]

openstudio::FloorplanJS::FloorplanJS ( const std::string & json)

constructor from JSON formatted string, will throw if error

Member Function Documentation

◆ elevation()

double openstudio::FloorplanJS::elevation ( ) const

elevation from sea level

◆ latitude()

double openstudio::FloorplanJS::latitude ( ) const

degrees, North is positive, South is negative

◆ load()

static boost::optional< FloorplanJS > openstudio::FloorplanJS::load ( const std::string & json)
static

load from string

◆ longitude()

double openstudio::FloorplanJS::longitude ( ) const

degrees, West is negative, East is positive

◆ northAxis()

double openstudio::FloorplanJS::northAxis ( ) const

degrees from Building North to True North measured clockwise, opposite of EnergyPlus convention

◆ resetElevation()

void openstudio::FloorplanJS::resetElevation ( )

◆ resetLatitude()

void openstudio::FloorplanJS::resetLatitude ( )

◆ resetLongitude()

void openstudio::FloorplanJS::resetLongitude ( )

◆ resetNorthAxis()

void openstudio::FloorplanJS::resetNorthAxis ( )

◆ resetUnits()

void openstudio::FloorplanJS::resetUnits ( )

◆ setElevation()

bool openstudio::FloorplanJS::setElevation ( double elevation)

◆ setLatitude()

bool openstudio::FloorplanJS::setLatitude ( double latitude)

◆ setLongitude()

bool openstudio::FloorplanJS::setLongitude ( double longitude)

◆ setNorthAxis()

bool openstudio::FloorplanJS::setNorthAxis ( double northAxis)

◆ setUnits()

bool openstudio::FloorplanJS::setUnits ( const std::string & units)

◆ toJSON()

std::string openstudio::FloorplanJS::toJSON ( bool prettyPrint = false) const

print to JSON

◆ toThreeScene()

ThreeScene openstudio::FloorplanJS::toThreeScene ( bool openstudioFormat) const

convert to ThreeJS, will throw if error if openstudioFormat is true, surfaces will be created with arbitrary number of vertices, not suitable for rendering using ThreeJS if openstudioFormat is false, surfaces will be created with with either 3 or 4 vertices, suitable for rendering using ThreeJS ThreeJS file produced will always be in metric units, NorthAxis will not be applied during this conversion

◆ units()

std::string openstudio::FloorplanJS::units ( ) const

unit system, "ip" or "si"

◆ updateBuildingUnits()

void openstudio::FloorplanJS::updateBuildingUnits ( const std::vector< FloorplanObject > & objects,
bool removeMissingObjects )

◆ updateConstructionSets()

void openstudio::FloorplanJS::updateConstructionSets ( const std::vector< FloorplanObject > & objects,
bool removeMissingObjects )

◆ updateSpaces()

void openstudio::FloorplanJS::updateSpaces ( const std::vector< FloorplanObject > & objects,
bool removeMissingObjects )

◆ updateSpaceTypes()

void openstudio::FloorplanJS::updateSpaceTypes ( const std::vector< FloorplanObject > & objects,
bool removeMissingObjects )

◆ updateStories()

void openstudio::FloorplanJS::updateStories ( const std::vector< FloorplanObject > & objects,
bool removeMissingObjects )

update object names in Floorplan with external data if object with same handle exists, name will be updated else if object with same name exists, handle will be assigned else new object will be added if removeMissingObjects is true, then existing objects not in input will be deleted

◆ updateThermalZones()

void openstudio::FloorplanJS::updateThermalZones ( const std::vector< FloorplanObject > & objects,
bool removeMissingObjects )