+bool Model_Objects::isLater(FeaturePtr theLater, FeaturePtr theCurrent) const
+{
+ std::shared_ptr<Model_Data> aLaterD = std::static_pointer_cast<Model_Data>(theLater->data());
+ std::shared_ptr<Model_Data> aCurrentD = std::static_pointer_cast<Model_Data>(theCurrent->data());
+ if (aLaterD && aLaterD->isValid() && aCurrentD && aCurrentD->isValid()) {
+ TDF_Label aLaterL = aLaterD->label().Father();
+ TDF_Label aCurrentL = aCurrentD->label().Father();
+ int aLaterI = -1, aCurentI = -1; // not found yet state
+ Handle(TDataStd_ReferenceArray) aRefs;
+ if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) {
+ for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { // iterate all existing features
+ TDF_Label aCurLab = aRefs->Value(a);
+ if (aCurLab.IsEqual(aLaterL)) {
+ aLaterI = a;
+ } else if (aCurLab.IsEqual(aCurrentL)) {
+ aCurentI = a;
+ } else continue;
+ if (aLaterI != -1 && aCurentI != -1) // both are found
+ return aLaterI > aCurentI;
+ }
+ }
+ }
+ return false; // not found, or something is wrong
+}
+