mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
OP37/GCS
New OPMapWidget functions: void SetFollowMouse(bool value) bool FollowMouse() internals::PointLatLng OPMapWidget::currentMousePosition() git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@823 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
46be975628
commit
5bc48dd92e
@ -13,7 +13,6 @@ namespace mapcontrol
|
||||
this->SetZoom(2);
|
||||
connect(core,SIGNAL(OnNeedInvalidation()),this,SLOT(Core_OnNeedInvalidation()));
|
||||
|
||||
|
||||
//resize();
|
||||
}
|
||||
void MapGraphicItem::start()
|
||||
@ -79,6 +78,7 @@ namespace mapcontrol
|
||||
}
|
||||
|
||||
}
|
||||
QGraphicsItem::mouseMoveEvent(event);
|
||||
}
|
||||
void MapGraphicItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
@ -272,6 +272,7 @@ namespace mapcontrol
|
||||
}
|
||||
return core->FromLocalToLatLng(x, y);
|
||||
}
|
||||
|
||||
double MapGraphicItem::Zoom()
|
||||
{
|
||||
return zoomReal;
|
||||
|
@ -37,6 +37,7 @@ protected:
|
||||
void SetZoomStep(int const& value);
|
||||
|
||||
private:
|
||||
|
||||
internals::Core *core;
|
||||
Configuration *config;
|
||||
bool showTileGridLines;
|
||||
@ -58,18 +59,9 @@ private:
|
||||
internals::PointLatLng FromLocalToLatLng(int x, int y);
|
||||
qreal rotation;
|
||||
QRectF boundingBox(QRectF const& rect, qreal const& angle);
|
||||
///
|
||||
// QBrush EmptytileBrush;
|
||||
// QString EmptyTileText;
|
||||
// QPen EmptyTileBorders;
|
||||
// QPen ScalePen;
|
||||
// QPen SelectionPen;
|
||||
///
|
||||
int MaxZoom()const{return maxZoom;}
|
||||
int MinZoom()const{return minZoom;}
|
||||
internals::MouseWheelZoomType::Types GetMouseWheelZoomType(){return core->GetMouseWheelZoomType();}
|
||||
// QString GetMouseWheelZoomTypeStr(){return internals::MouseWheelZoomType::TypesStrList().at((int)core->GetMouseWheelZoomType());}
|
||||
// bool MapScaleInfoEnabled;
|
||||
Qt::MouseButton DragButton;
|
||||
void SetSelectedArea(internals::RectLatLng const& value){selectedArea = value;this->update();}
|
||||
internals::RectLatLng BoundsOfMap;
|
||||
|
@ -21,7 +21,7 @@ namespace mapcontrol
|
||||
// connect(&mscene,SIGNAL(sceneRectChanged(QRectF)),map,SLOT(resize(QRectF)));
|
||||
// connect(map,SIGNAL(zoomChanged(double)),this,SIGNAL(zoomChanged(double)));
|
||||
// }
|
||||
OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config):QGraphicsView(parent),configuration(config)
|
||||
OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config):QGraphicsView(parent),configuration(config),followmouse(true)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
core=new internals::Core;
|
||||
@ -40,6 +40,7 @@ namespace mapcontrol
|
||||
connect(map->core,SIGNAL(OnTileLoadComplete()),this,SIGNAL(OnTileLoadComplete()));
|
||||
connect(map->core,SIGNAL(OnTileLoadStart()),this,SIGNAL(OnTileLoadStart()));
|
||||
connect(map->core,SIGNAL(OnTilesStillToLoad(int)),this,SIGNAL(OnTilesStillToLoad(int)));
|
||||
this->setMouseTracking(followmouse);
|
||||
}
|
||||
|
||||
void OPMapWidget::resizeEvent(QResizeEvent *event)
|
||||
@ -78,5 +79,16 @@ namespace mapcontrol
|
||||
setupViewport(new QWidget());
|
||||
update();
|
||||
}
|
||||
internals::PointLatLng OPMapWidget::currentMousePosition()
|
||||
{
|
||||
return currentmouseposition;
|
||||
}
|
||||
void OPMapWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
QGraphicsView::mouseMoveEvent(event);
|
||||
QPointF p=event->posF();
|
||||
p=map->mapFromParent(p);
|
||||
currentmouseposition=map->FromLocalToLatLng(p.x(),p.y());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -97,6 +97,11 @@ namespace mapcontrol
|
||||
|
||||
Configuration* configuration;
|
||||
|
||||
internals::PointLatLng currentMousePosition();
|
||||
|
||||
void SetFollowMouse(bool const& value){followmouse=value;this->setMouseTracking(followmouse);}
|
||||
bool FollowMouse(){return followmouse;}
|
||||
|
||||
private:
|
||||
internals::Core *core;
|
||||
MapGraphicItem *map;
|
||||
@ -105,12 +110,14 @@ namespace mapcontrol
|
||||
GeoCoderStatusCode x;
|
||||
MapType y;
|
||||
core::AccessMode xx;
|
||||
|
||||
internals::PointLatLng currentmouseposition;
|
||||
bool followmouse;
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void showEvent ( QShowEvent * event );
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void mouseMoveEvent ( QMouseEvent * event );
|
||||
// private slots:
|
||||
signals:
|
||||
void zoomChanged(double zoom);
|
||||
|
Loading…
x
Reference in New Issue
Block a user