+
+bool GeomAPI_Curve::isEqual(const std::shared_ptr<GeomAPI_Curve>& theOther) const
+{
+ return MY_CURVE == theOther->impl<Handle_Geom_Curve>();
+}
+
+bool GeomAPI_Curve::isTrimmed() const
+{
+ return !isNull() && MY_CURVE->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve);
+}
+
+GeomCurvePtr GeomAPI_Curve::basisCurve() const
+{
+ Handle(Geom_Curve) aCurve = MY_CURVE;
+ if (aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve))
+ aCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve)->BasisCurve();
+
+ GeomCurvePtr aNewCurve(new GeomAPI_Curve);
+ aNewCurve->setImpl(new Handle(Geom_Curve)(aCurve));
+ return aNewCurve;
+}
+
+
+const std::shared_ptr<GeomAPI_Pnt> GeomAPI_Curve::project(
+ const std::shared_ptr<GeomAPI_Pnt>& thePoint) const
+{
+ std::shared_ptr<GeomAPI_Pnt> aResult;
+ if (MY_CURVE.IsNull())
+ return aResult;
+
+ const gp_Pnt& aPoint = thePoint->impl<gp_Pnt>();
+
+ GeomAPI_ProjectPointOnCurve aProj(aPoint, MY_CURVE);
+ Standard_Integer aNbPoint = aProj.NbPoints();
+ if (aNbPoint > 0) {
+ gp_Pnt aNearest = aProj.NearestPoint();
+ aResult = GeomPointPtr(new GeomAPI_Pnt(aNearest.X(), aNearest.Y(), aNearest.Z()));
+ }
+ return aResult;
+}
+
+// ================================================================================================
+
+bool GeomAPI_Curve::Comparator::operator()(const GeomCurvePtr& theCurve1,
+ const GeomCurvePtr& theCurve2) const
+{
+ const Handle(Geom_Curve)& aCurve1 = theCurve1->impl<Handle_Geom_Curve>();
+ const Handle(Geom_Curve)& aCurve2 = theCurve2->impl<Handle_Geom_Curve>();
+ return aCurve1.get() < aCurve2.get();
+}