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:
gdd 2011-10-07 09:56:54 +00:00
parent 775f0ac393
commit 28bd174c0d
3 changed files with 38 additions and 6 deletions

View File

@ -293,6 +293,7 @@
<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="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>
<endsubmenu />
<popup-item item-id="8032" pos-id="" label-id="Color" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>

View File

@ -32,6 +32,8 @@
#include <OCCViewer_FeatureDetector.h>
#include <OCCViewer_ViewManager.h>
#include <SOCC_ViewModel.h>
#include <DlgRef.h>
#include <GeometryGUI.h>
#include <EntityGUI.h>
@ -46,6 +48,8 @@
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SalomeApp_Study.h>
#include <utilities.h>
@ -357,6 +361,12 @@ void EntityGUI_FeatureDetectorDlg::SelectionIntoArgument()
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO 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 (myEditCurrentArgument == myLineEdit)
@ -558,7 +568,27 @@ bool EntityGUI_FeatureDetectorDlg::execute( ObjectList& objects )
bool res = false;
SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow();
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() )
return res;
@ -637,9 +667,9 @@ bool EntityGUI_FeatureDetectorDlg::execute( ObjectList& objects )
// double z = aCornerPnt.Z();
// When using the new way with textures on shapes we just have to do the following
double x = corners[i].x;
double y = height - corners[i].y;
double z = 0;
double x = -0.5*width + corners[i].x;
double y = 0.5*height - corners[i].y;
double z = 0;
aGeomCorner = aBasicOperations->MakePointXYZ( x,y,z );
@ -708,8 +738,8 @@ bool EntityGUI_FeatureDetectorDlg::execute( ObjectList& objects )
// if (pnt_it.second == true)
// {
// MESSAGE("point absent du contour insere")
double x = it->x;
double y = height - it->y;
double x = -0.5*width + it->x;
double y = 0.5 *height - it->y;
double z = 0;
aGeomContourPnt = aBasicOperations->MakePointXYZ( x,y,z );
geomContourPnts[j] = aGeomContourPnt;

View File

@ -71,6 +71,7 @@ private slots:
private:
GEOM::GeomObjPtr myFace;
QString myFaceEntry;
int myConstructorId;