195 lines
5.6 KiB
C++
Executable File
195 lines
5.6 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* main for AreaEffectSimulation
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#include <nglapplication/nglapplication.h>
|
|
#include <NGLLogger/INGLLogger.h>
|
|
#include <NGLLogger/NGLLoggerBootstrap.h>
|
|
#include "icons.h"
|
|
#include "polygons.h"
|
|
|
|
#include <QWidget>
|
|
#include <QLabel>
|
|
#include <QIcon>
|
|
|
|
#include <LtsCoordTrans/lts_coord_trans.h>
|
|
|
|
QIcon iconExplosionArea()
|
|
{
|
|
AreaEffectSimulation::Database::AesExplosionArea ff;
|
|
ff.impactPosition = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7000060000"));
|
|
ff.impactWidth = 50;
|
|
ff.impactLength = 10;
|
|
ff.rotationAngle = 30;
|
|
|
|
return AreaEffectSimulation::Icons::explosionArea(ff);
|
|
}
|
|
|
|
QIcon iconExplosionAreaSingleExplosions()
|
|
{
|
|
AreaEffectSimulation::Database::AesExplosionArea ff;
|
|
ff.impactPosition = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7000060000"));
|
|
ff.impactWidth = 50;
|
|
ff.id = 42;
|
|
ff.impactLength = 500;
|
|
ff.rotationAngle = 30;
|
|
ff.effectStart = QDateTime::currentDateTimeUtc().addSecs(-300);
|
|
ff.effectDuration = 600000;
|
|
ff.cannonCount = 5;
|
|
ff.cannonRounds = 5;
|
|
|
|
return AreaEffectSimulation::Icons::explosionAreaSingleExplosions(ff);
|
|
}
|
|
|
|
QIcon iconNContamination()
|
|
{
|
|
AreaEffectSimulation::Database::AesNContamination ff;
|
|
ff.impactPosition = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7000060000"));
|
|
ff.rotationAngle = 30;
|
|
ff.borderLengthInner = 50;
|
|
ff.borderLengthOuter = 100;
|
|
ff.impactRadius = 50;
|
|
ff.spanAngle = 60;
|
|
|
|
return AreaEffectSimulation::Icons::nContamination(ff);
|
|
}
|
|
|
|
QIcon iconBcContamination()
|
|
{
|
|
AreaEffectSimulation::Database::AesBCContamination ff;
|
|
ff.impactPosition = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7000060000"));
|
|
ff.impactRadius = 500;
|
|
ff.weatherPosition = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7200062000"));
|
|
ff.weatherTimestamp = QDateTime::currentDateTimeUtc().addSecs(-3600);
|
|
ff.effectStart = ff.weatherTimestamp.addSecs(360);
|
|
ff.effectDuration = 360000; // msecs
|
|
ff.propagationDirection = 20;
|
|
ff.windSpeed = 2;
|
|
ff.chargeTypeId = 1;
|
|
return AreaEffectSimulation::Icons::bcContamination(ff,
|
|
ProjectDataManagement::VolatilityType::Floating,
|
|
1.25,
|
|
QDateTime::currentDateTimeUtc());
|
|
}
|
|
|
|
QIcon iconExplosionSingle()
|
|
{
|
|
AreaEffectSimulation::Database::AesExplosionSingle ff;
|
|
ff.impactPosition = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7000060000"));
|
|
ff.chargeTypeId = 5;
|
|
|
|
return AreaEffectSimulation::Icons::explosionSingle(ff, 7.43);
|
|
}
|
|
|
|
QIcon IconMineArea()
|
|
{
|
|
AreaEffectSimulation::Database::AesMineArea ff;
|
|
ff.id = 42;
|
|
ff.density = 7;
|
|
ff.width = 100;
|
|
QVector<AreaEffectSimulation::Database::AesMineAreaSegment> vec;
|
|
AreaEffectSimulation::Database::AesMineAreaSegment seg1;
|
|
seg1.elementNumber = 1;
|
|
seg1.mineAreaId = 42;
|
|
seg1.startPosition = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7000060000"));
|
|
seg1.endPosition = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7050061000"));
|
|
|
|
// AreaEffectSimulation::Database::AesMineAreaSegment seg2;
|
|
// seg2.elementNumber = 2;
|
|
// seg2.density = 300;
|
|
// seg2.mineAreaId = 42;
|
|
// seg2.mineCount = 10;
|
|
// seg2.rotationAngle = 10;
|
|
// seg2.startPosition = QPointF(190,170);
|
|
// seg2.width = 100;
|
|
vec << seg1 ; //<< seg2;
|
|
|
|
return AreaEffectSimulation::Icons::mineArea(ff, vec);
|
|
}
|
|
|
|
QIcon IconMineAreaPositions()
|
|
{
|
|
AreaEffectSimulation::Database::AesMineArea ff;
|
|
ff.id = 42;
|
|
ff.density = 0.07;
|
|
ff.width = 100;
|
|
|
|
QVector<AreaEffectSimulation::Database::AesMineAreaSegment> vec;
|
|
AreaEffectSimulation::Database::AesMineAreaSegment seg1, seg2;
|
|
seg1.elementNumber = 1;
|
|
seg1.mineAreaId = 42;
|
|
seg1.startPosition = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7000060000"));
|
|
seg1.endPosition = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7050061000"));
|
|
|
|
seg2.elementNumber = 2;
|
|
seg2.mineAreaId = 42;
|
|
seg2.startPosition = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7027260421"));
|
|
seg2.endPosition = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7060060732"));
|
|
vec << seg1 << seg2;
|
|
|
|
return AreaEffectSimulation::Icons::mineArea(ff, vec);
|
|
}
|
|
|
|
QIcon IconMineCorridor()
|
|
{
|
|
QVector<AreaEffectSimulation::Database::AesMineCorridorSegment> vec;
|
|
vec.reserve(3);
|
|
AreaEffectSimulation::Database::AesMineCorridorSegment seg1, seg2, seg3;
|
|
|
|
seg1.elementNumber = 1;
|
|
seg1.mineCorridorId = 43;
|
|
seg1.position = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7010060100"));
|
|
|
|
seg2 = seg1;
|
|
seg2.elementNumber++;
|
|
seg2.position = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7020060100"));
|
|
|
|
seg3 = seg2;
|
|
seg3.elementNumber++;
|
|
seg3.position = LtsCoordTrans::geographicFromMgrs(QLatin1String("32UMD7030060200"));
|
|
|
|
|
|
vec << seg1;
|
|
vec << seg2;
|
|
vec << seg3;
|
|
|
|
return AreaEffectSimulation::Icons::mineCorridor(vec, 30);
|
|
}
|
|
|
|
// ------------------------------------------------------------------
|
|
int main(int argc, char **argv)
|
|
{
|
|
NGLApplication app(argc, argv);
|
|
app.createLogger("AES", "log4cxx_aesutilstest.props");
|
|
|
|
int iRet = -1;
|
|
{
|
|
STARTUP_LOG(app.baseLogger());
|
|
|
|
QIcon i;
|
|
// i = iconExplosionArea();
|
|
// i = iconExplosionAreaSingleExplosions();
|
|
// i = iconBcContamination();
|
|
// i = iconExplosionSingle();
|
|
// i = iconNContamination();
|
|
// i = IconMineCorridor();
|
|
// i = IconMineAreaPositions();
|
|
// i = IconMineAreaPositions();
|
|
|
|
QWidget *p = new QWidget();
|
|
QLabel *l = new QLabel(p);
|
|
l->setPixmap(i.pixmap(256, 256));
|
|
|
|
p->show();
|
|
|
|
iRet = app.exec();
|
|
SHUTDOWN_LOG(app.baseLogger());
|
|
}
|
|
|
|
return iRet;
|
|
}
|