void RS_EntityContainer::move(const RS_Vector& offset) { for(auto e: entities){ e->move(offset); if (autoUpdateBorders) { e->moveBorders(offset); } } if (autoUpdateBorders) { moveBorders(offset); } }
void RS_Line::move(const RS_Vector& offset) { // RS_DEBUG->print("RS_Line::move1: sp: %f/%f, ep: %f/%f", // data.startpoint.x, data.startpoint.y, // data.endpoint.x, data.endpoint.y); // RS_DEBUG->print("RS_Line::move1: offset: %f/%f", offset.x, offset.y); data.startpoint.move(offset); data.endpoint.move(offset); moveBorders(offset); // RS_DEBUG->print("RS_Line::move2: sp: %f/%f, ep: %f/%f", // data.startpoint.x, data.startpoint.y, // data.endpoint.x, data.endpoint.y); }
/** * this function creates offset *@coord, position indicates the direction of offset *@distance, distance of offset * return true, if success, otherwise, false * *Author: Dongxu Li */ bool RS_Line::offset(const RS_Vector& coord, const double& distance) { RS_Vector direction(getEndpoint()-getStartpoint()); double ds(direction.magnitude()); if(ds< RS_TOLERANCE) return false; direction /= ds; RS_Vector vp(coord-getStartpoint()); RS_Vector vp1(getStartpoint() + direction*(RS_Vector::dotP(direction,vp))); //projection direction.set(-direction.y,direction.x); //rotate pi/2 if(RS_Vector::dotP(direction,vp)<0.) { direction *= -1.; } direction*=distance; move(direction); moveBorders(direction); return true; }
void RS_Image::move(const RS_Vector& offset) { data.insertionPoint.move(offset); moveBorders(offset); }
void RS_Circle::move(const RS_Vector& offset) { data.center.move(offset); moveBorders(offset); // calculateBorders(); }