odf.cpp revision 83a298afaee287cf58fc2273fd61664e584f9784
606N/A#ifdef HAVE_CONFIG_H
#include "clear-n_.h"
#include "inkscape.h"
#include <style.h>
#include "libnr/n-art-bpath.h"
#include "xml/attribute-record.h"
#include "sp-image.h"
#include "sp-gradient.h"
#include "sp-linear-gradient.h"
#include "sp-radial-gradient.h"
#include "sp-path.h"
#include "sp-text.h"
#include "sp-flowtext.h"
#include "text-editing.h"
#include "dom/io/domstream.h"
#include "dom/io/bufferstream.h"
namespace Inkscape
namespace Extension
namespace Internal
#include <math.h>
class SVDMatrix
d = new double[size];
for (unsigned int i=0 ; i<size ; i++)
d = new double[size];
for (unsigned int i=0 ; i<size ; i++)
d[i] = vals[i];
virtual ~SVDMatrix()
return badval;
return badval;
unsigned int getRows()
return rows;
unsigned int getCols()
return cols;
return dummy;
for (unsigned int i=0 ; i<rows ; i++)
for (unsigned int k=0 ; k<cols ; k++)
return result;
for (unsigned int i=0 ; i<rows ; i++)
for (unsigned int j=0 ; j<cols ; j++)
return result;
d = new double[size];
for (unsigned int i=0 ; i<size ; i++)
d[i] = other.d[i];
double badval;
unsigned int rows;
unsigned int cols;
unsigned int size;
A = mat;
calculate();
virtual ~SingularValueDecomposition()
double norm2();
double cond();
int rank();
void calculate();
SVDMatrix A;
SVDMatrix U;
unsigned int s_size;
SVDMatrix V;
static double svd_hypot(double a, double b)
int m = A.getRows();
int n = A.getCols();
int nu = (m > n) ? m : n;
s = new double[s_size];
V = SVDMatrix(n, n);
double *work = new double[m];
bool wantu = true;
bool wantv = true;
if (k < nct) {
s[k] = svd_hypot(s[k],A(i, k));
if (k < nrt) {
e[k] = svd_hypot(e[k],e[i]);
work[i] += e[j]*A(i, j);
A(i, j) += t*work[i];
if (wantv) {
if (nct < n) {
if (wantu) {
if (wantv) {
int iter = 0;
int k,kase;
if (fabs(e[k]) <=
int ks;
if (ks == k) {
if (ks == k) {
k = ks;
switch (kase) {
double t = svd_hypot(s[j],f);
double cs = s[j]/t;
double sn = f/t;
if (wantv) {
double t = svd_hypot(s[j],f);
double cs = s[j]/t;
double sn = f/t;
f = -sn*e[j];
e[j] = cs*e[j];
if (wantu) {
d = fabs(s[k]);
d = fabs(e[k]);
double t = svd_hypot(f,g);
double cs = f/t;
double sn = g/t;
if (wantv) {
t = svd_hypot(f,g);
cs = f/t;
sn = g/t;
if (wantv) {
for (int i = 0; i <= pp; i++) {
while (k < pp) {
iter = 0;
delete work;
return s[index];
if (s[i] > tol)
if (valstr)
return val;
return ext;
return str;
return tf;
return bbox;
return itemTransform;
if (!reprobj)
//g_message("native path:%s", pathName.c_str());
if (ze)
bool isGradient = false;
//g_message("## %s %lx", id.c_str(), (unsigned int)fillCol);
isGradient = true;
bool gradientMatch = false;
//g_message("found duplicate style:%s", gradientName.c_str());
gradientMatch = true;
if (!gradientMatch)
if (!isGradient)
bool styleMatch = false;
//g_message("found duplicate style:%s", styleName.c_str());
styleMatch = true;
if (!styleMatch)
outs.printf("<!DOCTYPE manifest:manifest PUBLIC \"-//OpenOffice.org//DTD Manifest 1.0//EN\" \"Manifest.dtd\">\n");
outs.printf("<manifest:manifest xmlns:manifest=\"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0\">\n");
outs.printf(" <manifest:file-entry manifest:media-type=\"application/vnd.oasis.opendocument.graphics\" manifest:full-path=\"/\"/>\n");
outs.printf(" <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"content.xml\"/>\n");
outs.printf(" <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"meta.xml\"/>\n");
outs.printf("<style:style style:name=\"gr1\" style:family=\"graphic\" style:parent-style-name=\"standard\">\n");
bool closed = false;
case NR_LINETO:
case NR_CURVETO:
case NR_MOVETO_OPEN:
case NR_MOVETO:
if (closed)
if (closed)
if (!reprobj)
double rotate;
double xskew;
double yskew;
double xscale;
double yscale;
//g_message("##### %s #####", nodeName.c_str());
//g_message("### %s is a shape", nodeName.c_str());
if (curve)
//trans.scale(12.0, 12.0);
reset();
"<mimetype>text/x-povray-script</mimetype>\n"
new OdfOutput());
return TRUE;