Logo Search packages:      
Sourcecode: inkscape version File versions

std::vector< std::pair< Geom::Point, int > > Inkscape::Selection::getSnapPoints ( SnapPreferences const *  snapprefs  )  const

Gets the selection's snap points.

Selection's snap points
Compute the list of points in the selection that are to be considered for snapping.

Definition at line 444 of file selection.cpp.

References SPItem::getCenter(), and itemList().

    GSList const *items = const_cast<Selection *>(this)->itemList();

    SnapPreferences snapprefs_dummy = *snapprefs; // create a local copy of the snapping prefs
    snapprefs_dummy.setIncludeItemCenter(false); // locally disable snapping to the item center

    std::vector<std::pair<Geom::Point, int> > p;
    for (GSList const *iter = items; iter != NULL; iter = iter->next) {
        SPItem *this_item = SP_ITEM(iter->data);
        sp_item_snappoints(this_item, false, p, &snapprefs_dummy);

        //Include the transformation origin for snapping
        //For a selection or group only the overall origin is considered
        if (snapprefs != NULL && snapprefs->getIncludeItemCenter()) {
            p.push_back(std::make_pair(this_item->getCenter(), SNAPSOURCE_ROTATION_CENTER));

    return p;

Generated by  Doxygen 1.6.0   Back to index