57 return QList<DataPtr>();
83 virtual void remove(
DataPtr dataToBeRemoved)
104 mStorage(new
PatientStorage(sessionStorageService,
"ActiveData", true)),
105 mPatientModelService(patientModelService)
107 mStorage->storeVariable(
"activeUids",
108 boost::bind(&ActiveData::getStringToSave,
this),
109 boost::bind(&ActiveData::loadFromString,
this, _1));
112 QString ActiveData::getStringToSave()
const
114 return this->getActiveDataStringList().join(
" ");
117 QStringList ActiveData::getActiveDataStringList()
const
120 if(!mActiveData.isEmpty())
121 for(
int i = 0; i < mActiveData.size(); ++i)
122 retval << mActiveData.at(i)->getUid();
126 void ActiveData::loadFromString(
const QString activeDatas)
129 QStringList activeDataList = activeDatas.split(
" ");
130 for(
int i = 0; i < activeDataList.size(); ++i)
132 DataPtr data = mPatientModelService->getData(activeDataList.at(i));
144 if(mActiveData.isEmpty())
146 return mActiveData.last();
154 if(!activeDatas.isEmpty())
155 activeData = activeDatas.last();
168 retval = boost::dynamic_pointer_cast<
Image>(activeData);
174 QRegExp reg(typeRegexp);
176 QList<DataPtr> retval;
178 for(
int i = 0; i < active.size(); ++i)
181 if(current->getType().contains(reg))
182 retval.push_back(current);
192 if (!mActiveData.empty() && mActiveData.last() == activeData)
195 mActiveData.removeAll(activeData);
196 mActiveData.append(activeData);
198 this->emitSignals(activeData);
203 DataPtr dataToSet = mPatientModelService->getData(uid);
209 ImagePtr image = this->getActive<Image>();
211 return image->getUid();
216 void ActiveData::emitSignals(
DataPtr activeData)
218 this->emitActiveDataChanged();
219 if(activeData && activeData->getType() ==
"image")
220 this->emitActiveImageChanged();
223 void ActiveData::emitActiveImageChanged()
225 DataPtr activeData = ActiveData::getActive<Image>();
226 QString uid = getChangedUid(activeData);
230 void ActiveData::emitActiveDataChanged()
233 QString uid = getChangedUid(activeData);
237 QString ActiveData::getChangedUid(
DataPtr activeData)
const
241 uid = activeData->getUid();
249 if(!mActiveData.contains(dataToBeRemoved))
252 bool resendActiveImage =
false;
253 bool resendActiveData =
false;
254 if (this->getActive<Image>() == dataToBeRemoved)
255 resendActiveImage =
true;
257 resendActiveData =
true;
259 mActiveData.removeAll(dataToBeRemoved);
261 if(resendActiveImage)
262 emitActiveImageChanged();
264 emitActiveDataChanged();
virtual ImagePtr getDerivedActiveImage() const
In addition to returning Image this also provides derived (changing) images from TrackedStream.
virtual QList< DataPtr > getActiveDataHistory() const
virtual ImagePtr getDerivedActiveImage() const
In addition to returning Image this also provides derived (changing) images from TrackedStream.
virtual DataPtr getActiveUsingRegexp(QString typeRegexp) const
boost::shared_ptr< class TrackedStream > TrackedStreamPtr
Helper class for storing variables in the patient file.
Provides the last active data of warious types.
boost::shared_ptr< class Image > ImagePtr
boost::shared_ptr< class ActiveData > ActiveDataPtr
A data set for video streams (2D/3D).
static ActiveDataPtr getNullObject()
virtual void remove(DataPtr dataToBeRemoved)
ActiveData(PatientModelServicePtr patientModelService, SessionStorageServicePtr sessionStorageService)
boost::shared_ptr< class Data > DataPtr
virtual bool isNull() const
virtual DataPtr getActive() const
virtual void setActive(DataPtr activeData)
void reportWarning(QString msg)
void activeDataChanged(const QString &uId)
cxLogicManager_EXPORT SessionStorageServicePtr sessionStorageService()
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
ImagePtr getChangingImage()
virtual DataPtr getActiveUsingRegexp(QString typeRegexp) const
virtual QString getActiveImageUid()
virtual QList< DataPtr > getActiveDataHistory() const
void printWarning(QString warning="") const
virtual DataPtr getActive() const
static ActiveDataPtr getNullObject()
virtual QString getActiveImageUid()
virtual void setActive(DataPtr activeData)
boost::shared_ptr< class SessionStorageService > SessionStorageServicePtr
void activeImageChanged(const QString &uId)