Files
qt5-legatus-legacy/Lts/Viewer/SituationMap/SymbologyXML/symbol_exporter.h
T
2026-08-13 18:33:10 +02:00

143 lines
5.6 KiB
C++
Executable File

/**
* @RDE_HEADER@
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "symbol.h"
#include "symbology_xml_export.h"
#include "primitive.h"
#include <QPainterPath>
#include <QMap>
class QGraphicsItem;
class QGraphicsItemGroup;
class QGraphicsScene;
namespace SymbologyXML
{
/**
@author Stephan Kuhagen <stephan.kuhagen@rheinmetall.com>
*/
class SYMBOLOGY_XML_EXPORT SymbolExporter
{
public:
/**
Draws a symbol frame into a given GraphicScene
\param symbol: Reference to symbol
\param additionalSymbolData: contains status, filltype
\param scene: Pointer to GraphicScene
\param color: Draw with this color
\param fillColor: Fill with this color
\param z: Z-Value in the scene for new Items
\param antialias: antialias (used for font-style-setting)
*/
static void drawFrameSymbol(const Symbol& symbol,
const SymbolTypes::AdditionalSymbolData& additionalData,
QGraphicsScene* scene, const QColor& color, const QColor& fillColor,
double z, bool antialias = true);
/**
Draws the headquarter prims into a given GraphicScene
\param scene: Pointer to GraphicScene
\param headquarter : headquarter or not
\param affil : affliliation
\param dimen: dimension
\param color: draw color
*/
static void drawHeadquarterPrims(QGraphicsScene *scene, bool headquarter,
SymbolTypes::t_dimen dimen, SymbolTypes::t_affil affil,
const QColor& color);
/**
Draws a symbol into a given GraphicScene
\param symbol:reference to symbol
\param symTableSectorIcons_p: Pointer to Symboltable with SectorIcons
\param scene: Pointer to GraphicScene
\param color: Draw with this color
\param fillColor: Fill with this color
\param z: Z-Value in the scene for new Items
\param isAttrib: If true, this is a static Attribute-Symbol
\param antialias: antialias (used for font-style-setting)
*/
static void drawSymbol(const Symbol& symbol, const SymbolTypes::t_symbolTableCont& symTableCont, QGraphicsScene* scene,
const QColor& color, const QColor& fillColor,
double z, bool isAttrib = false, bool antialias = true,
QFont* font_p = nullptr,
QMap<QGraphicsItem*, Primitive*> *mapItemPrimitives_p = nullptr,
bool drawBoundRect=false);
/**
Draw the Text-Data of a Symbol into the given scene with color.
\param symbol: The symbol
\param color: Draw with this color
\param scene: Pointer to GraphicScene
\param antialias: antialias (used for font-style-setting)
\param font_p: font (set the font to be used )
*/
static void drawSymbolText(const Symbol &symbol, QGraphicsScene* scene,
const QColor& color, bool antialias, QFont* font_p = nullptr);
static void drawSymbolPrimitive(Primitive *primitive,
const SymbolTypes::t_symbolTableCont& symTableCont,
QGraphicsScene* scene,
const QColor& color, const QColor& fillColor,
double z, bool isAttrib,
QMap<QGraphicsItem*, Primitive*> *mapItemPrimitives_p,
bool drawBoundRect);
static QGraphicsItem* drawPrimitive(const Primitive& primitive,
const QColor& color, const QColor& fillColor,
double z, bool isAttrib, bool drawBoundRect = false);
static QGraphicsItem* redraw(QGraphicsItem *g, bool drawBoundRect = false);
static void scaleGeometry(QGraphicsItemGroup* ggroup, const QRectF &wantedBox, bool proport);
static void tryScaleGeometry(QGraphicsItemGroup* ggroup, qreal scalex, qreal scaley);
static QGraphicsItem* drawICON(const Primitive &primitive,
const SymbolTypes::t_symbolTableCont& symTableCont,
QGraphicsScene* scene,
const QColor& color, const QColor& fillColor,
double z, bool isAttrib, bool drawBoundRect = false);
static QGraphicsItem* drawText(const Primitive &primitive,
const SymbolTypes::t_symbolTableCont& symTableCont,
QGraphicsScene* scene,
const QColor& color, const QColor& fillColor,
double z, bool isAttrib, bool drawBoundRect = false);
static Primitive *newPrimitiveICON(SymbolTypes::t_icon_type iconType,
SymbolTypes::t_sector_position pos,
SymbolTypes::t_sector_rectpos rectpos,
int id);
static Symbol *newSecIconSymbol(const SymbolTypes::t_symbolTableCont& symTableCont,
SymbolTypes::t_icon_type iconType, int iconId);
static QFont getMatchFont(QFont* font_p, bool antialias);
static QFont fontMatch(const QFont &font);
/**
Create a QPainterPath from this Primitive.
\param primitive: The Primitive
\param isAttrib: True, if this Primitive is part of an Attribute (influences some
draw operations)
\return A new QPainterPath
*/
static QPainterPath createPath(const Primitive* primitive_p, bool isAttrib);
//! Deleted Constructor, only static functions in this class
SymbolExporter() = delete;
};
} // namespace SymbologyXML