update dev300-m58
[ooovba.git] / basegfx / source / tuple / b2dtuple.cxx
blob052eba96c79b33b88155308d077e38272085ad77
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: b2dtuple.cxx,v $
10 * $Revision: 1.14 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_basegfx.hxx"
33 #include <basegfx/tuple/b2dtuple.hxx>
34 #include <basegfx/numeric/ftools.hxx>
35 #include <rtl/instance.hxx>
37 namespace { struct EmptyTuple : public rtl::Static<basegfx::B2DTuple, EmptyTuple> {}; }
38 #include <basegfx/tuple/b2ituple.hxx>
40 namespace basegfx
42 const B2DTuple& B2DTuple::getEmptyTuple()
44 return EmptyTuple::get();
47 B2DTuple::B2DTuple(const B2ITuple& rTup)
48 : mfX( rTup.getX() ),
49 mfY( rTup.getY() )
52 void B2DTuple::correctValues(const double fCompareValue)
54 if(0.0 == fCompareValue)
56 if(::basegfx::fTools::equalZero(mfX))
58 mfX = 0.0;
61 if(::basegfx::fTools::equalZero(mfY))
63 mfY = 0.0;
66 else
68 if(::basegfx::fTools::equal(mfX, fCompareValue))
70 mfX = fCompareValue;
73 if(::basegfx::fTools::equal(mfY, fCompareValue))
75 mfY = fCompareValue;
80 B2ITuple fround(const B2DTuple& rTup)
82 return B2ITuple(fround(rTup.getX()), fround(rTup.getY()));
85 } // end of namespace basegfx
87 // eof