All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
te::layout::View Class Reference

Class representing the view. This view is child of QGraphicsView, part of Graphics View Framework. The View object is a widget where the items in the scene are drawn. It is responsible for presentation and interaction between the screen events and the scene. Manages interactive functions and intercepts all mouse or keyboard events. The coordinate system of this representation is pixel and your point 0.0 is in the top left(Screen coordinate system). The default settings of the layout module are in the object Context (singleton). More...

#include <View.h>

Inheritance diagram for te::layout::View:
te::layout::AbstractView

Public Slots

virtual void onChangeConfig ()
 Notifies View object that some configuration was modified in the Page Settings Window. More...
 
virtual void onMainMenuChangeContext (bool change)
 Notifies View object that some action on the Menu has been thrown. More...
 
virtual void onSelectionChanged ()
 Notifies View object that the selection of objects in the scene changed. More...
 
virtual void onSelectionItem (std::string name)
 
virtual void onSystematicApply (double scale, SystematicScaleType type)
 
virtual void onToolbarChangeContext (bool change)
 Notifies View object that some action on the toolbar has been thrown. More...
 

Signals

void changeContext ()
 This signal is emitted when context change. More...
 
void changeSceneCoordMouse (QPointF pos)
 This signal is emitted when the mouse move changed. More...
 
void changeZoom (double currentFactor)
 This signal is emitted when View object changes the zoom factor internally. More...
 
void closeView ()
 This signal is emitted when close View object. More...
 
void hideView ()
 This signal is emitted when hide View object. More...
 
void reloadProperties ()
 This signal is emitted when selection change and mouse release. More...
 
void showView ()
 This signal is emitted when show View object. More...
 

Public Member Functions

virtual void addZoomFactor (double factor, std::string text)
 Method that adds new zoom factor. Ex.: 0.5 - 50%. More...
 
virtual void changeZoomFactor (double currentZoom)
 Method that change rulers visibility state. More...
 
virtual void clearZoomFactors ()
 Method that clears the zoom factor list. More...
 
virtual void closeOutsideWindows ()
 Close all windows that have been instantiated by this View. Ex .: Page Settings. More...
 
virtual void config ()
 Initialization method that configures the View and sets the transformation matrix of the scene in the View object. More...
 
virtual QImage createImage ()
 Create snapshot of the View current state. More...
 
virtual void exportToPDF ()
 Method that sets View object for the Print function. More...
 
virtual bool isVisibleRulers ()
 Method that return rulers visibility state. More...
 
virtual double nextFactor (double currentFactor)
 Method that returns the next zoom factor in the list. More...
 
virtual void pan ()
 Method that sets View object for the Pan function. More...
 
virtual double previousFactor (double currentFactor)
 Method that returns the previous zoom factor in the list. More...
 
virtual void print ()
 Method that sets View object for the Print function. More...
 
virtual void recompose ()
 Reset to initial configuration made in the config() method. Reset to default zoom factor. More...
 
virtual void resetView ()
 Reset to initial configuration made in the config() method. More...
 
virtual void setVisibleRulers (bool visible)
 Method that change rulers visibility state. More...
 
 View (QWidget *widget=(QWidget *) 0)
 Constructor. More...
 
virtual void zoomArea ()
 Method that sets View object for the Zoom Area function. More...
 
virtual void zoomOut ()
 Method that sets View object for the Zoom Out function. More...
 
virtual void zoomPercentage ()
 Method that applies current zoom defined in the Context. More...
 
virtual ~View ()
 Destructor. More...
 

Protected Member Functions

virtual void closeEvent (QCloseEvent *event)
 Reimplemented from QGraphicsView. More...
 
virtual void contextMenuEvent (QContextMenuEvent *event)
 Reimplemented from QGraphicsView. More...
 
virtual QCursor createCursor (std::string pathIcon)
 
virtual void createItemGroup ()
 Groups selected objects. More...
 
virtual void destroyItemGroup ()
 Method that delete Grouping object selected, but the individual objects continue to exist. More...
 
virtual void drawForeground (QPainter *painter, const QRectF &rect)
 Reimplemented from QGraphicsView. More...
 
virtual void exportItemsToImage ()
 Saves each item in the scene as image. Ex .: .png. More...
 
virtual bool exportProperties (EnumType *type)
 Method that exports all the objects in the scene to a template. Ex.: JSON. More...
 
virtual void hideEvent (QHideEvent *event)
 Reimplemented from QGraphicsView. More...
 
virtual bool importTemplate (EnumType *type)
 Method that import a template and build all objects. Ex.: JSON. More...
 
virtual bool isExceededLimit (double currentScale, double factor, double oldFactor)
 
virtual void keyPressEvent (QKeyEvent *keyEvent)
 Reimplemented from QGraphicsView. More...
 
virtual void mouseMoveEvent (QMouseEvent *event)
 Reimplemented from QGraphicsView. More...
 
virtual void mousePressEvent (QMouseEvent *event)
 Reimplemented from QGraphicsView. Call method createItem() of the scene. More...
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 Reimplemented from QGraphicsView. More...
 
virtual void outsideAreaChangeContext (bool change)
 Responsible method for verifying changes made in Context outside the View object and call corresponding actions. Ex.: Action Pan called in toolbar changed Context to Pan mode, then View object call method to do it. More...
 
virtual void resetDefaultConfig ()
 
virtual void resizeEvent (QResizeEvent *event)
 Reimplemented from QGraphicsView. More...
 
virtual void showEvent (QShowEvent *event)
 Reimplemented from QGraphicsView. More...
 
virtual void showPageSetup ()
 Method that instantiates and shows the Page Setup window. More...
 
virtual void showSystematicScale ()
 
virtual void wheelEvent (QWheelEvent *event)
 Reimplemented from QGraphicsView. More...
 

Protected Attributes

te::gm::Coord2D m_coordSystematic
 
AbstractViewToolm_currentTool
 
bool m_flag
 
double m_height
 
HorizontalRulerm_horizontalRuler
 
bool m_isMoving
 
double m_maxZoomLimit
 
MenuBuilderm_menuBuilder
 
double m_minZoomLimit
 
te::layout::MovingItemGroupm_movingItemGroup
 
EnumTypem_oldMode
 
PageSetupOutsidem_pageSetupOutside
 
bool m_selectionChange
 
SystematicScaleOutsidem_systematicOutside
 
bool m_updateItemPos
 
VerticalRulerm_verticalRuler
 
bool m_visibleRulers
 rulers visibility state More...
 
VisualizationAream_visualizationArea
 
WaitViewm_wait
 
double m_width
 
std::map< double, std::string > m_zoomFactors
 zoom factor list More...
 

Detailed Description

Class representing the view. This view is child of QGraphicsView, part of Graphics View Framework. The View object is a widget where the items in the scene are drawn. It is responsible for presentation and interaction between the screen events and the scene. Manages interactive functions and intercepts all mouse or keyboard events. The coordinate system of this representation is pixel and your point 0.0 is in the top left(Screen coordinate system). The default settings of the layout module are in the object Context (singleton).

See also
te::layout::AbstractView

Definition at line 89 of file View.h.

Constructor & Destructor Documentation

te::layout::View::View ( QWidget *  widget = (QWidget*)0)

Constructor.

Definition at line 61 of file View.cpp.

References te::common::Singleton< Enums >::getInstance(), m_horizontalRuler, m_oldMode, m_verticalRuler, and m_wait.

te::layout::View::~View ( )
virtual

Destructor.

Definition at line 92 of file View.cpp.

Member Function Documentation

void te::layout::AbstractView::addZoomFactor ( double  factor,
std::string  text 
)
virtualinherited

Method that adds new zoom factor. Ex.: 0.5 - 50%.

Parameters
factorfactor
textpercentage

Definition at line 53 of file AbstractView.cpp.

void te::layout::View::changeContext ( )
signal

This signal is emitted when context change.

void te::layout::View::changeSceneCoordMouse ( QPointF  pos)
signal

This signal is emitted when the mouse move changed.

Parameters
poscurrent position
void te::layout::View::changeZoom ( double  currentFactor)
signal

This signal is emitted when View object changes the zoom factor internally.

void te::layout::View::changeZoomFactor ( double  currentZoom)
virtual

Method that change rulers visibility state.

Parameters
visiblevisibility state

Definition at line 1076 of file View.cpp.

References te::common::Singleton< Context >::getInstance(), te::layout::Context::getZoomFactor(), te::layout::Context::setOldZoomFactor(), and te::layout::Context::setZoomFactor().

void te::layout::AbstractView::clearZoomFactors ( )
virtualinherited

Method that clears the zoom factor list.

Definition at line 58 of file AbstractView.cpp.

void te::layout::View::closeEvent ( QCloseEvent *  event)
protectedvirtual

Reimplemented from QGraphicsView.

Definition at line 665 of file View.cpp.

void te::layout::View::closeOutsideWindows ( )
virtual

Close all windows that have been instantiated by this View. Ex .: Page Settings.

Definition at line 724 of file View.cpp.

void te::layout::View::closeView ( )
signal

This signal is emitted when close View object.

void te::layout::View::config ( )
virtual
void te::layout::View::contextMenuEvent ( QContextMenuEvent *  event)
protectedvirtual
QCursor te::layout::View::createCursor ( std::string  pathIcon)
protectedvirtual

Definition at line 790 of file View.cpp.

QImage te::layout::View::createImage ( )
virtual

Create snapshot of the View current state.

Returns
image

Definition at line 770 of file View.cpp.

References te::layout::AbstractScene::getSceneBox(), te::gm::Envelope::m_llx, te::gm::Envelope::m_lly, te::gm::Envelope::m_urx, and te::gm::Envelope::m_ury.

void te::layout::View::createItemGroup ( )
protectedvirtual

Groups selected objects.

Definition at line 437 of file View.cpp.

References te::layout::Scene::createItemGroup(), and te::layout::ItemObserver::redraw().

void te::layout::View::destroyItemGroup ( )
protectedvirtual

Method that delete Grouping object selected, but the individual objects continue to exist.

Definition at line 464 of file View.cpp.

References te::layout::Scene::destroyItemGroup().

void te::layout::View::drawForeground ( QPainter *  painter,
const QRectF &  rect 
)
protectedvirtual

Reimplemented from QGraphicsView.

Definition at line 943 of file View.cpp.

References te::map::SolidLine.

void te::layout::View::exportItemsToImage ( )
protectedvirtual

Saves each item in the scene as image. Ex .: .png.

Definition at line 1043 of file View.cpp.

References te::layout::Scene::exportItemsToImage().

bool te::layout::View::exportProperties ( EnumType type)
protectedvirtual

Method that exports all the objects in the scene to a template. Ex.: JSON.

Parameters
typetype of template. Ex .: JSON type
Returns
true if exported, false otherwise

Definition at line 980 of file View.cpp.

References te::layout::Scene::exportPropertiesToTemplate().

void te::layout::View::exportToPDF ( )
virtual

Method that sets View object for the Print function.

Definition at line 908 of file View.cpp.

References te::layout::PrintScene::exportToPDF(), and te::layout::Scene::getPrintScene().

void te::layout::View::hideEvent ( QHideEvent *  event)
protectedvirtual

Reimplemented from QGraphicsView.

Definition at line 659 of file View.cpp.

void te::layout::View::hideView ( )
signal

This signal is emitted when hide View object.

bool te::layout::View::importTemplate ( EnumType type)
protectedvirtual

Method that import a template and build all objects. Ex.: JSON.

Returns
true if exported, false otherwise

Definition at line 1018 of file View.cpp.

References te::layout::Scene::buildTemplate().

bool te::layout::View::isExceededLimit ( double  currentScale,
double  factor,
double  oldFactor 
)
protectedvirtual

Definition at line 925 of file View.cpp.

bool te::layout::AbstractView::isVisibleRulers ( )
virtualinherited

Method that return rulers visibility state.

Returns
true if visible, false otherwise

Definition at line 43 of file AbstractView.cpp.

void te::layout::View::mouseMoveEvent ( QMouseEvent *  event)
protectedvirtual

Reimplemented from QGraphicsView.

Definition at line 210 of file View.cpp.

References te::common::Singleton< Context >::getInstance(), and te::layout::Context::getMode().

void te::layout::View::mouseReleaseEvent ( QMouseEvent *  event)
protectedvirtual

Reimplemented from QGraphicsView.

Definition at line 244 of file View.cpp.

References te::layout::Scene::destroyItemGroup(), te::layout::Scene::selectItems(), and te::layout::Scene::updateSelectedItemsPositions().

double te::layout::AbstractView::nextFactor ( double  currentFactor)
virtualinherited

Method that returns the next zoom factor in the list.

Parameters
currentFactorcurrent factor

Definition at line 63 of file AbstractView.cpp.

void te::layout::View::onChangeConfig ( )
virtualslot

Notifies View object that some configuration was modified in the Page Settings Window.

Definition at line 692 of file View.cpp.

References te::layout::AbstractScene::getSceneBox(), and te::layout::Scene::reset().

void te::layout::View::onMainMenuChangeContext ( bool  change)
virtualslot

Notifies View object that some action on the Menu has been thrown.

Definition at line 504 of file View.cpp.

void te::layout::View::onSelectionChanged ( )
virtualslot

Notifies View object that the selection of objects in the scene changed.

Definition at line 737 of file View.cpp.

void te::layout::View::onSelectionItem ( std::string  name)
virtualslot

Definition at line 1094 of file View.cpp.

References te::layout::Scene::selectItem().

void te::layout::View::onSystematicApply ( double  scale,
SystematicScaleType  type 
)
virtualslot

Definition at line 732 of file View.cpp.

void te::layout::View::onToolbarChangeContext ( bool  change)
virtualslot

Notifies View object that some action on the toolbar has been thrown.

Definition at line 432 of file View.cpp.

void te::layout::View::outsideAreaChangeContext ( bool  change)
protectedvirtual

Responsible method for verifying changes made in Context outside the View object and call corresponding actions. Ex.: Action Pan called in toolbar changed Context to Pan mode, then View object call method to do it.

Definition at line 509 of file View.cpp.

References te::layout::AlignItems::alignBottom(), te::layout::AlignItems::alignCenterHorizontal(), te::layout::AlignItems::alignCenterVertical(), te::layout::AlignItems::alignLeft(), te::layout::AlignItems::alignRight(), te::layout::AlignItems::alignTop(), te::layout::AlignItems::bringToFront(), te::layout::ItemUtils::createLegendChildAsObject(), te::layout::ItemUtils::createTextGridAsObject(), te::layout::ItemUtils::createTextMapAsObject(), te::layout::Scene::getAlignItems(), te::layout::Enums::getEnumModeType(), te::layout::Enums::getEnumTemplateType(), te::common::Singleton< Enums >::getInstance(), te::common::Singleton< Context >::getInstance(), te::layout::Context::getItemUtils(), te::layout::EnumTemplateType::getJsonType(), te::layout::Context::getMode(), te::layout::EnumModeType::getModeAlignBottom(), te::layout::EnumModeType::getModeAlignCenterHorizontal(), te::layout::EnumModeType::getModeAlignCenterVertical(), te::layout::EnumModeType::getModeAlignLeft(), te::layout::EnumModeType::getModeAlignRight(), te::layout::EnumModeType::getModeAlignTop(), te::layout::EnumModeType::getModeArrowCursor(), te::layout::EnumModeType::getModeBringToFront(), te::layout::EnumModeType::getModeDrawSelectionMap(), te::layout::EnumModeType::getModeExit(), te::layout::EnumModeType::getModeExportPropsJSON(), te::layout::EnumModeType::getModeExportToPDF(), te::layout::EnumModeType::getModeGroup(), te::layout::EnumModeType::getModeImportJSONProps(), te::layout::EnumModeType::getModeLegendChildAsObject(), te::layout::EnumModeType::getModeMapCreateTextGrid(), te::layout::EnumModeType::getModeMapCreateTextMap(), te::layout::EnumModeType::getModeMapPan(), te::layout::EnumModeType::getModeMapZoomIn(), te::layout::EnumModeType::getModeMapZoomOut(), te::layout::EnumModeType::getModeNewTemplate(), te::layout::EnumModeType::getModeObjectToImage(), te::layout::EnumModeType::getModePageConfig(), te::layout::EnumModeType::getModePan(), te::layout::EnumModeType::getModePrinter(), te::layout::EnumModeType::getModeRecompose(), te::layout::EnumModeType::getModeRemoveObject(), te::layout::EnumModeType::getModeSceneZoom(), te::layout::EnumModeType::getModeSendToBack(), te::layout::EnumModeType::getModeUngroup(), te::layout::EnumModeType::getModeUnitsMetricsChange(), te::layout::EnumModeType::getModeZoomIn(), te::layout::EnumModeType::getModeZoomOut(), te::layout::Scene::redrawSelectionMap(), te::layout::Scene::removeSelectedItems(), te::layout::Scene::reset(), te::layout::AlignItems::sendToBack(), and te::layout::ItemUtils::setCurrentToolInSelectedMapItems().

void te::layout::View::pan ( )
virtual

Method that sets View object for the Pan function.

Definition at line 819 of file View.cpp.

double te::layout::AbstractView::previousFactor ( double  currentFactor)
virtualinherited

Method that returns the previous zoom factor in the list.

Parameters
currentFactorcurrent factor

Definition at line 83 of file AbstractView.cpp.

void te::layout::View::print ( )
virtual

Method that sets View object for the Print function.

Definition at line 857 of file View.cpp.

References te::layout::Scene::getPrintScene(), and te::layout::PrintScene::printPreview().

void te::layout::View::recompose ( )
virtual

Reset to initial configuration made in the config() method. Reset to default zoom factor.

Definition at line 874 of file View.cpp.

References te::layout::Context::getDefaultZoomFactor(), and te::common::Singleton< Context >::getInstance().

void te::layout::View::reloadProperties ( )
signal

This signal is emitted when selection change and mouse release.

void te::layout::View::resetDefaultConfig ( )
protectedvirtual

Definition at line 485 of file View.cpp.

void te::layout::View::resetView ( )
virtual
void te::layout::View::resizeEvent ( QResizeEvent *  event)
protectedvirtual

Reimplemented from QGraphicsView.

Definition at line 427 of file View.cpp.

void te::layout::AbstractView::setVisibleRulers ( bool  visible)
virtualinherited

Method that change rulers visibility state.

Parameters
visiblevisibility state

Definition at line 48 of file AbstractView.cpp.

void te::layout::View::showEvent ( QShowEvent *  event)
protectedvirtual

Reimplemented from QGraphicsView.

Definition at line 671 of file View.cpp.

void te::layout::View::showPageSetup ( )
protectedvirtual

Method that instantiates and shows the Page Setup window.

Definition at line 677 of file View.cpp.

References te::layout::OutsideController::getView().

void te::layout::View::showSystematicScale ( )
protectedvirtual

Definition at line 710 of file View.cpp.

References te::layout::OutsideController::getView().

void te::layout::View::showView ( )
signal

This signal is emitted when show View object.

void te::layout::View::wheelEvent ( QWheelEvent *  event)
protectedvirtual
void te::layout::View::zoomArea ( )
virtual

Method that sets View object for the Zoom Area function.

Definition at line 831 of file View.cpp.

void te::layout::View::zoomOut ( )
virtual

Method that sets View object for the Zoom Out function.

Definition at line 844 of file View.cpp.

void te::layout::View::zoomPercentage ( )
virtual

Member Data Documentation

te::gm::Coord2D te::layout::View::m_coordSystematic
protected

Definition at line 347 of file View.h.

AbstractViewTool* te::layout::View::m_currentTool
protected

Definition at line 344 of file View.h.

bool te::layout::View::m_flag
protected

Definition at line 361 of file View.h.

double te::layout::View::m_height
protected

Definition at line 355 of file View.h.

HorizontalRuler* te::layout::View::m_horizontalRuler
protected

Definition at line 350 of file View.h.

Referenced by View().

bool te::layout::View::m_isMoving
protected

Definition at line 356 of file View.h.

double te::layout::View::m_maxZoomLimit
protected

Definition at line 352 of file View.h.

MenuBuilder* te::layout::View::m_menuBuilder
protected

Definition at line 349 of file View.h.

double te::layout::View::m_minZoomLimit
protected

Definition at line 353 of file View.h.

te::layout::MovingItemGroup* te::layout::View::m_movingItemGroup
protected

Definition at line 357 of file View.h.

EnumType* te::layout::View::m_oldMode
protected

Definition at line 359 of file View.h.

Referenced by View().

PageSetupOutside* te::layout::View::m_pageSetupOutside
protected

Definition at line 345 of file View.h.

bool te::layout::View::m_selectionChange
protected

Definition at line 348 of file View.h.

SystematicScaleOutside* te::layout::View::m_systematicOutside
protected

Definition at line 346 of file View.h.

bool te::layout::View::m_updateItemPos
protected

Definition at line 358 of file View.h.

VerticalRuler* te::layout::View::m_verticalRuler
protected

Definition at line 351 of file View.h.

Referenced by View().

bool te::layout::AbstractView::m_visibleRulers
protectedinherited

rulers visibility state

Definition at line 111 of file AbstractView.h.

VisualizationArea* te::layout::View::m_visualizationArea
protected

Definition at line 343 of file View.h.

WaitView* te::layout::View::m_wait
protected

Definition at line 360 of file View.h.

Referenced by View().

double te::layout::View::m_width
protected

Definition at line 354 of file View.h.

std::map<double, std::string> te::layout::AbstractView::m_zoomFactors
protectedinherited

zoom factor list

Definition at line 112 of file AbstractView.h.

Referenced by te::layout::AbstractView::AbstractView().


The documentation for this class was generated from the following files: