sp-ellipse.cpp revision c88be829a2fccea2277bdfcd362db30b26da43a3
#define __SP_ELLIPSE_C__
/*
* SVG <ellipse> and related implementations
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Mitsuru Oka
* bulia byak <buliabyak@users.sf.net>
*
* 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 "libnr/nr-matrix-fns.h"
#include "svg/path-string.h"
#include "attributes.h"
#include "style.h"
#include "document.h"
#include "sp-ellipse.h"
#include "preferences.h"
/* Common parent class */
#define noELLIPSE_VERBOSE
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#if 1
/* Hmmm... shouldn't this also qualify */
/* Whether it is faster or not, well, nobody knows */
#define sp_round(v,m) (((v) < 0.0) ? ((ceil((v) / (m) - 0.5)) * (m)) : ((floor((v) / (m) + 0.5)) * (m)))
#else
/* we do not use C99 round(3) function yet */
static double sp_round(double x, double y)
{
double remain;
g_assert(y > 0.0);
/* return round(x/y) * y; */
if (remain >= 0.5*y)
return x - remain + y;
else
return x - remain;
}
#endif
static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const *snapprefs);
static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr,
static SPShapeClass *ge_parent_class;
{
if (!type) {
sizeof(SPGenericEllipseClass),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof(SPGenericEllipse),
16, /* n_preallocs */
NULL, /* value_table */
};
}
return type;
}
{
}
static void
{
}
static void
{
if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
}
}
static void
{
if (write) {
} else {
}
}
}
#define C1 0.552
/* fixme: Think (Lauris) */
/* Can't we use arcto in this method? */
{
double len;
// gint i;
// figure out if we have a slice, guarding against rounding errors
} else {
}
e = s + M_PI_2;
#ifdef ELLIPSE_VERBOSE
g_print("step %d s %f e %f coords %f %f %f %f %f %f\n",
#endif
}
}
}
Geom::Matrix aff = Geom::Scale(rx, ry) * Geom::Translate(ellipse->cx.computed, ellipse->cy.computed);
/* Reset the shape'scurve to the "original_curve"
* This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/
if (sp_lpe_item_has_path_effect(SP_LPE_ITEM(shape)) && sp_lpe_item_path_effects_enabled(SP_LPE_ITEM(shape))) {
if (success) {
}
}
}
static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const *snapprefs)
{
// Help enforcing strict snapping, i.e. only return nodes when we're snapping nodes to nodes or a guide to nodes
return;
}
// figure out if we have a slice, while guarding against rounding errors
bool slice = false;
slice = false;
} else {
slice = true;
}
// Snap to the 4 quadrant points of the ellipse, but only if the arc
// spans far enough to include them
double angle = 0;
}
}
}
// Add the centre, if we have a closed slice or when explicitly asked for
if ((snapprefs->getSnapToItemNode() && slice && ellipse->closed) || snapprefs->getSnapObjectMidpoints()) {
}
// And if we have a slice, also snap to the endpoints
// Add the start point, if it's not coincident with a quadrant point
}
// Add the end point, if it's not coincident with a quadrant point
}
}
}
void
{
if (diff >= 0.0)
/* Now we keep: 0 <= start < end <= 2*PI */
}
static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
if (flags & SP_OBJECT_WRITE_EXT) {
}
}
return repr;
}
/* SVG <ellipse> element */
static Inkscape::XML::Node *sp_ellipse_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
sp_ellipse_get_type(void)
{
if (!type) {
sizeof(SPEllipseClass),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof(SPEllipse),
16, /* n_preallocs */
NULL, /* value_table */
};
}
return type;
}
{
}
static void
{
/* Nothing special */
}
static void
{
}
sp_ellipse_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
}
return repr;
}
static void
{
switch (key) {
case SP_ATTR_CX:
break;
case SP_ATTR_CY:
break;
case SP_ATTR_RX:
}
break;
case SP_ATTR_RY:
}
break;
default:
break;
}
}
{
return g_strdup(_("<b>Ellipse</b>"));
}
void
{
}
/* SVG <circle> element */
static Inkscape::XML::Node *sp_circle_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static SPGenericEllipseClass *circle_parent_class;
sp_circle_get_type(void)
{
if (!type) {
sizeof(SPCircleClass),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof(SPCircle),
16, /* n_preallocs */
NULL, /* value_table */
};
}
return type;
}
static void
{
}
static void
{
/* Nothing special */
}
static void
{
}
sp_circle_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
}
return repr;
}
static void
{
switch (key) {
case SP_ATTR_CX:
break;
case SP_ATTR_CY:
break;
case SP_ATTR_R:
}
break;
default:
break;
}
}
{
return g_strdup(_("<b>Circle</b>"));
}
/* <path sodipodi:type="arc"> element */
static Inkscape::XML::Node *sp_arc_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static SPGenericEllipseClass *arc_parent_class;
sp_arc_get_type(void)
{
if (!type) {
sizeof(SPArcClass),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof(SPArc),
16, /* n_preallocs */
NULL, /* value_table */
};
}
return type;
}
static void
{
}
static void
{
/* Nothing special */
}
static void
{
}
/*
* sp_arc_set_elliptical_path_attribute:
*
* Convert center to endpoint parameterization and set it to repr.
*
* See SVG 1.0 Specification W3C Recommendation
* ``F.6 Ellptical arc implementation notes'' for more detail.
*/
static gboolean
{
.closePath();
} else {
}
}
return true;
}
sp_arc_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
}
if (flags & SP_OBJECT_WRITE_EXT) {
// write start and end only if they are non-trivial; otherwise remove
} else {
}
}
// write d=
return repr;
}
static void
{
switch (key) {
case SP_ATTR_SODIPODI_CX:
break;
case SP_ATTR_SODIPODI_CY:
break;
case SP_ATTR_SODIPODI_RX:
}
break;
case SP_ATTR_SODIPODI_RY:
}
break;
case SP_ATTR_SODIPODI_START:
if (value) {
} else {
}
break;
case SP_ATTR_SODIPODI_END:
if (value) {
} else {
}
break;
case SP_ATTR_SODIPODI_OPEN:
break;
default:
break;
}
}
static void
{
if (flags & SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG) {
}
}
{
return g_strdup(_("<b>Segment</b>"));
} else {
return g_strdup(_("<b>Arc</b>"));
}
} else {
return g_strdup(_("<b>Ellipse</b>"));
}
}
void
{
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:encoding=utf-8:textwidth=99 :