Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+214
@@ -0,0 +1,214 @@
|
||||
/**
|
||||
**
|
||||
** @RDE_HEADER@
|
||||
** Definition of base class for 3d rubberbands
|
||||
** $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 .........:
|
||||
**
|
||||
** 27.03.2015, JT : First edition for use with Qt5
|
||||
**
|
||||
** -----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "rubberband_base.h"
|
||||
|
||||
#include <Map/map.h>
|
||||
#include <Common/ref_pointer.h>
|
||||
|
||||
|
||||
class QObject;
|
||||
namespace Esri {
|
||||
namespace ArcGISRuntime {
|
||||
class MapGraphicsView;
|
||||
class Point;
|
||||
} }
|
||||
|
||||
|
||||
|
||||
namespace SituationMap
|
||||
{
|
||||
|
||||
/**
|
||||
Namespace for all rubberband stuff (is part of namespace SituationMap)
|
||||
*/
|
||||
namespace RB
|
||||
{
|
||||
class RubberbandDrawable;
|
||||
class RubberbandHandle;
|
||||
|
||||
/**
|
||||
@class Rubberband3D rubberband_3d.h
|
||||
@brief Base class of all 3D rubberbands
|
||||
|
||||
Rubberbands are used to create or modifiy geometries like single points or lines in 3D views by processing
|
||||
Qt input events like keyboard and mouse events. To create a rubberband the RubberbandFactory has to be used.
|
||||
At end of rubberband processing the signal \c abort or\c apply are emitted. To delete the rubberband the
|
||||
function deleteMySelf must be called. To use the delete operator is dangerous because at end of signal
|
||||
processing some program code may be performed.
|
||||
|
||||
Example to how to use rubberband:
|
||||
|
||||
@code
|
||||
|
||||
SituationMap::Map & map = ...
|
||||
|
||||
const RubberbandFactory & rubberbandFactory = map.rubberbandFactory();
|
||||
|
||||
RubberbandPointFeature * rubberband = rubberbandFactory.create<RubberbandPointFeature3D>(); // the map has to be in 3D mode
|
||||
if (rubberband != nullptr)
|
||||
{
|
||||
QObject::connect( rubberband, &SiMapRubBnd::Rubberband::apply, [=](SiMapRubBnd::Rubberband * rubberband )
|
||||
{
|
||||
// rubberband has finished input
|
||||
if (rubberband)
|
||||
{
|
||||
const QVector<QPointF> & vertexList = rubberband->coordinateVector();
|
||||
|
||||
// do something with vertexList
|
||||
|
||||
rubberband->deleteMySelf(); // notice don't call here delete rubberband directly !!!
|
||||
}
|
||||
} );
|
||||
|
||||
QObject::connect( rubberband, &SiMapRubBnd::Rubberband::abort, this, [=](SiMapRubBnd::Rubberband * rubberband )
|
||||
{
|
||||
// Rubberband has been aborted by user
|
||||
if (rubberband)
|
||||
{
|
||||
rubberband->deleteMySelf(); // notice don't call here delete rubberband directly !!!
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@endcode
|
||||
|
||||
Following keyboard commands are available in active rubberbands:
|
||||
|
||||
| Key | Modifier | Funktion |
|
||||
| :----: |:-------: | :--------------------------------------------------------------------------- |
|
||||
| Esc | | Rubberband abbrechen |
|
||||
| Return | | Rubberband abschließen und Eingabe übernehmen wenn möglich, sonst Abbruch |
|
||||
| Left | | Selektierten Handle (Punkt,Frame) um 1 Pixel nach links schieben |
|
||||
| Right | | Selektierten Handle (Punkt,Frame) um 1 Pixel nach rechts schieben |
|
||||
| Up | | Selektierten Handle (Punkt,Frame) um 1 Pixel nach oben schieben |
|
||||
| Down | | Selektierten Handle (Punkt,Frame) um 1 Pixel nach unten schieben |
|
||||
| Left | Shift | Selektierten Handle (Punkt,Frame) um 10 Pixel nach links schieben |
|
||||
| Right | Shift | Selektierten Handle (Punkt,Frame) um 10 Pixel nach rechts schieben |
|
||||
| Up | Shift | Selektierten Handle (Punkt,Frame) um 10 Pixel nach oben schieben |
|
||||
| Down | Shift | Selektierten Handle (Punkt,Frame) um 10 Pixel nach unten schieben |
|
||||
|
||||
@see EventDispatcher
|
||||
@see RubberbandBase, Rubberband, RubberbandPointFeature3D, RubberbandMultiPointFeature3D
|
||||
*/
|
||||
|
||||
class SITUATIONMAP_EXPORT Rubberband3D : public RubberbandBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
@name Construction & Destruction
|
||||
@{
|
||||
*/
|
||||
|
||||
private:
|
||||
|
||||
friend class RubberbandPointFeature3D;
|
||||
friend class RubberbandMultiPointFeature3D;
|
||||
|
||||
|
||||
/**
|
||||
Constructs a Rubberband for a situation map. Use \c RubberbandFactor to create a rubberband.
|
||||
In case of the user actions the autoDelete mechanism can be used to delete the rubberband. Sometimes
|
||||
the application wants to finish a running rubberband. This can be done by calling \c deleteMySelf. The
|
||||
rubberband will be destroyed also automatically if the parent QObject or the map (see
|
||||
SituationMap::Map::beginDestroy signal) will be destroyed.
|
||||
|
||||
@param map Pointer to SituationMap::Map
|
||||
@param parent Pointer to QObject to use as parent.
|
||||
@isActive If set to false the Rubberband is not active and have to be actived to start the input.
|
||||
@see RubberbandFactory
|
||||
*/
|
||||
explicit Rubberband3D( SituationMap::Map * map, QObject * parent, bool isActive = true );
|
||||
|
||||
public:
|
||||
|
||||
~Rubberband3D();
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
@name EventHandlerInterface Methodes of AbstractEventDispatcher::EventActionInterface
|
||||
The interface between EventDispatcher and Rubberband are defined in class AbstractEventDispatcher.
|
||||
To Implement the interface these methodes have to be override again in the derived classes of the Rubberband class. */
|
||||
/**
|
||||
@{
|
||||
*/
|
||||
|
||||
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;
|
||||
void resetAction ( AbstractEventDispatcher * causer, int x, int y ) override;
|
||||
bool contextMenuAction ( AbstractEventDispatcher * causer, int x, int y ) override;
|
||||
bool completeStateAction ( AbstractEventDispatcher * causer, int x, int y ) override;
|
||||
bool deleteAction ( AbstractEventDispatcher * causer, int x, int y ) override;
|
||||
bool undoAction ( AbstractEventDispatcher * causer, int x, int y ) override;
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
Retrieve and set 3D coordinates.
|
||||
@{
|
||||
*/
|
||||
virtual Point3D singleCoordinate3D( unsigned int idx = 0, CoordinateSystem cs = CoordinateSystem::Geo ) const = 0;
|
||||
|
||||
virtual QVector<Point3D> coordinateVector3D( CoordinateSystem cs = CoordinateSystem::Geo ) const = 0;
|
||||
|
||||
virtual void setCoordinateVector( const QVector<Point3D> & coordinateVector, CoordinateSystem cs = CoordinateSystem::Geo ) = 0;
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
QRectF sceneBbox() const override;
|
||||
|
||||
QImage markerImage();
|
||||
QImage markerSelectionImage();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
QPixmap * _markerPixmap;
|
||||
QPixmap * _markerSelectionPixmap;
|
||||
|
||||
}; /* Rubberband3D */
|
||||
|
||||
} } /* namespace SituationMap::RB */
|
||||
Reference in new issue
Block a user