MainPage   Related pages 
 All Classes Functions Pages
CoreAPI.h
1 
2 //
3 // $Id: CoreAPI.h 3898 2020-08-27 10:10:44Z ansgar.horstmann $
4 // (c) ceapoint aec technologies GmbH
5 //
6 
7 
8 
9 #pragma once
10 
11 
12 #include <basic/IProgressDelegate.h>
13 #include <model/IProject.h>
14 #include <model/IObject.h>
15 
16 #include <domainDocuments/DocumentProject.h>
17 #include <domainDocuments/Document.h>
18 
19 #include <domainQTO/QTOProject.h>
20 #include <domainQTO/ConstructionElement.h>
21 
22 
23 // test reading and parsing a json file with cache
24 //#define ENABLE_READJSON 1
25 
26 
27 namespace domainGeometry3D {
28  class Project;
29 }
30 
31 
32 namespace domainBim
33 {
34 
35  class BimProject;
36 
53  class CoreAPI : public QObject, public basic::IProgressDelegate
54  {
55  Q_OBJECT
56 
57  public:
58 
59 
61 
62  CoreAPI::CoreAPI( BimProject* bimPrj, QObject* parent = 0);
63  virtual ~CoreAPI();
64 
65  BimProject* getBimProject() const { return _bimProject; }
67 
69 
70  public slots:
71 
72 
73 #pragma region TOOLS
74 
87  QString addDays(QString dateStr, int nrDays);
88 
96  QString timeStamp( QString format = QString() );
97 
110  int getCalendarWeek( QDateTime dt );
111 
125  QString format( double v, int dec = 2, QString frmt = "%L1", int fieldWidth = 10, QChar fillChar = QChar::Nbsp ) { return frmt.arg(v,fieldWidth,'f',dec,fillChar); }
126 
151  QString formatDateTime( QDateTime dt, QString formatstr = "iso" );
152 
157  QString createID();
158 
163  long calcHashcode( QString str );
164 
183  QString compressToIfcGuid(QString id);
184 
191  QString uncompressFromIfcGuid(QString ifcGuid);
192 
211  bool checkRegExp( QString value, QString pattern );
212 
225  double calcSlantedArea(QString objId, double angleMin = 0.0, double angleMax = 45.0);
226 
259  QVariantMap calcGpsCoordsByStation( QString objId, double station );
260 
283  QVariantMap calcGpsCoordsByModelCoords( double x, double y );
284 
305  QVariantMap calcModelCoordsByGpsCoords( double lat, double lon );
306 
333  QVariantMap calcGkCoordsByModelCoords( double x, double y, double z );
334 
339  QVariantMap calcModelCoordsByGkCoords( double r, double h );
340 
362  QVariantMap calcGkCoordsByGpsCoords( double lat, double lon );
363 
386  QVariantMap calcGpsCoordsByGkCoords( double rw, double hw );
387 
392  QString idListToStr( QStringList idList );
393 
398  QStringList strToIdList( QString strIDList );
399 
400 
402 #pragma endregion
403 
404 
405 #pragma region TOOLS - FILES
406 
421  QVariantMap getFileInfo( QString filePath );
422 
430  QString getAbsolutePath( QString filePath ) { return QFileInfo(filePath).absolutePath(); }
431 
440  QString getBaseName( QString filePath ) { return QFileInfo(filePath).baseName(); }
441 
449  QString getFileName( QString filePath ) { return QFileInfo(filePath).fileName(); }
450 
451 
452 
453 
454  /*
455  test of caching a parsed json file
456  */
457 #ifdef ENABLE_READJSON
458  QVariantMap readJsonFromTextFile( QString filename, bool useCache = true, QString codec = QString() );
459 #endif
460 #pragma endregion
462 
463 
464 #pragma region APPLICATION
465 
470  QString getApplicationDirectory();
471 
476  QString getApplicationFilename();
477 
482  virtual QString getApplicationLanguage();
483 
489  QString getVersionAsString();
490 
501  int getVersionMAJOR();
502 
513  int getVersionMINOR();
514 
525  int getVersionBUILD();
526 
537  QVariantMap getVersion();
538 
544  bool requireVersion( int major, int minor, int patch );
545 
546 
548 #pragma endregion
549 
550 
551 #pragma region PROJECT
552 
557  QString getUserName();
558 
562  QString getProjectID();
563 
569 
580 
585  QString getProjectNumber();
586 
590  int setProjectNumber(QString s, bool overwriteExisting = false);
591 
595  QString getProjectName();
596 
600  QString getProjectShortDescription();
601 
605  int setProjectShortDescription(QString s, bool overwriteExisting = false);
606 
610  QString getProjectLongDescription();
611 
615  int setProjectLongDescription(QString s, bool overwriteExisting = false);
616 
620  QString getProjectDirectory();
621 
622 
641  QString getLocation();
642 
643 
655  QVariantMap getProjectLocation() const;
656 
670  QVariantMap getCloudSettings();
671 
697  QVariantMap getProjectInfo();
698 
700 #pragma endregion
701 
702 
703 #pragma region DOMAINS
704 
731  QString getDomainByElement( QString objId );
732 
734 #pragma endregion
735 
736 
737 #pragma region PROPERTIES
738 
773  QVariant getPropertyValue(QString objId, QString propName, QString propType, bool inh = true ); // , bool evaluate = true, bool formatAsString = false );
774 
822  QList<QVariant> getPropertyValuesByObject( QString objId, QString filterpattern = "*" );
823 
829  QVariant getPropertySource( QString objId, QString propName, QString propType, bool inh = true );
830 
831 
842  QString getPropertyUnit(QString objId, QString propName, QString propType, bool inh = true );
843 
844 
849  QString getPropertyUnit( QString propName, QString propType );
850 
871  QVariant getPropertyValueByDate(QString objId, QString propName, QString propType, bool inh = true );
872 
891  QDateTime getPropertyLastDate(QString objId, QString propName, QString propType, bool inh = true );
892 
908  QDateTime getPropertyFirstDate(QString objId, QString propName, QString propType, bool inh /* = true */ );
909 
976  QVariantMap getPropertyDateListAsJSON( QString objId, QString propName, QString propType, bool inh = true );
977 
1013  QVariantList getPropertyDateList(QString objectId, QString propertyBaseName, QString propertyType );
1014 
1050  QVariantMap getPropertyTypesByObject( QString objId, QString filterPattern = "*" );
1051 
1052 
1086  QVariantMap getPropertyTypesByDomain( QString domainName, QString filterPattern = "*" );
1087 
1088 
1112  QVariantMap getPropertyTypeMetaData( QString propName, QString propType );
1113 
1114 
1149  QList<QVariant> getPropertyTypeList( QString domain = "all", QString filterPattern = "*", bool activeOnly = false );
1150 
1151 
1190  QList<QVariant> getPropertyTypeListByObject( QString objId, QString filterPattern = "*" );
1191 
1192 
1198  bool isPropertyInherited(QString objId, QString propName, QString propType );
1199 
1200 
1210  QString getPropertyValueRange(QString idList, QString propName, QString propType, QString domainFilter = "geometry" );
1211 
1212 
1223  QStringList getPropertyValueList( QString propName, QString propType, int maxValues );
1224 
1225 
1237  QString getPropertyValueAsString(QString objId, QString propName, QString propType, bool inh = true );
1238 
1239 
1278  QVariant evaluateFormula( QString code, QString id, QString id_otherdomain = QString() );
1279 
1280 
1293  QString prepareJsCode( QString code, QString id, int dec = -1, QString frmt = "%L1", int fieldWidth = 10, QChar fillChar = QChar() );
1294 
1314  QStringList extractPropertyNames( const QString& code, const QString& startTag = "[[", const QString& endTag = "]]" );
1315 
1317 #pragma endregion
1318 
1319 
1320 #pragma region LINKS BETWEEN OBJECTS
1321 
1363  QStringList getLinkedObjects(QString objectIDList, QString resultDomains = "all", QString objectLookupDomains = "all");
1364 
1365 
1379  QStringList getTasksByObjectList(QString idList);
1380 
1390  QStringList getObjectsByTaskList(QString idList);
1391 
1392 
1402  QStringList getDocumentsByObjectList(QString idList);
1403 
1413  QStringList getObjectsByDocumentList(QString idList);
1414 
1415 
1425  QStringList getSectionsByObjectList(QString idList);
1426 
1436  QStringList getObjectsBySectionList(QString idList);
1437 
1438 
1448  QStringList getTypesByObjectList(QString idList);
1449 
1460  QStringList getObjectsByTypeList(QString idList);
1461 
1462 
1472  QStringList getResourcesByObjectList(QString idList);
1473 
1483  QStringList getObjectsByResourcesList(QString idList);
1484 
1485 
1493  QStringList getBoQItemsByObjectList(QString idList);
1494 
1501  QStringList getObjectsByBoQItemList(QString idList);
1502 
1503 
1512  QStringList getPcItemsByObjectList(QString idList);
1513 
1522  QStringList getObjectsByPcItemList(QString idList);
1523 
1525 #pragma endregion
1526 
1527 
1528 #pragma region OBJECT HIERARCHY
1529 
1544  QStringList getContainedElements(QString containerId, int maxDepth, bool loadExternal = true);
1545 
1557  int countContainedElements(QString containerId, int maxDepth, bool loadExternal = true);
1558 
1565  QString getParent(QString objId);
1566 
1576  QStringList getOpenings(QString objId);
1577 
1587  QStringList getParts(QString objId);
1588 
1590 #pragma endregion
1591 
1592 
1593 #pragma region STATUS
1594 
1603  bool isVisible(QString objId);
1604 
1609  bool isSelected(QString objId);
1610 
1615  bool isLocked(QString objId);
1616 
1621  bool isWired(QString objId);
1622 
1624 #pragma endregion
1625 
1626 
1627 #pragma region GEOMETRY
1628 
1644  QVariantList getPointList( QString objId );
1645 
1647 #pragma endregion
1648 
1649 
1650 #pragma region ALIGNMENTS / REGIONS
1651 
1671  QVariantMap getPointOnAlignmentAtStation( QString objId, double d );
1672 
1689  double getStationOfProjectedPoint( QString objId, double x, double y, double z = 0.0 );
1690 
1701  QStringList getRegionsOfAlignment( QString alignmentId );
1702 
1714  QVariantList getRangesOfRegion( QString alignmentID, QString regionID );
1715 
1716 
1728  double getValueOfAlignmentRegion( QString alignmentID, QString regionID );
1729 
1730 
1732 #pragma endregion
1733 
1734 
1735 #pragma region ACTIVITIES
1736 
1746  int getTaskMode( QString taskId );
1747 
1754  QString getTaskVisualisation( QString taskId );
1755 
1757 #pragma endregion
1758 
1759 #pragma region LINKRULES
1760 
1770  int updateRuleBasedLinks(QString domainName, bool visibleOnly = false);
1771 
1779  int removeRuleBasedLinks(QString domainName);
1780 
1782 #pragma endregion
1783 
1786  protected:
1787 
1788  /*
1789  Get object, looks up also containers in project
1790  */
1791  model::IContainerObject* getIContainerObject(const QString& id, model::eDomainType domainFilter = model::typeDomainAll );
1792  model::IContainer* getIContainer(const QString& id, model::eDomainType domainFilter = model::typeDomainAll );
1793  model::Element* getElement(const QString& id, model::eDomainType domainFilter = model::typeDomainAll );
1794 
1795  model::IProperty* _getProperty( QString objId, QString propName, QString propType, bool inh );
1796  QVariant _getPropertyValue( const QString& objId, const QString& propName, const QString& propType, bool inh, bool evaluate, bool formatAsString );
1797 
1798  /*
1799  Collect geometric elements and composite elements.
1800  */
1801  void collectGeoObjects( const QString& idList, QList<model::IObject*>& list );
1802 
1803 
1804  private:
1805 
1806  /*
1807  \since 1.9.0, 13 may 2016, jh
1808  */
1809  QList<QDateTime> _getPropertyDateList(const QString& objId, const QString& propName, const QString& propType, const QTime& defaultTime );
1810 
1811 
1812  CoreAPI(QObject* parent = 0);
1813 
1814  BimProject* _bimProject;
1815 
1818 #ifdef ENABLE_READJSON
1819  bool _firsttime;
1820  QVariantMap _fileCache;
1821 #endif
1822 
1823  };
1824 
1825 }
QList< QVariant > getPropertyTypeListByObject(QString objId, QString filterPattern="*")
QStringList getBoQItemsByObjectList(QString idList)
QString getProjectLongDescription()
QVariantMap calcGpsCoordsByModelCoords(double x, double y)
int getProjectVariantNumber()
QString getPropertyUnit(QString objId, QString propName, QString propType, bool inh=true)
int countContainedElements(QString containerId, int maxDepth, bool loadExternal=true)
int getTaskMode(QString taskId)
int removeRuleBasedLinks(QString domainName)
QStringList getObjectsByBoQItemList(QString idList)
QVariantMap getProjectInfo()
QVariantMap calcGpsCoordsByStation(QString objId, double station)
QVariantMap getProjectLocation() const
QVariantMap getCloudSettings()
QString getProjectDirectory()
QVariantList getRangesOfRegion(QString alignmentID, QString regionID)
QVariantList getPointList(QString objId)
virtual QString getApplicationLanguage()
QVariantMap getPropertyTypesByObject(QString objId, QString filterPattern="*")
bool isVisible(QString objId)
int updateRuleBasedLinks(QString domainName, bool visibleOnly=false)
QVariant getPropertyValue(QString objId, QString propName, QString propType, bool inh=true)
QStringList getParts(QString objId)
QString idListToStr(QStringList idList)
QVariantMap calcGpsCoordsByGkCoords(double rw, double hw)
QString getPropertyValueAsString(QString objId, QString propName, QString propType, bool inh=true)
QStringList getTypesByObjectList(QString idList)
QString getBaseName(QString filePath)
Definition: CoreAPI.h:440
long calcHashcode(QString str)
QString formatDateTime(QDateTime dt, QString formatstr="iso")
bool isLocked(QString objId)
bool checkRegExp(QString value, QString pattern)
QString getFileName(QString filePath)
Definition: CoreAPI.h:449
QDateTime getPropertyFirstDate(QString objId, QString propName, QString propType, bool inh)
QVariant getPropertySource(QString objId, QString propName, QString propType, bool inh=true)
QString compressToIfcGuid(QString id)
QString timeStamp(QString format=QString())
QVariant getPropertyValueByDate(QString objId, QString propName, QString propType, bool inh=true)
double getValueOfAlignmentRegion(QString alignmentID, QString regionID)
QStringList getPcItemsByObjectList(QString idList)
QVariant evaluateFormula(QString code, QString id, QString id_otherdomain=QString())
QStringList getResourcesByObjectList(QString idList)
QStringList getLinkedObjects(QString objectIDList, QString resultDomains="all", QString objectLookupDomains="all")
QStringList getObjectsByTypeList(QString idList)
int setProjectLongDescription(QString s, bool overwriteExisting=false)
QStringList strToIdList(QString strIDList)
QStringList getTasksByObjectList(QString idList)
QList< QVariant > getPropertyValuesByObject(QString objId, QString filterpattern="*")
Definition: CoreAPI.h:53
QString getDomainByElement(QString objId)
QVariantMap getPropertyDateListAsJSON(QString objId, QString propName, QString propType, bool inh=true)
QVariantMap calcGkCoordsByGpsCoords(double lat, double lon)
QString getProjectShortDescription()
QString format(double v, int dec=2, QString frmt="%L1", int fieldWidth=10, QChar fillChar=QChar::Nbsp)
Definition: CoreAPI.h:125
QStringList getOpenings(QString objId)
QStringList getObjectsByDocumentList(QString idList)
int setProjectShortDescription(QString s, bool overwriteExisting=false)
QStringList getObjectsByPcItemList(QString idList)
QStringList getPropertyValueList(QString propName, QString propType, int maxValues)
bool requireVersion(int major, int minor, int patch)
QVariantMap getPropertyTypeMetaData(QString propName, QString propType)
QStringList getObjectsByTaskList(QString idList)
QStringList getRegionsOfAlignment(QString alignmentId)
double calcSlantedArea(QString objId, double angleMin=0.0, double angleMax=45.0)
QStringList getObjectsByResourcesList(QString idList)
QDateTime getPropertyLastDate(QString objId, QString propName, QString propType, bool inh=true)
QString uncompressFromIfcGuid(QString ifcGuid)
QString getUserName()
int setProjectNumber(QString s, bool overwriteExisting=false)
QString getProjectID()
QStringList getDocumentsByObjectList(QString idList)
QString getParent(QString objId)
QStringList extractPropertyNames(const QString &code, const QString &startTag="[[", const QString &endTag="]]")
QStringList getObjectsBySectionList(QString idList)
QVariantMap getFileInfo(QString filePath)
QVariantMap getPropertyTypesByDomain(QString domainName, QString filterPattern="*")
QString getApplicationFilename()
QList< QVariant > getPropertyTypeList(QString domain="all", QString filterPattern="*", bool activeOnly=false)
QVariantMap calcModelCoordsByGpsCoords(double lat, double lon)
double getStationOfProjectedPoint(QString objId, double x, double y, double z=0.0)
QString addDays(QString dateStr, int nrDays)
int getCalendarWeek(QDateTime dt)
QString getAbsolutePath(QString filePath)
Definition: CoreAPI.h:430
QString getPropertyValueRange(QString idList, QString propName, QString propType, QString domainFilter="geometry")
QString getProjectNumber()
QString prepareJsCode(QString code, QString id, int dec=-1, QString frmt="%L1", int fieldWidth=10, QChar fillChar=QChar())
bool isPropertyInherited(QString objId, QString propName, QString propType)
QStringList getSectionsByObjectList(QString idList)
QStringList getContainedElements(QString containerId, int maxDepth, bool loadExternal=true)
QString getVersionAsString()
bool isSelected(QString objId)
QString getApplicationDirectory()
QString getTaskVisualisation(QString taskId)
int getProjectVersionNumber()
bool isWired(QString objId)
QVariantMap getPointOnAlignmentAtStation(QString objId, double d)
QVariantMap getVersion()
QString getProjectName()
QVariantList getPropertyDateList(QString objectId, QString propertyBaseName, QString propertyType)
QString getLocation()

Created: Tue Sep 1 2020 16:05:27