2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2017-01-20 10:55:49 +00:00
|
|
|
Copyright 2006-2017 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
|
2014-10-17 21:30:42 +00:00
|
|
|
|
|
|
|
#include <QSet>
|
|
|
|
|
|
|
|
class QGraphicsItem;
|
2007-11-09 13:06:51 +00:00
|
|
|
class Conductor;
|
|
|
|
class Element;
|
2010-04-18 17:59:54 +00:00
|
|
|
class IndependentTextItem;
|
2013-08-24 15:18:45 +00:00
|
|
|
class DiagramImageItem;
|
2014-10-17 21:30:42 +00:00
|
|
|
class QetShapeItem;
|
2017-08-03 17:36:08 +00:00
|
|
|
class DynamicElementTextItem;
|
2017-12-05 20:51:54 +00:00
|
|
|
class ElementTextItemGroup;
|
|
|
|
class Diagram;
|
|
|
|
class DiagramTextItem;
|
2014-02-28 14:30:59 +00:00
|
|
|
|
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
|
|
|
*/
|
2017-08-03 17:36:08 +00:00
|
|
|
class DiagramContent
|
|
|
|
{
|
2007-11-09 13:06:51 +00:00
|
|
|
public:
|
2017-08-03 17:36:08 +00:00
|
|
|
DiagramContent();
|
2017-12-05 20:51:54 +00:00
|
|
|
DiagramContent(Diagram *diagram);
|
2017-08-03 17:36:08 +00:00
|
|
|
DiagramContent(const DiagramContent &);
|
|
|
|
~DiagramContent();
|
|
|
|
|
|
|
|
/// Used to filter the different items carried by this container.
|
|
|
|
enum Filter {
|
|
|
|
Elements = 1,
|
|
|
|
TextFields = 2,
|
|
|
|
ElementTextFields = 4,
|
|
|
|
Images = 8,
|
|
|
|
ConductorsToMove = 16,
|
|
|
|
ConductorsToUpdate = 32,
|
|
|
|
OtherConductors = 64,
|
|
|
|
AnyConductor = 112,
|
|
|
|
Shapes = 128,
|
2017-12-05 20:51:54 +00:00
|
|
|
TextGroup = 256,
|
|
|
|
All = 511,
|
|
|
|
SelectedOnly = 512
|
2017-08-03 17:36:08 +00:00
|
|
|
};
|
|
|
|
|
2018-04-12 16:24:44 +00:00
|
|
|
QList<Element *> m_elements;
|
2017-08-03 17:36:08 +00:00
|
|
|
QSet<IndependentTextItem *> m_text_fields;
|
|
|
|
QSet<DiagramImageItem *> m_images;
|
|
|
|
QSet<QetShapeItem *> m_shapes;
|
2018-04-23 13:50:36 +00:00
|
|
|
QList<Conductor *> m_conductors_to_update;
|
|
|
|
QList<Conductor *> m_conductors_to_move;
|
|
|
|
QList<Conductor *> m_other_conductors;
|
2017-08-03 17:36:08 +00:00
|
|
|
QSet<DynamicElementTextItem *> m_element_texts;
|
2017-12-05 20:51:54 +00:00
|
|
|
QSet<ElementTextItemGroup *> m_texts_groups;
|
|
|
|
QList<QGraphicsItem *> m_selected_items;
|
2017-08-03 17:36:08 +00:00
|
|
|
|
2017-12-05 20:51:54 +00:00
|
|
|
QList<DiagramTextItem *> selectedTexts() const;
|
|
|
|
QList<ElementTextItemGroup *> selectedTextsGroup() const;
|
2017-08-03 17:36:08 +00:00
|
|
|
QList<Conductor *> conductors(int = AnyConductor) const;
|
2017-12-05 21:41:29 +00:00
|
|
|
bool hasDeletableItems() const;
|
2018-04-04 11:02:40 +00:00
|
|
|
bool hasCopiableItems() const;
|
2017-08-03 17:36:08 +00:00
|
|
|
QList<QGraphicsItem *> items(int = All) const;
|
|
|
|
QString sentence(int = All) const;
|
|
|
|
int count(int = All) const;
|
|
|
|
void clear();
|
|
|
|
int removeNonMovableItems();
|
2018-04-08 16:50:52 +00:00
|
|
|
|
|
|
|
DiagramContent& operator+=(const DiagramContent& other);
|
2007-11-09 13:06:51 +00:00
|
|
|
};
|
2007-11-11 16:12:45 +00:00
|
|
|
QDebug &operator<<(QDebug, DiagramContent &);
|
2007-11-09 13:06:51 +00:00
|
|
|
#endif
|