#include <XGUI_Workshop.h>
#include <XGUI_OperationMgr.h>
#include <XGUI_Displayer.h>
-#include <XGUI_ViewerPrs.h>
#include <XGUI_ViewerProxy.h>
-#include <PartSet_OperationSketchLine.h>
-#include <PartSet_Presentation.h>
+#include <PartSet_Tools.h>
+#include <PartSet_OperationSketchBase.h>
+#include <ModuleBase_ViewerPrs.h>
#include <ModelAPI_Feature.h>
#include <SketchPlugin_Line.h>
#include <ModelAPI_Document.h>
static double myTestDelta;
-static boost::shared_ptr<ModelAPI_Feature> myTestFeature;
+static FeaturePtr myTestFeature;
#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
theWorkshop->viewer()->activeView());
PartSet_TestOCC::changeTestLine(theWorkshop);
}
- Handle(AIS_InteractiveObject) anIO = theWorkshop->displayer()->GetAISObject(myTestFeature);
- if (!anIO.IsNull()) {
+ boost::shared_ptr<GeomAPI_AISObject> anIO = theWorkshop->displayer()->getAISObject(myTestFeature);
+ if (!anIO->empty()) {
theWorkshop->viewer()->AISContext()->MoveTo(0, 0, theWorkshop->viewer()->activeView());
theWorkshop->viewer()->AISContext()->Select(0, 0, 2500, 2500, theWorkshop->viewer()->activeView());
}
ModuleBase_Operation* anOperation = theWorkshop->operationMgr()->currentOperation();
PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
- boost::shared_ptr<ModelAPI_Feature> aSketch;
+ FeaturePtr aSketch;
if (aPreviewOp) {
// create a line
boost::shared_ptr<ModelAPI_Document> aDoc = ModelAPI_PluginManager::get()->rootDocument();
- boost::shared_ptr<ModelAPI_Feature> aFeature = aDoc->addFeature(
- PartSet_OperationSketchLine::Type().c_str());
+ FeaturePtr aFeature = aDoc->addFeature(SketchPlugin_Line::ID());
if (aFeature) // TODO: generate an error if feature was not created
aFeature->execute();
boost::dynamic_pointer_cast<SketchPlugin_Feature>(aPreviewOp->sketch());
aSketch->addSub(aFeature);
- PartSet_OperationSketchLine::setLinePoint(aFeature, 100, 100, LINE_ATTR_START);
- PartSet_OperationSketchLine::setLinePoint(aFeature, 150, 300, LINE_ATTR_END);
+ PartSet_Tools::setFeaturePoint(aFeature, 100, 100, SketchPlugin_Line::START_ID());
+ PartSet_Tools::setFeaturePoint(aFeature, 150, 300, SketchPlugin_Line::END_ID());
- boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchLine::preview(aFeature);
+ boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
XGUI_Displayer* aDisplayer = theWorkshop->displayer();
- Handle(AIS_InteractiveObject) anAIS = PartSet_Presentation::createPresentation(
- aFeature, aSketch,
- aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(), NULL);
- if (!anAIS.IsNull())
- aDisplayer->Redisplay(aFeature, anAIS, -1, false);
+ boost::shared_ptr<GeomAPI_AISObject> aPrevAIS;
+ boost::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+ boost::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
+ if (!anAIS->empty())
+ aDisplayer->redisplay(aFeature, anAIS, false);
std::list<int> aModes;
aModes.push_back(TopAbs_VERTEX);
aModes.push_back(TopAbs_EDGE);
- aDisplayer->ActivateInLocalContext(aFeature, aModes, true);
+ aDisplayer->activateInLocalContext(aFeature, aModes, true);
// change the line
/*double aDelta = -200;
for (int i = 0; i < 20; i++) {
aDelta = aDelta - i*2;
- PartSet_OperationSketchLine::setLinePoint(aFeature, 100+aDelta, 200+aDelta, LINE_ATTR_START);
- PartSet_OperationSketchLine::setLinePoint(aFeature, 300+aDelta, 500+aDelta, LINE_ATTR_END);
+ PartSet_Tools::setFeaturePoint(aFeature, 100+aDelta, 200+aDelta, SketchPlugin_Line::START_ID());
+ PartSet_Tools::setFeaturePoint(aFeature, 300+aDelta, 500+aDelta, SketchPlugin_Line::END_ID());
- boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchLine::preview(aFeature);
+ boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
Handle(AIS_InteractiveObject) anAIS = PartSet_Presentation::createPresentation(
aFeature, aSketch,
aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(), NULL);
if (!anAIS.IsNull())
- aDisplayer->Redisplay(aFeature, anAIS, -1, true);
+ aDisplayer->redisplay(aFeature, anAIS, true);
int aVal = 90;
for (int j = 0; j < 10000000; j++)
//aModes.clear();
//aModes.push_back(TopAbs_VERTEX);
//aModes.push_back(TopAbs_EDGE);
- //aDisplayer->ActivateInLocalContext(aFeature, aModes, true);
+ //aDisplayer->activateInLocalContext(aFeature, aModes, true);
myTestFeature = aFeature;
- std::list<XGUI_ViewerPrs> aPrs;
- aPrs.push_back(XGUI_ViewerPrs(myTestFeature, TopoDS_Shape(), NULL));
- aDisplayer->SetSelected(aPrs, true);
+ QFeatureList aFeatureList;
+ aFeatureList.append(myTestFeature);
+ aDisplayer->setSelected(aFeatureList, true);
}
}
// change the line
if (!myTestFeature)
return;
- boost::shared_ptr<ModelAPI_Feature> aFeature = myTestFeature;
+ FeaturePtr aFeature = myTestFeature;
myTestDelta = myTestDelta - 50;
double aDelta = myTestDelta;
- PartSet_OperationSketchLine::setLinePoint(aFeature, -100/*aDelta*/, -100/*aDelta*/, LINE_ATTR_START);
- PartSet_OperationSketchLine::setLinePoint(aFeature, 200/*aDelta*2*/, 200/*aDelta*2*/, LINE_ATTR_END);
- boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchLine::preview(aFeature);
-
- Handle(AIS_InteractiveObject) aPrevAIS;
- boost::shared_ptr<ModelAPI_Feature> aSketch;//NULL
- Handle(AIS_InteractiveObject) anAIS = PartSet_Presentation::createPresentation(
- aFeature, aSketch,
- aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(),
- aPrevAIS);
- if (!anAIS.IsNull())
- theWorkshop->displayer()->Redisplay(aFeature, anAIS, -1, true);
+ PartSet_Tools::setFeaturePoint(aFeature, -100/*aDelta*/, -100/*aDelta*/, SketchPlugin_Line::START_ID());
+ PartSet_Tools::setFeaturePoint(aFeature, 200/*aDelta*2*/, 200/*aDelta*2*/, SketchPlugin_Line::END_ID());
+ boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
+
+ boost::shared_ptr<GeomAPI_AISObject> aPrevAIS;
+ boost::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+ boost::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
+ if (!anAIS->empty())
+ theWorkshop->displayer()->redisplay(aFeature, anAIS, true);
//std::list<int> aModes;
//aModes.clear();
//aModes.push_back(TopAbs_VERTEX);
//aModes.push_back(TopAbs_EDGE);
- //aDisplayer->ActivateInLocalContext(aFeature, aModes, true);
+ //aDisplayer->activateInLocalContext(aFeature, aModes, true);
- /*std::list<XGUI_ViewerPrs> aPrs;
- aPrs.push_back(XGUI_ViewerPrs(myTestFeature, TopoDS_Shape()));
- theWorkshop->displayer()->SetSelected(aPrs, true);*/
+ /*QFeatureList aFeatureList;
+ aFeatureList.append(myTestFeature);
+ theWorkshop->displayer()->setSelected(aFeatureList, true);*/
- theWorkshop->displayer()->UpdateViewer();
+ theWorkshop->displayer()->updateViewer();
}
void PartSet_TestOCC::moveMouse(Handle(AIS_InteractiveContext) theContext, Handle(V3d_View) theView)