Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
Ploty2
Commits
a7fdb7f2
Commit
a7fdb7f2
authored
Nov 05, 2019
by
locatelli
Browse files
Do Commentaries
parent
51c45793
Changes
16
Hide whitespace changes
Inline
Side-by-side
src/datacontainer/PropertyPlotDataContainer.h
View file @
a7fdb7f2
...
...
@@ -74,30 +74,34 @@ public:
std
::
vector
<
int32
>
optimizationFitFoundId
;
//! Property id list for optimization fit found
std
::
vector
<
int32
>
optimizationFitYId
;
//! Property id list for optimization fit y values found
std
::
vector
<
std
::
string
>
optimizationFitColor
;
//! Color of optimization fit
int32
nbRoisId
;
std
::
vector
<
int32
>
roiX0_parent_ids
;
std
::
vector
<
int32
>
roiY0_parent_ids
;
std
::
vector
<
int32
>
roiX1_parent_ids
;
std
::
vector
<
int32
>
roiY1_parent_ids
;
std
::
vector
<
int32
>
roiSum_parent_ids
;
std
::
vector
<
std
::
vector
<
int32
>>
roiX0_ids
;
std
::
vector
<
std
::
vector
<
int32
>>
roiY0_ids
;
std
::
vector
<
std
::
vector
<
int32
>>
roiX1_ids
;
std
::
vector
<
std
::
vector
<
int32
>>
roiY1_ids
;
std
::
vector
<
std
::
vector
<
int32
>>
roiSum_ids
;
int32
roiSelectedPlotId
;
int32
roiSelectedRoiId
;
int32
roiSelectedX0Id
;
int32
roiSelectedY0Id
;
int32
roiSelectedX1Id
;
int32
roiSelectedY1Id
;
int32
roiCommandAddId
;
int32
roiCommandRazId
;
int32
nbRoisId
;
//! Property id of the number of Roi
std
::
vector
<
int32
>
roiX0_parent_ids
;
//! Parent property id of the dynamic property roi X0 coordinate
std
::
vector
<
int32
>
roiY0_parent_ids
;
//! Parent property id of the dynamic property roi Y0 coordinate
std
::
vector
<
int32
>
roiX1_parent_ids
;
//! Parent property id of the dynamic property roi X1 coordinate
std
::
vector
<
int32
>
roiY1_parent_ids
;
//! Parent property id of the dynamic property roi Y1 coordinate
std
::
vector
<
int32
>
roiSum_parent_ids
;
//! Parent property id of the dynamic property roi detector sum
std
::
vector
<
std
::
vector
<
int32
>>
roiX0_ids
;
//! Property ids of roi X0 coordinates
std
::
vector
<
std
::
vector
<
int32
>>
roiY0_ids
;
//! Property ids of roi Y0 coordinates
std
::
vector
<
std
::
vector
<
int32
>>
roiX1_ids
;
//! Property ids of roi X1 coordinates
std
::
vector
<
std
::
vector
<
int32
>>
roiY1_ids
;
//! Property ids of roi Y1 coordinates
std
::
vector
<
std
::
vector
<
int32
>>
roiSum_ids
;
//! Property ids of roi detector sum
int32
roiSelectedPlotId
;
//! Property id of the selected plot for adding or removing roi command
int32
roiSelectedRoiId
;
//! Property id of the selected roi for adding or removing roi command
int32
roiSelectedX0Id
;
//! Property id of the selected roi X0 for adding or removing roi command
int32
roiSelectedY0Id
;
//! Property id of the selected roi Y0 for adding or removing roi command
int32
roiSelectedX1Id
;
//! Property id of the selected roi X1 for adding or removing roi command
int32
roiSelectedY1Id
;
//! Property id of the selected roi Y1 for adding or removing roi command
int32
roiCommandAddId
;
//! Add Command id
int32
roiCommandRazId
;
//! Raz Command id
bool
hasx
;
//! Flag tells if there is x data (run getPlotType() before)
bool
hasy
;
//! Flag tells if there is y data (run getPlotType() before)
bool
hasz
;
//! Flag tells if there is z data (run getPlotType() before)
/*!
* \brief get plot type of this container
* \return Plot type
*/
virtual
plot
::
PlotType
getPlotType
();
};
...
...
src/manager/InterfaceManager.h
View file @
a7fdb7f2
...
...
@@ -44,6 +44,9 @@ class PropertyPlotDataContainer;
namespace
manager
{
/*!
* \brief InterfaceManager Manager for doing interface between qt and mpl interface.
*/
class
InterfaceManager
{
public:
...
...
@@ -59,8 +62,22 @@ public:
*/
static
void
resetInstance
();
/*!
* \brief init the plot window pointer
* \param[in] plotWindow The plot window pointer
*/
void
init
(
plot
::
PlotWindow
*
plotWindow
);
/*!
* \brief init the qt window pointer
* \param[in] qtWindow The qt window pointer
*/
void
init
(
view
::
qt
::
QtWindow
*
qtWindow
);
/*!
* \brief init the property plot pointer
* \param[in] propertyplot The property plot pointer
*/
void
init
(
plot
::
property
::
PropertyPlot
*
propertyplot
);
/*!
...
...
@@ -137,9 +154,27 @@ public:
*/
datacontainer
::
PropertyPlotDataContainer
&
getPropertyPlotDataContainer
();
/*!
* \brief Transform mouse coordinates to plot one
* \param[in] x The x coordinate
* \param[in] y The y coordinate
* \param[in] devicePixelRatio The pixel ratio of the display device
* \return The plot coordinates of the mouse pointer
* \throws Error
*/
std
::
vector
<
float64
>
toDataCoord
(
float64
x
,
float64
y
,
int32
devicePixelRatio
)
throw
(
Error
)
;
/*!
* \brief Check mouse click if in legend box
* \param[in] xmouse The x mouse coordinate
* \param[in] ymouse The y mouse coordinate
* \throws Error
*/
void
checkLegendPick
(
float64
x
,
float64
y
)
throw
(
Error
)
;
/*!
* \brief Allow Roi Functionnalities on the Qt interface
*/
void
allowRoiFunctionnalities
();
/*!
...
...
@@ -183,9 +218,24 @@ public:
*/
void
showRoiCoord
(
uint32
id
,
float64
x0
,
float64
y0
,
float64
x1
,
float64
y1
);
/*!
* \brief Update all roi
* \param[in] rects The roi rectangles coordinates
*/
void
updateRoi
(
const
std
::
vector
<
std
::
vector
<
float64
>>&
rects
);
/*!
* \brief Update a roi n
* \param[in] n The roi indice to update
* \param[in] rects The roi rectangles coordinates
*/
void
updateRoi
(
int32
n
,
const
std
::
vector
<
float64
>&
vect
);
/*!
* \brief Update a roi sum n
* \param[in] id The roi indice
* \param[in] sum The detector sum value
*/
void
updateSum
(
uint32
id
,
float64
sum
);
private:
...
...
@@ -198,7 +248,7 @@ private:
static
InterfaceManager
*
m_Instance
;
//! Pointer of singleton instance
view
::
qt
::
QtWindow
*
m_QtWindow
;
//! Qt window instance
plot
::
PlotWindow
*
m_PlotWindow
;
plot
::
PlotWindow
*
m_PlotWindow
;
//! Plot window instance
plot
::
property
::
PropertyPlot
*
m_PropertyPlot
;
//! Link on plot object
};
...
...
src/plot/Plot.h
View file @
a7fdb7f2
...
...
@@ -143,6 +143,10 @@ public:
return
std
::
nanf
(
""
);
}
/*!
* \brief get plot type of this container
* \return Plot type
*/
const
PlotType
&
getPlotType
()
const
{
return
m_PlotType
;
}
...
...
@@ -163,7 +167,7 @@ protected:
std
::
string
m_PlotKey
;
//! Unique Plot key
PlotType
m_PlotType
;
PlotType
m_PlotType
;
//! The plot Type
view
::
mpl
::
Mpl
&
m_Mpl
;
//! Mpl object
...
...
src/plot/PlotWindow.h
View file @
a7fdb7f2
...
...
@@ -215,7 +215,22 @@ public:
*/
void
colorLimits
(
float64
min
,
float64
max
)
throw
(
Error
);
/*!
* \brief Transform mouse coordinates to plot one
* \param[in] x The x coordinate
* \param[in] y The y coordinate
* \param[in] devicePixelRatio The pixel ratio of the display device
* \return The plot coordinates of the mouse pointer
* \throws Error
*/
std
::
vector
<
float64
>
toDataCoord
(
float64
x
,
float64
y
,
int32
devicePixelRatio
)
throw
(
Error
)
;
/*!
* \brief Check mouse click if in legend box
* \param[in] xmouse The x mouse coordinate
* \param[in] ymouse The y mouse coordinate
* \throws Error
*/
void
checkLegendPick
(
float64
x
,
float64
y
)
throw
(
Error
)
;
/*!
...
...
src/plot/property/PropertyPlot.cpp
View file @
a7fdb7f2
...
...
@@ -170,6 +170,9 @@ void PropertyPlot::deleteRoi(uint32 id) throw (Error) {
}
}
/*
* updateRoi
*/
void
PropertyPlot
::
updateRoi
()
throw
(
Error
)
{
if
(
m_MplRoi
)
{
...
...
@@ -225,6 +228,9 @@ void PropertyPlot::updateRoi() throw (Error) {
}
}
/*
* updateRoi
*/
void
PropertyPlot
::
updateRoi
(
int32
n
)
throw
(
Error
)
{
if
(
m_MplRoi
)
{
try
{
...
...
@@ -243,7 +249,7 @@ void PropertyPlot::updateRoi(int32 n) throw (Error) {
}
/*
* update
Plot
* update
*/
void
PropertyPlot
::
update
(
int32
id
)
{
if
(
m_MplRoi
)
{
...
...
src/plot/property/PropertyPlot.h
View file @
a7fdb7f2
...
...
@@ -108,7 +108,15 @@ protected:
*/
std
::
string
getPlotTitle
();
/*!
* \brief Update all roi
*/
void
updateRoi
()
throw
(
Error
);
/*!
* \brief Update a roi n
* \param[in] n The roi indice to update
*/
void
updateRoi
(
int32
n
)
throw
(
Error
);
bool
m_DimChanged
;
//! Data dimensions changed flag
...
...
src/view/mpl/Mpl.h
View file @
a7fdb7f2
...
...
@@ -232,7 +232,7 @@ private:
bp
::
object
m_BackendsModule
;
//! Matplotlib Backends module
bp
::
object
m_WidgetsModule
;
//! Matplotlib widgets module
bp
::
object
m_PatchesModule
;
//! Matplotlib patches module
bp
::
object
m_GarbageCollector
;
bp
::
object
m_GarbageCollector
;
//! Garbage collector module
};
...
...
src/view/mpl/MplFigure.h
View file @
a7fdb7f2
...
...
@@ -197,10 +197,18 @@ public:
return
m_Canvas
;
}
/*!
* \brief Set the main axis
* \param[in] axis The axis to set
*/
void
setMainAxis
(
const
bp
::
object
&
axis
)
{
m_MainAxis
=
axis
;
}
/*!
* \brief getter
* \return The main axis
*/
const
bp
::
object
&
getMainAxis
()
{
return
m_MainAxis
;
}
...
...
src/view/mpl/MplPlot2D.h
View file @
a7fdb7f2
...
...
@@ -288,7 +288,12 @@ public:
*/
void
hideAxis
()
throw
(
Error
);
/*!
* \brief Invert the Y Axis
* \throws Error
*/
void
invertYAxis
()
throw
(
Error
);
private:
/*!
...
...
src/view/mpl/MplRoi.cpp
View file @
a7fdb7f2
...
...
@@ -248,7 +248,7 @@ void MplRoi::updateRoi(int32 id, const std::vector<float64>& rect) throw (Error)
}
/*
*
plotR
ectangle
*
r
ectangle
Selector
*/
void
MplRoi
::
rectangleSelector
(
const
std
::
string
&
color
)
{
try
{
...
...
src/view/mpl/MplRoi.h
View file @
a7fdb7f2
...
...
@@ -38,6 +38,7 @@ class MplRoi {
public:
//! Rectangle structure for defining a Roi
struct
Rectangle
{
float64
x0
;
float64
y0
;
...
...
@@ -50,6 +51,7 @@ public:
/*!
* \brief constructor
* \param[in] plotType The plot type
* \param[in] mpl Mpl object
* \param[in] figure MplFigure object
*/
...
...
@@ -71,26 +73,22 @@ public:
/*!
* \brief Start of sequence modify a roi
* \param[in] id The id of the roi
* \param[in] color The color of the roi
* \throws Error
*/
void
modifyRoiStart
(
uint32
id
,
const
std
::
string
&
color
)
throw
(
Error
);
// /*!
// * \brief End of sequence modify a roi
// * \param[in] id The id of the roi
// * \param[in] color The color of the roi box
// * \throws Error
// */
// void modifyRoiEnd(uint32 id, const std::string& color) throw (Error);
// /*!
// * \brief Delete a roi
// * \param[in] id The id of the roi
// * \throws Error
// */
// void deleteRoi(uint32 id) throw (Error);
/*!
* \brief Update all roi
* \param[in] rects The roi rectangles coordinates
*/
void
updateRoi
(
const
std
::
vector
<
std
::
vector
<
float64
>>&
rects
)
throw
(
Error
);
/*!
* \brief Update a roi n
* \param[in] n The roi indice to update
* \param[in] rects The roi rectangles coordinates
*/
void
updateRoi
(
int32
n
,
const
std
::
vector
<
float64
>&
rect
)
throw
(
Error
);
static
float64
x0
,
y0
,
x1
,
y1
;
// Box coordinates
...
...
@@ -103,22 +101,53 @@ public:
*/
static
void
onselect
(
const
boost
::
python
::
object
&
eclick
,
const
boost
::
python
::
object
&
erelease
);
/*!
* \brief getter of the roi actual X0 coordinate
* \return Coordinate
*/
float64
getX0
()
const
{
return
x0
;
}
/*!
* \brief getter of the roi actual Y0 coordinate
* \return Coordinate
*/
float64
getY0
()
const
{
return
y0
;
}
/*!
* \brief getter of the roi actual X1 coordinate
* \return Coordinate
*/
float64
getX1
()
const
{
return
x1
;
}
/*!
* \brief getter of the roi actual Y1 coordinate
* \return Coordinate
*/
float64
getY1
()
const
{
return
y1
;
}
private:
void
rectangleSelector
(
const
std
::
string
&
color
);
void
plotRectangle
(
uint32
n
,
Rectangle
&
rect
);
/*!
* \brief Plot the rectangle selector
* \param[in] color The color of the selector
* \throws Error
*/
void
rectangleSelector
(
const
std
::
string
&
color
)
throw
(
Error
);
/*!
* \brief Plot the rectangle
* \param[in] n The roi number
* \param[in] rects The roi rectangle info
* \throws Error
*/
void
plotRectangle
(
uint32
n
,
Rectangle
&
rect
)
throw
(
Error
);
Mpl
&
m_Mpl
;
//! Matplotlib Figure object
MplFigure
&
m_MplFigure
;
//! Matplotlib Figure object
...
...
src/view/mpl/widgets/MplLegend.cpp
View file @
a7fdb7f2
...
...
@@ -178,7 +178,7 @@ void MplLegend::checkBoxLegend(float64 xmouse, float64 ymouse) throw (Error) {
/*
* setVisible
*/
void
MplLegend
::
setVisible
(
bool
state
)
{
void
MplLegend
::
setVisible
(
bool
state
)
throw
(
Error
)
{
mpl
::
MplLock
lock
;
auto
args
=
bp
::
make_tuple
(
state
);
try
{
...
...
src/view/mpl/widgets/MplLegend.h
View file @
a7fdb7f2
...
...
@@ -67,9 +67,14 @@ public:
* \param[in] ymouse The y mouse coordinate
* \throws Error
*/
void
checkBoxLegend
(
float64
xmouse
,
float64
ymouse
)
throw
(
Error
)
;
void
checkBoxLegend
(
float64
xmouse
,
float64
ymouse
)
throw
(
Error
);
void
setVisible
(
bool
state
);
/*!
* \brief Set visible stae of the legend box
* \param[in] state The state to set
* \throws Error
*/
void
setVisible
(
bool
state
)
throw
(
Error
);
private:
...
...
src/view/qt/QtRoiWidget.cpp
View file @
a7fdb7f2
...
...
@@ -164,7 +164,7 @@ void QtRoiWidget::newRoi() {
}
/*
* modify
* modify
Roi
*/
void
QtRoiWidget
::
modifyRoi
()
{
try
{
...
...
@@ -186,7 +186,7 @@ void QtRoiWidget::modifyRoi() {
//}
/*
*
new
Roi
*
validate
Roi
*/
void
QtRoiWidget
::
validateRoi
()
{
try
{
...
...
src/view/qt/QtRoiWidget.h
View file @
a7fdb7f2
...
...
@@ -64,7 +64,7 @@ public:
public
Q_SLOTS
:
/*!
* \brief
Modify a
roi
* \brief
New
roi
*/
void
newRoi
();
...
...
@@ -99,6 +99,10 @@ public Q_SLOTS:
*/
void
showRoiCoord
(
float64
x0
,
float64
y0
,
float64
x1
,
float64
y1
);
/*!
* \brief Update a roi sum n
* \param[in] sum The detector sum value
*/
void
updateSum
(
float64
sum
);
/*!
...
...
@@ -107,6 +111,10 @@ public Q_SLOTS:
*/
void
switchPlot
(
plot
::
PlotType
plottype
);
/*!
* \brief Set the Id of the roi
* \param[in] id The new id
*/
void
setId
(
uint32
id
);
private:
...
...
src/view/qt/QtWindow.h
View file @
a7fdb7f2
...
...
@@ -108,6 +108,9 @@ public:
*/
bool
ratioActivated
()
const
;
/*!
* \brief Allow Roi Functionnalities on the Qt interface
*/
void
allowRoiFunctionnalities
();
/*!
...
...
@@ -121,7 +124,18 @@ public:
*/
void
deleteRoi
(
uint32
id
);
/*!
* \brief Update a roi n
* \param[in] n The roi indice to update
* \param[in] rects The roi rectangles coordinates
*/
void
updateRoi
(
const
std
::
vector
<
std
::
vector
<
float64
>>&
rects
);
/*!
* \brief Update a roi sum n
* \param[in] id The roi indice
* \param[in] sum The detector sum value
*/
void
updateRoi
(
int32
n
,
const
std
::
vector
<
float64
>&
vect
);
/*!
...
...
@@ -134,6 +148,11 @@ public:
*/
void
showRoiCoord
(
uint32
id
,
float64
x0
,
float64
y0
,
float64
x1
,
float64
y1
);
/*!
* \brief Update a roi sum n
* \param[in] id The roi indice
* \param[in] sum The detector sum value
*/
void
updateSum
(
uint32
id
,
float64
sum
);
/*!
...
...
@@ -153,6 +172,10 @@ public:
*/
void
readSettings
();
/*!
* \brief get plot type of this container
* \return Plot type
*/
const
plot
::
PlotType
&
getPlotType
()
const
{
return
m_Plottype
;
}
...
...
@@ -178,7 +201,7 @@ private:
std
::
unique_ptr
<
QtUpdateThread
>
m_UpdateThread
;
//! Update QT thread
std
::
string
m_PlotKey
;
//! Use plot key for name as save settings name
plot
::
PlotType
m_Plottype
;
plot
::
PlotType
m_Plottype
;
//! The plot type
std
::
vector
<
std
::
unique_ptr
<
QtRoiWidget
>>
m_RoiWidgets
;
//! Plot widget
static
const
std
::
string
ROI_COLOR
;
// ROI color
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment