193
193
ctx->renderPathVector(pathv, style, &pbox);
195
for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) {
197
for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START
198
if ( shape->marker[i] ) {
199
SPMarker* marker = SP_MARKER (shape->marker[i]);
196
for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START
197
if ( shape->marker[i] ) {
198
SPMarker* marker = SP_MARKER (shape->marker[i]);
200
if (marker->orient_auto) {
201
tr = sp_shape_marker_get_transform_at_start(pathv.begin()->front());
203
tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(pathv.begin()->front().pointAt(0));
205
sp_shape_render_invoke_marker_rendering(marker, tr, style, ctx);
209
for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID
210
if ( !shape->marker[i] ) continue;
211
SPMarker* marker = SP_MARKER (shape->marker[i]);
212
for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) {
214
if ( path_it != pathv.begin()
215
&& ! ((path_it == (pathv.end()-1)) && (path_it->size_default() == 0)) ) // if this is the last path and it is a moveto-only, there is no mid marker there
201
218
if (marker->orient_auto) {
202
219
tr = sp_shape_marker_get_transform_at_start(path_it->front());
206
223
sp_shape_render_invoke_marker_rendering(marker, tr, style, ctx);
211
for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID
212
if ( shape->marker[i] && (path_it->size_default() > 1) ) {
226
if (path_it->size_default() > 1) {
213
227
Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve
214
228
Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve
215
229
while (curve_it2 != path_it->end_default())
217
231
/* Put marker between curve_it1 and curve_it2.
218
232
* Loop to end_default (so including closing segment), because when a path is closed,
219
233
* there should be a midpoint marker between last segment and closing straight line segment */
221
SPMarker* marker = SP_MARKER (shape->marker[i]);
224
235
if (marker->orient_auto) {
225
236
tr = sp_shape_marker_get_transform(*curve_it1, *curve_it2);
239
for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END
240
if ( shape->marker[i] ) {
241
SPMarker* marker = SP_MARKER (shape->marker[i]);
243
/* Get reference to last curve in the path.
244
* For moveto-only path, this returns the "closing line segment". */
245
unsigned int index = path_it->size_default();
249
Geom::Curve const &lastcurve = (*path_it)[index];
248
if ( path_it != (pathv.end()-1) && !path_it->empty()) {
249
Geom::Curve const &lastcurve = path_it->back_default();
252
251
if (marker->orient_auto) {
253
252
tr = sp_shape_marker_get_transform_at_end(lastcurve);
255
254
tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(lastcurve.pointAt(1));
258
256
sp_shape_render_invoke_marker_rendering(marker, tr, style, ctx);
261
for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END
262
if ( shape->marker[i] ) {
263
SPMarker* marker = SP_MARKER (shape->marker[i]);
265
/* Get reference to last curve in the path.
266
* For moveto-only path, this returns the "closing line segment". */
267
Geom::Path const &path_last = pathv.back();
268
unsigned int index = path_last.size_default();
272
Geom::Curve const &lastcurve = path_last[index];
275
if (marker->orient_auto) {
276
tr = sp_shape_marker_get_transform_at_end(lastcurve);
278
tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(lastcurve.pointAt(1));
281
sp_shape_render_invoke_marker_rendering(marker, tr, style, ctx);
264
286
static void sp_group_render(SPItem *item, CairoRenderContext *ctx)