Use longest edge in face for horizontal/vertical alignment (#20374)
* App: Add second direction to getCameraAlignmentDirection() * Part: Find longest face edge for horizontal/vertical alignment * Gui: Use longest face edge for horizontal/vertical alignment * App: Improve horizontal/vertical alignment for Datums and LCS
This commit is contained in:
@@ -58,10 +58,15 @@ DatumElement::DatumElement(bool hideRole)
|
||||
|
||||
DatumElement::~DatumElement() = default;
|
||||
|
||||
bool DatumElement::getCameraAlignmentDirection(Base::Vector3d& direction, const char* subname) const
|
||||
bool DatumElement::getCameraAlignmentDirection(Base::Vector3d& directionZ, Base::Vector3d& directionX, const char* subname) const
|
||||
{
|
||||
Q_UNUSED(subname);
|
||||
Placement.getValue().getRotation().multVec(baseDir, direction);
|
||||
|
||||
Placement.getValue().getRotation().multVec(baseDir, directionZ);
|
||||
|
||||
if (baseDir == Base::Vector3d::UnitZ) {
|
||||
Placement.getValue().getRotation().multVec(Base::Vector3d::UnitX, directionX);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -142,11 +147,14 @@ LocalCoordinateSystem::LocalCoordinateSystem()
|
||||
|
||||
LocalCoordinateSystem::~LocalCoordinateSystem() = default;
|
||||
|
||||
bool LocalCoordinateSystem::getCameraAlignmentDirection(Base::Vector3d& direction,
|
||||
bool LocalCoordinateSystem::getCameraAlignmentDirection(Base::Vector3d& directionZ,
|
||||
Base::Vector3d& directionX,
|
||||
const char* subname) const
|
||||
{
|
||||
Q_UNUSED(subname);
|
||||
Placement.getValue().getRotation().multVec(Base::Vector3d(0., 0., 1.), direction);
|
||||
|
||||
Placement.getValue().getRotation().multVec(Base::Vector3d::UnitZ, directionZ);
|
||||
Placement.getValue().getRotation().multVec(Base::Vector3d::UnitX, directionX);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
Base::Vector3d getDirection() const;
|
||||
Base::Vector3d getBaseDirection() const;
|
||||
|
||||
bool getCameraAlignmentDirection(Base::Vector3d& direction, const char* subname) const override;
|
||||
bool getCameraAlignmentDirection(Base::Vector3d& directionZ, Base::Vector3d& directionX, const char* subname) const override;
|
||||
|
||||
/// Returns true if this DatumElement is part of a App::Origin.
|
||||
bool isOriginFeature() const;
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
return "Gui::ViewProviderCoordinateSystem";
|
||||
}
|
||||
|
||||
bool getCameraAlignmentDirection(Base::Vector3d& direction, const char* subname) const override;
|
||||
bool getCameraAlignmentDirection(Base::Vector3d& directionZ, Base::Vector3d& directionX, const char* subname) const override;
|
||||
|
||||
/** @name Axis and plane access
|
||||
* This functions returns casted axis and planes objects and asserts they are set correctly
|
||||
|
||||
@@ -213,10 +213,11 @@ void GeoFeature::setMaterialAppearance(const App::Material& material)
|
||||
Q_UNUSED(material)
|
||||
}
|
||||
|
||||
bool GeoFeature::getCameraAlignmentDirection(Base::Vector3d& direction, const char* subname) const
|
||||
bool GeoFeature::getCameraAlignmentDirection(Base::Vector3d& directionZ, Base::Vector3d& directionX, const char* subname) const
|
||||
{
|
||||
Q_UNUSED(subname)
|
||||
Q_UNUSED(direction)
|
||||
Q_UNUSED(directionZ)
|
||||
Q_UNUSED(directionX)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -151,11 +151,13 @@ public:
|
||||
/**
|
||||
* @brief Virtual function to get the camera alignment direction
|
||||
*
|
||||
* Finds a direction to align the camera with.
|
||||
* Finds a directionZ to align the camera with.
|
||||
* May also find an optional directionX which could be used for horizontal or vertical alignment.
|
||||
*
|
||||
* @return bool whether or not a direction is found.
|
||||
* @return bool whether or not a directionZ is found.
|
||||
*/
|
||||
virtual bool getCameraAlignmentDirection(Base::Vector3d& direction,
|
||||
virtual bool getCameraAlignmentDirection(Base::Vector3d& directionZ,
|
||||
Base::Vector3d& directionX,
|
||||
const char* subname = nullptr) const;
|
||||
/** Search sub element using internal cached geometry
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user