From 9a2ab97a821a15a3bfa40bb0a7b1148c0ec83eab Mon Sep 17 00:00:00 2001 From: wmj Date: Wed, 13 Dec 2017 20:53:24 +0800 Subject: [PATCH] modified gitignore --- .gitignore | 5 +++ DataStructureProject.pro.user | 2 +- parkinglot.cpp | 85 ----------------------------------- 3 files changed, 6 insertions(+), 86 deletions(-) diff --git a/.gitignore b/.gitignore index 6732e72..dcf1d22 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,8 @@ Makefile* # QtCtreator CMake CMakeLists.txt.user* +.vs/ +debug/ +release/ +*.vcxproj +*.vcxproj.* diff --git a/DataStructureProject.pro.user b/DataStructureProject.pro.user index 7154b36..45fcb18 100644 --- a/DataStructureProject.pro.user +++ b/DataStructureProject.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/parkinglot.cpp b/parkinglot.cpp index b741c42..5d907aa 100644 --- a/parkinglot.cpp +++ b/parkinglot.cpp @@ -30,91 +30,6 @@ ParkingLot::ParkingLot(const QString &fname, QWidget* parent) // painter = new QPainter(map); } -void ParkingLot::creatMap() -{/* - // painter = new QPainter(map); - QDomElement root =doc -> documentElement(); - if (root.tagName() != "parkinglot") { - QMessageBox::critical(parent, QObject::tr("Error"), - QObject::tr("Not a parkinglot file")); - } - if (root.attribute("layout") == "vertical") - vertical = true; - else if (root.attribute("layout") == "horizontal") - vertical = false; - else - qDebug() << "XML文件错误:" << root.attribute("layout"); - - int currentX = 0, X = 0; - int currentY = 0, Y = 0; - int maxWidthOfColumn = 0; - int maxHeightOfLine = 0; - QPixmap roadPix(":/road/line"); - QPixmap roomPix(":/road/room"); - QPixmap *toDraw; - QMatrix rotate; - QDomNode line = root.firstChild(); - while (!line.isNull()) { // 节点 - QDomElement space = line.firstChild().toElement(); - while(!space.isNull()) { - if (space.tagName() == "road") { - toDraw = &roadPix; - } else if (space.tagName() == "room") { - toDraw = &roomPix; - } else { - qDebug() << "文件错误" << space.tagName(); - } - - int n = space.attribute("number", "1").toInt(); - painter->save(); - switch(space.attribute("direction").at(0).unicode()) { - case 'E': - rotate.rotate(180); - break; - case 'S': - rotate =rotate.rotate(90); - break; - case 'W': - rotate =rotate.rotate(0); - break; - case 'N': - rotate =rotate.rotate(270); - break; - default: - qDebug() << "错误的方向" << space.attribute("direction").at(0).unicode(); - } - for (int i = 0; i < n; i++) { - painter->drawPixmap(currentX, currentY, toDraw -> width(), toDraw -> height(), - toDraw->transformed(rotate)); - if (vertical) { - currentY += toDraw -> height(); - maxWidthOfColumn = std::max(maxWidthOfColumn, toDraw -> width()); - } else { - currentX += toDraw -> width(); - maxHeightOfLine = std::max(maxHeightOfLine, toDraw -> height()); - } - } - painter->restore(); - - space = space.nextSibling().toElement(); - } - if (vertical) { - Y = std::max(Y, currentY); - currentY = 0; - currentX += maxWidthOfColumn; - X = currentX; - maxWidthOfColumn = 0; - } else { - X = std::max(X, currentX); - currentX = 0; - currentY += maxHeightOfLine; - Y = currentY; - maxHeightOfLine = 0; - } - line = line.nextSibling(); - }*/ -} - QPixmap ParkingLot::creatMap2() { QDomElement root =doc -> documentElement();