sp-ellipse.cpp revision baa74b7b366585fca6d90ece888c678f580cb5d9
#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/n-art-bpath.h"
#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 "prefs-utils.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 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) {
if (abp) {
} else {
}
} else {
}
}
}
#define C1 0.552
/* fixme: Think (Lauris) */
{
double len;
gint i;
// figure out if we have a slice, guarding against rounding errors
} else {
}
i = 0;
} else {
}
i++;
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
i++;
}
i++;
i++;
}
sp_curve_unref(c);
}
{
// figure out if we have a slice, whilst 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;
}
}
// And if we have a slice, also snap to the endpoints and the centre point
if (slice) {
// Add the centre, if we have a closed slice
}
// 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::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::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
{
g_print ("sp_ellipse_build\n");
}
{
}
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::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
{
}
{
}
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 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;
}
{
}
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 :