1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/Model/Sample/ItemWithParticles.h
//! @brief Defines abstract item with a material property.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2021
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#ifndef BORNAGAIN_GUI_MODEL_SAMPLE_ITEMWITHPARTICLES_H
#define BORNAGAIN_GUI_MODEL_SAMPLE_ITEMWITHPARTICLES_H
#include "GUI/Model/Descriptor/PolyPtr.h"
#include "GUI/Model/Descriptor/VectorProperty.h"
#include "GUI/Model/Sample/Item3D.h"
#include "GUI/Model/Sample/RotationCatalog.h"
#include "GUI/Model/Sample/RotationItems.h"
#include <memory>
class IRotation;
class ItemWithParticles : public virtual Item3D {
public:
virtual ~ItemWithParticles() = default;
DoubleProperty& abundance() { return m_abundance; }
const DoubleProperty& abundance() const { return m_abundance; }
void setAbundance(double v) { m_abundance.setDVal(v); }
VectorProperty& position() { return m_position; }
const VectorProperty& position() const { return m_position; }
void setPosition(const R3& position) { m_position.setR3(position); }
PolyPtr<RotationItem, RotationCatalog>& rotationSelection() { return m_rotation; }
//! nullptr is allowed and sets to "no rotation"
void setRotationType(RotationItem* p) { m_rotation.setCertainItem(p); }
//! nullptr only if "no rotation". Can contain identity!
std::unique_ptr<IRotation> createRotation() const;
//! Returns particles contained at any sublevel (recursive).
virtual std::vector<ItemWithParticles*> containedItemsWithParticles() const = 0;
virtual void writeTo(QXmlStreamWriter* w) const;
virtual void readFrom(QXmlStreamReader* r);
protected:
ItemWithParticles(const QString& abundanceTooltip, const QString& positionTooltip);
DoubleProperty m_abundance;
VectorProperty m_position;
PolyPtr<RotationItem, RotationCatalog> m_rotation;
};
#endif // BORNAGAIN_GUI_MODEL_SAMPLE_ITEMWITHPARTICLES_H
|