mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-17 16:59:59 +01:00
Optimisation du deplacement des elements
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@122 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
29
diagram.h
29
diagram.h
@@ -9,6 +9,7 @@
|
||||
#include "borderinset.h"
|
||||
class Element;
|
||||
class Terminal;
|
||||
class Conducer;
|
||||
class Diagram : public QGraphicsScene {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -29,6 +30,10 @@ class Diagram : public QGraphicsScene {
|
||||
QGraphicsLineItem *conducer_setter;
|
||||
bool draw_grid;
|
||||
bool use_border;
|
||||
bool moved_elements_fetched;
|
||||
QSet<Element *> elements_to_move;
|
||||
QSet<Conducer *> conducers_to_move;
|
||||
QHash<Conducer *, Terminal *> conducers_to_update;
|
||||
|
||||
// methodes
|
||||
public:
|
||||
@@ -55,6 +60,12 @@ class Diagram : public QGraphicsScene {
|
||||
QImage toImage(int = -1, int = -1, Qt::AspectRatioMode = Qt::KeepAspectRatio);
|
||||
QSize imageSize() const;
|
||||
|
||||
void invalidateMovedElements();
|
||||
void fetchMovedElements();
|
||||
const QSet<Element *> &elementsToMove();
|
||||
const QSet<Conducer *> &conducersToMove();
|
||||
const QHash<Conducer *, Terminal *> &conducersToUpdate();
|
||||
|
||||
private slots:
|
||||
void slot_checkSelectionEmptinessChange();
|
||||
|
||||
@@ -149,4 +160,22 @@ inline Diagram::BorderOptions Diagram::borderOptions() {
|
||||
return(retour);
|
||||
}
|
||||
|
||||
/// @return la liste des elements a deplacer
|
||||
inline const QSet<Element *> &Diagram::elementsToMove() {
|
||||
if (!moved_elements_fetched) fetchMovedElements();
|
||||
return(elements_to_move);
|
||||
}
|
||||
|
||||
/// @return la liste des conducteurs a deplacer
|
||||
inline const QSet<Conducer *> &Diagram::conducersToMove() {
|
||||
if (!moved_elements_fetched) fetchMovedElements();
|
||||
return(conducers_to_move);
|
||||
}
|
||||
|
||||
/// @return la liste des conducteurs a modifier (typiquement les conducteurs dont seul un element est deplace)
|
||||
inline const QHash<Conducer *, Terminal *> &Diagram::conducersToUpdate() {
|
||||
if (!moved_elements_fetched) fetchMovedElements();
|
||||
return(conducers_to_update);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user