Changeset 67 in flair-src for trunk/tools
- Timestamp:
- Aug 29, 2016, 4:58:23 PM (8 years ago)
- Location:
- trunk/tools/FlairGCS/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/FlairGCS/src/DataRemote.cpp
r15 r67 78 78 79 79 void DataRemote::SendPeriod(int period, bool auto_refresh) { 80 RemoveAllAttributes(); 81 80 82 SetAttribute("period", period); 81 83 SetAttribute("enabled", auto_refresh); -
trunk/tools/FlairGCS/src/Landmark.cpp
r15 r67 46 46 } 47 47 48 bool Landmark::IsUptodate(void) { 49 if(text->brush()==QBrush(Qt::white)) { 50 return true; 51 } else { 52 return false; 53 } 54 } 55 48 56 void Landmark::setCoordinate(const QGeoCoordinate &coordinate) { 49 57 pixmap->setCoordinate(coordinate); -
trunk/tools/FlairGCS/src/Landmark.h
r15 r67 29 29 void RemoveLandmark(void); 30 30 void AddLandmark(QtMobility::QGraphicsGeoMap *geoMap); 31 bool IsUptodate(void); 31 32 32 33 private: -
trunk/tools/FlairGCS/src/Map.cpp
r62 r67 95 95 for (int i = 0; i < points.count(); i++) delete points.at(i); 96 96 delete mapWidget; 97 98 if(geoMap!=0) delete geoMap;99 97 } 100 98 -
trunk/tools/FlairGCS/src/Map.h
r15 r67 25 25 class Map : public DataRemote { 26 26 Q_OBJECT 27 28 friend class MapWidget; 27 29 28 30 public: -
trunk/tools/FlairGCS/src/XmlWidget.cpp
r15 r67 291 291 } 292 292 293 void XmlWidget::RemoveAllAttributes() { 294 QString name = write_elem.attribute("name"); 295 296 QDomNamedNodeMap attributes=write_elem.attributes(); 297 while(attributes.count()!=0) { 298 printf("%i %s\n",attributes.count(),attributes.item(0).toAttr().name().toLocal8Bit().constData()); 299 write_elem.removeAttribute(attributes.item(0).toAttr().name()); 300 } 301 SetAttribute("name", name); 302 } 303 293 304 void XmlWidget::RenamedFrom(QString old_name) { 294 305 QString name = write_elem.attribute("name"); -
trunk/tools/FlairGCS/src/XmlWidget.h
r16 r67 68 68 void SetAttribute(const QString &name, float value); 69 69 void SetAttribute(const QString &name, double value); 70 void RemoveAllAttributes(); //except name 70 71 void RemoveAttribute(const QString &name); 71 72 }; -
trunk/tools/FlairGCS/src/mapwidget.cpp
r62 r67 54 54 #include "Landmark.h" 55 55 #include "Map.h" 56 #include "ConnectionLayout.h" 56 57 57 58 using namespace QtMobility; … … 66 67 pressed = false; 67 68 landmark_match = NULL; 68 is_uptodate = true;69 69 this->map = map; 70 70 … … 107 107 QList<QAction *> centered_actions; 108 108 109 //add centered for every point 109 110 QMenu *centered_menu = menu->addMenu("centered"); 110 111 for (int i = 0; i < points.count(); i++) { … … 122 123 123 124 b = menu->addAction("place checkpoint"); 125 126 //add go to for every landmark 124 127 QMenu *go_to_menu = menu->addMenu("go to"); 125 128 for (int i = 0; i < landmarks->count(); i++) { … … 134 137 z = map->execmenu(this, menu, event->globalPos()); 135 138 139 //center to the desired point 136 140 for (int i = 0; i < centered_actions.count(); i++) { 137 141 if (z == centered_actions.at(i)) { … … 146 150 } 147 151 152 //add a landmark 148 153 if (z == b) { 149 154 Landmark *landmark = new Landmark( … … 151 156 QString("%1").arg(landmarks->count() + 1)); 152 157 landmarks->append(landmark); 153 is_uptodate = false;154 158 } 155 159 for (int i = 0; i < go_to_actions.count(); i++) { … … 161 165 } 162 166 167 //delete landmark 163 168 } else { 164 169 QAction *a, *z; 165 170 a = menu->addAction("delete"); 166 z = menu->exec(event->globalPos()); 167 168 if (z == a) { 169 int i; 170 for (i = 0; i < landmarks->count(); i++) { 171 if (landmarks->at(i)->contains( 171 //get selected landmark id 172 int landmark_index; 173 for (landmark_index = 0; landmark_index < landmarks->count(); landmark_index++) { 174 if (landmarks->at(landmark_index)->contains( 172 175 geoMap->screenPositionToCoordinate(event->pos()))) { 173 delete landmarks->at(i); 174 landmarks->removeAt(i); 176 a->setEnabled(landmarks->at(landmark_index)->IsUptodate()); 175 177 break; 176 178 } 177 } 178 for (int j = i; j < landmarks->count(); j++) { 179 } 180 z = menu->exec(event->globalPos()); 181 182 if (z == a) { 183 //remove from landmarks_old 184 for (int i = 0; i < landmarks_old->count(); i++) { 185 if (landmarks_old->at(i)->contains( 186 geoMap->screenPositionToCoordinate(event->pos()))) { 187 landmarks_old->removeAt(i); 188 break; 189 } 190 } 191 192 //remove from landmarks 193 delete landmarks->at(landmark_index); 194 landmarks->removeAt(landmark_index); 195 196 //reorder the remaining ones 197 for (int j = landmark_index; j < landmarks->count(); j++) { 179 198 landmarks->at(j)->setText(QString("%1").arg(j + 1)); 180 199 } 200 201 //send delete 202 map->RemoveAllAttributes(); 203 map->SetAttribute("lat" + QString::number(landmark_index),"delete"); 204 map->SetAttribute("long" + QString::number(landmark_index),"delete"); 205 map->connectionLayout()->XmlToSend(map->XmlDoc()); 206 map->RemoveAttribute("lat" + QString::number(landmark_index)); 207 map->RemoveAttribute("long" + QString::number(landmark_index)); 181 208 } 182 209 } … … 219 246 landmark_match = landmarks->at(i); 220 247 landmark_match->setColor(Qt::red); 221 is_uptodate = false;222 248 } 223 249 new_cursor = Qt::PointingHandCursor; … … 290 316 } 291 317 292 bool MapWidget::IsUptodate(void) { return is_uptodate; } 318 bool MapWidget::IsUptodate(void) { 319 for (int i = 0; i < landmarks->count(); i++) { 320 if(!landmarks->at(i)->IsUptodate()) return false; 321 } 322 return true; 323 } 293 324 294 325 void MapWidget::SetUptodate(void) { … … 306 337 landmarks_old->at(i)->setVisible(false); 307 338 } 308 309 is_uptodate = true;310 339 } 311 340 … … 323 352 landmarks->at(i)->setColor(Qt::white); 324 353 } 325 326 is_uptodate = true;327 354 } 328 355 -
trunk/tools/FlairGCS/src/mapwidget.h
r62 r67 94 94 QPoint dragStartPosition; 95 95 bool pressed; 96 bool is_uptodate;97 96 98 97 QGraphicsScene *m_scene;
Note:
See TracChangeset
for help on using the changeset viewer.