snapper.h revision 70d31ae8a7a27e57cfcdc921ea0d2f47c92442a4
#ifndef SEEN_SNAPPER_H
#define SEEN_SNAPPER_H
/**
* \brief Snapper class.
*
* Authors:
* Carl Hetherington <inkscape@carlh.net>
* Diederik van Lierop <mail@diedenrezi.nl>
*
* Released under GNU GPL, read the file 'COPYING' for more information.
*/
#include <map>
#include <list>
#include <boost/optional.hpp>
#include "snapped-point.h"
#include "snapped-line.h"
#include "snapped-curve.h"
#include "snap-preferences.h"
struct SnappedConstraints {
};
struct SPItem;
{
/// Parent for classes that can snap points to something
{
Snapper() {}
virtual Geom::Coord getSnapperTolerance() const = 0; //returns the tolerance of the snapper in screen pixels (i.e. independent of zoom)
virtual bool getSnapperAlwaysSnap() const = 0; //if true, then the snapper will always snap, regardless of its tolerance
/**
* \return true if this Snapper will snap at least one kind of point.
*/
virtual bool ThisSnapperMightSnap() const {return _snap_enabled;} // will likely be overridden by derived classes
// These four methods are only used for grids, for which snapping can be enabled individually
void setEnabled(bool s);
void setSnapVisibleOnly(bool s);
bool getEnabled() const {return _snap_enabled;}
bool getSnapVisibleOnly() const {return _snap_visible_only;}
SnapSourceType const &/*source_type*/,
bool const &/*first_point*/,
{
ConstraintLine(Geom::Point const &p, Geom::Point const &d) : _has_point(true), _point(p), _direction(d) {}
ConstraintLine(Geom::Line const &l) : _has_point(true), _point(l.origin()), _direction(l.versor()) {}
bool hasPoint() const {
return _has_point;
}
return _point;
}
return _direction;
}
_point = p;
_has_point = true;
}
Geom::Point projection(Geom::Point const &p) const { // returns the projection of p on this constraintline
}
bool _has_point;
};
SnapSourceType const &/*source_type*/,
bool const &/*first_point*/,
ConstraintLine const &/*c*/,
// This is only used for grids, for which snapping can be enabled individually
bool _snap_enabled; ///< true if this snapper is enabled, otherwise false
bool _snap_visible_only;
};
}
#endif /* !SEEN_SNAPPER_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 :