Sketcher: New geometry color to indicate invalid sketch

This commit is contained in:
Abdullah Tahiri
2021-01-22 19:35:59 +01:00
committed by abdullahtahiriyo
parent 1e4551123d
commit bcfe7e96b0
2 changed files with 19 additions and 2 deletions

View File

@@ -151,7 +151,7 @@ SbColor ViewProviderSketch::FullyConstrainedColor (0.0f,1.0f,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)
SbColor ViewProviderSketch::NonDrivingConstrDimColor (0.0f,0.149f,1.0f); // #0026FF -> ( 0, 38,255)
SbColor ViewProviderSketch::ExprBasedConstrDimColor (1.0f,0.5f,0.149f); // #FF7F26 -> (255, 127, 38)
SbColor ViewProviderSketch::ExprBasedConstrDimColor (1.0f,0.5f,0.149f); // #FF7F26 -> (255, 127,38)
SbColor ViewProviderSketch::InformationColor (0.0f,1.0f,0.0f); // #00FF00 -> ( 0,255, 0)
SbColor ViewProviderSketch::PreselectColor (0.88f,0.88f,0.0f); // #E1E100 -> (225,225, 0)
SbColor ViewProviderSketch::SelectColor (0.11f,0.68f,0.11f); // #1CAD1C -> ( 28,173, 28)
@@ -163,6 +163,7 @@ SbColor ViewProviderSketch::FullyConstraintElementColor (0.50f,0.81f
SbColor ViewProviderSketch::FullyConstraintConstructionElementColor (0.56f,0.66f,0.99f); // #8FA9FD -> (143,169,253)
SbColor ViewProviderSketch::FullyConstraintInternalAlignmentColor (0.87f,0.87f,0.78f); // #DEDEC8 -> (222,222,200)
SbColor ViewProviderSketch::FullyConstraintConstructionPointColor (1.0f,0.58f,0.50f); // #FF9580 -> (255,149,128)
SbColor ViewProviderSketch::InvalidSketchColor (1.0f,0.42f,0.0f); // #FF6D00 -> (255,109, 0)
// Variables for holding previous click
SbTime ViewProviderSketch::prvClickTime;
SbVec2s ViewProviderSketch::prvClickPos;
@@ -2845,8 +2846,16 @@ void ViewProviderSketch::updateColor(void)
return false;
};
bool invalidSketch = getSketchObject()->getLastHasRedundancies() ||
getSketchObject()->getLastHasConflicts() ||
getSketchObject()->getLastHasMalformedConstraints();
// colors of the point set
if (edit->FullyConstrained) {
if( invalidSketch ) {
for (int i=0; i < PtNum; i++)
pcolor[i] = InvalidSketchColor;
}
else if (edit->FullyConstrained) {
for (int i=0; i < PtNum; i++)
pcolor[i] = FullyConstrainedColor;
}
@@ -2958,6 +2967,13 @@ void ViewProviderSketch::updateColor(void)
verts[j] = SbVec3f(x,y,zExtLine);
}
}
else if ( invalidSketch ) {
color[i] = InvalidSketchColor;
for (int k=j; j<k+indexes; j++) {
verts[j].getValue(x,y,z);
verts[j] = SbVec3f(x,y,zNormLine);
}
}
else if (isConstructionGeom(getSketchObject(), GeoId)) {
if(isInternalAlignedGeom(getSketchObject(), GeoId)) {
if(constrainedElement)

View File

@@ -444,6 +444,7 @@ protected:
static SbColor FullyConstraintConstructionElementColor;
static SbColor FullyConstraintInternalAlignmentColor;
static SbColor FullyConstraintConstructionPointColor;
static SbColor InvalidSketchColor;
static SbTime prvClickTime;
static SbVec2s prvClickPos; //used by double-click-detector