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