void IgstkTool::internalVisible(bool value) { if (mVisible == value) return; mVisible = value; emit toolVisible(mVisible); }
void SliceProxy::setTool(ToolPtr tool) { if (mTool) { disconnect(mTool.get(), SIGNAL(toolTransformAndTimestamp(Transform3D,double)), this, SLOT(toolTransformAndTimestampSlot(Transform3D,double))); disconnect(mTool.get(), SIGNAL(toolVisible(bool)), this, SLOT(toolVisibleSlot(bool))); disconnect(mTool.get(), SIGNAL(tooltipOffset(double)), this, SLOT(tooltipOffsetSlot(double))); disconnect(mTool.get(), SIGNAL(toolProbeSector()), this, SLOT(changed())); } mTool = tool; if (mTool) { connect(mTool.get(), SIGNAL(toolTransformAndTimestamp(Transform3D,double)), this, SLOT(toolTransformAndTimestampSlot(Transform3D,double))); connect(mTool.get(), SIGNAL(toolVisible(bool)), this, SLOT(toolVisibleSlot(bool))); connect(mTool.get(), SIGNAL(tooltipOffset(double)), this, SLOT(tooltipOffsetSlot(double))); connect(mTool.get(), SIGNAL(toolProbeSector()), this, SLOT(changed()));/// not used here, but forwarded to users emit toolVisible(mTool->getVisible()); toolTransformAndTimestampSlot(mTool->get_prMt(), 0); // initial values tooltipOffsetSlot(mTool->getTooltipOffset()); } this->centerChangedSlot(); // force center update for tool==0 this->changed(); }
void PlaybackTool::timeChangedSlot() { QDateTime time = mTime->getTime(); qint64 time_ms = time.toMSecsSinceEpoch(); TimedTransformMapPtr positions = mBase->getPositionHistory(); if (positions->empty()) return; // find last stored time before current time. TimedTransformMap::iterator lastSample = positions->lower_bound(time_ms); if (lastSample!=positions->begin()) --lastSample; // interpret as hidden if no samples has been received the last time: qint64 timeout = 200; bool visible = (lastSample!=positions->end()) && (fabs(time_ms - lastSample->first) < timeout); // change visibility if applicable if (mVisible!=visible) { mVisible = visible; emit toolVisible(mVisible); } // emit new position if visible if (this->getVisible()) { m_rMpr = lastSample->second; mTimestamp = lastSample->first; emit toolTransformAndTimestamp(m_rMpr, mTimestamp); } }
void ManualTool::setVisible(bool vis) { if (mVisible==vis) return; mVisible = vis; emit toolVisible(mVisible); }