if (theValue) {
ModuleBase_WidgetValueFeature* aFeatureValue =
dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
- if (aFeatureValue)
- isDone = setFeature(aFeatureValue->feature());
+ // TODO
+// if (aFeatureValue)
+// isDone = setFeature(aFeatureValue->feature());
}
return isDone;
}
dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
if (aFeatureValue) {
boost::shared_ptr<GeomAPI_Pnt2d> aValuePoint = aFeatureValue->point();
- FeaturePtr aValueFeature = aFeatureValue->feature();
+ //TODO
+/* FeaturePtr aValueFeature = aFeatureValue->feature();
if (aValueFeature) {
isDone = setFeature(aValueFeature);
}
}
if (aFPoint)
isDone = setAttribute(aFPoint);
- }
+ }*/
}
}
return isDone;
dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
if (aFeatureValue) {
boost::shared_ptr<GeomAPI_Pnt2d> aPnt = aFeatureValue->point();
- FeaturePtr aFeature = aFeatureValue->feature();
+ // TODO
+ /*FeaturePtr aFeature = aFeatureValue->feature();
if (aFeature && aPnt) {
setPoint(aFeature, aPnt);
isDone = true;
- }
+ }*/
}
}
return isDone;
{
}
-void ModuleBase_WidgetValueFeature::setFeature(const FeaturePtr& theFeature)
+void ModuleBase_WidgetValueFeature::setResult(const ResultPtr& theFeature)
{
- myFeature = theFeature;
+ myResult = theFeature;
}
-const FeaturePtr& ModuleBase_WidgetValueFeature::feature() const
+const ResultPtr& ModuleBase_WidgetValueFeature::result() const
{
- return myFeature;
+ return myResult;
}
void ModuleBase_WidgetValueFeature::setPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
#include <ModuleBase.h>
#include <ModuleBase_WidgetValue.h>
-#include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
#include <boost/shared_ptr.hpp>
/// Fill the widget values by given point
/// \param thePoint the point
- void setFeature(const FeaturePtr& theFeature);
+ void setResult(const ResultPtr& theFeature);
/// Returns the widget values by given point
/// \return theFeature the current feature
- const FeaturePtr& feature() const;
+ const ResultPtr& result() const;
/// Fill the widget values by given point
/// \param thePoint the point
const boost::shared_ptr<GeomAPI_Pnt2d>& point() const;
private:
- FeaturePtr myFeature;
+ ResultPtr myResult;
boost::shared_ptr<GeomAPI_Pnt2d> myPoint;
};
std::set<ObjectPtr >::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
for (; anIt != aLast; anIt++) {
ObjectPtr aObject = *anIt;
- ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(aObject);
- if (aResult) {
- if (myModule->workshop()->displayer()->isVisible(aResult) ||
+ FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+ if (aFeature) {
+ if (myModule->workshop()->displayer()->isVisible(aFeature->firstResult()) ||
aType == EVENT_OBJECT_CREATED) {
- myModule->visualizePreview(aResult, true, false);
+ myModule->visualizePreview(aFeature->firstResult(), true, false);
//if (aType == EVENT_OBJECT_CREATED)
- myModule->activateFeature(aResult, true);
+ myModule->activateFeature(aFeature, true);
}
}
}
for (; anIt != aLast; anIt++) {
std::string aGroup = *anIt;
if (aGroup.compare(SKETCH_KIND) == 0) { // Update only Sketch group
- myModule->workshop()->displayer()->eraseDeletedFeatures();
+ myModule->workshop()->displayer()->eraseDeletedResults();
myModule->updateCurrentPreview(aGroup);
}
}
void PartSet_Module::onContextMenuCommand(const QString& theId, bool isChecked)
{
- QFeatureList aFeatures = myWorkshop->selector()->selection()->selectedFeatures();
+ QList<ObjectPtr> aFeatures = myWorkshop->selector()->selection()->selectedObjects();
if (theId == "EDIT_CMD" && (aFeatures.size() > 0)) {
- editFeature(aFeatures.first());
+ FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aFeatures.first());
+ if (aFeature)
+ editFeature(aFeature);
}
}
activateFeature((*anIt), false);
}
}
- aDisplayer->stopSelection(theFeatures, isStop, false);
+ QResultList aResults;
+ foreach(FeaturePtr aFeature, theFeatures) {
+ if (aFeature->results().size() > 0) {
+ std::list<ResultPtr>& aResList = aFeature->results();
+ std::list<ResultPtr>::iterator aIt;
+ for (aIt = aResList.begin(); aIt != aResList.end(); ++aIt)
+ aResults.append(*aIt);
+ }
+ }
+ aDisplayer->stopSelection(aResults, isStop, false);
XGUI_ViewerProxy* aViewer = myWorkshop->viewer();
aViewer->enableSelection(!isStop);
aDisplayer->updateViewer();
}
-void PartSet_Module::onSetSelection(const QFeatureList& theFeatures)
+void PartSet_Module::onSetSelection(const QResultList& theFeatures)
{
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
aDisplayer->setSelected(theFeatures, false);
void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode)
{
bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
- visualizePreview(theFeature, isDisplay, false);
+ // TODO visualizePreview(theFeature, isDisplay, false);
if (!isDisplay) {
ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
FeaturePtr aSketch;
std::list<FeaturePtr>::const_iterator anIt = aList.begin(),
aLast = aList.end();
for (; anIt != aLast; anIt++)
- visualizePreview(*anIt, false, false);
+ visualizePreview((*anIt)->firstResult(), false, false);
aDisplayer->updateViewer();
}
}
Events_Loop::loop()->send(aMessage);
}
-void PartSet_Module::visualizePreview(FeaturePtr theFeature, bool isDisplay,
+void PartSet_Module::visualizePreview(ResultPtr theFeature, bool isDisplay,
const bool isUpdateViewer)
{
ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
if (aPreviewOp) {
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
- aDisplayer->activateInLocalContext(theFeature, aPreviewOp->getSelectionModes(theFeature),
+ aDisplayer->activateInLocalContext(theFeature->firstResult(), aPreviewOp->getSelectionModes(theFeature),
isUpdateViewer);
}
}
boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
if (!aSPFeature)
continue;
- visualizePreview(*anIt, true, false);
- aDisplayer->activateInLocalContext(*anIt, aModes, false);
+ visualizePreview((*anIt)->firstResult(), true, false);
+ aDisplayer->activateInLocalContext((*anIt)->firstResult(), aModes, false);
}
aDisplayer->updateViewer();
}
return;
// if (theFeature->getKind() == SKETCH_KIND) {
- FeaturePtr aFeature = theFeature;
- if (XGUI_Tools::isModelObject(aFeature)) {
- ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
- aFeature = aObject->featureRef();
- }
-
- if (aFeature) {
- onLaunchOperation(aFeature->getKind(), aFeature);
- updateCurrentPreview(aFeature->getKind());
- }
+ //FeaturePtr aFeature = theFeature;
+ //if (XGUI_Tools::isModelObject(aFeature)) {
+ // ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
+ // aFeature = aObject->featureRef();
+ //}
+
+ //if (aFeature) {
+ onLaunchOperation(theFeature->getKind(), theFeature);
+ updateCurrentPreview(theFeature->getKind());
+ //}
// }
}
/// \param theFeature the feature instance to be displayed
/// \param isDisplay the state whether the presentation should be displayed or erased
/// \param isUpdateViewer the flag whether the viewer should be updated
- void visualizePreview(FeaturePtr theFeature, bool isDisplay,
+ void visualizePreview(ResultPtr theResult, bool isDisplay,
const bool isUpdateViewer = true);
/// Activates the feature in the displayer
/// SLOT, to set selection
/// \param theFeatures a list of features to be selected
- void onSetSelection(const QFeatureList& theFeatures);
+ void onSetSelection(const QResultList& theFeatures);
/// SLOT, to close the viewer local context
void onCloseLocalContext();
}
}
}
- FeaturePtr aFeature;
+ ResultPtr aFeature;
if (!theSelected.empty()) {
ModuleBase_ViewerPrs aPrs = theSelected.front();
aFeature = aPrs.result();
}
- else
- aFeature = feature(); // for the widget distance only
+ // TODO
+ //else
+ // aFeature = feature(); // for the widget distance only
- bool isApplyed = setWidgetValue(aFeature, aX, anY);
+ // TODO
+ /*bool isApplyed = setWidgetValue(aFeature, aX, anY);
if (isApplyed) {
flushUpdated();
emit activateNextWidget(myActiveWidget);
- }
+ }*/
}
void PartSet_OperationFeatureCreate::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
if ((myPreSelection.size() > 0) && myActiveWidget) {
const ModuleBase_ViewerPrs& aPrs = myPreSelection.front();
ModuleBase_WidgetValueFeature aValue;
- aValue.setFeature(aPrs.result());
+ aValue.setResult(aPrs.result());
if (myActiveWidget->setValue(&aValue)) {
myPreSelection.remove(aPrs);
emit activateNextWidget(myActiveWidget);
bool PartSet_OperationFeatureCreate::setWidgetValue(FeaturePtr theFeature, double theX, double theY)
{
ModuleBase_WidgetValueFeature* aValue = new ModuleBase_WidgetValueFeature();
- aValue->setFeature(theFeature);
+ aValue->setResult(theFeature->firstResult());
aValue->setPoint(boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY)));
bool isApplyed = myActiveWidget->setValue(aValue);
aFeature = theHighlighted.front().result();
if (!aFeature && !theSelected.empty()) // changed for a constrain
aFeature = theSelected.front().result();
-
- if (!aFeature || aFeature != feature())
+ // TODO
+ /*if (!aFeature || aFeature != feature())
{
commit();
emit featureConstructed(feature(), FM_Deactivation);
bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
if(aHasShift && !theHighlighted.empty()) {
- QFeatureList aSelected;
+ QResultList aSelected;
+ // TODO
aSelected.push_back(feature());
aSelected.push_back(theHighlighted.front().result());
emit setSelection(aSelected);
}
+ // TODO
else if (aFeature) {
restartOperation(PartSet_OperationFeatureEdit::Type(), aFeature);
}
- }
+ }*/
}
void PartSet_OperationFeatureEdit::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
// deselected in the viewer by blockSelection signal in the startOperation method.
bool isSelected = false;
std::list<ModuleBase_ViewerPrs>::const_iterator anIt = theSelected.begin(), aLast = theSelected.end();
- for (; anIt != aLast && !isSelected; anIt++) {
+ // TODO
+ /*for (; anIt != aLast && !isSelected; anIt++) {
isSelected = (*anIt).feature() == feature();
- }
+ }*/
if (!isSelected)
myFeatures = theHighlighted;
else
aSketchFeature->move(aDeltaX, aDeltaY);
std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
- for (; anIt != aLast; anIt++) {
+ // TODO
+ /*for (; anIt != aLast; anIt++) {
FeaturePtr aFeature = (*anIt).feature();
if (!aFeature || aFeature == feature())
continue;
aSketchFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
aSketchFeature->move(aDeltaX, aDeltaY);
- }
+ }*/
}
sendFeatures();
std::list<ModuleBase_ViewerPrs> aFeatures = myFeatures;
commit();
std::list<ModuleBase_ViewerPrs>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
- for (; anIt != aLast; anIt++) {
+ // TODO
+ /*for (; anIt != aLast; anIt++) {
FeaturePtr aFeature = (*anIt).feature();
if (aFeature) {
emit featureConstructed(aFeature, FM_Deactivation);
}
- }
+ }*/
}
void PartSet_OperationFeatureEditMulti::startOperation()
QFeatureList aFeatureList;
std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(),
aLast = myFeatures.end();
- for(; anIt != aLast; anIt++)
- aFeatureList.append((*anIt).feature());
+ /*for(; anIt != aLast; anIt++)
+ aFeatureList.append((*anIt).feature());*/
if (isBlocked) {
emit setSelection(QFeatureList());
emit stopSelection(aFeatureList, true);
std::list<FeaturePtr > aFeatures;
std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
- for (; anIt != aLast; anIt++) {
+ // TODO
+ /*for (; anIt != aLast; anIt++) {
FeaturePtr aFeature = (*anIt).feature();
if (!aFeature)
continue;
ModelAPI_EventCreator::get()->sendUpdated(aFeature, anEvent);
- }
+ }*/
Events_Loop::loop()->flush(anEvent);
flushUpdated();
}
return;
if (theHighlighted.size() == 1) {
- FeaturePtr aFeature = theHighlighted.front().feature();
+ ResultPtr aFeature = theHighlighted.front().result();
if (aFeature) {
std::string anOperationType = PartSet_OperationFeatureEdit::Type();
if (theSelected.size() > 1)
anOperationType = PartSet_OperationFeatureEditMulti::Type();
- restartOperation(anOperationType, aFeature);
+ // TODO restartOperation(anOperationType, aFeature);
}
}
else
/// It is empty and we have to use the process mouse release to start edition operation
/// for these objects
if (theSelected.size() == 1) {
- FeaturePtr aFeature = theSelected.front().feature();
- if (aFeature)
- restartOperation(PartSet_OperationFeatureEdit::Type(), aFeature);
+ ResultPtr aFeature = theSelected.front().result();
+ // TODO
+ //if (aFeature)
+ // restartOperation(PartSet_OperationFeatureEdit::Type(), aFeature);
}
}
}
boost::shared_ptr<ModelAPI_AttributeRefList> aRefList =
boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aData->attribute(SKETCH_ATTR_FEATURES));
- return aRefList->list();
+ std::list<ObjectPtr> aList = aRefList->list();
+ std::list<ObjectPtr>::iterator aIt;
+ std::list<FeaturePtr> aFeaList;
+ for (aIt = aList.begin(); aIt != aList.end(); ++aIt) {
+ FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*aIt);
+ if (aFeature)
+ aFeaList.push_back(aFeature);
+ }
+ return aFeaList;
}
void PartSet_OperationSketch::stopOperation()
#include <PartSet_OperationSketchBase.h>
#include <PartSet_Tools.h>
+#include <ModelAPI_ResultBody.h>
#include <SketchPlugin_Feature.h>
#include <V3d_View.hxx>
{
boost::shared_ptr<SketchPlugin_Feature> aFeature =
boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
- if (!aFeature)
- return boost::shared_ptr<GeomAPI_Shape>();
- return aFeature->preview();
+ if (aFeature) {
+ ResultPtr aRes = aFeature->firstResult();
+ ResultBodyPtr aBody = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(aRes);
+ if (aBody)
+ return aBody->shape();
+ }
+ return boost::shared_ptr<GeomAPI_Shape>();
}
std::list<FeaturePtr> PartSet_OperationSketchBase::subFeatures() const
boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
boost::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
if (!anAIS->empty())
- aDisplayer->redisplay(aFeature, anAIS, false);
+ aDisplayer->redisplay(aFeature->firstResult(), anAIS, false);
std::list<int> aModes;
aModes.push_back(TopAbs_VERTEX);
aModes.push_back(TopAbs_EDGE);
- aDisplayer->activateInLocalContext(aFeature, aModes, true);
+ aDisplayer->activateInLocalContext(aFeature->firstResult(), aModes, true);
// change the line
/*double aDelta = -200;
//aModes.push_back(TopAbs_VERTEX);
//aModes.push_back(TopAbs_EDGE);
//aDisplayer->activateInLocalContext(aFeature, aModes, true);
- myTestObject = aFeature;
+ myTestObject = aFeature->firstResult();
- QFeatureList aFeatureList;
+ QResultList aFeatureList;
aFeatureList.append(myTestObject);
aDisplayer->setSelected(aFeatureList, true);
}
// change the line
if (!myTestObject)
return;
- FeaturePtr aFeature = myTestObject;
+ ResultPtr aFeature = myTestObject;
myTestDelta = myTestDelta - 50;
double aDelta = myTestDelta;
- PartSet_Tools::setFeaturePoint(aFeature, -100/*aDelta*/, -100/*aDelta*/, LINE_ATTR_START);
- PartSet_Tools::setFeaturePoint(aFeature, 200/*aDelta*2*/, 200/*aDelta*2*/, LINE_ATTR_END);
- boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
+ // TODO
+ //PartSet_Tools::setFeaturePoint(aFeature, -100/*aDelta*/, -100/*aDelta*/, LINE_ATTR_START);
+ //PartSet_Tools::setFeaturePoint(aFeature, 200/*aDelta*2*/, 200/*aDelta*2*/, LINE_ATTR_END);
+ //boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
boost::shared_ptr<GeomAPI_AISObject> aPrevAIS;
boost::shared_ptr<SketchPlugin_Feature> aSPFeature =
boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, anY)));
if (aMinDelta < 0 || aMinDelta > aDelta) {
aMinDelta = aDelta;
- aDeltaFeature = aPrs.result();
+ // TODO aDeltaFeature = aPrs.result();
}
}
return aDeltaFeature;
boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(theAttribute));
if (anAttr) {
- aFeature = anAttr->feature();
+ aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(anAttr->object());
if (!theKind.empty() && aFeature && aFeature->getKind() != theKind) {
aFeature = FeaturePtr();
}
boost::shared_ptr<ModelAPI_AttributeRefList> aRefList =
boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aData->attribute(SKETCH_ATTR_FEATURES));
- std::list<FeaturePtr > aFeatures = aRefList->list();
- std::list<FeaturePtr >::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
+ std::list<ObjectPtr > aFeatures = aRefList->list();
+ std::list<ObjectPtr >::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttiributes;
boost::shared_ptr<GeomAPI_Pnt2d> aClickedPoint = boost::shared_ptr<GeomAPI_Pnt2d>
(new GeomAPI_Pnt2d(theClickedX, theClickedY));
for (; anIt != aLast; anIt++)
{
- FeaturePtr aFeature = *anIt;
+ FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*anIt);
// find the given point in the feature attributes
anAttiributes = aFeature->data()->attributes(GeomDataAPI_Point2D::type());
std::list<boost::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes.begin(),
/// Saves the internal parameters to the given feature
/// \param theFeature a model feature to be changed
- virtual bool storeValue(FeaturePtr theFeature) const { return true;}
+ virtual bool storeValue(ObjectPtr theFeature) const { return true;}
- virtual bool restoreValue(FeaturePtr theFeature) { return true;}
+ virtual bool restoreValue(ObjectPtr theFeature) { return true;}
/// Returns list of widget controls
/// \return a control list