Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D.cxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#include <drawinglayer/primitive2d/PolyPolygonMarkerPrimitive2D.hxx>
21
#include <drawinglayer/primitive2d/PolygonMarkerPrimitive2D.hxx>
22
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
23
24
#include <basegfx/polygon/b2dpolypolygontools.hxx>
25
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
26
#include <utility>
27
28
using namespace com::sun::star;
29
30
namespace drawinglayer::primitive2d
31
{
32
Primitive2DReference PolyPolygonMarkerPrimitive2D::create2DDecomposition(
33
    const geometry::ViewInformation2D& /*rViewInformation*/) const
34
0
{
35
0
    const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
36
0
    const sal_uInt32 nCount(aPolyPolygon.count());
37
38
0
    Primitive2DContainer aContainer;
39
0
    for (sal_uInt32 a(0); a < nCount; a++)
40
0
    {
41
0
        aContainer.push_back(new PolygonMarkerPrimitive2D(aPolyPolygon.getB2DPolygon(a),
42
0
                                                          getRGBColorA(), getRGBColorB(),
43
0
                                                          getDiscreteDashLength()));
44
0
    }
45
0
    return new GroupPrimitive2D(std::move(aContainer));
46
0
}
47
48
PolyPolygonMarkerPrimitive2D::PolyPolygonMarkerPrimitive2D(basegfx::B2DPolyPolygon aPolyPolygon,
49
                                                           const basegfx::BColor& rRGBColorA,
50
                                                           const basegfx::BColor& rRGBColorB,
51
                                                           double fDiscreteDashLength)
52
0
    : maPolyPolygon(std::move(aPolyPolygon))
53
0
    , maRGBColorA(rRGBColorA)
54
0
    , maRGBColorB(rRGBColorB)
55
0
    , mfDiscreteDashLength(fDiscreteDashLength)
56
0
{
57
0
}
58
59
bool PolyPolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
60
0
{
61
0
    if (BufferedDecompositionPrimitive2D::operator==(rPrimitive))
62
0
    {
63
0
        const PolyPolygonMarkerPrimitive2D& rCompare
64
0
            = static_cast<const PolyPolygonMarkerPrimitive2D&>(rPrimitive);
65
66
0
        return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
67
0
                && getRGBColorA() == rCompare.getRGBColorA()
68
0
                && getRGBColorB() == rCompare.getRGBColorB()
69
0
                && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
70
0
    }
71
72
0
    return false;
73
0
}
74
75
basegfx::B2DRange PolyPolygonMarkerPrimitive2D::getB2DRange(
76
    const geometry::ViewInformation2D& /*rViewInformation*/) const
77
0
{
78
    // return range
79
0
    return getB2DPolyPolygon().getB2DRange();
80
0
}
81
82
// provide unique ID
83
sal_uInt32 PolyPolygonMarkerPrimitive2D::getPrimitive2DID() const
84
0
{
85
0
    return PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D;
86
0
}
87
88
} // end drawinglayer::primitive2d namespace
89
90
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */