OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView(parent), configuration(config), UAV(0), GPS(0), Home(0), followmouse(true), compass(0), showuav(false), showhome(false), diagTimer(0), showDiag(false), diagGraphItem(0) { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); core=new internals::Core; map=new MapGraphicItem(core,config); mscene.addItem(map); this->setScene(&mscene); this->adjustSize(); connect(map,SIGNAL(zoomChanged(double,double,double)),this,SIGNAL(zoomChanged(double,double,double))); connect(map->core,SIGNAL(OnCurrentPositionChanged(internals::PointLatLng)),this,SIGNAL(OnCurrentPositionChanged(internals::PointLatLng))); connect(map->core,SIGNAL(OnEmptyTileError(int,core::Point)),this,SIGNAL(OnEmptyTileError(int,core::Point))); connect(map->core,SIGNAL(OnMapDrag()),this,SIGNAL(OnMapDrag())); connect(map->core,SIGNAL(OnMapTypeChanged(MapType::Types)),this,SIGNAL(OnMapTypeChanged(MapType::Types))); connect(map->core,SIGNAL(OnMapZoomChanged()),this,SIGNAL(OnMapZoomChanged())); connect(map->core,SIGNAL(OnMapZoomChanged()),this,SLOT(emitMapZoomChanged())); 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))); SetShowDiagnostics(showDiag); this->setMouseTracking(followmouse); SetShowCompass(true); }
TLMapWidget::TLMapWidget(QWidget *parent, Configuration *config):QGraphicsView(parent),configuration(config),UAV(0),GPS(0),Home(0) ,followmouse(true),compassRose(0),windCompass(0),showuav(false),showhome(false),diagTimer(0),diagGraphItem(0),showDiag(false),overlayOpacity(1) { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); core=new internals::Core; map=new MapGraphicItem(core,config); mscene.addItem(map); this->setScene(&mscene); Home=new HomeItem(map,this); Home->setParentItem(map); Home->setZValue(-1); setStyleSheet("QToolTip {font-size:8pt; color:blue;opacity: 223; padding:2px; border-width:2px; border-style:solid; border-color: rgb(170, 170, 127);border-radius:4px }"); this->adjustSize(); connect(map,SIGNAL(zoomChanged(double,double,double)),this,SIGNAL(zoomChanged(double,double,double))); connect(map->core,SIGNAL(OnCurrentPositionChanged(internals::PointLatLng)),this,SIGNAL(OnCurrentPositionChanged(internals::PointLatLng))); connect(map->core,SIGNAL(OnEmptyTileError(int,core::Point)),this,SIGNAL(OnEmptyTileError(int,core::Point))); connect(map->core,SIGNAL(OnMapDrag()),this,SIGNAL(OnMapDrag())); connect(map->core,SIGNAL(OnMapTypeChanged(MapType::Types)),this,SIGNAL(OnMapTypeChanged(MapType::Types))); connect(map->core,SIGNAL(OnMapZoomChanged()),this,SIGNAL(OnMapZoomChanged())); 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))); connect(map,SIGNAL(wpdoubleclicked(WayPointItem*)),this,SIGNAL(OnWayPointDoubleClicked(WayPointItem*))); connect(&mscene,SIGNAL(selectionChanged()),this,SLOT(OnSelectionChanged())); SetShowDiagnostics(showDiag); this->setMouseTracking(followmouse); SetShowCompassRose(true); SetShowWindCompass(false); QPixmapCache::setCacheLimit(64*1024); }
MapGraphicItem::MapGraphicItem(internals::Core *core, Configuration *configuration):core(core), config(configuration), MapRenderTransform(1), maxZoom(17), minZoom(2), zoomReal(0), rotation(0), zoomDigi(0), isSelected(false) { dragons.load(QString::fromUtf8(":/markers/images/dragons1.jpg")); showTileGridLines=false; isMouseOverMarker=false; maprect=QRectF(0,0,1022,680); core->SetCurrentRegion(internals::Rectangle(0, 0, maprect.width(), maprect.height())); core->SetMapType(MapType::GoogleHybrid); this->SetZoom(2); connect(core,SIGNAL(OnNeedInvalidation()),this,SLOT(Core_OnNeedInvalidation())); connect(core,SIGNAL(OnMapDrag()),this,SLOT(ChildPosRefresh())); connect(core,SIGNAL(OnMapZoomChanged()),this,SLOT(ChildPosRefresh())); //resize(); }