Adaption of FreeCAD to QuarterWidget

-removes all soqtviewer references
-create a quarter adaptor class which implements missing functionality
-adopts freecad code to make use of SoRenderManager and changed View3DInventorViewer  interface
This commit is contained in:
Stefan Tröger
2014-07-19 15:18:14 +02:00
committed by wmayer
parent e1265c874d
commit 72cab0c002
74 changed files with 1855 additions and 1180 deletions

View File

@@ -5,7 +5,6 @@ include_directories(
${COIN_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${XERCESC_INCLUDE_DIR}
#${ODE_INCLUDE_DIRS}

View File

@@ -11,7 +11,6 @@ include_directories(
${COIN3D_INCLUDE_DIR}
${OCC_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${SOQT_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${XERCESC_INCLUDE_DIR}

View File

@@ -4,7 +4,6 @@ include_directories(
${COIN3D_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${XERCESC_INCLUDE_DIR}
)

View File

@@ -14,7 +14,6 @@ include_directories(
${QT_INCLUDE_DIR}
${OCC_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${XERCESC_INCLUDE_DIR}
)
link_directories(${OCC_LIBRARY_DIR})

View File

@@ -17,7 +17,6 @@ include_directories(
${ZLIB_INCLUDE_DIR}
${OCC_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${XERCESC_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc

View File

@@ -465,7 +465,7 @@ void DefineNodesCallback(void * ud, SoEventCallback * n)
if (clPoly.front() != clPoly.back())
clPoly.push_back(clPoly.front());
SoCamera* cam = view->getCamera();
SoCamera* cam = view->getSoRenderManager()->getCamera();
SbViewVolume vv = cam->getViewVolume();
Gui::ViewVolumeProjection proj(vv);
Base::Polygon2D polygon;

View File

@@ -147,7 +147,7 @@ void TaskCreateNodeSet::DefineNodesCallback(void * ud, SoEventCallback * n)
if (clPoly.front() != clPoly.back())
clPoly.push_back(clPoly.front());
SoCamera* cam = view->getCamera();
SoCamera* cam = view->getSoRenderManager()->getCamera();
SbViewVolume vv = cam->getViewVolume();
Gui::ViewVolumeProjection proj(vv);
Base::Polygon2D polygon;

View File

@@ -11,7 +11,6 @@ include_directories(
${OPENCV2_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${XERCESC_INCLUDE_DIR}
)

View File

@@ -13,7 +13,6 @@ include_directories(
${COIN3D_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${XERCESC_INCLUDE_DIR}
)

View File

@@ -3,14 +3,13 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${Boost_INCLUDE_DIRS}
${COIN3D_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${XERCESC_INCLUDE_DIR}
${XERCESC_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
)
link_directories(${OCC_LIBRARY_DIR})
link_directories(${OCC_LIBRARY_DIR})
set(InspectionGui_LIBS
Inspection
@@ -18,23 +17,23 @@ set(InspectionGui_LIBS
)
qt4_add_resources(Inspection_QRC_SRCS Resources/Inspection.qrc)
set(InspectionGui_MOC_HDRS
set(InspectionGui_MOC_HDRS
VisualInspection.h
)
fc_wrap_cpp(InspectionGui_MOC_SRCS ${InspectionGui_MOC_HDRS})
SOURCE_GROUP("Moc" FILES ${InspectionGui_MOC_SRCS})
set(Dialogs_UIC_SRCS
)
fc_wrap_cpp(InspectionGui_MOC_SRCS ${InspectionGui_MOC_HDRS})
SOURCE_GROUP("Moc" FILES ${InspectionGui_MOC_SRCS})
set(Dialogs_UIC_SRCS
VisualInspection.ui
)
qt4_wrap_ui(Dialogs_UIC_HDRS ${Dialogs_UIC_SRCS})
SET(Dialogs_SRCS
${Dialogs_UIC_HDRS}
)
qt4_wrap_ui(Dialogs_UIC_HDRS ${Dialogs_UIC_SRCS})
SET(Dialogs_SRCS
${Dialogs_UIC_HDRS}
VisualInspection.cpp
VisualInspection.h
)
SOURCE_GROUP("Dialogs" FILES ${Dialogs_SRCS})
)
SOURCE_GROUP("Dialogs" FILES ${Dialogs_SRCS})
SET(InspectionGui_SRCS
${Inspection_QRC_SRCS}
@@ -47,12 +46,12 @@ SET(InspectionGui_SRCS
ViewProviderInspection.cpp
ViewProviderInspection.h
Workbench.cpp
Workbench.h
)
add_library(InspectionGui SHARED ${InspectionGui_SRCS})
target_link_libraries(InspectionGui ${InspectionGui_LIBS})
Workbench.h
)
add_library(InspectionGui SHARED ${InspectionGui_SRCS})
target_link_libraries(InspectionGui ${InspectionGui_LIBS})
fc_target_copy_resource(InspectionGui
${CMAKE_SOURCE_DIR}/src/Mod/Inspection
@@ -60,6 +59,6 @@ fc_target_copy_resource(InspectionGui
InitGui.py)
SET_BIN_DIR(InspectionGui InspectionGui /Mod/Inspection)
SET_PYTHON_PREFIX_SUFFIX(InspectionGui)
INSTALL(TARGETS InspectionGui DESTINATION ${CMAKE_INSTALL_LIBDIR})
SET_PYTHON_PREFIX_SUFFIX(InspectionGui)
INSTALL(TARGETS InspectionGui DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@@ -472,10 +472,10 @@ void ViewProviderInspection::inspectCallback(void * ud, SoEventCallback * n)
}
else {
// the nearest picked point was not part of the view provider
SoRayPickAction action(view->getViewportRegion());
SoRayPickAction action(view->getSoRenderManager()->getViewportRegion());
action.setPickAll(TRUE);
action.setPoint(mbe->getPosition());
action.apply(view->getSceneManager()->getSceneGraph());
action.apply(view->getSoRenderManager()->getSceneGraph());
const SoPickedPointList& pps = action.getPickedPointList();
for (int i=0; i<pps.getLength(); ++i) {

View File

@@ -4,7 +4,6 @@ include_directories(
${COIN3D_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${ZLIB_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${XERCESC_INCLUDE_DIR}
)

View File

@@ -59,6 +59,7 @@
#include <Gui/View3DInventorViewer.h>
using namespace MeshGui;
using namespace Quarter;
PROPERTY_SOURCE(MeshGui::ViewProviderFace, Gui::ViewProviderDocumentObject)
@@ -155,15 +156,15 @@ std::vector<std::string> ViewProviderFace::getDisplayModes(void) const
return modes;
}
SoPickedPoint* ViewProviderFace::getPickedPoint(const SbVec2s& pos, const SoQtViewer* viewer) const
SoPickedPoint* ViewProviderFace::getPickedPoint(const SbVec2s& pos, const Gui::View3DInventorViewer* viewer) const
{
SoSeparator* root = new SoSeparator;
root->ref();
root->addChild(viewer->getHeadlight());
root->addChild(viewer->getCamera());
root->addChild(viewer->getSoRenderManager()->getCamera());
root->addChild(this->pcMeshPick);
SoRayPickAction rp(viewer->getViewportRegion());
SoRayPickAction rp(viewer->getSoRenderManager()->getViewportRegion());
rp.setPoint(pos);
rp.apply(root);
root->unref();
@@ -455,11 +456,11 @@ void MeshFillHole::startEditing(MeshGui::ViewProviderMesh* vp)
myBoundariesRoot->removeAllChildren();
myBoundariesRoot->addChild(viewer->getHeadlight());
myBoundariesRoot->addChild(viewer->getCamera());
myBoundariesRoot->addChild(viewer->getSoRenderManager()->getCamera());
myBoundariesRoot->addChild(myBoundariesGroup);
myBoundaryRoot->removeAllChildren();
myBoundaryRoot->addChild(viewer->getHeadlight());
myBoundaryRoot->addChild(viewer->getCamera());
myBoundaryRoot->addChild(viewer->getSoRenderManager()->getCamera());
createPolygons();
static_cast<SoGroup*>(viewer->getSceneGraph())->addChild(myBridgeRoot);
}
@@ -577,7 +578,7 @@ void MeshFillHole::createPolygons()
}
}
SoNode* MeshFillHole::getPickedPolygon(const SoRayPickAction& action/*SoNode* root, const SbVec2s& pos, const SoQtViewer* viewer*/) const
SoNode* MeshFillHole::getPickedPolygon(const SoRayPickAction& action/*SoNode* root, const SbVec2s& pos*/) const
{
SoPolygon* poly = 0;
const SoPickedPointList & points = action.getPickedPointList();
@@ -632,7 +633,7 @@ void MeshFillHole::fileHoleCallback(void * ud, SoEventCallback * n)
const SoEvent* ev = n->getEvent();
if (ev->getTypeId() == SoLocation2Event::getClassTypeId()) {
n->setHandled();
SoRayPickAction rp(view->getViewportRegion());
SoRayPickAction rp(view->getSoRenderManager()->getViewportRegion());
rp.setPoint(ev->getPosition());
rp.setPickAll(true);
if (self->myNumPoints == 0)
@@ -664,7 +665,7 @@ void MeshFillHole::fileHoleCallback(void * ud, SoEventCallback * n)
else if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::UP) {
if (self->myNumPoints > 1)
return;
SoRayPickAction rp(view->getViewportRegion());
SoRayPickAction rp(view->getSoRenderManager()->getViewportRegion());
rp.setPoint(ev->getPosition());
rp.setPickAll(true);
if (self->myNumPoints == 0)
@@ -707,7 +708,7 @@ void MeshFillHole::fileHoleCallback(void * ud, SoEventCallback * n)
QTimer::singleShot(300, self, SLOT(finishEditing()));
}
}
}
}
}
#include "moc_MeshEditor.cpp"

View File

@@ -31,14 +31,13 @@ class SoCoordinate3;
class SoFaceSet;
class SoEventCallback;
class SoPickedPoint;
class SoQtViewer;
class SoGroup;
class SoSeparator;
class SoRayPickAction;
class SbLine;
class SbVec3f;
namespace Gui { class View3DInventor; }
namespace Gui { class View3DInventor; class View3DInventorViewer;}
namespace Mesh { class MeshObject; }
namespace Mesh { class Feature; }
namespace MeshGui {
@@ -60,7 +59,7 @@ public:
void setDisplayMode(const char* ModeName);
const char* getDefaultDisplayMode() const;
std::vector<std::string> getDisplayModes(void) const;
SoPickedPoint* getPickedPoint(const SbVec2s& pos, const SoQtViewer* viewer) const;
SoPickedPoint* getPickedPoint(const SbVec2s& pos, const Gui::View3DInventorViewer* viewer) const;
ViewProviderMesh* mesh;
std::vector<int> index;

View File

@@ -175,12 +175,11 @@ void MeshSelection::prepareBrushSelection(bool add,SoEventCallbackCB *cb)
brush->setColor(1.0f,0.0f,0.0f);
brush->setLineWidth(3.0f);
viewer->navigationStyle()->startSelection(brush);
SoQtCursor::CustomCursor custom;
custom.dim.setValue(CROSS_WIDTH, CROSS_HEIGHT);
custom.hotspot.setValue(CROSS_HOT_X, CROSS_HOT_Y);
custom.bitmap = cross_bitmap;
custom.mask = cross_mask_bitmap;
viewer->setComponentCursor(SoQtCursor(&custom));
QBitmap cursor = QBitmap::fromData(QSize(CROSS_WIDTH, CROSS_HEIGHT), cross_bitmap);
QBitmap mask = QBitmap::fromData(QSize(CROSS_WIDTH, CROSS_HEIGHT), cross_mask_bitmap);
QCursor custom(cursor, mask, CROSS_HOT_X, CROSS_HOT_Y);
viewer->setComponentCursor(custom);
this->addToSelection = add;
}
}
@@ -396,12 +395,12 @@ void MeshSelection::selectGLCallback(void * ud, SoEventCallback * n)
const MeshCore::MeshKernel& kernel = mesh.getKernel();
// simply get all triangles under the polygon
SoCamera* cam = view->getCamera();
SoCamera* cam = view->getSoRenderManager()->getCamera();
SbViewVolume vv = cam->getViewVolume();
Gui::ViewVolumeProjection proj(vv);
vp->getFacetsFromPolygon(polygon, proj, true, faces);
if (self->onlyVisibleTriangles) {
const SbVec2s& sz = view->getViewportRegion().getWindowSize();
const SbVec2s& sz = view->getSoRenderManager()->getViewportRegion().getWindowSize();
short width,height; sz.getValue(width,height);
std::vector<SbVec2s> pixelPoly = view->getPolygon();
SbBox2s rect;
@@ -411,7 +410,7 @@ void MeshSelection::selectGLCallback(void * ud, SoEventCallback * n)
}
std::vector<unsigned long> rf; rf.swap(faces);
std::vector<unsigned long> vf = vp->getVisibleFacetsAfterZoom
(rect, view->getViewportRegion(), view->getCamera());
(rect, view->getSoRenderManager()->getViewportRegion(), view->getSoRenderManager()->getCamera());
// get common facets of the viewport and the visible one
std::sort(vf.begin(), vf.end());
@@ -441,7 +440,7 @@ void MeshSelection::selectGLCallback(void * ud, SoEventCallback * n)
vp->removeSelection(faces);
}
view->render();
view->redraw();
}
void MeshSelection::pickFaceCallback(void * ud, SoEventCallback * n)

View File

@@ -67,7 +67,7 @@
#include <Gui/SoFCOffscreenRenderer.h>
#include <Gui/SoFCSelection.h>
#include <Gui/SoFCSelectionAction.h>
#include <Gui/SoFCDB.h>
#include <Gui/SoFCDB.h>
#include <Gui/MainWindow.h>
#include <Gui/Selection.h>
#include <Gui/Utilities.h>
@@ -677,7 +677,7 @@ void ViewProviderMesh::clipMeshCallback(void * ud, SoEventCallback * n)
ViewProviderMesh* self = static_cast<ViewProviderMesh*>(*it);
if (self->getEditingMode() > -1) {
self->finishEditing();
SoCamera* cam = view->getCamera();
SoCamera* cam = view->getSoRenderManager()->getCamera();
SbViewVolume vv = cam->getViewVolume();
Gui::ViewVolumeProjection proj(vv);
self->cutMesh(clPoly, proj, clip_inner);
@@ -686,7 +686,7 @@ void ViewProviderMesh::clipMeshCallback(void * ud, SoEventCallback * n)
Gui::Application::Instance->activeDocument()->commitCommand();
view->render();
view->redraw();
}
}
@@ -715,7 +715,7 @@ void ViewProviderMesh::trimMeshCallback(void * ud, SoEventCallback * n)
ViewProviderMesh* self = static_cast<ViewProviderMesh*>(*it);
if (self->getEditingMode() > -1) {
self->finishEditing();
SoCamera* cam = view->getCamera();
SoCamera* cam = view->getSoRenderManager()->getCamera();
SbViewVolume vv = cam->getViewVolume();
Gui::ViewVolumeProjection proj(vv);
self->trimMesh(clPoly, proj, clip_inner);
@@ -724,7 +724,7 @@ void ViewProviderMesh::trimMeshCallback(void * ud, SoEventCallback * n)
Gui::Application::Instance->activeDocument()->commitCommand();
view->render();
view->redraw();
}
}
@@ -750,7 +750,7 @@ void ViewProviderMesh::partMeshCallback(void * ud, SoEventCallback * cb)
SbVec3f b,n;
view->getNearPlane(b, n);
Base::Vector3f cPoint(b[0],b[1],b[2]), cNormal(n[0],n[1],n[2]);
SoCamera* pCam = view->getCamera();
SoCamera* pCam = view->getSoRenderManager()->getCamera();
SbViewVolume vol = pCam->getViewVolume();
// create a tool shape from these points
@@ -782,7 +782,7 @@ void ViewProviderMesh::partMeshCallback(void * ud, SoEventCallback * cb)
// Close the transaction
Gui::Application::Instance->activeDocument()->commitCommand();
view->render();
view->redraw();
}
void ViewProviderMesh::segmMeshCallback(void * ud, SoEventCallback * cb)
@@ -807,7 +807,7 @@ void ViewProviderMesh::segmMeshCallback(void * ud, SoEventCallback * cb)
SbVec3f b,n;
view->getNearPlane(b, n);
Base::Vector3f cPoint(b[0],b[1],b[2]), cNormal(n[0],n[1],n[2]);
SoCamera* pCam = view->getCamera();
SoCamera* pCam = view->getSoRenderManager()->getCamera();
SbViewVolume vol = pCam->getViewVolume();
// create a tool shape from these points
@@ -839,7 +839,7 @@ void ViewProviderMesh::segmMeshCallback(void * ud, SoEventCallback * cb)
// Close the transaction
Gui::Application::Instance->activeDocument()->commitCommand();
view->render();
view->redraw();
}
void ViewProviderMesh::selectGLCallback(void * ud, SoEventCallback * n)
@@ -857,8 +857,8 @@ void ViewProviderMesh::selectGLCallback(void * ud, SoEventCallback * n)
SbVec2f pos = clPoly[0];
float pX,pY; pos.getValue(pX,pY);
const SbVec2s& sz = view->getViewportRegion().getViewportSizePixels();
float fRatio = view->getViewportRegion().getViewportAspectRatio();
const SbVec2s& sz = view->getSoRenderManager()->getViewportRegion().getViewportSizePixels();
float fRatio = view->getSoRenderManager()->getViewportRegion().getViewportAspectRatio();
if (fRatio > 1.0f) {
pX = (pX - 0.5f) / fRatio + 0.5f;
pos.setValue(pX,pY);
@@ -887,11 +887,11 @@ void ViewProviderMesh::selectGLCallback(void * ud, SoEventCallback * n)
ViewProviderMesh* that = static_cast<ViewProviderMesh*>(*it);
if (that->getEditingMode() > -1) {
that->finishEditing();
that->selectArea(x, y, w, h, view->getViewportRegion(), view->getCamera());
that->selectArea(x, y, w, h, view->getSoRenderManager()->getViewportRegion(), view->getSoRenderManager()->getCamera());
}
}
view->render();
view->redraw();
}
void ViewProviderMesh::getFacetsFromPolygon(const std::vector<SbVec2f>& picked,
@@ -1004,8 +1004,8 @@ void ViewProviderMesh::boxZoom(const SbBox2s& box, const SbViewportRegion & vp,
// Get the new center in normalized pixel coordinates
short xmin,xmax,ymin,ymax;
box.getBounds(xmin,ymin,xmax,ymax);
const SbVec2f center((float) ((xmin+xmax)/2) / (float) SoQtMax((int)(size[0] - 1), 1),
(float) (size[1]-(ymin+ymax)/2) / (float) SoQtMax((int)(size[1] - 1), 1));
const SbVec2f center((float) ((xmin+xmax)/2) / (float) std::max((int)(size[0] - 1), 1),
(float) (size[1]-(ymin+ymax)/2) / (float) std::max((int)(size[1] - 1), 1));
SbPlane plane = vv.getPlane(cam->focalDistance.getValue());
panCamera(cam,vp.getViewportAspectRatio(),plane, SbVec2f(0.5,0.5), center);
@@ -1346,7 +1346,7 @@ void ViewProviderMesh::markPartCallback(void * ud, SoEventCallback * n)
for (std::vector<ViewProvider*>::iterator it = views.begin(); it != views.end(); ++it) {
static_cast<ViewProviderMesh*>(*it)->deleteSelection();
}
view->render();
view->redraw();
Gui::Application::Instance->activeDocument()->commitCommand();
}
}

View File

@@ -21,7 +21,6 @@ include_directories(
${COIN3D_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${XERCESC_INCLUDE_DIR}
)

View File

@@ -13,7 +13,6 @@ include_directories(
${COIN3D_INCLUDE_DIR}
${OCC_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${SOQT_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${XERCESC_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}

View File

@@ -88,10 +88,10 @@ namespace PartGui {
}
};
}
class FaceColors::Private
{
public:
class FaceColors::Private
{
public:
typedef boost::signals::connection Connection;
Ui_TaskFaceColors* ui;
Gui::View3DInventorViewer* view;
@@ -102,11 +102,11 @@ public:
QSet<int> index;
Connection connectDelDoc;
Connection connectDelObj;
Private(ViewProviderPartExt* vp) : ui(new Ui_TaskFaceColors()), view(0), vp(vp)
{
obj = vp->getObject();
doc = Gui::Application::Instance->getDocument(obj->getDocument());
{
obj = vp->getObject();
doc = Gui::Application::Instance->getDocument(obj->getDocument());
// build up map edge->face
TopTools_IndexedMapOfShape mapOfShape;
@@ -121,16 +121,16 @@ public:
current.push_back(vp->ShapeColor.getValue());
perface = current;
perface.resize(mapOfShape.Extent(), perface.front());
}
~Private()
{
delete ui;
}
bool isVisibleFace(int faceIndex, const SbVec2f& pos, Gui::View3DInventorViewer* viewer)
{
}
~Private()
{
delete ui;
}
bool isVisibleFace(int faceIndex, const SbVec2f& pos, Gui::View3DInventorViewer* viewer)
{
SoSeparator* root = new SoSeparator;
root->ref();
root->addChild(viewer->getCamera());
root->addChild(viewer->getSoRenderManager()->getCamera());
root->addChild(vp->getRoot());
SoSearchAction searchAction;
@@ -139,7 +139,7 @@ public:
searchAction.apply(root);
SoPath* selectionPath = searchAction.getPath();
SoRayPickAction rp(viewer->getViewportRegion());
SoRayPickAction rp(viewer->getSoRenderManager()->getViewportRegion());
rp.setNormalizedPoint(pos);
rp.apply(selectionPath);
root->unref();
@@ -160,13 +160,13 @@ public:
}
return false;
}
void addFacesToSelection(Gui::View3DInventorViewer* viewer,
const Gui::ViewVolumeProjection& proj,
const Base::Polygon2D& polygon,
const TopoDS_Shape& shape)
{
try {
}
void addFacesToSelection(Gui::View3DInventorViewer* viewer,
const Gui::ViewVolumeProjection& proj,
const Base::Polygon2D& polygon,
const TopoDS_Shape& shape)
{
try {
TopTools_IndexedMapOfShape M;
TopExp_Explorer xp_face(shape,TopAbs_FACE);
@@ -212,19 +212,19 @@ public:
// }
//}
}
}
catch (...) {
}
}
static void selectionCallback(void * ud, SoEventCallback * cb)
{
}
catch (...) {
}
}
static void selectionCallback(void * ud, SoEventCallback * cb)
{
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(cb->getUserData());
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), selectionCallback, ud);
SoNode* root = view->getSceneGraph();
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(TRUE);
std::vector<SbVec2f> picked = view->getGLPolygon();
SoCamera* cam = view->getCamera();
SoCamera* cam = view->getSoRenderManager()->getCamera();
SbViewVolume vv = cam->getViewVolume();
Gui::ViewVolumeProjection proj(vv);
Base::Polygon2D polygon;
@@ -247,10 +247,10 @@ public:
cb->setHandled();
const TopoDS_Shape& shape = static_cast<Part::Feature*>(self->d->obj)->Shape.getValue();
self->d->addFacesToSelection(view, proj, polygon, shape);
view->render();
view->redraw();
}
}
};
}
};
/* TRANSLATOR PartGui::TaskFaceColors */

View File

@@ -13,7 +13,6 @@ include_directories(
${COIN3D_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${XERCESC_INCLUDE_DIR}
)

View File

@@ -8,7 +8,6 @@ include_directories(
${Boost_INCLUDE_DIRS}
${COIN3D_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${SOQT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${XERCESC_INCLUDE_DIR}

View File

@@ -379,7 +379,7 @@ void ViewProviderPoints::clipPointsCallback(void * ud, SoEventCallback * n)
}
}
view->render();
view->getSoRenderManager()->render();
}
void ViewProviderPoints::cut(const std::vector<SbVec2f>& picked, Gui::View3DInventorViewer &Viewer)
@@ -394,7 +394,7 @@ void ViewProviderPoints::cut(const std::vector<SbVec2f>& picked, Gui::View3DInve
Points::Feature* fea = (Points::Feature*)pcObject;
const Points::PointKernel& points = fea->Points.getValue();
SoCamera* pCam = Viewer.getCamera();
SoCamera* pCam = Viewer.getSoRenderManager()->getCamera();
SbViewVolume vol = pCam->getViewVolume();
// search for all points inside/outside the polygon

View File

@@ -14,7 +14,6 @@ include_directories(
${OCC_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${ZLIB_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${XERCESC_INCLUDE_DIR}
)

View File

@@ -12,7 +12,6 @@ include_directories(
${OCC_INCLUDE_DIR}
${COIN3D_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${ZLIB_INCLUDE_DIR}
${XERCESC_INCLUDE_DIR}

View File

@@ -16,7 +16,6 @@ include_directories(
${OCC_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${EIGEN3_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${XERCESC_INCLUDE_DIR}
)

View File

@@ -10,7 +10,6 @@ include_directories(
${COIN3D_INCLUDE_DIR}
${OCC_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${SOQT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${XERCESC_INCLUDE_DIR}

View File

@@ -14,7 +14,6 @@ include_directories(
${COIN3D_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${ZLIB_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${XERCESC_INCLUDE_DIR}
${EIGEN3_INCLUDE_DIR}

View File

@@ -67,7 +67,7 @@ float SoZoomTranslation::getScaleFactor()
Gui::MDIView *mdi = Gui::Application::Instance->activeDocument()->getActiveView();
if (mdi && mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
Gui::View3DInventorViewer *viewer = static_cast<Gui::View3DInventor *>(mdi)->getViewer();
this->scale = viewer->getCamera()->getViewVolume(viewer->getCamera()->aspectRatio.getValue()).getWorldToScreenScale(SbVec3f(0.f, 0.f, 0.f), 0.1f) / 5;
this->scale = viewer->getSoRenderManager()->getCamera()->getViewVolume(viewer->getSoRenderManager()->getCamera()->aspectRatio.getValue()).getWorldToScreenScale(SbVec3f(0.f, 0.f, 0.f), 0.1f) / 5;
return this->scale;
} else {
return this->scale;

View File

@@ -284,10 +284,14 @@ ViewProviderSketch::ViewProviderSketch()
color = hGrp->GetUnsigned("SketchVertexColor", color);
vertexColor.setPackedValue((uint32_t)color);
PointColor.setValue(vertexColor);
//rubberband selection
rubberband = new Gui::Rubberband();
}
ViewProviderSketch::~ViewProviderSketch()
{
delete rubberband;
}
// handler management ***************************************************************
@@ -429,7 +433,7 @@ void ViewProviderSketch::snapToGrid(double &x, double &y)
void ViewProviderSketch::getProjectingLine(const SbVec2s& pnt, const Gui::View3DInventorViewer *viewer, SbLine& line) const
{
const SbViewportRegion& vp = viewer->getViewportRegion();
const SbViewportRegion& vp = viewer->getSoRenderManager()->getViewportRegion();
short x,y; pnt.getValue(x,y);
SbVec2f siz = vp.getViewportSize();
@@ -448,7 +452,7 @@ void ViewProviderSketch::getProjectingLine(const SbVec2s& pnt, const Gui::View3D
pY = (pY - 0.5f*dY) / fRatio + 0.5f*dY;
}
SoCamera* pCam = viewer->getCamera();
SoCamera* pCam = viewer->getSoRenderManager()->getCamera();
if (!pCam) return;
SbViewVolume vol = pCam->getViewVolume();
@@ -741,6 +745,13 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
return true;
case STATUS_SKETCH_UseRubberBand:
doBoxSelection(prvCursorPos, cursorPos, viewer);
rubberband->setWorking(false);
//disable framebuffer drawing in viewer
if(Gui::Application::Instance->activeDocument()->getActiveView()) {
static_cast<Gui::View3DInventor *>(Gui::Application::Instance->activeDocument()->getActiveView())->getViewer()->setRenderFramebuffer(false);
}
// a redraw is required in order to clear the rubberband
draw(true);
Mode = STATUS_NONE;
@@ -1064,27 +1075,17 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
return true;
case STATUS_SKETCH_StartRubberBand: {
Mode = STATUS_SKETCH_UseRubberBand;
rubberband->setWorking(true);
viewer->setRenderFramebuffer(true);
return true;
}
case STATUS_SKETCH_UseRubberBand: {
Gui::GLPainter p;
p.begin(viewer);
p.setColor(1.0, 1.0, 0.0, 0.0);
p.setLogicOp(GL_XOR);
p.setLineWidth(3.0f);
p.setLineStipple(2, 0x3F3F);
// first redraw the old rectangle with XOR to restore the correct colors
p.drawRect(prvCursorPos.getValue()[0],
viewer->getGLWidget()->height() - prvCursorPos.getValue()[1],
newCursorPos.getValue()[0],
viewer->getGLWidget()->height() - newCursorPos.getValue()[1]);
newCursorPos = cursorPos;
// now draw the new rectangle
p.drawRect(prvCursorPos.getValue()[0],
rubberband->setCoords(prvCursorPos.getValue()[0],
viewer->getGLWidget()->height() - prvCursorPos.getValue()[1],
newCursorPos.getValue()[0],
viewer->getGLWidget()->height() - newCursorPos.getValue()[1]);
p.end();
viewer->redraw();
return true;
}
default:
@@ -1241,7 +1242,7 @@ Base::Vector3d ViewProviderSketch::seekConstraintPosition(const Base::Vector3d &
assert(edit);
Gui::MDIView *mdi = Gui::Application::Instance->activeDocument()->getActiveView();
Gui::View3DInventorViewer *viewer = static_cast<Gui::View3DInventor *>(mdi)->getViewer();
SoRayPickAction rp(viewer->getViewportRegion());
SoRayPickAction rp(viewer->getSoRenderManager()->getViewportRegion());
float scaled_step = step * getScaleFactor();
@@ -1739,7 +1740,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
polygon.Add(Base::Vector2D(corners[1].getValue()[0], corners[1].getValue()[1]));
polygon.Add(Base::Vector2D(corners[1].getValue()[0], corners[0].getValue()[1]));
Gui::ViewVolumeProjection proj(viewer->getCamera()->getViewVolume());
Gui::ViewVolumeProjection proj(viewer->getSoRenderManager()->getCamera()->getViewVolume());
Sketcher::SketchObject *sketchObject = getSketchObject();
App::Document *doc = sketchObject->getDocument();
@@ -2644,7 +2645,7 @@ float ViewProviderSketch::getScaleFactor()
Gui::MDIView *mdi = Gui::Application::Instance->activeDocument()->getActiveView();
if (mdi && mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
Gui::View3DInventorViewer *viewer = static_cast<Gui::View3DInventor *>(mdi)->getViewer();
return viewer->getCamera()->getViewVolume(viewer->getCamera()->aspectRatio.getValue()).getWorldToScreenScale(SbVec3f(0.f, 0.f, 0.f), 0.1f) / 3;
return viewer->getSoRenderManager()->getCamera()->getViewVolume(viewer->getSoRenderManager()->getCamera()->aspectRatio.getValue()).getWorldToScreenScale(SbVec3f(0.f, 0.f, 0.f), 0.1f) / 3;
} else {
return 1.f;
}
@@ -3414,8 +3415,8 @@ Restart:
for (std::vector<Part::Geometry *>::iterator it=tempGeo.begin(); it != tempGeo.end(); ++it)
if (*it) delete *it;
if (mdi && mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
static_cast<Gui::View3DInventor *>(mdi)->getViewer()->render();
if (mdi && mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
static_cast<Gui::View3DInventor *>(mdi)->getViewer()->redraw();
}
}
@@ -4032,16 +4033,14 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo
viewer->setEditing(TRUE);
SoNode* root = viewer->getSceneGraph();
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(FALSE);
antiAliasing = (int)viewer->getAntiAliasingMode();
if (antiAliasing != Gui::View3DInventorViewer::None)
viewer->setAntiAliasingMode(Gui::View3DInventorViewer::None);
viewer->addGraphicsItem(rubberband);
rubberband->setViewer(viewer);
}
void ViewProviderSketch::unsetEditViewer(Gui::View3DInventorViewer* viewer)
{
if (antiAliasing != Gui::View3DInventorViewer::None)
viewer->setAntiAliasingMode(Gui::View3DInventorViewer::AntiAliasing(antiAliasing));
viewer->removeGraphicsItem(rubberband);
viewer->setEditing(FALSE);
SoNode* root = viewer->getSceneGraph();
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(TRUE);

View File

@@ -29,6 +29,7 @@
#include <Inventor/SbColor.h>
#include <Base/Tools2D.h>
#include <Gui/Selection.h>
#include <Gui/GLPainter.h>
#include <boost/signals.hpp>
#include <QCoreApplication>
@@ -203,8 +204,7 @@ public:
/// is called when the Provider is in edit and a key event ocours. Only ESC ends edit.
virtual bool keyPressed(bool pressed, int key);
/// is called when the Provider is in edit and the mouse is clicked
virtual bool mouseButtonPressed(int Button, bool pressed, const SbVec2s &pos,
const Gui::View3DInventorViewer *viewer);
virtual bool mouseButtonPressed(int Button, bool pressed, const SbVec2s& cursorPos, const Gui::View3DInventorViewer* viewer);
//@}
friend class DrawSketchHandler;
@@ -371,7 +371,8 @@ protected:
// reference coordinates for relative operations
double xInit,yInit;
bool relative;
int antiAliasing;
Gui::Rubberband* rubberband;
};
} // namespace PartGui

View File

@@ -4,7 +4,6 @@ include_directories(
${COIN3D_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${XERCESC_INCLUDE_DIR}
)

View File

@@ -4,7 +4,6 @@ include_directories(
${COIN3D_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${XERCESC_INCLUDE_DIR}
)