From 0ea9b448ee16fe941d46395c2877f4d2e815b9ed Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 23 May 2012 14:00:49 +0200 Subject: Add Mesh tool (experimental, requires Cario >= 1.11.4, disabled by default). (bzr r11406) --- src/sp-mesh-patch.cpp | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/sp-mesh-patch.cpp (limited to 'src/sp-mesh-patch.cpp') diff --git a/src/sp-mesh-patch.cpp b/src/sp-mesh-patch.cpp new file mode 100644 index 000000000..ff1a18a01 --- /dev/null +++ b/src/sp-mesh-patch.cpp @@ -0,0 +1,63 @@ +/** @file + * @gradient meshpatch class. + */ +/* Authors: + * Lauris Kaplinski + * bulia byak + * Johan Engelen + * Jon A. Cruz + * Tavmjong Bah + * + * Copyright (C) 1999,2005 authors + * Copyright (C) 2010 Jon A. Cruz + * Copyright (C) 2012 Tavmjong Bah + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ +#include "sp-mesh-patch.h" +#include "style.h" + +SPMeshPatch* SPMeshPatch::getNextMeshPatch() +{ + SPMeshPatch *result = 0; + + for (SPObject* obj = getNext(); obj && !result; obj = obj->getNext()) { + if (SP_IS_MESHPATCH(obj)) { + result = SP_MESHPATCH(obj); + } + } + + return result; +} + +SPMeshPatch* SPMeshPatch::getPrevMeshPatch() +{ + SPMeshPatch *result = 0; + + for (SPObject* obj = getPrev(); obj; obj = obj->getPrev()) { + // The closest previous SPObject that is an SPMeshPatch *should* be ourself. + if (SP_IS_MESHPATCH(obj)) { + SPMeshPatch* meshpatch = SP_MESHPATCH(obj); + // Sanity check to ensure we have a proper sibling structure. + if (meshpatch->getNextMeshPatch() == this) { + result = meshpatch; + } else { + g_warning("SPMeshPatch previous/next relationship broken"); + } + break; + } + } + + return result; +} + +/* + 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:fileencoding=utf-8:textwidth=99 : -- cgit v1.2.3