VICUS Library
Documentation of Vicus library
Loading...
Searching...
No Matches
VICUS::Project Class Reference

#include <VICUS_Project.h>

Classes

struct  RoomMapping
 

Public Types

enum  SelectionGroups {
  SG_Building = 0x001 , SG_Network = 0x002 , SG_Obstacle = 0x004 , SG_All = SG_Building | SG_Network | SG_Obstacle ,
  NUM_SG
}
 
enum  SenorType {
  ST_Horizontal , ST_North , ST_East , ST_South ,
  ST_West , NUM_ST
}
 

Public Member Functions

 Project ()
 
 Project (const Project &)=default
 
void parseHeader (const IBK::Path &filename)
 
void readXML (const IBK::Path &filename)
 
void readXML (const QString &projectText)
 
void readXMLDocument (TiXmlElement *rootElement)
 
void writeXML (const IBK::Path &filename) const
 
void readDirectoryPlaceholdersXML (const TiXmlElement *element)
 
void writeDirectoryPlaceholdersXML (TiXmlElement *parent) const
 
void updatePointers ()
 
void addChildSurface (const VICUS::Surface &s)
 
unsigned int nextUnusedID () const
 
VICUS::ObjectobjectById (unsigned int id)
 
const VICUS::ObjectobjectById (unsigned int id) const
 
VICUS::RoomroomByID (unsigned int roomID)
 
const VICUS::RoomroomByID (unsigned int roomID) const
 
VICUS::SurfacesurfaceByID (unsigned int surfaceID)
 
const VICUS::SurfacesurfaceByID (unsigned int surfaceID) const
 
VICUS::SubSurfacesubSurfaceByID (unsigned int surfID)
 
const VICUS::SubSurfacesubSurfaceByID (unsigned int surfID) const
 
void selectObjects (std::set< const Object * > &selectedObjs, SelectionGroups sg, bool takeSelected, bool takeVisible) const
 
void selectChildSurfaces (std::set< const Object * > &selectedObjs, const VICUS::Surface &s, bool takeSelected, bool takeVisible) const
 
bool selectedSubSurfaces (std::vector< const SubSurface * > &subSurfaces, const VICUS::Project::SelectionGroups &sg) const
 
bool selectedSurfaces (std::vector< const Surface * > &surfaces, const VICUS::Project::SelectionGroups &sg) const
 
bool selectedRooms (std::vector< const Room * > &rooms) const
 
QString newUniqueBuildingName (const QString &baseName) const
 
QString newUniqueBuildingLevelName (const QString &baseName) const
 
QString newUniqueRoomName (const QString &baseName) const
 
QString newUniqueSurfaceName (const QString &baseName) const
 
QString newUniqueSubSurfaceName (const QString &baseName) const
 
void generateNandradProject (NANDRAD::Project &p, QStringList &errorStack, const std::string &nandradProjectPath) const
 
void generateNetworkProjectData (NANDRAD::Project &p, QStringList &errorStack, const std::string &nandradProjectPath) const
 
void generateHeatLoadExport ()
 

Static Public Member Functions

static IBKMK::Vector3D boundingBox (std::vector< const Surface * > &surfaces, std::vector< const SubSurface * > &subsurfaces, IBKMK::Vector3D &center)
 
static IBKMK::Vector3D boundingBox (const std::vector< const NetworkEdge * > &edges, const std::vector< const NetworkNode * > &nodes, IBKMK::Vector3D &center)
 
static IBKMK::Vector3D boundingBox (std::vector< const VICUS::Surface * > &surfaces, std::vector< const VICUS::SubSurface * > &subsurfaces, IBKMK::Vector3D &center, const IBKMK::Vector3D &offset, const IBKMK::Vector3D &xAxis, const IBKMK::Vector3D &yAxis, const IBKMK::Vector3D &zAxis)
 
static bool connectSurfaces (double maxDist, double maxAngle, const std::set< const VICUS::Surface * > &selectedSurfaces, std::vector< VICUS::ComponentInstance > &newComponentInstances)
 

Public Attributes

NANDRAD::ProjectInfo m_projectInfo
 
NANDRAD::SolverParameter m_solverParameter
 
NANDRAD::SimulationParameter m_simulationParameter
 
NANDRAD::Location m_location
 
VICUS::Outputs m_outputs
 
ViewSettings m_viewSettings
 
std::vector< Networkm_geometricNetworks
 
std::vector< Buildingm_buildings
 
std::vector< ComponentInstancem_componentInstances
 
std::vector< SubSurfaceComponentInstancem_subSurfaceComponentInstances
 
PlainGeometry m_plainGeometry
 
std::map< std::string, IBK::Path > m_placeholders
 
EmbeddedDatabase m_embeddedDB
 
NANDRAD::FMIDescription m_fmiDescription
 
IBK::Path m_ifcFilePath
 

Detailed Description

The project data structure for the SIM-VICUS user interface.

Member Enumeration Documentation

◆ SelectionGroups

Private read-write functions.

Bitmasks for different selection groups used in selectObjects().

Enumerator
SG_Building 
SG_Network 
SG_Obstacle 
SG_All 
NUM_SG 

◆ SenorType

Sensor types for dynamic shading control.

Enumerator
ST_Horizontal 
ST_North 
ST_East 
ST_South 
ST_West 
NUM_ST 

Constructor & Destructor Documentation

◆ Project() [1/2]

VICUS::Project::Project ( )

Constructor, creates dummy data.

◆ Project() [2/2]

VICUS::Project::Project ( const Project )
default

Generate default copy constructor.

Member Function Documentation

◆ addChildSurface()

void VICUS::Project::addChildSurface ( const VICUS::Surface s)

Adds child surfaces to pointers of project.

◆ boundingBox() [1/3]

IBKMK::Vector3D VICUS::Project::boundingBox ( const std::vector< const NetworkEdge * > &  edges,
const std::vector< const NetworkNode * > &  nodes,
IBKMK::Vector3D &  center 
)
static

This function computes the global bounding box of all selected surfaces and the center point in global coordinates.

Returns
Returns the dimensions of the bounding box and its center point in argument 'center' in global coordinates.

◆ boundingBox() [2/3]

IBKMK::Vector3D VICUS::Project::boundingBox ( std::vector< const Surface * > &  surfaces,
std::vector< const SubSurface * > &  subsurfaces,
IBKMK::Vector3D &  center 
)
static

This function computes the global bounding box of all selected surfaces and the center point in global coordinates.

Returns
Returns the dimensions of the bounding box and its center point in argument 'center' in global coordinates.

◆ boundingBox() [3/3]

static IBKMK::Vector3D VICUS::Project::boundingBox ( std::vector< const VICUS::Surface * > &  surfaces,
std::vector< const VICUS::SubSurface * > &  subsurfaces,
IBKMK::Vector3D &  center,
const IBKMK::Vector3D &  offset,
const IBKMK::Vector3D &  xAxis,
const IBKMK::Vector3D &  yAxis,
const IBKMK::Vector3D &  zAxis 
)
static

This function computes the bounding box of all selected surfaces and the center point in LOCAL coordinates of the provided local coordinate system.

Returns
Returns the dimensions of the bounding box and its center point in argument 'center' in local coordinates.

◆ connectSurfaces()

bool VICUS::Project::connectSurfaces ( double  maxDist,
double  maxAngle,
const std::set< const VICUS::Surface * > &  selectedSurfaces,
std::vector< VICUS::ComponentInstance > &  newComponentInstances 
)
static

Attempts to create new surface-surface connections based on the current selection. Newly created component instances are stored in vector newComponentInstances alongside original component instances. Existing component instances that reference now connected surfaces are removed. The component is selected based on existing component instances.

◆ generateHeatLoadExport()

void VICUS::Project::generateHeatLoadExport ( )

◆ generateNandradProject()

void VICUS::Project::generateNandradProject ( NANDRAD::Project &  p,
QStringList &  errorStack,
const std::string &  nandradProjectPath 
) const

Converts VICUS data structure into NANDRAD project file. This function throws an error message in case the conversion failed.

Parameters
pThe NANDRAD project to be populated.

◆ generateNetworkProjectData()

void VICUS::Project::generateNetworkProjectData ( NANDRAD::Project &  p,
QStringList &  errorStack,
const std::string &  nandradProjectPath 
) const

◆ newUniqueBuildingLevelName()

QString VICUS::Project::newUniqueBuildingLevelName ( const QString &  baseName) const

◆ newUniqueBuildingName()

QString VICUS::Project::newUniqueBuildingName ( const QString &  baseName) const

◆ newUniqueRoomName()

QString VICUS::Project::newUniqueRoomName ( const QString &  baseName) const

◆ newUniqueSubSurfaceName()

QString VICUS::Project::newUniqueSubSurfaceName ( const QString &  baseName) const

◆ newUniqueSurfaceName()

QString VICUS::Project::newUniqueSurfaceName ( const QString &  baseName) const

◆ nextUnusedID()

unsigned int VICUS::Project::nextUnusedID ( ) const

Searches through all objects and determines the largest object ID (not unique ID!) used for buildings, buildingLevels, rooms, surface, subsurfaces, networks, etc and returns the next ID to be used for new data elements. For example, if IDs 10, 11, 14 have been used already, the function returns 15.

Note
Expects that updatePointers() has been called beforehand (i.e. project is synced)

◆ objectById() [1/2]

Object * VICUS::Project::objectById ( unsigned int  id)

Searches through all objects in project structure for the object with the object ID.

Returns
Returns nullptr, when object cannot be found.

◆ objectById() [2/2]

const VICUS::Object * VICUS::Project::objectById ( unsigned int  id) const
inline

Searches through all objects in project structure for the object with the object ID. Const version of the above function.

Returns
Returns nullptr, when object cannot be found.

◆ parseHeader()

void VICUS::Project::parseHeader ( const IBK::Path &  filename)

Parses only the header of the XML file. This function is supposed to be fast, yet not a complete XML parser.

Parameters
filenameThe full path to the project file.

◆ readDirectoryPlaceholdersXML()

void VICUS::Project::readDirectoryPlaceholdersXML ( const TiXmlElement *  element)

Reads the placeholder section into m_placeholders map.

◆ readXML() [1/2]

void VICUS::Project::readXML ( const IBK::Path &  filename)

Reads the project data from an XML file.

Parameters
filenameThe full path to the project file.

◆ readXML() [2/2]

void VICUS::Project::readXML ( const QString &  projectText)

Reads the project data from an text which contains XML.

Parameters
projectTextText with VICUS project.

◆ readXMLDocument()

void VICUS::Project::readXMLDocument ( TiXmlElement *  rootElement)

Actual read function, called from both variants of readXML().

◆ roomByID() [1/2]

VICUS::Room * VICUS::Project::roomByID ( unsigned int  roomID)
inline

Tries to find a room with given ID. A convenience function that uses objectById() internally.

◆ roomByID() [2/2]

const VICUS::Room * VICUS::Project::roomByID ( unsigned int  roomID) const
inline

Const-version of the function above.

◆ selectChildSurfaces()

void VICUS::Project::selectChildSurfaces ( std::set< const Object * > &  selectedObjs,
const VICUS::Surface s,
bool  takeSelected,
bool  takeVisible 
) const

Select all child surfaces of surface.

◆ selectedRooms()

bool VICUS::Project::selectedRooms ( std::vector< const Room * > &  rooms) const

This function collects the pointers to all selected rooms. This is a convenience function which essentially does the same as selectObjects, but only returns visible and selected objects of type Room. Type of wich should be returned can be set with

Returns
Returns true if any room is selected (same as rooms.size() > 0).

◆ selectedSubSurfaces()

bool VICUS::Project::selectedSubSurfaces ( std::vector< const SubSurface * > &  subSurfaces,
const VICUS::Project::SelectionGroups sg 
) const

This function collects the pointers to all selected sub surfaces. This is a convenience function which essentially does the same as selectObjects, but only returns visible and selected objects of type SubSurface.

Returns
Returns true if any sub surface is selected (same as subSurfaces.size() > 0).

◆ selectedSurfaces()

bool VICUS::Project::selectedSurfaces ( std::vector< const Surface * > &  surfaces,
const VICUS::Project::SelectionGroups sg 
) const

This function collects the pointers to all selected surfaces. This is a convenience function which essentially does the same as selectObjects, but only returns visible and selected objects of type Surface.

Returns
Returns true if any surface is selected (same as surfaces.size() > 0).

◆ selectObjects()

void VICUS::Project::selectObjects ( std::set< const Object * > &  selectedObjs,
SelectionGroups  sg,
bool  takeSelected,
bool  takeVisible 
) const

Selects objects and return set with pointers according to additional filters.

Parameters
selectedObjsHere the pointers to selected objects are returned.
sgSelection group, that the object belongs to.
takeSelectedIf true, only objects with "selected" property enabled are taken. If false, selection property is ignored.
takeVisibleIf true, only objects with "visible" property enabled are taken. If false, visible property is ignored.

◆ subSurfaceByID() [1/2]

VICUS::SubSurface * VICUS::Project::subSurfaceByID ( unsigned int  surfID)
inline

Tries to find a sub-surface with given ID. A convenience function that uses objectById() internally.

◆ subSurfaceByID() [2/2]

const VICUS::SubSurface * VICUS::Project::subSurfaceByID ( unsigned int  surfID) const
inline

Const-version of the function above.

◆ surfaceByID() [1/2]

VICUS::Surface * VICUS::Project::surfaceByID ( unsigned int  surfaceID)
inline

Tries to find a surface with given ID. A convenience function that uses objectById() internally.

◆ surfaceByID() [2/2]

const VICUS::Surface * VICUS::Project::surfaceByID ( unsigned int  surfaceID) const
inline

Const-version of the function above.

◆ updatePointers()

void VICUS::Project::updatePointers ( )

Call this function whenever project data has changed that depends on objects linked through pointers (building hierarchies, networks etc.). Checks interrelated definitions/references for validity. Throws IBK::Exceptions in case of errors. Call this function after reading a project and during debugging after project modifications to ensure data consistency.

◆ writeDirectoryPlaceholdersXML()

void VICUS::Project::writeDirectoryPlaceholdersXML ( TiXmlElement *  parent) const

Writes the section with directory place holders.

◆ writeXML()

void VICUS::Project::writeXML ( const IBK::Path &  filename) const

Writes the project file to an XML file.

Parameters
filenameThe full path to the project file.

Member Data Documentation

◆ m_buildings

std::vector<Building> VICUS::Project::m_buildings

◆ m_componentInstances

std::vector<ComponentInstance> VICUS::Project::m_componentInstances

All components actually placed in the geometry. This vector is outside buildings, so that two building parts can be connected with a component.

◆ m_embeddedDB

EmbeddedDatabase VICUS::Project::m_embeddedDB

Holds the database elements referenced in the project. These are a copy of db elements in the built-in and user-database and stored for project exchange between computers.

◆ m_fmiDescription

NANDRAD::FMIDescription VICUS::Project::m_fmiDescription

Definitions for exporting an FMU from the model.

◆ m_geometricNetworks

std::vector<Network> VICUS::Project::m_geometricNetworks

◆ m_ifcFilePath

IBK::Path VICUS::Project::m_ifcFilePath

Contains a file name for a IFC model in case of import from IFC.

◆ m_location

NANDRAD::Location VICUS::Project::m_location

Location and climate settings for NANDRAD.

◆ m_outputs

VICUS::Outputs VICUS::Project::m_outputs

Output definitions.

◆ m_placeholders

std::map< std::string, IBK::Path > VICUS::Project::m_placeholders

Path placeholder mappings used to substitute placeholders for database and user databases. These placeholders are read from the path placeholders section of the project file and hold a full directory path for a given placeholder name. You can compose a placeholder yourself:

m_placeholders["Database"] = "/path/to/databases";
// and then use this to resolve a relative path defined in the project file as
string relative_path = "${Database}/db_materials.xml";
std::map< std::string, IBK::Path > m_placeholders
Definition VICUS_Project.h:323

◆ m_plainGeometry

PlainGeometry VICUS::Project::m_plainGeometry

Vector with plain (dumb) geometry.

◆ m_projectInfo

NANDRAD::ProjectInfo VICUS::Project::m_projectInfo

Project info tag is manually written (not by code generator), to be located directly under root-node and not inside Project node.

◆ m_simulationParameter

NANDRAD::SimulationParameter VICUS::Project::m_simulationParameter

Simulation parameters for NANDRAD.

◆ m_solverParameter

NANDRAD::SolverParameter VICUS::Project::m_solverParameter

Solver parameters for NANDRAD.

◆ m_subSurfaceComponentInstances

std::vector<SubSurfaceComponentInstance> VICUS::Project::m_subSurfaceComponentInstances

◆ m_viewSettings

ViewSettings VICUS::Project::m_viewSettings

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