51 lines
925 B
C++
51 lines
925 B
C++
#include "stdafx.h"
|
|
#include "MapTools.h"
|
|
#include "MapToolPan.h"
|
|
#include "MapToolSpectral.h"
|
|
|
|
MapTools::MapTools(QObject* parent)
|
|
: QObject(parent)
|
|
{
|
|
m_tools.insert(Pan, new MapToolPan(this));
|
|
m_tools.insert(Spectral, new MapToolSpectral(this));
|
|
}
|
|
|
|
MapTools::~MapTools()
|
|
{
|
|
qDeleteAll(m_tools);
|
|
m_tools.clear();
|
|
}
|
|
|
|
MapToolPan* MapTools::mapToolPan() const
|
|
{
|
|
return qobject_cast<MapToolPan*>(m_tools.value(Pan));
|
|
}
|
|
|
|
MapToolSpectral* MapTools::mapToolSpectral() const
|
|
{
|
|
return qobject_cast<MapToolSpectral*>(m_tools.value(Spectral));
|
|
}
|
|
|
|
MapTool* MapTools::mapTool(Tool tool) const
|
|
{
|
|
return m_tools.value(tool, nullptr);
|
|
}
|
|
|
|
MapTool* MapTools::activeTool() const
|
|
{
|
|
return m_activeTool;
|
|
}
|
|
|
|
void MapTools::setActiveTool(MapTool* tool)
|
|
{
|
|
m_activeTool = tool;
|
|
}
|
|
|
|
void MapTools::setMapcavas(Mapcavas* canvas)
|
|
{
|
|
if (m_activeTool)
|
|
{
|
|
m_activeTool->setMapcavas(canvas);
|
|
}
|
|
}
|