RGraphicsScene
Class in Core Module
Header: #include <src/core/RGraphicsScene.h>
Inherits: RExporter
Inherited by: RGraphicsSceneQt
Description
Section titled “Description”Abstract base class for all graphics scenes.
A graphics scene is an exporter that exports entities into something that can be shown in a view (painter paths, triangles, OpenGL lists, …).
Graphics scenes store a map of reference points of all entities that are currently selected. This information is stored at the scene level and not at the document interface level because a scene that shows for example a wall from the side may show different reference points than a scene that shows the same wall from the top.
Scriptable: This class is available in script environments.
Public Functions
Section titled “Public Functions”RGraphicsScene(RDocumentInterface &documentInterface) |
|
| virtual | ~RGraphicsScene() |
| virtual void | addPathToPreview(RObject::Id entityId, RPainterPath &pp) |
| virtual void | addToPreview(RObject::Id entityId, QList< RGraphicsSceneDrawable > &drawables) |
| virtual void | addToPreview(RObject::Id entityId, RGraphicsSceneDrawable &drawable) |
| void | beginNoColorMode() |
| virtual void | beginPreview() |
| virtual void | clear()Clears (resets) the scene contents. |
| virtual void | clearPreview()Clears the preview. |
| int | countReferencePoints() const |
| virtual void | dump() |
| void | endNoColorMode() |
| virtual void | endPreview() |
| virtual void | exportCurrentEntity(bool preview=false, bool forceSelected=false)The default implementation calls the REntity::exportEntity() function of the entity. |
| virtual bool | exportDocumentSettings()Override for performance reasons, we don’t need settings to be exported for graphics scenes. |
| RDocumentInterface & | getDocumentInterface() |
| QList< RGraphicsView * > | getGraphicsViews() const |
| RRefPoint | getHighlightedReferencePoint() |
| bool | getNoColorMode() const |
| QMap< RObject::Id, QList< RRefPoint > > & | getReferencePoints() |
| void | handleKeyPressEvent(QKeyEvent &event) |
| void | handleKeyReleaseEvent(QKeyEvent &event) |
| void | handleMouseDoubleClickEvent(RMouseEvent &event)Forwards the given mouse event to the document interface. |
| void | handleMouseMoveEvent(RMouseEvent &event)Forwards the given mouse event to the document interface. |
| void | handleMousePressEvent(RMouseEvent &event)Forwards the given mouse event to the document interface. |
| void | handleMouseReleaseEvent(RMouseEvent &event)Forwards the given mouse event to the document interface. |
| void | handlePanGestureEvent(QPanGesture &gesture)Forwards the given gesture to the document interface. |
| void | handlePinchGestureEvent(QPinchGesture &gesture)Forwards the given gesture to the document interface. |
| void | handleSwipeGestureEvent(QSwipeGesture &gesture)Forwards the given gesture to the document interface. |
| void | handleTabletEvent(RTabletEvent &event)Forwards the given tablet event to the document interface. |
| void | handleTerminateEvent(RTerminateEvent &event) |
| void | handleWheelEvent(RWheelEvent &event)Forwards the given mouse event to the document interface. |
| bool | hasHadViews() const |
| bool | hasSelectedReferencePoints() const |
| virtual void | highlightEntity(REntity &entity)=0 = 0Highlights the given entity. |
| virtual void | highlightReferencePoint(const RRefPoint &position)Highlights the reference point at the given position. |
| virtual bool | isPreviewEmpty() |
| virtual void | regenerate(bool undone=false, bool invisible=false)Regenerates this scene from the entity data by exporting the whole document into it. |
| virtual void | regenerate(QSet< RObject::Id > &affectedEntities, bool updateViews) |
| virtual void | regenerateViews(bool force=false)Regenerates all views attached to this scene. |
| virtual void | regenerateViews(QSet< RObject::Id > &affectedEntities) |
| virtual void | registerView(RGraphicsView *view, bool regen=true)Registers a view with this scene. |
| virtual void | repaintViews()Repaints all views attached to this scene. |
| virtual void | selectReferencePoints(const RBox &box, bool add) |
| virtual void | setCursor(const QCursor &cursor) |
| virtual void | translateEntities(QSet< RObject::Id > &affectedEntities, const RVector &offset)Translates the graphical representation of the given entities by the given offset. |
| virtual void | unexportEntity(RObject::Id entityId)This is called for entities for which an export was requested but which cannot be instantiated because they either do not exist (anymore) in the DB or they are currently undone. |
| virtual void | unregisterView(RGraphicsView *view)Removes the given view from this scene. |
| virtual void | updateSelectionStatus(QSet< RObject::Id > &affectedEntities, bool updateViews)Updates the selection status of the given entities. |
Static Public Functions
Section titled “Static Public Functions”| static bool | isHighlightEnabled(const REntity &entity) |
Protected Functions
Section titled “Protected Functions”| virtual void | exportReferencePoints()Adds the reference points of the entity that is currently being exported to the internal referencePoints map. |
Protected Attributes
Section titled “Protected Attributes”| bool | colorMode |
| RDocumentInterface & | documentInterface |
| bool | exportToPreview |
| RRefPoint | highlightedReferencePoint |
| bool | previewIsEmpty |
| QMap< RObject::Id, QList< RRefPoint > > | referencePoints Internal map of reference points for every selected entity in the scene. |
| QList< RGraphicsView * > | views |
Private Attributes
Section titled “Private Attributes”| bool | deleting |
| bool | hadViews |
Friends
Section titled “Friends”| QDebug | operator<<(QDebug dbg, RGraphicsScene &gs)Stream operator for QDebug. |
Member Documentation
Section titled “Member Documentation”RGraphicsScene
Section titled “RGraphicsScene”RGraphicsScene::RGraphicsScene(RDocumentInterface &documentInterface)All rights reserved.
This file is part of the QCAD project.
QCAD 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 3 of the License, or (at your option) any later version.
QCAD 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 QCAD.
~RGraphicsScene
Section titled “~RGraphicsScene”virtual RGraphicsScene::~RGraphicsScene()virtual
addPathToPreview
Section titled “addPathToPreview”virtual void RGraphicsScene::addPathToPreview(RObject::Id entityId, RPainterPath &pp)virtual inline
Reimplemented in addPathToPreview.
addToPreview
Section titled “addToPreview”virtual void RGraphicsScene::addToPreview(RObject::Id entityId, QList< RGraphicsSceneDrawable > &drawables)virtual inline
Reimplemented in addToPreview.
addToPreview
Section titled “addToPreview”virtual void RGraphicsScene::addToPreview(RObject::Id entityId, RGraphicsSceneDrawable &drawable)virtual inline
Reimplemented in addToPreview.
beginNoColorMode
Section titled “beginNoColorMode”void RGraphicsScene::beginNoColorMode()inline
beginPreview
Section titled “beginPreview”virtual void RGraphicsScene::beginPreview()virtual
virtual void RGraphicsScene::clear()virtual
Clears (resets) the scene contents.
Reimplemented in clear.
clearPreview
Section titled “clearPreview”virtual void RGraphicsScene::clearPreview()virtual
Clears the preview.
Reimplemented in clearPreview.
countReferencePoints
Section titled “countReferencePoints”int RGraphicsScene::countReferencePoints() constconst
virtual void RGraphicsScene::dump()virtual inline
Reimplemented in dump.
endNoColorMode
Section titled “endNoColorMode”void RGraphicsScene::endNoColorMode()inline
endPreview
Section titled “endPreview”virtual void RGraphicsScene::endPreview()virtual
exportCurrentEntity
Section titled “exportCurrentEntity”virtual void RGraphicsScene::exportCurrentEntity(bool preview=false, bool forceSelected=false)virtual
The default implementation calls the REntity::exportEntity() function of the entity.
This method may use the currentEntity stack to access the entity that is currently being exported. Exporters can choose to reimplement this function to export an entity in a target platform specific manner (e.g. to optimize things for a specific platform).
Reimplemented from exportCurrentEntity.
exportDocumentSettings
Section titled “exportDocumentSettings”virtual bool RGraphicsScene::exportDocumentSettings()virtual inline
Override for performance reasons, we don’t need settings to be exported for graphics scenes.
Reimplemented from exportDocumentSettings.
getDocumentInterface
Section titled “getDocumentInterface”RDocumentInterface & RGraphicsScene::getDocumentInterface()Returns: Document interface this scene is attached to.
getGraphicsViews
Section titled “getGraphicsViews”QList< RGraphicsView * > RGraphicsScene::getGraphicsViews() constconst
Returns: List of all views that are attached to this scene.
getHighlightedReferencePoint
Section titled “getHighlightedReferencePoint”RRefPoint RGraphicsScene::getHighlightedReferencePoint()getNoColorMode
Section titled “getNoColorMode”bool RGraphicsScene::getNoColorMode() constinline const
getReferencePoints
Section titled “getReferencePoints”QMap< RObject::Id, QList< RRefPoint > > & RGraphicsScene::getReferencePoints()inline
Non-Scriptable: This function is not available in script environments.
handleKeyPressEvent
Section titled “handleKeyPressEvent”void RGraphicsScene::handleKeyPressEvent(QKeyEvent &event)handleKeyReleaseEvent
Section titled “handleKeyReleaseEvent”void RGraphicsScene::handleKeyReleaseEvent(QKeyEvent &event)handleMouseDoubleClickEvent
Section titled “handleMouseDoubleClickEvent”void RGraphicsScene::handleMouseDoubleClickEvent(RMouseEvent &event)Forwards the given mouse event to the document interface.
handleMouseMoveEvent
Section titled “handleMouseMoveEvent”void RGraphicsScene::handleMouseMoveEvent(RMouseEvent &event)Forwards the given mouse event to the document interface.
handleMousePressEvent
Section titled “handleMousePressEvent”void RGraphicsScene::handleMousePressEvent(RMouseEvent &event)Forwards the given mouse event to the document interface.
handleMouseReleaseEvent
Section titled “handleMouseReleaseEvent”void RGraphicsScene::handleMouseReleaseEvent(RMouseEvent &event)Forwards the given mouse event to the document interface.
handlePanGestureEvent
Section titled “handlePanGestureEvent”void RGraphicsScene::handlePanGestureEvent(QPanGesture &gesture)Forwards the given gesture to the document interface.
handlePinchGestureEvent
Section titled “handlePinchGestureEvent”void RGraphicsScene::handlePinchGestureEvent(QPinchGesture &gesture)Forwards the given gesture to the document interface.
handleSwipeGestureEvent
Section titled “handleSwipeGestureEvent”void RGraphicsScene::handleSwipeGestureEvent(QSwipeGesture &gesture)Forwards the given gesture to the document interface.
handleTabletEvent
Section titled “handleTabletEvent”void RGraphicsScene::handleTabletEvent(RTabletEvent &event)Forwards the given tablet event to the document interface.
handleTerminateEvent
Section titled “handleTerminateEvent”void RGraphicsScene::handleTerminateEvent(RTerminateEvent &event)handleWheelEvent
Section titled “handleWheelEvent”void RGraphicsScene::handleWheelEvent(RWheelEvent &event)Forwards the given mouse event to the document interface.
hasHadViews
Section titled “hasHadViews”bool RGraphicsScene::hasHadViews() constinline const
Returns: True if at least one view has been registered with this scene since it was created. Together with an empty list of views this means that all views of this scene have been deleted and the scene is not used anymore.
See also: RDocumentInterface::deleteScenesWithoutViews
hasSelectedReferencePoints
Section titled “hasSelectedReferencePoints”bool RGraphicsScene::hasSelectedReferencePoints() constconst
highlightEntity
Section titled “highlightEntity”virtual void RGraphicsScene::highlightEntity(REntity &entity)=0 = 0pure virtual
Highlights the given entity.
This is typically used to highlight entities when the mouse hovers over them.
Reimplemented in highlightEntity.
highlightReferencePoint
Section titled “highlightReferencePoint”virtual void RGraphicsScene::highlightReferencePoint(const RRefPoint &position)virtual
Highlights the reference point at the given position.
This is typically used to highlight reference point when the mouse hovers over them.
isPreviewEmpty
Section titled “isPreviewEmpty”virtual bool RGraphicsScene::isPreviewEmpty()virtual
regenerate
Section titled “regenerate”virtual void RGraphicsScene::regenerate(bool undone=false, bool invisible=false)virtual
Regenerates this scene from the entity data by exporting the whole document into it.
This can for example regenerate all painter paths or all triangles of the scene. This is called if the scene changes fundamentally or when the entities that are affected by an update are not known.
regenerate
Section titled “regenerate”virtual void RGraphicsScene::regenerate(QSet< RObject::Id > &affectedEntities, bool updateViews)virtual
regenerateViews
Section titled “regenerateViews”virtual void RGraphicsScene::regenerateViews(bool force=false)virtual
Regenerates all views attached to this scene.
regenerateViews
Section titled “regenerateViews”virtual void RGraphicsScene::regenerateViews(QSet< RObject::Id > &affectedEntities)virtual
registerView
Section titled “registerView”virtual void RGraphicsScene::registerView(RGraphicsView *view, bool regen=true)virtual
Registers a view with this scene.
repaintViews
Section titled “repaintViews”virtual void RGraphicsScene::repaintViews()virtual
Repaints all views attached to this scene.
selectReferencePoints
Section titled “selectReferencePoints”virtual void RGraphicsScene::selectReferencePoints(const RBox &box, bool add)virtual
setCursor
Section titled “setCursor”virtual void RGraphicsScene::setCursor(const QCursor &cursor)virtual
translateEntities
Section titled “translateEntities”virtual void RGraphicsScene::translateEntities(QSet< RObject::Id > &affectedEntities, const RVector &offset)virtual
Translates the graphical representation of the given entities by the given offset.
The default implementation regenerates the entities. Scenes that cache the graphical representation of entities may override this for performance reasons.
The default implementation exports the entities again (regenerate).
Reimplemented in translateEntities.
unexportEntity
Section titled “unexportEntity”virtual void RGraphicsScene::unexportEntity(RObject::Id entityId)virtual
This is called for entities for which an export was requested but which cannot be instantiated because they either do not exist (anymore) in the DB or they are currently undone.
Reimplemented from unexportEntity.
Reimplemented in unexportEntity.
unregisterView
Section titled “unregisterView”virtual void RGraphicsScene::unregisterView(RGraphicsView *view)virtual
Removes the given view from this scene.
updateSelectionStatus
Section titled “updateSelectionStatus”virtual void RGraphicsScene::updateSelectionStatus(QSet< RObject::Id > &affectedEntities, bool updateViews)virtual
Updates the selection status of the given entities.
The default implementation exports the entities again. May be overridden for performance reasons.
Reimplemented in updateSelectionStatus.
isHighlightEnabled
Section titled “isHighlightEnabled”static bool RGraphicsScene::isHighlightEnabled(const REntity &entity)static
Returns: True if the given entity is highlighted when the mouse hovers over it according to the preferences: images and hatches only if enabled (GraphicsView/HighlightImage, GraphicsView/HighlightHatch, default off). Used by the implementations of highlightEntity, which may ignore it (e.g. scenes that highlight entities with a halo).
exportReferencePoints
Section titled “exportReferencePoints”virtual void RGraphicsScene::exportReferencePoints()virtual protected
Adds the reference points of the entity that is currently being exported to the internal referencePoints map.
colorMode
Section titled “colorMode”bool RGraphicsScene::colorModeprotected
documentInterface
Section titled “documentInterface”RDocumentInterface& RGraphicsScene::documentInterfaceprotected
exportToPreview
Section titled “exportToPreview”bool RGraphicsScene::exportToPreviewprotected
highlightedReferencePoint
Section titled “highlightedReferencePoint”RRefPoint RGraphicsScene::highlightedReferencePointprotected
previewIsEmpty
Section titled “previewIsEmpty”bool RGraphicsScene::previewIsEmptyprotected
referencePoints
Section titled “referencePoints”QMap<RObject::Id, QList<RRefPoint> > RGraphicsScene::referencePointsprotected
Internal map of reference points for every selected entity in the scene.
Used for drawing reference points.
QList<RGraphicsView*> RGraphicsScene::viewsprotected
deleting
Section titled “deleting”bool RGraphicsScene::deletingprivate
hadViews
Section titled “hadViews”bool RGraphicsScene::hadViewsprivate
operator<<
Section titled “operator<<”QDebug operator<<(QDebug dbg, RGraphicsScene &gs)Stream operator for QDebug.
Non-Scriptable: This function is not available in script environments.