//#define DEBUG_CURSOR
+//#define DEBUG_INTERSECTION_POINT
+
/// Returns list of unique objects by sum of objects from List1 and List2
/*QList<ModuleBase_ViewerPrs> getSumList(const QList<ModuleBase_ViewerPrs>& theList1,
const QList<ModuleBase_ViewerPrs>& theList2)
if (myPlaneFilter.IsNull())
myPlaneFilter = new ModuleBase_ShapeInPlaneFilter();
+#ifndef DEBUG_INTERSECTION_POINT
myModule->workshop()->viewer()->addSelectionFilter(myPlaneFilter);
-
+#endif
bool aHasPlane = false;
std::shared_ptr<GeomAPI_Pln> aPln;
if (aFOperation->isEditOperation()) {
#include "SketchPlugin_IntersectionPoint.h"
-#include <ModelAPI_AttributeRefAttr.h>
+#include <ModelAPI_AttributeSelection.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
void SketchPlugin_IntersectionPoint::initDerivedClassAttributes()
{
- data()->addAttribute(EXTERNAL_LINE_ID(), ModelAPI_AttributeRefAttr::typeId());
+ data()->addAttribute(EXTERNAL_LINE_ID(), ModelAPI_AttributeSelection::typeId());
SketchPlugin_Point::initDerivedClassAttributes();
}
void SketchPlugin_IntersectionPoint::computePoint()
{
- AttributeRefAttrPtr aLineRefAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(attribute(EXTERNAL_LINE_ID()));
- ResultPtr aLineResult = std::dynamic_pointer_cast<ModelAPI_Result>(aLineRefAttr->object());
+ AttributeSelectionPtr aLineAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(attribute(EXTERNAL_LINE_ID()));
+ ResultPtr aLineResult = std::dynamic_pointer_cast<ModelAPI_Result>(aLineAttr->context());
if (!aLineResult)
return;
const std::list<std::string>& theArguments,
std::string& theError) const
{
- if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
+ if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) {
theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
return false;
}
- AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
- ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aRefAttr->object());
+ AttributeSelectionPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anAttr->context());
if (!aResult) {
theError = "The attribute " + theAttribute->id() + " should be an object";
return false;
// find a sketch
std::shared_ptr<SketchPlugin_Sketch> aSketch;
- std::set<AttributePtr> aRefs = aRefAttr->owner()->data()->refsToMe();
+ std::set<AttributePtr> aRefs = anAttr->owner()->data()->refsToMe();
std::set<AttributePtr>::const_iterator anIt = aRefs.begin();
for (; anIt != aRefs.end(); ++anIt) {
CompositeFeaturePtr aComp =
std::shared_ptr<GeomAPI_Pln> aPlane = aSketch->plane();
std::shared_ptr<GeomAPI_Dir> aNormal = aPlane->direction();
- return fabs(aNormal->dot(aLineDir)) > tolerance * tolerance;
+ return true;//fabs(aNormal->dot(aLineDir)) > tolerance * tolerance;
}