sp-path.cpp revision dd32fcd5e58afb82b0cbd042de0179902124f8c8
/*
* SVG <path> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* David Turner <novalis@gnu.org>
* Abhishek Sharma
* Johan Engelen
*
* Copyright (C) 2004 David Turner
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
* Copyright (C) 1999-2012 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "live_effects/effect.h"
#include "live_effects/lpeobject.h"
#include "live_effects/lpeobject-reference.h"
#include "sp-lpe-item.h"
#include "helper/geom-curves.h"
#include "attributes.h"
#include "sp-path.h"
#include "sp-guide.h"
#include "document.h"
#include "desktop.h"
#include "desktop-handles.h"
#include "desktop-style.h"
#include "ui/tools/tool-base.h"
#include "inkscape.h"
#include "style.h"
#include "message-stack.h"
#include "selection.h"
#define noPATH_VERBOSE
#include "sp-factory.h"
namespace {
SPObject* createPath() {
return new SPPath();
}
}
{
}
const char* SPPath::displayName() const {
return _("Path");
}
int count = this->nodesInPath();
if (hasPathEffect()) {
{
break;
}
if (s.empty()) {
} else {
}
}
}
return ret;
}
void SPPath::convert_to_guides() const {
if (!this->_curve) {
return;
}
// only add curves for straight line segments
if( is_straight_curve(*cit) )
{
}
}
}
}
}
}
/* Are these calls actually necessary? */
this->readAttr( "marker" );
this->readAttr( "marker-start" );
this->readAttr( "marker-mid" );
this->readAttr( "marker-end" );
sp_conn_end_pair_build(this);
// this->readAttr( "inkscape:original-d" ); // lp1299948
{
// write it to XML, and to my curve, but don't update patheffects
if (_curve_before_lpe) {
}
if (curve) {
}
}
this->readAttr( "d" );
/* d is a required attribute */
if (d == NULL) {
}
}
this->connEndPair.release();
}
switch (key) {
if (value) {
if (curve) {
}
} else {
}
break;
case SP_ATTR_D:
if (value) {
if (curve) {
}
} else {
}
break;
case SP_PROP_MARKER:
case SP_PROP_MARKER_START:
case SP_PROP_MARKER_MID:
case SP_PROP_MARKER_END:
break;
case SP_ATTR_CONNECTOR_TYPE:
case SP_ATTR_CONNECTION_START:
case SP_ATTR_CONNECTION_END:
break;
default:
break;
}
}
Inkscape::XML::Node* SPPath::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
}
#ifdef PATH_VERBOSE
g_message("sp_path_write writes 'd' attribute");
#endif
} else {
}
if (flags & SP_OBJECT_WRITE_EXT) {
if ( this->_curve_before_lpe != NULL ) {
} else {
}
}
return repr;
}
if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
flags &= ~SP_OBJECT_USER_MODIFIED_FLAG_B; // since we change the description, it's not a "just translation" anymore
}
this->connEndPair.update();
}
if (!_curve) { // 0 nodes, nothing to transform
}
// Transform the original-d path if this is a valid LPE this, other else the (ordinary) path
if (_curve_before_lpe && hasPathEffectRecursive()) {
// if path has the CLONE_ORIGINAL LPE applied, don't write the transform to the pathdata, but write it 'unoptimized'
return transform;
} else {
}
} else {
}
// Adjust stroke
// Adjust pattern fill
this->adjust_pattern(transform);
// Adjust gradient fill
this->adjust_gradient(transform);
// Adjust LPE
this->adjust_livepatheffect(transform);
// nothing remains - we've written all of the transform, so return identity
}
#ifdef PATH_VERBOSE
g_message("sp_path_update_patheffect");
#endif
if (_curve_before_lpe && hasPathEffectRecursive()) {
/* if a path has an lpeitem applied, then reset the curve to the _curve_before_lpe.
* This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/
// could also do this->getRepr()->updateRepr(); but only the d attribute needs updating.
#ifdef PATH_VERBOSE
g_message("sp_path_update_patheffect writes 'd' attribute");
#endif
if (_curve) {
} else {
}
} else if (!success) {
// LPE was unsuccesfull. Read the old 'd'-attribute.
if (oldcurve) {
}
}
}
}
}
/**
* Adds a original_curve to the path. If owner is specified, a reference
* will be made, otherwise the curve will be copied into the path.
* Any existing curve in the path will be unreferenced first.
* This routine triggers reapplication of an effect if present
* and also triggers a request to update the display. Does not write
* result to XML when write=false.
*/
{
if (_curve_before_lpe) {
}
if (new_curve) {
if (owner) {
} else {
}
}
sp_lpe_item_update_patheffect(this, true, write);
}
/**
* Return duplicate of _curve_before_lpe (if any exists) or NULL if there is no curve
*/
{
if (_curve_before_lpe) {
return _curve_before_lpe->copy();
}
return NULL;
}
/**
* Return duplicate of edittable curve which is _curve_before_lpe if it exists or
* shape->curve if not.
*/
{
if (_curve_before_lpe && hasPathEffectRecursive()) {
return get_original_curve();
} else {
return getCurve();
}
}
/**
* Returns \c _curve_before_lpe if it is not NULL and a valid LPE is applied or
* \c curve if not.
*/
{
if (_curve_before_lpe && hasPathEffectRecursive()) {
return _curve_before_lpe;
} else {
return _curve;
}
}
/**
* Returns \c _curve_before_lpe if it is not NULL and a valid LPE is applied or \c curve if not.
* \todo should only be available to class friends!
*/
{
if (_curve_before_lpe && hasPathEffectRecursive()) {
return _curve_before_lpe;
} else {
return _curve;
}
}
/*
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 :