Class representing the scene. This scene is child of QGraphicsScene, part of Graphics View Framework. The scene is not drawn, but the items that are inserted into it. She is responsible for managing items QGraphicsItem and know when and how to redrawing them. The scene has a coordinate system that is, by default, the same for all items that are inserted. The coordinate system of this representation is millimeters and your point 0.0 is in the bottom left(Cartesian coordinate system). The default settings of the layout module are in the object Context (singleton). More...
#include <Scene.h>
Public Slots | |
virtual void | onChangeZoomFactor (double currentFactor) |
It is called immediately when the zoom factor is changed in the Context. More... | |
Signals | |
void | addItemFinalized () |
Issued after insertion of an item in the scene. More... | |
void | deleteFinalized (std::vector< std::string > names) |
Issued after deleting an item in the scene. More... | |
Public Member Functions | |
virtual bool | addItemStackWithoutScene (QGraphicsItem *item) |
virtual void | addUndoStack (QUndoCommand *command) |
Method that insert command Undo/Redo of type AddCommand in the Undo/Redo stack. More... | |
virtual bool | buildTemplate (VisualizationArea *vzArea, EnumType *type, std::string fileName) |
Method that import a template and build all objects. Ex.: JSON. More... | |
virtual void | calculateSceneMeasures (double widthMM, double heightMM) |
Method that resets the scene and calculates again. More... | |
virtual QGraphicsItem * | createItem (const te::gm::Coord2D &coord) |
Method that create a graphic object and place it in the scene. A name and a position is added. A command Undo/Redo of type AddCommand is created. More... | |
virtual QGraphicsItemGroup * | createItemGroup (const QList< QGraphicsItem * > &items) |
Groups objects and creates a QGraphicsItemGroup object. A command Undo/Redo of type AddCommand is created. More... | |
virtual te::layout::MovingItemGroup * | createMovingItemGroup (const QList< QGraphicsItem * > &items) |
virtual void | deleteItems () |
Method that deletes all selected items in the scene. More... | |
virtual void | destroyItemGroup (QGraphicsItemGroup *group) |
Method that delete object grouping, but the individual objects continue to exist. More... | |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
Reimplemented from QGraphicsScene. More... | |
virtual void | exportItemsToImage (std::string dir) |
Saves each item in the scene as image. Ex .: .png. More... | |
virtual bool | exportPropertiesToTemplate (EnumType *type, std::string fileName) |
Method that exports all the objects in the scene to a template. Ex.: JSON. More... | |
virtual AlignItems * | getAlignItems () |
Method that returns the object responsible for aligning objects in the scene. More... | |
virtual PrintScene * | getPrintScene () |
Method that returns the object responsible for printing the scene. More... | |
virtual te::gm::Envelope | getSceneBox () |
Method that return the scene box. More... | |
virtual QUndoStack * | getUndoStack () |
Method that return stack of Undo/Redo. More... | |
virtual int | getUndoStackLimit () |
Method that returns the size limit of the stack Undo/Redo. More... | |
virtual std::vector< te::layout::Properties * > | importTemplateToProperties (EnumType *type, std::string fileName) |
Method that imports a template and turns it into properties. Ex.: JSON. More... | |
virtual void | init (double screenWMM, double screenHMM) |
Method that starts the scene and configures. Calculates the transformation matrix of the scene and calculates the ratio of the size of the scene with the paper size. More... | |
virtual void | insertItem (ItemObserver *item) |
Method that inserts a graphic object in the scene. Inverts the matrix of the object if necessary, ex.: TextItem. More... | |
virtual void | insertItem (QGraphicsItem *item) |
Method that inserts a graphic object in the scene. Inverts the matrix of the object if necessary, ex.: TextItem. More... | |
virtual void | redrawItems () |
virtual void | redrawSelectionMap () |
Redraws the Layer of the selected map. More... | |
virtual bool | removeItemStackWithoutScene (QGraphicsItem *item) |
virtual void | removeSelectedItems () |
Method that removes all selected items in the scene and creates a Command to Undo/Redo of type DeleteCommand. The item is removed from the scene, but is not deleted. More... | |
virtual void | reset () |
Method that clears the scene and the stack of Undo/Redo. More... | |
Scene (QObject *object=(QObject *) 0) | |
Constructor. More... | |
Scene (AlignItems *align, PrintScene *print, QObject *object=0) | |
Constructor. The ownership of objects passed via parameter becomes the scene. More... | |
virtual QTransform | sceneTransform () |
Method that returns the matrix transformation scene. More... | |
virtual void | selectItem (std::string name) |
Select an item an item by name. More... | |
virtual void | selectItem (QGraphicsItem *item) |
Select specified item. More... | |
virtual void | selectItems (std::vector< std::string > names) |
Select items by name. More... | |
virtual void | selectItems (QList< QGraphicsItem * > items) |
Select items. More... | |
virtual void | setUndoStackLimit (int limit) |
Method that limits the size of the stack of Undo/Redo. More... | |
virtual void | updateSelectedItemsPositions () |
virtual | ~Scene () |
Destructor. More... | |
Protected Member Functions | |
virtual void | calculateMatrixViewScene () |
Method that calculates the transformation matrix of the scene. This matrix will be set in each QGraphicsView class that watches this scene. More... | |
virtual void | calculateWindow (double wMM, double hMM) |
Method that calculates the ratio of the size of the scene with the paper size. This calculation is necessary so that the paper always is centered in the scene. More... | |
virtual std::vector< te::layout::Properties * > | getItemsProperties () |
Method that returns a list of the properties of all the graphic objects in the scene. More... | |
Protected Attributes | |
AlignItems * | m_align |
object responsible for aligning objects in the scene. More... | |
QColor | m_backgroundColor |
background color that is applied to each observer(QGraphicsView) of the scene. More... | |
te::gm::Envelope | m_box |
scene box. More... | |
QList< QGraphicsItem * > | m_itemStackWithoutScene |
Items that are not included in any scene. More... | |
QTransform | m_matrix |
transformation matrix of the scene. More... | |
bool | m_moveWatched |
std::map< QGraphicsItem *, QPointF > | m_moveWatches |
PrintScene * | m_print |
object responsible for printing the scene. More... | |
QUndoStack * | m_undoStack |
Undo/Redo stack. More... | |
int | m_undoStackLimit |
Undo/Redo limit size. More... | |
Class representing the scene. This scene is child of QGraphicsScene, part of Graphics View Framework. The scene is not drawn, but the items that are inserted into it. She is responsible for managing items QGraphicsItem and know when and how to redrawing them. The scene has a coordinate system that is, by default, the same for all items that are inserted. The coordinate system of this representation is millimeters and your point 0.0 is in the bottom left(Cartesian coordinate system). The default settings of the layout module are in the object Context (singleton).
te::layout::Scene::Scene | ( | QObject * | object = (QObject*)0 | ) |
Constructor.
Definition at line 61 of file Scene.cpp.
References m_backgroundColor, and m_undoStack.
te::layout::Scene::Scene | ( | AlignItems * | align, |
PrintScene * | print, | ||
QObject * | object = 0 |
||
) |
|
signal |
Issued after insertion of an item in the scene.
|
virtual |
Definition at line 810 of file Scene.cpp.
Referenced by te::layout::DeleteCommand::redo(), and te::layout::AddCommand::undo().
|
virtual |
Method that insert command Undo/Redo of type AddCommand in the Undo/Redo stack.
command | command |
Definition at line 313 of file Scene.cpp.
Referenced by te::layout::MenuBuilder::changePropertyValue(), te::layout::TextItem::resetEdit(), te::layout::PropertiesOutside::sendPropertyToSelectedItem(), and te::layout::PropertiesOutside::sendPropertyToSelectedItems().
|
virtual |
Method that import a template and build all objects. Ex.: JSON.
type | type of template. Ex .: JSON type |
fileName | Full path where the template is saved. |
Definition at line 545 of file Scene.cpp.
References te::layout::VisualizationArea::changeBoxArea(), te::layout::Context::getAbstractBuildGraphicsItem(), te::common::Singleton< Context >::getInstance(), and te::layout::BuildGraphicsItem::rebuildItem().
Referenced by te::layout::View::importTemplate().
|
protectedvirtual |
Method that calculates the transformation matrix of the scene. This matrix will be set in each QGraphicsView class that watches this scene.
Implements te::layout::AbstractScene.
Definition at line 196 of file Scene.cpp.
References te::layout::Context::getDpiX(), and te::common::Singleton< Context >::getInstance().
|
virtual |
|
protectedvirtual |
Method that calculates the ratio of the size of the scene with the paper size. This calculation is necessary so that the paper always is centered in the scene.
wMM | width of physical screen in millimeters |
hMM | height of physical screen in millimeters |
Implements te::layout::AbstractScene.
Definition at line 213 of file Scene.cpp.
References te::common::Singleton< Context >::getInstance(), te::layout::Context::getPaperConfig(), and te::layout::PaperConfig::getPaperSize().
|
virtual |
Method that create a graphic object and place it in the scene. A name and a position is added. A command Undo/Redo of type AddCommand is created.
coord | Coordinated where the item is located. The coordinate should be the same scene coordinates system |
Definition at line 408 of file Scene.cpp.
References te::layout::BuildGraphicsItem::createItem(), te::layout::Context::getAbstractBuildGraphicsItem(), te::layout::Enums::getEnumModeType(), te::common::Singleton< Context >::getInstance(), te::common::Singleton< Enums >::getInstance(), te::layout::Context::getMode(), te::layout::EnumModeType::getModeNone(), te::layout::ItemObserver::isCanChangeGraphicOrder(), and te::layout::Context::setMode().
Referenced by te::layout::ItemUtils::createLegendChildItemFromLegend(), and te::layout::ItemUtils::createTextItemFromObject().
|
virtual |
Groups objects and creates a QGraphicsItemGroup object. A command Undo/Redo of type AddCommand is created.
list | of objects |
Definition at line 333 of file Scene.cpp.
References te::layout::ItemGroup::addToGroup(), te::layout::BuildGraphicsItem::createItem(), te::layout::Context::getAbstractBuildGraphicsItem(), te::layout::Enums::getEnumModeType(), te::common::Singleton< Enums >::getInstance(), te::common::Singleton< Context >::getInstance(), and te::layout::EnumModeType::getModeCreateItemGroup().
Referenced by te::layout::View::createItemGroup().
|
virtual |
Definition at line 381 of file Scene.cpp.
References te::layout::ItemGroup::addToGroup(), te::layout::BuildGraphicsItem::createItem(), te::layout::Context::getAbstractBuildGraphicsItem(), te::layout::Enums::getEnumObjectType(), te::common::Singleton< Context >::getInstance(), te::common::Singleton< Enums >::getInstance(), and te::layout::EnumObjectType::getMovingItemGroup().
|
signal |
Issued after deleting an item in the scene.
names | names of items removed |
|
virtual |
Method that deletes all selected items in the scene.
Definition at line 256 of file Scene.cpp.
References te::layout::ItemObserver::getModel(), and te::layout::Observable::getName().
|
virtual |
Method that delete object grouping, but the individual objects continue to exist.
group | list of objects |
Definition at line 375 of file Scene.cpp.
Referenced by te::layout::View::destroyItemGroup(), and te::layout::View::mouseReleaseEvent().
|
virtual |
|
virtual |
Saves each item in the scene as image. Ex .: .png.
dir | Full path where the images will be saved |
Definition at line 598 of file Scene.cpp.
References te::common::Free(), te::qt::widgets::GetImage(), te::layout::ItemObserver::getModel(), te::layout::Observable::getName(), and te::layout::ItemObserver::getRGBAColorImage().
Referenced by te::layout::View::exportItemsToImage().
|
virtual |
Method that exports all the objects in the scene to a template. Ex.: JSON.
type | type of template. Ex .: JSON type |
fileName | Full path where the template is saved. |
Definition at line 463 of file Scene.cpp.
References te::layout::AbstractTemplate::exportTemplate(), and te::layout::TemplateEditor::getTemplate().
Referenced by te::layout::View::exportProperties().
|
virtual |
Method that returns the object responsible for aligning objects in the scene.
Definition at line 458 of file Scene.cpp.
Referenced by te::layout::View::outsideAreaChangeContext().
|
protectedvirtual |
Method that returns a list of the properties of all the graphic objects in the scene.
Definition at line 510 of file Scene.cpp.
References te::layout::ItemObserver::getModel(), te::layout::Observable::getProperties(), and te::layout::ItemObserver::isPrintable().
|
virtual |
Method that returns the object responsible for printing the scene.
Definition at line 453 of file Scene.cpp.
Referenced by te::layout::View::exportToPDF(), and te::layout::View::print().
|
virtualinherited |
Method that return the scene box.
graphic | object |
Definition at line 36 of file AbstractScene.cpp.
Referenced by te::layout::View::config(), te::layout::View::createImage(), te::layout::BuildContext::createLayoutContext(), te::layout::View::onChangeConfig(), and te::layout::View::resetView().
|
virtual |
Method that return stack of Undo/Redo.
Definition at line 328 of file Scene.cpp.
Referenced by te::layout::ToolbarOutside::createUndoToolButton(), and te::layout::MoveCommand::redo().
|
virtual |
|
virtual |
Method that imports a template and turns it into properties. Ex.: JSON.
type | type of template. Ex .: JSON type |
fileName | Full path where the template is saved |
Definition at line 489 of file Scene.cpp.
References te::layout::TemplateEditor::getTemplate(), and te::layout::AbstractTemplate::importTemplate().
|
virtual |
Method that starts the scene and configures. Calculates the transformation matrix of the scene and calculates the ratio of the size of the scene with the paper size.
screenWMM | width of physical screen in millimeters |
screenHMM | height of physical screen in millimeters |
Implements te::layout::AbstractScene.
Definition at line 177 of file Scene.cpp.
References te::common::Singleton< Context >::getInstance(), and te::layout::Context::getPaperConfig().
Referenced by te::layout::View::config().
|
virtual |
Method that inserts a graphic object in the scene. Inverts the matrix of the object if necessary, ex.: TextItem.
item | graphic object |
Implements te::layout::AbstractScene.
Definition at line 116 of file Scene.cpp.
Referenced by te::layout::AddCommand::redo(), and te::layout::DeleteCommand::undo().
|
virtual |
Method that inserts a graphic object in the scene. Inverts the matrix of the object if necessary, ex.: TextItem.
item | graphic object |
Definition at line 128 of file Scene.cpp.
References te::layout::ItemObserver::isInvertedMatrix(), and te::layout::ItemObserver::refresh().
|
virtualslot |
It is called immediately when the zoom factor is changed in the Context.
currentZoomFactor | current zoom factor of the layout module |
Definition at line 794 of file Scene.cpp.
References te::layout::ItemObserver::changeZoomFactor().
Referenced by te::layout::PrintScene::printPaper().
|
virtual |
Definition at line 759 of file Scene.cpp.
References te::layout::ItemObserver::isPrintable(), and te::layout::ItemObserver::redraw().
Referenced by te::layout::PrintScene::printPreview().
|
virtual |
Redraws the Layer of the selected map.
Definition at line 578 of file Scene.cpp.
References te::layout::ItemObserver::redraw().
Referenced by te::layout::View::outsideAreaChangeContext().
|
virtual |
Definition at line 832 of file Scene.cpp.
Referenced by te::layout::AddCommand::redo(), and te::layout::DeleteCommand::undo().
|
virtual |
Method that removes all selected items in the scene and creates a Command to Undo/Redo of type DeleteCommand. The item is removed from the scene, but is not deleted.
Definition at line 284 of file Scene.cpp.
References te::layout::ItemObserver::getModel(), and te::layout::Observable::getName().
Referenced by te::layout::View::keyPressEvent(), and te::layout::View::outsideAreaChangeContext().
|
virtual |
Method that clears the scene and the stack of Undo/Redo.
Definition at line 534 of file Scene.cpp.
Referenced by te::layout::View::onChangeConfig(), and te::layout::View::outsideAreaChangeContext().
|
virtual |
Method that returns the matrix transformation scene.
Definition at line 251 of file Scene.cpp.
Referenced by te::layout::View::config(), te::layout::View::resetView(), and te::layout::View::zoomPercentage().
|
virtual |
Select an item an item by name.
name | graphic object name |
Definition at line 707 of file Scene.cpp.
References te::layout::ItemObserver::getModel(), and te::layout::Observable::getName().
Referenced by te::layout::View::onSelectionItem().
|
virtual |
|
virtual |
Select items by name.
names | vector with object names |
Definition at line 743 of file Scene.cpp.
Referenced by te::layout::View::mouseReleaseEvent().
|
virtual |
|
virtual |
|
virtual |
Definition at line 778 of file Scene.cpp.
References te::layout::ItemObserver::refresh().
Referenced by te::layout::View::mouseReleaseEvent().
|
protected |
|
protected |
|
protectedinherited |
scene box.
Definition at line 101 of file AbstractScene.h.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |