[4] | 1 | #include "DefaultEmptySceneContent.h" |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | const QString DefaultEmptySceneContent::g_scene_name=QObject::tr("Empty"); |
---|
| 5 | |
---|
| 6 | |
---|
| 7 | /** |
---|
| 8 | * Default constructor |
---|
| 9 | * |
---|
| 10 | */ |
---|
| 11 | DefaultEmptySceneContent::DefaultEmptySceneContent(SceneInterface* plugin): |
---|
| 12 | SceneContent(plugin) |
---|
| 13 | { |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | /** |
---|
| 18 | * Destructor. |
---|
| 19 | * |
---|
| 20 | */ |
---|
| 21 | DefaultEmptySceneContent::~DefaultEmptySceneContent() |
---|
| 22 | { |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | /** |
---|
| 27 | * Implements the copy from other contents. |
---|
| 28 | * |
---|
| 29 | * This method is used by the copy constructor. |
---|
| 30 | * For the empty scene contents, it does nothing. |
---|
| 31 | * |
---|
| 32 | * @param content The source content to copy from. |
---|
| 33 | * |
---|
| 34 | * @return true if the copy is ok, false otherwise. The copy can fail if |
---|
| 35 | * SceneContent is not a DefaultEmptySceneContent. |
---|
| 36 | * |
---|
| 37 | * @seealso is_equal_to |
---|
| 38 | * |
---|
| 39 | */ |
---|
| 40 | bool DefaultEmptySceneContent::copy_from(const SceneContent& data) |
---|
| 41 | { |
---|
| 42 | if (!SceneContent::copy_from(data)) return false; |
---|
| 43 | Q_ASSERT(NULL!=plugin()); |
---|
| 44 | Q_ASSERT(NULL!=data.plugin()); |
---|
| 45 | return true; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | /** |
---|
| 50 | * Implements the egality-test with other contents. |
---|
| 51 | * |
---|
| 52 | * This could be an operator==. For the empty scene content, the test is not |
---|
| 53 | * difficult. |
---|
| 54 | * |
---|
| 55 | * @param content The content to compare with. |
---|
| 56 | * |
---|
| 57 | * @return true if the content are equal, false otherwise. The test can |
---|
| 58 | * fail if the contents have different parameters, but also it |
---|
| 59 | * SceneContent is not a DefaultEmptySceneContent. |
---|
| 60 | * |
---|
| 61 | * @seealso copy_from |
---|
| 62 | * |
---|
| 63 | */ |
---|
| 64 | bool DefaultEmptySceneContent::is_equal_to(const SceneContent& data) const |
---|
| 65 | { |
---|
| 66 | if (!SceneContent::is_equal_to(data)) return false; |
---|
| 67 | return true; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | |
---|
| 71 | /** |
---|
| 72 | * Draws the empty scene. |
---|
| 73 | * |
---|
| 74 | * @param glWidget The QGLWidget that own the OpenGL context. |
---|
| 75 | * @param cameraMatrix The camera matrix that must be use. |
---|
| 76 | * |
---|
| 77 | */ |
---|
| 78 | void DefaultEmptySceneContent::draw(QGLWidget *glWidget, const float* cameraMatrix) |
---|
| 79 | { |
---|
| 80 | Q_UNUSED (glWidget); |
---|
| 81 | Q_UNUSED(cameraMatrix); |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | /** |
---|
| 86 | * Loads the empty scene from a QDomElement. |
---|
| 87 | * |
---|
| 88 | * This is implemented for convenience, but it does nothing. |
---|
| 89 | * |
---|
| 90 | * @param element The QDomElement to read from. |
---|
| 91 | * |
---|
| 92 | */ |
---|
| 93 | void DefaultEmptySceneContent::initFromDOMElement(const QDomElement& element) |
---|
| 94 | { |
---|
| 95 | if (!element.isNull()) |
---|
| 96 | { |
---|
| 97 | SceneContent::initFromDOMElement(element); |
---|
| 98 | } |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | /** |
---|
| 103 | * Writes the empty scene in a QDomDocument. |
---|
| 104 | * |
---|
| 105 | * This is implemented for convenience, but it does nothing. |
---|
| 106 | * |
---|
| 107 | * @param name The name of the element. |
---|
| 108 | * @param doc The document whom belongs the element. |
---|
| 109 | * |
---|
| 110 | * @return The QDomElement to add. |
---|
| 111 | * |
---|
| 112 | */ |
---|
| 113 | QDomElement DefaultEmptySceneContent::domElement(const QString& name, QDomDocument& doc) const |
---|
| 114 | { |
---|
| 115 | QDomElement de = SceneContent::domElement(name, doc); |
---|
| 116 | return de; |
---|
| 117 | } |
---|