Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
@@ -12,12 +12,11 @@
|
||||
namespace TrainingAreaBase
|
||||
{
|
||||
|
||||
IsmHandler::IsmHandler(MainHandler *mainHandler)
|
||||
: m_mainHandler(mainHandler)
|
||||
IsmHandler::IsmHandler(MainHandler *mainHandler) : m_mainHandler(mainHandler)
|
||||
, m_dtcIsm(nullptr)
|
||||
, m_distanceIpsToGps(Settings::distanceIpsToGps())
|
||||
, m_distanceOpsToGps(Settings::distanceOpsToGps())
|
||||
{}
|
||||
, m_distanceOpsToGps(Settings::distanceOpsToGps()),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
bool IsmHandler::init()
|
||||
{
|
||||
@@ -39,7 +38,7 @@ bool IsmHandler::init()
|
||||
!m_dtcIsm->enableMountingPointAsset() ||
|
||||
!m_dtcIsm->enableMainFootprint())
|
||||
{
|
||||
ERROR_LOG() << "Can not read data from ISM";
|
||||
ERROR_LOG(m_logger) << "Can not read data from ISM";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -63,7 +62,7 @@ IsmHandler::OpsData IsmHandler::dataFromOpsCode(int ipsCode)
|
||||
{
|
||||
if ( m_opsData.contains(ipsCode))
|
||||
{
|
||||
DEBUG_LOG() << "dataFromOpsCode contains ipsCode:" << ipsCode
|
||||
DEBUG_LOG(m_logger) << "dataFromOpsCode contains ipsCode:" << ipsCode
|
||||
<< " assetId=" << m_opsData.value(ipsCode).assetId
|
||||
<< " roomId=" << m_opsData.value(ipsCode).roomId
|
||||
<< " mainStructureElementId=" << m_opsData.value(ipsCode).mainStructureElementId
|
||||
@@ -81,7 +80,7 @@ IsmHandler::OpsData IsmHandler::dataFromOpsCode(int ipsCode)
|
||||
|
||||
if ( assetId < 0)
|
||||
{
|
||||
WARNING_LOG() << "No asset for ops code=" << ipsCode << " found";
|
||||
WARNING_LOG(m_logger) << "No asset for ops code=" << ipsCode << " found";
|
||||
return {};
|
||||
}
|
||||
opsData.opsCode = ipsCode;
|
||||
@@ -95,7 +94,7 @@ IsmHandler::OpsData IsmHandler::dataFromOpsCode(int ipsCode)
|
||||
|
||||
|
||||
|
||||
DEBUG_LOG() << "OpsData.structureElementId=" << opsData.structureElementId
|
||||
DEBUG_LOG(m_logger) << "OpsData.structureElementId=" << opsData.structureElementId
|
||||
<< " assetId=" << opsData.assetId
|
||||
<< " mountingPointTypeId=" << opsData.mountingPointTypeId
|
||||
<< " opsCode=" << opsData.opsCode
|
||||
@@ -105,7 +104,7 @@ IsmHandler::OpsData IsmHandler::dataFromOpsCode(int ipsCode)
|
||||
{
|
||||
|
||||
|
||||
DEBUG_LOG() <<"---------------- UPDATE OPS-Data ------------------";
|
||||
DEBUG_LOG(m_logger) <<"---------------- UPDATE OPS-Data ------------------";
|
||||
updateOpsData(opsData, true);
|
||||
opsData= m_opsData[opsData.opsCode] ;
|
||||
}
|
||||
@@ -131,7 +130,7 @@ void IsmHandler::onInstrumentationAssetChanged(const InfrastructureManagement::I
|
||||
if ( i.value().assetId == data.id())
|
||||
{
|
||||
opsCode = i.value().opsCode;
|
||||
DEBUG_LOG() << "onInstrumentationAssetChanged assetId=" << data.id();
|
||||
DEBUG_LOG(m_logger) << "onInstrumentationAssetChanged assetId=" << data.id();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -153,7 +152,7 @@ void IsmHandler::onInstrumentationAssetChanged(const InfrastructureManagement::I
|
||||
if ( i.value().assetId == data.id())
|
||||
{
|
||||
opsCode = i.value().opsCode;
|
||||
DEBUG_LOG() << "onInstrumentationAssetChanged assetId=" << data.id();
|
||||
DEBUG_LOG(m_logger) << "onInstrumentationAssetChanged assetId=" << data.id();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -179,7 +178,7 @@ void IsmHandler::onMountingPointAssetChanged(const InfrastructureManagement::Mou
|
||||
break;
|
||||
}
|
||||
case DataModification::eRemoved:
|
||||
DEBUG_LOG() << "onMountingPointAssetChanged Unmount id=" << data.id()
|
||||
DEBUG_LOG(m_logger) << "onMountingPointAssetChanged Unmount id=" << data.id()
|
||||
<< " assetId=" << data.assetId();
|
||||
|
||||
removeOpsAsset(data.assetId());
|
||||
@@ -193,13 +192,13 @@ void IsmHandler::rotateBuildingFootprint(int mseId)
|
||||
|
||||
if ( m_relBuildingFootprintsRotated.contains(mseId))
|
||||
{
|
||||
DEBUG_LOG() << " mainStructureElements.Rotate already done id=" << mseId;
|
||||
DEBUG_LOG(m_logger) << " mainStructureElements.Rotate already done id=" << mseId;
|
||||
return;
|
||||
}
|
||||
InfrastructureManagement::MainStructureElement mse = m_dtcIsm->mainStructureElement(mseId);
|
||||
TetraIcd::RelativePosition relBldgPosition = m_mainHandler->posHandler()->geographicToRelative(mse.geoPosition());
|
||||
|
||||
DEBUG_LOG() << " mainStructureElements.Rotate id=" << mseId;
|
||||
DEBUG_LOG(m_logger) << " mainStructureElements.Rotate id=" << mseId;
|
||||
QMatrix matrix;
|
||||
QPolygonF relBuildingFootprintMgrs;
|
||||
qreal angle = mse.angle();
|
||||
@@ -213,13 +212,13 @@ void IsmHandler::rotateBuildingFootprint(int mseId)
|
||||
QPointF relBuildingPoint(p.x() + relBldgPosition.offsetX,
|
||||
p.y() + relBldgPosition.offsetY);
|
||||
relBuildingFootprintMgrs.append(relBuildingPoint);
|
||||
DEBUG_LOG() << " relBuildingFootprintRotated = " << p.x() << "/" << p.y()
|
||||
DEBUG_LOG(m_logger) << " relBuildingFootprintRotated = " << p.x() << "/" << p.y()
|
||||
<< " relBuildingPointMgrs=" << relBuildingPoint.x() << "/" << relBuildingPoint.y()
|
||||
<< " angle=" << angle;
|
||||
}
|
||||
m_relBuildingFootprintsRotatedMgrs.insert(mseId, relBuildingFootprintMgrs);
|
||||
m_buildingBoundingBoxesMgrs.insert(mseId, relBuildingFootprintMgrs.boundingRect());
|
||||
DEBUG_LOG() << "BoundingBox bottomLeft=" << relBuildingFootprintMgrs.boundingRect().bottomLeft().x() << "/" << relBuildingFootprintMgrs.boundingRect().bottomLeft().x()
|
||||
DEBUG_LOG(m_logger) << "BoundingBox bottomLeft=" << relBuildingFootprintMgrs.boundingRect().bottomLeft().x() << "/" << relBuildingFootprintMgrs.boundingRect().bottomLeft().x()
|
||||
<< " topRight=" << relBuildingFootprintMgrs.boundingRect().topRight().x() << "/" << relBuildingFootprintMgrs.boundingRect().topRight().x();
|
||||
}
|
||||
|
||||
@@ -234,7 +233,7 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
|
||||
int exerciseId = m_mainHandler->ddsHandler()->getExerciseId();
|
||||
if ( !m_dtcIsm->isElementAssignedToExercise(data, exerciseId))
|
||||
{
|
||||
INFO_LOG() << "HandlerBuildingData::onMainStructureElementChanged() id=" << data.id() << " remove";
|
||||
INFO_LOG(m_logger) << "HandlerBuildingData::onMainStructureElementChanged() id=" << data.id() << " remove";
|
||||
|
||||
|
||||
m_buildingBoundingBoxes.remove(data.id());
|
||||
@@ -258,7 +257,7 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
|
||||
iter.next();
|
||||
if (iter.value().mainStructureElementId == data.id())
|
||||
{
|
||||
DEBUG_LOG() << "remove from m_opsData, key=" << iter.key();
|
||||
DEBUG_LOG(m_logger) << "remove from m_opsData, key=" << iter.key();
|
||||
iter.remove();
|
||||
break;
|
||||
}
|
||||
@@ -283,7 +282,7 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
|
||||
if (it != m_opsData.end())
|
||||
updateOpsData(it.value());
|
||||
}
|
||||
DEBUG_LOG() << " mainStructureElements Vor Rotate id=" << data.id();
|
||||
DEBUG_LOG(m_logger) << " mainStructureElements Vor Rotate id=" << data.id();
|
||||
QMap<int, InfrastructureManagement::MainFootprint> mainFootprints = m_dtcIsm->getFootprintsByExerciseId(exerciseId);
|
||||
|
||||
|
||||
@@ -308,7 +307,7 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
|
||||
|
||||
void IsmHandler::onMainFootprintChanged(const InfrastructureManagement::MainFootprint &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG() << "onMainFootprintChanged id=" << data.id()
|
||||
DEBUG_LOG(m_logger) << "onMainFootprintChanged id=" << data.id()
|
||||
<< " size=" << data.elements().size();
|
||||
|
||||
switch (modType)
|
||||
@@ -318,7 +317,7 @@ void IsmHandler::onMainFootprintChanged(const InfrastructureManagement::MainFoot
|
||||
{
|
||||
|
||||
|
||||
DEBUG_LOG() << "mainStructureElements onMainFootprintChanged id=" << data.id();
|
||||
DEBUG_LOG(m_logger) << "mainStructureElements onMainFootprintChanged id=" << data.id();
|
||||
double minX = 0;
|
||||
double maxX = 0;
|
||||
double minY = 0;
|
||||
@@ -335,11 +334,11 @@ void IsmHandler::onMainFootprintChanged(const InfrastructureManagement::MainFoot
|
||||
|
||||
QPointF point(relPos.offsetX(), relPos.offsetY());
|
||||
relBuildingFootprint.append(point);
|
||||
DEBUG_LOG() << "relBuildingFootprint.append() " << point.x() << "/" << point.y() << ")";
|
||||
DEBUG_LOG(m_logger) << "relBuildingFootprint.append() " << point.x() << "/" << point.y() << ")";
|
||||
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "minX=" << minX
|
||||
DEBUG_LOG(m_logger) << "minX=" << minX
|
||||
<< " maxX=" << maxX
|
||||
<< " minY=" << minY
|
||||
<< " maxY=" << maxY
|
||||
@@ -354,7 +353,7 @@ void IsmHandler::onMainFootprintChanged(const InfrastructureManagement::MainFoot
|
||||
|
||||
m_relBuildingFootprints.insert(data.id(), relBuildingFootprint);
|
||||
for (const QPointF &p : std::as_const(relBuildingFootprint))
|
||||
DEBUG_LOG() << "relBuildingFootprint = " << p.x() << "/" << p.y();
|
||||
DEBUG_LOG(m_logger) << "relBuildingFootprint = " << p.x() << "/" << p.y();
|
||||
rotateBuildingFootprint(data.id());
|
||||
break;
|
||||
}
|
||||
@@ -402,7 +401,7 @@ int IsmHandler::getOpsCodeFromJSon(const std::string &s) const
|
||||
if (jError.error != QJsonParseError::NoError ||
|
||||
!doc.isObject())
|
||||
{
|
||||
ERROR_LOG() << "Can not read json data from IPS asset - properties are not parsable: "
|
||||
ERROR_LOG(m_logger) << "Can not read json data from IPS asset - properties are not parsable: "
|
||||
<< jError.errorString() << " - '" << s << "'";
|
||||
return 0;
|
||||
}
|
||||
@@ -417,7 +416,7 @@ bool IsmHandler::getIsOpsTunnel(const std::string &s) const
|
||||
if (jError.error != QJsonParseError::NoError ||
|
||||
!doc.isObject())
|
||||
{
|
||||
ERROR_LOG() << "Can not read json data from IPS asset - properties are not parsable: "
|
||||
ERROR_LOG(m_logger) << "Can not read json data from IPS asset - properties are not parsable: "
|
||||
<< jError.errorString() << " - '" << s << "'";
|
||||
return false;
|
||||
}
|
||||
@@ -430,12 +429,12 @@ bool IsmHandler::getIsOpsTunnel(const std::string &s) const
|
||||
|
||||
void IsmHandler::updateOpsData(OpsData &data, bool force)
|
||||
{
|
||||
DEBUG_LOG() << "updateOpsData"
|
||||
DEBUG_LOG(m_logger) << "updateOpsData"
|
||||
<< " opsCode=" << data.opsCode
|
||||
<< " assetId=" << data.assetId
|
||||
<< " force=" << force;
|
||||
int exerciseId = m_mainHandler->ddsHandler()->getExerciseId();
|
||||
DEBUG_LOG() << "updateOpsData for asset " << data.assetId << " with ops id " << data.opsCode;
|
||||
DEBUG_LOG(m_logger) << "updateOpsData for asset " << data.assetId << " with ops id " << data.opsCode;
|
||||
const int seId = m_dtcIsm->getStructueElementIdFromAssetId(data.assetId);
|
||||
|
||||
data.structureElementId = 0;
|
||||
@@ -464,7 +463,7 @@ void IsmHandler::updateOpsData(OpsData &data, bool force)
|
||||
data.position = se.geoPosition();
|
||||
data.position.z(data.position.z() - mse.geoPosition().z());
|
||||
m_structure_ElementId2AssetTypeId[seId] = se.mountingPointTypeId().underlying();
|
||||
DEBUG_LOG() << "found position for asset " << data.assetId << " with se id " << seId
|
||||
DEBUG_LOG(m_logger) << "found position for asset " << data.assetId << " with se id " << seId
|
||||
<< " " << data.position.lon() << "/" << data.position.lat() << "/" << data.position.z()
|
||||
<< " name=" << se.name()
|
||||
<< " type=" << se.mountingPointTypeId()
|
||||
@@ -476,24 +475,24 @@ void IsmHandler::updateOpsData(OpsData &data, bool force)
|
||||
}
|
||||
}
|
||||
}
|
||||
DEBUG_LOG() << "found no position for asset " << data.assetId << " with se id " << seId;
|
||||
DEBUG_LOG(m_logger) << "found no position for asset " << data.assetId << " with se id " << seId;
|
||||
}
|
||||
|
||||
bool IsmHandler::posInExtendedBuildingFootprint(int mainStructureElementId, const Core::GeoPosition &position, const int mountPointTypeId) const
|
||||
{
|
||||
int distance = 0;
|
||||
DEBUG_LOG() << "IsmHandler::posInExtendedBuildingFootprint mainStructureElementId=" << mainStructureElementId
|
||||
DEBUG_LOG(m_logger) << "IsmHandler::posInExtendedBuildingFootprint mainStructureElementId=" << mainStructureElementId
|
||||
<< " mountPointTypeId=" << mountPointTypeId;
|
||||
if (m_distanceIpsToGps <= 0 && m_distanceOpsToGps <= 0)
|
||||
return false;
|
||||
|
||||
switch (mountPointTypeId) {
|
||||
case InfrastructureManagement::MountingPointType_def::OutdoorIPS:
|
||||
DEBUG_LOG() << "posInExtendedBuildingFootprint Distance = m_distanceOpsToGps";
|
||||
DEBUG_LOG(m_logger) << "posInExtendedBuildingFootprint Distance = m_distanceOpsToGps";
|
||||
distance = m_distanceOpsToGps;
|
||||
break;
|
||||
case InfrastructureManagement::MountingPointType_def::IndoorIPS:
|
||||
DEBUG_LOG() << "posInExtendedBuildingFootprint Distance = m_distanceIpsToGps";
|
||||
DEBUG_LOG(m_logger) << "posInExtendedBuildingFootprint Distance = m_distanceIpsToGps";
|
||||
distance = m_distanceIpsToGps;
|
||||
break;
|
||||
default:
|
||||
@@ -503,7 +502,7 @@ bool IsmHandler::posInExtendedBuildingFootprint(int mainStructureElementId, cons
|
||||
|
||||
|
||||
|
||||
DEBUG_LOG() << "mainStructureElementId=" << mainStructureElementId
|
||||
DEBUG_LOG(m_logger) << "mainStructureElementId=" << mainStructureElementId
|
||||
<< " position=" << position;
|
||||
|
||||
|
||||
@@ -519,7 +518,7 @@ bool IsmHandler::posInExtendedBuildingFootprint(int mainStructureElementId, cons
|
||||
|
||||
TetraIcd::RelativePosition relBldgPosition = m_mainHandler->posHandler()->geographicToRelative(mse.geoPosition());
|
||||
TetraIcd::RelativePosition relPosition = m_mainHandler->posHandler()->geographicToRelative(position);
|
||||
DEBUG_LOG() << "relBldgPosition=" << relBldgPosition.offsetX << "/" << relBldgPosition.offsetY
|
||||
DEBUG_LOG(m_logger) << "relBldgPosition=" << relBldgPosition.offsetX << "/" << relBldgPosition.offsetY
|
||||
<< ", relPosition=" << relPosition.offsetX << "/" << relPosition.offsetY;
|
||||
QPointF relPositionMgrs(relPosition.offsetX, relPosition.offsetY);
|
||||
|
||||
@@ -532,14 +531,14 @@ bool IsmHandler::posInExtendedBuildingFootprint(int mainStructureElementId, cons
|
||||
QPointF relPositionF(relPosition.offsetX - relBldgPosition.offsetX, relPosition.offsetY - relBldgPosition.offsetY);
|
||||
if (relBuildingFootprint.containsPoint(relPositionF, Qt::OddEvenFill))
|
||||
{
|
||||
DEBUG_LOG() << "Position is inside Building-Footprint";
|
||||
DEBUG_LOG(m_logger) << "Position is inside Building-Footprint";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
DEBUG_LOG() << "relBuildingFootprint.size=" << relBuildingFootprint.size();
|
||||
DEBUG_LOG(m_logger) << "relBuildingFootprint.size=" << relBuildingFootprint.size();
|
||||
for (int i = 0; i < relBuildingFootprint.size() ; i++)
|
||||
{
|
||||
int nextPoint = i + 1;
|
||||
@@ -549,17 +548,17 @@ bool IsmHandler::posInExtendedBuildingFootprint(int mainStructureElementId, cons
|
||||
QPointF l1(relBuildingFootprint[i].x() + relBldgPosition.offsetX, relBuildingFootprint[i].y() + relBldgPosition.offsetY);
|
||||
QPointF l2(relBuildingFootprint[nextPoint].x() + relBldgPosition.offsetX, relBuildingFootprint[nextPoint].y() + relBldgPosition.offsetY);
|
||||
double distancePointLineValue = distancePointLine(relPositionMgrs, l1, l2);
|
||||
DEBUG_LOG() << "distancePointLineValue=" << distancePointLineValue
|
||||
DEBUG_LOG(m_logger) << "distancePointLineValue=" << distancePointLineValue
|
||||
<< " Point =" << relPositionMgrs.x() << "/" << relPositionMgrs.y()
|
||||
<< " Line=" << l1.x() << "/" << l1.y()
|
||||
<< " " << l2.x() << "/" << l2.y();
|
||||
if (distancePointLineValue < distance)
|
||||
{
|
||||
DEBUG_LOG() << "IsmHandler::posInExtendedBuildingFootprint return true";
|
||||
DEBUG_LOG(m_logger) << "IsmHandler::posInExtendedBuildingFootprint return true";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
DEBUG_LOG() << "IsmHandler::posInExtendedBuildingFootprint return false";
|
||||
DEBUG_LOG(m_logger) << "IsmHandler::posInExtendedBuildingFootprint return false";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -577,7 +576,7 @@ double IsmHandler::distancePointLine(const QPointF &p, const QPointF &l1,
|
||||
qreal length2 = pToP2.length();
|
||||
if (length1 < length2)
|
||||
{
|
||||
DEBUG_LOG() << "a distancePointLine p=" << p.x() << "/" << p.y()
|
||||
DEBUG_LOG(m_logger) << "a distancePointLine p=" << p.x() << "/" << p.y()
|
||||
<< " line: p1=" << l1.x() << "/" << l1.y()
|
||||
<< " p2=" << l2.x() << "/" << l2.y()
|
||||
<< " distance=" << length1
|
||||
@@ -586,7 +585,7 @@ double IsmHandler::distancePointLine(const QPointF &p, const QPointF &l1,
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG() << "b distancePointLine p=" << p.x() << "/" << p.y()
|
||||
DEBUG_LOG(m_logger) << "b distancePointLine p=" << p.x() << "/" << p.y()
|
||||
<< " line: p1=" << l1.x() << "/" << l1.y()
|
||||
<< " p2=" << l2.x() << "/" << l2.y()
|
||||
<< " distance=" << length2
|
||||
@@ -600,7 +599,7 @@ double IsmHandler::distancePointLine(const QPointF &p, const QPointF &l1,
|
||||
|
||||
double distance = sqrt(squareLen(p, intersectPnt));
|
||||
|
||||
DEBUG_LOG() << "c distancePointLine p=" << p.x() << "/" << p.y()
|
||||
DEBUG_LOG(m_logger) << "c distancePointLine p=" << p.x() << "/" << p.y()
|
||||
<< " line: p1=" << l1.x() << "/" << l1.y()
|
||||
<< " p2=" << l2.x() << "/" << l2.y()
|
||||
<< " distance=" << distance;
|
||||
|
||||
Reference in new issue
Block a user