#include <QList>
-static const int AIS_DEFAULT_WIDTH = 2;
-
//#define DEBUG_EMPTY_SHAPE
// multi-rotation/translation operation
// appendShapeIfVisible() on the step of filling myFeatureShapes list
// the reason is to avoid empty AIS object visualized in the viewer
//if (!aGeomShape.get()) continue;
- TopoDS_Shape aShape = aGeomShape->impl<TopoDS_Shape>();
+ TopoDS_Shape aShape = aGeomShape.get() ? aGeomShape->impl<TopoDS_Shape>() : TopoDS_Shape();
// change deviation coefficient to provide more precise circle
ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aDrawer);
/// workaround for zero width. Else, there will be a crash
if (aWidth == 0) { // width returns of TSolid shape is zero
bool isDisplayed = !anIO->GetContext().IsNull();
- aWidth = AIS_DEFAULT_WIDTH;// default width value
+ aWidth = PartSet_Tools::getAISDefaultWidth();// default width value
}
setWidth(aDrawer, aWidth);
}
// the presentation is not used in the selection
}
-bool PartSet_OperationPrs::isVisible(XGUI_Displayer* theDisplayer, const ObjectPtr& theObject)
-{
- bool aVisible = false;
- GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
- ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
- if (aPrs.get() || aResult.get()) {
- aVisible = theDisplayer->isVisible(theObject);
- // compsolid is not visualized in the viewer, but should have presentation when all sub solids are
- // visible. It is useful for highlight presentation where compsolid shape is selectable
- if (!aVisible && aResult.get() && aResult->groupName() == ModelAPI_ResultCompSolid::group()) {
- ResultCompSolidPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
- if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids
- bool anAllSubsVisible = aCompsolidResult->numberOfSubs() > 0;
- for(int i = 0; i < aCompsolidResult->numberOfSubs() && anAllSubsVisible; i++) {
- anAllSubsVisible = theDisplayer->isVisible(aCompsolidResult->subResult(i));
- }
- aVisible = anAllSubsVisible;
- }
- }
- }
- else {
- // check if all results of the feature are visible
- FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
- std::list<ResultPtr> aResults = aFeature->results();
- std::list<ResultPtr>::const_iterator aIt;
- aVisible = !aResults.empty();
- for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
- aVisible = aVisible && theDisplayer->isVisible(*aIt);
- }
- }
- return aVisible;
-}
-
bool isSubObject(const ObjectPtr& theObject, const FeaturePtr& theFeature)
{
bool isSub = false;
QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes)
{
XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(theWorkshop)->displayer();
- if (isVisible(aDisplayer, theObject)) {
+ if (XGUI_Displayer::isVisible(aDisplayer, theObject)) {
if (theGeomShape.get()) {
if (theObjectShapes.contains(theObject))
theObjectShapes[theObject].append(theGeomShape);
{
theObjectShapes.clear();
- QList<ModuleBase_ViewerPrs> aValues;
+ QList<ModuleBase_ViewerPrsPtr> aValues;
ModuleBase_IPropertyPanel* aPanel = theWorkshop->propertyPanel();
if (aPanel) {
ModuleBase_ModelWidget* aWidget = aPanel->activeWidget();
}
QList<GeomShapePtr> aShapes;
- QList<ModuleBase_ViewerPrs>::const_iterator anIIt = aValues.begin(),
+ QList<ModuleBase_ViewerPrsPtr>::const_iterator anIIt = aValues.begin(),
aILast = aValues.end();
for (; anIIt != aILast; anIIt++) {
- ModuleBase_ViewerPrs aPrs = *anIIt;
- ObjectPtr anObject = aPrs.object();
+ ModuleBase_ViewerPrsPtr aPrs = *anIIt;
+ ObjectPtr anObject = aPrs->object();
- GeomShapePtr aGeomShape;
-
- TopoDS_Shape aShape = aPrs.shape();
- if (!aShape.IsNull()) {
- aGeomShape = GeomShapePtr(new GeomAPI_Shape());
- aGeomShape->setImpl(new TopoDS_Shape(aShape));
- }
- else {
+ GeomShapePtr aGeomShape = aPrs->shape();
+ if (!aGeomShape.get() || aGeomShape->isNull()) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
if (aResult.get()) {
aGeomShape = aResult->shape();