2003-11-26 13:31:41 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 18:04:01 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2003-11-26 13:31:41 +00:00
|
|
|
*
|
2008-04-10 18:04:01 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2003-11-26 13:31:41 +00:00
|
|
|
*
|
2008-04-10 18:04:01 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2003-11-26 13:31:41 +00:00
|
|
|
*
|
2008-04-10 18:04:01 +00:00
|
|
|
* $RCSfile: b3dpolypolygontools.cxx,v $
|
|
|
|
* $Revision: 1.6 $
|
2003-11-26 13:31:41 +00:00
|
|
|
*
|
2008-04-10 18:04:01 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2003-11-26 13:31:41 +00:00
|
|
|
*
|
2008-04-10 18:04:01 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2003-11-26 13:31:41 +00:00
|
|
|
*
|
2008-04-10 18:04:01 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2003-11-26 13:31:41 +00:00
|
|
|
*
|
2008-04-10 18:04:01 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2003-11-26 13:31:41 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 07:04:16 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_basegfx.hxx"
|
2003-11-26 13:31:41 +00:00
|
|
|
#include <basegfx/polygon/b3dpolypolygontools.hxx>
|
|
|
|
#include <basegfx/range/b3drange.hxx>
|
|
|
|
#include <basegfx/polygon/b3dpolypolygon.hxx>
|
|
|
|
#include <basegfx/polygon/b3dpolygon.hxx>
|
|
|
|
#include <basegfx/polygon/b3dpolygontools.hxx>
|
|
|
|
#include <basegfx/numeric/ftools.hxx>
|
|
|
|
|
2004-08-03 12:31:17 +00:00
|
|
|
#include <numeric>
|
|
|
|
|
2003-11-26 13:31:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
namespace basegfx
|
|
|
|
{
|
2003-11-28 10:18:16 +00:00
|
|
|
namespace tools
|
2003-11-26 13:31:41 +00:00
|
|
|
{
|
2003-11-28 10:18:16 +00:00
|
|
|
// B3DPolyPolygon tools
|
|
|
|
::basegfx::B3DRange getRange(const ::basegfx::B3DPolyPolygon& rCandidate)
|
2003-11-26 13:31:41 +00:00
|
|
|
{
|
2003-11-28 10:18:16 +00:00
|
|
|
::basegfx::B3DRange aRetval;
|
|
|
|
const sal_uInt32 nPolygonCount(rCandidate.count());
|
|
|
|
|
|
|
|
for(sal_uInt32 a(0L); a < nPolygonCount; a++)
|
2003-11-26 13:31:41 +00:00
|
|
|
{
|
2003-11-28 10:18:16 +00:00
|
|
|
::basegfx::B3DPolygon aCandidate = rCandidate.getB3DPolygon(a);
|
|
|
|
aRetval.expand(::basegfx::tools::getRange(aCandidate));
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRetval;
|
|
|
|
}
|
2003-11-26 13:31:41 +00:00
|
|
|
|
2003-11-28 10:18:16 +00:00
|
|
|
::basegfx::B3DPolyPolygon applyLineDashing(const ::basegfx::B3DPolyPolygon& rCandidate, const ::std::vector<double>& raDashDotArray, double fFullDashDotLen)
|
|
|
|
{
|
|
|
|
::basegfx::B3DPolyPolygon aRetval;
|
2003-11-26 13:31:41 +00:00
|
|
|
|
2004-08-03 12:31:17 +00:00
|
|
|
if(0.0 == fFullDashDotLen && raDashDotArray.size())
|
2003-11-28 10:18:16 +00:00
|
|
|
{
|
2004-08-03 12:31:17 +00:00
|
|
|
// calculate fFullDashDotLen from raDashDotArray
|
|
|
|
fFullDashDotLen = ::std::accumulate(raDashDotArray.begin(), raDashDotArray.end(), 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(rCandidate.count() && fFullDashDotLen > 0.0)
|
|
|
|
{
|
|
|
|
for(sal_uInt32 a(0L); a < rCandidate.count(); a++)
|
|
|
|
{
|
|
|
|
::basegfx::B3DPolygon aCandidate = rCandidate.getB3DPolygon(a);
|
|
|
|
aRetval.append(applyLineDashing(aCandidate, raDashDotArray, fFullDashDotLen));
|
|
|
|
}
|
2003-11-26 13:31:41 +00:00
|
|
|
}
|
2003-11-28 10:18:16 +00:00
|
|
|
|
|
|
|
return aRetval;
|
|
|
|
}
|
|
|
|
} // end of namespace tools
|
2003-11-26 13:31:41 +00:00
|
|
|
} // end of namespace basegfx
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// eof
|