MCPcopy Create free account
hub / github.com/Kitware/VTK / DeepCopy

Method DeepCopy

Rendering/Core/vtkCamera.cxx:1552–1770  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Description: Copy the properties of `source' into `this'. Copy the contents of the matrices. \pre source_exists!=0 \pre not_this: source!=this

Source from the content-addressed store, hash-verified

1550// \pre source_exists!=0
1551// \pre not_this: source!=this
1552void vtkCamera::DeepCopy(vtkCamera* source)
1553{
1554 assert("pre: source_exists" && source != nullptr);
1555 assert("pre: not_this" && source != this);
1556
1557 this->PartialCopy(source);
1558
1559 // Deep copy the matrices:
1560 if (source->UserTransform == nullptr)
1561 {
1562 if (this->UserTransform != nullptr)
1563 {
1564 this->UserTransform->UnRegister(this);
1565 this->UserTransform = nullptr;
1566 }
1567 }
1568 else
1569 {
1570 if (this->UserTransform == nullptr)
1571 {
1572 this->UserTransform =
1573 static_cast<vtkHomogeneousTransform*>(source->UserTransform->MakeTransform());
1574 }
1575 this->UserTransform->DeepCopy(source->UserTransform);
1576 }
1577
1578 if (source->UserViewTransform == nullptr)
1579 {
1580 if (this->UserViewTransform != nullptr)
1581 {
1582 this->UserViewTransform->UnRegister(this);
1583 this->UserViewTransform = nullptr;
1584 }
1585 }
1586 else
1587 {
1588 if (this->UserViewTransform == nullptr)
1589 {
1590 this->UserViewTransform =
1591 static_cast<vtkHomogeneousTransform*>(source->UserViewTransform->MakeTransform());
1592 }
1593 this->UserViewTransform->DeepCopy(source->UserViewTransform);
1594 }
1595
1596 if (source->ExplicitProjectionTransformMatrix == nullptr)
1597 {
1598 if (this->ExplicitProjectionTransformMatrix != nullptr)
1599 {
1600 this->ExplicitProjectionTransformMatrix->UnRegister(this);
1601 this->ExplicitProjectionTransformMatrix = nullptr;
1602 }
1603 }
1604 else
1605 {
1606 if (this->ExplicitProjectionTransformMatrix == nullptr)
1607 {
1608 this->ExplicitProjectionTransformMatrix =
1609 source->ExplicitProjectionTransformMatrix->NewInstance();

Callers 1

Calls 6

PartialCopyMethod · 0.95
NewFunction · 0.70
assertFunction · 0.50
UnRegisterMethod · 0.45
MakeTransformMethod · 0.45
NewInstanceMethod · 0.45

Tested by

no test coverage detected