#include <AIS_InteractiveObject.hxx>
#include <AIS_Shape.hxx>
+#ifdef BEFORE_TRIHEDRON_PATCH
#include <AIS_Axis.hxx>
#include <AIS_Point.hxx>
#include <AIS_Plane.hxx>
+#else
+#include <AIS_Trihedron.hxx>
+#include <AIS_TrihedronOwner.hxx>
+#include <Geom_Axis2Placement.hxx>
+#endif
#include <Geom_Point.hxx>
#include <Geom_Line.hxx>
#include <Geom_Plane.hxx>
// Check Trihedron sub-objects
Handle(SelectMgr_SelectableObject) aSelObj = theOwner->Selectable();
Handle(Standard_Type) aType = aSelObj->DynamicType();
+#ifdef BEFORE_TRIHEDRON_PATCH
if (aType == STANDARD_TYPE(AIS_Axis)) {
Handle(AIS_Axis) aAxis = Handle(AIS_Axis)::DownCast(aSelObj);
gp_Lin aLine = aAxis->Component()->Lin();
gp_Pln aPln = aAisPlane->Component()->Pln();
return aPlane.Distance(aPln) < Precision::Confusion();
}
+#else
+ if (aType == STANDARD_TYPE(AIS_Trihedron)) {
+ Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(aSelObj);
+ Handle(AIS_TrihedronOwner) aTrOwner = Handle(AIS_TrihedronOwner)::DownCast(theOwner);
+ if (!aTrOwner.IsNull())
+ {
+ const Prs3d_DatumParts& aPart = aTrOwner->DatumPart();
+ if (aPart >= Prs3d_DP_XAxis && aPart <= Prs3d_DP_ZAxis)
+ {
+ Handle(Prs3d_Drawer) aDrawer = aTrihedron->Attributes();
+ Handle(Prs3d_DatumAspect) aDatumAspect = aDrawer->DatumAspect();
+ Handle(Graphic3d_ArrayOfPrimitives) aPrimitives =
+ aDatumAspect->ArrayOfPrimitives(aPart);
+ Standard_Real aX1, anY1, aZ1, aX2, anY2, aZ2;
+ aPrimitives->Vertice(1, aX1, anY1, aZ1);
+ aPrimitives->Vertice(2, aX2, anY2, aZ2);
+ gp_Pnt aPnt1(aX1, anY1, aZ1);
+ gp_Pnt aPnt2(aX2, anY2, aZ2);
+ gp_Lin aLine(aPnt1, gp_Dir(gp_Vec(aPnt1, aPnt2)));
+ return aPlane.Contains(aLine, Precision::Confusion(), Precision::Angular());
+ }
+ }
+ }
+#endif
// This is not object controlled by the filter
aValid = Standard_True;
}
#include <cmath>
+//#define CREATE_CONSTRAINTS
+
//#define DEBUG_SPLIT
#ifdef DEBUG_SPLIT
#include <iostream>
thePoints.insert(std::dynamic_pointer_cast<GeomDataAPI_Point2D>
(theSplitFeature->attribute(SketchPlugin_Line::START_ID())));
+#ifdef CREATE_CONSTRAINTS
// additional constraints between split and base features
aConstraintFeature = createConstraintForObjects(SketchPlugin_ConstraintParallel::ID(),
getFeatureResult(aBaseFeature),
getFeatureResult(theAfterFeature));
theCreatedFeatures.insert(aConstraintFeature);
}
+#endif
}
void SketchPlugin_ConstraintSplit::splitArc(FeaturePtr& theSplitFeature,
(theSplitFeature->attribute(SketchPlugin_Arc::START_ID())));
// additional constraints between split and base features
+#ifdef CREATE_CONSTRAINTS
aConstraintFeature = createConstraintForObjects(SketchPlugin_ConstraintEqual::ID(),
getFeatureResult(aBaseFeature),
getFeatureResult(theSplitFeature));
getFeatureResult(theAfterFeature));
theCreatedFeatures.insert(aConstraintFeature);
}
+#endif
}
void SketchPlugin_ConstraintSplit::splitCircle(FeaturePtr& theSplitFeature,
theSplitFeature->attribute(SketchPlugin_Arc::START_ID()));
theCreatedFeatures.insert(aConstraintFeature);
+#ifdef CREATE_CONSTRAINTS
aConstraintFeature = createConstraintForObjects(SketchPlugin_ConstraintTangent::ID(),
getFeatureResult(theSplitFeature),
getFeatureResult(theBaseFeatureModified));
theCreatedFeatures.insert(aConstraintFeature);
+#endif
}
void SketchPlugin_ConstraintSplit::arrangePointsOnLine(
#ifndef XGUI_H
#define XGUI_H
+//#define BEFORE_TRIHEDRON_PATCH
+
#if defined XGUI_EXPORTS
#if defined WIN32
#define XGUI_EXPORT __declspec( dllexport )
#include <AIS_Shape.hxx>
#include <AIS_Dimension.hxx>
#include <AIS_Trihedron.hxx>
+#ifdef BEFORE_TRIHEDRON_PATCH
#include <AIS_Axis.hxx>
#include <AIS_Plane.hxx>
#include <AIS_Point.hxx>
+#endif
#include <AIS_Selection.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <SelectMgr_ListOfFilter.hxx>
);
/// #1136 hidden axis are selected in sketch
+#ifdef BEFORE_TRIHEDRON_PATCH
deactivateObject(aContext, aTrie->XAxis()
#ifdef VINSPECTOR
, getCallBack()
, getCallBack()
#endif
);
-
+#endif
if (theUpdateViewer)
updateViewer();
}
#include <ModelAPI_ResultConstruction.h>
#include <AIS_InteractiveContext.hxx>
+#ifdef BEFORE_TRIHEDRON_PATCH
#include <AIS_Axis.hxx>
#include <AIS_Point.hxx>
+#else
+#include <AIS_TrihedronOwner.hxx>
+#endif
#include <Geom_Line.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS_Edge.hxx>
// the located method is called in the context to obtain the shape by the SelectedShape()
// method, so the shape is located by the same rules
TopoDS_Shape aShape = aBRO->Shape().Located (aBRO->Location() * aBRO->Shape().Location());
+#ifdef BEFORE_TRIHEDRON_PATCH
#ifndef DEBUG_DELIVERY
if (aShape.IsNull())
aShape = findAxisShape(anIO);
+#endif
#endif
if (!aShape.IsNull()) {
std::shared_ptr<GeomAPI_Shape> aGeomShape =
} else {
#ifdef DEBUG_DELIVERY
// Fill by trihedron shapes
+#ifdef BEFORE_TRIHEDRON_PATCH
Handle(AIS_Axis) aAxis = Handle(AIS_Axis)::DownCast(anIO);
DocumentPtr aDoc = ModelAPI_Session::get()->moduleDocument();
int aSize = aDoc->size(ModelAPI_ResultConstruction::group());
}
}
}
+#else
+ /// find axis direction
+ Handle(AIS_TrihedronOwner) aTrihedronOwner = Handle(AIS_TrihedronOwner)::DownCast(theOwner);
+ if (!aTrihedronOwner.IsNull()) {
+ const Prs3d_DatumParts& aPart = aTrihedronOwner->DatumPart();
+ std::string aName;
+ switch (aPart) {
+ case Prs3d_DP_Origin: aName = "Origin"; break;
+ case Prs3d_DP_XAxis: aName = "OX"; break;
+ case Prs3d_DP_YAxis: aName = "OY"; break;
+ case Prs3d_DP_ZAxis: aName = "OZ"; break;
+ default: break;
+ }
+ if (aName.length() > 0) {
+ DocumentPtr aDoc = ModelAPI_Session::get()->moduleDocument();
+ int aSize = aDoc->size(ModelAPI_ResultConstruction::group());
+ ObjectPtr aObj;
+ ResultPtr aResult;
+ for (int i = 0; i < aSize; i++) {
+ aObj = aDoc->object(ModelAPI_ResultConstruction::group(), i);
+ if (aObj->data()->name() == aName) {
+ aResult = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
+ break;
+ }
+ }
+ if (aResult.get()) {
+ thePrs->setObject(aResult);
+ thePrs->setShape(aResult->shape());
+ return;
+ }
+ }
+ }
+#endif
#endif
}
}
//**************************************************************
+#ifdef BEFORE_TRIHEDRON_PATCH
TopoDS_Shape XGUI_Selection::findAxisShape(Handle(AIS_InteractiveObject) theIO) const
{
TopoDS_Shape aShape;
}
return aShape;
}
+#endif
/// Generates a vertex or edge by the give IO if it is an AIS created on trihedron
/// \param theIO a selected object
/// \return created shape or empty shape
+#ifdef BEFORE_TRIHEDRON_PATCH
TopoDS_Shape findAxisShape(Handle(AIS_InteractiveObject) theIO) const;
+#endif
private:
XGUI_Workshop* myWorkshop;
#include <SUIT_ResourceMgr.h>
#include <AIS_Trihedron.hxx>
+#ifdef BEFORE_TRIHEDRON_PATCH
#include <AIS_Point.hxx>
#include <AIS_Axis.hxx>
+#endif
#include <QApplication>
#include <QFileDialog>
Standard_Integer aMode = itr.Value();
aContext->Deactivate(aTrihedron, aMode);
}
+#ifdef BEFORE_TRIHEDRON_PATCH
/// Trihedron problem: objects stayed in the viewer, should be removed manually
/// otherwise in SALOME happens crash by HideAll in the viewer
aContext->Remove(aTrihedron->Position(), true);
aContext->Remove(aTrihedron->Axis(), true);
aContext->Remove(aTrihedron->XAxis(), true);
aContext->Remove(aTrihedron->YAxis(), true);
-
+#endif
myOperationMgr->deactivate();
}