sp-path.cpp revision f6615d53f68134f258cf4a6bb32dfc289ceaefbe
/*
* 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 "event-context.h"
#include "inkscape.h"
#include "style.h"
#include "message-stack.h"
#include "selection.h"
#define noPATH_VERBOSE
static Inkscape::XML::Node *sp_path_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static SPShapeClass *parent_class;
/**
* Gets the GType object for SPPathClass
*/
sp_path_get_type(void)
{
if (!type) {
sizeof(SPPathClass),
sizeof(SPPath),
16,
NULL, /* value_table */
};
}
return type;
}
/**
* Does the object-oriented work of initializing the class structure
* including parent class, and registers function pointers for
* the functions build, set, write, and set_transform.
*/
static void
{
}
{
}
static gchar *
{
{
break;
if (s.empty())
else
}
} else {
}
}
static void
{
return;
}
// only add curves for straight line segments
if( is_straight_curve(*cit) )
{
}
}
}
}
/**
* Initializes an SPPath.
*/
static void
{
}
static void
{
}
/**
* Given a repr, this sets the data items in the path object such as
* fill & style attributes, markers, and CSS properties.
*/
static void
{
/* Are these calls actually necessary? */
}
/* d is a required attribute */
if (d == NULL) {
}
}
static void
{
}
}
/**
* Sets a value in the path object given by 'key', to 'value'. This is used
* for setting attributes and markers on a path object.
*/
static void
{
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;
}
}
/**
*
* Writes the path object into a Inkscape::XML::Node
*/
sp_path_write(SPObject *object, 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) {
} else {
}
}
}
return repr;
}
static void
{
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
}
}
}
/**
* Writes the given transform into the repr for the given item.
*/
{
if (!SP_IS_PATH(item)) {
}
}
// Transform the original-d path if this is a valid LPE item, other else the (ordinary) path
if (sp_lpe_item_has_path_effect_of_type(SP_LPE_ITEM(item), Inkscape::LivePathEffect::CLONE_ORIGINAL)) {
// if path has the CLONE_ORIGINAL LPE applied, don't write the transform to the pathdata, but write it 'unoptimized'
return xform;
} else {
}
} else {
}
// Adjust stroke
// Adjust pattern fill
// Adjust gradient fill
// Adjust LPE
// nothing remains - we've written all of the transform, so return identity
}
static void
{
#ifdef PATH_VERBOSE
g_message("sp_path_update_patheffect");
#endif
/* 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 shape->getRepr()->updateRepr(); but only the d attribute needs updating.
#ifdef PATH_VERBOSE
g_message("sp_path_update_patheffect writes 'd' attribute");
#endif
} 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.
*/
{
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.
*/
{
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!
*/
{
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 :