Changeset 15 in flair-src for trunk/tools/FlairGCS/src/Landmark.cpp


Ignore:
Timestamp:
Apr 8, 2016, 3:40:57 PM (5 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/FlairGCS/src/Landmark.cpp

    r10 r15  
    1111using namespace QtMobility;
    1212
    13 Landmark::Landmark(QGraphicsGeoMap *geoMap, const QGeoCoordinate &coordinate,QString name,QString type)
    14 {
    15     geoMap->addMapObject(this);
    16     this->geoMap=geoMap;
    17     pixmap = new QGeoMapPixmapObject();
    18     pixmap->setCoordinate(coordinate);
     13Landmark::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);
    1919
    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);
    3128
    32     QFont font;
    33     font.setWeight(QFont::Bold);
    34     text = new QGeoMapTextObject(coordinate,name, font, QPoint(0, 10));
    35     text->setPen(QPen(Qt::NoPen));
    36     text->setBrush(QBrush(Qt::red));
    37     addChildObject(text);
     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);
    3835}
    3936
    40 Landmark::~Landmark()
    41 {
    42     geoMap->removeMapObject(this);
    43     clearChildObjects();
     37Landmark::~Landmark() {
     38  geoMap->removeMapObject(this);
     39  clearChildObjects();
    4440}
    4541
    46 void Landmark::setText(QString string)
    47 {
    48     text->setText(string);
     42void Landmark::setText(QString string) { text->setText(string); }
     43
     44void Landmark::setColor(Qt::GlobalColor color) {
     45  text->setBrush(QBrush(color));
    4946}
    5047
    51 void Landmark::setColor(Qt::GlobalColor color)
    52 {
    53     text->setBrush(QBrush(color));
     48void Landmark::setCoordinate(const QGeoCoordinate &coordinate) {
     49  pixmap->setCoordinate(coordinate);
     50  text->setCoordinate(coordinate);
    5451}
    5552
    56 void Landmark::setCoordinate(const QGeoCoordinate &coordinate)
    57 {
    58     pixmap->setCoordinate(coordinate);
    59     text->setCoordinate(coordinate);
     53QGeoCoordinate Landmark::coordinate(void) { return pixmap->coordinate(); }
     54
     55void Landmark::RemoveLandmark(void) { geoMap->removeMapObject(this); }
     56
     57void Landmark::AddLandmark(QGraphicsGeoMap *geoMap) {
     58  geoMap->addMapObject(this);
     59  this->geoMap = geoMap;
    6060}
    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.