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 DigitalSetDomain.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 DigitalSetDomain.h
26 * This file is part of the DGtal library.
30 //////////////////////////////////////////////////////////////////////////////
32 //////////////////////////////////////////////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////////////////
35 // IMPLEMENTATION of inline methods.
36 ///////////////////////////////////////////////////////////////////////////////
38 ///////////////////////////////////////////////////////////////////////////////
39 // ----------------------- Standard services ------------------------------
41 template <typename TDigitalSet>
43 DGtal::DigitalSetDomain<TDigitalSet>
47 //------------------------------------------------------------------------------
48 template <typename TDigitalSet>
50 DGtal::DigitalSetDomain<TDigitalSet>
51 ::DigitalSetDomain ( ConstAlias<DigitalSet> aSet )
54 mySet->computeBoundingBox( myLowerBound, myUpperBound );
56 //------------------------------------------------------------------------------
57 template <typename TDigitalSet>
59 DGtal::DigitalSetDomain<TDigitalSet>
60 ::DigitalSetDomain ( const DigitalSetDomain & other )
61 : mySet( other.mySet ),
62 myUpperBound( other.myUpperBound ),
63 myLowerBound( other.myLowerBound )
66 // ----------------------- Domain services --------------------------------
67 //------------------------------------------------------------------------------
68 template <typename TDigitalSet>
70 typename DGtal::DigitalSetDomain<TDigitalSet>::ConstIterator
71 DGtal::DigitalSetDomain<TDigitalSet>
72 ::begin(const Point &aPoint) const
74 return mySet->find(aPoint);
76 //------------------------------------------------------------------------------
77 template <typename TDigitalSet>
79 typename DGtal::DigitalSetDomain<TDigitalSet>::ConstIterator
80 DGtal::DigitalSetDomain<TDigitalSet>
83 return mySet->begin();
85 //------------------------------------------------------------------------------
86 template <typename TDigitalSet>
88 typename DGtal::DigitalSetDomain<TDigitalSet>::ConstIterator
89 DGtal::DigitalSetDomain<TDigitalSet>
94 //------------------------------------------------------------------------------
95 template <typename TDigitalSet>
97 const typename DGtal::DigitalSetDomain<TDigitalSet>::Point &
98 DGtal::DigitalSetDomain<TDigitalSet>
103 //------------------------------------------------------------------------------
104 template <typename TDigitalSet>
106 const typename DGtal::DigitalSetDomain<TDigitalSet>::Point &
107 DGtal::DigitalSetDomain<TDigitalSet>
112 //------------------------------------------------------------------------------
113 template <typename TDigitalSet>
115 typename DGtal::DigitalSetDomain<TDigitalSet>::Size
116 DGtal::DigitalSetDomain<TDigitalSet>
119 return static_cast<Size>(mySet->size());
121 //------------------------------------------------------------------------------
122 template <typename TDigitalSet>
125 DGtal::DigitalSetDomain<TDigitalSet>
126 ::isInside( const Point & p ) const
128 return p.isLower( myUpperBound )
129 && p.isUpper( myLowerBound )
132 //------------------------------------------------------------------------------
133 template <typename TDigitalSet>
135 const typename DGtal::DigitalSetDomain<TDigitalSet>::Predicate &
136 DGtal::DigitalSetDomain<TDigitalSet>
142 //------------------------------------------------------------------------------
143 template <typename TDigitalSet>
146 DGtal::DigitalSetDomain<TDigitalSet>::selfDisplay ( std::ostream & out ) const
148 out << "[DigitalSetDomain set=" << *mySet << "]";
150 //------------------------------------------------------------------------------
151 template <typename TDigitalSet>
154 DGtal::DigitalSetDomain<TDigitalSet>::isValid() const
158 //------------------------------------------------------------------------------
159 template <typename TDigitalSet>
162 DGtal::operator<< ( std::ostream & out,
163 const DigitalSetDomain<TDigitalSet> & object )
165 object.selfDisplay( out );
170 ///////////////////////////////////////////////////////////////////////////////