Commit 29309c40 authored by Tao Zhong's avatar Tao Zhong

Add properties for goal #133 Update goal file format

* x_min
* x_max
* y_min
* y_max
parent 6e61cb6d
......@@ -2983,6 +2983,10 @@ void jpsDatamanager::writeGoals(QXmlStreamWriter *stream, QList<JPSGoal *> &goal
stream->writeAttribute("id",QString::number(goal->getId()));
stream->writeAttribute("final",goal->getIsFinal());
stream->writeAttribute("caption",goal->getCaption());
stream->writeAttribute("x_min",goal->getXMin());
stream->writeAttribute("x_max",goal->getXMax());
stream->writeAttribute("y_min",goal->getYMin());
stream->writeAttribute("y_max",goal->getYMax());
stream->writeStartElement("polygon");
......
......@@ -58,6 +58,10 @@ JPSGoal::JPSGoal(QGraphicsRectItem *goalRectItem)
caption="Goal";
beSaved="true";
isFinal="true";
x_min = QString::number(this->rect().bottomLeft().x());
y_min = QString::number(this->rect().bottomLeft().y());
x_max = QString::number(this->rect().topRight().x());
y_max = QString::number(this->rect().topRight().y());
}
JPSGoal::~JPSGoal()
......@@ -104,6 +108,37 @@ void JPSGoal::setRectItem(QGraphicsRectItem *rectItem) {
JPSGoal::rectItem = rectItem;
}
const QString &JPSGoal::getXMin() const {
return x_min;
}
void JPSGoal::setXMin(const QString &xMin) {
x_min = xMin;
}
const QString &JPSGoal::getXMax() const {
return x_max;
}
void JPSGoal::setXMax(const QString &xMax) {
x_max = xMax;
}
const QString &JPSGoal::getYMin() const {
return y_min;
}
void JPSGoal::setYMin(const QString &yMin) {
y_min = yMin;
}
const QString &JPSGoal::getYMax() const {
return y_max;
}
void JPSGoal::setYMax(const QString &yMax) {
y_max = yMax;
}
// For drawing
void JPSGoal::setPen(const QPen &pen_)
......
......@@ -80,6 +80,22 @@ public slots:
void setRectItem(QGraphicsRectItem *rectItem);
const QString &getXMin() const;
void setXMin(const QString &xMin);
const QString &getXMax() const;
void setXMax(const QString &xMax);
const QString &getYMin() const;
void setYMin(const QString &yMin);
const QString &getYMax() const;
void setYMax(const QString &yMax);
protected:
QVariant itemChange(GraphicsItemChange change,const QVariant &value);
void keyPressEvent(QKeyEvent *event);
......@@ -93,6 +109,10 @@ private:
QString caption;
QString beSaved;
QString isFinal;
QString x_min;
QString x_max;
QString y_min;
QString y_max;
//QGraphicsItem attributes
QPen currentPen;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment