24 #include "cairoRenderer.h" 25 #include "dynamicRavelCAPI.h" 26 #include "hypercube.h" 41 float localX(
float x)
const;
42 float localY(
float y)
const;
43 bool redraw(
int x0,
int y0,
int width,
int height)
override;
47 void mouseDown(
float x,
float y)
override;
48 void mouseUp(
float x,
float y)
override;
49 void mouseMove(
float x,
float y)
override;
50 void mouseOver(
float x,
float y);
55 class Ravel:
public ItemT<Ravel, Operation<OperationType::ravel>>,
public classdesc::Exclude<ravel::Ravel>
63 const double moveX=0.5, moveY=0.5, moveSz=0.1;
66 bool m_editorMode=
false;
69 ravel::HandleSort::Order previousOrder=ravel::HandleSort::forward;
78 std::vector<std::string> allSliceLabelsImpl(
int axis, ravel::HandleSort::Order)
const;
97 double radius()
const {
return wrappedRavel.radius();}
104 void leaveLockGroup();
105 void broadcastStateToLockGroup()
const;
107 void draw(cairo_t* cairo)
const override;
108 void resize(
const LassoBox&)
override;
109 bool inItem(
float x,
float y)
const override;
110 void onMouseDown(
float x,
float y)
override;
111 void onMouseUp(
float x,
float y)
override;
112 bool onMouseMotion(
float x,
float y)
override;
113 bool onMouseOver(
float x,
float y)
override;
116 Hypercube hypercube()
const;
117 void populateHypercube(
const Hypercube&);
119 unsigned maxRank()
const {
return wrappedRavel.numHandles();}
120 unsigned numHandles()
const {
return wrappedRavel.numHandles();}
122 size_t numSliceLabels(
size_t axis)
const {
return wrappedRavel.numSliceLabels(axis);}
124 void setRank(
unsigned r);
125 void adjustSlicer(
int);
126 bool onKeyPress(
int,
const std::string&,
int)
override;
137 void collapseAllHandles(
bool collapse=
true);
140 bool displayFilterCaliper()
const;
141 bool setDisplayFilterCaliper(
bool x);
143 {
return setDisplayFilterCaliper(!displayFilterCaliper());}
147 std::vector<std::string> allSliceLabels()
const;
149 std::vector<std::string> allSliceLabelsAxis(
int axis)
const;
151 std::vector<std::string> pickedSliceLabels()
const;
152 std::vector<std::string> pickedSliceLabels(
int axis)
const;
154 void pickSliceLabels(
int axis,
const std::vector<std::string>& pick);
158 std::vector<std::string> r;
159 for (
size_t i=0; i<wrappedRavel.numHandles(); ++i)
160 r.push_back(wrappedRavel.handleDescription(i));
165 Dimension dimension(
int handle)
const;
169 ravel::HandleSort::Order sortOrder()
const;
170 ravel::HandleSort::Order setSortOrder(ravel::HandleSort::Order);
173 void resortHandleIfDynamic();
176 ravel::HandleSort::Order setHandleSortOrder(ravel::HandleSort::Order,
int handle);
179 bool handleSortableByValue()
const;
182 void sortByValue(ravel::HandleSort::Order dir);
185 std::string description()
const;
186 void setDescription(
const std::string&);
189 std::string
handleDescription(
int handle)
const {
return wrappedRavel.handleDescription(handle);}
192 {wrappedRavel.setHandleDescription(handle,description);}
195 Dimension::Type dimensionType()
const;
196 Dimension::Type dimensionType(
int)
const;
197 std::string dimensionUnitsFormat()
const;
198 std::string dimensionUnitsFormat(
int)
const;
200 void setDimension(Dimension::Type type,
const std::string& units);
202 void setDimension(
int handleIndex, Dimension::Type type,
const std::string& units);
206 ravel::RavelState
getState()
const {
return wrappedRavel? wrappedRavel.getRavelState(): initState;}
209 void applyState(
const ravel::RavelState& state);
210 void displayDelayedTooltip(
float x,
float y)
override;
213 void exportAsCSV(
const std::string& filename,
bool tabular)
const;
215 Units units(
bool)
const override;
221 static std::vector<unsigned> lockGroupColours();
222 void joinLockGroup(
unsigned);
232 void addRavel(
const std::weak_ptr<Ravel>& ravel);
233 const std::vector<std::weak_ptr<Ravel> >&
ravels()
const {
return m_ravels;}
235 void initialBroadcast();
237 void broadcast(
const Ravel& ravel);
239 unsigned colour()
const {
return m_colour;}
244 void validateLockHandleInfo();
247 std::vector<std::string> allLockHandles()
const;
250 std::vector<std::string> ravelNames()
const;
253 std::vector<std::string> handleNames(
size_t ravel_idx)
const;
256 void setLockHandles(
const std::vector<std::string>& handles);
258 void addHandleInfo(
const std::weak_ptr<Ravel>& ravel);
259 void removeFromGroup(
const Ravel&);
263 #include "ravelWrap.cd" int selectedHandle() const
current handle mouse is over, or -1 if none
unsigned colour() const
an identifying tag used to colour locked ravels on canvas
std::vector< std::weak_ptr< Ravel > > m_ravels
ravel::RavelState getState() const
get the current state of the Ravel
void nextReduction(ravel::Op::ReductionOp op)
sets the type of the next reduction operation
bool toggleDisplayFilterCaliper()
void redistributeHandles()
redistribute handles according to current state
represents rectangular region of a lasso operation
static SVGRenderer svgRenderer
SVG icon to display when not in editor mode.
ravel::Ravel wrappedRavel
static unsigned nextColour
ravel::RavelState initState
used entirely to defer persisted state data until after first load from a variable ...
bool flipped(double rotation)
returns if the angle (in degrees) is in the second or third quadrant
bool editorMode() const override
indicate whether icon is in editor mode or icon mode
void handleSetReduction(int handle, ravel::Op::ReductionOp op)
set the reduction type for handle
void onMouseLeave() override
respond to mouse leave events (when mouse leaves item)
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky's state cha...
const Ravel * ravelCast() const override
RavelPopup popup
popup Ravel control window
represents the units (in sense of dimensional analysis) of a variable.
#define CLASSDESC_ACCESS(type)
std::vector< std::string > handleNames() const
return all handle names
std::string handleDescription(int handle) const
return the description field for handle handle.
std::shared_ptr< RavelLockGroup > lockGroup
group of ravels that move syncronously
const std::vector< std::weak_ptr< Ravel > > & ravels() const
void toggleEditorMode() override
size_t numSliceLabels(size_t axis) const
number of slice labels along axis axis
void operator=(const Ravel &)
std::vector< HandleLockInfo > handleLockInfo
Ravel * ravelCast() override
void setHandleDescription(int handle, const std::string &description)
set the description field for handle
ravel::HandleState HandleState
ravel::Op::ReductionOp ReductionOp
Dimensions axisDimensions
local override of axis dimensionality
unsigned numHandles() const