All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OverlapBehavior.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2011-2011 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/serialization/se/OverlapBehavior.cpp
22 
23  \brief Support for OverlapBehavior serialization.
24 */
25 
26 // TerraLib
27 #include "../../xml/Reader.h"
28 #include "../../xml/Writer.h"
29 #include "OverlapBehavior.h"
30 
31 // STL
32 #include <cassert>
33 
35 {
36  assert(reader.getNodeType() == te::xml::START_ELEMENT);
37  assert(reader.getElementLocalName() == "OverlapBehavior");
38 
39  reader.next();
40  assert(reader.getNodeType() == te::xml::VALUE);
41  std::string type = reader.getElementValue();
42  reader.next();
43 
44  if(type == "AVERAGE")
46 
47  if(type == "EARLIEST_ON_TOP")
49 
50  if(type == "LATEST_ON_TOP")
52 
53  if(type == "RANDOM")
55 
56  assert(reader.getNodeType() == te::xml::END_ELEMENT);
57  reader.next();
58 
60 }
61 
63 {
64  switch(type)
65  {
67  break;
68 
70  writer.writeElement("se:OverlapBehavior", "AVERAGE");
71  break;
72 
74  writer.writeElement("se:OverlapBehavior", "EARLIEST_ON_TOP");
75  break;
76 
78  writer.writeElement("se:OverlapBehavior", "LATEST_ON_TOP");
79  break;
80 
82  writer.writeElement("se:OverlapBehavior", "RANDOM");
83  break;
84  }
85 }
This class models a XML reader object.
Definition: Reader.h:55
virtual bool next()=0
It gets the next event to be read.
virtual std::string getElementValue() const =0
It returns the element data value in the case of VALUE node.
Support for OverlapBehavior serialization.
TESERIALIZATIONEXPORT void Save(const te::fe::Filter *filter, te::xml::Writer &writer)
Definition: Filter.cpp:54
TESERIALIZATIONEXPORT te::se::RasterSymbolizer::OverlapBehavior ReadOverlapBehavior(te::xml::Reader &reader)
virtual void writeElement(const std::string &qName, const std::string &value)
Definition: Writer.cpp:54
virtual NodeType getNodeType() const =0
It return the type of node read.
virtual std::string getElementLocalName() const =0
It returns the local part of the element name in the case of an element node.
OverlapBehavior
OverlapBehavior tells a system how to behave when multiple raster images in a layer overlap each othe...
This class models a XML writer object.
Definition: Writer.h:52