Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+194
@@ -0,0 +1,194 @@
|
||||
/**
|
||||
**
|
||||
** @RDE_HEADER@
|
||||
** drop_event_manager.h
|
||||
** $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 .........:
|
||||
**
|
||||
** 13.06.2016, JT : First edition for use with Qt5
|
||||
**
|
||||
** -----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "plan_editor.h"
|
||||
|
||||
#include <Map/drop_event_manager.h>
|
||||
|
||||
#include <LtsWidgets/lts_drop_handler.h>
|
||||
|
||||
#include <QtCore/QMimeData>
|
||||
|
||||
|
||||
namespace PlanEditor
|
||||
{
|
||||
|
||||
class DropEventManager : public SituationMap::DropEventManager
|
||||
{
|
||||
public:
|
||||
|
||||
DropEventManager() = default;
|
||||
|
||||
virtual ~DropEventManager()
|
||||
{
|
||||
// delete all dropHandler
|
||||
qDeleteAll(m_dropHandlerMap);
|
||||
} // ~DropEventManager()
|
||||
|
||||
QString mimeFormatString() const override { return QLatin1String("DropHandlerPtr"); }
|
||||
|
||||
void manageDrop(QPoint windowPos, const QMimeData *mimeData) override
|
||||
{
|
||||
bool ok = false;
|
||||
qulonglong dropHandlerAddress = mimeData->data(mimeFormatString()).toULongLong(&ok);
|
||||
if (ok)
|
||||
{
|
||||
// qWarning() << __FUNCTION__ << "key : " << dropHandlerAddress << "mimeData :" << mimeData->data( QLatin1String("DropHandlerPtr") );
|
||||
auto dropHandler = m_dropHandlerMap.find(dropHandlerAddress);
|
||||
if (dropHandler != m_dropHandlerMap.end())
|
||||
(*dropHandler)->doDrop(windowPos.x(), windowPos.y(), mimeData);
|
||||
}
|
||||
} // manageDrop( const QMimeData * mimeData )
|
||||
|
||||
qulonglong add(LtsWidgets::LtsDropHandler *dropHandler)
|
||||
{
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* DropEvewntManager get ownership of dropHandler and delete them in dtor.
|
||||
* See dtor above.
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
qulonglong key = qulonglong(dropHandler);
|
||||
if (dropHandler)
|
||||
{
|
||||
// qWarning() << __FUNCTION__ << "key : " << key;
|
||||
m_dropHandlerMap[key] = dropHandler;
|
||||
}
|
||||
return key;
|
||||
} // add(LtsWidgets::LtsDropHandler * dropHandler)
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
QHash<qulonglong, LtsWidgets::LtsDropHandler *> m_dropHandlerMap;
|
||||
|
||||
}; // DropEventManager
|
||||
|
||||
|
||||
class DropCreateLine : public LtsWidgets::LtsDropHandler
|
||||
{
|
||||
PlanEditor *m_planEditor;
|
||||
PlanEditor::InternalData *m_planEditorInternal;
|
||||
|
||||
public:
|
||||
|
||||
DropCreateLine(PlanEditor *planEditor, PlanEditor::InternalData *planEditorInternal)
|
||||
: LtsWidgets::LtsDropHandler()
|
||||
, m_planEditor(planEditor)
|
||||
, m_planEditorInternal(planEditorInternal) {;}
|
||||
|
||||
virtual ~DropCreateLine() = default;
|
||||
|
||||
void doDrop(int x, int y, const QMimeData *mimeData) const override;
|
||||
|
||||
}; // DropCreateLine
|
||||
|
||||
|
||||
class DropCreatePolyLine : public LtsWidgets::LtsDropHandler
|
||||
{
|
||||
PlanEditor *m_planEditor;
|
||||
PlanEditor::InternalData *m_planEditorInternal;
|
||||
bool m_smooth;
|
||||
|
||||
public:
|
||||
|
||||
DropCreatePolyLine(PlanEditor *planEditor, PlanEditor::InternalData *planEditorInternal, bool smooth = false)
|
||||
: LtsWidgets::LtsDropHandler()
|
||||
, m_planEditor(planEditor)
|
||||
, m_planEditorInternal(planEditorInternal)
|
||||
, m_smooth(smooth) {;}
|
||||
|
||||
virtual ~DropCreatePolyLine() = default;
|
||||
|
||||
void doDrop(int x, int y, const QMimeData *mimeData) const override;
|
||||
|
||||
}; // DropCreatePolyLine
|
||||
|
||||
|
||||
class DropCreatePolygon : public LtsWidgets::LtsDropHandler
|
||||
{
|
||||
PlanEditor *m_planEditor;
|
||||
PlanEditor::InternalData *m_planEditorInternal;
|
||||
bool m_smooth;
|
||||
|
||||
public:
|
||||
|
||||
DropCreatePolygon(PlanEditor *planEditor, PlanEditor::InternalData *planEditorInternal, bool smooth = false)
|
||||
: LtsWidgets::LtsDropHandler()
|
||||
, m_planEditor(planEditor)
|
||||
, m_planEditorInternal(planEditorInternal)
|
||||
, m_smooth(smooth) {;}
|
||||
|
||||
virtual ~DropCreatePolygon() = default;
|
||||
|
||||
void doDrop(int x, int y, const QMimeData *mimeData) const override;
|
||||
|
||||
}; // DropCreatePolygon
|
||||
|
||||
|
||||
class DropCreateRectangle : public LtsWidgets::LtsDropHandler
|
||||
{
|
||||
PlanEditor *m_planEditor;
|
||||
PlanEditor::InternalData *m_planEditorInternal;
|
||||
bool m_ellipse;
|
||||
|
||||
public:
|
||||
|
||||
DropCreateRectangle(PlanEditor *planEditor, PlanEditor::InternalData *planEditorInternal, bool ellipse = false)
|
||||
: LtsWidgets::LtsDropHandler()
|
||||
, m_planEditor(planEditor)
|
||||
, m_planEditorInternal(planEditorInternal)
|
||||
, m_ellipse(ellipse) {;}
|
||||
|
||||
virtual ~DropCreateRectangle() = default;
|
||||
|
||||
void doDrop(int x, int y, const QMimeData *mimeData) const override;
|
||||
|
||||
}; // DropCreateRectangle
|
||||
|
||||
|
||||
class DropCreateTextLine : public LtsWidgets::LtsDropHandler
|
||||
{
|
||||
PlanEditor *m_planEditor;
|
||||
PlanEditor::InternalData *m_planEditorInternal;
|
||||
|
||||
public:
|
||||
|
||||
DropCreateTextLine(PlanEditor *planEditor, PlanEditor::InternalData *planEditorInternal)
|
||||
: LtsWidgets::LtsDropHandler()
|
||||
, m_planEditor(planEditor)
|
||||
, m_planEditorInternal(planEditorInternal) {;}
|
||||
|
||||
virtual ~DropCreateTextLine() = default;
|
||||
|
||||
void doDrop(int x, int y, const QMimeData *mimeData) const override;
|
||||
|
||||
}; // DropCreateTextLine
|
||||
|
||||
} // namespace PlanEditor
|
||||
Reference in new issue
Block a user