mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-24 19:40:33 +05:00
Improvement 0019703: deform (scale along axes) a shape.
This commit is contained in:
parent
a60b0da186
commit
d72b7ebbff
@ -7,13 +7,23 @@
|
|||||||
|
|
||||||
\n This operation creates a scaled shape basing on the initial
|
\n This operation creates a scaled shape basing on the initial
|
||||||
shape. For this, you need to define the \b Shape to be scaled, the
|
shape. For this, you need to define the \b Shape to be scaled, the
|
||||||
<b>Central Point</b> of scale and the Scale Factor.
|
<b>Central Point</b> of scale and the Scale Factor(s).
|
||||||
\n The \b Result will be a \b GEOM_Object.
|
\n The \b Result will be a \b GEOM_Object.
|
||||||
\n <b>TUI Command:</b> <em>geompy.MakeScaleTransform(Shape, CenterOfScale, Factor)</em>
|
\n <b>TUI Command:</b> <em>geompy.MakeScaleTransform(Shape, CenterOfScale, Factor)</em>
|
||||||
\n <b>Arguments:</b> Name + 1 shape(s) + 1 vertex + 1 Scale Factor.
|
\n <b>Arguments:</b> Name + 1 shape(s) + 1 vertex + 1 Scale Factor.
|
||||||
|
\n <b>TUI Command:</b> <em>geompy.MakeScaleAlongAxes(Shape, CenterOfScale, FactorX, FactorY, FactorZ)</em>
|
||||||
|
\n <b>Arguments:</b> Name + 1 shape(s) + 1 vertex + 3 Scale Factors.
|
||||||
\n <b>Advanced option:</b>
|
\n <b>Advanced option:</b>
|
||||||
\ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments".
|
\ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments".
|
||||||
|
|
||||||
|
\note If <b>Central Point</b> is not defined, the scaling will be
|
||||||
|
performed relatively the origin of global coordinate system.
|
||||||
|
|
||||||
|
\note Scaling by a factor is a simple transformation, it does not modify
|
||||||
|
geometry of the shape, while scaling by different factors along axes
|
||||||
|
is a general transformation, which can modify geometry, for example, a
|
||||||
|
circle can be transformed into an ellipse.
|
||||||
|
|
||||||
\image html transformation10.png
|
\image html transformation10.png
|
||||||
|
|
||||||
\n <b>Example:</b>
|
\n <b>Example:</b>
|
||||||
@ -23,6 +33,6 @@ shape. For this, you need to define the \b Shape to be scaled, the
|
|||||||
\image html scale_transformsn2.png
|
\image html scale_transformsn2.png
|
||||||
|
|
||||||
Our <b>TUI Scripts</b> provide you with useful examples of the use of
|
Our <b>TUI Scripts</b> provide you with useful examples of the use of
|
||||||
\ref tui_scale "Transformation Operations".
|
\ref tui_scale "Scale Transformation" and of \ref swig_scale "Scale Along Axes Transformation"
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@ -43,6 +43,12 @@
|
|||||||
\until MakeSewing
|
\until MakeSewing
|
||||||
|
|
||||||
\anchor swig_all_trsf
|
\anchor swig_all_trsf
|
||||||
|
\until RotatPnt
|
||||||
|
|
||||||
|
\anchor swig_scale
|
||||||
|
\until Scale4
|
||||||
|
|
||||||
|
\anchor swig_all_trsf_more
|
||||||
\until MakeOffset
|
\until MakeOffset
|
||||||
|
|
||||||
\anchor swig_ChangeOrientation
|
\anchor swig_ChangeOrientation
|
||||||
|
@ -735,6 +735,33 @@ module GEOM
|
|||||||
GEOM_Object ScaleShapeCopy (in GEOM_Object theObject, in GEOM_Object thePoint,
|
GEOM_Object ScaleShapeCopy (in GEOM_Object theObject, in GEOM_Object thePoint,
|
||||||
in double theFactor);
|
in double theFactor);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Scale the given object by different factors along coordinate axes.
|
||||||
|
* \param theObject The object to be scaled.
|
||||||
|
* \param thePoint Center point for scaling.
|
||||||
|
* \param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
|
||||||
|
* \return theObject.
|
||||||
|
*/
|
||||||
|
GEOM_Object ScaleShapeAlongAxes (in GEOM_Object theObject,
|
||||||
|
in GEOM_Object thePoint,
|
||||||
|
in double theFactorX,
|
||||||
|
in double theFactorY,
|
||||||
|
in double theFactorZ);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Scale the given object by different factors along coordinate axes,
|
||||||
|
* creating its copy before the scaling.
|
||||||
|
* \param theObject The object to be scaled.
|
||||||
|
* \param thePoint Center point for scaling.
|
||||||
|
* \param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
|
||||||
|
* \return New GEOM_Object, containing the scaled shape.
|
||||||
|
*/
|
||||||
|
GEOM_Object ScaleShapeAlongAxesCopy (in GEOM_Object theObject,
|
||||||
|
in GEOM_Object thePoint,
|
||||||
|
in double theFactorX,
|
||||||
|
in double theFactorY,
|
||||||
|
in double theFactorZ);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Modify the Location of the given object by LCS.
|
* Modify the Location of the given object by LCS.
|
||||||
* \param theObject The object to be displaced.
|
* \param theObject The object to be displaced.
|
||||||
|
@ -309,6 +309,16 @@ module GEOM
|
|||||||
GEOM_Object ScaleShapeCopy (in GEOM_Object theObject,
|
GEOM_Object ScaleShapeCopy (in GEOM_Object theObject,
|
||||||
in GEOM_Object thePoint,
|
in GEOM_Object thePoint,
|
||||||
in double theFactor) ;
|
in double theFactor) ;
|
||||||
|
GEOM_Object ScaleShapeAlongAxes (in GEOM_Object theObject,
|
||||||
|
in GEOM_Object thePoint,
|
||||||
|
in double theFactorX,
|
||||||
|
in double theFactorY,
|
||||||
|
in double theFactorZ);
|
||||||
|
GEOM_Object ScaleShapeAlongAxesCopy (in GEOM_Object theObject,
|
||||||
|
in GEOM_Object thePoint,
|
||||||
|
in double theFactorX,
|
||||||
|
in double theFactorY,
|
||||||
|
in double theFactorZ);
|
||||||
GEOM_Object PositionShape (in GEOM_Object theObject,
|
GEOM_Object PositionShape (in GEOM_Object theObject,
|
||||||
in GEOM_Object theStartLCS,
|
in GEOM_Object theStartLCS,
|
||||||
in GEOM_Object theEndLCS) ;
|
in GEOM_Object theEndLCS) ;
|
||||||
|
@ -127,6 +127,7 @@ revol.png \
|
|||||||
rotate.png \
|
rotate.png \
|
||||||
rotatepnt.png \
|
rotatepnt.png \
|
||||||
scale.png \
|
scale.png \
|
||||||
|
scale_along_axes.png \
|
||||||
section.png \
|
section.png \
|
||||||
select1.png \
|
select1.png \
|
||||||
sewing.png \
|
sewing.png \
|
||||||
|
BIN
resources/scale_along_axes.png
Normal file
BIN
resources/scale_along_axes.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 513 B |
@ -314,7 +314,8 @@ void BasicGUI_CurveDlg::SelectionIntoArgument()
|
|||||||
//Find Object in study
|
//Find Object in study
|
||||||
_PTR(SObject) obj ( aDStudy->FindObjectID( anIt.Value()->getEntry() ) );
|
_PTR(SObject) obj ( aDStudy->FindObjectID( anIt.Value()->getEntry() ) );
|
||||||
bool inStudy = false;
|
bool inStudy = false;
|
||||||
for (_PTR(ChildIterator) iit (aDStudy->NewChildIterator(obj)); iit->More(); iit->Next()) {
|
_PTR(ChildIterator) iit (aDStudy->NewChildIterator(obj));
|
||||||
|
for (; iit->More() && !inStudy; iit->Next()) {
|
||||||
_PTR(SObject) child (iit->Value());
|
_PTR(SObject) child (iit->Value());
|
||||||
QString aChildName = child->GetName();
|
QString aChildName = child->GetName();
|
||||||
if (aChildName == aName) {
|
if (aChildName == aName) {
|
||||||
|
@ -331,6 +331,10 @@ msgstr "rotatepnt.png"
|
|||||||
msgid "ICON_DLG_SCALE"
|
msgid "ICON_DLG_SCALE"
|
||||||
msgstr "scale.png"
|
msgstr "scale.png"
|
||||||
|
|
||||||
|
#ScaleDlg
|
||||||
|
msgid "ICON_DLG_SCALE_ALONG_AXES"
|
||||||
|
msgstr "scale_along_axes.png"
|
||||||
|
|
||||||
#OffsetDlg
|
#OffsetDlg
|
||||||
msgid "ICON_DLG_OFFSET"
|
msgid "ICON_DLG_OFFSET"
|
||||||
msgstr "offset.png"
|
msgstr "offset.png"
|
||||||
|
@ -1280,6 +1280,15 @@ msgstr "Offset Surface"
|
|||||||
msgid "GEOM_SCALE_FACTOR"
|
msgid "GEOM_SCALE_FACTOR"
|
||||||
msgstr "Scale Factor :"
|
msgstr "Scale Factor :"
|
||||||
|
|
||||||
|
msgid "GEOM_SCALE_FACTOR_X"
|
||||||
|
msgstr "Scale Factor X :"
|
||||||
|
|
||||||
|
msgid "GEOM_SCALE_FACTOR_Y"
|
||||||
|
msgstr "Scale Factor Y :"
|
||||||
|
|
||||||
|
msgid "GEOM_SCALE_FACTOR_Z"
|
||||||
|
msgstr "Scale Factor Z :"
|
||||||
|
|
||||||
#: GeometryGUI_SectionDlg.cxx:50
|
#: GeometryGUI_SectionDlg.cxx:50
|
||||||
msgid "GEOM_SECTION_TITLE"
|
msgid "GEOM_SECTION_TITLE"
|
||||||
msgstr "BOOLEAN : Section Of Two Objects"
|
msgstr "BOOLEAN : Section Of Two Objects"
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#define SCALE_ARG_SHAPE 1
|
#define SCALE_ARG_SHAPE 1
|
||||||
#define SCALE_ARG_VALUE 2
|
#define SCALE_ARG_VALUE 2
|
||||||
#define SCALE_ARG_POINT 3
|
#define SCALE_ARG_POINT 3
|
||||||
|
#define SCALE_ARG_VALUE_Y 4
|
||||||
|
#define SCALE_ARG_VALUE_Z 5
|
||||||
|
|
||||||
class GEOMImpl_IScale
|
class GEOMImpl_IScale
|
||||||
{
|
{
|
||||||
@ -44,6 +46,14 @@ class GEOMImpl_IScale
|
|||||||
|
|
||||||
Handle(GEOM_Function) GetPoint() { return _func->GetReference(SCALE_ARG_POINT); }
|
Handle(GEOM_Function) GetPoint() { return _func->GetReference(SCALE_ARG_POINT); }
|
||||||
|
|
||||||
|
void SetFactorX(double theValue) { _func->SetReal(SCALE_ARG_VALUE , theValue); }
|
||||||
|
void SetFactorY(double theValue) { _func->SetReal(SCALE_ARG_VALUE_Y, theValue); }
|
||||||
|
void SetFactorZ(double theValue) { _func->SetReal(SCALE_ARG_VALUE_Z, theValue); }
|
||||||
|
|
||||||
|
double GetFactorX() { return _func->GetReal(SCALE_ARG_VALUE ); }
|
||||||
|
double GetFactorY() { return _func->GetReal(SCALE_ARG_VALUE_Y); }
|
||||||
|
double GetFactorZ() { return _func->GetReal(SCALE_ARG_VALUE_Z); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Handle(GEOM_Function) _func;
|
Handle(GEOM_Function) _func;
|
||||||
|
@ -1030,14 +1030,11 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape
|
|||||||
{
|
{
|
||||||
SetErrorCode(KO);
|
SetErrorCode(KO);
|
||||||
|
|
||||||
if (theObject.IsNull() || thePoint.IsNull()) return NULL;
|
if (theObject.IsNull()) return NULL;
|
||||||
|
|
||||||
Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
|
Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
|
||||||
if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
|
if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
|
||||||
|
|
||||||
// Get last functions of the arguments
|
|
||||||
Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
|
|
||||||
|
|
||||||
//Add a scale function
|
//Add a scale function
|
||||||
Handle(GEOM_Function) aFunction =
|
Handle(GEOM_Function) aFunction =
|
||||||
theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE);
|
theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE);
|
||||||
@ -1046,11 +1043,17 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape
|
|||||||
//Check if the function is set correctly
|
//Check if the function is set correctly
|
||||||
if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
|
if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
|
||||||
|
|
||||||
|
// Set arguments
|
||||||
GEOMImpl_IScale aTI (aFunction);
|
GEOMImpl_IScale aTI (aFunction);
|
||||||
aTI.SetShape(anOriginal);
|
aTI.SetShape(anOriginal);
|
||||||
aTI.SetPoint(aPF);
|
|
||||||
aTI.SetFactor(theFactor);
|
aTI.SetFactor(theFactor);
|
||||||
|
|
||||||
|
// Set point argument
|
||||||
|
if (!thePoint.IsNull()) {
|
||||||
|
Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
|
||||||
|
aTI.SetPoint(aPF);
|
||||||
|
}
|
||||||
|
|
||||||
//Compute the scale
|
//Compute the scale
|
||||||
try {
|
try {
|
||||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
@ -1085,7 +1088,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
|
|||||||
{
|
{
|
||||||
SetErrorCode(KO);
|
SetErrorCode(KO);
|
||||||
|
|
||||||
if (theObject.IsNull() || thePoint.IsNull()) return NULL;
|
if (theObject.IsNull()) return NULL;
|
||||||
|
|
||||||
Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
|
Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
|
||||||
if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
|
if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
|
||||||
@ -1101,11 +1104,17 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
|
|||||||
//Check if the function is set correctly
|
//Check if the function is set correctly
|
||||||
if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
|
if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
|
||||||
|
|
||||||
|
// Set arguments
|
||||||
GEOMImpl_IScale aTI (aFunction);
|
GEOMImpl_IScale aTI (aFunction);
|
||||||
aTI.SetShape(anOriginal);
|
aTI.SetShape(anOriginal);
|
||||||
aTI.SetPoint(thePoint->GetLastFunction());
|
|
||||||
aTI.SetFactor(theFactor);
|
aTI.SetFactor(theFactor);
|
||||||
|
|
||||||
|
// Set point argument
|
||||||
|
if (!thePoint.IsNull()) {
|
||||||
|
Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
|
||||||
|
aTI.SetPoint(aPF);
|
||||||
|
}
|
||||||
|
|
||||||
//Compute the scale
|
//Compute the scale
|
||||||
try {
|
try {
|
||||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
@ -1130,6 +1139,85 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
|
|||||||
return aCopy;
|
return aCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* ScaleShapeAlongAxes
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeAlongAxes (Handle(GEOM_Object) theObject,
|
||||||
|
Handle(GEOM_Object) thePoint,
|
||||||
|
double theFactorX,
|
||||||
|
double theFactorY,
|
||||||
|
double theFactorZ,
|
||||||
|
bool doCopy)
|
||||||
|
{
|
||||||
|
SetErrorCode(KO);
|
||||||
|
|
||||||
|
if (theObject.IsNull()) return NULL;
|
||||||
|
|
||||||
|
Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
|
||||||
|
if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
|
||||||
|
|
||||||
|
//Add a scale function
|
||||||
|
Handle(GEOM_Object) aCopy; //Add a new Copy object
|
||||||
|
Handle(GEOM_Function) aFunction;
|
||||||
|
if (doCopy) {
|
||||||
|
aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
|
||||||
|
aFunction = aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES_COPY);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aFunction = theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES);
|
||||||
|
}
|
||||||
|
if (aFunction.IsNull()) return NULL;
|
||||||
|
|
||||||
|
//Check if the function is set correctly
|
||||||
|
if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
|
||||||
|
|
||||||
|
// Set arguments
|
||||||
|
GEOMImpl_IScale aTI (aFunction);
|
||||||
|
aTI.SetShape(anOriginal);
|
||||||
|
aTI.SetFactorX(theFactorX);
|
||||||
|
aTI.SetFactorY(theFactorY);
|
||||||
|
aTI.SetFactorZ(theFactorZ);
|
||||||
|
|
||||||
|
// Set point (optional argument)
|
||||||
|
if (!thePoint.IsNull()) {
|
||||||
|
Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
|
||||||
|
aTI.SetPoint(aPF);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Compute the scale
|
||||||
|
try {
|
||||||
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
|
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||||
|
SetErrorCode("Scale driver failed");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Standard_Failure) {
|
||||||
|
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||||
|
SetErrorCode(aFail->GetMessageString());
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetErrorCode(OK);
|
||||||
|
|
||||||
|
//Make a Python command
|
||||||
|
if (doCopy) {
|
||||||
|
GEOM::TPythonDump(aFunction) << "geompy.MakeScaleAlongAxes("
|
||||||
|
<< theObject << ", " << thePoint << ", "
|
||||||
|
<< theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
|
||||||
|
return aCopy;
|
||||||
|
}
|
||||||
|
|
||||||
|
GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.ScaleShapeAlongAxes("
|
||||||
|
<< theObject << ", " << thePoint << ", "
|
||||||
|
<< theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
|
||||||
|
return theObject;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* PositionShape
|
* PositionShape
|
||||||
|
@ -27,7 +27,8 @@
|
|||||||
#include "GEOM_Object.hxx"
|
#include "GEOM_Object.hxx"
|
||||||
#include <TDocStd_Document.hxx>
|
#include <TDocStd_Document.hxx>
|
||||||
|
|
||||||
class GEOMImpl_ITransformOperations : public GEOM_IOperations {
|
class GEOMImpl_ITransformOperations : public GEOM_IOperations
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
Standard_EXPORT GEOMImpl_ITransformOperations(GEOM_Engine* theEngine, int theDocID);
|
Standard_EXPORT GEOMImpl_ITransformOperations(GEOM_Engine* theEngine, int theDocID);
|
||||||
Standard_EXPORT ~GEOMImpl_ITransformOperations();
|
Standard_EXPORT ~GEOMImpl_ITransformOperations();
|
||||||
@ -40,9 +41,11 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations {
|
|||||||
Handle(GEOM_Object) thePoint1,
|
Handle(GEOM_Object) thePoint1,
|
||||||
Handle(GEOM_Object) thePoint2);
|
Handle(GEOM_Object) thePoint2);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) TranslateDXDYDZ (Handle(GEOM_Object) theObject, double theX, double theY, double theZ);
|
Standard_EXPORT Handle(GEOM_Object) TranslateDXDYDZ (Handle(GEOM_Object) theObject,
|
||||||
|
double theX, double theY, double theZ);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) TranslateDXDYDZCopy (Handle(GEOM_Object) theObject, double theX, double theY, double theZ);
|
Standard_EXPORT Handle(GEOM_Object) TranslateDXDYDZCopy (Handle(GEOM_Object) theObject,
|
||||||
|
double theX, double theY, double theZ);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) TranslateVector (Handle(GEOM_Object) theObject,
|
Standard_EXPORT Handle(GEOM_Object) TranslateVector (Handle(GEOM_Object) theObject,
|
||||||
Handle(GEOM_Object) theVector);
|
Handle(GEOM_Object) theVector);
|
||||||
@ -51,12 +54,22 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations {
|
|||||||
Handle(GEOM_Object) theVector);
|
Handle(GEOM_Object) theVector);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) TranslateVectorDistance (Handle(GEOM_Object) theObject,
|
Standard_EXPORT Handle(GEOM_Object) TranslateVectorDistance (Handle(GEOM_Object) theObject,
|
||||||
Handle(GEOM_Object) theVector, double theDistance, bool theCopy);
|
Handle(GEOM_Object) theVector,
|
||||||
|
double theDistance,
|
||||||
|
bool theCopy);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) Translate1D (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, double theStep, Standard_Integer theNbTimes);
|
Standard_EXPORT Handle(GEOM_Object) Translate1D (Handle(GEOM_Object) theObject,
|
||||||
|
Handle(GEOM_Object) theVector,
|
||||||
|
double theStep,
|
||||||
|
Standard_Integer theNbTimes);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) Translate2D (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, double theStep1, Standard_Integer theNbTimes1,
|
Standard_EXPORT Handle(GEOM_Object) Translate2D (Handle(GEOM_Object) theObject,
|
||||||
Handle(GEOM_Object) theVector2, double theStep2, Standard_Integer theNbTimes2);
|
Handle(GEOM_Object) theVector,
|
||||||
|
double theStep1,
|
||||||
|
Standard_Integer theNbTimes1,
|
||||||
|
Handle(GEOM_Object) theVector2,
|
||||||
|
double theStep2,
|
||||||
|
Standard_Integer theNbTimes2);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) MirrorPlane (Handle(GEOM_Object) theObject,
|
Standard_EXPORT Handle(GEOM_Object) MirrorPlane (Handle(GEOM_Object) theObject,
|
||||||
Handle(GEOM_Object) thePlane);
|
Handle(GEOM_Object) thePlane);
|
||||||
@ -90,6 +103,13 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations {
|
|||||||
Handle(GEOM_Object) thePoint,
|
Handle(GEOM_Object) thePoint,
|
||||||
double theFactor);
|
double theFactor);
|
||||||
|
|
||||||
|
Standard_EXPORT Handle(GEOM_Object) ScaleShapeAlongAxes (Handle(GEOM_Object) theObject,
|
||||||
|
Handle(GEOM_Object) thePoint,
|
||||||
|
double theFactorX,
|
||||||
|
double theFactorY,
|
||||||
|
double theFactorZ,
|
||||||
|
bool doCopy);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) PositionShape (Handle(GEOM_Object) theObject,
|
Standard_EXPORT Handle(GEOM_Object) PositionShape (Handle(GEOM_Object) theObject,
|
||||||
Handle(GEOM_Object) theStartLCS,
|
Handle(GEOM_Object) theStartLCS,
|
||||||
Handle(GEOM_Object) theEndLCS);
|
Handle(GEOM_Object) theEndLCS);
|
||||||
@ -98,11 +118,17 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations {
|
|||||||
Handle(GEOM_Object) theStartLCS,
|
Handle(GEOM_Object) theStartLCS,
|
||||||
Handle(GEOM_Object) theEndLCS);
|
Handle(GEOM_Object) theEndLCS);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) Rotate (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis, double theAngle);
|
Standard_EXPORT Handle(GEOM_Object) Rotate (Handle(GEOM_Object) theObject,
|
||||||
|
Handle(GEOM_Object) theAxis,
|
||||||
|
double theAngle);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) RotateCopy (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis, double theAngle);
|
Standard_EXPORT Handle(GEOM_Object) RotateCopy (Handle(GEOM_Object) theObject,
|
||||||
|
Handle(GEOM_Object) theAxis,
|
||||||
|
double theAngle);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) Rotate1D (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis, Standard_Integer theNbTimes);
|
Standard_EXPORT Handle(GEOM_Object) Rotate1D (Handle(GEOM_Object) theObject,
|
||||||
|
Handle(GEOM_Object) theAxis,
|
||||||
|
Standard_Integer theNbTimes);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) Rotate2D (Handle(GEOM_Object) theObject,
|
Standard_EXPORT Handle(GEOM_Object) Rotate2D (Handle(GEOM_Object) theObject,
|
||||||
Handle(GEOM_Object) theAxis,
|
Handle(GEOM_Object) theAxis,
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <GEOM_Function.hxx>
|
#include <GEOM_Function.hxx>
|
||||||
|
|
||||||
#include <BRepBuilderAPI_Transform.hxx>
|
#include <BRepBuilderAPI_Transform.hxx>
|
||||||
|
#include <BRepBuilderAPI_GTransform.hxx>
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <BRepAlgo.hxx>
|
#include <BRepAlgo.hxx>
|
||||||
#include <TopAbs.hxx>
|
#include <TopAbs.hxx>
|
||||||
@ -37,6 +38,8 @@
|
|||||||
|
|
||||||
#include <Precision.hxx>
|
#include <Precision.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
|
#include <gp_Trsf.hxx>
|
||||||
|
#include <gp_GTrsf.hxx>
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetID
|
//function : GetID
|
||||||
@ -73,11 +76,17 @@ Standard_Integer GEOMImpl_ScaleDriver::Execute(TFunction_Logbook& log) const
|
|||||||
|
|
||||||
if (aType == SCALE_SHAPE || aType == SCALE_SHAPE_COPY) {
|
if (aType == SCALE_SHAPE || aType == SCALE_SHAPE_COPY) {
|
||||||
Handle(GEOM_Function) aRefShape = aCI.GetShape();
|
Handle(GEOM_Function) aRefShape = aCI.GetShape();
|
||||||
Handle(GEOM_Function) aRefPoint = aCI.GetPoint();
|
|
||||||
TopoDS_Shape aShapeBase = aRefShape->GetValue();
|
TopoDS_Shape aShapeBase = aRefShape->GetValue();
|
||||||
|
if (aShapeBase.IsNull()) return 0;
|
||||||
|
|
||||||
|
gp_Pnt aP (0,0,0);
|
||||||
|
Handle(GEOM_Function) aRefPoint = aCI.GetPoint();
|
||||||
|
if (!aRefPoint.IsNull()) {
|
||||||
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
|
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
|
||||||
if (aShapeBase.IsNull() || aShapePnt.IsNull()) return 0;
|
if (aShapePnt.IsNull()) return 0;
|
||||||
if (aShapePnt.ShapeType() != TopAbs_VERTEX) return 0;
|
if (aShapePnt.ShapeType() != TopAbs_VERTEX) return 0;
|
||||||
|
aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
|
||||||
|
}
|
||||||
|
|
||||||
// Bug 6839: Check for standalone (not included in faces) degenerated edges
|
// Bug 6839: Check for standalone (not included in faces) degenerated edges
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aEFMap;
|
TopTools_IndexedDataMapOfShapeListOfShape aEFMap;
|
||||||
@ -94,12 +103,67 @@ Standard_Integer GEOMImpl_ScaleDriver::Execute(TFunction_Logbook& log) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Perform Scaling
|
// Perform Scaling
|
||||||
gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
|
|
||||||
gp_Trsf aTrsf;
|
gp_Trsf aTrsf;
|
||||||
aTrsf.SetScale(aP, aCI.GetFactor());
|
aTrsf.SetScale(aP, aCI.GetFactor());
|
||||||
BRepBuilderAPI_Transform aBRepTrsf (aShapeBase, aTrsf, Standard_False);
|
BRepBuilderAPI_Transform aBRepTrsf (aShapeBase, aTrsf, Standard_False);
|
||||||
aShape = aBRepTrsf.Shape();
|
aShape = aBRepTrsf.Shape();
|
||||||
} else {
|
}
|
||||||
|
else if (aType == SCALE_SHAPE_AXES || aType == SCALE_SHAPE_AXES_COPY) {
|
||||||
|
Handle(GEOM_Function) aRefShape = aCI.GetShape();
|
||||||
|
TopoDS_Shape aShapeBase = aRefShape->GetValue();
|
||||||
|
if (aShapeBase.IsNull()) return 0;
|
||||||
|
|
||||||
|
bool isP = false;
|
||||||
|
gp_Pnt aP (0,0,0);
|
||||||
|
Handle(GEOM_Function) aRefPoint = aCI.GetPoint();
|
||||||
|
if (!aRefPoint.IsNull()) {
|
||||||
|
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
|
||||||
|
if (aShapePnt.IsNull()) return 0;
|
||||||
|
if (aShapePnt.ShapeType() != TopAbs_VERTEX) return 0;
|
||||||
|
aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
|
||||||
|
isP = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bug 6839: Check for standalone (not included in faces) degenerated edges
|
||||||
|
TopTools_IndexedDataMapOfShapeListOfShape aEFMap;
|
||||||
|
TopExp::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, aEFMap);
|
||||||
|
Standard_Integer i, nbE = aEFMap.Extent();
|
||||||
|
for (i = 1; i <= nbE; i++) {
|
||||||
|
TopoDS_Shape anEdgeSh = aEFMap.FindKey(i);
|
||||||
|
if (BRep_Tool::Degenerated(TopoDS::Edge(anEdgeSh))) {
|
||||||
|
const TopTools_ListOfShape& aFaces = aEFMap.FindFromIndex(i);
|
||||||
|
if (aFaces.IsEmpty())
|
||||||
|
Standard_ConstructionError::Raise
|
||||||
|
("Scaling aborted : cannot scale standalone degenerated edge");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform Scaling
|
||||||
|
gp_GTrsf aGTrsf;
|
||||||
|
gp_Mat rot (aCI.GetFactorX(), 0, 0,
|
||||||
|
0, aCI.GetFactorY(), 0,
|
||||||
|
0, 0, aCI.GetFactorZ());
|
||||||
|
aGTrsf.SetVectorialPart(rot);
|
||||||
|
|
||||||
|
if (isP) {
|
||||||
|
gp_Pnt anO (0,0,0);
|
||||||
|
if (anO.Distance(aP) > Precision::Confusion()) {
|
||||||
|
gp_GTrsf aGTrsfP0;
|
||||||
|
aGTrsfP0.SetTranslationPart(anO.XYZ() - aP.XYZ());
|
||||||
|
gp_GTrsf aGTrsf0P;
|
||||||
|
aGTrsf0P.SetTranslationPart(aP.XYZ());
|
||||||
|
//aGTrsf = aGTrsf0P * aGTrsf * aGTrsfP0;
|
||||||
|
aGTrsf = aGTrsf0P.Multiplied(aGTrsf);
|
||||||
|
aGTrsf = aGTrsf.Multiplied(aGTrsfP0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BRepBuilderAPI_GTransform aBRepGTrsf (aShapeBase, aGTrsf, Standard_False);
|
||||||
|
if (!aBRepGTrsf.IsDone())
|
||||||
|
Standard_ConstructionError::Raise("Scaling not done");
|
||||||
|
aShape = aBRepGTrsf.Shape();
|
||||||
|
}
|
||||||
|
else {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aShape.IsNull()) return 0;
|
if (aShape.IsNull()) return 0;
|
||||||
|
@ -144,6 +144,8 @@
|
|||||||
|
|
||||||
#define SCALE_SHAPE 1
|
#define SCALE_SHAPE 1
|
||||||
#define SCALE_SHAPE_COPY 2
|
#define SCALE_SHAPE_COPY 2
|
||||||
|
#define SCALE_SHAPE_AXES 3
|
||||||
|
#define SCALE_SHAPE_AXES_COPY 4
|
||||||
|
|
||||||
#define POSITION_SHAPE 1
|
#define POSITION_SHAPE 1
|
||||||
#define POSITION_SHAPE_COPY 2
|
#define POSITION_SHAPE_COPY 2
|
||||||
|
@ -735,7 +735,7 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape
|
|||||||
//Set a not done flag
|
//Set a not done flag
|
||||||
GetOperations()->SetNotDone();
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
if (thePoint == NULL || theObject == NULL) return aGEOMObject._retn();
|
if (theObject->_is_nil()) return aGEOMObject._retn();
|
||||||
|
|
||||||
//check if the object is a subshape
|
//check if the object is a subshape
|
||||||
if (!theObject->IsMainShape()) {
|
if (!theObject->IsMainShape()) {
|
||||||
@ -750,10 +750,12 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape
|
|||||||
if (anObject.IsNull()) return aGEOMObject._retn();
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
||||||
|
|
||||||
//Get the point
|
//Get the point
|
||||||
|
Handle(GEOM_Object) aPoint;
|
||||||
|
if (!thePoint->_is_nil()) {
|
||||||
CORBA::String_var aPntEntry = thePoint->GetEntry();
|
CORBA::String_var aPntEntry = thePoint->GetEntry();
|
||||||
Handle(GEOM_Object) aPoint =
|
aPoint = GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry);
|
||||||
GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry);
|
|
||||||
if (aPoint.IsNull()) return aGEOMObject._retn();
|
if (aPoint.IsNull()) return aGEOMObject._retn();
|
||||||
|
}
|
||||||
|
|
||||||
//Perform the scale
|
//Perform the scale
|
||||||
GetOperations()->ScaleShape(anObject, aPoint, theFactor);
|
GetOperations()->ScaleShape(anObject, aPoint, theFactor);
|
||||||
@ -776,7 +778,7 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeCopy
|
|||||||
//Set a not done flag
|
//Set a not done flag
|
||||||
GetOperations()->SetNotDone();
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
if (thePoint == NULL || theObject == NULL) return aGEOMObject._retn();
|
if (theObject->_is_nil()) return aGEOMObject._retn();
|
||||||
|
|
||||||
//Get the basic object
|
//Get the basic object
|
||||||
CORBA::String_var anEntry = theObject->GetEntry();
|
CORBA::String_var anEntry = theObject->GetEntry();
|
||||||
@ -785,10 +787,12 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeCopy
|
|||||||
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
||||||
|
|
||||||
//Get the point
|
//Get the point
|
||||||
|
Handle(GEOM_Object) aPoint;
|
||||||
|
if (!thePoint->_is_nil()) {
|
||||||
CORBA::String_var aPntEntry = thePoint->GetEntry();
|
CORBA::String_var aPntEntry = thePoint->GetEntry();
|
||||||
Handle(GEOM_Object) aPoint =
|
aPoint = GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry);
|
||||||
GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry);
|
|
||||||
if (aPoint.IsNull()) return aGEOMObject._retn();
|
if (aPoint.IsNull()) return aGEOMObject._retn();
|
||||||
|
}
|
||||||
|
|
||||||
//Perform the scale
|
//Perform the scale
|
||||||
Handle(GEOM_Object) anObject =
|
Handle(GEOM_Object) anObject =
|
||||||
@ -799,6 +803,94 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeCopy
|
|||||||
return GetObject(anObject);
|
return GetObject(anObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* ScaleShapeAlongAxes
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxes
|
||||||
|
(GEOM::GEOM_Object_ptr theObject,
|
||||||
|
GEOM::GEOM_Object_ptr thePoint,
|
||||||
|
CORBA::Double theFactorX,
|
||||||
|
CORBA::Double theFactorY,
|
||||||
|
CORBA::Double theFactorZ)
|
||||||
|
{
|
||||||
|
GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
||||||
|
|
||||||
|
//Set a not done flag
|
||||||
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
|
if (theObject->_is_nil()) return aGEOMObject._retn();
|
||||||
|
|
||||||
|
//check if the object is a subshape
|
||||||
|
if (!theObject->IsMainShape()) {
|
||||||
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
||||||
|
return aGEOMObject._retn();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get the object itself
|
||||||
|
CORBA::String_var anEntry = theObject->GetEntry();
|
||||||
|
Handle(GEOM_Object) anObject =
|
||||||
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
||||||
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
||||||
|
|
||||||
|
//Get the point
|
||||||
|
Handle(GEOM_Object) aPoint;
|
||||||
|
if (!thePoint->_is_nil()) {
|
||||||
|
CORBA::String_var aPntEntry = thePoint->GetEntry();
|
||||||
|
aPoint = GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry);
|
||||||
|
if (aPoint.IsNull()) return aGEOMObject._retn();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Perform the scale
|
||||||
|
GetOperations()->ScaleShapeAlongAxes
|
||||||
|
(anObject, aPoint, theFactorX, theFactorY, theFactorZ, /*doCopy*/false);
|
||||||
|
|
||||||
|
return aGEOMObject._retn();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* ScaleShapeAlongAxesCopy
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxesCopy
|
||||||
|
(GEOM::GEOM_Object_ptr theObject,
|
||||||
|
GEOM::GEOM_Object_ptr thePoint,
|
||||||
|
CORBA::Double theFactorX,
|
||||||
|
CORBA::Double theFactorY,
|
||||||
|
CORBA::Double theFactorZ)
|
||||||
|
{
|
||||||
|
GEOM::GEOM_Object_var aGEOMObject;
|
||||||
|
|
||||||
|
//Set a not done flag
|
||||||
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
|
if (theObject->_is_nil()) return aGEOMObject._retn();
|
||||||
|
|
||||||
|
//Get the basic object
|
||||||
|
CORBA::String_var anEntry = theObject->GetEntry();
|
||||||
|
Handle(GEOM_Object) aBasicObject =
|
||||||
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
||||||
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
||||||
|
|
||||||
|
//Get the point
|
||||||
|
Handle(GEOM_Object) aPoint;
|
||||||
|
if (!thePoint->_is_nil()) {
|
||||||
|
CORBA::String_var aPntEntry = thePoint->GetEntry();
|
||||||
|
aPoint = GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry);
|
||||||
|
if (aPoint.IsNull()) return aGEOMObject._retn();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Perform the scale
|
||||||
|
Handle(GEOM_Object) anObject = GetOperations()->ScaleShapeAlongAxes
|
||||||
|
(aBasicObject, aPoint, theFactorX, theFactorY, theFactorZ, /*doCopy*/true);
|
||||||
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||||
|
return aGEOMObject._retn();
|
||||||
|
|
||||||
|
return GetObject(anObject);
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* PositionShape
|
* PositionShape
|
||||||
|
@ -121,6 +121,18 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i :
|
|||||||
GEOM::GEOM_Object_ptr thePoint,
|
GEOM::GEOM_Object_ptr thePoint,
|
||||||
CORBA::Double theFactor);
|
CORBA::Double theFactor);
|
||||||
|
|
||||||
|
GEOM::GEOM_Object_ptr ScaleShapeAlongAxes (GEOM::GEOM_Object_ptr theObject,
|
||||||
|
GEOM::GEOM_Object_ptr thePoint,
|
||||||
|
CORBA::Double theFactorX,
|
||||||
|
CORBA::Double theFactorY,
|
||||||
|
CORBA::Double theFactorZ);
|
||||||
|
|
||||||
|
GEOM::GEOM_Object_ptr ScaleShapeAlongAxesCopy (GEOM::GEOM_Object_ptr theObject,
|
||||||
|
GEOM::GEOM_Object_ptr thePoint,
|
||||||
|
CORBA::Double theFactorX,
|
||||||
|
CORBA::Double theFactorY,
|
||||||
|
CORBA::Double theFactorZ);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr PositionShape (GEOM::GEOM_Object_ptr theObject,
|
GEOM::GEOM_Object_ptr PositionShape (GEOM::GEOM_Object_ptr theObject,
|
||||||
GEOM::GEOM_Object_ptr theStartLCS,
|
GEOM::GEOM_Object_ptr theStartLCS,
|
||||||
GEOM::GEOM_Object_ptr theEndLCS);
|
GEOM::GEOM_Object_ptr theEndLCS);
|
||||||
|
@ -1634,6 +1634,42 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShapeCopy (GEOM::GEOM_Object_ptr theOb
|
|||||||
return anObj;
|
return anObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
// ScaleShapeAlongAxes:
|
||||||
|
//=============================================================================
|
||||||
|
GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShapeAlongAxes (GEOM::GEOM_Object_ptr theObject,
|
||||||
|
GEOM::GEOM_Object_ptr thePoint,
|
||||||
|
CORBA::Double theFactorX,
|
||||||
|
CORBA::Double theFactorY,
|
||||||
|
CORBA::Double theFactorZ)
|
||||||
|
{
|
||||||
|
beginService( " GEOM_Superv_i::ScaleShapeAlongAxes" );
|
||||||
|
MESSAGE("GEOM_Superv_i::ScaleShapeAlongAxes");
|
||||||
|
getTransfOp();
|
||||||
|
GEOM::GEOM_Object_ptr anObj = myTransfOp->ScaleShapeAlongAxes
|
||||||
|
(theObject, thePoint, theFactorX, theFactorY, theFactorZ);
|
||||||
|
endService( " GEOM_Superv_i::ScaleShapeAlongAxes" );
|
||||||
|
return anObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
// ScaleShapeAlongAxesCopy:
|
||||||
|
//=============================================================================
|
||||||
|
GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShapeAlongAxesCopy (GEOM::GEOM_Object_ptr theObject,
|
||||||
|
GEOM::GEOM_Object_ptr thePoint,
|
||||||
|
CORBA::Double theFactorX,
|
||||||
|
CORBA::Double theFactorY,
|
||||||
|
CORBA::Double theFactorZ)
|
||||||
|
{
|
||||||
|
beginService( " GEOM_Superv_i::ScaleShapeAlongAxesCopy" );
|
||||||
|
MESSAGE("GEOM_Superv_i::ScaleShapeAlongAxesCopy");
|
||||||
|
getTransfOp();
|
||||||
|
GEOM::GEOM_Object_ptr anObj = myTransfOp->ScaleShapeAlongAxesCopy
|
||||||
|
(theObject, thePoint, theFactorX, theFactorY, theFactorZ);
|
||||||
|
endService( " GEOM_Superv_i::ScaleShapeAlongAxesCopy" );
|
||||||
|
return anObj;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// PositionShape:
|
// PositionShape:
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -377,6 +377,16 @@ public:
|
|||||||
GEOM::GEOM_Object_ptr ScaleShapeCopy (GEOM::GEOM_Object_ptr theObject,
|
GEOM::GEOM_Object_ptr ScaleShapeCopy (GEOM::GEOM_Object_ptr theObject,
|
||||||
GEOM::GEOM_Object_ptr thePoint,
|
GEOM::GEOM_Object_ptr thePoint,
|
||||||
CORBA::Double theFactor);
|
CORBA::Double theFactor);
|
||||||
|
GEOM::GEOM_Object_ptr ScaleShapeAlongAxes (GEOM::GEOM_Object_ptr theObject,
|
||||||
|
GEOM::GEOM_Object_ptr thePoint,
|
||||||
|
CORBA::Double theFactorX,
|
||||||
|
CORBA::Double theFactorY,
|
||||||
|
CORBA::Double theFactorZ);
|
||||||
|
GEOM::GEOM_Object_ptr ScaleShapeAlongAxesCopy (GEOM::GEOM_Object_ptr theObject,
|
||||||
|
GEOM::GEOM_Object_ptr thePoint,
|
||||||
|
CORBA::Double theFactorX,
|
||||||
|
CORBA::Double theFactorY,
|
||||||
|
CORBA::Double theFactorZ);
|
||||||
GEOM::GEOM_Object_ptr PositionShape (GEOM::GEOM_Object_ptr theObject,
|
GEOM::GEOM_Object_ptr PositionShape (GEOM::GEOM_Object_ptr theObject,
|
||||||
GEOM::GEOM_Object_ptr theStartLCS,
|
GEOM::GEOM_Object_ptr theStartLCS,
|
||||||
GEOM::GEOM_Object_ptr theEndLCS);
|
GEOM::GEOM_Object_ptr theEndLCS);
|
||||||
|
@ -184,7 +184,16 @@ def TestAll (geompy, math):
|
|||||||
TranslVectD = geompy.MakeTranslationVectorDistance(Box, vxyz, 50.0) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
|
TranslVectD = geompy.MakeTranslationVectorDistance(Box, vxyz, 50.0) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
|
||||||
Rotation = geompy.MakeRotation(Box, vz, angle1) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
|
Rotation = geompy.MakeRotation(Box, vz, angle1) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
|
||||||
RotatPnt = geompy.MakeRotationThreePoints(Box, px, py, pz) #(4 GEOM_Object_ptr)->GEOM_Object_ptr
|
RotatPnt = geompy.MakeRotationThreePoints(Box, px, py, pz) #(4 GEOM_Object_ptr)->GEOM_Object_ptr
|
||||||
Scale = geompy.MakeScaleTransform(Box, p0, factor) #
|
|
||||||
|
#Scale by factor relatively given point
|
||||||
|
Scale1 = geompy.MakeScaleTransform(Box, pxyz, factor) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
|
||||||
|
#Scale by factor relatively the origin of global CS
|
||||||
|
Scale2 = geompy.MakeScaleTransform(Box, None, factor) #
|
||||||
|
#Scale along axes of global CS by different factors. Scale relatively given point
|
||||||
|
Scale3 = geompy.MakeScaleAlongAxes(Box, pxyz, 1.5, 0.5, 3) #(2 GEOM_Object_ptr, 3 Doubles)->GEOM_Object_ptr
|
||||||
|
#Scale along axes of global CS by different factors. Scale relatively the origin of global CS
|
||||||
|
Scale4 = geompy.MakeScaleAlongAxes(Box, None, 1.5, 0.5, 3) #
|
||||||
|
|
||||||
Mirror = geompy.MakeMirrorByPlane(Box, Plane) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
|
Mirror = geompy.MakeMirrorByPlane(Box, Plane) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
|
||||||
MirrorAxis = geompy.MakeMirrorByAxis(Box, Line1) #
|
MirrorAxis = geompy.MakeMirrorByAxis(Box, Line1) #
|
||||||
MirrorPnt = geompy.MakeMirrorByPoint(Box, p200) #
|
MirrorPnt = geompy.MakeMirrorByPoint(Box, p200) #
|
||||||
@ -338,7 +347,10 @@ def TestAll (geompy, math):
|
|||||||
id_TranslVectD = geompy.addToStudy(TranslVectD, "Translation along vector with defined distance")
|
id_TranslVectD = geompy.addToStudy(TranslVectD, "Translation along vector with defined distance")
|
||||||
id_Rotation = geompy.addToStudy(Rotation, "Rotation")
|
id_Rotation = geompy.addToStudy(Rotation, "Rotation")
|
||||||
id_RotatPnt = geompy.addToStudy(RotatPnt, "Rotation by three points")
|
id_RotatPnt = geompy.addToStudy(RotatPnt, "Rotation by three points")
|
||||||
id_Scale = geompy.addToStudy(Scale, "Scale")
|
id_Scale1 = geompy.addToStudy(Scale1, "Scale1")
|
||||||
|
id_Scale2 = geompy.addToStudy(Scale2, "Scale2")
|
||||||
|
id_Scale3 = geompy.addToStudy(Scale3, "Scale3")
|
||||||
|
id_Scale4 = geompy.addToStudy(Scale4, "Scale4")
|
||||||
id_Mirror = geompy.addToStudy(Mirror, "Mirror by Plane")
|
id_Mirror = geompy.addToStudy(Mirror, "Mirror by Plane")
|
||||||
id_MirrorAxis = geompy.addToStudy(MirrorAxis, "Mirror by Axis")
|
id_MirrorAxis = geompy.addToStudy(MirrorAxis, "Mirror by Axis")
|
||||||
id_MirrorPnt = geompy.addToStudy(MirrorPnt, "Mirror by Point")
|
id_MirrorPnt = geompy.addToStudy(MirrorPnt, "Mirror by Point")
|
||||||
|
@ -217,8 +217,6 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
|
|
||||||
## Publish sub-shapes, standing for arguments and sub-shapes of arguments
|
## Publish sub-shapes, standing for arguments and sub-shapes of arguments
|
||||||
# To be used from python scripts out of geompy.addToStudy (non-default usage)
|
# To be used from python scripts out of geompy.addToStudy (non-default usage)
|
||||||
# \param theStudy the study, in which theObject is published already,
|
|
||||||
# and in which the arguments will be published
|
|
||||||
# \param theObject published GEOM object, arguments of which will be published
|
# \param theObject published GEOM object, arguments of which will be published
|
||||||
# \param theArgs list of GEOM_Object, operation arguments to be published.
|
# \param theArgs list of GEOM_Object, operation arguments to be published.
|
||||||
# If this list is empty, all operation arguments will be published
|
# If this list is empty, all operation arguments will be published
|
||||||
@ -1683,9 +1681,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
RaiseIfFailed("DivideEdge", self.HealOp)
|
RaiseIfFailed("DivideEdge", self.HealOp)
|
||||||
return anObj
|
return anObj
|
||||||
|
|
||||||
## Change orientation of the given object.
|
## Change orientation of the given object. Updates given shape.
|
||||||
# @param theObject Shape to be processed.
|
# @param theObject Shape to be processed.
|
||||||
# @update given shape
|
|
||||||
#
|
#
|
||||||
# @ref swig_todo "Example"
|
# @ref swig_todo "Example"
|
||||||
def ChangeOrientationShell(self,theObject):
|
def ChangeOrientationShell(self,theObject):
|
||||||
@ -2008,6 +2005,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
## Scale the given object by the factor, creating its copy before the scaling.
|
## Scale the given object by the factor, creating its copy before the scaling.
|
||||||
# @param theObject The object to be scaled.
|
# @param theObject The object to be scaled.
|
||||||
# @param thePoint Center point for scaling.
|
# @param thePoint Center point for scaling.
|
||||||
|
# Passing None for it means scaling relatively the origin of global CS.
|
||||||
# @param theFactor Scaling factor value.
|
# @param theFactor Scaling factor value.
|
||||||
# @return New GEOM_Object, containing the scaled shape.
|
# @return New GEOM_Object, containing the scaled shape.
|
||||||
#
|
#
|
||||||
@ -2018,6 +2016,22 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
|
RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
|
||||||
return anObj
|
return anObj
|
||||||
|
|
||||||
|
## Scale the given object by different factors along coordinate axes,
|
||||||
|
# creating its copy before the scaling.
|
||||||
|
# @param theObject The object to be scaled.
|
||||||
|
# @param thePoint Center point for scaling.
|
||||||
|
# Passing None for it means scaling relatively the origin of global CS.
|
||||||
|
# @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
|
||||||
|
# @return New GEOM_Object, containing the scaled shape.
|
||||||
|
#
|
||||||
|
# @ref swig_scale "Example"
|
||||||
|
def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ):
|
||||||
|
# Example: see GEOM_TestAll.py
|
||||||
|
anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
|
||||||
|
theFactorX, theFactorY, theFactorZ)
|
||||||
|
RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
|
||||||
|
return anObj
|
||||||
|
|
||||||
## Create an object, symmetrical
|
## Create an object, symmetrical
|
||||||
# to the given one relatively the given plane.
|
# to the given one relatively the given plane.
|
||||||
# @param theObject The object to be mirrored.
|
# @param theObject The object to be mirrored.
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
|
||||||
|
#include "DlgRef_SpinBox.h"
|
||||||
|
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
#include <qcheckbox.h>
|
#include <qcheckbox.h>
|
||||||
|
|
||||||
@ -60,59 +62,160 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG
|
|||||||
: GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
|
: GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
|
||||||
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
||||||
{
|
{
|
||||||
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SCALE")));
|
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||||
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
QPixmap image1 (aResMgr->loadPixmap("GEOM",tr("ICON_DLG_SCALE")));
|
||||||
|
QPixmap image2 (aResMgr->loadPixmap("GEOM",tr("ICON_DLG_SCALE_ALONG_AXES")));
|
||||||
|
QPixmap image3 (aResMgr->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||||
|
|
||||||
setCaption(tr("GEOM_SCALE_TITLE"));
|
setCaption(tr("GEOM_SCALE_TITLE"));
|
||||||
|
|
||||||
/***************************************************************/
|
// Constructors
|
||||||
GroupConstructors->setTitle(tr("GEOM_SCALE"));
|
GroupConstructors->setTitle(tr("GEOM_SCALE"));
|
||||||
RadioButton1->setPixmap(image0);
|
RadioButton1->setPixmap(image1);
|
||||||
RadioButton2->close(TRUE);
|
RadioButton2->setPixmap(image2);
|
||||||
RadioButton3->close(TRUE);
|
RadioButton3->close(TRUE);
|
||||||
|
|
||||||
GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints");
|
// Own widgets
|
||||||
GroupPoints->CheckButton2->hide();
|
GroupBox1 = new QGroupBox (this, "GroupBox1");
|
||||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||||
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
|
GroupBox1->setColumnLayout(0, Qt::Vertical);
|
||||||
GroupPoints->TextLabel2->setText(tr("GEOM_CENTRAL_POINT"));
|
GroupBox1->layout()->setSpacing(6);
|
||||||
GroupPoints->TextLabel3->setText(tr("GEOM_SCALE_FACTOR"));
|
GroupBox1->layout()->setMargin(11);
|
||||||
GroupPoints->LineEdit1->setReadOnly( true );
|
|
||||||
GroupPoints->LineEdit2->setReadOnly( true );
|
|
||||||
GroupPoints->PushButton1->setPixmap(image1);
|
|
||||||
GroupPoints->PushButton2->setPixmap(image1);
|
|
||||||
GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY"));
|
|
||||||
|
|
||||||
// san -- modification of an exisitng object by offset is not allowed
|
TextLabel1 = new QLabel (GroupBox1, "TextLabel1");
|
||||||
GroupPoints->CheckButton1->hide();
|
TextLabel1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0,
|
||||||
|
0, 0, TextLabel1->sizePolicy().hasHeightForWidth()));
|
||||||
|
|
||||||
Layout1->addWidget(GroupPoints, 2, 0);
|
TextLabel2 = new QLabel (GroupBox1, "TextLabel2");
|
||||||
/***************************************************************/
|
TextLabel2->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0,
|
||||||
|
0, 0, TextLabel2->sizePolicy().hasHeightForWidth()));
|
||||||
|
|
||||||
|
PushButton1 = new QPushButton(GroupBox1, "PushButton1");
|
||||||
|
PushButton1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0,
|
||||||
|
0, 0, PushButton1->sizePolicy().hasHeightForWidth()));
|
||||||
|
|
||||||
|
PushButton2 = new QPushButton( GroupBox1, "PushButton2" );
|
||||||
|
PushButton2->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0,
|
||||||
|
0, 0, PushButton2->sizePolicy().hasHeightForWidth()));
|
||||||
|
|
||||||
|
LineEdit1 = new QLineEdit (GroupBox1, "LineEdit1");
|
||||||
|
LineEdit2 = new QLineEdit (GroupBox1, "LineEdit2");
|
||||||
|
|
||||||
|
TextLabel3 = new QLabel (GroupBox1, "TextLabel3");
|
||||||
|
TextLabel3->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0,
|
||||||
|
0, 0, TextLabel3->sizePolicy().hasHeightForWidth()));
|
||||||
|
|
||||||
|
TextLabel4 = new QLabel (GroupBox1, "TextLabel4");
|
||||||
|
TextLabel4->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0,
|
||||||
|
0, 0, TextLabel3->sizePolicy().hasHeightForWidth()));
|
||||||
|
|
||||||
|
TextLabel5 = new QLabel (GroupBox1, "TextLabel5");
|
||||||
|
TextLabel5->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0,
|
||||||
|
0, 0, TextLabel3->sizePolicy().hasHeightForWidth()));
|
||||||
|
|
||||||
|
SpinBox_FX = new DlgRef_SpinBox(GroupBox1, "SpinBox_FX");
|
||||||
|
SpinBox_FY = new DlgRef_SpinBox(GroupBox1, "SpinBox_FY");
|
||||||
|
SpinBox_FZ = new DlgRef_SpinBox(GroupBox1, "SpinBox_FZ");
|
||||||
|
|
||||||
|
CheckBoxCopy = new QCheckBox (GroupBox1, "CheckBoxCopy");
|
||||||
|
|
||||||
|
QSpacerItem* spacer = new QSpacerItem(0, 316, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
// Layouting
|
||||||
|
OwnLayout = new QGridLayout (0, 1, 1, 0, 6, "Layout1");
|
||||||
|
|
||||||
|
OwnLayout->addWidget(TextLabel1, 0, 0);
|
||||||
|
OwnLayout->addWidget(TextLabel2, 1, 0);
|
||||||
|
|
||||||
|
OwnLayout->addWidget(PushButton1, 0, 1);
|
||||||
|
OwnLayout->addWidget(PushButton2, 1, 1);
|
||||||
|
|
||||||
|
OwnLayout->addMultiCellWidget(LineEdit1, 0, 0, 2, 3);
|
||||||
|
OwnLayout->addMultiCellWidget(LineEdit2, 1, 1, 2, 3);
|
||||||
|
|
||||||
|
OwnLayout->addWidget(TextLabel3, 2, 0);
|
||||||
|
OwnLayout->addWidget(TextLabel4, 3, 0);
|
||||||
|
OwnLayout->addWidget(TextLabel5, 4, 0);
|
||||||
|
|
||||||
|
OwnLayout->addWidget(SpinBox_FX, 2, 2);
|
||||||
|
OwnLayout->addWidget(SpinBox_FY, 3, 2);
|
||||||
|
OwnLayout->addWidget(SpinBox_FZ, 4, 2);
|
||||||
|
|
||||||
|
OwnLayout->addMultiCellWidget(CheckBoxCopy, 5, 5, 0, 3);
|
||||||
|
|
||||||
|
OwnLayout->addItem(spacer, 6, 2);
|
||||||
|
|
||||||
|
GroupBox1Layout = new QGridLayout (GroupBox1->layout());
|
||||||
|
GroupBox1Layout->setAlignment(Qt::AlignTop);
|
||||||
|
GroupBox1Layout->addLayout(OwnLayout, 0, 0);
|
||||||
|
|
||||||
|
Layout1->addWidget(GroupBox1, 2, 0);
|
||||||
|
|
||||||
|
// Text and pictures for own widgets
|
||||||
|
TextLabel1->setText(tr("GEOM_OBJECTS"));
|
||||||
|
TextLabel2->setText(tr("GEOM_CENTRAL_POINT"));
|
||||||
|
|
||||||
|
PushButton1->setPixmap(image3);
|
||||||
|
PushButton2->setPixmap(image3);
|
||||||
|
|
||||||
|
LineEdit1->setReadOnly( true );
|
||||||
|
LineEdit2->setReadOnly( true );
|
||||||
|
|
||||||
|
TextLabel3->setText(tr("GEOM_SCALE_FACTOR"));
|
||||||
|
TextLabel4->setText(tr("GEOM_SCALE_FACTOR_Y"));
|
||||||
|
TextLabel5->setText(tr("GEOM_SCALE_FACTOR_Z"));
|
||||||
|
|
||||||
|
// Min, max, step and decimals for spin boxes & initial values
|
||||||
double aFactor = 2.0;
|
double aFactor = 2.0;
|
||||||
double SpecificStep = 0.5;
|
double SpecificStep = 0.5;
|
||||||
/* min, max, step and decimals for spin boxes & initial values */
|
SpinBox_FX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
|
||||||
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
|
SpinBox_FY->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
|
||||||
GroupPoints->SpinBox_DX->SetValue(aFactor);
|
SpinBox_FZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
|
||||||
|
SpinBox_FX->SetValue(aFactor);
|
||||||
|
SpinBox_FY->SetValue(aFactor);
|
||||||
|
SpinBox_FZ->SetValue(aFactor);
|
||||||
|
|
||||||
|
// Tab order
|
||||||
|
setTabOrder(PushButton1, LineEdit1);
|
||||||
|
setTabOrder(LineEdit1, PushButton2);
|
||||||
|
setTabOrder(PushButton2, LineEdit2);
|
||||||
|
setTabOrder(LineEdit2 , SpinBox_FX);
|
||||||
|
setTabOrder(SpinBox_FX, SpinBox_FY);
|
||||||
|
setTabOrder(SpinBox_FY, SpinBox_FZ);
|
||||||
|
setTabOrder(SpinBox_FZ, CheckBoxCopy);
|
||||||
|
setTabOrder(CheckBoxCopy, CheckBoxRestoreSS);
|
||||||
|
|
||||||
|
// Modification of an existing object by offset is not allowed
|
||||||
|
CheckBoxCopy->hide();
|
||||||
|
|
||||||
// Activate Create a Copy mode
|
// Activate Create a Copy mode
|
||||||
GroupPoints->CheckButton1->setChecked(true);
|
CheckBoxCopy->setText(tr("GEOM_CREATE_COPY"));
|
||||||
|
CheckBoxCopy->setChecked(true);
|
||||||
CreateCopyModeChanged(true);
|
CreateCopyModeChanged(true);
|
||||||
|
|
||||||
|
// Allowed inheritance of children and visual properties by the scaling result
|
||||||
GroupBoxPublish->show();
|
GroupBoxPublish->show();
|
||||||
|
|
||||||
/* signals and slots connections */
|
// Signals and slots connections
|
||||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
|
connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
|
||||||
|
|
||||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
connect(PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
connect(PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
|
|
||||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
connect(LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
connect(LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
|
||||||
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
connect(SpinBox_FX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
|
connect(SpinBox_FY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||||
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
connect(SpinBox_FZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||||
|
|
||||||
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox_FX, SLOT(SetStep(double)));
|
||||||
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox_FY, SLOT(SetStep(double)));
|
||||||
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox_FZ, SLOT(SetStep(double)));
|
||||||
|
|
||||||
|
connect(CheckBoxCopy, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||||
|
|
||||||
connect(myGeomGUI->getApp()->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||||
@ -122,7 +225,6 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG
|
|||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~TransformationGUI_ScaleDlg()
|
// function : ~TransformationGUI_ScaleDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
@ -132,21 +234,57 @@ TransformationGUI_ScaleDlg::~TransformationGUI_ScaleDlg()
|
|||||||
/* no need to delete child widgets, Qt does it all for us */
|
/* no need to delete child widgets, Qt does it all for us */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : Init()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_ScaleDlg::Init()
|
void TransformationGUI_ScaleDlg::Init()
|
||||||
{
|
{
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = LineEdit1;
|
||||||
GroupPoints->LineEdit2->clear();
|
LineEdit2->clear();
|
||||||
|
|
||||||
myPoint = GEOM::GEOM_Object::_nil();
|
myPoint = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
initName(tr("GEOM_SCALE"));
|
initName(tr("GEOM_SCALE"));
|
||||||
|
|
||||||
|
ConstructorsClicked(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ConstructorsClicked()
|
||||||
|
// purpose : Radio button management
|
||||||
|
//=================================================================================
|
||||||
|
void TransformationGUI_ScaleDlg::ConstructorsClicked(int constructorId)
|
||||||
|
{
|
||||||
|
erasePreview();
|
||||||
|
|
||||||
|
switch (constructorId)
|
||||||
|
{
|
||||||
|
case 0: /* translation an object by dx, dy, dz */
|
||||||
|
TextLabel3->setText(tr("GEOM_SCALE_FACTOR"));
|
||||||
|
TextLabel4->hide();
|
||||||
|
TextLabel5->hide();
|
||||||
|
SpinBox_FY->hide();
|
||||||
|
SpinBox_FZ->hide();
|
||||||
|
resize(0,0);
|
||||||
|
break;
|
||||||
|
case 1: /* translation an object by 2 points */
|
||||||
|
TextLabel3->setText(tr("GEOM_SCALE_FACTOR_X"));
|
||||||
|
TextLabel4->show();
|
||||||
|
TextLabel5->show();
|
||||||
|
SpinBox_FY->show();
|
||||||
|
SpinBox_FZ->show();
|
||||||
|
resize(0,0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//qApp->processEvents();
|
||||||
|
//updateGeometry();
|
||||||
|
//resize(minimumSize());
|
||||||
|
displayPreview();
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
@ -158,31 +296,31 @@ void TransformationGUI_ScaleDlg::ClickOnOk()
|
|||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool TransformationGUI_ScaleDlg::ClickOnApply()
|
bool TransformationGUI_ScaleDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
if ( !onAccept(GroupPoints->CheckButton1->isChecked()) )
|
if (!onAccept(CheckBoxCopy->isChecked()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Init();
|
//Init();
|
||||||
|
initName(tr("GEOM_SCALE"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection as changed or other case
|
// purpose : Called when selection as changed or other case
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
|
erasePreview();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aName;
|
QString aName;
|
||||||
|
|
||||||
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
if (myEditCurrentArgument == LineEdit1)
|
||||||
{
|
{
|
||||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName);
|
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName);
|
||||||
if (aNbSel < 1)
|
if (aNbSel < 1)
|
||||||
@ -194,15 +332,15 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
|||||||
if (!myObjects.length())
|
if (!myObjects.length())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(myEditCurrentArgument == GroupPoints->LineEdit2)
|
else if (myEditCurrentArgument == LineEdit2)
|
||||||
{
|
{
|
||||||
if(IObjectCount() != 1)
|
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||||
|
if (IObjectCount() == 1)
|
||||||
{
|
{
|
||||||
myPoint = GEOM::GEOM_Object::_nil();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Standard_Boolean testResult = Standard_False;
|
Standard_Boolean testResult = Standard_False;
|
||||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
|
aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
|
||||||
|
if (testResult)
|
||||||
|
{
|
||||||
aName = GEOMBase::GetName(aSelectedObject);
|
aName = GEOMBase::GetName(aSelectedObject);
|
||||||
|
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
@ -228,26 +366,24 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
|||||||
else
|
else
|
||||||
aSelectedObject = aFindedObject; // get Object from study
|
aSelectedObject = aFindedObject; // get Object from study
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (aShape.ShapeType() != TopAbs_VERTEX) {
|
if (aShape.ShapeType() != TopAbs_VERTEX) {
|
||||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||||
aName = "";
|
aName = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
myPoint = aSelectedObject;
|
myPoint = aSelectedObject;
|
||||||
|
|
||||||
if(!testResult || CORBA::is_nil( myPoint ))
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
myEditCurrentArgument->setText( aName );
|
|
||||||
|
|
||||||
|
myEditCurrentArgument->setText(aName);
|
||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : LineEditReturnPressed()
|
// function : LineEditReturnPressed()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -255,15 +391,13 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
|||||||
void TransformationGUI_ScaleDlg::LineEditReturnPressed()
|
void TransformationGUI_ScaleDlg::LineEditReturnPressed()
|
||||||
{
|
{
|
||||||
QLineEdit* send = (QLineEdit*)sender();
|
QLineEdit* send = (QLineEdit*)sender();
|
||||||
if(send == GroupPoints->LineEdit1 ||
|
if (send == LineEdit1 || send == LineEdit2)
|
||||||
send == GroupPoints->LineEdit2)
|
|
||||||
{
|
{
|
||||||
myEditCurrentArgument = send;
|
myEditCurrentArgument = send;
|
||||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetEditCurrentArgument()
|
// function : SetEditCurrentArgument()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -273,11 +407,11 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
|
|||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
globalSelection();
|
globalSelection();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1) {
|
if (send == PushButton1) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = LineEdit1;
|
||||||
}
|
}
|
||||||
else if(send == GroupPoints->PushButton2) {
|
else if (send == PushButton2) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
myEditCurrentArgument = LineEdit2;
|
||||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +419,6 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
|
|||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -293,13 +426,15 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
|
|||||||
void TransformationGUI_ScaleDlg::ActivateThisDialog()
|
void TransformationGUI_ScaleDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
connect(myGeomGUI->getApp()->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
this, SLOT(SelectionIntoArgument()));
|
||||||
globalSelection();
|
|
||||||
GroupPoints->LineEdit1->setFocus();
|
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
globalSelection();
|
||||||
|
myEditCurrentArgument->setFocus();
|
||||||
|
if (myEditCurrentArgument == LineEdit2) {
|
||||||
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : enterEvent()
|
// function : enterEvent()
|
||||||
@ -311,7 +446,6 @@ void TransformationGUI_ScaleDlg::enterEvent(QEvent* e)
|
|||||||
ActivateThisDialog();
|
ActivateThisDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ValueChangedInSpinBox()
|
// function : ValueChangedInSpinBox()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -321,7 +455,6 @@ void TransformationGUI_ScaleDlg::ValueChangedInSpinBox()
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : createOperation
|
// function : createOperation
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -337,9 +470,17 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool TransformationGUI_ScaleDlg::isValid (QString& msg)
|
bool TransformationGUI_ScaleDlg::isValid (QString& msg)
|
||||||
{
|
{
|
||||||
return !(myObjects.length() == 0 || myPoint->_is_nil() || fabs(GetFactor()) <= 0.00001);
|
if (myObjects.length() > 0 && fabs(SpinBox_FX->GetValue()) > 0.00001)
|
||||||
|
{
|
||||||
|
// && !myPoint->_is_nil()
|
||||||
|
if (getConstructorId() == 0)
|
||||||
|
return true;
|
||||||
|
if (fabs(SpinBox_FY->GetValue()) > 0.00001 &&
|
||||||
|
fabs(SpinBox_FZ->GetValue()) > 0.00001)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : execute
|
// function : execute
|
||||||
@ -348,27 +489,67 @@ bool TransformationGUI_ScaleDlg::isValid( QString& msg )
|
|||||||
bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
|
bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
|
||||||
{
|
{
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
bool toCreateCopy = IsPreview() || CheckBoxCopy->isChecked();
|
||||||
|
|
||||||
GEOM::GEOM_Object_var anObj;
|
GEOM::GEOM_Object_var anObj;
|
||||||
|
|
||||||
if (GroupPoints->CheckButton1->isChecked() || IsPreview())
|
switch (getConstructorId())
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
if (toCreateCopy)
|
||||||
|
{
|
||||||
for (int i = 0; i < myObjects.length(); i++)
|
for (int i = 0; i < myObjects.length(); i++)
|
||||||
{
|
{
|
||||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||||
ScaleShapeCopy( myObjects[i], myPoint, GetFactor() );
|
ScaleShapeCopy(myObjects[i], myPoint, SpinBox_FX->GetValue());
|
||||||
if (!anObj->_is_nil())
|
if (!anObj->_is_nil())
|
||||||
objects.push_back(anObj._retn());
|
objects.push_back(anObj._retn());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
for (int i = 0; i < myObjects.length(); i++)
|
for (int i = 0; i < myObjects.length(); i++)
|
||||||
{
|
{
|
||||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||||
ScaleShape( myObjects[i], myPoint, GetFactor() );
|
ScaleShape(myObjects[i], myPoint, SpinBox_FX->GetValue());
|
||||||
if (!anObj->_is_nil())
|
if (!anObj->_is_nil())
|
||||||
objects.push_back(anObj._retn());
|
objects.push_back(anObj._retn());
|
||||||
}
|
}
|
||||||
res = true;
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
if (toCreateCopy)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < myObjects.length(); i++)
|
||||||
|
{
|
||||||
|
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||||
|
ScaleShapeAlongAxesCopy(myObjects[i], myPoint, SpinBox_FX->GetValue(),
|
||||||
|
SpinBox_FY->GetValue(), SpinBox_FZ->GetValue());
|
||||||
|
if (!anObj->_is_nil())
|
||||||
|
objects.push_back(anObj._retn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < myObjects.length(); i++)
|
||||||
|
{
|
||||||
|
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||||
|
ScaleShapeAlongAxes(myObjects[i], myPoint, SpinBox_FX->GetValue(),
|
||||||
|
SpinBox_FY->GetValue(), SpinBox_FZ->GetValue());
|
||||||
|
if (!anObj->_is_nil())
|
||||||
|
objects.push_back(anObj._retn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = true;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,37 +568,29 @@ void TransformationGUI_ScaleDlg::restoreSubShapes (SALOMEDS::Study_ptr theStud
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : GetFactor()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
double TransformationGUI_ScaleDlg::GetFactor() const
|
|
||||||
{
|
|
||||||
return GroupPoints->SpinBox_DX->GetValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : CreateCopyModeChanged()
|
// function : CreateCopyModeChanged()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_ScaleDlg::CreateCopyModeChanged (bool isCreateCopy)
|
void TransformationGUI_ScaleDlg::CreateCopyModeChanged (bool isCreateCopy)
|
||||||
{
|
{
|
||||||
this->GroupBoxName->setEnabled(isCreateCopy);
|
GroupBoxName->setEnabled(isCreateCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : addSubshapeToStudy
|
// function : addSubshapesToStudy
|
||||||
// purpose : virtual method to add new SubObjects if local selection
|
// purpose : virtual method to add new SubObjects if local selection
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_ScaleDlg::addSubshapesToStudy()
|
void TransformationGUI_ScaleDlg::addSubshapesToStudy()
|
||||||
{
|
{
|
||||||
bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
|
bool toCreateCopy = IsPreview() || CheckBoxCopy->isChecked();
|
||||||
if (toCreateCopy) {
|
if (toCreateCopy)
|
||||||
|
{
|
||||||
|
if (!myPoint->_is_nil())
|
||||||
|
{
|
||||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||||
|
objMap[LineEdit2->text()] = myPoint;
|
||||||
objMap[GroupPoints->LineEdit2->text()] = myPoint;
|
|
||||||
|
|
||||||
addSubshapesToFather(objMap);
|
addSubshapesToFather(objMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -29,8 +29,14 @@
|
|||||||
#define DIALOGBOX_SCALE_H
|
#define DIALOGBOX_SCALE_H
|
||||||
|
|
||||||
#include "GEOMBase_Skeleton.h"
|
#include "GEOMBase_Skeleton.h"
|
||||||
#include "DlgRef_2Sel1Spin2Check.h"
|
|
||||||
|
|
||||||
|
class QGridLayout;
|
||||||
|
class QCheckBox;
|
||||||
|
class QGroupBox;
|
||||||
|
class QLabel;
|
||||||
|
class QLineEdit;
|
||||||
|
class QPushButton;
|
||||||
|
class DlgRef_SpinBox;
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : TransformationGUI_ScaleDlg
|
// class : TransformationGUI_ScaleDlg
|
||||||
@ -56,12 +62,33 @@ protected:
|
|||||||
private :
|
private :
|
||||||
void Init();
|
void Init();
|
||||||
void enterEvent (QEvent* e);
|
void enterEvent (QEvent* e);
|
||||||
double GetFactor() const;
|
|
||||||
|
|
||||||
GEOM::ListOfGO myObjects;
|
GEOM::ListOfGO myObjects;
|
||||||
GEOM::GEOM_Object_var myPoint; /* Central Point */
|
GEOM::GEOM_Object_var myPoint; /* Central Point */
|
||||||
|
|
||||||
DlgRef_2Sel1Spin2Check* GroupPoints;
|
QGroupBox* GroupBox1;
|
||||||
|
|
||||||
|
QLabel* TextLabel1;
|
||||||
|
QLabel* TextLabel2;
|
||||||
|
|
||||||
|
QPushButton* PushButton1;
|
||||||
|
QPushButton* PushButton2;
|
||||||
|
|
||||||
|
QLineEdit* LineEdit1;
|
||||||
|
QLineEdit* LineEdit2;
|
||||||
|
|
||||||
|
QLabel* TextLabel3;
|
||||||
|
QLabel* TextLabel4;
|
||||||
|
QLabel* TextLabel5;
|
||||||
|
|
||||||
|
DlgRef_SpinBox* SpinBox_FX;
|
||||||
|
DlgRef_SpinBox* SpinBox_FY;
|
||||||
|
DlgRef_SpinBox* SpinBox_FZ;
|
||||||
|
|
||||||
|
QCheckBox* CheckBoxCopy;
|
||||||
|
|
||||||
|
QGridLayout* GroupBox1Layout;
|
||||||
|
QGridLayout* OwnLayout;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
@ -70,6 +97,7 @@ private slots:
|
|||||||
void LineEditReturnPressed();
|
void LineEditReturnPressed();
|
||||||
void SelectionIntoArgument();
|
void SelectionIntoArgument();
|
||||||
void SetEditCurrentArgument();
|
void SetEditCurrentArgument();
|
||||||
|
void ConstructorsClicked (int constructorId);
|
||||||
void ValueChangedInSpinBox();
|
void ValueChangedInSpinBox();
|
||||||
void CreateCopyModeChanged (bool isCreateCopy);
|
void CreateCopyModeChanged (bool isCreateCopy);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user