mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-27 14:50:33 +05:00
rnc : Finished a first demo prototype
A textured shape can now be selected in the FeatureDetection dialog and the associated texture is used to detect contours and corners.
This commit is contained in:
parent
775f0ac393
commit
28bd174c0d
@ -293,6 +293,7 @@
|
|||||||
<submenu label-id="Display Mode" item-id="803" pos-id="6">
|
<submenu label-id="Display Mode" item-id="803" pos-id="6">
|
||||||
<popup-item item-id="80311" pos-id="" label-id="Wireframe" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
<popup-item item-id="80311" pos-id="" label-id="Wireframe" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||||
<popup-item item-id="80312" pos-id="" label-id="Shading" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
<popup-item item-id="80312" pos-id="" label-id="Shading" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||||
|
<popup-item item-id="80312" pos-id="" label-id="Texture" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||||
</submenu>
|
</submenu>
|
||||||
<endsubmenu />
|
<endsubmenu />
|
||||||
<popup-item item-id="8032" pos-id="" label-id="Color" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
<popup-item item-id="8032" pos-id="" label-id="Color" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
#include <OCCViewer_FeatureDetector.h>
|
#include <OCCViewer_FeatureDetector.h>
|
||||||
#include <OCCViewer_ViewManager.h>
|
#include <OCCViewer_ViewManager.h>
|
||||||
|
|
||||||
|
#include <SOCC_ViewModel.h>
|
||||||
|
|
||||||
#include <DlgRef.h>
|
#include <DlgRef.h>
|
||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
#include <EntityGUI.h>
|
#include <EntityGUI.h>
|
||||||
@ -46,6 +48,8 @@
|
|||||||
#include <LightApp_Application.h>
|
#include <LightApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
|
#include <SALOME_ListIteratorOfListIO.hxx>
|
||||||
|
|
||||||
#include <SalomeApp_Study.h>
|
#include <SalomeApp_Study.h>
|
||||||
|
|
||||||
#include <utilities.h>
|
#include <utilities.h>
|
||||||
@ -357,6 +361,12 @@ void EntityGUI_FeatureDetectorDlg::SelectionIntoArgument()
|
|||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
SALOME_ListIO aSelList;
|
SALOME_ListIO aSelList;
|
||||||
aSelMgr->selectedObjects(aSelList);
|
aSelMgr->selectedObjects(aSelList);
|
||||||
|
SALOME_ListIteratorOfListIO anIt( aSelList );
|
||||||
|
for( ; anIt.More(); anIt.Next() )
|
||||||
|
if( !anIt.Value().IsNull() )
|
||||||
|
{
|
||||||
|
myFaceEntry = anIt.Value()->getEntry();
|
||||||
|
}
|
||||||
|
|
||||||
if (aSelList.Extent() != 1) {
|
if (aSelList.Extent() != 1) {
|
||||||
if (myEditCurrentArgument == myLineEdit)
|
if (myEditCurrentArgument == myLineEdit)
|
||||||
@ -558,7 +568,27 @@ bool EntityGUI_FeatureDetectorDlg::execute( ObjectList& objects )
|
|||||||
bool res = false;
|
bool res = false;
|
||||||
SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow();
|
SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow();
|
||||||
OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
|
OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
|
||||||
QString theImgFileName = vp->backgroundImageFilename();
|
// QString theImgFileName = vp->backgroundImageFilename();
|
||||||
|
|
||||||
|
MESSAGE("myFaceEntry = "<< myFaceEntry.toStdString());
|
||||||
|
std::map< std::string , std::vector<Handle(AIS_InteractiveObject)> >::iterator AISit;
|
||||||
|
SOCC_Viewer* soccViewer = (SOCC_Viewer*)(theViewWindow->getViewManager()->getViewModel());
|
||||||
|
|
||||||
|
MESSAGE("repere1")
|
||||||
|
AISit = soccViewer->entry2aisobjects.find(myFaceEntry.toStdString());
|
||||||
|
if (AISit == soccViewer->entry2aisobjects.end())
|
||||||
|
return res;
|
||||||
|
|
||||||
|
Handle(AIS_InteractiveObject) myAIS = (*AISit).second[0];
|
||||||
|
Handle(GEOM_AISShape) myAISShape;
|
||||||
|
if( myAIS->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) {
|
||||||
|
myAISShape = Handle(GEOM_AISShape)::DownCast( myAIS );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return res;
|
||||||
|
|
||||||
|
QString theImgFileName = QString::fromStdString( myAISShape->TextureFile() );
|
||||||
|
|
||||||
|
|
||||||
if ( theImgFileName.isEmpty() )
|
if ( theImgFileName.isEmpty() )
|
||||||
return res;
|
return res;
|
||||||
@ -637,9 +667,9 @@ bool EntityGUI_FeatureDetectorDlg::execute( ObjectList& objects )
|
|||||||
// double z = aCornerPnt.Z();
|
// double z = aCornerPnt.Z();
|
||||||
|
|
||||||
// When using the new way with textures on shapes we just have to do the following
|
// When using the new way with textures on shapes we just have to do the following
|
||||||
double x = corners[i].x;
|
double x = -0.5*width + corners[i].x;
|
||||||
double y = height - corners[i].y;
|
double y = 0.5*height - corners[i].y;
|
||||||
double z = 0;
|
double z = 0;
|
||||||
|
|
||||||
aGeomCorner = aBasicOperations->MakePointXYZ( x,y,z );
|
aGeomCorner = aBasicOperations->MakePointXYZ( x,y,z );
|
||||||
|
|
||||||
@ -708,8 +738,8 @@ bool EntityGUI_FeatureDetectorDlg::execute( ObjectList& objects )
|
|||||||
// if (pnt_it.second == true)
|
// if (pnt_it.second == true)
|
||||||
// {
|
// {
|
||||||
// MESSAGE("point absent du contour insere")
|
// MESSAGE("point absent du contour insere")
|
||||||
double x = it->x;
|
double x = -0.5*width + it->x;
|
||||||
double y = height - it->y;
|
double y = 0.5 *height - it->y;
|
||||||
double z = 0;
|
double z = 0;
|
||||||
aGeomContourPnt = aBasicOperations->MakePointXYZ( x,y,z );
|
aGeomContourPnt = aBasicOperations->MakePointXYZ( x,y,z );
|
||||||
geomContourPnts[j] = aGeomContourPnt;
|
geomContourPnts[j] = aGeomContourPnt;
|
||||||
|
@ -71,6 +71,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
GEOM::GeomObjPtr myFace;
|
GEOM::GeomObjPtr myFace;
|
||||||
|
QString myFaceEntry;
|
||||||
|
|
||||||
int myConstructorId;
|
int myConstructorId;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user