Sketcher: fix for issue 12925

This commit is contained in:
wmayer
2025-07-10 14:54:36 +02:00
committed by Chris Hennes
parent ff03f3f182
commit 402d533bff
2 changed files with 31 additions and 0 deletions

View File

@@ -499,12 +499,31 @@ struct CoinMapping
{
return CurvIdToGeoId[layerindex][sublayerindex][curveindex];
}
bool isValidCurveId(int curveindex, int layerindex, int sublayerindex = 0) const
{
// clang-format off
return static_cast<int>(CurvIdToGeoId.size()) > layerindex &&
static_cast<int>(CurvIdToGeoId[layerindex].size()) > sublayerindex &&
static_cast<int>(CurvIdToGeoId[layerindex][sublayerindex].size()) > curveindex;
// clang-format on
}
/// given the MF index of a point and the coin layer in which it is drawn returns the GeoId of
/// the point
int getPointGeoId(int pointindex, int layerindex)
{
return PointIdToGeoId[layerindex][pointindex];
}
bool isValidPointId(int pointindex, int layerindex) const
{
// clang-format off
return static_cast<int>(PointIdToGeoId.size()) > layerindex &&
static_cast<int>(PointIdToGeoId[layerindex].size()) > pointindex;
// clang-format on
}
/// given the MF index of a point and the coin layer in which it is drawn returns the PosId of
/// the point
Sketcher::PointPos getPointPosId(int pointindex, int layerindex)

View File

@@ -203,6 +203,10 @@ void EditModeGeometryCoinManager::updateGeometryColor(const GeoListFacade& geoli
// colors of the point set
for (int i = 0; i < PtNum; i++) {
if (!coinMapping.isValidPointId(i, l)) {
continue;
}
int GeoId = coinMapping.getPointGeoId(i, l);
Sketcher::PointPos PosId = coinMapping.getPointPosId(i, l);
bool isExternal = GeoId < -1;
@@ -303,6 +307,10 @@ void EditModeGeometryCoinManager::updateGeometryColor(const GeoListFacade& geoli
pverts[i].setValue(0, 0, viewOrientationFactor * drawingParameters.zRootPoint);
}
else {
if (!coinMapping.isValidPointId(i, l)) {
continue;
}
int GeoId = coinMapping.getPointGeoId(i, l);
Sketcher::PointPos PosId = coinMapping.getPointPosId(i, l);
pverts[i].getValue(x, y, z);
@@ -405,6 +413,10 @@ void EditModeGeometryCoinManager::updateGeometryColor(const GeoListFacade& geoli
int j = 0; // vertexindex
for (int i = 0; i < CurvNum; i++) {
if (!coinMapping.isValidCurveId(i, l, t)) {
continue;
}
int GeoId = coinMapping.getCurveGeoId(i, l, t);
// CurvId has several vertices associated to 1 material
// edit->CurveSet->numVertices => [i] indicates number of vertex for line i.