From e28c46aecd336669b53d9263c3cb1d7912bc6e41 Mon Sep 17 00:00:00 2001 From: Luc Hermitte <luc.hermitte@c-s.fr> Date: Thu, 14 Jun 2012 16:54:43 +0200 Subject: [PATCH] STYLE: OTB-151/GeometriesProjectionFilter --- .../OGRAdapters/otbGeometriesSet.cxx | 10 +++++----- Code/UtilitiesAdapters/OGRAdapters/otbGeometriesSet.h | 10 +++++----- .../OGRAdapters/otbGeometriesToGeometriesFilter.cxx | 10 ---------- .../OGRAdapters/otbGeometriesToGeometriesFilter.h | 3 --- .../OGRAdapters/otbGeometriesToGeometriesFilter.txx | 3 +-- .../UtilitiesAdapters/OGRAdapters/otbImageReference.h | 10 +++++----- .../OGRAdapters/otbOGRGeometriesVisitor.h | 11 ++++------- .../Filtering/GeometriesChangeSpatialReference.cxx | 2 +- Examples/Filtering/GeometriesFilter.cxx | 2 +- 9 files changed, 22 insertions(+), 39 deletions(-) diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesSet.cxx b/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesSet.cxx index c83078511e..7bb9e7bb4c 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesSet.cxx +++ b/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesSet.cxx @@ -57,20 +57,20 @@ otb::ogr::Layer & getRef(otb::ogr::Layer & layer) /*=======================[ Setting and construction ]========================*/ /*===========================================================================*/ otb::GeometriesSet::GeometriesSet() -: m_geometriesSet(otb::ogr::DataSource::New()) +: m_GeometriesSet(otb::ogr::DataSource::New()) , m_ImageReference(*this) { } otb::GeometriesSet::GeometriesSet(ogr::DataSource::Pointer datasource) -: m_geometriesSet(datasource) +: m_GeometriesSet(datasource) , m_ImageReference(*this) { assert(datasource && "unexpected nil datasource"); } otb::GeometriesSet::GeometriesSet(ogr::Layer layer) -: m_geometriesSet(layer) +: m_GeometriesSet(layer) , m_ImageReference(*this) { } @@ -99,13 +99,13 @@ otb::GeometriesSet::~GeometriesSet() void otb::GeometriesSet::Set(ogr::Layer layer) { assert(layer && "unexpected nil layer"); - m_geometriesSet = layer; + m_GeometriesSet = layer; } void otb::GeometriesSet::Set(ogr::DataSource::Pointer datasource) { assert(datasource && "unexpected nil datasource"); - m_geometriesSet = datasource; + m_GeometriesSet = datasource; } /*===========================================================================*/ diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesSet.h b/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesSet.h index ff613e85c2..c366f35249 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesSet.h +++ b/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesSet.h @@ -83,28 +83,28 @@ public: typename Visitor::result_type apply(Visitor const& visitor) { - return boost::apply_visitor(visitor, m_geometriesSet); + return boost::apply_visitor(visitor, m_GeometriesSet); } template <typename Visitor> typename Visitor::result_type apply(Visitor const& visitor) const { - return boost::apply_visitor(visitor, m_geometriesSet); + return boost::apply_visitor(visitor, m_GeometriesSet); } template <typename Visitor> typename Visitor::result_type apply(Visitor const& visitor, Self & visitable) { - return boost::apply_visitor(visitor, m_geometriesSet, visitable.m_geometriesSet); + return boost::apply_visitor(visitor, m_GeometriesSet, visitable.m_GeometriesSet); } template <typename Visitor> typename Visitor::result_type apply(Visitor const& visitor, Self /*const*/& visitable) const { - return boost::apply_visitor(visitor, m_geometriesSet, visitable.m_geometriesSet); + return boost::apply_visitor(visitor, m_GeometriesSet, visitable.m_GeometriesSet); } //@} @@ -152,7 +152,7 @@ protected: void PrintSelf(std::ostream& os, itk::Indent indent) const; private: typedef boost::variant<ogr::DataSource::Pointer, ogr::Layer> AnyGeometriesSetType; - AnyGeometriesSetType m_geometriesSet; + AnyGeometriesSetType m_GeometriesSet; ImageReference m_ImageReference; }; diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.cxx b/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.cxx index f0e4760527..7f67f4e56b 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.cxx +++ b/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.cxx @@ -41,7 +41,6 @@ struct ProcessVisitor : boost::static_visitor<> : m_filter(filter) {} void operator()(otb::ogr::Layer const& source, otb::ogr::Layer & destination) const { - // std::cout << "G2GF: Process Visitor: L -> L ("<< source.GetName()<<")...\n"; m_filter.DoProcessLayer(source, destination); } @@ -49,7 +48,6 @@ struct ProcessVisitor : boost::static_visitor<> { assert(source && "can't filter a nil datasource"); assert(destination && "can't filter to a nil datasource"); - // std::cout << "G2GF: Process Visitor: DS("<<source->ogr().GetName()<<") -> DS("<<destination->ogr().GetName()<<") ...\n"; for (otb::ogr::DataSource::const_iterator b = source->begin(), e = source->end() ; b != e ; ++b @@ -57,33 +55,28 @@ struct ProcessVisitor : boost::static_visitor<> { otb::ogr::Layer const& sourceLayer = *b; assert(sourceLayer && "unexpected nil source layer"); - // std::cout << "source layer name:" << sourceLayer.GetName() << "\n"; otb::ogr::Layer destLayer = destination->CreateLayer( sourceLayer.GetName(), m_filter.DoDefineNewLayerSpatialReference(sourceLayer), m_filter.DoDefineNewLayerGeometryType(sourceLayer), otb::ogr::StringListConverter(m_filter.DoDefineNewLayerOptions(sourceLayer)).to_ogr() ); - // std::cout << "layer created!\n"; m_filter.DoProcessLayer(sourceLayer, destLayer); } } void operator()(otb::ogr::Layer & inout) const { - // std::cout << "G2GF: Process Visitor: L -> L ("<< source.GetName()<<")...\n"; m_filter.DoProcessLayer(inout, inout); } void operator()(otb::ogr::DataSource::Pointer inout) const { assert(inout && "can't filter a nil datasource"); - // std::cout << "G2GF: Process Visitor: DS("<<source->ogr().GetName()<<") -> DS("<<destination->ogr().GetName()<<") ...\n"; for (otb::ogr::DataSource::iterator b = inout->begin(), e = inout->end(); b != e; ++b) { otb::ogr::Layer layer = *b; assert(layer && "unexpected nil source layer"); - // std::cout << "source layer name:" << sourceLayer.GetName() << "\n"; m_filter.DoProcessLayer(layer, layer); } } @@ -128,7 +121,6 @@ otb::GeometriesToGeometriesFilter::GetInput(void ) /*virtual*/ void otb::GeometriesToGeometriesFilter::Process( InputGeometriesType const& source, OutputGeometriesType & destination) { - // std::cout << "G2GF: Processing ...\n"; // si layer, appelle virt process layer // si DS, loop et appelle virt process layer source.apply(ProcessVisitor(*this), destination); @@ -137,7 +129,6 @@ otb::GeometriesToGeometriesFilter::GetInput(void ) /*virtual*/ void otb::GeometriesToGeometriesFilter::Process( OutputGeometriesType & inout) { - // std::cout << "G2GF: Processing ...\n"; // si layer, appelle virt process layer // si DS, loop et appelle virt process layer inout.apply(ProcessVisitor(*this)); @@ -159,7 +150,6 @@ void otb::GeometriesToGeometriesFilter::GenerateOutputInformation(void ) /*virtual*/ void otb::GeometriesToGeometriesFilter::GenerateData(void ) { - // std::cout << "G2GF::GenerateData\n"; this->DoAllocateOutputs(); this->DoFinalizeInitialisation(); diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.h b/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.h index 4bc2b90eed..5f2c96f159 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.h +++ b/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.h @@ -193,7 +193,6 @@ struct TransformationFunctorDispatcher<TransformationFunctor, OGRGeometry> void operator()(ogr::Layer const& in, ogr::Layer & out) const { - // std::cout << "Converting layer " << in.GetName() << " -> " << out.GetName() << "\n"; OGRFeatureDefn & defn = out.GetLayerDefn(); for (ogr::Layer::const_iterator b = in.begin(), e = in.end(); b != e; ++b) { @@ -208,7 +207,6 @@ struct TransformationFunctorDispatcher<TransformationFunctor, OGRGeometry> void operator()(ogr::Layer & inout) const { - // std::cout << "Converting layer " << inout.GetName() << "\n"; OGRFeatureDefn & defn = inout.GetLayerDefn(); // NB: We can't iterate with begin()/end() as SetFeature may invalidate the // iterators depending of the underlying drivers @@ -270,7 +268,6 @@ protected: virtual void DoProcessLayer(ogr::Layer const& source, ogr::Layer & destination) const { - // std::cout << "DG2GF::DoProcessLayer: L("<<source.GetName()<<") -> L("<<destination.GetName()<<") ...\n"; if (source != destination) { m_TransformationFunctor(source, destination); // if TransformedElementType == layer diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.txx b/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.txx index f7c1230d60..db670ed69f 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.txx +++ b/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.txx @@ -21,9 +21,8 @@ /*===========================================================================*/ /*===========================================================================*/ -/*==============================[ other stuff ]==============================*/ +/*==================[ DefaultGeometriesToGeometriesFilter ]==================*/ /*===========================================================================*/ - template <class TransformationFunctor> inline otb::DefaultGeometriesToGeometriesFilter<TransformationFunctor>::DefaultGeometriesToGeometriesFilter() diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbImageReference.h b/Code/UtilitiesAdapters/OGRAdapters/otbImageReference.h index 78978b278c..efce577c73 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbImageReference.h +++ b/Code/UtilitiesAdapters/OGRAdapters/otbImageReference.h @@ -42,7 +42,7 @@ public: itkTypeMacro(ImageReference, void); bool GetDebug() const { - return m_holder.GetDebug(); + return m_Holder.GetDebug(); } //@} /**\name Template-parameters typedefs */ @@ -57,7 +57,7 @@ public: * \post <tt>m_Origin = {0,0}</tt> */ ImageReference(itk::Object const& holder) - : m_holder(holder) + : m_Holder(holder) { m_Spacing.Fill(1); m_Origin.Fill(0); @@ -67,13 +67,13 @@ public: * \post <tt>m_Origin = origin</tt> */ ImageReference(SpacingType const& spacing, OriginType const& origin, itk::Object const& holder) - : m_holder(holder) , m_Spacing(spacing), m_Origin(origin) + : m_Holder(holder) , m_Spacing(spacing), m_Origin(origin) { } void Modified() const { - m_holder.Modified(); + m_Holder.Modified(); } /**\name Origin property @@ -155,7 +155,7 @@ public: } private: - itk::Object const& m_holder; + itk::Object const& m_Holder; SpacingType m_Spacing; OriginType m_Origin; }; diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbOGRGeometriesVisitor.h b/Code/UtilitiesAdapters/OGRAdapters/otbOGRGeometriesVisitor.h index 1eec99f889..b0f63e673d 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbOGRGeometriesVisitor.h +++ b/Code/UtilitiesAdapters/OGRAdapters/otbOGRGeometriesVisitor.h @@ -29,17 +29,14 @@ namespace ogr { template <typename Tin, typename Tout> struct propagate_const -{ -typedef Tout type; -}; +{ typedef Tout type; }; template <typename Tin, typename Tout> struct propagate_const<Tin const, Tout> -{ -typedef typename boost::add_const<Tout>::type type; -}; +{ typedef typename boost::add_const<Tout>::type type; }; #define TRY_APPLY(TYPE, geometry, functor) \ -if (typename propagate_const<TGeometry, TYPE>::type * dc = dynamic_cast<typename propagate_const<TGeometry, TYPE>::type*>(geometry))\ +if (typename propagate_const<TGeometry, TYPE>::type * dc \ + = dynamic_cast<typename propagate_const<TGeometry, TYPE>::type*>(geometry))\ {\ return functor(dc); \ } diff --git a/Examples/Filtering/GeometriesChangeSpatialReference.cxx b/Examples/Filtering/GeometriesChangeSpatialReference.cxx index 53dcf25ad3..9f7180ac65 100644 --- a/Examples/Filtering/GeometriesChangeSpatialReference.cxx +++ b/Examples/Filtering/GeometriesChangeSpatialReference.cxx @@ -89,7 +89,7 @@ int main (int argc, char **argv) } try { - const bool workingInplace = argc==2; + const bool workingInplace = argc == 2; const bool outputIsStdout = !workingInplace && !strcmp(argv[2], "-"); const std::string inputFile = argv[1]; diff --git a/Examples/Filtering/GeometriesFilter.cxx b/Examples/Filtering/GeometriesFilter.cxx index a1c84487ca..37c564e43e 100644 --- a/Examples/Filtering/GeometriesFilter.cxx +++ b/Examples/Filtering/GeometriesFilter.cxx @@ -60,7 +60,7 @@ int main (int argc, char **argv) } try { - const bool workingInplace = argc==2; + const bool workingInplace = argc == 2; const bool outputIsStdout = !workingInplace && !strcmp(argv[2], "-"); const std::string inputFile = argv[1]; -- GitLab