diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-04-01 12:18:34 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-04-01 12:18:34 +0000 |
| commit | aea84844cf40c4c1b1977548421ec50ad164590e (patch) | |
| tree | 1362e7df57fca3ca0477dbafebb43b590218e914 /src | |
| parent | More cleanup of code structure. (diff) | |
| download | inkscape-aea84844cf40c4c1b1977548421ec50ad164590e.tar.gz inkscape-aea84844cf40c4c1b1977548421ec50ad164590e.zip | |
add documentation
(bzr r13645.1.65)
Diffstat (limited to 'src')
| -rw-r--r-- | src/helper/geom-pathinfo.cpp | 38 | ||||
| -rw-r--r-- | src/helper/geom-pathinfo.h | 32 | ||||
| -rw-r--r-- | src/helper/geom-pointwise.cpp | 60 | ||||
| -rw-r--r-- | src/helper/geom-pointwise.h | 59 | ||||
| -rw-r--r-- | src/helper/geom-satellite-enum.h | 26 | ||||
| -rw-r--r-- | src/helper/geom-satellite.cpp | 93 | ||||
| -rw-r--r-- | src/helper/geom-satellite.h | 44 |
7 files changed, 142 insertions, 210 deletions
diff --git a/src/helper/geom-pathinfo.cpp b/src/helper/geom-pathinfo.cpp index 4bacad7ea..19991e879 100644 --- a/src/helper/geom-pathinfo.cpp +++ b/src/helper/geom-pathinfo.cpp @@ -1,32 +1,11 @@ -/* - * pathinfo.cpp +/** + * \file + * \brief Pathinfo store the data of a pathvector and allow get info about it + *//* * Authors: * 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es> - * Copyright 2015 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, output 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. * + * This code is in public domain */ #include <helper/geom-pathinfo.h> @@ -34,6 +13,10 @@ namespace Geom { +/** + * @brief Pathinfo store the data of a pathvector and allow get info about it + * + */ Pathinfo::Pathinfo(Piecewise<D2<SBasis> > pwd2) : _pwd2(pwd2) { @@ -49,7 +32,8 @@ Pathinfo::setPwd2(Piecewise<D2<SBasis> > pwd2_in) setPathInfo(); } - +/** Store the base path data + */ void Pathinfo::setPathInfo() { diff --git a/src/helper/geom-pathinfo.h b/src/helper/geom-pathinfo.h index 9018e44f2..9a40a4f20 100644 --- a/src/helper/geom-pathinfo.h +++ b/src/helper/geom-pathinfo.h @@ -1,35 +1,11 @@ /** * \file - * \brief Pathinfo + * \brief Pathinfo store the data of a pathvector and allow get info about it *//* * Authors: * 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es> - * Copyright 2015 authors - * - * Pathinfo maintains .... - * 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, output 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. * + * This code is in public domain */ #ifndef SEEN_GEOM_PATHINFO_H @@ -41,9 +17,9 @@ namespace Geom { /** - * %Pathinfo function class. + * @brief Pathinfo store the data of a pathvector and allow get info about it + * */ - class Pathinfo { public: diff --git a/src/helper/geom-pointwise.cpp b/src/helper/geom-pointwise.cpp index 9096dff28..9e65685ae 100644 --- a/src/helper/geom-pointwise.cpp +++ b/src/helper/geom-pointwise.cpp @@ -1,32 +1,11 @@ -/* - * pointwise.cpp +/** + * \file + * \brief Pointwise a class to manage a vector of satellites per piecewise curve + *//* * Authors: * 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es> - * Copyright 2015 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, output 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. * + * This code is in public domain */ #include <helper/geom-pointwise.h> @@ -34,6 +13,19 @@ namespace Geom { +/** + * @brief Pointwise a class to manage a vector of satellites per piecewise curve + * + * For the moment is a per curve satellite holder not per node. This is ok for + * much cases but not a real node satellite on open paths + * To implement this we can: + * add extra satellite in open paths, and take notice of current open paths + * or put extra satellites on back for each open subpath + * + * Also maybe the vector of satellites become a vector of + * optional satellites, and remove the active variable in satellites. + * + */ Pointwise::Pointwise(Piecewise<D2<SBasis> > pwd2, std::vector<Satellite> satellites) : _pwd2(pwd2), _satellites(satellites), _pathInfo(pwd2) { @@ -68,6 +60,8 @@ Pointwise::setSatellites(std::vector<Satellite> sats) setStart(); } +/** Update the start satellite on ope/closed paths. + */ void Pointwise::setStart() { @@ -85,6 +79,8 @@ Pointwise::setStart() } } +/** Fired when a path is modified. + */ void Pointwise::recalculate_for_new_pwd2(Piecewise<D2<SBasis> > A) { @@ -95,6 +91,8 @@ Pointwise::recalculate_for_new_pwd2(Piecewise<D2<SBasis> > A) } } +/** Some nodes/subpaths are removed. + */ void Pointwise::pwd2_sustract(Piecewise<D2<SBasis> > A) { @@ -112,7 +110,8 @@ Pointwise::pwd2_sustract(Piecewise<D2<SBasis> > A) setSatellites(sats); } - +/** Append nodes/subpaths to current pointwise + */ void Pointwise::pwd2_append(Piecewise<D2<SBasis> > A) { @@ -123,6 +122,7 @@ Pointwise::pwd2_append(Piecewise<D2<SBasis> > A) for(size_t i = 0; i < A.size(); i++){ size_t first = _pathInfo.getFirst(i-counter); size_t last = _pathInfo.getLast(i-counter); + //Check for subpath closed. If a subpath is closed, is not reversed or moved to back _pathInfo.setPwd2(A); size_t subpathAIndex = _pathInfo.getSubPathIndex(i); _pathInfo.setPwd2(_pwd2); @@ -133,7 +133,8 @@ Pointwise::pwd2_append(Piecewise<D2<SBasis> > A) changedSubpath = subpathAIndex != _pathInfo.getSubPathIndex(i-counter); } if(!reorder && first == i-counter && !are_near(_pwd2[i-counter].at0(),A[i].at0(),0.001) && !changedSubpath){ - subpath_to_top(_pathInfo.getSubPathIndex(first)); + //Send the modified subpath to back + subpath_to_back(_pathInfo.getSubPathIndex(first)); reorder = true; i--; continue; @@ -161,8 +162,9 @@ Pointwise::pwd2_append(Piecewise<D2<SBasis> > A) setSatellites(sats); } + void -Pointwise::subpath_to_top(size_t subpath){ +Pointwise::subpath_to_back(size_t subpath){ std::vector<Geom::Path> path_in = path_from_piecewise(remove_short_cuts(_pwd2,0.1), 0.001); size_t nSubpath = 0; size_t counter = 0; diff --git a/src/helper/geom-pointwise.h b/src/helper/geom-pointwise.h index 8297143c9..59ed4d1aa 100644 --- a/src/helper/geom-pointwise.h +++ b/src/helper/geom-pointwise.h @@ -1,43 +1,11 @@ /** * \file - * \brief Pointwise + * \brief Pointwise a class to manage a vector of satellites per piecewise curve *//* * Authors: * 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es> - * Copyright 2015 authors - * - * Pointwise maintains a set of "Satellite" positions along a curve/pathvector. - * The positions are specified as arc length distances along the curve or by - * time in the curve. Splicing operations automatically update the satellite - * positions to preserve the intent. - * The data is serialised to SVG using a specialiced pointwise LPE parameter to - * handle it in th future can be a inkscape based property to paths - * Anywhere a Piecewise is used, a Pointwise can be substituted, allowing - * existing algorithms to correctly update satellite positions. - - * 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, output 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. * + * This code is in public domain */ #ifndef SEEN_GEOM_POINTWISE_H @@ -53,29 +21,40 @@ #include <boost/optional.hpp> namespace Geom { + /** - * %Pointwise function class. + * @brief Pointwise a class to manage a vector of satellites per piecewise curve + * + * For the moment is a per curve satellite holder not per node. This is ok for + * much cases but not a real node satellite on open paths + * To implement this we can: + * add extra satellite in open paths, and take notice of current open paths + * or put extra satellites on back for each open subpath + * + * Also maybe the vector of satellites become a vector of + * optional satellites, and remove the active variable in satellites. + * */ - class Pointwise { public: Pointwise(Piecewise<D2<SBasis> > pwd2, std::vector<Satellite> satellites); virtual ~Pointwise(); - std::vector<Satellite> getSatellites() const; - void setSatellites(std::vector<Satellite> sats); Piecewise<D2<SBasis> > getPwd2() const; void setPwd2(Piecewise<D2<SBasis> > pwd2_in); + + std::vector<Satellite> getSatellites() const; + void setSatellites(std::vector<Satellite> sats); + void setStart(); void recalculate_for_new_pwd2(Piecewise<D2<SBasis> > A); void pwd2_sustract(Piecewise<D2<SBasis> > A); void pwd2_append(Piecewise<D2<SBasis> > A); - void subpath_to_top(size_t subpath); + void subpath_to_back(size_t subpath); void subpath_reverse(size_t start,size_t end); - private: Piecewise<D2<SBasis> > _pwd2; std::vector<Satellite> _satellites; diff --git a/src/helper/geom-satellite-enum.h b/src/helper/geom-satellite-enum.h index bcd8d1bb3..4680ce2f6 100644 --- a/src/helper/geom-satellite-enum.h +++ b/src/helper/geom-satellite-enum.h @@ -1,17 +1,17 @@ #ifndef LIB2GEOM_SEEN_SATELLITE_ENUM_H #define LIB2GEOM_SEEN_SATELLITE_ENUM_H -/* - * +/** + * \file + * \brief Satellite types enum + *//* + * Authors: + * 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es> * -* Copyright (C) Jabier Arraiza Cenoz <jabier.arraiza@marker.es> - * - * Released under GNU GPL, read the file 'COPYING' for more information + * This code is in public domain */ #include "util/enums.h" -/*#include <boost/bimap.hpp> -*/ namespace Geom { @@ -23,18 +23,6 @@ enum SatelliteType { KO // Invalid Satellite) }; -/* TODO maybe is best do next by bimap - typedef boost::bimap< Geom::SatelliteType,gchar const *> map_type ; - - map_type SatelliteTypeBimap; - - SatelliteTypeBimap.insert( map_type::value_type(FILLET, "FILLET")); - SatelliteTypeBimap.insert( map_type::value_type(INVERSE_FILLET, "INVERSE_FILLET")); - SatelliteTypeBimap.insert( map_type::value_type(CHAMFER, "CHAMFER")) ); - SatelliteTypeBimap.insert( map_type::value_type(INVERSE_CHAMFER, "INVERSE_CHAMFER")); - SatelliteTypeBimap.insert( map_type::value_type(INVALID_SATELLITE, "INVALID_SATELLITE")); -*/ - } //namespace Geom #endif diff --git a/src/helper/geom-satellite.cpp b/src/helper/geom-satellite.cpp index 73201445a..6304b4148 100644 --- a/src/helper/geom-satellite.cpp +++ b/src/helper/geom-satellite.cpp @@ -1,33 +1,11 @@ /** * \file - * \brief Satellite + * \brief Satellite a per ?node/curve holder of data. *//* * Authors: * 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es> - * Copyright 2015 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. + * This code is in public domain */ #include <helper/geom-satellite.h> @@ -42,6 +20,9 @@ namespace Geom { +/** + * @brief Satellite a per ?node/curve holder of data. + */ Satellite::Satellite(){}; Satellite::Satellite(SatelliteType satelliteType, bool isTime, bool active, bool hasMirror, bool hidden, double amount, double angle, size_t steps) @@ -49,6 +30,9 @@ Satellite::Satellite(SatelliteType satelliteType, bool isTime, bool active, bool Satellite::~Satellite() {}; +/** + * Calculate the time in d2_in with a size of A + */ double Satellite::toTime(double A,Geom::D2<Geom::SBasis> d2_in) const { @@ -74,6 +58,9 @@ Satellite::toTime(double A,Geom::D2<Geom::SBasis> d2_in) const return t; } +/** + * Calculate the size in d2_in with a point at A + */ double Satellite::toSize(double A,Geom::D2<Geom::SBasis> d2_in) const { @@ -94,7 +81,9 @@ Satellite::toSize(double A,Geom::D2<Geom::SBasis> d2_in) const return s; } - +/** + * Calculate the lenght of a satellite from a radious A input. + */ double Satellite::rad_to_len(double A, boost::optional<Geom::D2<Geom::SBasis> > d2_in, Geom::D2<Geom::SBasis> d2_out, boost::optional<Geom::Satellite> previousSatellite) const { @@ -118,6 +107,9 @@ Satellite::rad_to_len(double A, boost::optional<Geom::D2<Geom::SBasis> > d2_in, return len; } + /** + * Calculate the radious of a satellite from a lenght A input. + */ double Satellite::len_to_rad(double A, boost::optional<Geom::D2<Geom::SBasis> > d2_in, Geom::D2<Geom::SBasis> d2_out, boost::optional<Geom::Satellite> previousSatellite) const { @@ -157,17 +149,9 @@ Satellite::len_to_rad(double A, boost::optional<Geom::D2<Geom::SBasis> > d2_in, return 0; } -double -Satellite::getOpositeTime(double s, Geom::D2<Geom::SBasis> d2_in) const -{ - if(s == 0){ - return 1; - } - double lenghtPart = Geom::length(d2_in, Geom::EPSILON); - double size = lenghtPart - s; - return toTime(size, d2_in); -} - +/** + * Get the time position of the satellite in d2_in + */ double Satellite::getTime(Geom::D2<Geom::SBasis> d2_in) const { @@ -181,6 +165,29 @@ Satellite::getTime(Geom::D2<Geom::SBasis> d2_in) const return t; } +/**. + * Get the time from a lenght A in other curve, a bolean I gived to reverse time + */ +double +Satellite::getTime(double A, bool I, Geom::D2<Geom::SBasis> d2_in) const +{ + if(A == 0 && I){ + return 1; + } + if(A == 0 && !I){ + return 0; + } + if(!I){ + return toTime(A, d2_in); + } + double lenghtPart = Geom::length(d2_in, Geom::EPSILON); + A = lenghtPart - A; + return toTime(A, d2_in); +} + +/** + * Get the lenght of the satellite in d2_in + */ double Satellite::getSize(Geom::D2<Geom::SBasis> d2_in) const { @@ -191,7 +198,9 @@ Satellite::getSize(Geom::D2<Geom::SBasis> d2_in) const return s; } - +/** + * Get the point position of the satellite + */ Geom::Point Satellite::getPosition(Geom::D2<Geom::SBasis> d2_in) const { @@ -199,6 +208,9 @@ Satellite::getPosition(Geom::D2<Geom::SBasis> d2_in) const return d2_in.valueAt(t); } +/** + * Set the position of the satellite from a gived point P + */ void Satellite::setPosition(Geom::Point p, Geom::D2<Geom::SBasis> d2_in) { @@ -209,6 +221,9 @@ Satellite::setPosition(Geom::Point p, Geom::D2<Geom::SBasis> d2_in) amount = A; } +/** + * Map a satellite type with gchar + */ void Satellite::setSatelliteType(gchar const * A) { @@ -216,6 +231,10 @@ Satellite::setSatelliteType(gchar const * A) satelliteType = GcharMapToSatelliteType.find(std::string(A))->second; } + +/** + * Map a gchar with satelliteType + */ gchar const * Satellite::getSatelliteTypeGchar() const { diff --git a/src/helper/geom-satellite.h b/src/helper/geom-satellite.h index f367bb7f3..d4550b922 100644 --- a/src/helper/geom-satellite.h +++ b/src/helper/geom-satellite.h @@ -1,33 +1,11 @@ /** * \file - * \brief Satellite + * \brief Satellite a per ?node/curve holder of data. *//* * Authors: * 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es> - * Copyright 2015 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. + * This code is in public domain */ #ifndef LIB2GEOM_SEEN_SATELLITE_H @@ -40,6 +18,9 @@ namespace Geom { +/** + * @brief Satellite a per ?node/curve holder of data. + */ class Satellite { public: @@ -49,18 +30,21 @@ class Satellite virtual ~Satellite(); - void setPosition(Geom::Point p, Geom::D2<Geom::SBasis> d2_in); - Geom::Point getPosition(Geom::D2<Geom::SBasis> d2_in) const; - double getSize(Geom::D2<Geom::SBasis> d2_in) const; - double getTime(Geom::D2<Geom::SBasis> d2_in) const; - double getOpositeTime(double A,Geom::D2<Geom::SBasis> SBasisCurve) const; double toSize(double A,Geom::D2<Geom::SBasis> d2_in) const; double toTime(double A,Geom::D2<Geom::SBasis> d2_in) const; double len_to_rad(double A, boost::optional<Geom::D2<Geom::SBasis> > d2_in, Geom::D2<Geom::SBasis> d2_out, boost::optional<Geom::Satellite> previousSatellite) const; double rad_to_len(double A, boost::optional<Geom::D2<Geom::SBasis> > d2_in, Geom::D2<Geom::SBasis> d2_out, boost::optional<Geom::Satellite> previousSatellite) const; + + double getTime(Geom::D2<Geom::SBasis> d2_in) const; + double getTime(double A, bool I, Geom::D2<Geom::SBasis> d2_in) const; + double getSize(Geom::D2<Geom::SBasis> d2_in) const; + + void setPosition(Geom::Point p, Geom::D2<Geom::SBasis> d2_in); + Geom::Point getPosition(Geom::D2<Geom::SBasis> d2_in) const; + void setSatelliteType(gchar const * A); gchar const * getSatelliteTypeGchar() const; - + //TODO: maybe make after variables protected? SatelliteType satelliteType; bool isTime; bool active; |
