void WayPointItem::WPRenumbered(const int &oldnumber, const int &newnumber, WayPointItem *waypoint) { if (waypoint!=this) { if(((oldnumber>number) && (newnumber<=number))) { ++number; numberI->setText(QString::number(number)); numberIBG->setRect(numberI->boundingRect().adjusted(-2,0,1,0)); RefreshToolTip(); } else if (((oldnumber<number) && (newnumber>number))) { --number; numberI->setText(QString::number(number)); numberIBG->setRect(numberI->boundingRect().adjusted(-2,0,1,0)); RefreshToolTip(); } else if (newnumber==number) { ++number; numberI->setText(QString::number(number)); RefreshToolTip(); } this->update(); } }
void WayPointItem::SetDescription(const QString &value) { description=value; RefreshToolTip(); emit WPValuesChanged(this); this->update(); }
void gpLayer::Refresh() { m_refreshNeeded = false; RefreshChart(); RefreshToolTip(); m_sameFormatAsPreviously = true; }
WayPointItem::WayPointItem(const internals::PointLatLng &coord,double const& altitude, const QString &description, MapGraphicItem *map) : map(map), autoreachedEnabled(true), text(NULL), textBG(NULL), numberI(NULL), numberIBG(NULL), coord(coord), reached(false), description(description), shownumber(true), isDragging(false), altitude(altitude), // sets a 10m default just in case heading(0), number(0) { picture.load(QString::fromUtf8(":/markers/images/marker.png")); number=WayPointItem::snumber; ++WayPointItem::snumber; this->setFlag(QGraphicsItem::ItemIsMovable,true); this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true); this->setFlag(QGraphicsItem::ItemIsSelectable,true); //transf.translate(picture.width()/2,picture.height()); // this->setTransform(transf); SetShowNumber(shownumber); RefreshToolTip(); RefreshPos(); }
void WayPointItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { if(event->button()==Qt::LeftButton) { if (m_mouseDown) { //Mouse is already pressed return; } m_mouseDown = true; Q_ASSERT(text == NULL); Q_ASSERT(textBG == NULL); text=new QGraphicsSimpleTextItem(this); textBG=new QGraphicsRectItem(this); textBG->setBrush(QColor(255, 255, 255, 128)); textBG->setOpacity(0.5); text->setPen(QPen(Qt::red)); text->setPos(10,-picture.height()); textBG->setPos(10,-picture.height()); text->setZValue(3); RefreshToolTip(); isDragging=true; } QGraphicsItem::mousePressEvent(event); }
WayPointItem::WayPointItem(MapGraphicItem *map, bool magicwaypoint):reached(false),description(""),shownumber(true),isDragging(false),altitude(0),map(map) { relativeCoord.bearing=0; relativeCoord.distance=0; relativeCoord.altitudeRelative=0; myType=relative; if(magicwaypoint) { isMagic=true; picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker3.png")); number=-1; } else { isMagic=false; number=WayPointItem::snumber; ++WayPointItem::snumber; } text=0; numberI=0; this->setFlag(QGraphicsItem::ItemIsMovable,true); this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true); this->setFlag(QGraphicsItem::ItemIsSelectable,true); SetShowNumber(shownumber); RefreshToolTip(); RefreshPos(); myHome=NULL; QList<QGraphicsItem *> list=map->childItems(); foreach(QGraphicsItem * obj,list) { HomeItem* h=qgraphicsitem_cast <HomeItem*>(obj); if(h) myHome=h; }
WayPointItem::WayPointItem(const internals::PointLatLng &coord,double const& altitude, MapGraphicItem *map) : AbstractBaseItem(map), map(map), autoreachedEnabled(true), coord(coord), reached(false), description(""), shownumber(true), isDragging(false), altitude(altitude), heading(0) { text=0; numberI=0; picture.load(QString::fromUtf8(":/markers/images/marker.png")); number=WayPointItem::snumber; ++WayPointItem::snumber; this->setFlag(QGraphicsItem::ItemIsMovable,true); this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true); this->setFlag(QGraphicsItem::ItemIsSelectable,true); this->setZValue(4); // transf.translate(picture.width()/2,picture.height()); // this->setTransform(transf); SetShowNumber(shownumber); RefreshToolTip(); RefreshPos(); }
void WayPointItem::SetCoord(const internals::PointLatLng &value) { coord=value; emit WPValuesChanged(this); RefreshPos(); RefreshToolTip(); this->update(); }
void WayPointItem::SetAltitude(const double &value) { altitude=value; RefreshToolTip(); emit WPValuesChanged(this); this->update(); }
void WayPointItem::WPDeleted(const int &onumber) { if(number>onumber) --number; numberI->setText(QString::number(number)); numberIBG->setRect(numberI->boundingRect().adjusted(-2,0,1,0)); RefreshToolTip(); this->update(); }
void WayPointItem::SetHeading(const float &value) { heading=value; RefreshToolTip(); emit WPValuesChanged(this); this->update(); }
void WayPointItem::SetNumber(const int &value) { emit WPNumberChanged(number,value,this); number=value; RefreshToolTip(); numberI->setText(QString::number(number)); numberIBG->setRect(numberI->boundingRect().adjusted(-2,0,1,0)); this->update(); }
void WayPointItem::SetHomeAlt(double const& value) { homeAlt = value; altitude = homeAlt + height; RefreshToolTip(); emit WPValuesChanged(this); this->update(); }
void WayPointItem::WPInserted(const int &onumber, WayPointItem *waypoint) { if(waypoint!=this) { if(onumber<=number) ++number; numberI->setText(QString::number(number)); RefreshToolTip(); this->update(); } }
void WayPointItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if(event->button()==Qt::LeftButton) { delete text; delete textBG; coord=map->FromLocalToLatLng(this->pos().x(),this->pos().y()); QString coord_str = " " + QString::number(coord.Lat(), 'f', 6) + " " + QString::number(coord.Lng(), 'f', 6); // qDebug() << "WP MOVE:" << coord_str << __FILE__ << __LINE__; isDragging=false; RefreshToolTip(); emit WPValuesChanged(this); } QGraphicsItem::mouseReleaseEvent(event); }
bool gpLayer::SetChartKind(gpCHART_KIND kind) { //if(!IsSupported(kind)) return false; if(!IsChartTypeEnabled(kind)) return false; gpChart_kind = kind; gpYaxis_type = gpAXIS_DEFAULT; gpXaxis_type = gpAXIS_DEFAULT; m_sameFormatAsPreviously = false; RefreshChart(); RefreshLabels(); //last refresh tooltip for current view /// @note maybe there is case, when tooltip /// don't want refresh to this kind of chart view... /// example with fft, wan't show tips before fft.. RefreshToolTip(); return true; }
void WayPointItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { if(event->button()==Qt::LeftButton) { text=new QGraphicsSimpleTextItem(this); textBG=new QGraphicsRectItem(this); // textBG->setBrush(Qt::white); // textBG->setOpacity(0.5); textBG->setBrush(QColor(255, 255, 255, 128)); text->setPen(QPen(Qt::red)); text->setPos(10,-picture.height()); textBG->setPos(10,-picture.height()); text->setZValue(3); RefreshToolTip(); isDragging=true; } QGraphicsItem::mousePressEvent(event); }