Main Page
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
HorizontalRulerItem.cpp
Go to the documentation of this file.
1
/* Copyright (C) 2001-2014 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 HorizontalRulerItem.cpp
22
23
\brief
24
25
\ingroup layout
26
*/
27
28
// TerraLib
29
#include "
HorizontalRulerItem.h
"
30
#include "
ItemController.h
"
31
#include "
Context.h
"
32
#include "
AbstractScene.h
"
33
#include "
ItemModelObservable.h
"
34
#include "../../../color/RGBAColor.h"
35
#include "../../../../qt/widgets/Utils.h"
36
#include "../../../../geometry/Envelope.h"
37
#include "../../../../common/STLUtils.h"
38
39
te::layout::HorizontalRulerItem::HorizontalRulerItem
(
ItemController
* controller,
Observable
* o ) :
40
ObjectItem
(controller, o)
41
{
42
m_printable
=
false
;
43
}
44
45
te::layout::HorizontalRulerItem::~HorizontalRulerItem
()
46
{
47
48
}
49
50
void
te::layout::HorizontalRulerItem::updateObserver
(
ContextItem
context )
51
{
52
if
(!m_model)
53
return
;
54
55
te::color::RGBAColor
** rgba = context.
getPixmap
();
56
57
if
(!rgba)
58
return
;
59
60
Utils
* utils =
Context::getInstance
()->
getUtils
();
61
62
if
(!utils)
63
return
;
64
65
te::gm::Envelope
box = utils->
viewportBox
(m_model->getBox());
66
67
if
(!box.
isValid
())
68
return
;
69
70
QPixmap pixmap;
71
QImage* img = 0;
72
73
if
(rgba)
74
{
75
img =
te::qt::widgets::GetImage
(rgba, box.
getWidth
(), box.
getHeight
());
76
pixmap = QPixmap::fromImage(*img);
77
}
78
79
te::common::Free
(rgba, box.
getHeight
());
80
if
(img)
81
delete
img;
82
83
setPixmap(pixmap);
84
update();
85
}
86
87
te::layout::Observable
Definition:
Observable.h:45
te::layout::ContextItem
Definition:
ContextItem.h:41
ItemController.h
te::layout::ItemObserver::m_printable
bool m_printable
Definition:
ItemObserver.h:84
te::gm::Envelope::getWidth
double getWidth() const
It returns the envelope width.
Definition:
Envelope.h:443
Context.h
te::layout::HorizontalRulerItem::updateObserver
virtual void updateObserver(ContextItem context)
Definition:
HorizontalRulerItem.cpp:50
te::layout::ItemController
Definition:
ItemController.h:45
te::layout::ContextItem::getPixmap
te::color::RGBAColor ** getPixmap()
Definition:
ContextItem.cpp:82
HorizontalRulerItem.h
te::layout::HorizontalRulerItem::HorizontalRulerItem
HorizontalRulerItem(ItemController *controller=0, Observable *o=0)
Definition:
HorizontalRulerItem.cpp:39
te::common::Free
void Free(std::vector< T * > *v)
This function can be applied to a pointer to a vector of pointers.
Definition:
STLUtils.h:131
te::layout::HorizontalRulerItem::~HorizontalRulerItem
virtual ~HorizontalRulerItem()
Definition:
HorizontalRulerItem.cpp:45
te::layout::ObjectItem
Definition:
ObjectItem.h:51
te::gm::Envelope
An Envelope defines a 2D rectangular region.
Definition:
Envelope.h:51
te::layout::Context::getUtils
Utils * getUtils()
Definition:
Context.cpp:126
AbstractScene.h
te::layout::Utils::viewportBox
virtual te::gm::Envelope viewportBox(te::gm::Envelope box)
Definition:
Utils.cpp:164
ItemModelObservable.h
te::qt::widgets::GetImage
TEQTWIDGETSEXPORT QImage * GetImage(te::color::RGBAColor **img, int width, int height)
It creates a QImage from an RGBA color array.
Definition:
Utils.cpp:63
te::color::RGBAColor
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition:
RGBAColor.h:57
te::layout::Context::getInstance
static Context * getInstance()
This function is called to create an instance of the class.
Definition:
Context.cpp:46
te::layout::Utils
Definition:
Utils.h:42
te::gm::Envelope::getHeight
double getHeight() const
It returns the envelope height.
Definition:
Envelope.h:448
te::gm::Envelope::isValid
bool isValid() const
It tells if the rectangle is valid or not.
Definition:
Envelope.h:438
BB_TL5
terralib5
src
terralib
layout
qt
src
item
HorizontalRulerItem.cpp
Generated on Mon Sep 29 2014 13:46:33 for TerraLib by
1.8.7