OpenStudio:utilities
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Static Public Member Functions | List of all members
openstudio::FloorplanJS Class Reference

#include <FloorplanJS.hpp>

Public Member Functions

 FloorplanJS ()
 default constructor More...
 
 FloorplanJS (const std::string &json)
 constructor from JSON formatted string, will throw if error More...
 
double northAxis () const
 degrees from North measured clockwise More...
 
void resetNorthAxis ()
 
void resetUnits ()
 
bool setNorthAxis (double northAxis)
 
bool setUnits (const std::string &units)
 
std::string toJSON (bool prettyPrint=false) const
 print to JSON More...
 
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 More...
 
std::string units () const
 unit system, "ip" or "si" More...
 
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 More...
 
void updateThermalZones (const std::vector< FloorplanObject > &objects, bool removeMissingObjects)
 

Static Public Member Functions

static boost::optional
< FloorplanJS
load (const std::string &json)
 load from string More...
 

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

openstudio::FloorplanJS::FloorplanJS ( )

default constructor

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

constructor from JSON formatted string, will throw if error

Member Function Documentation

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

load from string

double openstudio::FloorplanJS::northAxis ( ) const

degrees from North measured clockwise

void openstudio::FloorplanJS::resetNorthAxis ( )
void openstudio::FloorplanJS::resetUnits ( )
bool openstudio::FloorplanJS::setNorthAxis ( double  northAxis)
bool openstudio::FloorplanJS::setUnits ( const std::string &  units)
std::string openstudio::FloorplanJS::toJSON ( bool  prettyPrint = false) const

print to JSON

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

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

unit system, "ip" or "si"

void openstudio::FloorplanJS::updateBuildingUnits ( const std::vector< FloorplanObject > &  objects,
bool  removeMissingObjects 
)
void openstudio::FloorplanJS::updateConstructionSets ( const std::vector< FloorplanObject > &  objects,
bool  removeMissingObjects 
)
void openstudio::FloorplanJS::updateSpaces ( const std::vector< FloorplanObject > &  objects,
bool  removeMissingObjects 
)
void openstudio::FloorplanJS::updateSpaceTypes ( const std::vector< FloorplanObject > &  objects,
bool  removeMissingObjects 
)
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

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