Loading...
Searching...
No Matches
ScatterUtils.h
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 terralib/qt/widgets/charts/ScatterUtils.h
22
23 \brief This file contains a set of utility scatter functions
24*/
25
26#ifndef __TERRALIB_QT_WIDGETS_INTERNAL_SCATTERUTILS_H
27#define __TERRALIB_QT_WIDGETS_INTERNAL_SCATTERUTILS_H
28
29//TerraLib
30#include "../Config.h"
31#include "../../../dataaccess/dataset/ObjectId.h"
32
33//STL
34#include <map>
35#include <set>
36#include <string>
37#include <vector>
38
39// Boost
40#include <boost/multi_index_container.hpp>
41#include <boost/multi_index/ordered_index.hpp>
42#include <boost/multi_index/identity.hpp>
43#include <boost/multi_index/member.hpp>
44#include <boost/multi_index/mem_fun.hpp>
45
46namespace te
47{
48 namespace qt
49 {
50 namespace widgets
51 {
52 // The struct used to store the scatter's point and it's objectId
54 {
55 double x; //!< Double values for axis X.
56 double y; //!< Double values for axis Y.
57 te::da::ObjectId* oid; //!< This point's objectId.
58
59 PointToObjectId(double p_x, double p_y, te::da::ObjectId* p_oid) : x(p_x), y(p_y), oid(p_oid){}
60
61 bool operator<(const PointToObjectId& v) const
62 {
63 return (v.x < x);
64 }
65
66 std::string getObjIdAsString() const
67 {
68 return oid->getValueAsString();
69 }
70 };
71
72 // define a multiply indexed set with indices by
73 typedef boost::multi_index::multi_index_container<
74 PointToObjectId,
75 boost::multi_index::indexed_by<
76
77 // sort by less<string> on Interval
78 boost::multi_index::ordered_non_unique<
79 boost::multi_index::identity<PointToObjectId> >,
80
81 // sort by less<string> on objectID
82 boost::multi_index::ordered_unique<
83 boost::multi_index::const_mem_fun<PointToObjectId, std::string, &PointToObjectId::getObjIdAsString> >
84 >
86
87 } // end namespace widgets
88 } // end namespace qt
89} // end namespace te
90
91#endif // __TERRALIB_QT_WIDGETS_INTERNAL_SCATTERUTILS_H
This class represents an unique id for a data set element.
Definition: ObjectId.h:48
std::string getValueAsString() const
It gets the properties values used to uniquely identify a data set element as string.
boost::multi_index::multi_index_container< PointToObjectId, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< boost::multi_index::identity< PointToObjectId > >, boost::multi_index::ordered_unique< boost::multi_index::const_mem_fun< PointToObjectId, std::string, &PointToObjectId::getObjIdAsString > > > > PointToObjectIdSet
Definition: ScatterUtils.h:85
TerraLib.
std::string getObjIdAsString() const
Definition: ScatterUtils.h:66
double x
Double values for axis X.
Definition: ScatterUtils.h:55
double y
Double values for axis Y.
Definition: ScatterUtils.h:56
te::da::ObjectId * oid
This point's objectId.
Definition: ScatterUtils.h:57
bool operator<(const PointToObjectId &v) const
Definition: ScatterUtils.h:61
PointToObjectId(double p_x, double p_y, te::da::ObjectId *p_oid)
Definition: ScatterUtils.h:59