All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GeometryOperands.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 GeometryOperands.cpp
22 
23  \brief Geometry operands.
24  */
25 
26 // TerraLib
27 #include "GeometryOperands.h"
28 #include "Globals.h"
29 
30 // STL
31 #include <cassert>
32 
33 std::set<const char*, te::common::LessCmp<const char*> > te::fe::GeometryOperands::sm_validGeometryOperands;
34 
36 {
37 }
38 
40 {
41 // we will not clear the vector items because they are just reference to an internal list of operands.
42 }
43 
45 {
46  return m_operands.size();
47 }
48 
50 {
51  assert(g);
52  m_operands.push_back(g);
53 }
54 
55 const char* te::fe::GeometryOperands::operator[](size_t i) const
56 {
57  assert(i < m_operands.size());
58  return m_operands[i];
59 }
60 
61 const char* te::fe::GeometryOperands::findOperand(const char* o)
62 {
63  assert(o);
64 
65  std::set<const char*, te::common::LessCmp<const char*> >::const_iterator it = sm_validGeometryOperands.find(o);
66 
67  if(it != sm_validGeometryOperands.end())
68  return *it;
69 
70  return 0;
71 }
72 
74 {
75  sm_validGeometryOperands.insert(Globals::sm_envelope);
76  sm_validGeometryOperands.insert(Globals::sm_point);
77  sm_validGeometryOperands.insert(Globals::sm_lineString);
78  sm_validGeometryOperands.insert(Globals::sm_polygon);
79  sm_validGeometryOperands.insert(Globals::sm_arcByCenterPoint);
80  sm_validGeometryOperands.insert(Globals::sm_circleByCenterPoint);
81  sm_validGeometryOperands.insert(Globals::sm_arc);
82  sm_validGeometryOperands.insert(Globals::sm_circle);
83  sm_validGeometryOperands.insert(Globals::sm_arcByBulge);
84  sm_validGeometryOperands.insert(Globals::sm_bezier);
85  sm_validGeometryOperands.insert(Globals::sm_clothoid);
86  sm_validGeometryOperands.insert(Globals::sm_cubicSpline);
87  sm_validGeometryOperands.insert(Globals::sm_geodesic);
88  sm_validGeometryOperands.insert(Globals::sm_offsetCurve);
89  sm_validGeometryOperands.insert(Globals::sm_triangle);
90  sm_validGeometryOperands.insert(Globals::sm_polyhedralSurface);
91  sm_validGeometryOperands.insert(Globals::sm_triangulatedSurface);
92  sm_validGeometryOperands.insert(Globals::sm_tin);
93  sm_validGeometryOperands.insert(Globals::sm_solid);
94 }
95 
97 {
98  sm_validGeometryOperands.clear();
99 }
100 
101 
102 
static const char * sm_bezier
Definition: Globals.h:105
static const char * sm_tin
Definition: Globals.h:113
static const char * sm_polyhedralSurface
Definition: Globals.h:111
static void loadValidGeometryOperandsList()
It loads the valid geometry operands list.
size_t size() const
It returns the number of available geometry operands in the object list.
static const char * sm_arcByCenterPoint
Definition: Globals.h:100
const char * operator[](size_t i) const
It returns a specified geometry operand.
static const char * sm_envelope
Definition: Globals.h:96
Geometry operands.
static const char * sm_clothoid
Definition: Globals.h:106
static const char * sm_geodesic
Definition: Globals.h:108
static const char * sm_arcByBulge
Definition: Globals.h:104
static const char * sm_arc
Definition: Globals.h:102
static const char * sm_circle
Definition: Globals.h:103
static const char * sm_circleByCenterPoint
Definition: Globals.h:101
GeometryOperands()
It initializes a new GeometryOperands.
static const char * sm_solid
Definition: Globals.h:114
static const char * sm_triangulatedSurface
Definition: Globals.h:112
static const char * sm_polygon
Definition: Globals.h:99
static const char * sm_lineString
Definition: Globals.h:98
static const char * sm_triangle
Definition: Globals.h:110
An static class with global definitions.
static const char * sm_point
Definition: Globals.h:97
static void clearValidGeometryOperandsList()
It clears the valid geometry operands list.
static const char * sm_cubicSpline
Definition: Globals.h:107
static const char * sm_offsetCurve
Definition: Globals.h:109
void push_back(const char *g)
It adds the geometry operand to the supported list of operands.
static const char * findOperand(const char *o)
It checks if operator 'o' is a valid operator. It returns a pointer to the found operator or NULL oth...
static std::set< const char *, te::common::LessCmp< const char * > > sm_validGeometryOperands
The list of valid bynary geometry operands.