Ejemplo n.º 1
0
void
SPConnEndPair::getEndpoints(Geom::Point endPts[]) const {
    SPCurve *curve = _path->curve;
    SPItem *h2attItem[2];
    getAttachedItems(h2attItem);

    for (unsigned h = 0; h < 2; ++h) {
        if ( h2attItem[h] ) {
            Geom::OptRect bbox = h2attItem[h]->getBounds(sp_item_i2doc_affine(h2attItem[h]));
            if (bbox) {
                endPts[h] = bbox->midpoint();
            } else {
                // FIXME
                endPts[h] = Geom::Point(0, 0);
            }
        }
        else
        {
            if (h == 0) {
                endPts[h] = *(curve->first_point());
            }
            else {
                endPts[h] = *(curve->last_point());
            }
        }
    }
}
Ejemplo n.º 2
0
void
SPConnEndPair::getEndpoints(Geom::Point endPts[]) const {
    SPCurve *curve = _path->original_curve ? _path->original_curve : _path->curve;
    SPItem *h2attItem[2];
    getAttachedItems(h2attItem);
    Geom::Matrix i2d = sp_item_i2doc_affine(SP_ITEM(_path));

    for (unsigned h = 0; h < 2; ++h) {
        if ( h2attItem[h] ) {
            g_assert(h2attItem[h]->avoidRef);
            endPts[h] = h2attItem[h]->avoidRef->getConnectionPointPos(_connEnd[h]->type, _connEnd[h]->id);
        }
        else if (!curve->is_empty())
        {
            if (h == 0) {
                endPts[h] = *(curve->first_point())*i2d;
            }
            else {
                endPts[h] = *(curve->last_point())*i2d;
            }
        }
    }
}