235 lines
8.0 KiB
C++
Executable File
235 lines
8.0 KiB
C++
Executable File
/**
|
|
**
|
|
** @RDE_HEADER@
|
|
** Definition of dialog to modify xml symbols
|
|
** $Id$
|
|
** $HeadURL$
|
|
** $Author$
|
|
**
|
|
** -----------------------------------------------------------------------------------------------
|
|
**
|
|
** Hardware-Environment: Intel-PC
|
|
** Software-Environment: Windows 7, Qt 5.4. ArcGIS 10.2.5
|
|
**
|
|
** Language ........: C++ 11
|
|
**
|
|
** -----------------------------------------------------------------------------------------------
|
|
**
|
|
** Author ...........: Jörg Turla, SPD G, Tel. 3132
|
|
**
|
|
** -----------------------------------------------------------------------------------------------
|
|
**
|
|
** Notes .........:
|
|
**
|
|
** 14.12.2017, JT : First edition for use with Qt5
|
|
**
|
|
** -----------------------------------------------------------------------------------------------
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "symbology_xml_gui_export.h"
|
|
|
|
#include <Symbology/symbol_dictionary.h>
|
|
|
|
#include <GeometryModel/geometry_model.h>
|
|
|
|
#include <LtsWidgets/lts_dialog.h>
|
|
|
|
#include <QtCore/QString>
|
|
|
|
|
|
namespace SymbologyXML
|
|
{
|
|
/**
|
|
* \brief Implements a dialog to set parameters and attributes of a xml symbol.
|
|
* A xml symbol will be descipted by it's symbol id and some parameters like the affiliation, the mobility and the injury. Additionally several
|
|
* attributes like text lines or colors can be defined by the user.
|
|
*/
|
|
class SYMBOLOGY_XML_GUI_EXPORT SymbolDialog : public LtsWidgets::LtsDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/**
|
|
Defines the size of the symbol preview image in dialog.
|
|
*/
|
|
static QSize symbolPixmapSize() { return QSize(200,200); }
|
|
|
|
/**
|
|
Construction for use with SituationMap::GeometryModel to edit a symbol node.
|
|
@param symbolDict Symbol dictionary that store information about the symbol
|
|
@param geomModel Pointer to
|
|
@param autoApply If true the user changes should be applied emmediately by caller (use change signals for implementation), an apply button doesn't exist.
|
|
In other case the signal applyChanges is emmitted when the apply has been clicked by user. If a GeoemtryModel node has been set with setNode,
|
|
this node will be updated automatically.
|
|
@param parent Parent widget for QObject hierarchy.
|
|
|
|
*/
|
|
explicit SymbolDialog( const AdvancedSymbology::SymbolDictionary &symbolDict, SituationMap::GeometryModel * geomModel, bool autoApply, QWidget * parent );
|
|
|
|
/**
|
|
Construction for using a "standalone" dialog
|
|
*/
|
|
explicit SymbolDialog( const AdvancedSymbology::SymbolDictionary &symbolDict, bool autoApply, QWidget * parent );
|
|
|
|
/**
|
|
Destruction
|
|
*/
|
|
virtual ~SymbolDialog();
|
|
|
|
/**
|
|
* Retranslate all labelling of dialog.
|
|
*/
|
|
void retranslate() override;
|
|
|
|
/**
|
|
* Define the existing parties with names and colors.
|
|
*/
|
|
void updateParties( const QVector<int> &partyIds
|
|
, const QVector<QColor> &partyColors
|
|
, const QVector<QString> &partyNames
|
|
, const QVector<AdvancedSymbology::Role> &partyRoles );
|
|
|
|
/**
|
|
* Set values of parameters and attributes from node of geometry model.
|
|
*/
|
|
void setNode( int symbolId, const SituationMap::GeometryModel::Node &node );
|
|
|
|
/**
|
|
* Store values from dialog to node of geometry model. Returns true on success.
|
|
*/
|
|
bool applyToNode(const SituationMap::GeometryModel::Node &node) const;
|
|
|
|
/**
|
|
* Update preview image of the symbol.
|
|
*/
|
|
void updateSymbolPixmap();
|
|
|
|
/**
|
|
* Get single parameter or attribute from dialog.
|
|
* @{
|
|
*/
|
|
SymbolTypes::t_affil symbolAffiliation() const;
|
|
SymbolTypes::t_mob symbolMobility() const;
|
|
|
|
SymbolTypes::t_state symbolState() const;
|
|
SymbolTypes::t_uncertainty symbolUncertainty() const;
|
|
SituationMap::GeometryModel::t_vbg_et symbolVBG() const;
|
|
|
|
int partyId() const;
|
|
QColor partyColor() const;
|
|
QString partyName() const;
|
|
AdvancedSymbology::Role partyRole() const;
|
|
|
|
int damagedPartyId() const;
|
|
QColor damagedPartyColor() const;
|
|
QString damagedPartyName() const;
|
|
|
|
QPoint pixelOffset() const;
|
|
double scale() const;
|
|
|
|
bool directionValid() const;
|
|
int directionDegree() const;
|
|
|
|
QString textW() const;
|
|
QString textXY() const;
|
|
QString textV() const;
|
|
QString textT() const;
|
|
QString textZ() const;
|
|
QString textEF() const;
|
|
QString textG() const;
|
|
QString textH() const;
|
|
QString textM() const;
|
|
QString textJ() const;
|
|
|
|
/** @} */
|
|
|
|
/**
|
|
* Set single parameter or attribute from dialog.
|
|
* @{
|
|
*/
|
|
void setSymbolAffiliation(SymbolTypes::t_affil affil);
|
|
void setSymbolMobility(SymbolTypes::t_mob mob);
|
|
|
|
void setSymbolState(SymbolTypes::t_state state);
|
|
void setSymbolUncertainty(SymbolTypes::t_uncertainty uncertainty);
|
|
void setSymbolVBG(SituationMap::GeometryModel::t_vbg_et vbg);
|
|
|
|
void setPartyId(int id );
|
|
|
|
void setDamagedPartyId(int id);
|
|
|
|
void setPixelOffset( const QPoint &offset );
|
|
void setScale(double scale);
|
|
|
|
void setDirectionValid( bool ok );
|
|
void setDirectionDegree( int angle );
|
|
/** @} */
|
|
|
|
signals:
|
|
|
|
/**
|
|
* Signals to announce changes of values by the user.
|
|
* @{
|
|
*/
|
|
|
|
void changedSymbolAffiliation( SymbolTypes::t_affil );
|
|
void changedSymbolMobility( SymbolTypes::t_mob );
|
|
|
|
void changedSymbolState( SymbolTypes::t_state );
|
|
|
|
void changedSymbolUncertainty( SymbolTypes::t_uncertainty );
|
|
|
|
void changedSymbolVBG( SituationMap::GeometryModel::t_vbg_et vbg );
|
|
|
|
void changedParty( int partyId );
|
|
void changedDamageParty( int partyId );
|
|
|
|
void changedOffset( const QPoint & );
|
|
|
|
void changedScale( double );
|
|
|
|
void changedDirection( bool valid, int degree );
|
|
|
|
void changedTextW ( const QString & );
|
|
void changedTextXY( const QString & );
|
|
void changedTextV ( const QString & );
|
|
void changedTextT ( const QString & );
|
|
void changedTextZ ( const QString & );
|
|
void changedTextEF( const QString & );
|
|
void changedTextG ( const QString & );
|
|
void changedTextH ( const QString & );
|
|
void changedTextM ( const QString & );
|
|
void changedTextJ ( const QString & );
|
|
|
|
void changed();
|
|
|
|
/** @} */
|
|
|
|
/**
|
|
Signal to notify the caller that the apply button has been clicked.
|
|
@param self Pointer to this instance of dialog to make changed values accessable
|
|
@param canCloseDialog Set to true if saving values was successful and the dialog should be closed.
|
|
*/
|
|
void applyChanges( SymbolDialog * self, bool & canCloseDialog );
|
|
|
|
void signalAboutToClose();
|
|
|
|
protected:
|
|
|
|
bool apply() override;
|
|
|
|
void aboutToClose() override;
|
|
|
|
private:
|
|
|
|
class InternalData;
|
|
|
|
InternalData *m_internal;
|
|
|
|
}; // SymbolDialog
|
|
|
|
} // namespace SymbologyXML
|