summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 77ff648)
raw | patch | inline | side by side (parent: 77ff648)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 18 May 2008 14:09:46 +0000 (14:09 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 18 May 2008 14:09:46 +0000 (14:09 +0000) |
src/2geom/Makefile_insert | patch | blob | history | |
src/2geom/forward.h | [new file with mode: 0644] | patch | blob |
src/2geom/isnan.h | patch | blob | history | |
src/2geom/path.cpp | patch | blob | history | |
src/2geom/path.h | patch | blob | history | |
src/2geom/pathvector.cpp | [new file with mode: 0644] | patch | blob |
src/2geom/pathvector.h | [new file with mode: 0644] | patch | blob |
index ef82b75251f8ec6a577a7351528b09442440ad80..6f2a3e642cbfcf16687dd797fda297575a80ee58 100644 (file)
2geom/d2-sbasis.h \\r
2geom/d2.h \\r
2geom/exception.h \\r
+ 2geom/forward.h \\r
2geom/geom.cpp \\r
2geom/geom.h \\r
2geom/interval.h \\r
2geom/path-intersection.h \\r
2geom/path.cpp \\r
2geom/path.h \\r
+ 2geom/pathvector.cpp \\r
+ 2geom/pathvector.h \\r
2geom/piecewise.cpp \\r
2geom/piecewise.h \\r
2geom/point-l.h \\r
diff --git a/src/2geom/forward.h b/src/2geom/forward.h
--- /dev/null
+++ b/src/2geom/forward.h
@@ -0,0 +1,98 @@
+/*
+ * forward - this file contains forward declarations of 2geom types
+ *
+ * Authors:
+ * Johan Engelen <goejendaagh@zonnet.nl>
+ *
+ * Copyright 2008 authors
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ */
+
+#ifndef SEEN_GEOM_FORWARD_H
+#define SEEN_GEOM_FORWARD_H
+
+#include <vector> // include this dependency so PathVector can be defined more explicitly
+
+namespace Geom {
+
+template <unsigned> class BezierCurve;
+template<> class BezierCurve<0>;
+typedef BezierCurve<2> QuadraticBezier;
+typedef BezierCurve<1> LineSegment;
+typedef BezierCurve<3> CubicBezier;
+
+typedef double Coord;
+class Point;
+
+class Exception;
+class LogicalError;
+class RangeError;
+class NotImplemented;
+class InvariantsViolation;
+class NotInvertible;
+class ContinuityError;
+
+class Interval;
+class Linear;
+class Hat;
+class Tri;
+
+class Matrix;
+class Translate;
+class Rotate;
+class Scale;
+
+class Curve;
+class Path;
+typedef std::vector<Path> PathVector;
+
+template <class> class D2;
+template <typename> class Piecewise;
+class SBasis;
+class SBasisCurve;
+
+typedef D2<Interval> Rect;
+
+class Shape;
+class Region;
+
+class SVGEllipticalArc;
+class SVGPathSink;
+template <typename> class SVGPathGenerator;
+
+}
+
+#endif // SEEN_GEOM_FORWARD_H
+
+/*
+ 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 :
diff --git a/src/2geom/isnan.h b/src/2geom/isnan.h
index decebc7d27ad41410ecb7baa7a0e6248c28c724e..96a70f6dcf5c1939cfe5d6874c1796ef1b797d06 100644 (file)
--- a/src/2geom/isnan.h
+++ b/src/2geom/isnan.h
-#ifndef __ISNAN_H__
-#define __ISNAN_H__
+#ifndef _2GEOM_ISNAN_H__
+#define _2GEOM_ISNAN_H__
/*
* Temporary fix for various misdefinitions of isnan().
*/
-#endif /* __ISNAN_H__ */
+#endif /* _2GEOM_ISNAN_H__ */
/*
Local Variables:
diff --git a/src/2geom/path.cpp b/src/2geom/path.cpp
index fdfa77c791cf36d9a02d98590c53c6bdb5db14ec..3effa93746d833f276a5a0e6e9c109664de9a90a 100644 (file)
--- a/src/2geom/path.cpp
+++ b/src/2geom/path.cpp
do_append(new SBasisCurve(curve));
}
+void Path::append(Path const &other)
+{
+ // Check that path stays continuous:
+ if ( !are_near( finalPoint(), other.initialPoint() ) ) {
+ THROW_CONTINUITYERROR();
+ }
+
+ insert(begin(), other.begin(), other.end());
+}
+
void Path::do_update(Sequence::iterator first_replaced,
Sequence::iterator last_replaced,
Sequence::iterator first,
diff --git a/src/2geom/path.h b/src/2geom/path.h
index ed15260fc40ba488f95fcf311aeb53120f69e807..0493b4a593555d0d7641776d6a41b793ecd496b7 100644 (file)
--- a/src/2geom/path.h
+++ b/src/2geom/path.h
ret.append(*temp);
delete temp;
}
+ ret.closed_ = closed_;
return ret;
}
do_update(first.impl_, last.impl_, curves_.begin(), curves_.begin());
}
+ // erase last segment of path
+ void erase_last() {
+ erase(curves_.end()-2);
+ }
+
void replace(iterator replaced, Curve const &curve) {
Sequence source(1, curve.duplicate());
try {
void append(Curve const &curve);
void append(D2<SBasis> const &curve);
+ void append(Path const &other);
template <typename CurveType, typename A>
void appendNew(A a) {
diff --git a/src/2geom/pathvector.cpp b/src/2geom/pathvector.cpp
--- /dev/null
+++ b/src/2geom/pathvector.cpp
@@ -0,0 +1,82 @@
+/*
+ * PathVector - std::vector containing Geom::Path
+ * This file provides a set of operations that can be performed on PathVector,
+ * e.g. an affine transform.
+ *
+ * Authors:
+ * Johan Engelen <goejendaagh@zonnet.nl>
+ *
+ * Copyright 2008 authors
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ */
+
+#ifndef SEEN_GEOM_PATHVECTOR_CPP
+#define SEEN_GEOM_PATHVECTOR_CPP
+
+#include "pathvector.h"
+
+#include "path.h"
+#include "matrix.h"
+
+namespace Geom {
+
+// TODO: see which of these functions can be inlined for optimization
+
+PathVector operator* (PathVector const & path_in, Matrix const &m)
+{
+ PathVector path_out;
+ for(PathVector::const_iterator it = path_in.begin(); it != path_in.end(); ++it) {
+ path_out.push_back( (*it) * m );
+ }
+ return path_out;
+}
+
+/**
+ * Reverses all Paths and the order of paths in the vector as well
+ **/
+PathVector reverse_paths_and_order (PathVector const & path_in)
+{
+ PathVector path_out;
+ for (PathVector::const_reverse_iterator it = path_in.rbegin(); it != path_in.rend(); it++) {
+ path_out.push_back( (*it).reverse() );
+ }
+ return path_out;
+}
+
+
+} // namespace Geom
+
+#endif // SEEN_GEOM_PATHVECTOR_CPP
+
+/*
+ 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 :
diff --git a/src/2geom/pathvector.h b/src/2geom/pathvector.h
--- /dev/null
+++ b/src/2geom/pathvector.h
@@ -0,0 +1,62 @@
+/*
+ * PathVector - std::vector containing Geom::Path
+ * This file provides a set of operations that can be performed on PathVector,
+ * e.g. an affine transform.
+ *
+ * Authors:
+ * Johan Engelen <goejendaagh@zonnet.nl>
+ *
+ * Copyright 2008 authors
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ */
+
+#ifndef SEEN_GEOM_PATHVECTOR_H
+#define SEEN_GEOM_PATHVECTOR_H
+
+#include "forward.h"
+
+namespace Geom {
+
+typedef std::vector<Geom::Path> PathVector;
+
+
+PathVector operator* (PathVector const & path_in, Matrix const &m);
+
+PathVector reverse_paths_and_order (PathVector const & path_in);
+
+}
+
+#endif // SEEN_GEOM_PATHVECTOR_H
+
+/*
+ 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 :