object-snapper.cpp revision f76f0d94b4b87bb6c1ba98e14d120aac94e415d0
/**
* \file object-snapper.cpp
* \brief Snapping things to objects.
*
* Authors:
* Carl Hetherington <inkscape@carlh.net>
*
* Copyright (C) 2005 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "libnr/n-art-bpath.h"
#include "libnr/nr-rect-ops.h"
#include "document.h"
#include "sp-namedview.h"
#include "sp-path.h"
#include "sp-image.h"
#include "sp-item-group.h"
#include "sp-item.h"
#include "sp-use.h"
#include "desktop.h"
#include "inkscape.h"
#include "splivarot.h"
{
}
/**
* \param p Point we are trying to snap (desktop coordinates)
*/
SPObject* r,
{
if (ThisSnapperMightSnap()) {
/* See if this item is on the ignore list */
i++;
}
/* See if the item is within range */
if (SP_IS_GROUP(o)) {
_findCandidates(c, o, it, p);
} else {
}
}
}
}
}
}
}
{
/* FIXME: this seems like a hack. Perhaps Snappers should be
** in SPDesktop rather than SPNamedView?
*/
if (SP_IS_USE(*i)) {
} else {
i2doc = sp_item_i2doc_affine(*i);
root_item = *i;
}
if (SP_IS_SHAPE(root_item)) {
} else if (SP_IS_IMAGE(root_item)) {
}
if (curve) {
int j = 0;
/* Get this node in desktop coordinates */
/* Try to snap to this node of the path */
s = SnappedPoint(n, dist);
}
j++;
}
}
}
}
{
/* FIXME: this seems like a hack. Perhaps Snappers should be
** in SPDesktop rather than SPNamedView?
*/
/* Transform the requested snap point to this item's coordinates */
/* We might have a clone at hand, so make sure we get the root item */
if (SP_IS_USE(*i)) {
} else {
i2doc = sp_item_i2doc_affine(*i);
root_item = *i;
}
if (!livarot_path)
continue;
/* Look for the nearest position on this SPItem to our snap point */
if (o && o->t >= 0 && o->t <= 1) {
/* Convert the nearest point back to desktop coordinates */
}
}
delete livarot_path;
}
}
{
if ( NULL == _named_view ) {
return SnappedPoint(p, NR_HUGE);
}
/* Get a list of all the SPItems that we will try to snap to */
SnappedPoint s(p, NR_HUGE);
if (_snap_to_nodes) {
_snapNodes(s, p, cand);
}
if (_snap_to_paths) {
_snapPaths(s, p, cand);
}
return s;
}
ConstraintLine const &c,
{
/* FIXME: this needs implementing properly; I think we have to do the
** intersection of c with the objects.
*/
return _doFreeSnap(p, it);
}
/**
* \return true if this Snapper will snap at least one kind of point.
*/
{
}
/*
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 :