37 lines
839 B
C++
Executable File
37 lines
839 B
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
*
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Philipp Last, SLSY, 2017-09-22
|
|
*/
|
|
|
|
#include "bdv_helper.h"
|
|
|
|
namespace BuildingViewer
|
|
{
|
|
QString gStrFeatureIdPrefix = QStringLiteral("House_");
|
|
|
|
/*
|
|
* Converts a given building id (as used within the database) to the featureId
|
|
* format which is internally used by the BuildingViewer
|
|
*/
|
|
QString databaseId2FeatureId(int32_t buildingDatabaseId)
|
|
{
|
|
if (buildingDatabaseId <= 0)
|
|
return QString();
|
|
return gStrFeatureIdPrefix + QString::number(buildingDatabaseId);
|
|
}
|
|
|
|
|
|
int32_t featureId2DatabaseId(const QString &strFeatureId)
|
|
{
|
|
if (!strFeatureId.startsWith(gStrFeatureIdPrefix))
|
|
return -1;
|
|
bool isOk = false;
|
|
int32_t buildingDatabaseId = strFeatureId.midRef(gStrFeatureIdPrefix.size()).toInt(&isOk);
|
|
return isOk ? buildingDatabaseId : -1;
|
|
}
|
|
}
|