1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski #ifndef _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX 23*b1cdbd2cSJim Jagielski #define _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX 24*b1cdbd2cSJim Jagielski 25*b1cdbd2cSJim Jagielski #include <basegfx/point/b2dpoint.hxx> 26*b1cdbd2cSJim Jagielski #include <basegfx/vector/b2dvector.hxx> 27*b1cdbd2cSJim Jagielski #include <basegfx/polygon/b2dpolygon.hxx> 28*b1cdbd2cSJim Jagielski #include <basegfx/polygon/b3dpolypolygon.hxx> 29*b1cdbd2cSJim Jagielski #include <com/sun/star/drawing/PointSequenceSequence.hpp> 30*b1cdbd2cSJim Jagielski #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> 31*b1cdbd2cSJim Jagielski #include <vector> 32*b1cdbd2cSJim Jagielski #include <set> 33*b1cdbd2cSJim Jagielski 34*b1cdbd2cSJim Jagielski namespace rtl 35*b1cdbd2cSJim Jagielski { 36*b1cdbd2cSJim Jagielski class OUString; 37*b1cdbd2cSJim Jagielski } 38*b1cdbd2cSJim Jagielski 39*b1cdbd2cSJim Jagielski ////////////////////////////////////////////////////////////////////////////// 40*b1cdbd2cSJim Jagielski 41*b1cdbd2cSJim Jagielski namespace basegfx 42*b1cdbd2cSJim Jagielski { 43*b1cdbd2cSJim Jagielski // predefinitions 44*b1cdbd2cSJim Jagielski class B2DPolyPolygon; 45*b1cdbd2cSJim Jagielski class B2DRange; 46*b1cdbd2cSJim Jagielski 47*b1cdbd2cSJim Jagielski namespace tools 48*b1cdbd2cSJim Jagielski { 49*b1cdbd2cSJim Jagielski // B2DPolyPolygon tools 50*b1cdbd2cSJim Jagielski 51*b1cdbd2cSJim Jagielski // Check and evtl. correct orientations of all contained Polygons so that 52*b1cdbd2cSJim Jagielski // the orientations of contained polygons will variate to express areas and 53*b1cdbd2cSJim Jagielski // holes 54*b1cdbd2cSJim Jagielski B2DPolyPolygon correctOrientations(const B2DPolyPolygon& rCandidate); 55*b1cdbd2cSJim Jagielski 56*b1cdbd2cSJim Jagielski // make sure polygon with index 0L is not a hole. This may evtl. change the 57*b1cdbd2cSJim Jagielski // sequence of polygons, but allows to use polygon with index 0L to 58*b1cdbd2cSJim Jagielski // get the correct normal for the whole polyPolygon 59*b1cdbd2cSJim Jagielski B2DPolyPolygon correctOutmostPolygon(const B2DPolyPolygon& rCandidate); 60*b1cdbd2cSJim Jagielski 61*b1cdbd2cSJim Jagielski // Subdivide all contained curves. Use distanceBound value if given. 62*b1cdbd2cSJim Jagielski B2DPolyPolygon adaptiveSubdivideByDistance(const B2DPolyPolygon& rCandidate, double fDistanceBound = 0.0); 63*b1cdbd2cSJim Jagielski 64*b1cdbd2cSJim Jagielski // Subdivide all contained curves. Use distanceBound value if given. Else, a convenient one 65*b1cdbd2cSJim Jagielski // is created. 66*b1cdbd2cSJim Jagielski B2DPolyPolygon adaptiveSubdivideByAngle(const B2DPolyPolygon& rCandidate, double fAngleBound = 0.0); 67*b1cdbd2cSJim Jagielski 68*b1cdbd2cSJim Jagielski // Subdivide all contained curves. Use nCount divisions if given. Else, a convenient one 69*b1cdbd2cSJim Jagielski // is created. 70*b1cdbd2cSJim Jagielski B2DPolyPolygon adaptiveSubdivideByCount(const B2DPolyPolygon& rCandidate, sal_uInt32 nCount = 0L); 71*b1cdbd2cSJim Jagielski 72*b1cdbd2cSJim Jagielski // isInside test for B2dPoint. On border is not inside as long as not true is given 73*b1cdbd2cSJim Jagielski // in bWithBorder flag. It is assumed that the orientations of the given polygon are correct. 74*b1cdbd2cSJim Jagielski bool isInside(const B2DPolyPolygon& rCandidate, const B2DPoint& rPoint, bool bWithBorder = false); 75*b1cdbd2cSJim Jagielski 76*b1cdbd2cSJim Jagielski /** get range of PolyPolygon. Control points are included. 77*b1cdbd2cSJim Jagielski 78*b1cdbd2cSJim Jagielski For detailed description look at getRangeWithControlPoints(const B2DPolygon&). 79*b1cdbd2cSJim Jagielski This method just expands by the range of every sub-Polygon. 80*b1cdbd2cSJim Jagielski 81*b1cdbd2cSJim Jagielski @param rCandidate 82*b1cdbd2cSJim Jagielski The B2DPolyPolygon eventually containing bezier segments 83*b1cdbd2cSJim Jagielski 84*b1cdbd2cSJim Jagielski @return 85*b1cdbd2cSJim Jagielski The outer range including control points 86*b1cdbd2cSJim Jagielski */ 87*b1cdbd2cSJim Jagielski B2DRange getRangeWithControlPoints(const B2DPolyPolygon& rCandidate); 88*b1cdbd2cSJim Jagielski 89*b1cdbd2cSJim Jagielski /** Get the range of a polyPolygon 90*b1cdbd2cSJim Jagielski 91*b1cdbd2cSJim Jagielski For detailed description look at getRange(const B2DPolygon&). 92*b1cdbd2cSJim Jagielski This method just expands by the range of every sub-Polygon. 93*b1cdbd2cSJim Jagielski 94*b1cdbd2cSJim Jagielski @param rCandidate 95*b1cdbd2cSJim Jagielski The B2DPolyPolygon eventually containing bezier segments 96*b1cdbd2cSJim Jagielski 97*b1cdbd2cSJim Jagielski @return 98*b1cdbd2cSJim Jagielski The outer range of the polygon 99*b1cdbd2cSJim Jagielski */ 100*b1cdbd2cSJim Jagielski B2DRange getRange(const B2DPolyPolygon& rCandidate); 101*b1cdbd2cSJim Jagielski 102*b1cdbd2cSJim Jagielski // get signed area of polygon 103*b1cdbd2cSJim Jagielski double getSignedArea(const B2DPolyPolygon& rCandidate); 104*b1cdbd2cSJim Jagielski 105*b1cdbd2cSJim Jagielski // get area of polygon 106*b1cdbd2cSJim Jagielski double getArea(const B2DPolyPolygon& rCandidate); 107*b1cdbd2cSJim Jagielski 108*b1cdbd2cSJim Jagielski /** Apply given LineDashing to given polyPolygon 109*b1cdbd2cSJim Jagielski 110*b1cdbd2cSJim Jagielski For a description see applyLineDashing in b2dpolygontoos.hxx 111*b1cdbd2cSJim Jagielski */ 112*b1cdbd2cSJim Jagielski void applyLineDashing( 113*b1cdbd2cSJim Jagielski const B2DPolyPolygon& rCandidate, 114*b1cdbd2cSJim Jagielski const ::std::vector<double>& rDotDashArray, 115*b1cdbd2cSJim Jagielski B2DPolyPolygon* pLineTarget, 116*b1cdbd2cSJim Jagielski B2DPolyPolygon* pGapTarget = 0, 117*b1cdbd2cSJim Jagielski double fFullDashDotLen = 0.0); 118*b1cdbd2cSJim Jagielski 119*b1cdbd2cSJim Jagielski // test if point is inside epsilon-range around the given PolyPolygon. Can be used 120*b1cdbd2cSJim Jagielski // for HitTesting. The epsilon-range is defined to be the tube around the PolyPolygon 121*b1cdbd2cSJim Jagielski // with distance fDistance and rounded edges (start and end point). 122*b1cdbd2cSJim Jagielski bool isInEpsilonRange(const B2DPolyPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance); 123*b1cdbd2cSJim Jagielski 124*b1cdbd2cSJim Jagielski /** Helper class to transport PointIndices to a PolyPolygon, 125*b1cdbd2cSJim Jagielski with an operator< for convenient sorting in a std::set usage 126*b1cdbd2cSJim Jagielski */ 127*b1cdbd2cSJim Jagielski class PointIndex 128*b1cdbd2cSJim Jagielski { 129*b1cdbd2cSJim Jagielski private: 130*b1cdbd2cSJim Jagielski sal_uInt32 mnPolygonIndex; 131*b1cdbd2cSJim Jagielski sal_uInt32 mnPointIndex; 132*b1cdbd2cSJim Jagielski 133*b1cdbd2cSJim Jagielski public: PointIndex(sal_uInt32 nPolygonIndex,sal_uInt32 nPointIndex)134*b1cdbd2cSJim Jagielski PointIndex(sal_uInt32 nPolygonIndex, sal_uInt32 nPointIndex) 135*b1cdbd2cSJim Jagielski : mnPolygonIndex(nPolygonIndex), 136*b1cdbd2cSJim Jagielski mnPointIndex(nPointIndex) 137*b1cdbd2cSJim Jagielski {} 138*b1cdbd2cSJim Jagielski getPolygonIndex() const139*b1cdbd2cSJim Jagielski sal_uInt32 getPolygonIndex() const { return mnPolygonIndex; } getPointIndex() const140*b1cdbd2cSJim Jagielski sal_uInt32 getPointIndex() const { return mnPointIndex; } 141*b1cdbd2cSJim Jagielski bool operator<(const PointIndex& rComp) const; 142*b1cdbd2cSJim Jagielski }; 143*b1cdbd2cSJim Jagielski 144*b1cdbd2cSJim Jagielski /** the PointIndexSet itself; it allows to define a 'selection'of 145*b1cdbd2cSJim Jagielski points in a PolyPolygon by giving the polygon and point index. 146*b1cdbd2cSJim Jagielski Adding points double makes no sense, hence the std::set 147*b1cdbd2cSJim Jagielski */ 148*b1cdbd2cSJim Jagielski typedef std::set< PointIndex > PointIndexSet; 149*b1cdbd2cSJim Jagielski 150*b1cdbd2cSJim Jagielski /** Read poly-polygon from SVG. 151*b1cdbd2cSJim Jagielski 152*b1cdbd2cSJim Jagielski This function imports a poly-polygon from an SVG-D 153*b1cdbd2cSJim Jagielski attribute. Currently, elliptical arc elements are not yet 154*b1cdbd2cSJim Jagielski supported (and ignored during parsing). 155*b1cdbd2cSJim Jagielski 156*b1cdbd2cSJim Jagielski @param o_rPolyPoly 157*b1cdbd2cSJim Jagielski The output poly-polygon 158*b1cdbd2cSJim Jagielski 159*b1cdbd2cSJim Jagielski @param rSvgDAttribute 160*b1cdbd2cSJim Jagielski A valid SVG-D attribute string 161*b1cdbd2cSJim Jagielski 162*b1cdbd2cSJim Jagielski @param bHandleRelativeNextPointCompatible 163*b1cdbd2cSJim Jagielski If set to true, the old error that after a relative 'z' command 164*b1cdbd2cSJim Jagielski the current point was not reset to the first point of the current 165*b1cdbd2cSJim Jagielski polygon is kept; this is needed to read odf files. 166*b1cdbd2cSJim Jagielski If false, pure svg is used; this is needed for svg import. 167*b1cdbd2cSJim Jagielski 168*b1cdbd2cSJim Jagielski @param pHelpPointIndexSet 169*b1cdbd2cSJim Jagielski If given, all points created in the target PolyPolygon 170*b1cdbd2cSJim Jagielski which are only helper points are added here using their 171*b1cdbd2cSJim Jagielski point indices; this are currently points created from 172*b1cdbd2cSJim Jagielski import of the 'a' and 'A' svg:d statements which create 173*b1cdbd2cSJim Jagielski bezier curve info as representation and maybe points 174*b1cdbd2cSJim Jagielski which are no 'real' svg:d points, but helper points. It 175*b1cdbd2cSJim Jagielski is necessary to identify these e.g. when markers need to 176*b1cdbd2cSJim Jagielski be created in the svg import 177*b1cdbd2cSJim Jagielski 178*b1cdbd2cSJim Jagielski @return true, if the string was successfully parsed 179*b1cdbd2cSJim Jagielski */ 180*b1cdbd2cSJim Jagielski 181*b1cdbd2cSJim Jagielski bool importFromSvgD( 182*b1cdbd2cSJim Jagielski B2DPolyPolygon& o_rPolyPoly, 183*b1cdbd2cSJim Jagielski const ::rtl::OUString& rSvgDAttribute, 184*b1cdbd2cSJim Jagielski bool bHandleRelativeNextPointCompatible, 185*b1cdbd2cSJim Jagielski PointIndexSet* pHelpPointIndexSet); 186*b1cdbd2cSJim Jagielski 187*b1cdbd2cSJim Jagielski // grow for polyPolygon. Move all geometry in each point in the direction of the normal in that point 188*b1cdbd2cSJim Jagielski // with the given amount. Value may be negative. 189*b1cdbd2cSJim Jagielski B2DPolyPolygon growInNormalDirection(const B2DPolyPolygon& rCandidate, double fValue); 190*b1cdbd2cSJim Jagielski 191*b1cdbd2cSJim Jagielski // This method will correct a pair of polyPolygons where the goal is to keep same point count 192*b1cdbd2cSJim Jagielski // to allow direct point association and also to remove self-intersections produced by shrinks. 193*b1cdbd2cSJim Jagielski // This method will eventually change both polyPolygons to reach that goal because there are cases 194*b1cdbd2cSJim Jagielski // where it is necessary to add new cut points to the original 195*b1cdbd2cSJim Jagielski void correctGrowShrinkPolygonPair(B2DPolyPolygon& rOriginal, B2DPolyPolygon& rGrown); 196*b1cdbd2cSJim Jagielski 197*b1cdbd2cSJim Jagielski // force all sub-polygons to a point count of nSegments 198*b1cdbd2cSJim Jagielski B2DPolyPolygon reSegmentPolyPolygon(const B2DPolyPolygon& rCandidate, sal_uInt32 nSegments); 199*b1cdbd2cSJim Jagielski 200*b1cdbd2cSJim Jagielski // create polygon state at t from 0.0 to 1.0 between the two polygons. Both polygons must have the same 201*b1cdbd2cSJim Jagielski // organisation, e.g. same amount of polygons 202*b1cdbd2cSJim Jagielski B2DPolyPolygon interpolate(const B2DPolyPolygon& rOld1, const B2DPolyPolygon& rOld2, double t); 203*b1cdbd2cSJim Jagielski 204*b1cdbd2cSJim Jagielski // create 3d PolyPolygon from given 2d PolyPolygon. The given fZCoordinate is used to expand the 205*b1cdbd2cSJim Jagielski // third coordinate. 206*b1cdbd2cSJim Jagielski B3DPolyPolygon createB3DPolyPolygonFromB2DPolyPolygon(const B2DPolyPolygon& rCandidate, double fZCoordinate = 0.0); 207*b1cdbd2cSJim Jagielski 208*b1cdbd2cSJim Jagielski // create 2d PolyPolygon from given 3d PolyPolygon. All coordinates are transformed using the given 209*b1cdbd2cSJim Jagielski // matrix and the resulting x,y is used to form the new polygon. 210*b1cdbd2cSJim Jagielski B2DPolyPolygon createB2DPolyPolygonFromB3DPolyPolygon(const B3DPolyPolygon& rCandidate, const B3DHomMatrix& rMat); 211*b1cdbd2cSJim Jagielski 212*b1cdbd2cSJim Jagielski // for each contained edge in each contained polygon calculate the smallest distance. Return the index to the smallest 213*b1cdbd2cSJim Jagielski // edge in rEdgeIndex and the index to the polygon in rPolygonIndex. The relative position on the edge is returned in rCut. 214*b1cdbd2cSJim Jagielski // If nothing was found (e.g. empty input plygon), DBL_MAX is returned. 215*b1cdbd2cSJim Jagielski double getSmallestDistancePointToPolyPolygon(const B2DPolyPolygon& rCandidate, const B2DPoint& rTestPoint, sal_uInt32& rPolygonIndex, sal_uInt32& rEdgeIndex, double& rCut); 216*b1cdbd2cSJim Jagielski 217*b1cdbd2cSJim Jagielski // distort PolyPolygon. rOriginal describes the original range, where the given points describe the distorted 218*b1cdbd2cSJim Jagielski // corresponding points. 219*b1cdbd2cSJim Jagielski B2DPolyPolygon distort(const B2DPolyPolygon& rCandidate, const B2DRange& rOriginal, const B2DPoint& rTopLeft, const B2DPoint& rTopRight, const B2DPoint& rBottomLeft, const B2DPoint& rBottomRight); 220*b1cdbd2cSJim Jagielski 221*b1cdbd2cSJim Jagielski // rotate PolyPolygon around given point with given angle. 222*b1cdbd2cSJim Jagielski B2DPolyPolygon rotateAroundPoint(const B2DPolyPolygon& rCandidate, const B2DPoint& rCenter, double fAngle); 223*b1cdbd2cSJim Jagielski 224*b1cdbd2cSJim Jagielski // expand all segments (which are not yet) to curve segments. This is done with setting the control 225*b1cdbd2cSJim Jagielski // vectors on the 1/3 resp. 2/3 distances on each segment. 226*b1cdbd2cSJim Jagielski B2DPolyPolygon expandToCurve(const B2DPolyPolygon& rCandidate); 227*b1cdbd2cSJim Jagielski 228*b1cdbd2cSJim Jagielski // set continuity for the whole curve. If not a curve, nothing will change. Non-curve points are not changed, too. 229*b1cdbd2cSJim Jagielski B2DPolyPolygon setContinuity(const B2DPolyPolygon& rCandidate, B2VectorContinuity eContinuity); 230*b1cdbd2cSJim Jagielski 231*b1cdbd2cSJim Jagielski /** Predicate whether a given poly-polygon is a rectangle. 232*b1cdbd2cSJim Jagielski 233*b1cdbd2cSJim Jagielski @param rPoly 234*b1cdbd2cSJim Jagielski PolyPolygon to check 235*b1cdbd2cSJim Jagielski 236*b1cdbd2cSJim Jagielski @return true, if the poly-polygon describes a rectangle 237*b1cdbd2cSJim Jagielski (contains exactly one polygon, polygon is closed, and the 238*b1cdbd2cSJim Jagielski points are either cw or ccw enumerations of a rectangle's 239*b1cdbd2cSJim Jagielski vertices). Note that intermediate points and duplicate 240*b1cdbd2cSJim Jagielski points are ignored. 241*b1cdbd2cSJim Jagielski */ 242*b1cdbd2cSJim Jagielski bool isRectangle( const B2DPolyPolygon& rPoly ); 243*b1cdbd2cSJim Jagielski 244*b1cdbd2cSJim Jagielski /** Export poly-polygon to SVG. 245*b1cdbd2cSJim Jagielski 246*b1cdbd2cSJim Jagielski This function exports a poly-polygon into an SVG-D 247*b1cdbd2cSJim Jagielski statement. Currently, output of relative point sequences 248*b1cdbd2cSJim Jagielski is not yet supported (might cause slightly larger output) 249*b1cdbd2cSJim Jagielski 250*b1cdbd2cSJim Jagielski @param rPolyPoly 251*b1cdbd2cSJim Jagielski The poly-polygon to export 252*b1cdbd2cSJim Jagielski 253*b1cdbd2cSJim Jagielski @param bUseRelativeCoordinates 254*b1cdbd2cSJim Jagielski When true, all coordinate values are exported as relative 255*b1cdbd2cSJim Jagielski to the current position. This tends to save some space, 256*b1cdbd2cSJim Jagielski since fewer digits needs to be written. 257*b1cdbd2cSJim Jagielski 258*b1cdbd2cSJim Jagielski @param bDetectQuadraticBeziers 259*b1cdbd2cSJim Jagielski When true, the export tries to detect cubic bezier 260*b1cdbd2cSJim Jagielski segments in the input polygon, which can be represented by 261*b1cdbd2cSJim Jagielski quadratic bezier segments. Note that the generated string 262*b1cdbd2cSJim Jagielski causes versions prior to OOo2.0 to crash. 263*b1cdbd2cSJim Jagielski 264*b1cdbd2cSJim Jagielski @param bHandleRelativeNextPointCompatible 265*b1cdbd2cSJim Jagielski If set to true, the old error that after a relative 'z' command 266*b1cdbd2cSJim Jagielski the current point was not reset to the first point of the current 267*b1cdbd2cSJim Jagielski polygon is kept; this is needed to read odf files. 268*b1cdbd2cSJim Jagielski If false, pure svg is used; this is needed for svg import. 269*b1cdbd2cSJim Jagielski 270*b1cdbd2cSJim Jagielski @return the generated SVG-D statement (the XML d attribute 271*b1cdbd2cSJim Jagielski value alone, without any "<path ...>" or "d="...") 272*b1cdbd2cSJim Jagielski */ 273*b1cdbd2cSJim Jagielski ::rtl::OUString exportToSvgD( 274*b1cdbd2cSJim Jagielski const B2DPolyPolygon& rPolyPoly, 275*b1cdbd2cSJim Jagielski bool bUseRelativeCoordinates, 276*b1cdbd2cSJim Jagielski bool bDetectQuadraticBeziers, 277*b1cdbd2cSJim Jagielski bool bHandleRelativeNextPointCompatible); 278*b1cdbd2cSJim Jagielski 279*b1cdbd2cSJim Jagielski // #i76891# Try to remove existing curve segments if they are simply edges 280*b1cdbd2cSJim Jagielski B2DPolyPolygon simplifyCurveSegments(const B2DPolyPolygon& rCandidate); 281*b1cdbd2cSJim Jagielski 282*b1cdbd2cSJim Jagielski /** split each edge of a polyPolygon in exactly nSubEdges equidistant edges 283*b1cdbd2cSJim Jagielski 284*b1cdbd2cSJim Jagielski @param rCandidate 285*b1cdbd2cSJim Jagielski The source polyPolygon. If too small (no edges), nSubEdges too small (<2) 286*b1cdbd2cSJim Jagielski or neither bHandleCurvedEdgesnor bHandleStraightEdges it will just be returned. 287*b1cdbd2cSJim Jagielski Else for each edge nSubEdges will be created. Closed state is preserved. 288*b1cdbd2cSJim Jagielski 289*b1cdbd2cSJim Jagielski @param nSubEdges 290*b1cdbd2cSJim Jagielski @param bHandleCurvedEdges 291*b1cdbd2cSJim Jagielski @param bHandleStraightEdges 292*b1cdbd2cSJim Jagielski Please take a look at reSegmentPolygonEdges description, these are the same. 293*b1cdbd2cSJim Jagielski */ 294*b1cdbd2cSJim Jagielski B2DPolyPolygon reSegmentPolyPolygonEdges(const B2DPolyPolygon& rCandidate, sal_uInt32 nSubEdges, bool bHandleCurvedEdges, bool bHandleStraightEdges); 295*b1cdbd2cSJim Jagielski 296*b1cdbd2cSJim Jagielski ////////////////////////////////////////////////////////////////////// 297*b1cdbd2cSJim Jagielski // comparators with tolerance for 2D PolyPolygons 298*b1cdbd2cSJim Jagielski bool equal(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB, const double& rfSmallValue); 299*b1cdbd2cSJim Jagielski bool equal(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB); 300*b1cdbd2cSJim Jagielski 301*b1cdbd2cSJim Jagielski /** snap some polygon coordinates to discrete coordinates 302*b1cdbd2cSJim Jagielski 303*b1cdbd2cSJim Jagielski This method allows to snap some polygon points to discrete (integer) values 304*b1cdbd2cSJim Jagielski which equals e.g. a snap to discrete coordinates. It will snap points of 305*b1cdbd2cSJim Jagielski horizontal and vertical edges 306*b1cdbd2cSJim Jagielski 307*b1cdbd2cSJim Jagielski @param rCandidate 308*b1cdbd2cSJim Jagielski The source polygon 309*b1cdbd2cSJim Jagielski 310*b1cdbd2cSJim Jagielski @return 311*b1cdbd2cSJim Jagielski The modified version of the source polygon 312*b1cdbd2cSJim Jagielski */ 313*b1cdbd2cSJim Jagielski B2DPolyPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolyPolygon& rCandidate); 314*b1cdbd2cSJim Jagielski 315*b1cdbd2cSJim Jagielski /** returns true if the Polygon only contains horizontal or vertical edges 316*b1cdbd2cSJim Jagielski so that it could be represented by RegionBands 317*b1cdbd2cSJim Jagielski */ 318*b1cdbd2cSJim Jagielski bool containsOnlyHorizontalAndVerticalEdges(const B2DPolyPolygon& rCandidate); 319*b1cdbd2cSJim Jagielski 320*b1cdbd2cSJim Jagielski /// converters for com::sun::star::drawing::PointSequence 321*b1cdbd2cSJim Jagielski B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon( 322*b1cdbd2cSJim Jagielski const com::sun::star::drawing::PointSequenceSequence& rPointSequenceSequenceSource, 323*b1cdbd2cSJim Jagielski bool bCheckClosed = true); 324*b1cdbd2cSJim Jagielski void B2DPolyPolygonToUnoPointSequenceSequence( 325*b1cdbd2cSJim Jagielski const B2DPolyPolygon& rPolyPolygon, 326*b1cdbd2cSJim Jagielski com::sun::star::drawing::PointSequenceSequence& rPointSequenceSequenceRetval); 327*b1cdbd2cSJim Jagielski 328*b1cdbd2cSJim Jagielski /// converters for com::sun::star::drawing::PolyPolygonBezierCoords (curved polygons) 329*b1cdbd2cSJim Jagielski B2DPolyPolygon UnoPolyPolygonBezierCoordsToB2DPolyPolygon( 330*b1cdbd2cSJim Jagielski const com::sun::star::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsSource, 331*b1cdbd2cSJim Jagielski bool bCheckClosed = true); 332*b1cdbd2cSJim Jagielski void B2DPolyPolygonToUnoPolyPolygonBezierCoords( 333*b1cdbd2cSJim Jagielski const B2DPolyPolygon& rPolyPolygon, 334*b1cdbd2cSJim Jagielski com::sun::star::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsRetval); 335*b1cdbd2cSJim Jagielski 336*b1cdbd2cSJim Jagielski } // end of namespace tools 337*b1cdbd2cSJim Jagielski } // end of namespace basegfx 338*b1cdbd2cSJim Jagielski 339*b1cdbd2cSJim Jagielski #endif /* _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX */ 340