2 * This program is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU Lesser General Public License as
4 * published by the Free Software Foundation, either version 3 of the
5 * License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * @file DigitalTopology.ih
19 * @author Jacques-Olivier Lachaud (\c jacques-olivier.lachaud@univ-savoie.fr )
20 * Laboratory of Mathematics (CNRS, UMR 5807), University of Savoie, France
24 * Implementation of inline methods defined in DigitalTopology.h
26 * This file is part of the DGtal library.
30 //////////////////////////////////////////////////////////////////////////////
32 //////////////////////////////////////////////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////////////////
35 // IMPLEMENTATION of inline methods.
36 ///////////////////////////////////////////////////////////////////////////////
38 ///////////////////////////////////////////////////////////////////////////////
39 // ----------------------- Standard services ------------------------------
44 template <typename TForegroundAdjacency, typename TBackgroundAdjacency>
46 DGtal::DigitalTopology<TForegroundAdjacency,TBackgroundAdjacency>
52 * Defines the digital topology (kappa,lambda).
54 * @param aKappa a const reference to the adjacency object chosen
55 * for the foreground topology.
57 * @param aLambda a const reference to the adjacency object chosen
58 * for the background topology.
60 * @param props an hint of the properties of this digital
61 * topology, default is UNKNOWN.
63 template <typename TForegroundAdjacency, typename TBackgroundAdjacency>
65 DGtal::DigitalTopology<TForegroundAdjacency,TBackgroundAdjacency>
66 ::DigitalTopology( ConstAlias<ForegroundAdjacency> aKappa,
67 ConstAlias<BackgroundAdjacency> aLambda,
68 DigitalTopologyProperties props )
69 : myKappa( aKappa ), myLambda( aLambda ),
78 * @param other the object to clone.
80 template <typename TForegroundAdjacency, typename TBackgroundAdjacency>
82 DGtal::DigitalTopology<TForegroundAdjacency,TBackgroundAdjacency>
83 ::DigitalTopology ( const DigitalTopology & other )
84 : myKappa( other.myKappa ), myLambda( other.myLambda ),
85 myProps( other.myProps )
91 * @return a const reference to the foreground connectedness.
93 template <typename TForegroundAdjacency, typename TBackgroundAdjacency>
95 const TForegroundAdjacency &
96 DGtal::DigitalTopology<TForegroundAdjacency,TBackgroundAdjacency>::kappa() const
102 * @return a const reference to the background connectedness.
104 template <typename TForegroundAdjacency, typename TBackgroundAdjacency>
106 const TBackgroundAdjacency &
107 DGtal::DigitalTopology<TForegroundAdjacency,TBackgroundAdjacency>::lambda() const
113 * @return JORDAN iff the topology is Jordan, NOT_JORDAN iff the
114 * topology is known to be NOT_JORDAN, UNKNOWN otherwise.
116 template <typename TForegroundAdjacency, typename TBackgroundAdjacency>
118 DGtal::DigitalTopologyProperties
119 DGtal::DigitalTopology<TForegroundAdjacency,TBackgroundAdjacency>::properties() const
125 * @return a digital topology object which is the reverse
126 * topology of this (ie. \f[ (\lambda,\kappa) \f].
128 template <typename TForegroundAdjacency, typename TBackgroundAdjacency>
130 typename DGtal::DigitalTopology<TForegroundAdjacency,TBackgroundAdjacency>
132 DGtal::DigitalTopology<TForegroundAdjacency,TBackgroundAdjacency>
133 ::reverseTopology() const
135 return ReverseTopology( myLambda, myKappa, myProps );
138 ///////////////////////////////////////////////////////////////////////////////
139 // Interface - public :
142 * Writes/Displays the object on an output stream.
143 * @param out the output stream where the object is written.
145 template <typename TForegroundAdjacency, typename TBackgroundAdjacency>
148 DGtal::DigitalTopology<TForegroundAdjacency,TBackgroundAdjacency>
149 ::selfDisplay ( std::ostream & out ) const
151 out << "[DigitalTopology kappa=" << myKappa
152 << " lambda=" << myLambda;
153 if ( properties() == JORDAN_DT ) out << " [Jordan]";
154 else if ( properties() == NOT_JORDAN_DT ) out << " [Not Jordan]";
155 else if ( properties() == UNKNOWN_DT ) out << " [Unknown]";
156 else out << properties();
161 * Checks the validity/consistency of the object.
162 * @return 'true' if the object is valid, 'false' otherwise.
164 template <typename TForegroundAdjacency, typename TBackgroundAdjacency>
167 DGtal::DigitalTopology<TForegroundAdjacency,TBackgroundAdjacency>
175 ///////////////////////////////////////////////////////////////////////////////
176 // Implementation of inline functions //
178 template <typename TForegroundAdjacency, typename TBackgroundAdjacency>
181 DGtal::operator<< ( std::ostream & out,
182 const DigitalTopology<TForegroundAdjacency,TBackgroundAdjacency> & object )
184 object.selfDisplay( out );
189 ///////////////////////////////////////////////////////////////////////////////