diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.cpp b/src/Mod/Sketcher/Gui/SketcherSettings.cpp index dc69ebcad2..dbf99822e7 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.cpp +++ b/src/Mod/Sketcher/Gui/SketcherSettings.cpp @@ -260,6 +260,7 @@ void SketcherSettingsColors::saveSettings() ui->ConstructionColor->onSave(); ui->ExternalColor->onSave(); ui->FullyConstrainedColor->onSave(); + ui->InternalAlignedGeoColor->onSave(); ui->ConstrainedColor->onSave(); ui->NonDrivingConstraintColor->onSave(); @@ -286,6 +287,7 @@ void SketcherSettingsColors::loadSettings() ui->ConstructionColor->onRestore(); ui->ExternalColor->onRestore(); ui->FullyConstrainedColor->onRestore(); + ui->InternalAlignedGeoColor->onRestore(); ui->ConstrainedColor->onRestore(); ui->NonDrivingConstraintColor->onRestore(); diff --git a/src/Mod/Sketcher/Gui/SketcherSettingsColors.ui b/src/Mod/Sketcher/Gui/SketcherSettingsColors.ui index 9235a4d255..895c864824 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettingsColors.ui +++ b/src/Mod/Sketcher/Gui/SketcherSettingsColors.ui @@ -221,6 +221,39 @@ + + + + 182 + 0 + + + + Internal alignment edge color + + + + + + + Color of edges of internal alignment geometry + + + + 178 + 178 + 127 + + + + InternalAlignedGeoColor + + + View + + + + @@ -233,7 +266,7 @@ - + Color of external geometry in edit mode @@ -253,7 +286,7 @@ - + @@ -266,7 +299,7 @@ - + Color of fully constrained geometry in edit mode @@ -286,7 +319,7 @@ - + @@ -299,7 +332,7 @@ - + Color of driving constraints in edit mode @@ -319,14 +352,14 @@ - + Reference constraint color - + Color of reference constraints in edit mode @@ -346,14 +379,14 @@ - + Expression dependent constraint color - + Color of expression dependent constraints in edit mode @@ -373,14 +406,14 @@ - + Deactivated constraint color - + Color of deactivated constraints in edit mode @@ -400,7 +433,7 @@ - + @@ -413,7 +446,7 @@ - + Color of the datum portion of a driving constraint @@ -433,7 +466,7 @@ - + @@ -446,7 +479,7 @@ - + The default line thickness for new shapes @@ -468,7 +501,7 @@ - + @@ -481,7 +514,7 @@ - + The default line thickness for new shapes @@ -503,7 +536,7 @@ - + @@ -516,7 +549,7 @@ - + The default line thickness for new shapes @@ -538,7 +571,7 @@ - + @@ -551,7 +584,7 @@ - + Text color of the coordinates @@ -571,7 +604,7 @@ - + @@ -584,7 +617,7 @@ - + Color of crosshair cursor. diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 6fbe9fccbf..178cfb0452 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -110,6 +110,7 @@ #include #include #include +#include #include "SoZoomTranslation.h" #include "SoDatumLabel.h" @@ -158,6 +159,7 @@ SbColor ViewProviderSketch::SelectColor (0.11f,0.68f,0.11f); // SbColor ViewProviderSketch::PreselectSelectedColor (0.36f,0.48f,0.11f); // #5D7B1C -> ( 93,123, 28) SbColor ViewProviderSketch::CreateCurveColor (0.8f,0.8f,0.8f); // #CCCCCC -> (204,204,204) SbColor ViewProviderSketch::DeactivatedConstrDimColor (0.8f,0.8f,0.8f); // #CCCCCC -> (204,204,204) +SbColor ViewProviderSketch::InternalAlignedGeoColor (0.7f,0.7f,0.5f); // #B2B27F -> (178,178,127) // Variables for holding previous click SbTime ViewProviderSketch::prvClickTime; SbVec2s ViewProviderSketch::prvClickPos; @@ -2636,14 +2638,38 @@ void ViewProviderSketch::updateColor(void) float x,y,z; + // use a lambda function to only access the geometry when needed + // and properly handle the case where it's null + auto isConstructionGeom = [](Sketcher::SketchObject* obj, int GeoId) -> bool { + const Part::Geometry* geom = obj->getGeometry(GeoId); + if (geom) + return geom->getConstruction(); + return false; + }; + + auto isInternalAlignedGeom = [](Sketcher::SketchObject* obj, int GeoId) -> bool { + const Part::Geometry* geom = obj->getGeometry(GeoId); + if (geom) { + auto gf = Sketcher::GeometryFacade::getFacade(geom); + return gf->isInternalAligned(); + } + return false; + }; + // colors of the point set if (edit->FullyConstrained) { for (int i=0; i < PtNum; i++) pcolor[i] = FullyConstrainedColor; } else { - for (int i=0; i < PtNum; i++) - pcolor[i] = VertexColor; + for (int i=0; i < PtNum; i++) { + int GeoId = edit->PointIdToGeoId[i]; + + if(isInternalAlignedGeom(getSketchObject(), GeoId)) + pcolor[i] = InternalAlignedGeoColor; + else + pcolor[i] = VertexColor; + } } for (int i=0; i < PtNum; i++) { // 0 is the origin @@ -2683,16 +2709,6 @@ void ViewProviderSketch::updateColor(void) float zConstrLine = (topid==2?zHighLines:midid==2?zMidLines:zLowLines); float zExtLine = (topid==3?zHighLines:midid==3?zMidLines:zLowLines); - // use a lambda function to only access the geometry when needed - // and properly handle the case where it's null - auto isConstructionGeom = [](Sketcher::SketchObject* obj, int GeoId) -> bool { - const Part::Geometry* geom = obj->getGeometry(GeoId); - if (geom) - return geom->getConstruction(); - return false; - }; - - int j=0; // vertexindex for (int i=0; i < CurvNum; i++) { @@ -2733,7 +2749,11 @@ void ViewProviderSketch::updateColor(void) } } else if (isConstructionGeom(getSketchObject(), GeoId)) { - color[i] = CurveDraftColor; + if(isInternalAlignedGeom(getSketchObject(), GeoId)) + color[i] = InternalAlignedGeoColor; + else + color[i] = CurveDraftColor; + for (int k=j; jGetUnsigned("ConstructionColor", color); CurveDraftColor.setPackedValue((uint32_t)color, transparency); + // set the construction curve color + color = (unsigned long)(InternalAlignedGeoColor.getPackedValue()); + color = hGrp->GetUnsigned("InternalAlignedGeoColor", color); + InternalAlignedGeoColor.setPackedValue((uint32_t)color, transparency); // set the cross lines color //CrossColorV.setPackedValue((uint32_t)color, transparency); //CrossColorH.setPackedValue((uint32_t)color, transparency); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.h b/src/Mod/Sketcher/Gui/ViewProviderSketch.h index ffb3a571e5..ab0aad8701 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.h +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.h @@ -400,6 +400,7 @@ protected: static SbColor PreselectSelectedColor; static SbColor InformationColor; static SbColor DeactivatedConstrDimColor; + static SbColor InternalAlignedGeoColor; static SbTime prvClickTime; static SbVec2s prvClickPos; //used by double-click-detector