All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
VisualizationArea.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file VisualizationArea.cpp
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 // TerraLib
29 #include "VisualizationArea.h"
30 #include "../../item/PaperModel.h"
31 #include "../../item/PaperController.h"
32 #include "../item/PaperItem.h"
33 #include "../../core/pattern/mvc/ItemObserver.h"
34 #include "../../core/pattern/singleton/Context.h"
35 
37 {
38  m_boxArea = boxArea;
39 }
40 
42 {
43 
44 }
45 
47 {
48  init();
49 }
50 
52 {
53  createPaper();
54 }
55 
57 {
58  //Paper
59  PaperModel* modelPaper = new PaperModel(te::layout::Context::getInstance().getPaperConfig());
60 
61  double x = modelPaper->getBox().getLowerLeftX();
62  double y = modelPaper->getBox().getLowerLeftY();
63 
64  PaperController* controllerPaper = new PaperController(modelPaper);
65  ItemObserver* itemPaper = (ItemObserver*)controllerPaper->getView();
66  PaperItem* qPaper = dynamic_cast<PaperItem*>(itemPaper);
67 
68  qPaper->setPos(QPointF(x,y));
69  qPaper->setZValue(0);
70  qPaper->redraw();
71 }
72 
74 {
75  m_boxArea = boxArea;
76 }
Class that represents a "Model" part of Paper MVC component. Its coordinate system is the same of sce...
Definition: PaperModel.h:54
Class that represents a graphic sheet of paper. Its coordinate system is the same of scene (millimete...
Definition: PaperItem.h:52
VisualizationArea(te::gm::Envelope boxArea)
const Observer * getView()
Returns the "View" part of the MVC component.
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
Definition: Envelope.h:400
Creates the viewing area. Ex.: creation of the sheet of paper.
Abstract class to represent an observer. "View" part of MVC component. All classes representing the g...
Definition: ItemObserver.h:52
Class that represents a "Controller" part of Paper MVC component. Its coordinate system is the same o...
virtual void redraw(bool bRefresh=true)
Redraws the graphic component.
static Context & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
virtual void changeBoxArea(te::gm::Envelope boxArea)
void setZValue(qreal z)
The Z value decides the stacking order of drawing.
Definition: ParentItem.h:736
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
Definition: Envelope.h:390
virtual te::gm::Envelope getBox()
Reimplemented from Observable.