Merge from V6_2_BR 23/12/2010

This commit is contained in:
inv 2010-12-24 08:16:18 +00:00
parent 56da2a0652
commit aab55c4f10
52 changed files with 1447 additions and 594 deletions

View File

@ -37,7 +37,7 @@ SUBDIRS = idl adm_local resources src doc bin
DIST_SUBDIRS = idl adm_local resources src doc bin
DISTCLEANFILES = a.out aclocal.m4 configure local-install.sh
DISTCLEANFILES = a.out aclocal.m4 configure local-install.sh hack_libtool
salomeinclude_DATA = GEOM_version.h

View File

@ -389,6 +389,9 @@ sed -i "s%^CC=\"\(.*\)\"%hack_libtool (){ \n\
$(pwd)/hack_libtool \1 \"\$[@]\" \n\
}\n\
CC=\"hack_libtool\"%g" libtool
sed -i "s%\(\s*\)for searchdir in \$newlib_search_path \$lib_search_path \$sys_lib_search_path \$shlib_search_path; do%\1searchdirs=\"\$newlib_search_path \$lib_search_path \$sys_lib_search_path \$shlib_search_path\"\n\1for searchdir in \$searchdirs; do%g" libtool
sed -i "s%\(\s*\)searchdirs=\"\$newlib_search_path \$lib_search_path \(.*\)\"%\1searchdirs=\"\$newlib_search_path \$lib_search_path\"\n\1sss_beg=\"\"\n\1sss_end=\"\2\"%g" libtool
sed -i "s%\(\s*\)\(for searchdir in \$searchdirs; do\)%\1for sss in \$searchdirs; do\n\1 if ! test -d \$sss; then continue; fi\n\1 ssss=\$(cd \$sss; pwd)\n\1 if test \"\$ssss\" != \"\" \&\& test -d \$ssss; then\n\1 case \$ssss in\n\1 /usr/lib | /usr/lib64 ) ;;\n\1 * ) sss_beg=\"\$sss_beg \$ssss\" ;;\n\1 esac\n\1 fi\n\1done\n\1searchdirs=\"\$sss_beg \$sss_end\"\n\1\2%g" libtool
],[])
# This list is initiated using autoscan and must be updated manually
@ -405,6 +408,7 @@ AC_OUTPUT([ \
GEOM_version.h \
doc/Makefile \
doc/docutils/Makefile \
doc/docutils/conf.py \
doc/salome/Makefile \
doc/salome/gui/Makefile \
doc/salome/gui/GEOM/Makefile \

View File

@ -49,7 +49,7 @@ htm:
mkdir -p html doctrees
PYTHONPATH=$(SPHINX_PYTHONPATH):${PYTHONPATH} \
LD_LIBRARY_PATH=$(SPHINX_LD_LIBRARY_PATH):${LD_LIBRARY_PATH} \
$(SPHINXBUILD) -W -b html $(ALLSPHINXOPTS) html
$(SPHINXBUILD) -c $(top_builddir)/doc/docutils -W -b html $(ALLSPHINXOPTS) html
@echo
@echo "Build finished. The HTML pages are in html."
@ -57,7 +57,7 @@ latex:
mkdir -p latex doctrees
PYTHONPATH=$(SPHINX_PYTHONPATH):${PYTHONPATH} \
LD_LIBRARY_PATH=$(SPHINX_LD_LIBRARY_PATH):${LD_LIBRARY_PATH} \
$(SPHINXBUILD) -W -b latex $(ALLSPHINXOPTS) latex
$(SPHINXBUILD) -c $(top_builddir)/doc/docutils -W -b latex $(ALLSPHINXOPTS) latex
@echo
@echo "Build finished; the LaTeX files are in latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
@ -73,9 +73,6 @@ RSTFILES= \
EXTRA_DIST+= $(RSTFILES)
EXTRA_DIST+= \
conf.py
install-data-local: html/index.html
test -z $(pydocdir) || mkdir -p $(DESTDIR)$(pydocdir)
if test -d "html"; then b=; else b="$(srcdir)/"; fi; \

View File

@ -54,9 +54,9 @@ copyright = '2010 EDF R&D'
# built documents.
#
# The short X.Y version.
version = '6.2.0'
version = '@VERSION@'
# The full version, including alpha/beta/rc tags.
release = '6.2.0'
release = '@VERSION@'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@ -24,10 +24,10 @@
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
EXTRA_DIST += images input static/footer.html static/doxygen.css
EXTRA_DIST += images input static/footer.html static/doxygen.css static/SALOME_BOA_PA.pdf
guidocdir = $(docdir)/gui/GEOM
guidoc_DATA = images/head.png
guidoc_DATA = images/head.png static/SALOME_BOA_PA.pdf
usr_docs: doxyfile_tui doxyfile_py doxyfile
echo "===========================================" ; \

View File

@ -2,19 +2,25 @@
\page common_operation_page Common
\n To produce a \b Common operation in the <b>Main Menu</b> select <b>Operations - > Boolean - > Common</b>
For detail description of the Boolean operations please refer to
<a href="SALOME_BOA_PA.pdf">this document</a>.
It provides a general review of the Partition and Boolean
operations algorithms, describes the usage methodology and highlighs
major limitations of these operations.
\n This operation cuts the common part of two shapes and transforms it into an independent geometrical object.
To produce a \b Common operation in the <b>Main Menu</b> select <b>Operations - > Boolean - > Common</b>
\n The \b Result will be any \b GEOM_Object.
\n <b>TUI Command:</b> <em>geompy.MakeCommon(s1, s2)</em>
\n <b>Arguments:</b> Name + 2 shapes.
\n <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments".
This operation cuts the common part of two shapes and transforms it into an independent geometrical object.
The \b Result will be any \b GEOM_Object.
<b>TUI Command:</b> <em>geompy.MakeCommon(s1, s2)</em>
<b>Arguments:</b> Name + 2 shapes.
<b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments".
\image html bool2.png
\n <b>Example:</b>
<b>Example:</b>
\image html fusesn1.png "The initial shapes"

View File

@ -2,19 +2,25 @@
\page cut_operation_page Cut
\n To produce a \b Cut operation in the <b>Main Menu</b> select <b>Operations - > Boolean - > Cut</b>
For detail description of the Boolean operations please refer to
<a href="SALOME_BOA_PA.pdf">this document</a>.
It provides a general review of the Partition and Boolean
operations algorithms, describes the usage methodology and highlighs
major limitations of these operations.
\n This operation cuts a shape with another one.
\n The \b Result will be any \b GEOM_Object.
\n <b>Arguments:</b> Name + 2 shapes.
\n <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments".
To produce a \b Cut operation in the <b>Main Menu</b> select <b>Operations - > Boolean - > Cut</b>
\n <b>Dialog Box:</b>
This operation cuts a shape with another one.
The \b Result will be any \b GEOM_Object.
<b>Arguments:</b> Name + 2 shapes.
<b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments".
<b>Dialog Box:</b>
\image html bool3.png
\n <b>Example:</b>
<b>Example:</b>
\image html fusesn1.png "The initial shapes"

View File

@ -2,20 +2,26 @@
\page fuse_operation_page Fuse
\n To produce a \b Fuse operation in the <b>Main Menu</b> select
For detail description of the Boolean operations please refer to
<a href="SALOME_BOA_PA.pdf">this document</a>.
It provides a general review of the Partition and Boolean
operations algorithms, describes the usage methodology and highlighs
major limitations of these operations.
To produce a \b Fuse operation in the <b>Main Menu</b> select
<b>Operations - > Boolean - > Fuse</b>
\n This operation creates a shape from two shapes.
This operation creates a shape from two shapes.
\n The \b Result will be any \b GEOM_Object.
\n <b>TUI Command:</b> <em>geompy.MakeFuse(s1, s2)</em>
\n <b>Arguments:</b> Name + 2 shapes.
\n <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments".
The \b Result will be any \b GEOM_Object.
<b>TUI Command:</b> <em>geompy.MakeFuse(s1, s2)</em>
<b>Arguments:</b> Name + 2 shapes.
<b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments".
\image html bool1.png
\n <b>Example:</b>
<b>Example:</b>
\image html fusesn1.png "The initial shapes"

View File

@ -27,5 +27,7 @@ Also it can be useful to have a look at the \subpage geompypkg_page "documentati
\image html image3.png "Example of Geometry module usage for engineering tasks"
There are also \subpage related_docs_page "additional reference documents"
for Geometry module that can be useful.
*/

View File

@ -2,6 +2,12 @@
\page partition_page Partition
For detail description of the Partition operation please refer to
<a href="SALOME_BOA_PA.pdf">this document</a>.
It provides a general review of the Partition and Boolean
operations algorithms, describes the usage methodology and highlighs
major limitations of these operations.
To produce a \b Partition in the <b>Main Menu</b> select <b>Operations - > Partition</b>
This operation builds a compound by intersection of several shapes

View File

@ -0,0 +1,10 @@
/*!
\page related_docs_page Related Documents
Here you can find additional reference documents for Geometry module
that can be useful for reading.
<a href="SALOME_BOA_PA.pdf">General Fuse Algorithm, Partition
Algorithm, Boolean Operations Algorithm. Backgrounds.</a>
*/

View File

@ -2,20 +2,26 @@
\page section_opeartion_page Section
\n To produce a \b Section operation in the <b>Main Menu</b> select
For detail description of the Boolean operations please refer to
<a href="SALOME_BOA_PA.pdf">this document</a>.
It provides a general review of the Partition and Boolean
operations algorithms, describes the usage methodology and highlighs
major limitations of these operations.
To produce a \b Section operation in the <b>Main Menu</b> select
<b>Operations - > Boolean - > Section</b>
\n This operation creates the section between 2 shapes.
This operation creates the section between 2 shapes.
\n The \b Result will be any \b GEOM_Object (EDGE or WIRE).
\n <b>TUI Command:</b> <em>geompy.MakeSection(s1, s2)</em>
\n <b>Arguments:</b> Name + 2 shapes.
\n <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments".
The \b Result will be any \b GEOM_Object (EDGE or WIRE).
<b>TUI Command:</b> <em>geompy.MakeSection(s1, s2)</em>
<b>Arguments:</b> Name + 2 shapes.
<b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments".
\image html neo-section.png
\n <b>Example:</b>
<b>Example:</b>
\image html fusesn1.png "The initial shapes"

View File

@ -357,6 +357,20 @@ print "\nBox 100x30x100 description:"
print Descr
\endcode
<br><h2>NbShapes and ShapeInfo</h2>
\code
import geompy
# create a box
box = geompy.MakeBoxDXDYDZ(100,30,100)
nbSolids = geompy.NbShapes(box, geompy.ShapeType["SOLID"])
print "\nBox 100x30x100 quantity of solids:", nbSolids
boxInfo = geompy.ShapeInfo(box)
print "\nBox 100x30x100 shapes:"
print boxInfo
\endcode
<br><h2>Check Shape</h2>
\code

View File

@ -2,7 +2,13 @@
\page using_boolean_operations_page Using Boolean Operations
\n You can use the following boolean operations for construction of more
For detail description of the Boolean operations please refer to
<a href="SALOME_BOA_PA.pdf">this document</a>.
It provides a general review of the Partition and Boolean
operations algorithms, describes the usage methodology and highlighs
major limitations of these operations.
You can use the following boolean operations for construction of more
complex geometrical objects (2D & 3D elements):
<ul>
@ -38,7 +44,7 @@ Shape2 is the second argument of Cut operation;
<em>geompy.MakeSection(Shape1, Shape2)</em>, where \em Shape1 and \em
Shape2 is the second argument of Section operation;
\n 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_boolean_operations_page "Boolean Operations".
*/

Binary file not shown.

View File

@ -111,7 +111,12 @@ module GEOM
FSM_GetShapesOnShape,
/*! Use GetInPlaceByHistory method (can work only after Partition) */
FSM_GetInPlaceByHistory
FSM_GetInPlaceByHistory,
/*! To be used only for multi-transformation result.
* Only this method can be used after multi-transformation.
*/
FSM_MultiTransformed
};
/*!
@ -180,10 +185,19 @@ module GEOM
* This function is useful for the compounds only; for simple shapes it
* exactly the same value as GetShapeType().
* Note, that compounds are procesed recursively.
* \sa GetShapeType(), GetTopologyType()
* \sa GetShapeType(), GetTopologyType(), GetMaxShapeType()
*/
shape_type GetMinShapeType();
/*!
* Get a maximal type of the top-level shapes contained in the object.
* This function is useful for the compounds only; for simple shapes it
* exactly the same value as GetShapeType().
* Note, that compounds are procesed recursively.
* \sa GetShapeType(), GetTopologyType(), GetMinShapeType()
*/
shape_type GetMaxShapeType();
/*!
* Set name of the object.
* \param theName is a name which will be associated with this object.
@ -968,13 +982,23 @@ module GEOM
* \param theCopy is a true or false parameter. true is to reverse direction, false is to move normal direction.
* \return New GEOM_Object, containing the displaced shape.
*/
GEOM_Object PositionAlongPath (in GEOM_Object theObject,
in GEOM_Object thePath,
in double theDistance,
in boolean theCopy,
in boolean theReverse);
/*!
* Transform the shape in the same way what was used for the sample shape creation.
* \param theObject The object to be transformed.
* \param theSample The object containing information about required transformation.
* \note Implementation of this method is limited by multi-transformations now.
* \note Internal method.
* \return New GEOM_Object, containing the transformed shape.
*/
GEOM_Object TransformLikeOtherCopy (in GEOM_Object theObject,
in GEOM_Object theSample);
/*!
* Recompute the shape from its arguments.
* \param theObject The object to be recomputed.

View File

@ -95,10 +95,14 @@ static
void MakeInternalShells(const TopTools_MapOfShape& ,
TopTools_ListOfShape& );
//modified by NIZNHY-PKV Tue Aug 5 15:06:50 2008f
static
Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell);
//modified by NIZNHY-PKV Tue Aug 5 15:06:57 2008t
Standard_Boolean IsClosedShell(const TopoDS_Shell& );
//modified by NIZNHY-PKV Tue Oct 26 13:30:39 2010f
static
Standard_Boolean RefineShell(const TopoDS_Shell& ,
TopoDS_Shell& );
//modified by NIZNHY-PKV Tue Oct 26 13:30:42 2010t
//=======================================================================
//function :
@ -187,15 +191,17 @@ static
if (!myShapesToAvoid.Contains(aF)) {
TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
}
else {
int a=0;
/*
else {
int a=0;
}
*/
}
aNbE=aMEF.Extent();
//
// 2. myFacesToAvoid
for (i=1; i<=aNbE; ++i) {
const TopoDS_Edge& aE=TopoDS::Edge(aMEF.FindKey(i));
const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aMEF.FindKey(i)));
if (BRep_Tool::Degenerated(aE)) {
continue;
}
@ -209,7 +215,7 @@ static
//
aOrE=aE.Orientation();
//
const TopoDS_Face& aF1=TopoDS::Face(aLF.First());
const TopoDS_Face& aF1=*((TopoDS_Face*)(&aLF.First()));
if (aNbF==1) {
if (aOrE==TopAbs_INTERNAL) {
continue;
@ -218,7 +224,7 @@ static
myShapesToAvoid.Add(aF1);
}
else if (aNbF==2) {
const TopoDS_Face& aF2=TopoDS::Face(aLF.Last());
const TopoDS_Face& aF2=*((TopoDS_Face*)(&aLF.Last()));
if (aF2.IsSame(aF1)) {
if (BRep_Tool::IsClosed(aE, aF1)) {
continue;
@ -233,7 +239,7 @@ static
myShapesToAvoid.Add(aF2);
}
}
//DEB
/*//DEB
else {
TopTools_ListIteratorOfListOfShape aItLF;
//
@ -243,7 +249,7 @@ static
int a=0;
}
}
//DEB
*///DEB
}// for (i=1; i<=aNbE; ++i) {
//
if (!bFound) {
@ -262,12 +268,12 @@ static
//
myLoops.Clear();
//
Standard_Integer aNbLF, aNbOff, aNbFP, aNbFA;
Standard_Integer aNbLF, aNbOff, aNbFP;
TopAbs_Orientation anOr;
TopoDS_Edge aEL;
BRep_Builder aBB;
NMTTools_CoupleOfShape aCSOff;
TopTools_MapOfOrientedShape AddedFacesMap;//, aMFP;
TopTools_MapOfOrientedShape AddedFacesMap;
TopTools_IndexedDataMapOfShapeListOfShape aEFMap, aMEFP;
TopTools_ListIteratorOfListOfShape aItF, aIt;
TopTools_MapIteratorOfMapOfOrientedShape aItM;
@ -304,12 +310,12 @@ static
// loop on faces added to Shell; add their neighbor faces to Shell and so on
TopoDS_Iterator aItAddedF (aShell);
for (; aItAddedF.More(); aItAddedF.Next()) {
const TopoDS_Face& aF = TopoDS::Face(aItAddedF.Value());
const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value()));
//
// loop on edges of aF; find a good neighbor face of aF by aE
TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE);
for (; aEdgeExp.More(); aEdgeExp.Next()) {
const TopoDS_Edge& aE = TopoDS::Edge(aEdgeExp.Current());
const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aEdgeExp.Current()));
//
//1
if (aMEFP.Contains(aE)) {
@ -344,7 +350,7 @@ static
//
aItLF.Initialize(aLF);
for (; aItLF.More(); aItLF.Next()) {
const TopoDS_Face& aFL=TopoDS::Face(aItLF.Value());
const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItLF.Value()));
if (myShapesToAvoid.Contains(aFL)) {
continue;
}
@ -372,7 +378,7 @@ static
//
TopoDS_Face aSelF;
if (aNbOff==1) {
aSelF=TopoDS::Face(aLCSOff.First().Shape2());
aSelF=*((TopoDS_Face*)(&aLCSOff.First().Shape2()));
}
else if (aNbOff>1){
GEOMAlgo_Tools3D::GetFaceOff(aE, aF, aLCSOff, aSelF);
@ -384,24 +390,22 @@ static
}
} // for (; aEdgeExp.More(); aEdgeExp.Next()) {
} //for (; aItAddedF.More(); aItAddedF.Next()) {
//modified by NIZNHY-PKV Tue Aug 5 15:07:08 2008f
//myLoops.Append(aShell);
//
if (IsClosedShell(aShell)) {
myLoops.Append(aShell);
}
/*
//modified by NIZNHY-PKV Wed Oct 27 07:10:41 2010f
else {
TopoDS_Iterator aItS;
aItS.Initialize(aShell);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aFs=aItS.Value();
aMFP.Add(aFs);
Standard_Boolean bRefine;
TopoDS_Shell aShx;
//
bRefine=RefineShell(aShell, aShx);
if (bRefine) {
myLoops.Append(aShx);
}
}
*/
//modified by NIZNHY-PKV Tue Aug 5 15:07:30 2008t
} // for (; aItF.More(); aItF.Next()) {
//modified by NIZNHY-PKV Tue Aug 5 15:07:35 2008f
//modified by NIZNHY-PKV Wed Oct 27 07:10:44 2010t
} // for (; aItF.More(); aItF.Next()) {
//
// Post Treatment
TopTools_MapOfOrientedShape aMP;
@ -417,14 +421,14 @@ static
}
}
//
// b. collect all edges that are to avoid
// b. collect all faces that are to avoid
aItM.Initialize(myShapesToAvoid);
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aF=aItM.Key();
aMP.Add(aF);
}
//
// c. add all edges that are not processed to myShapesToAvoid
// c. add all faces that are not processed to myShapesToAvoid
aIt.Initialize (myShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
@ -432,7 +436,6 @@ static
myShapesToAvoid.Add(aF);
}
}
//modified by NIZNHY-PKV Tue Aug 5 15:07:44 2008t
//=================================================
//
// 2.Internal Shells
@ -442,8 +445,6 @@ static
aEFMap.Clear();
AddedFacesMap.Clear();
//
aNbFA=myShapesToAvoid.Extent();
//
aItM.Initialize(myShapesToAvoid);
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aFF=aItM.Key();
@ -464,15 +465,15 @@ static
//
TopoDS_Iterator aItAddedF (aShell);
for (; aItAddedF.More(); aItAddedF.Next()) {
const TopoDS_Face& aF = TopoDS::Face(aItAddedF.Value());
const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value()));
//
TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE);
for (; aEdgeExp.More(); aEdgeExp.Next()) {
const TopoDS_Edge& aE = TopoDS::Edge(aEdgeExp.Current());
const TopoDS_Edge& aE = *((TopoDS_Edge*)(&aEdgeExp.Current()));
const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE);
aItF.Initialize(aLF);
for (; aItF.More(); aItF.Next()) {
const TopoDS_Face& aFL=TopoDS::Face(aItF.Value());
const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItF.Value()));
if (AddedFacesMap.Add(aFL)){
aBB.Add(aShell, aFL);
}
@ -518,10 +519,8 @@ static
}
else{
// check if a shell is a hole
//XX
bIsHole=IsHole(aShell, myContext);
//bIsHole=GEOMAlgo_BuilderTools::IsHole(aShell);
//XX
//
if (bIsHole) {
aHoleShells.Append(aShell);
TopExp::MapShapes(aShell, TopAbs_FACE, aMHF);
@ -581,7 +580,7 @@ static
// 3. Add aHoles to Solids
aItMSH.Initialize(aMSH);
for (; aItMSH.More(); aItMSH.Next()) {
TopoDS_Solid aSolid=TopoDS::Solid(aItMSH.Key());
TopoDS_Solid aSolid=*((TopoDS_Solid*)(&aItMSH.Key()));
//
const TopTools_ListOfShape& aLH=aItMSH.Value();
aShellIt.Initialize(aLH);
@ -637,7 +636,7 @@ static
// 2 Process solids
aSolidIt.Initialize(myAreas);
for ( ; aSolidIt.More(); aSolidIt.Next()) {
TopoDS_Solid& aSolid=TopoDS::Solid(aSolidIt.Value());
TopoDS_Solid& aSolid=*((TopoDS_Solid*)(&aSolidIt.Value()));
//
aMEF.Clear();
TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMEF);
@ -646,7 +645,7 @@ static
aMFP.Clear();
aItMF.Initialize(aMF);
for (; aItMF.More(); aItMF.Next()) {
const TopoDS_Face& aF=TopoDS::Face(aItMF.Key());
const TopoDS_Face& aF=*((TopoDS_Face*)(&aItMF.Key()));
if (GEOMAlgo_Tools3D::IsInternalFace(aF, aSolid, aMEF, 1.e-14, *myContext)) {
aMFP.Add(aF);
}
@ -792,7 +791,6 @@ Standard_Boolean IsGrowthShell(const TopoDS_Shape& theShell,
}
return bRet;
}
//modified by NIZNHY-PKV Tue Aug 5 15:07:50 2008f
//=======================================================================
//function : IsClosedShell
//purpose :
@ -811,18 +809,15 @@ Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell)
const TopoDS_Face& aF=TopoDS::Face(aIt.Value());
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aExp.Current()));
if (BRep_Tool::Degenerated(aE)) {
continue;
}
/*
if (BRep_Tool::IsClosed(aE, aF)) {
continue;
}
*/
//
if (aE.Orientation()==TopAbs_INTERNAL) {
continue;
}
//
if (!aM.Add(aE)) {
aM.Remove(aE);
}
@ -835,8 +830,89 @@ Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell)
}
return bRet;
}
//modified by NIZNHY-PKV Tue Aug 5 15:08:07 2008t
//BRepTools::Write(aFF, "ff");
//modified by NIZNHY-PKV Tue Oct 26 13:30:23 2010f
//=======================================================================
//function : RefineShell
//purpose :
//=======================================================================
Standard_Boolean RefineShell(const TopoDS_Shell& aShell,
TopoDS_Shell& aShx)
{
Standard_Boolean bRet;
Standard_Integer i, aNbE, aNbF;
TopAbs_Orientation aOrE;
TopTools_IndexedDataMapOfShapeListOfShape aMEF;
TopTools_MapOfOrientedShape aMFx;
//
bRet=Standard_False;
//
TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEF);
aNbE=aMEF.Extent();
for (i=1; i<=aNbE; ++i) {
const TopoDS_Edge &aE=*((TopoDS_Edge*)(&aMEF.FindKey(i)));
//
if (BRep_Tool::Degenerated(aE)) {
continue;
}
//
aOrE=aE.Orientation();
//
const TopTools_ListOfShape& aLF=aMEF(i);
aNbF=aLF.Extent();
if (!aNbF) {
continue;
}
//
const TopoDS_Face& aF1=*((TopoDS_Face*)(&aLF.First()));
if (aNbF==1) {
if (aOrE==TopAbs_INTERNAL) {
continue;
}
aMFx.Add(aF1);
}
//
else if (aNbF==2) {
const TopoDS_Face& aF2=*((TopoDS_Face*)(&aLF.Last()));
if (aF2.IsSame(aF1)) {
if (BRep_Tool::IsClosed(aE, aF1)) {
continue;
}
if (aOrE==TopAbs_INTERNAL) {
continue;
}
aMFx.Add(aF1);
aMFx.Add(aF2);
}
}
}
//
aNbF=aMFx.Extent();
if (!aNbF) {
return bRet;
}
//
BRep_Builder aBB;
TopoDS_Iterator aIt;
//
aNbF=0;
aBB.MakeShell(aShx);
aIt.Initialize(aShell);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
if (!aMFx.Contains(aF)) {
aBB.Add(aShx, aF);
++aNbF;
}
}
//
if (aNbF) {
bRet=IsClosedShell(aShx);
}
//
return bRet;
}
//modified by NIZNHY-PKV Tue Oct 26 13:30:26 2010t
//
// ErrorStatus :
// 11 - Null Context

View File

@ -116,7 +116,7 @@ static
IntTools_Context& aCtx=pPF->ChangeContext();
//
Standard_Boolean bToReverse;
Standard_Integer i, aNb, aNbSp, nSp, nSpR, nSpx, aIsCB;
Standard_Integer i, aNb, aNbSp, nSp, nSpR, nSpx, aIsCB, aNbLB;
TColStd_ListIteratorOfListOfInteger aItLB;
TColStd_ListOfInteger aLB;
TopoDS_Edge aEE, aESpR;
@ -150,16 +150,17 @@ static
nSp=aPB.Edge();
const TopoDS_Shape& aSp=aDS.Shape(nSp);
//
//modified by NIZNHY-PKV Fri Nov 30 10:40:36 2007 f
//const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB);
const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB, aIsCB);
//modified by NIZNHY-PKV Fri Nov 30 10:40:48 2007t
//modified by NIZNHY-PKV Wed Oct 27 11:19:30 2010f
aNbLB=aLB.Extent();
if (aIsCB && aNbLB<2) {
aIsCB=0;
}
//modified by NIZNHY-PKV Wed Oct 27 11:19:34 2010t
//
nSpR=aPBR.Edge();
const TopoDS_Shape& aSpR=aDS.Shape(nSpR);
//modified by NIZNHY-PKV Fri Nov 30 10:41:39 2007f
//if (aSpR.IsSame(aSp) && aSpR.IsSame(aE)) {
if (aSpR.IsSame(aSp) && aSpR.IsSame(aE) && !aIsCB) {
//modified by NIZNHY-PKV Fri Nov 30 10:41:46 2007t
continue;
}
//
@ -183,10 +184,7 @@ static
aIt.Initialize(aLPB);
for (; aIt.More(); aIt.Next()) {
const BOPTools_PaveBlock& aPB=aIt.Value();
//modified by NIZNHY-PKV Fri Nov 30 10:42:15 2007f
//const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB);
const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB, aIsCB);
//modified by NIZNHY-PKV Fri Nov 30 10:42:20 2007t
nSpR=aPBR.Edge();
const TopoDS_Shape& aSpR=aDS.Shape(nSpR);
//
@ -203,7 +201,6 @@ static
const TopoDS_Shape& aSpx=aDS.Shape(nSpx);
mySameDomainShapes.Add(aSpx ,aSpR);
}
//
}
}
//

View File

@ -70,6 +70,8 @@
#include <BOPTools_CArray1OfESInterference.hxx>
#include <NMTDS_ShapesDataStructure.hxx>
#include <NMTDS_InterfPool.hxx>
#include <NMTTools_PaveFiller.hxx>
#include <NMTTools_ListOfCoupleOfShape.hxx>
#include <NMTTools_Tools.hxx>
@ -84,7 +86,8 @@
#include <GEOMAlgo_Tools3D.hxx>
#include <GEOMAlgo_WireEdgeSet.hxx>
#include <GEOMAlgo_BuilderFace.hxx>
#include <NMTDS_InterfPool.hxx>
#include <GEOMAlgo_ShapeSet.hxx>
static
void UpdateCandidates(const Standard_Integer ,
@ -254,6 +257,9 @@ static
aNbSE=aLSE.Extent();
if (aNbSE) {
aMFP.Add(i);
//modified by NIZNHY-PKV Wed Oct 27 11:40:57 2010f
break;
//modified by NIZNHY-PKV Wed Oct 27 11:41:07 2010t
}
}
}
@ -358,46 +364,35 @@ static
}
//
// 2.2. Build images Faces
GEOMAlgo_BuilderFace aBF;
//
aBF.SetFace(aFF);
aBF.SetContext(aCtx);
const TopTools_ListOfShape& aSE=aWES.StartElements();
//
//DEB f
/*
{
TopoDS_Compound aCx;
BRep_Builder aBBx;
TopTools_ListIteratorOfListOfShape aItx;
//
aBBx.MakeCompound(aCx);
aBBx.Add(aCx, aFF);
aItx.Initialize(aSE);
for (; aItx.More(); aItx.Next()) {
TopoDS_Shape& aEx=aItx.Value();
aBBx.Add(aCx, aEx);
}
int a=0;
}
*/
//DEB t
//
aBF.SetShapes(aSE);
//
aBF.Perform();
//
const TopTools_ListOfShape& aLF=aBF.Areas();
//
TopTools_ListOfShape aLFR;
GEOMAlgo_ShapeSet aS1, aS2;
//
aIt.Initialize(aLF);
for (; aIt.More(); aIt.Next()) {
TopoDS_Shape& aFR=aIt.Value();
if (anOriF==TopAbs_REVERSED) {
aFR.Orientation(TopAbs_REVERSED);
const TopTools_ListOfShape& aSE=aWES.StartElements();
//modified by NIZNHY-PKV Thu Oct 28 08:30:41 2010f
aS1.Add(aSE);
aS2.Add(aFF, TopAbs_EDGE);
if (aS1.IsEqual(aS2)) {
aLFR.Append(aF);
}
//modified by NIZNHY-PKV Thu Oct 28 08:30:42 2010t
else {
GEOMAlgo_BuilderFace aBF;
//
aBF.SetFace(aFF);
aBF.SetContext(aCtx);
aBF.SetShapes(aSE);
// <-DEB
aBF.Perform();
//
const TopTools_ListOfShape& aLF=aBF.Areas();
aIt.Initialize(aLF);
for (; aIt.More(); aIt.Next()) {
TopoDS_Shape& aFR=aIt.Value();
if (anOriF==TopAbs_REVERSED) {
aFR.Orientation(TopAbs_REVERSED);
}
aLFR.Append(aFR);
}
aLFR.Append(aFR);
}
//
// 2.3. Collect draft images Faces
@ -530,7 +525,7 @@ static
//=======================================================================
void GEOMAlgo_Builder::FillImagesFaces1()
{
Standard_Integer i, aNb, iSense;
Standard_Integer i, aNb, iSense, aNbLFx;
TopoDS_Face aF, aFSp, aFSD;
TopTools_ListOfShape aLFx;
TopTools_ListIteratorOfListOfShape aIt;
@ -568,7 +563,16 @@ static
aLFx.Append(aFSD);
}
}
if (!myImages.HasImage(aF)) {//XX
if (!myImages.HasImage(aF)) {
//modified by NIZNHY-PKV Wed Oct 27 14:41:34 2010f
aNbLFx=aLFx.Extent();
if (aNbLFx==1) {
const TopoDS_Shape& aFx=aLFx.First();
if (aF.IsSame(aFx)) {
continue;
}
}
//modified by NIZNHY-PKV Wed Oct 27 14:41:36 2010t
myImages.Bind(aF, aLFx);
}
}
@ -803,3 +807,20 @@ void UpdateCandidates(const Standard_Integer theNF,
theMFMV.Add(theNF, aMV);
}
}
/*
{
TopoDS_Compound aCx;
BRep_Builder aBBx;
TopTools_ListIteratorOfListOfShape aItx;
//
aBBx.MakeCompound(aCx);
aBBx.Add(aCx, aFF);
aItx.Initialize(aSE);
for (; aItx.More(); aItx.Next()) {
TopoDS_Shape& aEx=aItx.Value();
aBBx.Add(aCx, aEx);
}
int a=0;
}
*/

View File

@ -19,11 +19,10 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOMAlgo_Builder_3.cxx
// Created :
// Author : Peter KURNEV
// File: GEOMAlgo_Builder_3.cxx
// Created:
// Author: Peter KURNEV
//
#include <GEOMAlgo_Builder.hxx>
#include <TopAbs_State.hxx>
@ -75,7 +74,7 @@ static
//=======================================================================
//function : FillImagesSolids
//purpose :
//purpose :
//=======================================================================
void GEOMAlgo_Builder::FillImagesSolids()
{
@ -87,9 +86,9 @@ static
}
//=======================================================================
//function : BuildDraftSolid
//purpose :
//purpose :
//=======================================================================
void GEOMAlgo_Builder::BuildDraftSolid(const TopoDS_Shape& theSolid,
void GEOMAlgo_Builder::BuildDraftSolid (const TopoDS_Shape& theSolid,
TopoDS_Shape& theDraftSolid,
TopTools_ListOfShape& theLIF)
{
@ -103,7 +102,7 @@ static
Standard_Integer iFlag;
TopAbs_Orientation aOrF, aOrSh, aOrSd;
TopoDS_Iterator aIt1, aIt2;
TopTools_ListIteratorOfListOfShape aItS;
TopTools_ListIteratorOfListOfShape aItS;
BRep_Builder aBB;
TopoDS_Shell aShD;
TopoDS_Shape aFSDx, aFx;
@ -142,7 +141,7 @@ static
theLIF.Append(aFSDx);
}
else {
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aFSDx, aF, aCtx);
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aFSDx, aF, aCtx);
if (bToReverse) {
aFSDx.Reverse();
}
@ -182,7 +181,7 @@ static
}
//=======================================================================
//function : FillIn3DParts
//purpose :
//purpose :
//=======================================================================
void GEOMAlgo_Builder::FillIn3DParts()
{
@ -193,16 +192,16 @@ static
IntTools_Context& aCtx= pPF->ChangeContext();
//
Standard_Boolean bIsIN, bHasImage;
Standard_Integer aNbS, aNbSolids, i, j, aNbFaces, aNbFP, aNbFPx, aNbFIN, aNbLIF;// k,
TopAbs_ShapeEnum aType;
Standard_Integer aNbS, aNbSolids, i, j, aNbFaces, aNbFP, aNbFPx, aNbFIN, aNbLIF;
TopAbs_ShapeEnum aType;
TopAbs_State aState;
TopTools_IndexedMapOfShape aMSolids, aMS, aMFaces, aMFIN;
TopTools_MapOfShape aMFDone;
TopTools_IndexedDataMapOfShapeListOfShape aMEF;
TopTools_ListIteratorOfListOfShape aItS;
TopTools_ListIteratorOfListOfShape aItS;
TopoDS_Iterator aIt, aItF;
BRep_Builder aBB;
TopoDS_Solid aSolidSp;
TopoDS_Solid aSolidSp;
TopoDS_Face aFP;
//
myDraftSolids.Clear();
@ -212,7 +211,7 @@ static
const TopoDS_Shape& aS=aDS.Shape(i);
//
aType=aS.ShapeType();
if (aType==TopAbs_SOLID) {
if (aType==TopAbs_SOLID) {
// all solids from DS
aMSolids.Add(aS);
}
@ -284,6 +283,9 @@ static
else {
//aMS.Add(aShell);
TopExp::MapShapes(aShell, TopAbs_FACE, aMS);
//modified by NIZNHY-PKV Fri Dec 03 11:18:45 2010f
TopExp::MapShapes(aShell, TopAbs_EDGE, aMS);
//modified by NIZNHY-PKV Fri Dec 03 11:18:51 2010t
TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEF);
}
}
@ -304,9 +306,9 @@ static
}
//
// among all faces from aMEFP select these that have same edges
// with the solid (i.e aMEF). These faces will be treated first
// with the solid (i.e aMEF). These faces will be treated first
// to prevent the usage of 3D classifier.
// The full list of faces to process is aLFP1.
// The full list of faces to process is aLFP1.
aNbEFP=aMEFP.Extent();
for (j=1; j<=aNbEFP; ++j) {
const TopoDS_Shape& aE=aMEFP.FindKey(j);
@ -349,7 +351,7 @@ static
if (!aMFDone.Add(aSP)) {
continue;
}
//
// first face to process
aFP=TopoDS::Face(aSP);
@ -367,12 +369,12 @@ static
}
}
//
// Connexity Block that spreads from aFP the Bound
// Connexity Block that spreads from aFP the Bound
// or till the end of the block itself
aLCBF.Clear();
GEOMAlgo_Tools3D::MakeConnexityBlock(aLFP, aMS, aLCBF);
//
// fill states for the Connexity Block
// fill states for the Connexity Block
aItS.Initialize(aLCBF);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aSx=aItS.Value();
@ -412,12 +414,12 @@ static
}
//=======================================================================
//function : BuildSplitSolids
//purpose :
//purpose :
//=======================================================================
void GEOMAlgo_Builder::BuildSplitSolids()
{
myErrorStatus=0;
//
//
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
NMTTools_PaveFiller* pPF=myPaveFiller;
IntTools_Context& aCtx= pPF->ChangeContext();
@ -432,8 +434,6 @@ static
GEOMAlgo_DataMapOfShapeShapeSet aMSS;
GEOMAlgo_ShapeSet aSSi;
//
//modified by NIZNHY-PKV Wed Dec 6 17:08:03 2006f
//
// 0. Find same domain solids for non-interferred solids
aNbS=aDS.NumberOfShapesOfTheObject();
for (i=1; i<=aNbS; ++i) {
@ -452,12 +452,9 @@ static
aSSi.Add(aS, TopAbs_FACE);
//
aMSS.Bind(aS, aSSi);
} //for (i=1; i<=aNbS; ++i)
//
//modified by NIZNHY-PKV Wed Dec 6 17:08:09 2006t
} //for (i=1; i<=aNbS; ++i)
//
// 1. Build solids for interferred source solids
//
aSB.SetContext(aCtx);
aNbS=myDraftSolids.Extent();
for (i=1; i<=aNbS; ++i) {
@ -468,7 +465,7 @@ static
//
// 1.1 Fill Shell Faces Set
aSFS.Clear();
aExp.Init(aSD, TopAbs_FACE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aF=aExp.Current();
@ -489,15 +486,15 @@ static
aNbSFS=aSFS.Extent();
//
// 1.2
// Check whether aSFS contains a subsets of faces
// of solids that have been already built.
// Check whether aSFS contains a subsets of faces
// of solids that have been already built.
// If yes, shrink aSFS by these subsets.
aSSi.Clear();
aSSi.Add(aSFS);
//
aItSS.Initialize(aMSS);
for (; aItSS.More(); aItSS.Next()) {
const TopoDS_Shape& aSR=aItSS.Key();
const TopoDS_Shape& aSR=aItSS.Key();
const GEOMAlgo_ShapeSet& aSSR=aItSS.Value();
if (aSSi.Contains(aSSR)) {
// the aSR is SD solid for aS
@ -516,6 +513,11 @@ static
}
const TopTools_ListOfShape& aSFS1=aSSi.GetSet();
aNbSFS=aSFS1.Extent();
//modified by NIZNHY-PKV Wed Oct 27 09:53:15 2010f
if (!aNbSFS) {
continue;
}
//modified by NIZNHY-PKV Wed Oct 27 09:53:18 2010t
//
// 1.3 Build new solids
aSB.SetShapes(aSFS1);
@ -528,7 +530,7 @@ static
//
const TopTools_ListOfShape& aLSR=aSB.Areas();
//
// 1.4 Collect resulting solids and theirs set of faces
// 1.4 Collect resulting solids and theirs set of faces
aIt.Initialize(aLSR);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSR=aIt.Value();
@ -550,42 +552,10 @@ static
myImages.Bind(aS, aLSR);
}
} // for (i=1; i<=aNbS; ++i) {
//modified by NIZNHY-PKV Wed Dec 6 17:07:47 2006f
/*
//
// 2. Find same domain solids for non-interferred solids
aNbS=aDS.NumberOfShapesOfTheObject();
for (i=1; i<=aNbS; ++i) {
const TopoDS_Shape& aS=aDS.Shape(i);
if (aS.ShapeType()!=TopAbs_SOLID) {
continue;
}
if (!aMFence.Add(aS)) {
continue;
}
if(myImages.HasImage(aS)) {
continue;
}
//
aSSi.Clear();
aSSi.Add(aS, TopAbs_FACE);
//
aItSS.Initialize(aMSS);
for (; aItSS.More(); aItSS.Next()) {
const TopoDS_Shape& aSR=aItSS.Key();
const GEOMAlgo_ShapeSet& aSSR=aItSS.Value();
if (aSSi.Contains(aSSR)) {
myImages.Bind(aS, aSR);
break;
}
}
} //for (i=1; i<=aNbS; ++i)
*/
//modified by NIZNHY-PKV Wed Dec 6 17:07:55 2006t
}
//=======================================================================
//function :FillInternalShapes
//purpose :
//function :FillInternalShapes
//purpose :
//=======================================================================
void GEOMAlgo_Builder::FillInternalShapes()
{
@ -610,7 +580,7 @@ static
//
// 1. Shapes to process
//
// 1.1 Shapes from pure arguments aMSI
// 1.1 Shapes from pure arguments aMSI
// 1.1.1 vertex, edge
for (i=0; i<2; ++i) {
jT=(Standard_Integer)aT[i];
@ -624,7 +594,7 @@ static
}
}
// 1.1.2 wire
{
{
jT=(Standard_Integer)TopAbs_WIRE;
const TopTools_ListOfShape &aLW=myShapes1[jT];
aIt.Initialize(aLW);
@ -639,7 +609,7 @@ static
}
}
}
// 1.1.3 theirs images/sources
// 1.1.3 theirs images/sources
aIt1.Initialize(aLSI);
for (; aIt1.More(); aIt1.Next()) {
const TopoDS_Shape& aS=aIt1.Value();
@ -693,7 +663,7 @@ static
aIt.Initialize(aLSp);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSp=aIt.Value();
if (aMFence.Add(aSp)) {
if (aMFence.Add(aSp)) {
TopExp::MapShapesAndAncestors(aSp, TopAbs_VERTEX, TopAbs_EDGE, aMSx);
TopExp::MapShapesAndAncestors(aSp, TopAbs_VERTEX, TopAbs_FACE, aMSx);
TopExp::MapShapesAndAncestors(aSp, TopAbs_EDGE , TopAbs_FACE, aMSx);
@ -707,7 +677,7 @@ static
TopExp::MapShapesAndAncestors(aS, TopAbs_VERTEX, TopAbs_FACE, aMSx);
TopExp::MapShapesAndAncestors(aS, TopAbs_EDGE , TopAbs_FACE, aMSx);
aLSd.Append(aS);
aMSOr.Add(aS);
aMSOr.Add(aS);
}
}
}//if (aType==TopAbs_SOLID)
@ -715,9 +685,9 @@ static
//
aNbSd=aLSd.Extent();
//
// 3. Some shapes of aMSI can be already tied with faces of
// 3. Some shapes of aMSI can be already tied with faces of
// split solids
aItM.Initialize(aMSI);
aItM.Initialize(aMSI);
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aSI=aItM.Key();
if (aMSx.Contains(aSI)) {
@ -741,7 +711,7 @@ static
for (; aIt.More(); aIt.Next()) {
TopoDS_Solid aSd=TopoDS::Solid(aIt.Value());
//
aItM.Initialize(aMSI);
aItM.Initialize(aMSI);
for (; aItM.More(); aItM.Next()) {
TopoDS_Shape aSI=aItM.Key();
aSI.Orientation(TopAbs_INTERNAL);
@ -777,7 +747,7 @@ static
}
//=======================================================================
//function : OwnInternalShapes
//purpose :
//purpose :
//=======================================================================
void OwnInternalShapes(const TopoDS_Shape& theS,
TopTools_IndexedMapOfShape& theMx)
@ -795,4 +765,3 @@ static
//
// ErrorStatus
// 30 - SolidBuilder failed

View File

@ -73,7 +73,14 @@ is
---Purpose: Returns the Set
returns ListOfShape from TopTools;
---C++: return const &
--modified by NIZNHY-PKV Wed Oct 28 13:51:45 2010f
IsEqual(me;
theOther: ShapeSet from GEOMAlgo)
---Purpose: Returns True if the Set==theSet
returns Boolean from Standard;
---C++: alias operator ==
--modified by NIZNHY-PKV Wed Oct 28 13:51:50 2010t
fields
myMap : MapOfOrientedShape from TopTools is protected;
myList : ListOfShape from TopTools is protected;

View File

@ -96,17 +96,6 @@
//=======================================================================
const TopTools_ListOfShape& GEOMAlgo_ShapeSet::GetSet()const
{
/*
TopTools_ListOfShape *pL;
TopTools_MapIteratorOfMapOfOrientedShape aIt;
//
pL=(TopTools_ListOfShape *)&myList;
pL->Clear();
aIt.Initialize(myMap);
for (; aIt.More(); aIt.Next()) {
pL->Append(aIt.Key());
}
*/
return myList;
}
//=======================================================================
@ -140,16 +129,6 @@
//=======================================================================
void GEOMAlgo_ShapeSet::Subtract(const GEOMAlgo_ShapeSet& theOther)
{
/*
TopTools_MapIteratorOfMapOfOrientedShape aIt;
//
aIt.Initialize(theOther.myMap);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Key();
myMap.Remove(aS);
}
*/
//
TopTools_ListIteratorOfListOfShape aIt;
TopTools_ListOfShape aLS;
//
@ -166,3 +145,34 @@
//
myList=aLS;
}
//modified by NIZNHY-PKV Wed Oct 28 13:51:36 2010f
//=======================================================================
//function : IsEqual
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_ShapeSet::IsEqual(const GEOMAlgo_ShapeSet& theOther)const
{
Standard_Boolean bRet;
Standard_Integer aNb1, aNb2;
TopAbs_Orientation aOr;
TopTools_ListIteratorOfListOfShape aIt;
//
bRet=Standard_True;
aNb1=myList.Extent();
const TopTools_ListOfShape& aLS2=theOther.GetSet();
aNb2=aLS2.Extent();
if (aNb1!=aNb2) {
return !bRet;
}
//
aIt.Initialize(myList);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
if(!theOther.myMap.Contains(aS)) {
bRet=!bRet;
break;
}
}
return bRet;
}
//modified by NIZNHY-PKV Wed Oct 28 13:51:38 2010t

View File

@ -23,6 +23,13 @@
#ifndef _GEOMAlgo_ShapeSet_HeaderFile
#define _GEOMAlgo_ShapeSet_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _TopTools_MapOfOrientedShape_HeaderFile
#include <TopTools_MapOfOrientedShape.hxx>
#endif
@ -39,59 +46,48 @@ class TopTools_ListOfShape;
class TopoDS_Shape;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
//! Implementation some formal <br>
//! opereations with Set of shapes <br>
class GEOMAlgo_ShapeSet {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
//! Empty constructor <br>
Standard_EXPORT GEOMAlgo_ShapeSet();
//! Adds shapes from the list theLS to the Set <br>
Standard_EXPORT void Add(const TopTools_ListOfShape& theLS) ;
//! Adds shape theShape to the Set <br>
Standard_EXPORT void Add(const TopoDS_Shape& theShape) ;
//! Adds sub-shapes of shape theShape, <br>
//! Empty constructor <br>
Standard_EXPORT GEOMAlgo_ShapeSet();
//! Adds shapes from the list theLS to the Set <br>
Standard_EXPORT void Add(const TopTools_ListOfShape& theLS) ;
//! Adds shape theShape to the Set <br>
Standard_EXPORT void Add(const TopoDS_Shape& theShape) ;
//! Adds sub-shapes of shape theShape, <br>
//! that have type theType to the Set <br>
Standard_EXPORT void Add(const TopoDS_Shape& theShape,const TopAbs_ShapeEnum theType) ;
//! Removes shapes of theSet from the Set <br>
Standard_EXPORT void Subtract(const GEOMAlgo_ShapeSet& theSet) ;
//! Clears internal fields <br>
Standard_EXPORT void Clear() ;
//! Returns True if the Set contains <br>
Standard_EXPORT void Add(const TopoDS_Shape& theShape,const TopAbs_ShapeEnum theType) ;
//! Removes shapes of theSet from the Set <br>
Standard_EXPORT void Subtract(const GEOMAlgo_ShapeSet& theSet) ;
//! Clears internal fields <br>
Standard_EXPORT void Clear() ;
//! Returns True if the Set contains <br>
//! all shapes of theSet <br>
Standard_EXPORT Standard_Boolean Contains(const GEOMAlgo_ShapeSet& theSet) const;
//! Returns the Set <br>
Standard_EXPORT const TopTools_ListOfShape& GetSet() const;
Standard_EXPORT Standard_Boolean Contains(const GEOMAlgo_ShapeSet& theSet) const;
//! Returns the Set <br>
Standard_EXPORT const TopTools_ListOfShape& GetSet() const;
//! Returns True if the Set==theSet <br>
Standard_EXPORT Standard_Boolean IsEqual(const GEOMAlgo_ShapeSet& theOther) const;
Standard_Boolean operator ==(const GEOMAlgo_ShapeSet& theOther) const
{
return IsEqual(theOther);
}
@ -99,24 +95,16 @@ Standard_EXPORT const TopTools_ListOfShape& GetSet() const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
TopTools_MapOfOrientedShape myMap;
TopTools_ListOfShape myList;
private:
// Methods PRIVATE
//
private:
// Fields PRIVATE
//
};
@ -126,7 +114,6 @@ private:
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -19,11 +19,10 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOMAlgo_Tools3D.cxx
// Created :
// Author : Peter KURNEV
// File: GEOMAlgo_Tools3D.cxx
// Created:
// Author: Peter KURNEV
//
#include <GEOMAlgo_Tools3D.ixx>
#include <Precision.hxx>
@ -103,16 +102,16 @@ static
const gp_Dir& );
static
void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Standard_Real aT,
gp_Pnt& aPF,
void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Standard_Real aT,
gp_Pnt& aPF,
gp_Dir& aDNF,
IntTools_Context& aCtx);
//=======================================================================
//function : IsInternalFace
//purpose :
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
const TopoDS_Solid& theSolid,
@ -135,7 +134,7 @@ static
if (!theMEF.Contains(aE)) {
continue;
}
//
//
const TopTools_ListOfShape& aLF=theMEF.FindFromKey(aE);
aNbF=aLF.Extent();
if (!aNbF) {
@ -179,7 +178,7 @@ static
}
//=======================================================================
//function : IsInternalFace
//purpose :
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
const TopoDS_Edge& theEdge,
@ -221,7 +220,7 @@ static
}
//=======================================================================
//function : IsInternalFace
//purpose :
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
const TopoDS_Edge& theEdge,
@ -246,7 +245,7 @@ static
aDt2D=BOPTools_Tools3D::MinStepIn2d();
aDt2Dx=10.*aDt2D;
BOPTools_Tools3D::PointNearEdge (theEdge, theFace, aT, aDt2Dx, aPF2D, aPF);
//
//
// 2. E1, E2
GEOMAlgo_Tools3D::GetEdgeOnFace(theEdge, theFace1, aE1);
if (aE1.Orientation()==TopAbs_INTERNAL) {
@ -287,7 +286,7 @@ static
if (aA12<0.) {
aA12=aA12+aTwoPI;
}
aA1x=AngleWithRef(aDBF1, aDBF , aDTF1);
if (aA1x<0.) {
aA1x=aA1x+aTwoPI;
@ -301,7 +300,7 @@ static
}
//=======================================================================
//function : GetFaceOff
//purpose :
//purpose :
//=======================================================================
void GEOMAlgo_Tools3D::GetFaceOff(const TopoDS_Edge& theE1,
const TopoDS_Face& theF1,
@ -355,7 +354,7 @@ static
}
//=======================================================================
//function : GetEdgeOnFace
//purpose :
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOnFace(const TopoDS_Edge& theE1,
const TopoDS_Face& theF2,
@ -383,12 +382,12 @@ static
}
//=======================================================================
//function : GetEdgeOff
//purpose :
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff(const TopoDS_Edge& theE1,
Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
const TopoDS_Face& theF2,
TopoDS_Edge& theE2)
{
Standard_Boolean bFound;
TopAbs_Orientation aOr1, aOr1C, aOr2;
@ -414,7 +413,7 @@ static
}
//=======================================================================
// function: ComputeState
// purpose:
// purpose:
//=======================================================================
TopAbs_State GEOMAlgo_Tools3D::ComputeState(const TopoDS_Face& theF,
const TopoDS_Solid& theRef,
@ -423,10 +422,10 @@ static
IntTools_Context& theCtx)
{
TopAbs_State aState;
TopExp_Explorer aExp;
TopExp_Explorer aExp;
TopoDS_Edge aE1;
gp_Pnt2d aP2D;
gp_Pnt aP3D;
gp_Pnt aP3D;
//
aState=TopAbs_UNKNOWN;
//
@ -456,7 +455,7 @@ static
}
//=======================================================================
// function: ComputeStateByOnePoint
// purpose:
// purpose:
//=======================================================================
TopAbs_State GEOMAlgo_Tools3D::ComputeStateByOnePoint(const TopoDS_Shape& theS,
const TopoDS_Solid& theRef,
@ -480,7 +479,7 @@ static
}
//=======================================================================
// function: ComputeState
// purpose:
// purpose:
//=======================================================================
TopAbs_State GEOMAlgo_Tools3D::ComputeState(const TopoDS_Vertex& theV,
const TopoDS_Solid& theRef,
@ -488,7 +487,7 @@ static
IntTools_Context& theCtx)
{
TopAbs_State aState;
gp_Pnt aP3D;
gp_Pnt aP3D;
//
aP3D=BRep_Tool::Pnt(theV);
aState=GEOMAlgo_Tools3D::ComputeState(aP3D, theRef, theTol, theCtx);
@ -496,7 +495,7 @@ static
}
//=======================================================================
// function: ComputeState
// purpose:
// purpose:
//=======================================================================
TopAbs_State GEOMAlgo_Tools3D::ComputeState(const TopoDS_Edge& theE,
const TopoDS_Solid& theRef,
@ -506,7 +505,7 @@ static
Standard_Real aT1, aT2, aT = 0.;
TopAbs_State aState;
Handle(Geom_Curve) aC3D;
gp_Pnt aP3D;
gp_Pnt aP3D;
//
aC3D = BRep_Tool::Curve(theE, aT1, aT2);
//
@ -546,7 +545,7 @@ static
}
//=======================================================================
// function: ComputeState
// purpose:
// purpose:
//=======================================================================
TopAbs_State GEOMAlgo_Tools3D::ComputeState(const gp_Pnt& theP,
const TopoDS_Solid& theRef,
@ -564,7 +563,7 @@ static
}
//=======================================================================
// function: IsSplitToReverse
// purpose:
// purpose:
//=======================================================================
Standard_Boolean GEOMAlgo_Tools3D::IsSplitToReverse(const TopoDS_Shape& theSp,
const TopoDS_Shape& theSr,
@ -598,7 +597,7 @@ static
}
//=======================================================================
//function :IsSplitToReverse
//purpose :
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_Tools3D::IsSplitToReverse(const TopoDS_Face& theFSp,
const TopoDS_Face& theFSr,
@ -644,7 +643,7 @@ static
aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
BOPTools_Tools3D::GetApproxNormalToFaceOnEdge(aESp, theFSp, aT, aPFSp, aDNFSp);
//
// Parts of theContext.ComputeVS(..)
// Parts of theContext.ComputeVS(..)
GeomAPI_ProjectPointOnSurf& aProjector=theContext.ProjPS(theFSr);
aProjector.Perform(aPFSp);
if (!aProjector.IsDone()) {
@ -659,9 +658,9 @@ static
}
//
aSr->D1(aU, aV, aPFSr, aD1U, aD1V);
gp_Dir aDD1U(aD1U);
gp_Dir aDD1U(aD1U);
gp_Dir aDD1V(aD1V);
gp_Dir aDNFSr=aDD1U^aDD1V;
gp_Dir aDNFSr=aDD1U^aDD1V;
if (theFSr.Orientation()==TopAbs_REVERSED){
aDNFSr.Reverse();
}
@ -673,7 +672,7 @@ static
}
//=======================================================================
//function :IsSplitToReverse
//purpose :
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_Tools3D::IsSplitToReverse(const TopoDS_Edge& theSplit,
const TopoDS_Edge& theEdge,
@ -688,7 +687,7 @@ static
//
bRet=Standard_False;
//
bIsDegenerated=(BRep_Tool::Degenerated(theSplit) ||
bIsDegenerated=(BRep_Tool::Degenerated(theSplit) ||
BRep_Tool::Degenerated(theEdge));
if (bIsDegenerated) {
return bRet;
@ -721,7 +720,7 @@ static
//=======================================================================
// function: Sense
// purpose:
// purpose:
//=======================================================================
Standard_Integer GEOMAlgo_Tools3D::Sense (const TopoDS_Face& theF1,
const TopoDS_Face& theF2)
@ -767,7 +766,7 @@ static
}
//=======================================================================
// function: CopyFace
// purpose:
// purpose:
//=======================================================================
void GEOMAlgo_Tools3D::CopyFace (const TopoDS_Face& theF1,
TopoDS_Face& theF2)
@ -793,7 +792,7 @@ static
}
//=======================================================================
// function: MakeContainer
// purpose:
// purpose:
//=======================================================================
void GEOMAlgo_Tools3D::MakeContainer(const TopAbs_ShapeEnum theType,
TopoDS_Shape& theC)
@ -819,7 +818,7 @@ static
TopoDS_Solid aSolid;
aBB.MakeSolid(aSolid);
theC=aSolid;
}
}
break;
//
//
@ -827,7 +826,7 @@ static
TopoDS_Shell aShell;
aBB.MakeShell(aShell);
theC=aShell;
}
}
break;
//
case TopAbs_WIRE: {
@ -843,7 +842,7 @@ static
}
//=======================================================================
// function: MakeConnexityBlock.
// purpose:
// purpose:
//=======================================================================
void GEOMAlgo_Tools3D::MakeConnexityBlock (const TopTools_ListOfShape& theLFIn,
const TopTools_IndexedMapOfShape& theMEAvoid,
@ -860,7 +859,7 @@ static
aNbF=theLFIn.Extent();
aIt.Initialize(theLFIn);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
const TopoDS_Shape& aF=aIt.Value();
TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
}
//
@ -911,7 +910,7 @@ static
}
//
}//while(1) {
//
aNbF=aMCB.Extent();
aItM.Initialize(aMCB);
@ -922,7 +921,7 @@ static
}
//=======================================================================
//function : FindFacePairs
//purpose :
//purpose :
//=======================================================================
Standard_Boolean FindFacePairs (const TopoDS_Edge& theE,
const TopTools_ListOfShape& thLF,
@ -943,7 +942,7 @@ Standard_Boolean FindFacePairs (const TopoDS_Edge& theE,
//
// Preface aLCEF
aItLF.Initialize(thLF);
for (; aItLF.More(); aItLF.Next()) {
for (; aItLF.More(); aItLF.Next()) {
const TopoDS_Face& aFL=TopoDS::Face(aItLF.Value());
//
bFound=GEOMAlgo_Tools3D::GetEdgeOnFace(theE, aFL, aEL);
@ -1014,7 +1013,7 @@ Standard_Boolean FindFacePairs (const TopoDS_Edge& theE,
//
//=======================================================================
//function : AngleWithRef
//purpose :
//purpose :
//=======================================================================
Standard_Real AngleWithRef(const gp_Dir& theD1,
const gp_Dir& theD2,
@ -1047,17 +1046,17 @@ Standard_Real AngleWithRef(const gp_Dir& theD1,
}
//=======================================================================
//function : GetApproxNormalToFaceOnEdge
//purpose :
//purpose :
//=======================================================================
void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
const TopoDS_Face& aFx,
Standard_Real aT,
gp_Pnt& aPF,
void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
const TopoDS_Face& aFx,
Standard_Real aT,
gp_Pnt& aPF,
gp_Dir& aDNF,
IntTools_Context& )//aCtx)
IntTools_Context& aCtx)
{
Standard_Boolean bReverse;
Standard_Real aT1, aT2, dT;//, aU, aV;
Standard_Real aT1, aT2, dT, aU, aV;
gp_Dir aDTT, aDNFT, aDBT;
gp_Pnt aPFT, aPFx;
Handle(Geom_Curve) aC3D;
@ -1083,7 +1082,7 @@ void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
//
// Normal at aT
BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNFT);
// Tangent at aT
BOPTools_Tools3D::GetTangentToEdge(aE, aT, aDTT);
//
@ -1099,7 +1098,7 @@ void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
aTS=aGAS.GetType();
if (aTS==GeomAbs_BSplineSurface ||
aTS==GeomAbs_BezierSurface ||
aTS==GeomAbs_Plane) {
aTS==GeomAbs_Plane){
Standard_Real aTolEx, aTolFx, aTol, dUR, dVR, dR;
//
aTolEx=BRep_Tool::Tolerance(aEx);
@ -1112,6 +1111,19 @@ void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
dT=dR;
}
}
//modified by NIZNHY-PKV Thu Dec 02 10:39:09 2010f
else if (GeomAbs_Torus ||
aTS==GeomAbs_Cylinder){
Standard_Real aTolEx, aTolFx, aTol;
//
aTolEx=BRep_Tool::Tolerance(aEx);
aTolFx=BRep_Tool::Tolerance(aFx);
aTol=2.*aTolEx+aTolFx;
if (aTol>dT) {
dT=aTol;
}
}
//modified by NIZNHY-PKV Thu Dec 02 10:39:13 2010t
}
//----------------------------------------------
//
@ -1123,8 +1135,6 @@ void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
aDNF.Reverse();
}
//
//modified by NIZNHY-PKV Wed Sep 22 10:52:54 2010f
/*
GeomAPI_ProjectPointOnSurf& aProjector=aCtx.ProjPS(aF);
//
aProjector.Perform(aPFx);
@ -1136,6 +1146,4 @@ void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
aDNF.Reverse();
}
}
*/
//modified by NIZNHY-PKV Wed Sep 22 10:52:59 2010t
}

View File

@ -19,13 +19,11 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMClient : tool to transfer BREP files from GEOM server to GEOM client
// File : GEOM_Client.cxx
// Author : Yves FRICAUD/Lucien PIGNOLONI
// Module : GEOM
// $Header$
//
#include <Standard_Stream.hxx>
#include <Standard_Stream.hxx>
@ -78,7 +76,7 @@ TopoDS_Shape GEOM_Client::Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr a
/* get sequence of bytes of resulting brep shape from GEOM server */
TopoDS_Shape S;
SALOMEDS::TMPFile_var SeqFile = aShape->GetShapeStream();
int sizebuf = SeqFile->length();
/*int sizebuf = */SeqFile->length();
char* buf;
buf = (char*) &SeqFile[0];
std::istringstream streamBrep(buf);
@ -102,6 +100,19 @@ GEOM_Client::GEOM_Client()
#endif
}
//=======================================================================
// function : Create()
// purpose : Copy constructor
//=======================================================================
GEOM_Client::GEOM_Client(const GEOM_Client& client)
{
myIORs = client.myIORs;
myShapes = client.myShapes;
_myIndexes = client._myIndexes;
_mySubShapes = client._mySubShapes;
pid_client = client.pid_client;
}
//=======================================================================
// function : Create()
// purpose :
@ -111,18 +122,35 @@ GEOM_Client::GEOM_Client(Engines::Container_ptr client)
pid_client = client->getPID();
}
//=======================================================================
// function : get_client()
// purpose : Static method to have the only one instance of GEOM_Client
//=======================================================================
#ifdef SINGLE_CLIENT
GEOM_Client& GEOM_Client::get_client()
{
static GEOM_Client a;
return a;
}
#else
GEOM_Client GEOM_Client::get_client()
{
return GEOM_Client();
}
#endif
//=======================================================================
// function : Find()
// purpose :
//=======================================================================
Standard_Integer GEOM_Client::Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S )
{
if(_myIndexes.count(IOR) != 0)
{
Standard_Integer i =_myIndexes[IOR];
S = myShapes.Value(i);
return i;
}
if (_myIndexes.count(IOR) != 0)
{
Standard_Integer i = _myIndexes[IOR];
S = myShapes.Value(i);
return i;
}
return 0;
}
@ -149,7 +177,7 @@ void GEOM_Client::Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape&
{
myIORs.Append(IOR);
myShapes.Append(S);
_myIndexes[IOR]=myIORs.Length();
_myIndexes[IOR] = myIORs.Length();
}
//=======================================================================
@ -169,7 +197,6 @@ void GEOM_Client::RemoveShapeFromBuffer( const TCollection_AsciiString& IOR)
_myIndexes.erase(IOR);
_mySubShapes.erase(IOR);
}
return;
}
//=======================================================================
@ -221,20 +248,20 @@ TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_p
TopoDS_Shape aMainShape = GetShape (geom, aShape->GetMainShape());
GEOM::ListOfLong_var list = aShape->GetSubShapeIndices();
TopTools_IndexedMapOfShape anIndices;
CORBA::String_var aMainIOR = geom->GetStringFromIOR(aShape->GetMainShape());
TCollection_AsciiString mainIOR = (char*)aMainIOR.in();
//find subshapes only one time
if(_mySubShapes.count(mainIOR)==0)
{
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aMainShape, anIndices);
Standard_Integer ii = 1, nbSubSh = anIndices.Extent();
for (; ii <= nbSubSh; ii++)
{
TopExp::MapShapes(aMainShape, anIndices);
Standard_Integer ii = 1, nbSubSh = anIndices.Extent();
for (; ii <= nbSubSh; ii++)
{
_mySubShapes[mainIOR].push_back(anIndices.FindKey(ii));
}
_mySubShapes[mainIOR].push_back(anIndices.FindKey(ii));
}
}
/* Case of only one subshape */
if (list->length() == 1 && list[0] > 0) {
@ -245,7 +272,7 @@ TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_p
TopoDS_Compound aCompound;
B.MakeCompound(aCompound);
for (int i = 0; i < list->length(); i++) {
if (0 < list[i] && list[i] <= anIndices.Extent()) {
if (0 < list[i] && list[i] <= _mySubShapes[mainIOR].size()) {
TopoDS_Shape aSubShape = _mySubShapes[mainIOR][list[i]-1];
B.Add(aCompound, aSubShape);
}

View File

@ -19,19 +19,17 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMClient : tool to transfer BREP files from GEOM server to GEOM client
// File : GEOM_Client.hxx
// Author : Yves FRICAUD
// Module : GEOM
// $Header$
//
#ifndef _GEOM_Client_HeaderFile
#define _GEOM_Client_HeaderFile
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
#
#ifdef HAVE_FINITE
#undef HAVE_FINITE // E.A. fix a warning about redefinition of HAVE_FINITE in re-inclusion of Standard_values.h
#endif
@ -44,10 +42,10 @@
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
class TCollection_AsciiString;
class TopoDS_Shape;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
@ -85,53 +83,56 @@ class TopoDS_Shape;
* and the SHAPE_READER macro defines also a new object
*/
#define SINGLE_CLIENT
//=====================================================================
// GEOM_Client : class definition
//=====================================================================
class GEOMCLIENT_EXPORT GEOM_Client {
public:
inline void* operator new(size_t,void* anAddress)
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
//Standard_EXPORT
//
//Standard_EXPORT
GEOM_Client();
//Standard_EXPORT
//Standard_EXPORT
GEOM_Client(Engines::Container_ptr client);
//Standard_EXPORT
//Standard_EXPORT
GEOM_Client(const GEOM_Client& client);
//Standard_EXPORT
Standard_Integer Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S ) ;
//Standard_EXPORT
//Standard_EXPORT
Standard_Integer Find( const TopoDS_Shape& S, TCollection_AsciiString& IOR ) ;
//Standard_EXPORT
//Standard_EXPORT
void Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S ) ;
//Standard_EXPORT
//Standard_EXPORT
TopoDS_Shape GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape );
//Standard_EXPORT
//Standard_EXPORT
void RemoveShapeFromBuffer( const TCollection_AsciiString& IOR ) ;
//Standard_EXPORT
//Standard_EXPORT
void ClearClientBuffer() ;
//Standard_EXPORT
//Standard_EXPORT
unsigned int BufferLength() ;
TopoDS_Shape Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape);
#ifdef SINGLE_CLIENT
static GEOM_Client& get_client() { static GEOM_Client a;return a; }
static GEOM_Client& get_client();
#else
static GEOM_Client get_client() { return GEOM_Client(); }
static GEOM_Client get_client();
#endif
private:
private:
// Fields PRIVATE
//
TColStd_SequenceOfAsciiString myIORs ;

View File

@ -281,21 +281,8 @@ bool GEOMGUI_Selection::isCompoundOfVertices( GEOM::GEOM_Object_ptr obj )
bool ret = false;
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
(SUIT_Session::session()->activeApplication()->activeStudy());
if ( appStudy && !CORBA::is_nil( obj ) && obj->GetShapeType() == GEOM::COMPOUND ) {
GEOM::GEOM_IMeasureOperations_var anOper = GeometryGUI::GetGeomGen()->GetIMeasureOperations( appStudy->id() );
QString whatIs = anOper->WhatIs( obj );
QStringList data = whatIs.split( "\n", QString::SkipEmptyParts );
int nbVertices = 0, nbCompounds = 0, nbOther = 0;
foreach ( QString s, data ) {
QString type = s.section( ":", 0, 0 ).trimmed().toLower();
int cnt = s.section( ":", 1, 1 ).trimmed().toInt();
if ( type == "vertex" ) nbVertices += cnt;
else if ( type == "compound" ) nbCompounds += cnt;
else if ( type != "shape" ) nbOther += cnt;
}
ret = nbVertices > 0 && nbCompounds == 1 && nbOther == 0;
anOper->Destroy();
}
if ( appStudy && !CORBA::is_nil( obj ) )
ret = obj->GetShapeType() == GEOM::COMPOUND && obj->GetMaxShapeType() == GEOM::VERTEX;
return ret;
}

View File

@ -129,34 +129,33 @@ static inline int getTopAbsMode( const int implType )
}
}
static int getMinMaxShapeType( const TopoDS_Shape& shape, bool ismin )
{
if ( shape.IsNull() )
return TopAbs_SHAPE;
int ret = shape.ShapeType();
if ( shape.ShapeType() == TopAbs_COMPOUND || shape.ShapeType() == TopAbs_COMPSOLID ) {
TopoDS_Iterator it(shape, Standard_True, Standard_False);
for (; it.More(); it.Next()) {
TopoDS_Shape sub_shape = it.Value();
if ( sub_shape.IsNull() ) continue;
int stype = getMinMaxShapeType( sub_shape, ismin );
if ( stype == TopAbs_SHAPE ) continue;
if ( ismin && stype > ret )
ret = stype;
else if ( !ismin && ( ret < TopAbs_SOLID || stype < ret ) )
ret = stype;
}
}
return ret;
}
static bool isCompoundOfVertices( const TopoDS_Shape& theShape )
{
bool ret = false;
if ( !theShape.IsNull() ) {
int iType, nbTypes [TopAbs_SHAPE];
for (iType = 0; iType < TopAbs_SHAPE; ++iType)
nbTypes[iType] = 0;
nbTypes[theShape.ShapeType()]++;
TopTools_MapOfShape aMapOfShape;
aMapOfShape.Add(theShape);
TopTools_ListOfShape aListOfShape;
aListOfShape.Append(theShape);
TopTools_ListIteratorOfListOfShape itL (aListOfShape);
for (; itL.More(); itL.Next()) {
TopoDS_Iterator it (itL.Value());
for (; it.More(); it.Next()) {
TopoDS_Shape s = it.Value();
if (aMapOfShape.Add(s)) {
aListOfShape.Append(s);
nbTypes[s.ShapeType()]++;
}
}
}
ret = nbTypes[TopAbs_VERTEX] > 0 && nbTypes[TopAbs_COMPOUND] == 1;
}
return ret;
return theShape.ShapeType() == TopAbs_COMPOUND && getMinMaxShapeType( theShape, false ) == TopAbs_VERTEX;
}
//================================================================

View File

@ -285,7 +285,6 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_CENTER_POINT</source>
<translation>Center Point</translation>
</message>
<message>
<source>GEOM_CENTRAL_POINT</source>
<translation>Central Point</translation>
@ -1508,15 +1507,15 @@ Please, select face, shell or solid and try again</translation>
</message>
<message>
<source>GEOM_SKETCHER_ADD_PARAMS</source>
<translation>Additionnal Parameters</translation>
<translation>Additionnal Parameters</translation>
</message>
<message>
<source>GEOM_SKETCHER_ANGLE</source>
<translation>Angle</translation>
<translation>Angle</translation>
</message>
<message>
<source>GEOM_SKETCHER_ANGLE2</source>
<translation>Angle :</translation>
<translation>Angle :</translation>
</message>
<message>
<source>GEOM_SKETCHER_APPLY</source>
@ -1528,12 +1527,12 @@ Please, select face, shell or solid and try again</translation>
</message>
<message>
<source>GEOM_SKETCHER_CENTER</source>
<translation>Center</translation>
<translation>Center</translation>
</message>
<message>
<source>GEOM_SKETCHER_CENTER2</source>
<translation>Center :</translation>
</message>
</message>
<message>
<source>GEOM_SKETCHER_CENTER_X</source>
<translation>Center X coord. :</translation>
@ -1604,7 +1603,7 @@ Please, select face, shell or solid and try again</translation>
</message>
<message>
<source>GEOM_SKETCHER_END_POINT2</source>
<translation>End Point :</translation>
<translation>End Point :</translation>
</message>
<message>
<source>GEOM_SKETCHER_RADIUS</source>
@ -1958,7 +1957,6 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_AXIS_DEFAULT</source>
<translation>(Z axis by default)</translation>
</message>
<message>
<source>GEOM_VECTOR_LENGTH</source>
<translation>Vector Length :</translation>
@ -4146,8 +4144,7 @@ Otherwise the dimensions will be kept without modifications.</translation>
</message>
<message>
<source>GEOM_PRECISION_HINT</source>
<translation>
Input value precision can be adjusted using
<translation>Input value precision can be adjusted using
&apos;%1&apos; parameter in Geometry module preferences.</translation>
</message>
<message>
@ -4213,7 +4210,7 @@ Input value precision can be adjusted using
<message>
<source>GEOM_PLUGINS_OTHER</source>
<translation>Other</translation>
</message>
</message>
</context>
<context>
<name>BasicGUI_CurveDlg</name>
@ -4467,7 +4464,7 @@ Number of sketch points too small</translation>
<message>
<source>SHOW_ALL_SUB_SHAPES</source>
<translation>Show all sub-shapes</translation>
</message>
</message>
<message>
<source>SELECT_ALL</source>
<translation>Select All</translation>

View File

@ -1505,6 +1505,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_SKETCHER_ABS</source>
<translation>Absolu</translation>
</message>
<message>
<source>GEOM_SKETCHER_ADD_PARAMS</source>
<translation>TODO</translation>
</message>
<message>
<source>GEOM_SKETCHER_ANGLE</source>
<translation>Angle</translation>
@ -1521,6 +1525,30 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_SKETCHER_ARC</source>
<translation>Arc</translation>
</message>
<message>
<source>GEOM_SKETCHER_CENTER</source>
<translation>Center</translation>
</message>
<message>
<source>GEOM_SKETCHER_CENTER2</source>
<translation>Centre :</translation>
</message>
<message>
<source>GEOM_SKETCHER_CENTER_X</source>
<translation>Centre coord. X :</translation>
</message>
<message>
<source>GEOM_SKETCHER_CENTER_Y</source>
<translation>Centre coord. Y :</translation>
</message>
<message>
<source>GEOM_SKETCHER_CENTER_DX</source>
<translation>Centre coord. DX :</translation>
</message>
<message>
<source>GEOM_SKETCHER_CENTER_DY</source>
<translation>Centre coord. DY :</translation>
</message>
<message>
<source>GEOM_SKETCHER_DEST</source>
<translation>Destination</translation>
@ -1557,6 +1585,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_SKETCHER_LENGTH2</source>
<translation>Longueur :</translation>
</message>
<message>
<source>GEOM_SKETCHER_NONE</source>
<translation>Aucun (Tangentiel)</translation>
</message>
<message>
<source>GEOM_SKETCHER_PER</source>
<translation>Perpendiculaire</translation>
@ -1571,7 +1603,11 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
</message>
<message>
<source>GEOM_SKETCHER_END_POINT2</source>
<translation>End Point :</translation>
<translation>End Point :</translation>
</message>
<message>
<source>GEOM_SKETCHER_RADIUS</source>
<translation>Rayon</translation>
</message>
<message>
<source>GEOM_SKETCHER_RADIUS2</source>
@ -4042,17 +4078,29 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<translation>INOUT</translation>
</message>
<message>
<source>TOP_GET_SHAPES_ON_SHAPES</source>
<source>TOP_GET_SHAPES_ON_SHAPE</source>
<translation>Trouver les éléments d&apos;un objet</translation>
</message>
<message>
<source>MEN_GET_SHAPES_ON_SHAPES</source>
<source>MEN_GET_SHAPES_ON_SHAPE</source>
<translation>Trouver les éléments d&apos;un objet</translation>
</message>
<message>
<source>STB_GET_SHAPES_ON_SHAPES</source>
<source>STB_GET_SHAPES_ON_SHAPE</source>
<translation>Trouve les éléments d&apos;un objet</translation>
</message>
<message>
<source>TOP_GET_SHARED_SHAPES</source>
<translation>Trouver les éléments d&apos;un objet</translation>
</message>
<message>
<source>MEN_GET_SHARED_SHAPES</source>
<translation>Trouver les éléments partagés</translation>
</message>
<message>
<source>STB_GET_SHARED_SHAPES</source>
<translation>Trouve les éléments partagés</translation>
</message>
<message>
<source>GEOM_PUBLISH_RESULT_GRP</source>
<translation>Options avancées</translation>
@ -4638,6 +4686,29 @@ Voulez-vous continuer?</translation>
<translation>Ouvrir une Texture</translation>
</message>
</context>
<context>
<name>OperationGUI_GetSharedShapesDlg</name>
<message>
<source>GEOM_SHARED_SHAPES_TITLE</source>
<translation>Trouver les éléments partagés</translation>
</message>
<message>
<source>GEOM_GET_SHARED_SHAPES</source>
<translation>Eléments partagés</translation>
</message>
<message>
<source>GEOM_SHARED_SHAPES_INPUT</source>
<translation>Paramètres d&apos;entrée</translation>
</message>
<message>
<source>MSG_SHARED_SHAPES_TOO_FEW_SHAPES</source>
<translation>Pas assez d'éléments sélectionnés</translation>
</message>
<message>
<source>GEOM_SHARED_SHAPE</source>
<translation>Partagé_%1</translation>
</message>
</context>
<context>
<name>AdvancedGUI_PipeTShapeDlg</name>
<message>

View File

@ -18,21 +18,25 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//NOTE: This is an intreface to a function for the Rotate operation.
//
// NOTE: This is an interface to a function for the Rotate operation.
#include "GEOM_Function.hxx"
#include <gp_XYZ.hxx>
#define ROTATE_ANGLE 1
#define ROTATE_AXIS 2
#define ROTATE_ORGN 3
#define ROTATE_STEP1 4
#define ROTATE_NBITER1 5
#define ROTATE_NBITER2 6
#define ROTATE_NBITER1 5
#define ROTATE_NBITER2 6
#define ROTATE_CENTRAL_POINT 7
#define ROTATE_POINT1 8
#define ROTATE_POINT2 9
#define ROTATE_DIR2_X 10
#define ROTATE_DIR2_Y 11
#define ROTATE_DIR2_Z 12
class GEOMImpl_IRotate
{
@ -64,7 +68,7 @@ class GEOMImpl_IRotate
Handle(GEOM_Function) GetOriginal() { return _func->GetReference(ROTATE_ORGN); }
void SetStep(double theStep) { return _func->SetReal(ROTATE_STEP1, theStep); }
void SetStep(double theStep) { _func->SetReal(ROTATE_STEP1, theStep); }
double GetStep() { return _func->GetReal(ROTATE_STEP1); }
@ -76,6 +80,21 @@ class GEOMImpl_IRotate
int GetNbIter2() { return _func->GetInteger(ROTATE_NBITER2); }
void SetDir2 (gp_XYZ theDir2)
{
_func->SetReal(ROTATE_DIR2_X, theDir2.X());
_func->SetReal(ROTATE_DIR2_Y, theDir2.Y());
_func->SetReal(ROTATE_DIR2_Z, theDir2.Z());
}
gp_XYZ GetDir2()
{
gp_XYZ aRes (0., 0., 0.);
aRes.SetX(_func->GetReal(ROTATE_DIR2_X));
aRes.SetY(_func->GetReal(ROTATE_DIR2_Y));
aRes.SetZ(_func->GetReal(ROTATE_DIR2_Z));
return aRes;
}
private:

View File

@ -3271,7 +3271,7 @@ namespace {
*/
//================================================================================
gp_Vec GetNormal(const TopoDS_Face& face, const BRepExtrema_DistShapeShape& extrema)
gp_Vec GetNormal (const TopoDS_Face& face, const BRepExtrema_DistShapeShape& extrema)
{
gp_Vec defaultNorm(1,0,0); // to have same normals on different faces
try {
@ -3304,12 +3304,35 @@ namespace {
}
return defaultNorm;
}
//================================================================================
/*!
* \brief Return type of shape for explode. In case of compound it will be a type of sub shape.
*/
//================================================================================
TopAbs_ShapeEnum GetTypeOfSimplePart (const TopoDS_Shape& theShape)
{
TopAbs_ShapeEnum aType = theShape.ShapeType();
if (aType == TopAbs_VERTEX) return TopAbs_VERTEX;
else if (aType == TopAbs_EDGE || aType == TopAbs_WIRE) return TopAbs_EDGE;
else if (aType == TopAbs_FACE || aType == TopAbs_SHELL) return TopAbs_FACE;
else if (aType == TopAbs_SOLID || aType == TopAbs_COMPSOLID) return TopAbs_SOLID;
else if (aType == TopAbs_COMPOUND) {
// Only the iType of the first shape in the compound is taken into account
TopoDS_Iterator It (theShape, Standard_False, Standard_False);
if (It.More()) {
return GetTypeOfSimplePart(It.Value());
}
}
return TopAbs_SHAPE;
}
}
//=============================================================================
/*!
case GetInPlace:
default:
* case GetInPlace:
* default:
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) theShapeWhere,
@ -3344,8 +3367,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object)
Handle(GEOM_Object) aResult;
bool isFound = false;
Standard_Integer iType = TopAbs_SOLID;
Standard_Integer compType = TopAbs_SOLID;
TopAbs_ShapeEnum iType = TopAbs_SOLID;
//Standard_Real aWhat_Mass = 0., aWhere_Mass = 0.;
Standard_Real tab_aWhat[4], tab_aWhere[4];
Standard_Real dl_l = 1e-3;
@ -3356,6 +3378,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object)
GProp_GProps aProps;
// Find the iType of the aWhat shape
/*
if ( aWhat.ShapeType() == TopAbs_VERTEX ) iType = TopAbs_VERTEX;
else if ( aWhat.ShapeType() == TopAbs_EDGE || aWhat.ShapeType() == TopAbs_WIRE ) iType = TopAbs_EDGE;
else if ( aWhat.ShapeType() == TopAbs_FACE || aWhat.ShapeType() == TopAbs_SHELL ) iType = TopAbs_FACE;
@ -3367,7 +3390,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object)
SetErrorCode("Error: theShapeWhat is an empty COMPOUND.");
return NULL;
}
compType = It.Value().ShapeType();
TopAbs_ShapeEnum compType = It.Value().ShapeType();
if ( compType == TopAbs_VERTEX ) iType = TopAbs_VERTEX;
else if ( compType == TopAbs_EDGE || compType == TopAbs_WIRE ) iType = TopAbs_EDGE;
else if ( compType == TopAbs_FACE || compType == TopAbs_SHELL) iType = TopAbs_FACE;
@ -3377,10 +3400,16 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object)
SetErrorCode("Error: An attempt to extract a shape of not supported type.");
return NULL;
}
*/
iType = GetTypeOfSimplePart(aWhat);
if (iType == TopAbs_SHAPE) {
SetErrorCode("Error: An attempt to extract a shape of not supported type.");
return NULL;
}
TopExp_Explorer Exp_aWhat( aWhat, TopAbs_ShapeEnum( iType ) );
TopExp_Explorer Exp_aWhere( aWhere, TopAbs_ShapeEnum( iType ) );
TopExp_Explorer Exp_Edge( aWhere, TopAbs_EDGE );
TopExp_Explorer Exp_aWhat ( aWhat, iType );
TopExp_Explorer Exp_aWhere ( aWhere, iType );
TopExp_Explorer Exp_Edge ( aWhere, TopAbs_EDGE );
// Find the shortest edge in theShapeWhere shape
BRepBndLib::Add(aWhere, BoundingBox);

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx>
@ -28,11 +27,6 @@
#include <OpUtil.hxx>
#include <Utils_ExceptHandlers.hxx>
#include <TFunction_DriverTable.hxx>
#include <TFunction_Driver.hxx>
#include <TFunction_Logbook.hxx>
#include <TDF_Tool.hxx>
#include <GEOM_Function.hxx>
#include <GEOM_PythonDump.hxx>
@ -52,6 +46,23 @@
#include <GEOMImpl_Types.hxx>
#include <TFunction_DriverTable.hxx>
#include <TFunction_Driver.hxx>
#include <TFunction_Logbook.hxx>
#include <TDF_Tool.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Trsf.hxx>
#include <StdFail_NotDone.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
@ -560,7 +571,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Obje
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
GEOMImpl_ITranslate aTI(aFunction);
GEOMImpl_ITranslate aTI (aFunction);
aTI.SetVector(theVector->GetLastFunction());
aTI.SetVector2(theVector2->GetLastFunction());
aTI.SetOriginal(aLastFunction);
@ -594,6 +605,148 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Obje
return aCopy;
}
//=============================================================================
/*!
* TranslateShape1D
*/
//=============================================================================
/*
TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape1D (const TopoDS_Shape& theShape,
GEOMImpl_ITranslate* theTI)
{
TopoDS_Shape aRes;
// Vector
Handle(GEOM_Function) aVector = theTI->GetVector();
if (aVector.IsNull()) {
StdFail_NotDone::Raise("Invalid object is given for vector argument");
}
TopoDS_Shape aV = aVector->GetValue();
if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) {
StdFail_NotDone::Raise("Invalid object is given for vector argument");
}
TopoDS_Edge anEdge = TopoDS::Edge(aV);
gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge));
if (aP1.Distance(aP2) < gp::Resolution()) {
StdFail_NotDone::Raise("Invalid object is given for vector argument");
}
// Step and Nb.times
Standard_Real step = theTI->GetStep1();
Standard_Integer nbtimes = theTI->GetNbIter1();
// Make multi-translation
gp_Trsf aTrsf;
gp_Vec aVec;
TopoDS_Compound aCompound;
BRep_Builder B;
B.MakeCompound(aCompound);
gp_Vec Vec (aP1, aP2);
Vec.Normalize();
TopLoc_Location aLocOrig = theShape.Location();
gp_Trsf aTrsfOrig = aLocOrig.Transformation();
for (int i = 0; i < nbtimes; i++) {
aVec = Vec * (i * step);
aTrsf.SetTranslation(aVec);
//NPAL18620: performance problem: multiple locations are accumulated
// in shape and need a great time to process
//BRepBuilderAPI_Transform aTransformation(theShape, aTrsf, Standard_False);
//B.Add(aCompound, aTransformation.Shape());
TopLoc_Location aLocRes (aTrsf * aTrsfOrig);
B.Add(aCompound, theShape.Located(aLocRes));
}
aRes = aCompound;
return aRes;
}
*/
//=============================================================================
/*!
* TranslateShape2D
*/
//=============================================================================
/*
TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape2D (const TopoDS_Shape& theShape,
GEOMImpl_ITranslate* theTI)
{
TopoDS_Shape aRes;
// Vectors
Handle(GEOM_Function) aVector1 = theTI->GetVector();
Handle(GEOM_Function) aVector2 = theTI->GetVector2();
if (aVector1.IsNull() || aVector2.IsNull()) {
StdFail_NotDone::Raise("Invalid object is given for vector argument");
}
TopoDS_Shape aV1 = aVector1->GetValue();
TopoDS_Shape aV2 = aVector2->GetValue();
if (aV1.IsNull() || aV1.ShapeType() != TopAbs_EDGE ||
aV2.IsNull() || aV2.ShapeType() != TopAbs_EDGE) {
StdFail_NotDone::Raise("Invalid object is given for vector argument");
}
TopoDS_Edge anEdge1 = TopoDS::Edge(aV1);
TopoDS_Edge anEdge2 = TopoDS::Edge(aV2);
gp_Pnt aP11 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge1));
gp_Pnt aP12 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge1));
gp_Pnt aP21 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge2));
gp_Pnt aP22 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge2));
if (aP11.Distance(aP12) < gp::Resolution() ||
aP21.Distance(aP22) < gp::Resolution()) {
StdFail_NotDone::Raise("Invalid object is given for vector argument");
}
gp_Vec Vec1 (aP11, aP12);
gp_Vec Vec2 (aP21, aP22);
Vec1.Normalize();
Vec2.Normalize();
// Step and Nb.times
Standard_Real step1 = theTI->GetStep1(), step2 = theTI->GetStep2();
Standard_Integer nbtimes1 = theTI->GetNbIter1(), nbtimes2 = theTI->GetNbIter2();
// Make multi-translation
gp_Trsf aTrsf;
gp_Vec aVec;
Standard_Real DX, DY, DZ;
TopoDS_Compound aCompound;
BRep_Builder B;
B.MakeCompound(aCompound);
TopLoc_Location aLocOrig = theShape.Location();
gp_Trsf aTrsfOrig = aLocOrig.Transformation();
for (int i = 0; i < nbtimes1; i++) {
for (int j = 0; j < nbtimes2; j++) {
DX = i * step1 * Vec1.X() + j * step2 * Vec2.X();
DY = i * step1 * Vec1.Y() + j * step2 * Vec2.Y();
DZ = i * step1 * Vec1.Z() + j * step2 * Vec2.Z();
aVec.SetCoord(DX, DY, DZ);
aTrsf.SetTranslation(aVec);
//NPAL18620: performance problem: multiple locations are accumulated
// in shape and need a great time to process
//BRepBuilderAPI_Transform aBRepTransformation(theShape, aTrsf, Standard_False);
//B.Add(aCompound, aBRepTransformation.Shape());
TopLoc_Location aLocRes (aTrsf * aTrsfOrig);
B.Add(aCompound, theShape.Located(aLocRes));
}
}
aRes = aCompound;
return aRes;
}
*/
//=============================================================================
/*!
@ -1538,7 +1691,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object)
aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
GEOMImpl_IRotate aRI(aFunction);
@ -1750,3 +1903,148 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePointsCopy (Handle
return aCopy;
}
//=============================================================================
/*!
* TransformLikeOtherCopy
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_ITransformOperations::TransformLikeOtherCopy
(Handle(GEOM_Object) theObject,
Handle(GEOM_Object) theSample)
{
SetErrorCode(KO);
if (theObject.IsNull() || theSample.IsNull()) return NULL;
Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
if (aLastFunction.IsNull()) return NULL; // There is no function which creates an object to be transformed
Handle(GEOM_Function) aSampleFunc = theSample->GetLastFunction();
if (aSampleFunc.IsNull()) return NULL; // There is no function which creates a sample object
// Add a new Copy object
Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
// Add a transform function (depends on theSample function)
Handle(GEOM_Function) aFunction =
aCopy->AddFunction(aSampleFunc->GetDriverGUID(), aSampleFunc->GetType());
if (aFunction.IsNull()) return NULL;
// Check if the function is set correctly
if (aFunction->GetDriverGUID() != aSampleFunc->GetDriverGUID()) return NULL;
if (aSampleFunc->GetDriverGUID() == GEOMImpl_TranslateDriver::GetID()) {
switch (aSampleFunc->GetType()) {
case TRANSLATE_1D:
{
GEOMImpl_ITranslate aRI_sample (aSampleFunc);
GEOMImpl_ITranslate aRI_target (aFunction);
aRI_target.SetVector(aRI_sample.GetVector());
aRI_target.SetStep1(aRI_sample.GetStep1());
aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
aRI_target.SetOriginal(aLastFunction);
}
break;
case TRANSLATE_2D:
{
GEOMImpl_ITranslate aRI_sample (aSampleFunc);
GEOMImpl_ITranslate aRI_target (aFunction);
aRI_target.SetVector(aRI_sample.GetVector());
aRI_target.SetStep1(aRI_sample.GetStep1());
aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
aRI_target.SetVector2(aRI_sample.GetVector2());
aRI_target.SetStep2(aRI_sample.GetStep2());
aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
aRI_target.SetOriginal(aLastFunction);
}
break;
default:
{
SetErrorCode("Not implemented case of TransformLikeOtherCopy");
return NULL;
}
}
}
else if (aSampleFunc->GetDriverGUID() == GEOMImpl_RotateDriver::GetID()) {
switch (aSampleFunc->GetType()) {
case ROTATE_1D:
{
GEOMImpl_IRotate aRI_sample (aSampleFunc);
GEOMImpl_IRotate aRI_target (aFunction);
aRI_target.SetAxis(aRI_sample.GetAxis());
aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
aRI_target.SetOriginal(aLastFunction);
}
break;
case ROTATE_2D:
{
GEOMImpl_IRotate aRI_sample (aSampleFunc);
GEOMImpl_IRotate aRI_target (aFunction);
aRI_target.SetAxis(aRI_sample.GetAxis());
aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
aRI_target.SetAngle(aRI_sample.GetAngle());
aRI_target.SetStep(aRI_sample.GetStep());
aRI_target.SetDir2(aRI_sample.GetDir2());
aRI_target.SetOriginal(aLastFunction);
}
break;
case ROTATE_THREE_POINTS_COPY:
{
GEOMImpl_IRotate aRI_sample (aSampleFunc);
GEOMImpl_IRotate aRI_target (aFunction);
aRI_target.SetCentPoint(aRI_sample.GetCentPoint());
aRI_target.SetPoint1(aRI_sample.GetPoint1());
aRI_target.SetPoint2(aRI_sample.GetPoint2());
aRI_target.SetOriginal(aLastFunction);
}
break;
default:
{
SetErrorCode("Not implemented case of TransformLikeOtherCopy");
return NULL;
}
}
}
else {
SetErrorCode("Not implemented case of TransformLikeOtherCopy");
return NULL;
}
// Compute the transformation
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("Driver failed");
return NULL;
}
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode(aFail->GetMessageString());
return NULL;
}
//Make a Python command
//GEOM::TPythonDump(aFunction) << aCopy << " = geompy.TransformLikeOtherCopy("
// << theObject << ", " << theSample << ")";
SetErrorCode(OK);
return aCopy;
}

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _GEOMImpl_ITransformOperations_HXX_
#define _GEOMImpl_ITransformOperations_HXX_
@ -27,7 +26,12 @@
#include "GEOM_IOperations.hxx"
#include "GEOM_Engine.hxx"
#include "GEOM_Object.hxx"
#include <TDocStd_Document.hxx>
#include <TopoDS_Shape.hxx>
class GEOMImpl_ITranslate;
class GEOMImpl_IRotate;
class GEOMImpl_ITransformOperations : public GEOM_IOperations
{
@ -73,6 +77,14 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations
double theStep2,
Standard_Integer theNbTimes2);
/*
Standard_EXPORT static TopoDS_Shape TranslateShape1D (const TopoDS_Shape& theShape,
GEOMImpl_ITranslate* theTI);
Standard_EXPORT static TopoDS_Shape TranslateShape2D (const TopoDS_Shape& theShape,
GEOMImpl_ITranslate* theTI);
*/
Standard_EXPORT Handle(GEOM_Object) MirrorPlane (Handle(GEOM_Object) theObject,
Handle(GEOM_Object) thePlane);
@ -155,6 +167,9 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations
Handle(GEOM_Object) thePoint1,
Handle(GEOM_Object) thePoint2);
Standard_EXPORT Handle(GEOM_Object) TransformLikeOtherCopy (Handle(GEOM_Object) theObject,
Handle(GEOM_Object) theSample);
};
#endif

View File

@ -205,35 +205,45 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const
gp_Ax1 AX1(aP1, D);
gp_Trsf aTrsf1;
gp_Trsf aTrsf2;
gp_Pnt P1;
GProp_GProps System;
if (anOriginal.ShapeType() == TopAbs_VERTEX) {
P1 = BRep_Tool::Pnt(TopoDS::Vertex( anOriginal ));
}
else if ( anOriginal.ShapeType() == TopAbs_EDGE || anOriginal.ShapeType() == TopAbs_WIRE ) {
BRepGProp::LinearProperties(anOriginal, System);
P1 = System.CentreOfMass();
}
else if ( anOriginal.ShapeType() == TopAbs_FACE || anOriginal.ShapeType() == TopAbs_SHELL ) {
BRepGProp::SurfaceProperties(anOriginal, System);
P1 = System.CentreOfMass();
}
else {
BRepGProp::VolumeProperties(anOriginal, System);
P1 = System.CentreOfMass();
gp_XYZ aDir2 = RI.GetDir2(); // can be set by previous execution
if (aDir2.Modulus() < gp::Resolution()) {
// Calculate direction as vector from the axis to the shape's center
gp_Pnt P1;
GProp_GProps System;
if (anOriginal.ShapeType() == TopAbs_VERTEX) {
P1 = BRep_Tool::Pnt(TopoDS::Vertex( anOriginal ));
}
else if ( anOriginal.ShapeType() == TopAbs_EDGE || anOriginal.ShapeType() == TopAbs_WIRE ) {
BRepGProp::LinearProperties(anOriginal, System);
P1 = System.CentreOfMass();
}
else if ( anOriginal.ShapeType() == TopAbs_FACE || anOriginal.ShapeType() == TopAbs_SHELL ) {
BRepGProp::SurfaceProperties(anOriginal, System);
P1 = System.CentreOfMass();
}
else {
BRepGProp::VolumeProperties(anOriginal, System);
P1 = System.CentreOfMass();
}
Handle(Geom_Line) Line = new Geom_Line(AX1);
GeomAPI_ProjectPointOnCurve aPrjTool( P1, Line );
gp_Pnt P2 = aPrjTool.NearestPoint();
if ( P1.IsEqual(P2, Precision::Confusion() ) ) return 0;
aDir2 = gp_XYZ(P1.X()-P2.X(), P1.Y()-P2.Y(), P1.Z()-P2.Z());
// Attention: this abnormal action is done for good working of
// TransformLikeOther(), used by RestoreSubShapes functionality
RI.SetDir2(aDir2);
}
Handle(Geom_Line) Line = new Geom_Line(AX1);
GeomAPI_ProjectPointOnCurve aPrjTool( P1, Line );
gp_Pnt P2 = aPrjTool.NearestPoint();
if ( P1.IsEqual(P2, Precision::Confusion() ) ) return 0;
gp_Vec Vec (P1.X()-P2.X(), P1.Y()-P2.Y(), P1.Z()-P2.Z());
gp_Vec Vec (aDir2);
Vec.Normalize();
Standard_Integer nbtimes2 = RI.GetNbIter2();

View File

@ -18,12 +18,12 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx>
#include <GEOMImpl_TranslateDriver.hxx>
#include <GEOMImpl_ITranslate.hxx>
#include <GEOMImpl_ITransformOperations.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
@ -79,7 +79,7 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const
if (aFunction.IsNull()) return 0;
GEOMImpl_ITranslate TI(aFunction);
GEOMImpl_ITranslate TI (aFunction);
gp_Trsf aTrsf;
gp_Pnt aP1, aP2;
Standard_Integer aType = aFunction->GetType();
@ -197,6 +197,7 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const
B.Add(aCompound, anOriginal.Located(aLocRes));
}
aShape = aCompound;
//aShape = GEOMImpl_ITransformOperations::TranslateShape1D(anOriginal, &TI);
}
else if (aType == TRANSLATE_2D) {
Standard_Integer nbtimes1 = TI.GetNbIter1(), nbtimes2 = TI.GetNbIter2();
@ -242,7 +243,8 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const
B.Add(aCompound, anOriginal.Located(aLocRes));
}
}
aShape = aCompound;
aShape = aCompound;
//aShape = GEOMImpl_ITransformOperations::TranslateShape2D(anOriginal, &TI);
}
else return 0;

View File

@ -966,8 +966,9 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy,
}
else {
// Get interface, containing method, which we will use to reconstruct sub-shapes
GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
GEOM::GEOM_ITransformOperations_var aTrsfOp = GetITransformOperations(theStudy->StudyId());
// Reconstruct arguments and tree of sub-shapes of the arguments
CORBA::String_var anIOR;
@ -996,6 +997,64 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy,
aSubO = aShapesOp->GetInPlace(theObject, anArgO);
}
break;
case GEOM::FSM_MultiTransformed:
{
// Only for Multi-transformations
GEOM::GEOM_Object_var anArgOTrsf = aTrsfOp->TransformLikeOtherCopy(anArgO, theObject);
if (!CORBA::is_nil(anArgOTrsf)) {
CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
Handle(GEOM_Object) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
anArgOTrsfFun->SetDescription("");
aSubO = aShapesOp->GetInPlace(theObject, anArgOTrsf);
}
/*
Handle(GEOM_Function) anOFun = theObject->GetLastFunction();
if (!anOFun.IsNull()) {
CORBA::String_var entryArg = anArgO->GetEntry();
Handle(GEOM_Object) anArgOImpl = _impl->GetObject(anArgO->GetStudyID(), entryArg);
if (!anArgOImpl.IsNull()) {
TopoDS_Shape anArgOShape = anArgOImpl->GetValue();
TopoDS_Shape aMultiArgShape;
//GEOM::GEOM_Object_var anArgOMulti; // ???
switch (anOFun->GetType()) {
case TRANSLATE_1D:
{
GEOMImpl_ITranslate aTI (anOFun);
aMultiArgShape = GEOMImpl_ITransformOperations::TranslateShape1D(anArgOShape, &aTI);
//anArgOMulti = aTrsfOp->Translate1D(anArgO, , , );
}
break;
case TRANSLATE_2D:
{
GEOMImpl_ITranslate aTI (anOFun);
aMultiArgShape = GEOMImpl_ITransformOperations::TranslateShape2D(anArgOShape, &aTI);
}
break;
case ROTATE_1D:
{
GEOMImpl_IRotate aTI (anOFun);
//aMultiArgShape = GEOMImpl_ITransformOperations::TranslateShape2D(anArgOShape, &aTI);
}
break;
case ROTATE_2D:
{
GEOMImpl_IRotate aTI (anOFun);
//aMultiArgShape = GEOMImpl_ITransformOperations::TranslateShape2D(anArgOShape, &aTI);
}
break;
default:
{}
}
GEOM::GEOM_Object_var anArgOMulti = (aMultiArgShape); // TODO
Handle(GEOM_Function) anArgOMultiFun = anArgOMulti->GetLastFunction();
anArgOMultiFun->SetDescription("");
aSubO = aShapesOp->GetInPlace(theObject, anArgOMulti);
}
}
*/
}
break;
case GEOM::FSM_Transformed:
{
// transformation, cannot use GetInPlace, operate with indices
@ -1183,6 +1242,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy,
switch (theFindMethod) {
case GEOM::FSM_GetInPlace:
pd << "FSM_GetInPlace"; break;
case GEOM::FSM_MultiTransformed:
pd << "FSM_MultiTransformed"; break;
case GEOM::FSM_Transformed:
pd << "FSM_Transformed"; break;
case GEOM::FSM_GetSame:
@ -1221,8 +1282,9 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr th
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
// Get interface, containing method, which we will use to reconstruct sub-shapes
GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
GEOM::GEOM_ITransformOperations_var aTrsfOp = GetITransformOperations(theStudy->StudyId());
// Reconstruct published sub-shapes
SALOMEDS::ChildIterator_var it = theStudy->NewChildIterator(theOldSO);
@ -1253,6 +1315,19 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr th
aNewSubO = aShapesOp->GetInPlace(theNewO, anOldSubO);
}
break;
case GEOM::FSM_MultiTransformed:
{
// Only for Multi-transformations
GEOM::GEOM_Object_var anArgOTrsf = aTrsfOp->TransformLikeOtherCopy(anOldSubO, theNewO);
if (!CORBA::is_nil(anArgOTrsf)) {
CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
Handle(GEOM_Object) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
anArgOTrsfFun->SetDescription("");
aNewSubO = aShapesOp->GetInPlace(theNewO, anArgOTrsf);
}
}
break;
case GEOM::FSM_Transformed:
{
// transformation, cannot use GetInPlace, operate with indices
@ -1482,8 +1557,9 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(SALOMEDS::Study_ptr theStu
}
else {
// Get interface, containing method, which we will use to reconstruct sub-shapes
GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
GEOM::GEOM_ITransformOperations_var aTrsfOp = GetITransformOperations(theStudy->StudyId());
// Reconstruct arguments and tree of sub-shapes of the arguments
CORBA::String_var anIOR;
@ -1512,6 +1588,19 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(SALOMEDS::Study_ptr theStu
aSubO = aShapesOp->GetInPlace(theObject, anArgO);
}
break;
case GEOM::FSM_MultiTransformed:
{
// Only for Multi-transformations
GEOM::GEOM_Object_var anArgOTrsf = aTrsfOp->TransformLikeOtherCopy(anArgO, theObject);
if (!CORBA::is_nil(anArgOTrsf)) {
CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
Handle(GEOM_Object) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
anArgOTrsfFun->SetDescription("");
aSubO = aShapesOp->GetInPlace(theObject, anArgOTrsf);
}
}
break;
case GEOM::FSM_Transformed:
{
// transformation, cannot use GetInPlace, operate with indices
@ -1691,6 +1780,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(SALOMEDS::Study_ptr theStu
switch (theFindMethod) {
case GEOM::FSM_GetInPlace:
pd << "FSM_GetInPlace"; break;
case GEOM::FSM_MultiTransformed:
pd << "FSM_MultiTransformed"; break;
case GEOM::FSM_Transformed:
pd << "FSM_Transformed"; break;
case GEOM::FSM_GetSame:
@ -1729,8 +1820,9 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::Study_ptr
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
// Get interface, containing method, which we will use to reconstruct sub-shapes
GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
GEOM::GEOM_ITransformOperations_var aTrsfOp = GetITransformOperations(theStudy->StudyId());
// Reconstruct published sub-shapes
SALOMEDS::ChildIterator_var it = theStudy->NewChildIterator(theOldSO);
@ -1769,6 +1861,19 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::Study_ptr
aNewSubO = aShapesOp->GetInPlace(theNewO, anOldSubO);
}
break;
case GEOM::FSM_MultiTransformed:
{
// Only for Multi-transformations
GEOM::GEOM_Object_var anArgOTrsf = aTrsfOp->TransformLikeOtherCopy(anOldSubO, theNewO);
if (!CORBA::is_nil(anArgOTrsf)) {
CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
Handle(GEOM_Object) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
anArgOTrsfFun->SetDescription("");
aNewSubO = aShapesOp->GetInPlace(theNewO, anArgOTrsf);
}
}
break;
case GEOM::FSM_Transformed:
{
// transformation, cannot use GetInPlace, operate with indices

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx>
@ -1130,6 +1129,37 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePointsCopy
return GetObject(anObject);
}
//=============================================================================
/*!
* TransformLikeOtherCopy
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TransformLikeOtherCopy
(GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theSample)
{
GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag
GetOperations()->SetNotDone();
//Get the object itself
Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
if (anObject.IsNull()) return aGEOMObject._retn();
//Get the sample object
Handle(GEOM_Object) aSample = GetObjectImpl(theSample);
if (aSample.IsNull()) return aGEOMObject._retn();
//Perform the transformation
Handle(GEOM_Object) aResObject =
GetOperations()->TransformLikeOtherCopy(anObject, aSample);
if (!GetOperations()->IsDone() || aResObject.IsNull())
return aGEOMObject._retn();
return GetObject(aResObject);
}
//=============================================================================
/*!
* RecomputeObject

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _GEOM_ITransformOperations_i_HeaderFile
#define _GEOM_ITransformOperations_i_HeaderFile
@ -51,10 +50,12 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i :
GEOM::GEOM_Object_ptr thePoint1,
GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject, CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ);
GEOM::GEOM_Object_ptr TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject,
CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ);
GEOM::GEOM_Object_ptr TranslateDXDYDZCopy (GEOM::GEOM_Object_ptr theObject, CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ);
GEOM::GEOM_Object_ptr TranslateDXDYDZCopy (GEOM::GEOM_Object_ptr theObject,
CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ);
GEOM::GEOM_Object_ptr TranslateVector (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theVector);
@ -67,10 +68,15 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i :
CORBA::Double theDistance,
CORBA::Boolean theCopy);
GEOM::GEOM_Object_ptr MultiTranslate1D (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theVector, CORBA::Double theStep, CORBA::Long theNbTimes);
GEOM::GEOM_Object_ptr MultiTranslate1D (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theVector,
CORBA::Double theStep, CORBA::Long theNbTimes);
GEOM::GEOM_Object_ptr MultiTranslate2D (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theVector1, CORBA::Double theStep1, CORBA::Long theNbTimes1,
GEOM::GEOM_Object_ptr theVector2, CORBA::Double theStep2, CORBA::Long theNbTimes2);
GEOM::GEOM_Object_ptr MultiTranslate2D (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theVector1,
CORBA::Double theStep1, CORBA::Long theNbTimes1,
GEOM::GEOM_Object_ptr theVector2,
CORBA::Double theStep2, CORBA::Long theNbTimes2);
GEOM::GEOM_Object_ptr Rotate (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theAxis,
@ -159,6 +165,9 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i :
GEOM::GEOM_Object_ptr thePoint1,
GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr TransformLikeOtherCopy (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theSample);
GEOM::GEOM_Object_ptr RecomputeObject (GEOM::GEOM_Object_ptr theObject);

View File

@ -141,7 +141,7 @@ GEOM::shape_type GEOM_Object_i::GetTopologyType()
return (GEOM::shape_type)shape.ShapeType();
}
static GEOM::shape_type getMinShapeType( const TopoDS_Shape& shape )
static GEOM::shape_type getMinMaxShapeType( const TopoDS_Shape& shape, bool ismin )
{
if ( shape.IsNull() )
return GEOM::SHAPE;
@ -153,8 +153,11 @@ static GEOM::shape_type getMinShapeType( const TopoDS_Shape& shape )
for (; it.More(); it.Next()) {
TopoDS_Shape sub_shape = it.Value();
if ( sub_shape.IsNull() ) continue;
GEOM::shape_type stype = (GEOM::shape_type)sub_shape.ShapeType();
if ( stype != GEOM::SHAPE && stype > ret )
GEOM::shape_type stype = (GEOM::shape_type)getMinMaxShapeType( sub_shape, ismin );
if ( stype == GEOM::SHAPE ) continue;
if ( ismin && stype > ret )
ret = stype;
else if ( !ismin && ( ret < GEOM::SOLID || stype < ret ) )
ret = stype;
}
}
@ -169,7 +172,17 @@ static GEOM::shape_type getMinShapeType( const TopoDS_Shape& shape )
//=============================================================================
GEOM::shape_type GEOM_Object_i::GetMinShapeType()
{
return getMinShapeType( _impl->GetValue() );
return getMinMaxShapeType( _impl->GetValue(), true );
}
//=============================================================================
/*!
* GetMaxShapeType
*/
//=============================================================================
GEOM::shape_type GEOM_Object_i::GetMaxShapeType()
{
return getMinMaxShapeType( _impl->GetValue(), false );
}
//=============================================================================

View File

@ -55,6 +55,8 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public
virtual GEOM::shape_type GetMinShapeType();
virtual GEOM::shape_type GetMaxShapeType();
virtual void SetName(const char* theName);
virtual char* GetName();

View File

@ -53,6 +53,17 @@ def TestMeasureOperations (geompy, math):
print "\nBox 10x30x70 description:"
print Descr
####### NbShapes #######
NbSolids = geompy.NbShapes(box, geompy.ShapeType["SOLID"])
print "\nBox 10x30x70 quantity of solids:", NbSolids
####### ShapeInfo #######
BoxInfo = geompy.ShapeInfo(box)
print "\nBox 10x30x70 shapes:"
print BoxInfo
####### BasicProperties #######
Props = geompy.BasicProperties(box)

View File

@ -654,10 +654,10 @@ def TestOtherOperations (geompy, math):
pcyl = geompy.MakeVertex(50, 50, -50)
cyli = geompy.MakeCylinder(pcyl, vz, 40, 100)
fuse = geompy.MakeFuse(sph1, cyli)
fuse = geompy.MakeFuse(fuse, sph2)
sh_1 = geompy.MakeFuse(fuse, sph2)
# As after Fuse we have a compound, we need to obtain a solid from it
shsh = geompy.SubShapeAll(fuse, geompy.ShapeType["SOLID"])
sh_1 = shsh[0]
#shsh = geompy.SubShapeAll(fuse, geompy.ShapeType["SOLID"])
#sh_1 = shsh[0]
geompy.addToStudy(sh_1, "sh_1")
# GetShapesOnShape

View File

@ -2251,6 +2251,21 @@ class geompyDC(GEOM._objref_GEOM_Gen):
anObj = self.GetSubShape(aShape, ListOfIDs)
return anObj
## Extract shapes (main shape or sub-shape) of given type
# @param aShape shape
# @param aType shape type
def ExtractShapes(self, aShape, aType, sorted = False):
ret = []
t = aShape.GetShapeType()._v
if hasattr(aType, "_v"): aType = aType._v
if t == aType:
ret.append(aShape )
elif sorted:
ret = self.SubShapeAllSortedCentres(aShape, aType)
else:
ret = self.SubShapeAll(aShape, aType)
return ret
# end of l4_decompose_d
## @}
@ -2566,8 +2581,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# Example: see GEOM_TestAll.py
if Limit == ShapeType["AUTO"]:
# automatic detection of the most appropriate shape limit type
lim = GEOM.SOLID
for s in ListShapes: lim = max( lim, s.GetMinShapeType() )
lim = GEOM.SHAPE
for s in ListShapes: lim = min( lim, s.GetMaxShapeType() )
Limit = lim._v
pass
anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
@ -2596,8 +2611,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
ListMaterials=[], KeepNonlimitShapes=0):
if Limit == ShapeType["AUTO"]:
# automatic detection of the most appropriate shape limit type
lim = GEOM.SOLID
for s in ListShapes: lim = max( lim, s.GetMinShapeType() )
lim = GEOM.SHAPE
for s in ListShapes: lim = min( lim, s.GetMaxShapeType() )
Limit = lim._v
pass
anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
@ -3425,6 +3440,42 @@ class geompyDC(GEOM._objref_GEOM_Gen):
RaiseIfFailed("WhatIs", self.MeasuOp)
return aDescr
## Obtain quantity of shapes of the given type in \a theShape.
# If \a theShape is of type \a theType, it is also counted.
# @param theShape Shape to be described.
# @return Quantity of shapes of type \a theType in \a theShape.
#
# @ref tui_measurement_tools_page "Example"
def NbShapes (self, theShape, theType):
# Example: see GEOM_TestMeasures.py
listSh = self.SubShapeAllIDs(theShape, theType)
Nb = len(listSh)
if theShape.GetShapeType()._v == theType:
Nb = Nb + 1
pass
return Nb
## Obtain quantity of shapes of each type in \a theShape.
# The \a theShape is also counted.
# @param theShape Shape to be described.
# @return Dictionary of shape types with bound quantities of shapes.
#
# @ref tui_measurement_tools_page "Example"
def ShapeInfo (self, theShape):
# Example: see GEOM_TestMeasures.py
aDict = {}
for typeSh in ShapeType:
if typeSh != "AUTO" and typeSh != "SHAPE":
listSh = self.SubShapeAllIDs(theShape, ShapeType[typeSh])
Nb = len(listSh)
if theShape.GetShapeType()._v == ShapeType[typeSh]:
Nb = Nb + 1
pass
aDict[typeSh] = Nb
pass
pass
return aDict
## Get a point, situated at the centre of mass of theShape.
# @param theShape Shape to define centre of mass of.
# @return New GEOM_Object, containing the created point.
@ -3637,7 +3688,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
#RaiseIfFailed("Import", self.InsertOp)
# recieve name using returned vertex
UnitName = "M"
vertices = self.SubShapeAll(anObj,ShapeType["VERTEX"])
if anObj.GetShapeType() == GEOM.VERTEX:
vertices = [anObj]
else:
vertices = self.SubShapeAll(anObj,ShapeType["VERTEX"])
if len(vertices)>0:
p = self.PointCoordinates(vertices[0])
if abs(p[0]-0.01) < 1.e-6:

View File

@ -33,6 +33,7 @@
#include "GEOM_AISShape.ixx"
#include "SALOME_InteractiveObject.hxx"
#include "GEOM_AISVector.hxx"
// Open CASCADE Includes
#include <AIS_Drawer.hxx>
@ -210,10 +211,14 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
if (isShowVectors())
{
const bool isVector = IsKind(STANDARD_TYPE(GEOM_AISVector));
TopExp_Explorer Exp ( myshape, TopAbs_EDGE );
for ( ; Exp.More(); Exp.Next() ) {
TopoDS_Vertex aV1, aV2;
TopoDS_Edge anEdgeE = TopoDS::Edge(Exp.Current());
if ( !isVector )
// draw curve direction (issue 0021087)
anEdgeE.Orientation( TopAbs_FORWARD );
if ( anEdgeE.IsNull() ) continue;

View File

@ -65,8 +65,11 @@ Execute()
TEdgeSet::Iterator anIter (myEdgeSet);
for (; anIter.More(); anIter.Next()) {
const TopoDS_Edge& anEdge = anIter.Value();
OCC2VTK(anEdge,aPolyData,aPts,myIsVector);
TopoDS_Edge anEdge = anIter.Value();
if ( !myIsVector )
// draw curve direction (issue 0021087)
anEdge.Orientation( TopAbs_FORWARD );
OCC2VTK(anEdge,aPolyData,aPts,myIsVector||myIsVectorMode);
}
}
@ -263,10 +266,10 @@ void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge,
void GEOM_EdgeSource::SetVectorMode (bool theMode)
{
myIsVector = theMode;
myIsVectorMode = theMode;
}
bool GEOM_EdgeSource::GetVectorMode ()
{
return myIsVector;
return !myIsVector && myIsVectorMode;
}

View File

@ -57,7 +57,7 @@ protected:
TEdgeSet myEdgeSet;
// The <myIsVector> flag is common for all edges, because the shape,
// representing a vector, can have only one edge.
bool myIsVector;
bool myIsVector, myIsVectorMode;
void Execute();

View File

@ -129,7 +129,8 @@ void OperationGUI_GetSharedShapesDlg::Init()
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName(getNewObjectName());
//initName(getNewObjectName());
initName(getPrefixByType());
ConstructorsClicked(0);
GroupPoints->PushButton1->click();
@ -181,7 +182,8 @@ bool OperationGUI_GetSharedShapesDlg::ClickOnApply()
if (!onAccept())
return false;
initName(getNewObjectName());
//initName(getNewObjectName());
initName(getPrefixByType());
return true;
}
@ -261,7 +263,8 @@ void OperationGUI_GetSharedShapesDlg::enterEvent(QEvent*)
//=======================================================================
void OperationGUI_GetSharedShapesDlg::ComboTextChanged()
{
initName(getNewObjectName());
//initName(getNewObjectName());
initName(getPrefixByType());
}
//=================================================================================
@ -319,6 +322,9 @@ bool OperationGUI_GetSharedShapesDlg::execute (ObjectList& objects)
if (!aList->length())
return false;
if (aList->length() > 1)
myMainFrame->ResultName->setText(getPrefixByType());
for (int i = 0, n = aList->length(); i < n; i++)
objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
@ -339,24 +345,24 @@ GEOM::GEOM_Object_ptr OperationGUI_GetSharedShapesDlg::getFather (GEOM::GEOM_Obj
}
//================================================================
// Function : getNewObjectName
// Function : getPrefixByType
// Purpose :
//================================================================
QString OperationGUI_GetSharedShapesDlg::getNewObjectName() const
QString OperationGUI_GetSharedShapesDlg::getPrefixByType () const
{
QString aPref;
int aLimit = GroupPoints->ComboBox1->currentIndex();
//QString aName = tr("GEOM_SHARED_SHAPE");
QString aName;
switch (aLimit) {
case 0: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SOLID")) ; break;
case 1: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SHELL")) ; break;
case 2: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_FACE")) ; break;
case 3: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_WIRE")) ; break;
case 4: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_EDGE")) ; break;
case 5: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_VERTEX")); break;
default: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SHAPE")) ;
case 0: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SOLID")) ; break;
case 1: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SHELL")) ; break;
case 2: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_FACE")) ; break;
case 3: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_WIRE")) ; break;
case 4: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_EDGE")) ; break;
case 5: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_VERTEX")); break;
default: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SHAPE")) ;
}
return aName;
return aPref;
}

View File

@ -48,7 +48,7 @@ protected:
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
virtual QString getNewObjectName() const;
QString getPrefixByType() const;
private:
void Init();

View File

@ -293,9 +293,9 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true);
//myListMaterials.length( 0 ); // obsolete
GEOM::shape_type type = GEOM::SOLID;
GEOM::shape_type type = GEOM::SHAPE;
for (int i = 0; i < myListShapes.length(); i++)
type = qMax( type, myListShapes[i]->GetMinShapeType() );
type = qMin( type, myListShapes[i]->GetMaxShapeType() );
int idx = qMax( 0, GroupPoints->ComboBox1->findData( type ) );
GroupPoints->ComboBox1->setCurrentIndex( idx );

View File

@ -19,11 +19,10 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component
// File : TransformationGUI_MultiRotationDlg.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
// GEOM GEOMGUI : GUI for Geometry component
// File : TransformationGUI_MultiRotationDlg.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
//
#include "TransformationGUI_MultiRotationDlg.h"
#include <DlgRef.h>
@ -196,7 +195,7 @@ void TransformationGUI_MultiRotationDlg::Init()
void TransformationGUI_MultiRotationDlg::SetDoubleSpinBoxStep (double step)
{
GroupDimensions->SpinBox_DX2->setSingleStep(step);
// san: Commented so as not to override specific step settings
//GroupPoints->SpinBox_DX->setSingleStep((int)step);
//GroupDimensions->SpinBox_DX1->setSingleStep(step);
@ -549,11 +548,11 @@ bool TransformationGUI_MultiRotationDlg::isValid (QString& msg)
case 0:
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
break;
case 1:
case 1:
ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok;
break;
}
return !(myBase->_is_nil() || myVector->_is_nil()) && ok;
@ -638,7 +637,7 @@ void TransformationGUI_MultiRotationDlg::restoreSubShapes (SALOMEDS::Study_ptr
anArgs->length(1);
anArgs[0] = myBase;
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
/*theFindMethod=*/GEOM::FSM_Transformed,
/*theFindMethod=*/GEOM::FSM_MultiTransformed,
/*theInheritFirstArg=*/true,
mainFrame()->CheckBoxAddPrefix->isChecked());
}

View File

@ -19,11 +19,10 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component
// File : TransformationGUI_MultiTranslationDlg.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
// GEOM GEOMGUI : GUI for Geometry component
// File : TransformationGUI_MultiTranslationDlg.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
//
#include "TransformationGUI_MultiTranslationDlg.h"
#include <DlgRef.h>
@ -197,13 +196,13 @@ void TransformationGUI_MultiTranslationDlg::Init()
connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged(const QString& )),
connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged(const QString& )),
this, SLOT(TextValueChangedInSpinBox(const QString& )));
connect(GroupDimensions->SpinBox_DX1, SIGNAL(textChanged(const QString& )),
connect(GroupDimensions->SpinBox_DX1, SIGNAL(textChanged(const QString& )),
this, SLOT(TextValueChangedInSpinBox(const QString& )));
connect(GroupDimensions->SpinBox_DX2, SIGNAL(textChanged(const QString& )),
connect(GroupDimensions->SpinBox_DX2, SIGNAL(textChanged(const QString& )),
this, SLOT(TextValueChangedInSpinBox(const QString& )));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
@ -222,9 +221,9 @@ void TransformationGUI_MultiTranslationDlg::Init()
void TransformationGUI_MultiTranslationDlg::SetDoubleSpinBoxStep (double step)
{
GroupPoints->SpinBox_DX->setSingleStep(step);
GroupDimensions->SpinBox_DX1->setSingleStep(step);
GroupDimensions->SpinBox_DX1->setSingleStep(step);
GroupDimensions->SpinBox_DX2->setSingleStep(step);
// san : Commented so as not to override specific step settings
//GroupPoints->SpinBox_DY->setSingleStep((int)step);
//GroupDimensions->SpinBox_DY1->setSingleStep((int)step);
@ -536,25 +535,25 @@ void TransformationGUI_MultiTranslationDlg::TextValueChangedInSpinBox( const QSt
{
QObject* send = (QObject*)sender();
bool isDigit = true;
switch (getConstructorId()) {
case 0:
case 0:
GroupPoints->SpinBox_DX->text().toDouble(&isDigit);
if(!isDigit){
GroupPoints->CheckButton1->setChecked(false);
}
GroupPoints->CheckButton1->setEnabled(isDigit);
break;
case 1:
case 1:
if (send == GroupDimensions->SpinBox_DX1) {
GroupDimensions->SpinBox_DX1->text().toDouble(&isDigit);
if(!isDigit)
if(!isDigit)
GroupDimensions->CheckButton1->setChecked(false);
GroupDimensions->CheckButton1->setEnabled(isDigit);
}
else if(send == GroupDimensions->SpinBox_DX2){
GroupDimensions->SpinBox_DX2->text().toDouble(&isDigit);
if(!isDigit)
if(!isDigit)
GroupDimensions->CheckButton2->setChecked(false);
GroupDimensions->CheckButton2->setEnabled(isDigit);
}
@ -655,7 +654,7 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio
bool TransformationGUI_MultiTranslationDlg::isValid (QString& msg)
{
int aConstructorId = getConstructorId();
if (aConstructorId == 0) {
bool ok = true;
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
@ -762,7 +761,7 @@ void TransformationGUI_MultiTranslationDlg::restoreSubShapes (SALOMEDS::Study_pt
anArgs->length(1);
anArgs[0] = myBase;
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
/*theFindMethod=*/GEOM::FSM_Transformed,
/*theFindMethod=*/GEOM::FSM_MultiTransformed,
/*theInheritFirstArg=*/true,
mainFrame()->CheckBoxAddPrefix->isChecked());
}
@ -784,7 +783,7 @@ void TransformationGUI_MultiTranslationDlg::createPathPreview ( GEOM::GEOM_Objec
TopoDS_Shape aVector = BRepBuilderAPI_MakeEdge(BRep_Tool::Pnt(aFirst), BRep_Tool::Pnt(aLast)).Shape();
const char* aName = "tmpVector";
Handle(GEOM_AISVector) anIO = new GEOM_AISVector( aVector, aName );
// add Prs to preview
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));