@@ -2411,14 +2411,9 @@ AcDbLine* PyDbLine::impObj(const std::source_location& src /*= std::source_locat
24112411
24122412// -----------------------------------------------------------------------------------
24132413// PyDbPolyline
2414- using AcDbPolylinePointer = AcDbObjectPointer<AcDbPolyline>;
2415-
2416- static auto shallowClone (const AcDbPolyline& pline) -> AcDbPolylinePointer
2414+ static auto shallowClone (const AcDbPolyline& pline) -> AcDbAcDbPolylineUPtr
24172415{
2418- AcDbPolylinePointer plineClone;
2419- auto _tmp = static_cast <AcDbPolyline*>(pline.clone ());
2420- plineClone.acquire (_tmp);
2421- return std::move (plineClone);
2416+ return AcDbAcDbPolylineUPtr{ static_cast <AcDbPolyline*>(pline.clone ()) };
24222417}
24232418
24242419static auto getCompositCurve (const AcDbPolyline& pline) -> std::unique_ptr<AcGeCompositeCurve3d>
@@ -2428,7 +2423,7 @@ static auto getCompositCurve(const AcDbPolyline& pline) -> std::unique_ptr<AcGeC
24282423 return std::unique_ptr<AcGeCompositeCurve3d>(static_cast <AcGeCompositeCurve3d*>(pcurve));
24292424}
24302425
2431- static auto getPolyPoints (const AcGeCompositeCurve3d& cc)
2426+ static auto getPolyPoints (const AcGeCompositeCurve3d& cc) -> AcGePoint3dArray
24322427{
24332428 AcGePoint3dArray polypoints;
24342429 AcGeVoidPointerArray curveList;
@@ -2454,8 +2449,7 @@ static auto getPolyPoints(const AcGeCompositeCurve3d& cc)
24542449 return polypoints;
24552450}
24562451
2457- // Utility function to test if a point is inside a polygon (2D)
2458- // Uses ray casting algorithm
2452+ // Utility function to test if a point is inside a polygon (2D), Uses ray casting algorithm
24592453static bool isPointInPolygon (const AcGePoint3dArray& polygon, const AcGePoint3d& testPoint)
24602454{
24612455 int n = polygon.length ();
@@ -2469,9 +2463,7 @@ static bool isPointInPolygon(const AcGePoint3dArray& polygon, const AcGePoint3d&
24692463 {
24702464 double xi = polygon[i].x , yi = polygon[i].y ;
24712465 double xj = polygon[j].x , yj = polygon[j].y ;
2472-
2473- bool intersect = ((yi > y) != (yj > y)) &&
2474- (x < (xj - xi) * (y - yi) / (yj - yi + 1e-12 ) + xi);
2466+ bool intersect = ((yi > y) != (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi + 1e-12 ) + xi);
24752467 if (intersect)
24762468 count++;
24772469 }
@@ -2544,7 +2536,7 @@ void makePyDbPolylineWrapper()
25442536 .def (" toPoint2dList" , &PyDbPolyline::toPoint2dList, DS.ARGS ())
25452537 .def (" toPoint3dList" , &PyDbPolyline::toPoint3dList, DS.ARGS ())
25462538 .def (" toList" , &PyDbPolyline::toList, DS.ARGS ())
2547- .def (" isPointInside" , &PyDbPolyline::isPointInside, DS.ARGS ({" point: PyGe.Point3d" }))
2539+ .def (" isPointInside" , &PyDbPolyline::isPointInside, DS.ARGS ({ " point: PyGe.Point3d" }))
25482540 .def (" className" , &PyDbPolyline::className, DS.SARGS ()).staticmethod (" className" )
25492541 .def (" desc" , &PyDbPolyline::desc, DS.SARGS (15560 )).staticmethod (" desc" )
25502542 .def (" cloneFrom" , &PyDbPolyline::cloneFrom, DS.SARGS ({ " otherObject: PyRx.RxObject" })).staticmethod (" cloneFrom" )
@@ -2957,7 +2949,7 @@ boost::python::list PyDbPolyline::toList() const
29572949
29582950bool PyDbPolyline::isPointInside (const AcGePoint3d& pnt) const
29592951{
2960- AcDbPolylinePointer plineClone = shallowClone (*impObj ());
2952+ auto plineClone = shallowClone (*impObj ());
29612953 plineClone->setClosed (true );
29622954 auto cc = getCompositCurve (*plineClone);
29632955 return isPointInPolygon (getPolyPoints (*cc), pnt);
0 commit comments