29 #include <cairo/cairo.h> 34 #include "polyPackBase.h" 35 #include <pack_base.h> 41 template <minsky::OperationType::Type T>
43 public classdesc::PolyPack<Operation<T> >
49 void iconDraw(cairo_t *)
const override;
51 {
return OperationTypeInfo::numArguments<T>()+1;}
106 virtual std::string
description(
const std::string&);
120 cairo_move_to(
cairo,0,-5);
121 cairo_line_to(
cairo,0,5);
122 cairo_move_to(
cairo,-5,0);
123 cairo_line_to(
cairo,5,0);
129 cairo_move_to(
cairo,-5,0);
130 cairo_line_to(
cairo,5,0);
136 cairo_move_to(
cairo,-5,-5);
137 cairo_line_to(
cairo,5,5);
138 cairo_move_to(
cairo,-5,5);
139 cairo_line_to(
cairo,5,-5);
145 cairo_move_to(
cairo,-5,0);
146 cairo_line_to(
cairo,5,0);
147 cairo_new_sub_path(
cairo);
149 cairo_new_sub_path(
cairo);
157 cairo_move_to(
cairo,-5,0);
158 cairo_show_text(
cairo,s);
164 void drawPort(F
f,
float x,
float y,
float rotation)
const 166 const ecolab::cairo::CairoSave cs(
cairo);
168 const double angle=rotation *
M_PI / 180.0;
171 cairo_rotate(
cairo, angle);
173 cairo_translate(
cairo,0.7*x,0.6*y);
174 cairo_scale(
cairo,0.5,0.5);
177 cairo_rotate(
cairo, -angle);
183 #include "operation.cd" 184 #include "operation.xcd" #define M_PI
some useful geometry types, defined from boost::geometry
std::string classType() const override
CLASSDESC_ACCESS(NamedOp)
Units units(bool) const override
compute the dimensional units
ItemT< Operation< T >, OperationBase > Super
std::size_t numPorts() const override
DrawBinOp(cairo_t *cairo, double z=1)
Operation(const Operation &x)
void drawPort(F f, float x, float y, float rotation) const
double arg
operation argument. For example, the offset used in a difference operator, or binsize in a binning op...
Operation & operator=(Operation &&x)
Units units(bool) const override
compute the dimensional units
void drawMultiply() const
base class for operations that have names
bool flipped(double rotation)
returns if the angle (in degrees) is in the second or third quadrant
void drawSymbol(const char *s) const
Type type() const override
virtual void updateBB()=0
represents the units (in sense of dimensional analysis) of a variable.
virtual std::string description() const
name of the associated data operation
static std::string typeName(int type)
return the symbolic name of type
Units units(bool check) const override
compute the dimensional units
std::string m_description
Operation & operator=(const Operation &x)
helper class to draw port label symbols
ItemT & operator=(const ItemT &)=default
void iconDraw(cairo_t *) const override
visual representation of operation on the canvas