24 const double default_detector_width = 20.0;
25 const double default_detector_height = 20.0;
26 const double default_detector_distance = 1000.0;
27 const QString tooltip_u0 =
"u-coordinate of point of intersection of normal vector "
28 "and detector plane, \n in local detector coordinates";
29 const QString tooltip_v0 =
"v-coordinate of point of intersection of normal vector "
30 "and detector plane, \n in local detector coordinates";
32 const QString tooltip_dbeam_u0 =
"u-coordinate of point where direct beam hits the detector, \n"
33 "in local detector coordinates [mm]";
34 const QString tooltip_dbeam_v0 =
"v-coordinate of point where direct beam hits the detector, \n"
35 "in local detector coordinates [mm]";
37 const QString tooltip_refbeam_u0 =
38 "u-coordinate of point where reflected beam hits the detector, \n"
39 "in local detector coordinates [mm]";
40 const QString tooltip_refbeam_v0 =
41 "v-coordinate of point where reflected beam hits the detector, \n"
42 "in local detector coordinates [mm]";
44 const QString tooltip_samplex_u0 =
45 "u-coordinate of point where sample x-axis crosses the detector, \n"
46 "in local detector coordinates [mm]";
47 const QString tooltip_samplex_v0 =
48 "v-coordinate of point where sample x-axis crosses the detector, \n"
49 "in local detector coordinates [mm]";
55 <<
"Perpendicular to direct beam"
56 <<
"Perpendicular to sample x-axis"
57 <<
"Perpendicular to reflected beam"
58 <<
"Perpendicular to reflected beam (dpos)";
59 result.
setValue(
"Perpendicular to direct beam");
76 :
DetectorItem(
"RectangularDetector"), m_is_constructed(false)
79 auto axisItem = addProperty<BasicAxisItem>(
P_X_AXIS);
82 axisItem->setUpperBound(default_detector_width);
86 axisItem = addProperty<BasicAxisItem>(
P_Y_AXIS);
89 axisItem->setUpperBound(default_detector_height);
97 auto normalItem = addProperty<VectorItem>(
P_NORMAL);
98 normalItem->setX(default_detector_distance);
101 auto directionItem = addProperty<VectorItem>(
P_DIRECTION);
102 directionItem->setY(-1.0);
114 ->
setToolTip(
"Distance in [mm] from the sample origin to the detector plane");
132 if (!combo_property.
getValues().contains(alignment))
134 "RectangularDetectorItem::setDetectorAlignment -> Unexpected alignment");
162 return item<BasicAxisItem>(
P_X_AXIS);
173 return item<BasicAxisItem>(
P_Y_AXIS);
191 auto result = std::make_unique<RectangularDetector>(n_x, width, n_y, height);
202 if (alignment.
getValue() ==
"Generic") {
204 }
else if (alignment.
getValue() ==
"Perpendicular to direct beam") {
205 result->setPerpendicularToDirectBeam(distance, dbeam_u0, dbeam_v0);
206 }
else if (alignment.
getValue() ==
"Perpendicular to sample x-axis") {
207 result->setPerpendicularToSampleX(distance, u0, v0);
208 }
else if (alignment.
getValue() ==
"Perpendicular to reflected beam") {
209 result->setPerpendicularToReflectedBeam(distance, u0, v0);
210 }
else if (alignment.
getValue() ==
"Perpendicular to reflected beam (dpos)") {
211 result->setPerpendicularToReflectedBeam(distance);
212 result->setDirectBeamPosition(dbeam_u0, dbeam_v0);
214 return std::unique_ptr<IDetector2D>(result.release());
222 QStringList prop_list;
224 for (
auto prop : prop_list)
228 if (alignment.
getValue() ==
"Generic") {
235 }
else if (alignment.
getValue() ==
"Perpendicular to sample x-axis") {
241 }
else if (alignment.
getValue() ==
"Perpendicular to direct beam") {
245 }
else if (alignment.
getValue() ==
"Perpendicular to reflected beam") {
251 }
else if (alignment.
getValue() ==
"Perpendicular to reflected beam (dpos)") {
Defines various axis items.
Defines class ComboProperty.
Defines class GUIHelpers functions.
Defines class RectangularDetectorItem.
Defines class RectangularDetector.
Defines family of ResolutionFunctionItem.
Defines class VectorItem.
void setBinCount(int value)
static const QString P_MAX_DEG
static const QString P_TITLE
double upperBound() const
static const QString P_MIN_DEG
Custom property to define list of string values with multiple selections.
QStringList getValues() const
QVariant variant() const
Constructs variant enclosing given ComboProperty.
void setValue(const QString &name)
void register_resolution_function()
void setOnPropertyChange(std::function< void(QString)> f, const void *caller=0)
static RealLimits limitless()
Creates an object withoud bounds (default)
static const QString P_X_AXIS
const BasicAxisItem * xAxisItem() const
kvector_t directionVector() const
std::unique_ptr< IDetector2D > createDomainDetector() const override
static const QString P_DIRECTION
int ySize() const override
returns the size of y-axis of the detector
void update_properties_appearance()
updates property tooltips and visibility flags, depending from type of alignment selected
kvector_t normalVector() const
static const QString P_Y_AXIS
void setDetectorAlignment(const QString &alignment)
static const QString P_V0
static const QString P_NORMAL
static const QString P_DBEAM_V0
static const QString P_DISTANCE
void setYSize(int ny) override
sets the size of y-axis of the detector
static const QString P_ALIGNMENT
static const QString P_U0
void setXSize(int nx) override
sets the size of x-axis of the detector
RectangularDetectorItem()
int xSize() const override
returns the size of x-axis of the detector
static const QString P_DBEAM_U0
const BasicAxisItem * yAxisItem() const
SessionItem * addProperty(const QString &name, const QVariant &variant)
Add new property item and register new tag.
void setVisible(bool enabled)
Flags accessors.
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
void setItemValue(const QString &tag, const QVariant &variant)
Directly set value of item under given tag.
SessionItem & setToolTip(const QString &tooltip)
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.
SessionItem & setLimits(const RealLimits &value)
QString const & name(EShape k)