Sketcher: Support auto-constraints with root cross elements and swap axes colors
This commit is contained in:
parent
6d9539fb42
commit
b6eec06fa3
|
@ -141,25 +141,37 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
|||
// Get Preselection
|
||||
int preSelPnt = sketchgui->getPreselectPoint();
|
||||
int preSelCrv = sketchgui->getPreselectCurve();
|
||||
int preSelCrs = sketchgui->getPreselectCross();
|
||||
int GeoId = Constraint::GeoUndef;
|
||||
Sketcher::PointPos PosId = Sketcher::none;
|
||||
if (preSelPnt != -1)
|
||||
sketchgui->getSketchObject()->getGeoVertexIndex(preSelPnt, GeoId, PosId);
|
||||
else if (preSelCrv != -1)
|
||||
GeoId = preSelCrv;
|
||||
else if (preSelCrs == 0) { // root point
|
||||
GeoId = -1;
|
||||
PosId = Sketcher::start;
|
||||
}
|
||||
else if (preSelCrs == 1) // x axis
|
||||
GeoId = -1;
|
||||
else if (preSelCrs == 2) // y axis
|
||||
GeoId = -2;
|
||||
|
||||
if (GeoId == Constraint::GeoUndef)
|
||||
return suggestedConstraints.size();
|
||||
|
||||
// Currently only considers objects in current Sketcher
|
||||
AutoConstraint constr;
|
||||
constr.Type = Sketcher::None;
|
||||
constr.GeoId = GeoId;
|
||||
constr.PosId = PosId;
|
||||
if (type == AutoConstraint::VERTEX && preSelPnt != -1)
|
||||
if (type == AutoConstraint::VERTEX && PosId != Sketcher::none)
|
||||
constr.Type = Sketcher::Coincident;
|
||||
else if (type == AutoConstraint::CURVE && preSelPnt != -1)
|
||||
else if (type == AutoConstraint::CURVE && PosId != Sketcher::none)
|
||||
constr.Type = Sketcher::PointOnObject;
|
||||
else if (type == AutoConstraint::VERTEX && preSelCrv != -1)
|
||||
else if (type == AutoConstraint::VERTEX && PosId == Sketcher::none)
|
||||
constr.Type = Sketcher::PointOnObject;
|
||||
else if (type == AutoConstraint::CURVE && preSelCrv != -1)
|
||||
else if (type == AutoConstraint::CURVE && PosId == Sketcher::none)
|
||||
constr.Type = Sketcher::Tangent;
|
||||
|
||||
if (constr.Type != Sketcher::None)
|
||||
|
|
|
@ -107,8 +107,8 @@ SbColor ViewProviderSketch::VertexColor (1.0f,0.149f,0.0f); // #FF26
|
|||
SbColor ViewProviderSketch::CurveColor (1.0f,1.0f,1.0f); // #FFFFFF -> (255,255,255)
|
||||
SbColor ViewProviderSketch::CurveDraftColor (0.0f,0.0f,0.86f); // #0000DC -> ( 0, 0,220)
|
||||
SbColor ViewProviderSketch::CurveExternalColor (0.8f,0.2f,0.6f); // #CC3399 -> (204, 51,153)
|
||||
SbColor ViewProviderSketch::CrossColorV (0.8f,0.4f,0.4f); // #CC6666 -> (204,102,102)
|
||||
SbColor ViewProviderSketch::CrossColorH (0.4f,0.8f,0.4f); // #66CC66 -> (102,204,102)
|
||||
SbColor ViewProviderSketch::CrossColorH (0.8f,0.4f,0.4f); // #CC6666 -> (204,102,102)
|
||||
SbColor ViewProviderSketch::CrossColorV (0.4f,0.8f,0.4f); // #66CC66 -> (102,204,102)
|
||||
SbColor ViewProviderSketch::FullyConstrainedColor (0.0f,1.0f,0.0f); // #00FF00 -> ( 0,255, 0)
|
||||
SbColor ViewProviderSketch::ConstrDimColor (1.0f,0.149f,0.0f); // #FF2600 -> (255, 38, 0)
|
||||
SbColor ViewProviderSketch::ConstrIcoColor (1.0f,0.149f,0.0f); // #FF2600 -> (255, 38, 0)
|
||||
|
@ -3298,6 +3298,13 @@ int ViewProviderSketch::getPreselectCurve(void) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
int ViewProviderSketch::getPreselectCross(void) const
|
||||
{
|
||||
if (edit)
|
||||
return edit->PreselectCross;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ViewProviderSketch::getPreselectConstraint(void) const
|
||||
{
|
||||
if (edit)
|
||||
|
|
|
@ -164,6 +164,7 @@ public:
|
|||
float getScaleFactor();
|
||||
int getPreselectPoint(void) const;
|
||||
int getPreselectCurve(void) const;
|
||||
int getPreselectCross(void) const;
|
||||
int getPreselectConstraint(void) const;
|
||||
//@}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user