Skip to content

Commit df1e1d1

Browse files
author
Jean-Christophe Fabre
committed
Overall cleaning of landr library according to coding style
1 parent e3dafcf commit df1e1d1

32 files changed

+2335
-3181
lines changed

GdalCompat.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
license, and requires a written agreement between You and INRA.
2727
Licensees for Other Usage of OpenFLUID may use this file in accordance
2828
with the terms contained in the written agreement between You and INRA.
29-
29+
3030
*/
3131

3232

@@ -36,7 +36,9 @@
3636
@author Jean-Christophe FABRE <jean-christophe.fabre@supagro.inra.fr>
3737
*/
3838

39+
3940
#include <gdal_version.h>
41+
4042
#include <openfluid/landr/GdalCompat.hpp>
4143

4244

@@ -74,4 +76,3 @@ OGRGeometry* convertGEOSGeometryToOGR(const GEOSGeom Geometry)
7476

7577

7678
} } // namespaces
77-

GdalCompat.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
license, and requires a written agreement between You and INRA.
2727
Licensees for Other Usage of OpenFLUID may use this file in accordance
2828
with the terms contained in the written agreement between You and INRA.
29-
29+
3030
*/
3131

3232
/**
@@ -42,7 +42,9 @@
4242

4343

4444
#include <geos/geom/GeometryFactory.h>
45+
4546
#include <ogrsf_frmts.h>
47+
4648
#include <openfluid/dllexport.hpp>
4749

4850

GeosCompat.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
license, and requires a written agreement between You and INRA.
2727
Licensees for Other Usage of OpenFLUID may use this file in accordance
2828
with the terms contained in the written agreement between You and INRA.
29-
29+
3030
*/
3131

3232

@@ -44,15 +44,17 @@
4444

4545
#include <openfluid/config.hpp>
4646

47+
4748
namespace openfluid { namespace landr {
4849

4950
#if GEOS_VERSION_GREATER_OR_EQUAL_3_3_0
5051
#define GET_DANGLES(P,D) \
5152
D = P->getDangles();
5253
#else
5354
#define GET_DANGLES(P,D) \
54-
std::vector<const geos::geom::LineString*>* TheDangles = P->getDangles(); \
55-
if (TheDangles) D = *TheDangles;
55+
std::vector<const geos::geom::LineString*>* _M_TheDangles = P->getDangles(); \
56+
if (_M_TheDangles) \
57+
D = *_M_TheDangles;
5658
#endif
5759

5860
#if GEOS_VERSION_GREATER_OR_EQUAL_3_3_2
@@ -62,7 +64,7 @@ namespace openfluid { namespace landr {
6264
#endif
6365

6466

65-
}}
67+
} } // namespaces
6668

6769

6870
#endif /* __OPENFLUID_LANDR_GEOSCOMPAT_HPP__ */

LandREntity.cpp

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
license, and requires a written agreement between You and INRA.
2727
Licensees for Other Usage of OpenFLUID may use this file in accordance
2828
with the terms contained in the written agreement between You and INRA.
29-
29+
3030
*/
3131

3232
/**
@@ -36,18 +36,17 @@
3636
@author Michael RABOTIN <michael.rabotin@supagro.inra.fr>
3737
*/
3838

39-
#include "LandREntity.hpp"
4039

41-
#include <openfluid/core/Value.hpp>
40+
#include <algorithm>
41+
4242
#include <geos/geom/Geometry.h>
4343
#include <geos/geom/Point.h>
44-
#include <algorithm>
4544

46-
namespace openfluid { namespace landr {
45+
#include <openfluid/landr/LandREntity.hpp>
46+
#include <openfluid/core/Value.hpp>
4747

4848

49-
// =====================================================================
50-
// =====================================================================
49+
namespace openfluid { namespace landr {
5150

5251

5352
LandREntity::LandREntity(const geos::geom::Geometry* Geom, unsigned int OfldId) :
@@ -146,8 +145,7 @@ std::set<LandREntity*>* LandREntity::neighbours()
146145
bool LandREntity::getAttributeValue(const std::string& AttributeName,
147146
core::Value& Value) const
148147
{
149-
std::map<std::string, core::Value*>::const_iterator it = m_Attributes.find(
150-
AttributeName);
148+
std::map<std::string, core::Value*>::const_iterator it = m_Attributes.find(AttributeName);
151149

152150
if (it != m_Attributes.end() && it->second)
153151
{
@@ -166,17 +164,17 @@ bool LandREntity::getAttributeValue(const std::string& AttributeName,
166164
bool LandREntity::setAttributeValue(const std::string& AttributeName,
167165
const core::Value* Value)
168166
{
169-
std::map<std::string, core::Value*>::const_iterator it = m_Attributes.find(
170-
AttributeName);
167+
std::map<std::string, core::Value*>::const_iterator it = m_Attributes.find(AttributeName);
171168

172169
if (it != m_Attributes.end())
173170
{
174171
if (it->second)
175172
delete it->second;
173+
176174
m_Attributes[AttributeName] = const_cast<core::Value*>(Value);
175+
177176
return true;
178177
}
179-
180178
return false;
181179
}
182180

@@ -212,17 +210,10 @@ LandREntity* LandREntity::neighbour_MinDistCentroCentro()
212210
NeighByDist[Dist] = Neigh;
213211
}
214212

215-
std::map<double, LandREntity*>::iterator itMin = std::min_element(
216-
NeighByDist.begin(), NeighByDist.end());
213+
std::map<double, LandREntity*>::iterator itMin = std::min_element(NeighByDist.begin(), NeighByDist.end());
217214

218-
return
219-
(itMin != NeighByDist.end() && itMin->first > 0) ? itMin->second :
220-
(LandREntity*) 0;
215+
return (itMin != NeighByDist.end() && itMin->first > 0) ? itMin->second : nullptr;
221216
}
222217

223218

224-
// =====================================================================
225-
// =====================================================================
226-
227-
228-
} }// namespaces landr, openfluid
219+
} } // namespaces

LandREntity.hpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
license, and requires a written agreement between You and INRA.
2727
Licensees for Other Usage of OpenFLUID may use this file in accordance
2828
with the terms contained in the written agreement between You and INRA.
29-
29+
3030
*/
3131

3232
/**
@@ -36,15 +36,20 @@
3636
@author Michael RABOTIN <michael.rabotin@supagro.inra.fr>
3737
*/
3838

39+
3940
#ifndef __OPENFLUID_LANDR_LANDRENTITY_HPP__
4041
#define __OPENFLUID_LANDR_LANDRENTITY_HPP__
4142

42-
#include <geos/planargraph/GraphComponent.h>
43+
4344
#include <map>
4445
#include <set>
4546
#include <string>
47+
48+
#include <geos/planargraph/GraphComponent.h>
49+
4650
#include <openfluid/dllexport.hpp>
4751

52+
4853
namespace geos { namespace geom {
4954
class Geometry;
5055
class Point;
@@ -53,8 +58,9 @@ class Point;
5358
namespace openfluid {
5459
namespace core {
5560
class Value;
56-
5761
}
62+
63+
5864
namespace landr {
5965

6066
/**

0 commit comments

Comments
 (0)