Changeset 15 in flair-src for trunk/tools/FlairGCS/src/Landmark.cpp
- Timestamp:
- 04/08/16 15:40:57 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/FlairGCS/src/Landmark.cpp
r10 r15 11 11 using namespace QtMobility; 12 12 13 Landmark::Landmark(QGraphicsGeoMap *geoMap, const QGeoCoordinate &coordinate, QString name,QString type)14 {15 16 this->geoMap=geoMap;17 18 13 Landmark::Landmark(QGraphicsGeoMap *geoMap, const QGeoCoordinate &coordinate, 14 QString name, QString type) { 15 geoMap->addMapObject(this); 16 this->geoMap = geoMap; 17 pixmap = new QGeoMapPixmapObject(); 18 pixmap->setCoordinate(coordinate); 19 19 20 if(type=="cross") 21 { 22 pixmap->setOffset(QPoint(-16, -16)); 23 pixmap->setPixmap(QPixmap(":cross.png")); 24 } 25 else 26 { 27 pixmap->setOffset(QPoint(-2, -30)); 28 pixmap->setPixmap(QPixmap(":landmark.png")); 29 } 30 addChildObject(pixmap); 20 if (type == "cross") { 21 pixmap->setOffset(QPoint(-16, -16)); 22 pixmap->setPixmap(QPixmap(":cross.png")); 23 } else { 24 pixmap->setOffset(QPoint(-2, -30)); 25 pixmap->setPixmap(QPixmap(":landmark.png")); 26 } 27 addChildObject(pixmap); 31 28 32 33 34 text = new QGeoMapTextObject(coordinate,name, font, QPoint(0, 10));35 36 37 29 QFont font; 30 font.setWeight(QFont::Bold); 31 text = new QGeoMapTextObject(coordinate, name, font, QPoint(0, 10)); 32 text->setPen(QPen(Qt::NoPen)); 33 text->setBrush(QBrush(Qt::red)); 34 addChildObject(text); 38 35 } 39 36 40 Landmark::~Landmark() 41 { 42 geoMap->removeMapObject(this); 43 clearChildObjects(); 37 Landmark::~Landmark() { 38 geoMap->removeMapObject(this); 39 clearChildObjects(); 44 40 } 45 41 46 void Landmark::setText(QString string) 47 { 48 text->setText(string); 42 void Landmark::setText(QString string) { text->setText(string); } 43 44 void Landmark::setColor(Qt::GlobalColor color) { 45 text->setBrush(QBrush(color)); 49 46 } 50 47 51 void Landmark::setCo lor(Qt::GlobalColor color)52 { 53 text->setBrush(QBrush(color));48 void Landmark::setCoordinate(const QGeoCoordinate &coordinate) { 49 pixmap->setCoordinate(coordinate); 50 text->setCoordinate(coordinate); 54 51 } 55 52 56 void Landmark::setCoordinate(const QGeoCoordinate &coordinate) 57 { 58 pixmap->setCoordinate(coordinate); 59 text->setCoordinate(coordinate); 53 QGeoCoordinate Landmark::coordinate(void) { return pixmap->coordinate(); } 54 55 void Landmark::RemoveLandmark(void) { geoMap->removeMapObject(this); } 56 57 void Landmark::AddLandmark(QGraphicsGeoMap *geoMap) { 58 geoMap->addMapObject(this); 59 this->geoMap = geoMap; 60 60 } 61 62 QGeoCoordinate Landmark::coordinate(void)63 {64 return pixmap->coordinate();65 }66 67 void Landmark::RemoveLandmark(void)68 {69 geoMap->removeMapObject(this);70 }71 72 void Landmark::AddLandmark(QGraphicsGeoMap *geoMap)73 {74 geoMap->addMapObject(this);75 this->geoMap=geoMap;76 }
Note:
See TracChangeset
for help on using the changeset viewer.