// Who When What
// --- ---------- -----------------------------------------------------------
// JLH 05/21/2010 Added this text. :-)
// Who When What
// --- ---------- -----------------------------------------------------------
// JLH 05/21/2010 Added this text. :-)
Snapper::Snapper(EntityContainer & c, GraphicView & gv):
container(&c), graphicView(&gv), finished(false)
{
Snapper::Snapper(EntityContainer & c, GraphicView & gv):
container(&c), graphicView(&gv), finished(false)
{
}
/**
* @return Pointer to the entity which was the key entity for the last
* successful snapping action. If the snap mode is "end point" the key entity
}
/**
* @return Pointer to the entity which was the key entity for the last
* successful snapping action. If the snap mode is "end point" the key entity
* entity (e.g. free, grid) this method will return NULL.
*/
Entity * Snapper::getKeyEntity()
{
* entity (e.g. free, grid) this method will return NULL.
*/
Entity * Snapper::getKeyEntity()
{
Vector vec(false);
vec = container->getNearestPointOnEntity(coord, true, NULL, &keyEntity);
return vec;
Vector vec(false);
vec = container->getNearestPointOnEntity(coord, true, NULL, &keyEntity);
return vec;
Vector rz = graphicView->getRelativeZero();
return Vector(coord.x, rz.y);
Vector rz = graphicView->getRelativeZero();
return Vector(coord.x, rz.y);
Vector rz = graphicView->getRelativeZero();
return Vector(rz.x, coord.y);
Vector rz = graphicView->getRelativeZero();
return Vector(rz.x, coord.y);
#warning "!!! This may need to have SetVisibility() called !!!"
// deleteSnapper();
snapSpot = snapCoord = Vector(false);
#warning "!!! This may need to have SetVisibility() called !!!"
// deleteSnapper();
snapSpot = snapCoord = Vector(false);
if (snapMode == RS2::SnapDist && DIALOGFACTORY)
DIALOGFACTORY->requestSnapDistOptions(distance, false);
if (snapMode == RS2::SnapDist && DIALOGFACTORY)
DIALOGFACTORY->requestSnapDistOptions(distance, false);
if (snapMode == RS2::SnapDist && DIALOGFACTORY)
DIALOGFACTORY->requestSnapDistOptions(distance, true);
if (snapMode == RS2::SnapDist && DIALOGFACTORY)
DIALOGFACTORY->requestSnapDistOptions(distance, true);
if (finished || !snapSpot.valid || !snapCoord.valid)
return;
//hm, I don't like graphicView kicking around in here, especially since it now
//lives inside GraphicView... How to !!! FIX !!!?
//We'll pass it in for now...
if (finished || !snapSpot.valid || !snapCoord.valid)
return;
//hm, I don't like graphicView kicking around in here, especially since it now
//lives inside GraphicView... How to !!! FIX !!!?
//We'll pass it in for now...
// Snap point (need to make sure the brush is NULL!)
// painter->setPen(Pen(Color(0, 127, 255), RS2::Width00, RS2::DashLine));
painter->setPen(Pen(Color(255, 127, 0), RS2::Width00, RS2::DashLine));
// Snap point (need to make sure the brush is NULL!)
// painter->setPen(Pen(Color(0, 127, 255), RS2::Width00, RS2::DashLine));
painter->setPen(Pen(Color(255, 127, 0), RS2::Width00, RS2::DashLine));
painter->drawLine(Vector(view->toGuiX(snapCoord.x), 0),
Vector(view->toGuiX(snapCoord.x), view->getHeight()));
}
painter->drawLine(Vector(view->toGuiX(snapCoord.x), 0),
Vector(view->toGuiX(snapCoord.x), view->getHeight()));
}
{
painter->drawLine(view->toGui(snapSpot) + Vector(-5, 0),
view->toGui(snapSpot) + Vector(-1, 4));
{
painter->drawLine(view->toGui(snapSpot) + Vector(-5, 0),
view->toGui(snapSpot) + Vector(-1, 4));
painter->drawLine(view->toGui(snapSpot) + Vector(0, -5),
view->toGui(snapSpot) + Vector(-4, -1));
}
painter->drawLine(view->toGui(snapSpot) + Vector(0, -5),
view->toGui(snapSpot) + Vector(-4, -1));
}