2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2013-06-18 11:10:19 +00:00
|
|
|
Copyright 2006-2013 The QElectroTech Team
|
2007-12-01 10:47:15 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2007-11-09 13:06:51 +00:00
|
|
|
#ifndef DIAGRAM_CONTENT_H
|
|
|
|
#define DIAGRAM_CONTENT_H
|
|
|
|
#include <QtGui>
|
|
|
|
class Conductor;
|
|
|
|
class Element;
|
2010-04-18 17:59:54 +00:00
|
|
|
class IndependentTextItem;
|
2007-11-09 13:06:51 +00:00
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
This class provides a container that makes the transmission of diagram content
|
|
|
|
to other functions/methods easier. The different kind of items are made
|
|
|
|
available through a handful of filter-aware methods. Considering selected
|
|
|
|
elements are to be moved, the filter notably distinguishes conductors to be
|
|
|
|
moved from those to be updated.
|
|
|
|
Please note this container does not systematically contains a whole
|
|
|
|
diagram: it may describe only a part of it, e.g. selected items.
|
2007-11-09 13:06:51 +00:00
|
|
|
*/
|
|
|
|
class DiagramContent {
|
|
|
|
public:
|
|
|
|
DiagramContent();
|
|
|
|
DiagramContent(const DiagramContent &);
|
|
|
|
~DiagramContent();
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
/// Used to filter the different items carried by this container.
|
2007-11-11 16:12:45 +00:00
|
|
|
enum Filter {
|
|
|
|
Elements = 1,
|
|
|
|
TextFields = 2,
|
|
|
|
ConductorsToMove = 4,
|
|
|
|
ConductorsToUpdate = 8,
|
|
|
|
OtherConductors = 16,
|
|
|
|
AnyConductor = 28,
|
2009-05-17 02:13:40 +00:00
|
|
|
All = 31,
|
|
|
|
SelectedOnly = 32
|
2007-11-11 16:12:45 +00:00
|
|
|
};
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
/// Hold electrical elements
|
2010-05-08 21:24:43 +00:00
|
|
|
QSet<Element *> elements;
|
2012-11-09 21:09:24 +00:00
|
|
|
/// Hold independent text items
|
2010-05-08 21:24:43 +00:00
|
|
|
QSet<IndependentTextItem *> textFields;
|
2012-11-09 21:09:24 +00:00
|
|
|
/// Hold conductors that would get updated considering electrical elements are moved
|
2010-05-08 21:24:43 +00:00
|
|
|
QSet<Conductor *> conductorsToUpdate;
|
2012-11-09 21:09:24 +00:00
|
|
|
/// Hold conductors that would be moved as is considering electrical elements are moved
|
2010-05-08 21:24:43 +00:00
|
|
|
QSet<Conductor *> conductorsToMove;
|
2012-11-09 21:09:24 +00:00
|
|
|
/// Hold conductors that would be left untouched considering electrical elements are moved
|
2010-05-08 21:24:43 +00:00
|
|
|
QSet<Conductor *> otherConductors;
|
2007-11-09 13:06:51 +00:00
|
|
|
|
2007-11-11 16:12:45 +00:00
|
|
|
QList<Conductor *> conductors(int = AnyConductor) const;
|
|
|
|
QList<QGraphicsItem *> items(int = All) const;
|
|
|
|
QString sentence(int = All) const;
|
|
|
|
int count(int = All) const;
|
2007-11-09 13:06:51 +00:00
|
|
|
void clear();
|
|
|
|
};
|
2007-11-11 16:12:45 +00:00
|
|
|
QDebug &operator<<(QDebug, DiagramContent &);
|
2007-11-09 13:06:51 +00:00
|
|
|
#endif
|