API Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
VisibleCommand.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/DesignCommand.h>
4#include <NDEVR/DesignObjectLookup.h>
5#include <NDEVR/TranslatedString.h>
6#include <NDEVR/Translator.h>
7namespace NDEVR
8{
10 {
11 public:
16 virtual void execute(DesignObjectLookup* lookup) override
17 {
18 WLock lock(lookup->lockPtr());
19 if (is_undo)
20 {
21 for (const UUID& toggle_id : m_models_to_toggle)
22 {
23 Model model = lookup->modelOrLayer(toggle_id);
24 if(model.isValid())
26 }
27 }
28 else
29 {
30 m_models_to_toggle.clear();
31 for (UUID target_id : targets)
32 {
33 Model model = lookup->model(target_id);
34 while (model.isValid())
35 {
36 if (model.isVisible() == m_make_visible)
37 break;
39 {
41 m_models_to_toggle.add(model.uuid());
42 }
43 if (!m_make_visible)
44 break;
45 if (model.hasDirectLayer())
46 {
47 Model layer = model.getLayer();
49 {
51 m_models_to_toggle.add(layer.uuid());
52 }
53 }
54 model = model.getParent();
55 }
56 }
57 }
58 }
59 String icon() const override
60 {
62 return "visible";
63 else
64 return "invisible";
65 }
66 TranslatedString name() const override
67 {
69 return _t("Visible");
70 else
71 return _t("Invisible");
72 }
73 protected:
76 };
77}
#define _t(english_string)
Definition Translator.h:87
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition DesignCommand.h:46
bool is_undo
Definition DesignCommand.h:65
Buffer< UUID > targets
Definition DesignCommand.h:62
bool isValid() const
Definition DesignObject.h:362
UUID uuid() const
Definition DesignObject.cpp:533
t_type getProperty(DesignProperty property) const
Definition DesignObject.h:263
@ e_3D_visible
Definition DesignObject.h:110
Definition DesignObjectLookup.h:61
Model modelOrLayer(const UUID &id, bool allow_deleted=false) const
Definition DesignObjectLookup.cpp:1674
const void * lockPtr() const
Definition DesignObjectLookup.cpp:1027
Model model(const UUID &id, bool allow_deleted=false) const
Definition DesignObjectLookup.cpp:1683
Definition Model.h:54
bool hasDirectLayer() const
Definition Model.cpp:2338
Model getParent() const
Definition Model.cpp:2057
bool isVisible() const
Definition Model.cpp:1149
Model getLayer() const
Definition Model.cpp:2342
void updateVisible(bool is_visible)
Definition Model.cpp:751
Definition String.h:40
Definition TranslatedString.h:9
Definition UUID.h:66
Definition VisibleCommand.h:10
virtual void execute(DesignObjectLookup *lookup) override
Definition VisibleCommand.h:16
TranslatedString name() const override
Definition VisibleCommand.h:66
VisibleCommand(bool make_visible)
Definition VisibleCommand.h:12
Buffer< UUID > m_models_to_toggle
Definition VisibleCommand.h:74
bool m_make_visible
Definition VisibleCommand.h:75
String icon() const override
Definition VisibleCommand.h:59
Definition RWLock.h:99
Definition ACIColor.h:37
QAction * make_visible(nullptr)