+ fixes #0001873: Error working with getSelectionEx()[0].SubObjects

This commit is contained in:
wmayer 2014-12-23 22:04:34 +01:00
parent 11a4025c4b
commit 33bc596fd8

View File

@ -1553,6 +1553,7 @@ bool ViewProviderSketch::detectPreselection(const SoPickedPoint *Point,
assert(edit);
int PtIndex = -1;
int EdgeIndex = -1;
int GeoIndex = -1; // valid values are 0,1,2,... for normal geometry and -3,-4,-5,... for external geometry
int CrossIndex = -1;
std::set<int> constrIndices;
@ -1579,8 +1580,9 @@ bool ViewProviderSketch::detectPreselection(const SoPickedPoint *Point,
const SoDetail *curve_detail = Point->getDetail(edit->CurveSet);
if (curve_detail && curve_detail->getTypeId() == SoLineDetail::getClassTypeId()) {
// get the index
int CurvIndex = static_cast<const SoLineDetail *>(curve_detail)->getLineIndex();
GeoIndex = edit->CurvIdToGeoId[CurvIndex];
int curveIndex = static_cast<const SoLineDetail *>(curve_detail)->getLineIndex();
GeoIndex = edit->CurvIdToGeoId[curveIndex];
EdgeIndex = curveIndex;
}
// checking for a hit in the cross
} else if (tail == edit->RootCrossSet) {
@ -1619,7 +1621,7 @@ bool ViewProviderSketch::detectPreselection(const SoPickedPoint *Point,
} else if (GeoIndex != -1 && GeoIndex != edit->PreselectCurve) { // if a new curve is hit
std::stringstream ss;
if (GeoIndex >= 0)
ss << "Edge" << GeoIndex + 1;
ss << "Edge" << EdgeIndex + 1;
else // external geometry
ss << "ExternalEdge" << -GeoIndex - 2; // convert index start from -3 to 1
bool accepted =