Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+192
@@ -0,0 +1,192 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ViewshedParameter
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
// Own
|
||||
#include "symbol_data_to_render.h"
|
||||
#include <SymbologyImpl/advanced_symbology_logging.h>
|
||||
#include <Symbology/sidc_codec.h>
|
||||
#include <Symbology/sidc_builder.h>
|
||||
|
||||
//Qt
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
namespace AdvancedSymbology
|
||||
{
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
SymbolDataToRender::SymbolDataToRender(const QString &_sidc, int _sizeL)
|
||||
{
|
||||
init();
|
||||
sidc = _sidc;
|
||||
sizeL = _sizeL;
|
||||
}
|
||||
|
||||
void SymbolDataToRender::init()
|
||||
{
|
||||
sidc.clear();
|
||||
role = Role::Unknown;
|
||||
sizeL = 100;
|
||||
fillColor = Qt::magenta;
|
||||
fillColorReplace = false;
|
||||
marking = false;
|
||||
|
||||
injury = Injury::NoInjury; // NoInjury, Hit, MobilityKill, WeaponKill, TotalKill
|
||||
injuryColor = Qt::gray;
|
||||
|
||||
additionalSymbols.clear();
|
||||
|
||||
spiOriginalKey.clear();
|
||||
spiSizeL = 100;
|
||||
renderJustCoreImage = false;
|
||||
}
|
||||
|
||||
QString SymbolDataToRender::sidcAccordingRole() const
|
||||
{
|
||||
if (!SidcCodec::isEncoded(sidc))
|
||||
return sidc;
|
||||
|
||||
const SymbologyType symType = SidcCodec::decodeSymbologyType(sidc);
|
||||
if ((symType != SymbologyType::MIL2525D) && (symType != SymbologyType::APP6D))
|
||||
return sidc;
|
||||
|
||||
AdvancedSymbology::SidcBuilder sidcBuilder(&AdvancedSymbology::SymbolDictionary::dictionary(symType));
|
||||
if (!sidcBuilder.setSidc(sidc))
|
||||
return sidc;
|
||||
|
||||
sidcBuilder.setIdentity(static_cast<SidcDefinitions::Identity>(role)); // This works just for MIL2525D, APP6D symbols...
|
||||
|
||||
// // This works just for MIL2525D symbols :
|
||||
// QString sidcToBeModified = sidc;
|
||||
// sidcToBeModified.replace(13, 1, QString::number((int)role)); // enum role is (at least now) identical to Identity
|
||||
// // : This works just for MIL2525D symbols
|
||||
|
||||
return sidcBuilder.toSidc();
|
||||
}
|
||||
|
||||
|
||||
bool SymbolDataToRender::operator==(const SymbolDataToRender &o) const
|
||||
{
|
||||
return sidc == o.sidc &&
|
||||
role == o.role &&
|
||||
sizeL == o.sizeL &&
|
||||
fillColor == o.fillColor &&
|
||||
fillColorReplace == o.fillColorReplace &&
|
||||
marking == o.marking &&
|
||||
injury == o.injury &&
|
||||
injuryColor == o.injuryColor &&
|
||||
additionalSymbols == o.additionalSymbols;
|
||||
}
|
||||
|
||||
bool SymbolDataToRender::operator!=(const SymbolDataToRender &o) const
|
||||
{
|
||||
return !operator ==(o);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
QString toString(AdditionalSymbolType value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case AdditionalSymbolType::BiteError:
|
||||
return QLatin1String("BiteError");
|
||||
case AdditionalSymbolType::Manipulation:
|
||||
return QLatin1String("Manipulation");
|
||||
case AdditionalSymbolType::NoPosition:
|
||||
return QLatin1String("NoPosition");
|
||||
case AdditionalSymbolType::NbcProtection:
|
||||
return QLatin1String("NbcProtection");
|
||||
} // switch
|
||||
return QLatin1String("additionalSymbolTypeToStringERROR");
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, const AdditionalSymbolType &value)
|
||||
{
|
||||
stream << toString(value);
|
||||
return stream;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, const AdditionalSymbolTypeCont &value)
|
||||
{
|
||||
stream << "AST_Cont(" << value.size() << ") ";
|
||||
|
||||
for (const AdditionalSymbolType &item : value)
|
||||
stream << toString(item) << ";";
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
QString toString(Injury value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case Injury::NoInjury:
|
||||
return QLatin1String("NoInjury");
|
||||
case Injury::Hit:
|
||||
return QLatin1String("Hit");
|
||||
case Injury::MobilityKill:
|
||||
return QLatin1String("MobilityKill");
|
||||
case Injury::WeaponKill:
|
||||
return QLatin1String("WeaponKill");
|
||||
case Injury::TotalKill:
|
||||
return QLatin1String("TotalKill");
|
||||
} // switch
|
||||
return QLatin1String("InjuryToStringERROR");
|
||||
}
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, const Injury &value)
|
||||
{
|
||||
stream << toString(value);
|
||||
return stream;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, const SymbolDataToRender &value)
|
||||
{
|
||||
stream << value.toString().constData();
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
||||
QString SymbolDataToRender::toString() const
|
||||
{
|
||||
QString str;
|
||||
|
||||
str = QStringLiteral("sidc='%1'").arg(sidc) +
|
||||
QStringLiteral(" role=%1").arg(AdvancedSymbology::toString(role)) +
|
||||
QStringLiteral(" sizeL=%1").arg(sizeL) +
|
||||
|
||||
// QStringLiteral(" lineColor=%1")).arg(lineColor.name(QColor::HexArgb)) +
|
||||
QStringLiteral(" fillColor=%1").arg(fillColor.name(QColor::HexArgb)) +
|
||||
QStringLiteral(" fillColorReplace=%1").arg(fillColorReplace) +
|
||||
|
||||
QStringLiteral(" marking=%1").arg(marking) +
|
||||
|
||||
QStringLiteral(" injury=%1").arg(AdvancedSymbology::toString(injury)) +
|
||||
QStringLiteral(" injuryColor=%1").arg(injuryColor.name(QColor::HexArgb)) +
|
||||
|
||||
QStringLiteral(" spiOriginalKey=%1").arg(spiOriginalKey) +
|
||||
QStringLiteral(" spiSizeL=%1").arg(spiSizeL) +
|
||||
QStringLiteral(" renderJustCoreImage=%1").arg(renderJustCoreImage);
|
||||
|
||||
std::stringstream stream;
|
||||
stream << additionalSymbols;
|
||||
str += QStringLiteral(" additionalSymbols=%1").arg(QLatin1String(stream.str().c_str()));
|
||||
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
} // namespace AdvancedSymbology
|
||||
|
||||
Reference in new issue
Block a user