All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MarkSymbol.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 MarkSymbol.cpp
22 
23  \brief This file contains a class that specialize the QwtSymbol to draw a Terralib Mark.
24 */
25 
26 // TerraLib
27 #include "../../../common/STLUtils.h"
28 #include "../../../se/Mark.h"
29 #include "../../../maptools/MarkRendererManager.h"
30 #include "MarkSymbol.h"
31 #include "Utils.h"
32 
33 // Qt Widgets Utils
34 #include "../Utils.h"
35 
36 // Qt
37 #include <QImage>
38 #include <QPainter>
39 
40 
42  QwtSymbol(UserStyle),
43  m_mark(mark),
44  m_size(size)
45 {
46 
47 }
48 
49 void te::qt::widgets::MarkSymbol::drawSymbols(QPainter* painter, const QPointF* point, int numPoints) const
50 {
51  te::color::RGBAColor** rgba = te::map::MarkRendererManager::getInstance().render(m_mark, m_size);
52 
53  QImage* image = GetImage(rgba, m_size, m_size);
54 
55  for(int i=0; i<numPoints; ++i)
56  {
57  QPointF p = point[i];
58  painter->drawImage(p, *image);
59  }
60  delete image;
61  te::common::Free(rgba,m_size);
62 }
63 
64 
A Mark specifies a geometric shape and applies coloring to it.
Definition: Mark.h:84
void Free(std::vector< T * > *v)
This function can be applied to a pointer to a vector of pointers.
Definition: STLUtils.h:131
static MarkRendererManager & getInstance()
It returns a reference to the singleton instance.
This file contains a set of utility chart functions.
MarkSymbol(te::se::Mark *mark, std::size_t size)
Constructor.
Definition: MarkSymbol.cpp:41
TEQTWIDGETSEXPORT QImage * GetImage(te::color::RGBAColor **img, int width, int height)
It creates a QImage from an RGBA color array.
Definition: Utils.cpp:69
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
void drawSymbols(QPainter *painter, const QPointF *point, int numPoints) const
Set the scatter data.
Definition: MarkSymbol.cpp:49
This file contains a class that specialize the QwtSymbol to draw a Terralib Mark. ...