#include "PartSet_CustomPrs.h"
#include "PartSet_IconFactory.h"
#include "PartSet_OverconstraintListener.h"
+#include "PartSet_TreeNodes.h"
#include "PartSet_Filters.h"
#include "PartSet_FilterInfinite.h"
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
#include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_AttributeIntArray.h>
#include <GeomDataAPI_Point2D.h>
#include <GeomDataAPI_Point.h>
#include <SketchPlugin_Sketch.h>
#include <SketcherPrs_SymbolPrs.h>
+#include <SketcherPrs_PositionMgr.h>
#include <SketcherPrs_Coincident.h>
#include <SketcherPrs_Tools.h>
PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
: ModuleBase_IModule(theWshop),
myVisualLayerId(0),
+ myRoot(0),
myIsOperationIsLaunched(false)
{
new PartSet_IconFactory();
Config_PropManager::registerProp("Visualization", "hidden_face_transparency",
"Hidden faces transparency",
- Config_Prop::Double,
+ Config_Prop::DblSpin,
"0.8");
+ std::ostringstream aStream;
+ aStream << SketcherPrs_Tools::getDefaultArrowSize();
+ Config_PropManager::registerProp("Visualization", "dimension_arrow_size",
+ "Dimension arrow size", Config_Prop::IntSpin, aStream.str());
+
+ Config_PropManager::registerProp("Visualization", "dimension_font", "Dimension font",
+ Config_Prop::String, "Times-bold");
+
+ aStream.str("");
+ aStream.clear();
+ aStream << SketcherPrs_Tools::getDefaultTextHeight();
+ Config_PropManager::registerProp("Visualization", "dimension_value_size",
+ "Dimension value size", Config_Prop::IntSpin, aStream.str());
+
+ Config_PropManager::registerProp("Visualization", "sketch_dimension_color",
+ "Sketch dimension color",
+ Config_Prop::Color, SKETCH_DIMENSION_COLOR);
}
//******************************************************
PartSet_Module::~PartSet_Module()
{
- std::map<PartSet_SelectionFilterType, Handle(SelectMgr_Filter)>::const_iterator aFiltersIt =
+ std::map<XGUI_SelectionFilterType, Handle(SelectMgr_Filter)>::const_iterator aFiltersIt =
mySelectionFilters.begin();
for (; aFiltersIt != mySelectionFilters.end(); aFiltersIt++) {
Handle(SelectMgr_Filter) aFilter = aFiltersIt->second;
}
delete myCustomPrs;
delete myOverconstraintListener;
+ delete myRoot;
+}
+
+//******************************************************
+void PartSet_Module::createFeatures()
+{
+ ModuleBase_IModule::createFeatures();
+ myRoot = new PartSet_RootNode();
+ myRoot->setWorkshop(workshop());
}
+
//******************************************************
void PartSet_Module::storeSelection()
{
new PartSet_MultyTranslationSelection);
aFactory->registerValidator("PartSet_SplitSelection", new PartSet_SplitSelection);
aFactory->registerValidator("PartSet_ProjectionSelection", new PartSet_ProjectionSelection);
+ aFactory->registerValidator("PartSet_IntersectionSelection", new PartSet_IntersectionSelection);
}
//******************************************************
void PartSet_Module::moduleSelectionFilters(const QIntList& theFilterTypes,
SelectMgr_ListOfFilter& theSelectionFilters)
{
- bool isSketchActive = mySketchMgr->activeSketch();
- XGUI_ActiveControlSelector* anActiveSelector = getWorkshop()->activeControlMgr()->activeSelector();
- bool isHideFacesActive = anActiveSelector &&
- anActiveSelector->getType() == XGUI_FacesPanelSelector::Type();
+ bool isSketchActive = mySketchMgr->activeSketch().get();
- std::map<PartSet_SelectionFilterType, Handle(SelectMgr_Filter)>::const_iterator aFiltersIt =
+ std::map<XGUI_SelectionFilterType, Handle(SelectMgr_Filter)>::const_iterator aFiltersIt =
mySelectionFilters.begin();
for (; aFiltersIt != mySelectionFilters.end(); aFiltersIt++) {
int aFilterType = aFiltersIt->first;
// using sketch filters only if sketch operation is active
if (!isSketchActive &&
- mySketchMgr->sketchSelectionFilter((PartSet_SelectionFilterType)aFilterType))
+ mySketchMgr->sketchSelectionFilter((XGUI_SelectionFilterType)aFilterType))
continue;
- // using filtering of construction results only when faces panel is active
- if (aFilterType == SF_ResultGroupNameFilter && !isHideFacesActive)
+ // using filtering of construction results only from faces panel
+ if (aFilterType == SF_ResultGroupNameFilter)
continue;
theSelectionFilters.Append(aFiltersIt->second);
{
QIntList aTypes;
- std::map<PartSet_SelectionFilterType, Handle(SelectMgr_Filter)>::const_iterator aFiltersIt =
+ std::map<XGUI_SelectionFilterType, Handle(SelectMgr_Filter)>::const_iterator aFiltersIt =
mySelectionFilters.begin();
for (; aFiltersIt != mySelectionFilters.end(); aFiltersIt++)
aTypes.append(aFiltersIt->first);
}
//******************************************************
-void PartSet_Module::registerSelectionFilter(const PartSet_SelectionFilterType theFilterType,
+void PartSet_Module::registerSelectionFilter(const XGUI_SelectionFilterType theFilterType,
const Handle(SelectMgr_Filter)& theFilter)
{
mySelectionFilters[theFilterType] = theFilter;
}
//******************************************************
-Handle(SelectMgr_Filter) PartSet_Module::selectionFilter(
- const PartSet_SelectionFilterType theFilterType)
+Handle(SelectMgr_Filter) PartSet_Module::selectionFilter(const int theType)
{
- if (mySelectionFilters.find(theFilterType) != mySelectionFilters.end())
- return mySelectionFilters[theFilterType];
+ XGUI_SelectionFilterType aType = (XGUI_SelectionFilterType)theType;
+
+ if (mySelectionFilters.find(aType) != mySelectionFilters.end())
+ return mySelectionFilters[aType];
else
return Handle(SelectMgr_Filter)();
}
void PartSet_Module::closeDocument()
{
myActivePartIndex = QModelIndex();
+ SketcherPrs_PositionMgr::get()->clearAll();
}
//******************************************************
{
ModuleBase_ModelWidget* anActiveWidget = 0;
- anActiveWidget = mySketchReentrantMgr->internalActiveWidget();
- if (!anActiveWidget) {
- ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
- if (aOperation) {
- ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
- anActiveWidget = aPanel ? aPanel->activeWidget() : 0;
- }
- }
- return anActiveWidget;
+ ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
+ if (!aOperation)
+ return anActiveWidget;
+
+ ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
+ if (!aPanel)
+ return anActiveWidget;
+
+ return aPanel->activeWidget(true);
}
//******************************************************
{
Handle(AIS_InteractiveObject) anAIS = theAIS->impl<Handle(AIS_InteractiveObject)>();
if (!anAIS.IsNull()) {
- bool aToUseZLayer = false;
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
- if (aFeature.get() && PartSet_Tools::findRefsToMeFeature(aFeature,
- SketchPlugin_Projection::ID()))
- aToUseZLayer = true;
- Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext();
- Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAIS);
- if (!aDim.IsNull()) {
- aToUseZLayer = true;
- } else {
- Handle(SketcherPrs_SymbolPrs) aCons = Handle(SketcherPrs_SymbolPrs)::DownCast(anAIS);
- if (!aCons.IsNull())
- aToUseZLayer = true;
+ if (aFeature.get()) {
+ bool aToUseZLayer = false;
+ if (PartSet_Tools::findRefsToMeFeature(aFeature,SketchPlugin_Projection::ID()))
+ aToUseZLayer = true;
+ else {
+ CompositeFeaturePtr aParent = ModelAPI_Tools::compositeOwner(aFeature);
+ aToUseZLayer = (aParent.get() && (aParent->getKind() == SketchPlugin_Sketch::ID()));
+ }
+ if (aToUseZLayer) {
+ Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext();
+ aCtx->SetZLayer(anAIS, myVisualLayerId);
+ }
}
- if (aToUseZLayer)
- aCtx->SetZLayer(anAIS, myVisualLayerId);
}
}
if (aView.IsNull())
return;
+ bool isModified = false;
ModuleBase_Operation* aCurrentOperation = myWorkshop->currentOperation();
if (aCurrentOperation &&
(PartSet_SketcherMgr::isSketchOperation(aCurrentOperation) ||
- sketchMgr()->isNestedSketchOperation(aCurrentOperation)))
+ sketchMgr()->isNestedSketchOperation(aCurrentOperation) ||
+ (aCurrentOperation->id() == "Measurement")))
{
double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize());
SketcherPrs_Tools::setArrowSize(aLen);
const double aCurScale = aViewer->activeView()->Camera()->Scale();
aViewer->SetScale(aViewer->activeView(), aCurScale);
- bool isModified = false;
+#ifdef OPTIMIZE_PRS
+ QList<Handle(AIS_InteractiveObject)> aPrsList = aDisplayer->displayedPresentations();
+ foreach(Handle(AIS_InteractiveObject) aAisObj, aPrsList) {
+#else
QList<AISObjectPtr> aPrsList = aDisplayer->displayedPresentations();
- foreach (AISObjectPtr aAIS, aPrsList) {
+ foreach(AISObjectPtr aAIS, aPrsList) {
Handle(AIS_InteractiveObject) aAisObj = aAIS->impl<Handle(AIS_InteractiveObject)>();
-
+#endif
Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(aAisObj);
if (!aDim.IsNull()) {
aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen);
if (isModified)
aDisplayer->updateViewer();
}
+
}
//******************************************************
SessionPtr aMgr = ModelAPI_Session::get();
DocumentPtr aActiveDoc = aMgr->activeDocument();
- if (myActivePartIndex.isValid())
- aTreeView->setExpanded(myActivePartIndex, false);
+ // workaround for #2431 (SISGSEGV when launching some unit tests from GUI)
+ //if (myActivePartIndex.isValid())
+ // aTreeView->setExpanded(myActivePartIndex, false);
XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel();
myActivePartIndex = aDataModel->documentRootIndex(aActiveDoc, 0);
return aConnector->workshop();
}
-//******************************************************
void PartSet_Module::setDefaultConstraintShown()
{
myHasConstraintShown[PartSet_Tools::Geometrical] = true;
myHasConstraintShown[PartSet_Tools::Dimensional] = true;
myHasConstraintShown[PartSet_Tools::Expressions] = false;
}
+
+//******************************************************
+ModuleBase_ITreeNode* PartSet_Module::rootNode() const
+{
+ return myRoot;
+}