Exemple #1
0
	void Data::insertChild(size_t _index, DataPtr _child)
	{
		MYGUI_ASSERT(_child != nullptr, "Child is nullptr");
		MYGUI_ASSERT(_child->getParent() == nullptr, "Child already attached");
		MYGUI_ASSERT(_child->getType() != nullptr, "Type not found");
		MYGUI_ASSERT(getType() != nullptr, "Type not found");
		MYGUI_ASSERT(getType()->isChild(_child->getType()->getName()), "Type is not child");

		MYGUI_ASSERT_RANGE_INSERT(_index, mChilds.size(), "Data::insertChild");

		if (_index == MyGUI::ITEM_NONE)
			_index = mChilds.size();

		mChilds.insert(mChilds.begin() + _index, _child);
		_child->mParent = mWeakThis.lock();
	}
	void PropertyPanelController::notifyChangeDataSelector(DataPtr _data, bool _changeOnlySelection)
	{
		if (mControl != nullptr)
		{
			DataPtr selected = _data != nullptr ? _data->getChildSelected() : nullptr;

			// выделяем только данные с типом скопа
			if (selected != nullptr)
			{
				if (selected->getType()->getName() != ScopeManager::getInstance().getCurrentScope() &&
					selected->getType()->getFriend() != ScopeManager::getInstance().getCurrentScope())
				selected = nullptr;
			}

			mControl->setCurrentData(selected);
		}
	}
Exemple #3
0
	void DataUtility::cloneData(DataPtr _target, DataPtr _prototype)
	{
		MYGUI_ASSERT(_target != _prototype, "Error clone self");
		MYGUI_ASSERT(_target->getType() == _prototype->getType(), "Error clone different types");
		MYGUI_ASSERT(_target->getChilds().size() == 0, "Target not empty");

		copyProperty(_target, _prototype);
		
		for (Data::VectorData::const_iterator child = _prototype->getChilds().begin(); child != _prototype->getChilds().end(); child ++)
		{
			DataPtr data = Data::CreateInstance();
			data->setType((*child)->getType());

			_target->addChild(data);

			cloneData(data, *child);
		}
	}
Exemple #4
0
	DataPtr DataUtility::getSelectedDataByType(DataPtr _data, DataTypePtr _info)
	{
		if (_data == nullptr)
			return NULL;

		if (_data->getType() == _info)
			return _data;

		return getSelectedDataByType(_data->getChildSelected(), _info);
	}
Exemple #5
0
	DataPtr DataUtility::getSelectedParentDataByType(DataPtr _data, DataTypePtr _info)
	{
		if (_data == nullptr)
			return NULL;

		for (DataType::VectorString::const_iterator child = _data->getType()->getChilds().begin(); child != _data->getType()->getChilds().end(); child ++)
		{
			if ((*child) == _info->getName())
				return _data;
		}

		return getSelectedParentDataByType(_data->getChildSelected(), _info);
	}
	MyGUI::IntPoint ImageExportSerializer::getFirstFramePoint(DataPtr _data)
	{
		if (_data->getType()->getName() != "Group")
			return MyGUI::IntPoint();

		if (_data->getChilds().size() != 0)
		{
			DataPtr child = _data->getChildByIndex(0);
			if (child->getChilds().size() != 0)
			{
				return child->getChildByIndex(0)->getPropertyValue<MyGUI::IntPoint>("Point");
			}
		}


		return MyGUI::IntPoint();
	}
int getPriority(DataPtr data)
{
	if (data->getType()=="mesh")
		return 6;
	DataMetricPtr metric = boost::dynamic_pointer_cast<DataMetric>(data);
	if (metric)
		return 7;

	ImagePtr image = boost::dynamic_pointer_cast<Image>(data);
	if (image)
	{
		if (image->getModality().toUpper().contains("US"))
		{
			if (image->getImageType().toUpper().contains("B-MODE"))
				return 4;
			else // angio types
				return 5;
		}
		else if (image->getModality().toUpper().contains("MR"))
		{
			// MR, CT, SC, others
			return 2;
		}
		else if (image->getModality().toUpper().contains("CT"))
		{
			// MR, CT, SC, others
			return 1;
		}
		else
		{
			return 0;
		}
	}

	return 3;
}
bool MetricReferenceArgumentList::validArgument(DataPtr p) const
{
	if (!p)
		return false;
	return mValidTypes.contains(p->getType());
}
bool CustomMetric::modelIsImage() const
{
	DataPtr model = this->getModel();

	return (model && model->getType() == "image");
}