/** * Sets the polylines start and endpoint to match the first and last vertex. */ void RS_Polyline::updateEndpoints() { RS_Entity* e1 = firstEntity(); if (e1!=NULL && e1->isAtomic()) { RS_Vector v = ((RS_AtomicEntity*)e1)->getStartpoint(); setStartpoint(v); } RS_Entity* e2 = lastEntity(); if (isClosed()) { e2 = prevEntity(); } if (e2!=NULL && e2->isAtomic()) { RS_Vector v = ((RS_AtomicEntity*)e2)->getEndpoint(); setEndpoint(v); } }
/** * Sets the polylines start and endpoint to match the first and last vertex. */ void RS_Polyline::updateEndpoints() { RS_Entity* e1 = firstEntity(); if (e1 && e1->isAtomic()) { RS_Vector const& v = e1->getStartpoint(); setStartpoint(v); } RS_Entity const* e2 = last(); if (isClosed()) { e2 = prevEntity(); } if (e2 && e2->isAtomic()) { RS_Vector const& v = e2->getEndpoint(); setEndpoint(v); } }