2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2010-01-03 16:25:37 +00:00
|
|
|
Copyright 2006-2010 Xavier Guerrin
|
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;
|
|
|
|
class Terminal;
|
|
|
|
class DiagramTextItem;
|
|
|
|
/**
|
|
|
|
Cette classe est un conteneur pour passer facilement le contenu d'un schema
|
|
|
|
a une fonction. Il permet d'acceder rapidement aux differents types de
|
|
|
|
composants que l'on peut trouver sur un schema, comme les elements, les
|
|
|
|
champs de texte, les conducteurs (a deplacer ou a mettre a jour, en cas de
|
|
|
|
deplacements), etc.
|
|
|
|
A noter que ce container ne contient pas systematiquement l'integralite
|
|
|
|
d'un schema. Il peut n'en contenir qu'une partie, typiquement les
|
|
|
|
composants selectionnes.
|
|
|
|
*/
|
|
|
|
class DiagramContent {
|
|
|
|
public:
|
|
|
|
DiagramContent();
|
|
|
|
DiagramContent(const DiagramContent &);
|
|
|
|
~DiagramContent();
|
|
|
|
|
2007-11-11 16:12:45 +00:00
|
|
|
/// Permet de filtrer facilement les differentes parties d'un schema
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2007-11-09 13:06:51 +00:00
|
|
|
/// Elements de texte du schema
|
|
|
|
QList<Element *> elements;
|
|
|
|
/// Champs de texte du schema
|
|
|
|
QList<DiagramTextItem *> textFields;
|
|
|
|
/// Conducteurs a mettre a jour du schema
|
|
|
|
QHash<Conductor *, Terminal *> conductorsToUpdate;
|
|
|
|
/// Conducteurs a deplacer du schema
|
|
|
|
QList<Conductor *> conductorsToMove;
|
2007-11-11 16:12:45 +00:00
|
|
|
/// Conducteurs isoles (ni a deplacer, ni a mettre a jour)
|
|
|
|
QList<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
|