Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,180 @@
|
||||
/**
|
||||
**
|
||||
** @RDE_HEADER@
|
||||
** Definition of rubberband class to edit states of point objects
|
||||
** $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 .........:
|
||||
**
|
||||
** 18.06.2015, JT : First edition for use with Qt5
|
||||
**
|
||||
** -----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rubberband.h"
|
||||
|
||||
|
||||
namespace SituationMap { namespace RB
|
||||
{
|
||||
class RubberbandPointHandle;
|
||||
|
||||
|
||||
/**
|
||||
@class RubberbandPointCluster rubberband_point_cluster.h
|
||||
@brief Implementation of a rubberband to input single coodinates for building point feature clusters
|
||||
@see Rubberband, RubberbandPointFeature
|
||||
*/
|
||||
class SITUATIONMAP_EXPORT RubberbandStateSelect : public Rubberband
|
||||
{
|
||||
Q_OBJECT
|
||||
/**
|
||||
@name Construction & Destruction
|
||||
@{
|
||||
*/
|
||||
|
||||
friend class RubberbandFactory;
|
||||
|
||||
explicit RubberbandStateSelect( SituationMap::Map * map, QObject * parent = nullptr );
|
||||
|
||||
public:
|
||||
|
||||
class State
|
||||
{
|
||||
public:
|
||||
State() = default;
|
||||
State(int value, const QString & description, const QPixmap & icon)
|
||||
: _description(description), _icon(icon), _value(value), _valid(true)
|
||||
{
|
||||
}
|
||||
|
||||
inline bool isValid() const { return _valid; }
|
||||
inline int value() const { return _value; }
|
||||
inline const QString & description() const { return _description; }
|
||||
inline const QPixmap & icon() const { return _icon; }
|
||||
|
||||
protected:
|
||||
|
||||
QString _description;
|
||||
QPixmap _icon;
|
||||
int _value = 0;
|
||||
bool _valid = false;
|
||||
|
||||
}; /* State */
|
||||
|
||||
|
||||
class StateItem
|
||||
{
|
||||
friend class RubberbandStateSelect;
|
||||
|
||||
public:
|
||||
|
||||
StateItem() : _valid(false), _id(0), _description(), _coordinate(), _stateValue(0) {;}
|
||||
|
||||
StateItem( quint32 id, const QString &description, const QPointF & coordinate, int stateValue )
|
||||
: _valid(true), _id(id), _description(description), _coordinate(coordinate), _stateValue(stateValue)
|
||||
{
|
||||
} /* StateItem */
|
||||
|
||||
~StateItem() = default;
|
||||
|
||||
StateItem(const StateItem &) = default;
|
||||
StateItem & operator = (const StateItem &) = default;
|
||||
|
||||
inline bool isValid() const { return _valid; }
|
||||
inline quint32 id() const { return _id; }
|
||||
inline const QPointF & coordinate() const { return _coordinate; }
|
||||
inline int stateValue() const { return _stateValue; }
|
||||
|
||||
protected:
|
||||
|
||||
bool _valid;
|
||||
quint32 _id;
|
||||
QString _description;
|
||||
QPointF _coordinate;
|
||||
int _stateValue;
|
||||
|
||||
}; /* StateItem */
|
||||
|
||||
|
||||
virtual ~RubberbandStateSelect() = default;
|
||||
|
||||
RubberbandStateSelect(const RubberbandStateSelect &) = delete;
|
||||
RubberbandStateSelect & operator = (const RubberbandStateSelect &) = delete;
|
||||
/** @} */
|
||||
|
||||
bool selectAction ( AbstractEventDispatcher * causer, int x, int y ) override;
|
||||
bool multiSelectActionPress ( AbstractEventDispatcher * causer, int x, int y ) override;
|
||||
bool multiSelectActionRelease( AbstractEventDispatcher * causer, int x, int y ) override;
|
||||
bool setCoordinateAction ( AbstractEventDispatcher * causer, int x, int y ) override;
|
||||
bool moveAction ( AbstractEventDispatcher * causer, int x, int y ) override;
|
||||
bool movePickedAction ( AbstractEventDispatcher * causer, int x, int y ) override;
|
||||
bool contextMenuAction ( AbstractEventDispatcher * causer, int x, int y ) override;
|
||||
bool undoAction ( AbstractEventDispatcher * causer, int x, int y ) override { return contextMenuAction(causer,x,y); }
|
||||
|
||||
bool setStateItems( const QVector<State> & stateVector,
|
||||
const QVector<StateItem> & itemVector,
|
||||
CoordinateSystem cs = CoordinateSystem::Geo );
|
||||
|
||||
const QVector<StateItem> & stateItems() const;
|
||||
|
||||
static void setIconPolygon( const QPixmap & );
|
||||
|
||||
protected:
|
||||
|
||||
/*
|
||||
Forward declaration of InternalData to hold private member variables. Becareful the base class Rubberband
|
||||
has similary a class for internal data member with name "InternalData". Don't be confused it is not the same.
|
||||
*/
|
||||
struct InternalData;
|
||||
|
||||
InternalData * _internal;
|
||||
|
||||
void activateButtons() override;
|
||||
|
||||
void update() override;
|
||||
|
||||
void applyButtonClicked() override { applyAndEndAction( _windowEventDispatcher, 0.0, 0.0 ); }
|
||||
|
||||
void buildStateMenu();
|
||||
void chooseStateMenu();
|
||||
|
||||
void toggleState( RubberbandPointHandle * handlePtr );
|
||||
void setState( RubberbandPointHandle * handlePtr, int stateValue );
|
||||
|
||||
|
||||
|
||||
protected slots:
|
||||
|
||||
void onDo_areaSelectionBegin();
|
||||
void onDo_areaSelectionApply( RubberbandBase* );
|
||||
void onDo_areaSelectionAbort( RubberbandBase* );
|
||||
|
||||
void onDo_setState( bool );
|
||||
|
||||
private:
|
||||
|
||||
void setCoordinateVector(const QVector<QPointF> &, CoordinateSystem ) override {}
|
||||
|
||||
QVector<QPointF> coordinateVector( CoordinateSystem ) const override { return QVector<QPointF>(); }
|
||||
QPointF singleCoordinate( unsigned int, CoordinateSystem ) const override { return QPointF(); }
|
||||
|
||||
}; /* RubberbandStateSelect */
|
||||
|
||||
} } /* namespace SituationMap::RB */
|
||||
Reference in new issue
Block a user