Commit 5fe7d69e authored by Stéphane Albert's avatar Stéphane Albert
Browse files

ENH: Fixed VectorImageModel ID in DatasetDescriptor.

parent 42ce52e9
......@@ -338,13 +338,13 @@ DatasetDescriptor
// TODO: Manage XML structure errors.
assert( !node.isNull() );
assert( node.isText() );
QDomText textNode = node.toText();
assert( !textNode.isNull() );
QString data = textNode.data();
QStringList stringList = data.split(" ");
size_t size = static_cast<size_t>(stringList.size());
vector.resize(size);
for (size_t i = 0; i < size; ++i)
......@@ -365,7 +365,7 @@ DatasetDescriptor
// TODO: Manage XML structure errors.
assert( !node.isNull() );
assert( node.isText() );
QDomText textNode = node.toText();
assert( !textNode.isNull() );
......
......@@ -127,10 +127,13 @@ DatasetModel
// If first time, import image into descriptor.
if( foo )
{
AbstractImageModelList aimList( GetImageModels() );
int id = aimList.indexOf( vectorImageModel );
//
// 2.3: Add image to Dataset descriptor file.
m_Descriptor->InsertImageModel(
GetImageModels().size(),
id,
vectorImageModel->GetFilename(),
&vectorImageModel->GetSettings(),
vectorImageModel->GetQuicklookModel()->GetFilename()
......
......@@ -774,6 +774,19 @@ VectorImageModel
quicklookModel->OnModelUpdated();
}
#if 0
// Ensure type of parent model.
assert( GetDatasetModel()!=NULL );
qDebug() << GetDatasetModel();
// Get parent dataset model.
DatasetModel* datasetModel = GetDatasetModel();
#endif
// TODO: Update DatasetDescriptor.
// datasetModel->Foo();
// Emit rendering settings are updated so that display could be
// refreshed.
emit SettingsUpdated();
}
......
......@@ -275,6 +275,20 @@ public:
/** Destructor */
virtual ~VectorImageModel();
/**
* \brief Get the parent DatasetModel.
*
* \return The parent DatasetModel.
*/
inline const DatasetModel* GetDatasetModel() const;
/**
* \brief Get the parent DatasetModel.
*
* \return The parent DatasetModel.
*/
inline DatasetModel* GetDatasetModel();
/** */
static void EnsureValidImage(QString filename)
{
......@@ -295,20 +309,6 @@ public:
}
}
/**
* \brief Get the parent DatasetModel.
*
* \return The parent DatasetModel.
*/
inline const DatasetModel* GetDatasetModel() const;
/**
* \brief Get the parent DatasetModel.
*
* \return The parent DatasetModel.
*/
inline DatasetModel* GetDatasetModel();
/** */
// TODO: Move into template wrapper base-class.
SourceImageType::ConstPointer ToImage() const;
......@@ -596,7 +596,8 @@ const DatasetModel*
VectorImageModel
::GetDatasetModel() const
{
return qobject_cast< const DatasetModel* >( parent() );
// assert( GetParentModel()==GetParentModel< DatasetModel >() );
return GetParentModel< DatasetModel >();
}
/*****************************************************************************/
......@@ -604,7 +605,8 @@ DatasetModel*
VectorImageModel
::GetDatasetModel()
{
return qobject_cast< DatasetModel* >( parent() );
// assert( GetParentModel()==GetParentModel< DatasetModel >() );
return GetParentModel< DatasetModel >();
}
/*****************************************************************************/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment