Sketcher: ViewProvider - Show Internal aligment geometry in different color
=========================================================================== The aim is to easily differentiate a circle that is a normal circle from a circle that is internal geometry, no matter if the normal circle is construction or not. The underlying reason is that next commits will introduce a different treatment for internal geometry circles being B-Spline poles, to which a new constraint Weight instead of a normal radius constraint will be applied, even though the representation continues to be as circles.
This commit is contained in:
committed by
abdullahtahiriyo
parent
e5eff3f06b
commit
8080e8df90
@@ -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();
|
||||
|
||||
@@ -221,6 +221,39 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_ia">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>182</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Internal alignment edge color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="InternalAlignedGeoColor">
|
||||
<property name="toolTip">
|
||||
<string>Color of edges of internal alignment geometry</string>
|
||||
</property>
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>178</red>
|
||||
<green>178</green>
|
||||
<blue>127</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>InternalAlignedGeoColor</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>View</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -233,7 +266,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="ExternalColor">
|
||||
<property name="toolTip">
|
||||
<string>Color of external geometry in edit mode</string>
|
||||
@@ -253,7 +286,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -266,7 +299,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="FullyConstrainedColor">
|
||||
<property name="toolTip">
|
||||
<string>Color of fully constrained geometry in edit mode</string>
|
||||
@@ -286,7 +319,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -299,7 +332,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="ConstrainedColor">
|
||||
<property name="toolTip">
|
||||
<string>Color of driving constraints in edit mode</string>
|
||||
@@ -319,14 +352,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Reference constraint color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="NonDrivingConstraintColor">
|
||||
<property name="toolTip">
|
||||
<string>Color of reference constraints in edit mode</string>
|
||||
@@ -346,14 +379,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="labelexpr">
|
||||
<property name="text">
|
||||
<string>Expression dependent constraint color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="ExprBasedConstrDimColor">
|
||||
<property name="toolTip">
|
||||
<string>Color of expression dependent constraints in edit mode</string>
|
||||
@@ -373,14 +406,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="labeldeact">
|
||||
<property name="text">
|
||||
<string>Deactivated constraint color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<item row="12" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="DeactivatedConstrDimColor">
|
||||
<property name="toolTip">
|
||||
<string>Color of deactivated constraints in edit mode</string>
|
||||
@@ -400,7 +433,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -413,7 +446,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="13" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="DatumColor">
|
||||
<property name="toolTip">
|
||||
<string>Color of the datum portion of a driving constraint</string>
|
||||
@@ -433,7 +466,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -446,7 +479,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<item row="14" column="1">
|
||||
<widget class="Gui::PrefSpinBox" name="SketcherDatumWidth">
|
||||
<property name="toolTip">
|
||||
<string>The default line thickness for new shapes</string>
|
||||
@@ -468,7 +501,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -481,7 +514,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<item row="15" column="1">
|
||||
<widget class="Gui::PrefSpinBox" name="DefaultSketcherVertexWidth">
|
||||
<property name="toolTip">
|
||||
<string>The default line thickness for new shapes</string>
|
||||
@@ -503,7 +536,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -516,7 +549,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<item row="16" column="1">
|
||||
<widget class="Gui::PrefSpinBox" name="DefaultSketcherLineWidth">
|
||||
<property name="toolTip">
|
||||
<string>The default line thickness for new shapes</string>
|
||||
@@ -538,7 +571,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<item row="17" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -551,7 +584,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1">
|
||||
<item row="17" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="CursorTextColor">
|
||||
<property name="toolTip">
|
||||
<string>Text color of the coordinates</string>
|
||||
@@ -571,7 +604,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<item row="18" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -584,7 +617,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="1">
|
||||
<item row="18" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="CursorCrosshairColor">
|
||||
<property name="toolTip">
|
||||
<string>Color of crosshair cursor.
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
#include <Mod/Part/App/BodyBase.h>
|
||||
#include <Mod/Sketcher/App/SketchObject.h>
|
||||
#include <Mod/Sketcher/App/Sketch.h>
|
||||
#include <Mod/Sketcher/App/GeometryFacade.h>
|
||||
|
||||
#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; j<k+indexes; j++) {
|
||||
verts[j].getValue(x,y,z);
|
||||
verts[j] = SbVec3f(x,y,zConstrLine);
|
||||
@@ -5827,6 +5847,10 @@ bool ViewProviderSketch::setEdit(int ModNum)
|
||||
color = (unsigned long)(CurveDraftColor.getPackedValue());
|
||||
color = hGrp->GetUnsigned("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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user