Minsky
minsky::Canvas::Model Struct Reference

#include <canvas.h>

Inheritance diagram for minsky::Canvas::Model:
Inheritance graph
Collaboration diagram for minsky::Canvas::Model:
Collaboration graph

Public Member Functions

void updateTimestamp ()
 
 Model ()
 
 Model (const GroupPtr &g)
 
Modeloperator= (const GroupPtr &model)
 
void zoom (double x, double y, double z)
 

Public Attributes

Exclude< Timestamptimestamp {Timestamp::clock::now()}
 
GroupPtr parent
 
float px =0
 
float py =0
 
float pz =1
 

Detailed Description

Definition at line 69 of file canvas.h.

Constructor & Destructor Documentation

◆ Model() [1/2]

minsky::Canvas::Model::Model ( )
inline

Definition at line 75 of file canvas.h.

75 {}

◆ Model() [2/2]

minsky::Canvas::Model::Model ( const GroupPtr g)
inline

Definition at line 76 of file canvas.h.

76 {operator=(g);}
Model & operator=(const GroupPtr &model)
Definition: canvas.h:77

Member Function Documentation

◆ operator=()

Model& minsky::Canvas::Model::operator= ( const GroupPtr model)
inline

Definition at line 77 of file canvas.h.

77  {
79  if (this->get())
80  {
81  // restore previous stuff
82  (*this)->group=parent;
83  (*this)->m_x=px;
84  (*this)->m_y=py;
85  (*this)->relZoom=pz;
86  }
87  parent=model->group.lock();
88  model->group.reset();
89  px=model->m_x;
90  py=model->m_y;
91  pz=model->relZoom;
92  model->group.reset(); // disassociate model from it's parent
93  GroupPtr::operator=(model);
94  return *this;
95  }
Model model
Definition: canvas.h:103
GroupPtr parent
Definition: canvas.h:73
void updateTimestamp()
Definition: canvas.h:72

◆ updateTimestamp()

void minsky::Canvas::Model::updateTimestamp ( )
inline

Definition at line 72 of file canvas.h.

72 {timestamp=Timestamp::clock::now();}
Exclude< Timestamp > timestamp
Definition: canvas.h:71

◆ zoom()

void minsky::Canvas::Model::zoom ( double  x,
double  y,
double  z 
)
inline

Definition at line 96 of file canvas.h.

Referenced by minsky::Canvas::zoom().

96  {
97  if (fabs(x-(*this)->x())>1e-5 || fabs(y-(*this)->y())>1e-5)
98  updateTimestamp(); // Why is this needed??
99  (*this)->zoom(x,y,z);
100  }
void updateTimestamp()
Definition: canvas.h:72
Here is the caller graph for this function:

Member Data Documentation

◆ parent

GroupPtr minsky::Canvas::Model::parent

Definition at line 73 of file canvas.h.

◆ px

float minsky::Canvas::Model::px =0

Definition at line 74 of file canvas.h.

◆ py

float minsky::Canvas::Model::py =0

Definition at line 74 of file canvas.h.

◆ pz

float minsky::Canvas::Model::pz =1

Definition at line 74 of file canvas.h.

◆ timestamp

Exclude<Timestamp> minsky::Canvas::Model::timestamp {Timestamp::clock::now()}

Definition at line 71 of file canvas.h.


The documentation for this struct was generated from the following file: