23 #include <xml_pack_base.h> 24 #include <xml_unpack_base.h> 33 #include <cairo/cairo.h> 38 #include "polyPackBase.h" 39 #include <pack_base.h> 45 template <minsky::OperationType::Type T>
47 public classdesc::PolyPack<Operation<T> >
53 void iconDraw(cairo_t *)
const override;
55 {
return OperationTypeInfo::numArguments<T>()+1;}
101 class NamedOp:
public ecolab::TCLAccessor<NamedOp,std::string>
114 virtual std::string
description(
const std::string&);
128 cairo_move_to(
cairo,0,-5);
129 cairo_line_to(
cairo,0,5);
130 cairo_move_to(
cairo,-5,0);
131 cairo_line_to(
cairo,5,0);
137 cairo_move_to(
cairo,-5,0);
138 cairo_line_to(
cairo,5,0);
144 cairo_move_to(
cairo,-5,-5);
145 cairo_line_to(
cairo,5,5);
146 cairo_move_to(
cairo,-5,5);
147 cairo_line_to(
cairo,5,-5);
153 cairo_move_to(
cairo,-5,0);
154 cairo_line_to(
cairo,5,0);
155 cairo_new_sub_path(
cairo);
157 cairo_new_sub_path(
cairo);
165 cairo_move_to(
cairo,-5,0);
166 cairo_show_text(
cairo,s);
172 void drawPort(F
f,
float x,
float y,
float rotation)
const 174 const ecolab::cairo::CairoSave cs(
cairo);
176 const double angle=rotation *
M_PI / 180.0;
179 cairo_rotate(
cairo, angle);
181 cairo_translate(
cairo,0.7*x,0.6*y);
182 cairo_scale(
cairo,0.5,0.5);
185 cairo_rotate(
cairo, -angle);
191 #include "operation.cd" 192 #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
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky's state cha...
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