#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 <PartSetPlugin_Part.h>
#include <PartSetPlugin_Duplicate.h>
+#include <SketchPlugin_ConstraintCoincidence.h>
+
#include <ModuleBase_Operation.h>
#include <ModuleBase_OperationAction.h>
#include <ModuleBase_IViewer.h>
PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
: ModuleBase_IModule(theWshop),
myVisualLayerId(0),
+ myRoot(0),
myIsOperationIsLaunched(false)
{
new PartSet_IconFactory();
"Hidden faces transparency",
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",
+ "Dimension color",
+ Config_Prop::Color, SKETCH_DIMENSION_COLOR);
}
//******************************************************
}
delete myCustomPrs;
delete myOverconstraintListener;
+ delete myRoot;
}
+//******************************************************
+void PartSet_Module::createFeatures()
+{
+ ModuleBase_IModule::createFeatures();
+ myRoot = new PartSet_RootNode();
+ myRoot->setWorkshop(workshop());
+}
+
+
//******************************************************
void PartSet_Module::storeSelection()
{
}
if (aToUseZLayer) {
Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext();
- aCtx->SetZLayer(anAIS, myVisualLayerId);
+ if (aFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID())
+ aCtx->SetZLayer(anAIS, Graphic3d_ZLayerId_Top);
+ else
+ 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();
}
+
}
//******************************************************
// customize sketch dimension constraint presentation
if (!aCustomized) {
if (!aColor.empty()) { // otherwise presentation has the default color
- AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID());
- aColorAttr->setSize(3);
- // Set the color attribute in order do not use default colors in the perasentation object
- for (int i = 0; i < 3; i++)
- aColorAttr->setValue(i, aColor[i]);
aCustomized = thePrs->setColor(aColor[0], aColor[1], aColor[2]);
}
}
SessionPtr aMgr = ModelAPI_Session::get();
DocumentPtr aActiveDoc = aMgr->activeDocument();
- // workaround for #2431 (SISGSEGV when launching some unit tests from GUI)
- //if (myActivePartIndex.isValid())
- // aTreeView->setExpanded(myActivePartIndex, false);
+
+ // Clear active part index if there is no Part documents
+ // It could be not null if document was closed and opened a new
+ // without closeDocument call
+ if (aMgr->allOpenedDocuments().size() <= 1)
+ myActivePartIndex = QModelIndex();
XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel();
+ QModelIndex aOldActive = myActivePartIndex;
myActivePartIndex = aDataModel->documentRootIndex(aActiveDoc, 0);
bool needUpdate = false;
if (myActivePartIndex.isValid()) {
if (!needUpdate)
aTreeView->setExpanded(myActivePartIndex, true);
}
+ if ((aOldActive != myActivePartIndex) && (aOldActive.isValid()))
+ aTreeView->setExpanded(aOldActive, false);
aLabel->setPalette(aPalet);
aWorkshop->updateCommandStatus();
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;
+}