blob: 75ac206528f2582c947f21f4ab0dbd7c901e5945 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* SVG <polyline> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Abhishek Sharma
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 1999-2002 Lauris Kaplinski
*
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
#include "attributes.h"
#include "sp-polygon.h"
#include "sp-polyline.h"
#include "display/curve.h"
#include <glibmm/i18n.h>
#include "xml/repr.h"
#include "document.h"
SPPolyLine::SPPolyLine() : SPShape() {
}
SPPolyLine::~SPPolyLine() = default;
void SPPolyLine::build(SPDocument * document, Inkscape::XML::Node * repr) {
SPShape::build(document, repr);
this->readAttr(SPAttr::POINTS);
}
void SPPolyLine::set(SPAttr key, const gchar* value) {
switch (key) {
case SPAttr::POINTS:
if (value) {
setCurve(sp_poly_parse_curve(value));
}
break;
default:
SPShape::set(key, value);
break;
}
}
Inkscape::XML::Node* SPPolyLine::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
repr = xml_doc->createElement("svg:polyline");
}
if (repr != this->getRepr()) {
repr->mergeFrom(this->getRepr(), "id");
}
SPShape::write(xml_doc, repr, flags);
return repr;
}
const char* SPPolyLine::typeName() const {
return "path";
}
gchar* SPPolyLine::description() const {
return g_strdup(_("<b>Polyline</b>"));
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
|