#include <Events_Error.h>
#include <GeomAPI_Shape.h>
-
-#include <AIS_ListOfInteractive.hxx>
-//#include <AIS_DimensionSelectionMode.hxx>
+#include <GeomAPI_AISObject.h>
#include <QObject>
#include <QMouseEvent>
connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)),
this, SLOT(onMultiSelectionEnabled(bool)));
- connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)),
- this, SLOT(onMultiSelectionEnabled(bool)));
connect(aPreviewOp, SIGNAL(stopSelection(const QFeatureList&, const bool)),
this, SLOT(onStopSelection(const QFeatureList&, const bool)));
connect(aPreviewOp, SIGNAL(setSelection(const QFeatureList&)),
boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
if (aSPFeature)
{
- Handle(AIS_InteractiveObject) anAIS = aSPFeature->getAISShape(aDisplayer->getAISObject(theFeature));
+ boost::shared_ptr<GeomAPI_AISObject> anAIS =
+ aSPFeature->getAISObject(aDisplayer->getAISObject(theFeature));
aDisplayer->redisplay(theFeature, anAIS, false);
}
}
// compute a circle point in 3D view
boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr =
boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(CIRCLE_ATTR_CENTER));
- if (aCenterAttr->isInitialized()) {
+ AttributeDoublePtr aRadiusAttr =
+ boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(CIRCLE_ATTR_RADIUS));
+ if (aCenterAttr->isInitialized() && aRadiusAttr->isInitialized()) {
boost::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
// make a visible point
boost::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
if (aHasPlane) {
boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z()));
// compute the circle radius
- AttributeDoublePtr aRadiusAttr =
- boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(CIRCLE_ATTR_RADIUS));
double aRadius = aRadiusAttr->value();
boost::shared_ptr<GeomAPI_Shape> aCircleShape =
return getPreview();
}
+boost::shared_ptr<GeomAPI_AISObject> SketchPlugin_Circle::getAISObject(
+ boost::shared_ptr<GeomAPI_AISObject> thePrevious)
+{
+ return prepareAISShape(thePrevious);
+}
+
void SketchPlugin_Circle::move(double theDeltaX, double theDeltaY)
{
boost::shared_ptr<ModelAPI_Data> aData = data();
#include "SketchPlugin_Sketch.h"
#include <ModelAPI_Data.h>
#include <ModelAPI_AttributeRefList.h>
+#include <GeomAPI_AISObject.h>
#include <GeomAPI_XYZ.h>
#include <GeomDataAPI_Dir.h>
#include <GeomDataAPI_Point.h>
#include <GeomAlgoAPI_CompoundBuilder.h>
#include <GeomAlgoAPI_SketchBuilder.h>
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_Shape.hxx>
-#include <Quantity_NameOfColor.hxx>
-
-const Quantity_NameOfColor SKETCH_PLANE_COLOR = Quantity_NOC_CHOCOLATE; /// the plane edge color
-const int SKETCH_WIDTH = 4; /// the plane edge width
+const int SKETCH_PLANE_COLOR = Colors::COLOR_BROWN; /// the plane edge color
+const double SKETCH_WIDTH = 4.0; /// the plane edge width
using namespace std;
aFeaturesPreview.push_back(aPreview);
}
+ if (aFeaturesPreview.empty())
+ return ;
std::list< boost::shared_ptr<GeomAPI_Shape> > aLoops;
std::list< boost::shared_ptr<GeomAPI_Shape> > aWires;
GeomAlgoAPI_SketchBuilder::createFaces(anOrigin->pnt(), aDirX->dir(), aDirY->dir(), aNorm->dir(),
data()->store(aCompound);
}
-Handle(AIS_InteractiveObject) SketchPlugin_Sketch::getAISShape(Handle(AIS_InteractiveObject) thePrevious)
+boost::shared_ptr<GeomAPI_AISObject> SketchPlugin_Sketch::getAISObject(
+ boost::shared_ptr<GeomAPI_AISObject> thePrevious)
{
- Handle(AIS_InteractiveObject) anAIS = SketchPlugin_Feature::getAISShape(thePrevious);
- Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS);
- aShapeAIS->SetColor(Quantity_Color(SKETCH_PLANE_COLOR));
- aShapeAIS->SetWidth(SKETCH_WIDTH);
- aShapeAIS->Redisplay();
+ boost::shared_ptr<GeomAPI_AISObject> anAIS = prepareAISShape(thePrevious);
+ anAIS->setColor(SKETCH_PLANE_COLOR);
+ anAIS->setWidth(SKETCH_WIDTH);
+ //anAIS->Redisplay();
return anAIS;
}