44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#include "maptooladdplane.h"
|
|
#include "mapcanvas.h"
|
|
#include "maplayer.h"
|
|
#include "mapautoplane.h"
|
|
#pragma execution_character_set("utf-8")
|
|
|
|
void LAMPMainWidget::MapToolAddplane::execute(QMouseEvent *event)
|
|
{
|
|
QPointF scene_point=this->mMapCanvas->mapToScene(event->pos());
|
|
QPointF mkt_point=scene_point*this->mMapCanvas->currentLayer()->resolution();
|
|
if( event->type() != QEvent::MouseButtonPress) return;
|
|
if(event->button()==Qt::LeftButton){
|
|
MapAutoplane*plane=new MapAutoplane(this->mMapCanvas->currentLayer(),mkt_point);
|
|
this->addPlane(plane);
|
|
}
|
|
}
|
|
|
|
void LAMPMainWidget::MapToolAddplane::setup()
|
|
{
|
|
|
|
}
|
|
|
|
void LAMPMainWidget::MapToolAddplane::deSetup()
|
|
{
|
|
|
|
}
|
|
|
|
QString LAMPMainWidget::MapToolAddplane::id()
|
|
{
|
|
return QString("addplane_tool");
|
|
}
|
|
|
|
void LAMPMainWidget::MapToolAddplane::addPlane(MapAutoplane *plane)
|
|
{
|
|
this->mMapCanvas->scene()->addItem(plane);
|
|
this->planes.append(plane);
|
|
}
|
|
|
|
void LAMPMainWidget::MapToolAddplane::delePlane(MapAutoplane *plane)
|
|
{
|
|
this->mMapCanvas->scene()->removeItem(plane);
|
|
this->planes.removeAll(plane);
|
|
}
|