sp-path.cpp revision c4f75b909578d5859096825f8c1487849d9b544a
/*
* SVG <path> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* David Turner <novalis@gnu.org>
* Abhishek Sharma
*
* Copyright (C) 2004 David Turner
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
*
* 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
{
}
{
if (!curve)
return 0;
return curve->nodes_in_path();
}
static gchar *
{
{
break;
if (s.empty())
else
}
} else {
}
}
static void
{
if (!curve) 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
} 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.
*/
void
{
if (path->curve_before_lpe) {
}
if (curve) {
if (owner) {
} else {
}
}
}
/**
* Return duplicate of curve_before_lpe (if any exists) or NULL if there is no curve
*/
SPCurve *
{
if (path->curve_before_lpe) {
}
return NULL;
}
/**
* Return duplicate of edittable curve which is curve_before_lpe if it exists or
* shape->curve if not.
*/
{
if (!SP_IS_PATH(path)) {
return NULL;
}
return sp_path_get_original_curve(path);
} else {
}
}
/**
* Returns \c curve_before_lpe if it is not NULL and a valid LPE is applied or
* \c curve if not.
*/
const SPCurve*
{
if (!SP_IS_PATH(path)) {
return NULL;
}
return path->curve_before_lpe;
} else {
}
}
/**
* 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 (!SP_IS_PATH(path)) {
return NULL;
}
return path->curve_before_lpe;
} else {
}
}
/*
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 :