Kaydet (Commit) 83b3349b authored tarafından Caolán McNamara's avatar Caolán McNamara

refactor ensuring polygon has at least a line in it

just split that out into a standalone function, no logic
change

Change-Id: I061d5d716b3fc2a9fb6385e7fb249ce300752130
üst 8d5f4717
......@@ -40,26 +40,14 @@ namespace sdr
{
}
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence() const
static sal_uInt32 ensureGeometry(basegfx::B2DPolyPolygon& rUnitPolyPolygon)
{
const SfxItemSet& rItemSet = GetPathObj().GetMergedItemSet();
const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
rItemSet,
GetPathObj().getText(0),
false));
basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly());
Point aGridOff = GetPathObj().GetGridOffset();
// Hack for calc, transform position of object according
// to current zoom so as objects relative position to grid
// appears stable
aUnitPolyPolygon.transform( basegfx::tools::createTranslateB2DHomMatrix( aGridOff.X(), aGridOff.Y() ) );
sal_uInt32 nPolyCount(aUnitPolyPolygon.count());
sal_uInt32 nPolyCount(rUnitPolyPolygon.count());
sal_uInt32 nPointCount(0);
for(sal_uInt32 a(0); a < nPolyCount; a++)
{
nPointCount += aUnitPolyPolygon.getB2DPolygon(a).count();
nPointCount += rUnitPolyPolygon.getB2DPolygon(a).count();
}
if(!nPointCount)
......@@ -68,11 +56,30 @@ namespace sdr
basegfx::B2DPolygon aFallbackLine;
aFallbackLine.append(basegfx::B2DPoint(0.0, 0.0));
aFallbackLine.append(basegfx::B2DPoint(1000.0, 1000.0));
aUnitPolyPolygon = basegfx::B2DPolyPolygon(aFallbackLine);
rUnitPolyPolygon = basegfx::B2DPolyPolygon(aFallbackLine);
nPolyCount = 1;
}
return nPolyCount;
}
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence() const
{
const SfxItemSet& rItemSet = GetPathObj().GetMergedItemSet();
const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
rItemSet,
GetPathObj().getText(0),
false));
basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly());
Point aGridOff = GetPathObj().GetGridOffset();
// Hack for calc, transform position of object according
// to current zoom so as objects relative position to grid
// appears stable
aUnitPolyPolygon.transform( basegfx::tools::createTranslateB2DHomMatrix( aGridOff.X(), aGridOff.Y() ) );
sal_uInt32 nPolyCount(ensureGeometry(aUnitPolyPolygon));
// prepare object transformation and unit polygon (direct model data)
basegfx::B2DHomMatrix aObjectMatrix;
const bool bIsLine(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment