ufe 6.2
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
transform3d.h
Go to the documentation of this file.
1#line 1 "D:/Jenkins/workspace/EMS/ECG/ufe/full/ufe-full-python3.11-windows/ufe/include/transform3d.h"
2#ifndef _transform3d
3#define _transform3d
4// ===========================================================================
5// Copyright 2020 Autodesk, Inc. All rights reserved.
6//
7// Use of this software is subject to the terms of the Autodesk license
8// agreement provided at the time of installation or download, or which
9// otherwise accompanies this software in either electronic or hard copy form.
10// ===========================================================================
11
12#include "common/ufeExport.h"
13#include "sceneItem.h"
14#include "observer.h"
16#include "types.h"
17
18#include <memory>
19#include <array>
20
22
24
31{
32public:
33
34 // The None enumerant is deprecated, and may be removed in a future
35 // major version of UFE.
36 enum Type {NoHint, None = NoHint, Translate, Rotate, Scale, RotatePivot, ScalePivot};
42
43 inline Type type() const { return fType; }
44
45private:
46
47 const Type fType{None};
48};
49
51
53{
54public:
55 typedef std::shared_ptr<Transform3dRead> Ptr;
56
64 static Ptr transform3dRead(const SceneItem::Ptr& item);
65
68
71
74
76 virtual const Path& path() const = 0;
77
79 virtual SceneItem::Ptr sceneItem() const = 0;
80
83 virtual Matrix4d matrix() const = 0;
84
89
94
102 virtual Matrix4d segmentInclusiveMatrix() const = 0;
103
111 virtual Matrix4d segmentExclusiveMatrix() const = 0;
112};
113
115
154{
155public:
156 typedef std::shared_ptr<Transform3d> Ptr;
157
165 static Ptr transform3d(const SceneItem::Ptr& item);
166
177 const SceneItem::Ptr& item,
179 );
180
188 static bool addObserver(
189 const SceneItem::Ptr& item, const Observer::Ptr& obs);
190
198 static bool removeObserver(
199 const SceneItem::Ptr& item, const Observer::Ptr& obs);
200
201 typedef bool (*RemoveObserverItemType)(const SceneItem::Ptr& item, const Observer::Ptr& obs);
202
212 static bool removeObserver(
213 const Path& path, const Observer::Ptr& obs);
214
215 typedef bool (*RemoveObserverPathType)(const Path& path, const Observer::Ptr& obs);
216
222 static std::size_t nbObservers(const SceneItem::Ptr& item);
223
231 static bool hasObserver(
232 const SceneItem::Ptr& item, const Observer::Ptr& obs);
233
236 static bool hasObservers(const Path& path);
237
242 static bool hasObservers(Rtid runTimeId);
243
247 static void notify(const Path& path);
248
252 Transform3d(const Transform3d&) = default;
254 virtual ~Transform3d() override;
255
262 double x, double y, double z) = 0;
263
265 return translateCmd(0, 0, 0); }
266
272 virtual void translate(double x, double y, double z) {
273 auto cmd = translateCmd(x, y, z);
274 if (cmd) {
275 cmd->execute();
276 }
277 }
278
281 virtual Vector3d translation() const = 0;
282
290 double x, double y, double z) = 0;
291
293 return rotateCmd(0, 0, 0); }
294
300 virtual void rotate(double x, double y, double z) {
301 auto cmd = rotateCmd(x, y, z);
302 if (cmd) {
303 cmd->execute();
304 }
305 }
306
310 virtual Vector3d rotation() const = 0;
311
318 double x, double y, double z) = 0;
319
321 return scaleCmd(1, 1, 1); }
322
328 virtual void scale(double x, double y, double z) {
329 auto cmd = scaleCmd(x, y, z);
330 if (cmd) {
331 cmd->execute();
332 }
333 }
334
337 virtual Vector3d scale() const = 0;
338
346 double x, double y, double z) = 0;
347
349 return rotatePivotCmd(0, 0, 0); }
350
356 virtual void rotatePivot(double x, double y, double z) {
357 auto cmd = rotatePivotCmd(x, y, z);
358 if (cmd) {
359 cmd->execute();
360 }
361 }
362
365 virtual Vector3d rotatePivot() const = 0;
366
374 double x, double y, double z) = 0;
375
377 return scalePivotCmd(0, 0, 0); }
378
384 virtual void scalePivot(double x, double y, double z) {
385 auto cmd = scalePivotCmd(x, y, z);
386 if (cmd) {
387 cmd->execute();
388 }
389 }
390
393 virtual Vector3d scalePivot() const = 0;
394
405 double x, double y, double z) {
406 (void) x; (void) y; (void) z;
407 return nullptr;
408 }
409
411 return translateRotatePivotCmd(0, 0, 0); }
412
419 virtual void translateRotatePivot(double x, double y, double z) {
420 auto cmd = translateRotatePivotCmd(x, y, z);
421 if (cmd) {
422 cmd->execute();
423 }
424 }
425
430 return Vector3d(0, 0, 0);
431 }
432
443 double x, double y, double z) {
444 (void) x; (void) y; (void) z;
445 return nullptr;
446 }
447
449 return translateScalePivotCmd(0, 0, 0); }
450
456 virtual void translateScalePivot(double x, double y, double z) {
457 auto cmd = translateScalePivotCmd(x, y, z);
458 if (cmd) {
459 cmd->execute();
460 }
461 }
462
467 return Vector3d(0, 0, 0);
468 }
469
479 double x, double y, double z) {
480 (void) x; (void) y; (void) z;
481 return nullptr;
482 }
483
485 return rotateAxisCmd(0, 0, 0); }
486
492 virtual void rotateAxis(double x, double y, double z) {
493 auto cmd = rotateAxisCmd(x, y, z);
494 if (cmd) {
495 cmd->execute();
496 }
497 }
498
501 virtual Vector3d rotateAxis() const {
502 return Vector3d(0, 0, 0);
503 }
504
513 double xy, double xz, double yz) {
514 (void) xy; (void) xz; (void) yz;
515 return nullptr;
516 }
517
519 return shearCmd(0, 0, 0); }
520
526 virtual void shear(double xy, double xz, double yz) {
527 auto cmd = shearCmd(xy, xz, yz);
528 if (cmd) {
529 cmd->execute();
530 }
531 }
532
536 virtual Vector3d shear() const {
537 return Vector3d(0, 0, 0);
538 }
539
545
550 virtual void setMatrix(const Matrix4d& m) {
551 auto cmd = setMatrixCmd(m);
552 if (cmd) {
553 cmd->execute();
554 }
555 }
556};
557
558}
559
560#endif /* _transform3d */
Hint class for Transform3d editTransform3d.
Definition: transform3d.h:31
EditTransform3dHint & operator=(const EditTransform3dHint &)=delete
EditTransform3dHint(const EditTransform3dHint &)=delete
std::shared_ptr< Observer > Ptr
Definition: observer.h:36
Identify an object or 3D path in the scene.
Definition: path.h:38
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:44
std::shared_ptr< SetValue3UndoableCommand > Ptr
std::shared_ptr< SetValueUndoableCommand > Ptr
Abstract base class for 3D transform interface.
Definition: transform3d.h:154
static bool hasObserver(const SceneItem::Ptr &item, const Observer::Ptr &obs)
TranslateUndoableCommand::Ptr translateCmd()
Definition: transform3d.h:264
virtual Vector3d shear() const
Definition: transform3d.h:536
virtual Vector3d rotatePivotTranslation() const
Definition: transform3d.h:429
virtual ScaleUndoableCommand::Ptr scaleCmd(double x, double y, double z)=0
RotateUndoableCommand::Ptr rotateCmd()
Definition: transform3d.h:292
virtual TranslateUndoableCommand::Ptr rotatePivotCmd(double x, double y, double z)=0
virtual Vector3d rotatePivot() const =0
virtual Vector3d scalePivot() const =0
TranslateUndoableCommand::Ptr translateScalePivotCmd()
Definition: transform3d.h:448
virtual void shear(double xy, double xz, double yz)
Definition: transform3d.h:526
std::shared_ptr< Transform3d > Ptr
Definition: transform3d.h:156
static bool hasObservers(const Path &path)
virtual RotateUndoableCommand::Ptr rotateAxisCmd(double x, double y, double z)
Definition: transform3d.h:478
TranslateUndoableCommand::Ptr translateRotatePivotCmd()
Definition: transform3d.h:410
Transform3d(const Transform3d &)=default
Default copy constructor.
static std::size_t nbObservers(const SceneItem::Ptr &item)
virtual void rotate(double x, double y, double z)
Definition: transform3d.h:300
virtual void translateScalePivot(double x, double y, double z)
Definition: transform3d.h:456
virtual RotateUndoableCommand::Ptr rotateCmd(double x, double y, double z)=0
virtual ShearUndoableCommand::Ptr shearCmd(double xy, double xz, double yz)
Definition: transform3d.h:512
Transform3d()
Constructor.
virtual void scalePivot(double x, double y, double z)
Definition: transform3d.h:384
virtual void setMatrix(const Matrix4d &m)
Definition: transform3d.h:550
static bool hasObservers(Rtid runTimeId)
virtual void translate(double x, double y, double z)
Definition: transform3d.h:272
virtual TranslateUndoableCommand::Ptr translateRotatePivotCmd(double x, double y, double z)
Definition: transform3d.h:404
virtual Vector3d scale() const =0
static Ptr transform3d(const SceneItem::Ptr &item)
static Ptr editTransform3d(const SceneItem::Ptr &item, const EditTransform3dHint &hint=EditTransform3dHint())
ShearUndoableCommand::Ptr shearCmd()
Definition: transform3d.h:518
virtual Vector3d scalePivotTranslation() const
Definition: transform3d.h:466
TranslateUndoableCommand::Ptr rotatePivotCmd()
Definition: transform3d.h:348
virtual SetMatrix4dUndoableCommand::Ptr setMatrixCmd(const Matrix4d &m)=0
virtual void rotateAxis(double x, double y, double z)
Definition: transform3d.h:492
static bool removeObserver(const Path &path, const Observer::Ptr &obs)
virtual void rotatePivot(double x, double y, double z)
Definition: transform3d.h:356
virtual ~Transform3d() override
Destructor.
virtual Vector3d rotation() const =0
virtual Vector3d translation() const =0
RotateUndoableCommand::Ptr rotateAxisCmd()
Definition: transform3d.h:484
TranslateUndoableCommand::Ptr scalePivotCmd()
Definition: transform3d.h:376
virtual TranslateUndoableCommand::Ptr translateScalePivotCmd(double x, double y, double z)
Definition: transform3d.h:442
virtual TranslateUndoableCommand::Ptr scalePivotCmd(double x, double y, double z)=0
virtual void scale(double x, double y, double z)
Definition: transform3d.h:328
virtual TranslateUndoableCommand::Ptr translateCmd(double x, double y, double z)=0
virtual Vector3d rotateAxis() const
Definition: transform3d.h:501
static bool addObserver(const SceneItem::Ptr &item, const Observer::Ptr &obs)
static void notify(const Path &path)
ScaleUndoableCommand::Ptr scaleCmd()
Definition: transform3d.h:320
virtual void translateRotatePivot(double x, double y, double z)
Definition: transform3d.h:419
static bool removeObserver(const SceneItem::Ptr &item, const Observer::Ptr &obs)
Read-only abstract base class for 3D transform interface.
Definition: transform3d.h:53
virtual SceneItem::Ptr sceneItem() const =0
virtual ~Transform3dRead()
Destructor.
virtual Matrix4d segmentExclusiveMatrix() const =0
Matrix4d exclusiveMatrix() const
virtual Matrix4d matrix() const =0
Transform3dRead()
Constructor.
Transform3dRead(const Transform3dRead &)=default
Default copy constructor.
virtual Matrix4d segmentInclusiveMatrix() const =0
std::shared_ptr< Transform3dRead > Ptr
Definition: transform3d.h:55
static Ptr transform3dRead(const SceneItem::Ptr &item)
virtual const Path & path() const =0
Matrix4d inclusiveMatrix() const
Path path(const std::string &pathString)
TypedVectorN< double, 3 > Vector3d
Definition: types.h:122
uint32_t Rtid
Definition: rtid.h:26
Typed square matrix template.
Definition: types.h:224
#define UFE_NS_DEF
Definition: ufe.h:35
Definition of macros for symbol visibility.
#define UFE_SDK_DECL
Definition: ufeExport.h:36