const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
- myPntArray = new Graphic3d_ArrayOfPoints(2);
- myPntArray->AddVertex(0., 0., 0.);
- myPntArray->AddVertex(0., 0., 0.);
}
bool SketcherPrs_Collinear::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
return aReadyToDisplay;
}
-bool SketcherPrs_Collinear::updateIfReadyToDisplay(double theStep) const
+bool SketcherPrs_Collinear::updateIfReadyToDisplay(double theStep, bool withColor) const
{
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep);
gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep);
- myPntArray->SetVertice(1, aP1);
- myPntArray->SetVertice(2, aP2);
+ myPntArray = new Graphic3d_ArrayOfPoints(2, withColor);
+ myPntArray->AddVertex(aP1);
+ myPntArray->AddVertex(aP2);
return true;
}
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep) const;
+ virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
};
#endif
\ No newline at end of file
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
- myPntArray = new Graphic3d_ArrayOfPoints(2);
- myPntArray->AddVertex(0., 0., 0.);
- myPntArray->AddVertex(0., 0., 0.);
}
bool SketcherPrs_Equal::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
return aReadyToDisplay;
}
-bool SketcherPrs_Equal::updateIfReadyToDisplay(double theStep) const
+bool SketcherPrs_Equal::updateIfReadyToDisplay(double theStep, bool withColor) const
{
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep);
gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep);
- myPntArray->SetVertice(1, aP1);
- myPntArray->SetVertice(2, aP2);
+
+ myPntArray = new Graphic3d_ArrayOfPoints(2, withColor);
+ myPntArray->AddVertex(aP1);
+ myPntArray->AddVertex(aP2);
return true;
}
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep) const;
+ virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
};
#endif
\ No newline at end of file
return aReadyToDisplay;
}
-bool SketcherPrs_HVDirection::updateIfReadyToDisplay(double theStep) const
+bool SketcherPrs_HVDirection::updateIfReadyToDisplay(double theStep, bool withColor) const
{
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
gp_Pnt aP1 = aMgr->getPosition(aObj, this, theStep);
- myPntArray->SetVertice(1, aP1);
+ myPntArray = new Graphic3d_ArrayOfPoints(1, withColor);
+ myPntArray->AddVertex(aP1);
return true;
}
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep) const;
+ virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
private:
bool myIsHorisontal;
return aReadyToDisplay;
}
-bool SketcherPrs_Middle::updateIfReadyToDisplay(double theStep) const
+bool SketcherPrs_Middle::updateIfReadyToDisplay(double theStep, bool withColor) const
{
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
ObjectPtr aPointObject;
// find a line result to set middle symbol near it
+ myPntArray = new Graphic3d_ArrayOfPoints(1, withColor);
AttributePtr anAttribute =
SketcherPrs_Tools::getAttribute(myConstraint, SketchPlugin_Constraint::ENTITY_A());
if (!anAttribute.get()) {
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep) const;
+ virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
/// Draw shape of the object. Find shape result if the object is feature
void drawLine(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor,
return aReadyToDisplay;
}
-bool SketcherPrs_Mirror::updateIfReadyToDisplay(double theStep) const
+bool SketcherPrs_Mirror::updateIfReadyToDisplay(double theStep, bool withColor) const
{
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
int aNb = anAttrB->size();
- myPntArray = new Graphic3d_ArrayOfPoints(2 * aNb);
+ myPntArray = new Graphic3d_ArrayOfPoints(2 * aNb, withColor);
int i;
ObjectPtr aObj;
gp_Pnt aP1;
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep) const;
+ virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
};
#endif
\ No newline at end of file
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
- // Create default array
- myPntArray = new Graphic3d_ArrayOfPoints(2);
- myPntArray->AddVertex(0., 0., 0.);
- myPntArray->AddVertex(0., 0., 0.);
}
bool SketcherPrs_Parallel::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
return aReadyToDisplay;
}
-bool SketcherPrs_Parallel::updateIfReadyToDisplay(double theStep) const
+bool SketcherPrs_Parallel::updateIfReadyToDisplay(double theStep, bool withColor) const
{
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep);
gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep);
- myPntArray->SetVertice(1, aP1);
- myPntArray->SetVertice(2, aP2);
+ myPntArray = new Graphic3d_ArrayOfPoints(2, withColor);
+ myPntArray->AddVertex(aP1);
+ myPntArray->AddVertex(aP2);
return true;
}
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep) const;
+ virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
};
#endif
\ No newline at end of file
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
- // Create default array
- myPntArray = new Graphic3d_ArrayOfPoints(2);
- myPntArray->AddVertex(0., 0., 0.);
- myPntArray->AddVertex(0., 0., 0.);
}
bool SketcherPrs_Perpendicular::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
return aReadyToDisplay;
}
-bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep) const
+bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep, bool withColor) const
{
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep);
gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep);
- myPntArray->SetVertice(1, aP1);
- myPntArray->SetVertice(2, aP2);
+ myPntArray = new Graphic3d_ArrayOfPoints(2, withColor);
+ myPntArray->AddVertex(aP1);
+ myPntArray->AddVertex(aP2);
return true;
}
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep) const;
+ virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
};
#endif
\ No newline at end of file
return aReadyToDisplay;
}
-bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep) const
+bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep, bool withColor) const
{
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
+ myPntArray = new Graphic3d_ArrayOfPoints(1, withColor);
std::shared_ptr<ModelAPI_Data> aData = myConstraint->data();
std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
aData->refattr(SketchPlugin_Constraint::ENTITY_A());
SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
gp_Pnt aP1 = aMgr->getPosition(aObj, this, theStep);
- myPntArray->SetVertice(1, aP1);
+ myPntArray->AddVertex(aP1);
} else {
// The constraint attached to a point
std::shared_ptr<GeomAPI_Pnt2d> aPnt = SketcherPrs_Tools::getPoint(myConstraint,
SketchPlugin_Constraint::ENTITY_A());
std::shared_ptr<GeomAPI_Pnt> aPoint = myPlane->to3D(aPnt->x(), aPnt->y() + theStep);
- myPntArray->SetVertice(1, aPoint->impl<gp_Pnt>());
+ myPntArray->AddVertex(aPoint->impl<gp_Pnt>());
}
return true;
}
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep) const;
+ virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
};
Handle(OpenGl_View) aView = theWorkspace->View();
double aScale = aView->Camera()->Scale();
// Update points coordinate taking the viewer scale into account
- myObj->updateIfReadyToDisplay(MyDist * aScale);
+ myObj->updateIfReadyToDisplay(MyDist * aScale, myObj->myIsCustomColor);
if (myIsVboInit) {
if (myVboAttribs) {
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
: AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane), myIsCustomColor(false)
{
SetAutoHilight(Standard_False);
- myPntArray = new Graphic3d_ArrayOfPoints(1);
- myPntArray->AddVertex(0., 0., 0.);
}
//*********************************************************************************
// it updates array of points if the presentation is ready to display, or the array of points
// contains the previous values
- bool aReadyToDisplay = updateIfReadyToDisplay(20);
+ bool aReadyToDisplay = updateIfReadyToDisplay(20, myIsCustomColor);
int aNbVertex = myPntArray->VertexNumber();
if (myOwner.IsNull()) {
for (int i = 1; i <= aNbVertex; i++) {
Handle(SketcherPrs_SensitivePoint) aSP = new SketcherPrs_SensitivePoint(myOwner, i);
mySPoints.Append(aSP);
+ if (myIsCustomColor)
+ myPntArray->SetVertexColor(i, myCustomColor);
}
- Handle(OpenGl_Group) aGroup = Handle(OpenGl_Group)::DownCast(thePresentation->NewGroup());
+ Handle(OpenGl_Group) aGroup = Handle(OpenGl_Group)::DownCast(Prs3d_Root::CurrentGroup (thePresentation));
aGroup->SetPrimitivesAspect(myAspect);
// Recompute boundary box of the group
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep) const { return true; }
+ virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const { return true; }
/// Draw a shape into the given presentation scene
/// \param theShape the shape to draw
bool myIsCustomColor; /// state if the presentation is visualized in custom color
Quantity_Color myCustomColor; /// the color of mid ring if there is a conflict
- //Quantity_Color myIsCustomColor;
//bool myIsConflicting; /// state if the presentation is visualized in error state
Handle(Image_AlienPixMap) myErrorIcon;
Handle(Graphic3d_MarkerImage) myErrorImage;
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
- // Init default points
- myPntArray = new Graphic3d_ArrayOfPoints(2);
- myPntArray->AddVertex(0., 0., 0.);
- myPntArray->AddVertex(0., 0., 0.);
}
bool SketcherPrs_Tangent::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
return aReadyToDisplay;
}
-bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep) const
+bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep, bool withColor) const
{
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep);
gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep);
- myPntArray->SetVertice(1, aP1);
- myPntArray->SetVertice(2, aP2);
+ myPntArray = new Graphic3d_ArrayOfPoints(2, withColor);
+ myPntArray->AddVertex(aP1);
+ myPntArray->AddVertex(aP2);
return true;
}
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep) const;
+ virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
};
#endif
\ No newline at end of file
return aReadyToDisplay;
}
-bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep) const
+bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep, bool withColor) const
{
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
}
SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
- myPntArray = new Graphic3d_ArrayOfPoints(aNbB);
+ myPntArray = new Graphic3d_ArrayOfPoints(aNbB, withColor);
int i;
ObjectPtr aObj;
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep) const;
+ virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
private:
bool myIsTranslation;