当前位置: 首页>>代码示例>>C++>>正文


C++ Handle_Geom_Curve::DynamicType方法代码示例

本文整理汇总了C++中Handle_Geom_Curve::DynamicType方法的典型用法代码示例。如果您正苦于以下问题:C++ Handle_Geom_Curve::DynamicType方法的具体用法?C++ Handle_Geom_Curve::DynamicType怎么用?C++ Handle_Geom_Curve::DynamicType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Handle_Geom_Curve的用法示例。


在下文中一共展示了Handle_Geom_Curve::DynamicType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: convert_to_ifc

int convert_to_ifc(const TopoDS_Wire& wire, IfcSchema::IfcLoop*& loop, bool advanced) {
	bool polygonal = true;
	for (TopExp_Explorer exp(wire, TopAbs_EDGE); exp.More(); exp.Next()) {
		double a, b;
		Handle_Geom_Curve crv = BRep_Tool::Curve(TopoDS::Edge(exp.Current()), a, b);
		if (crv.IsNull()) {
			continue;
		}
		if (crv->DynamicType() != STANDARD_TYPE(Geom_Line)) {
			polygonal = false;
			break;
		}
	}
	if (!polygonal && !advanced) {
		return 0;
	} else if (polygonal && !advanced) {
		IfcSchema::IfcCartesianPoint::list::ptr points(new IfcSchema::IfcCartesianPoint::list);
		BRepTools_WireExplorer exp(wire);
		IfcSchema::IfcCartesianPoint* p;
		for (; exp.More(); exp.Next()) {
			if (convert_to_ifc(exp.CurrentVertex(), p, advanced)) {
				points->push(p);
			} else {
				return 0;
			}
		}
		loop = new IfcSchema::IfcPolyLoop(points);
		return 1;
	} else {
		IfcSchema::IfcOrientedEdge::list::ptr edges(new IfcSchema::IfcOrientedEdge::list);
		BRepTools_WireExplorer exp(wire);
		for (; exp.More(); exp.Next()) {
			IfcSchema::IfcEdge* edge;
			// With advanced set to true convert_to_ifc(TopoDS_Edge&) will always create an IfcOrientedEdge
			if (!convert_to_ifc(exp.Current(), edge, true)) {
				double a, b;
				if (BRep_Tool::Curve(TopoDS::Edge(exp.Current()), a, b).IsNull()) {
					continue;
				} else {
					return 0;
				}
			}
			edges->push(edge->as<IfcSchema::IfcOrientedEdge>());
		}
		loop = new IfcSchema::IfcEdgeLoop(edges);
		return 1;
	}
}
开发者ID:berndhahnebach,项目名称:IfcOpenShell,代码行数:48,代码来源:IfcGeomSerialisation.cpp

示例2: asObject

const Py::Object makeGeometryCurvePy(const Handle_Geom_Curve& c)
{
    if (c->IsKind(STANDARD_TYPE(Geom_Circle))) {
        Handle_Geom_Circle circ = Handle_Geom_Circle::DownCast(c);
        return Py::asObject(new CirclePy(new GeomCircle(circ)));
    }
    else if (c->IsKind(STANDARD_TYPE(Geom_Ellipse))) {
        Handle_Geom_Ellipse ell = Handle_Geom_Ellipse::DownCast(c);
        return Py::asObject(new EllipsePy(new GeomEllipse(ell)));
    }
    else if (c->IsKind(STANDARD_TYPE(Geom_Hyperbola))) {
        Handle_Geom_Hyperbola hyp = Handle_Geom_Hyperbola::DownCast(c);
        return Py::asObject(new HyperbolaPy(new GeomHyperbola(hyp)));
    }
    else if (c->IsKind(STANDARD_TYPE(Geom_Line))) {
        Handle_Geom_Line lin = Handle_Geom_Line::DownCast(c);
        return Py::asObject(new GeometryCurvePy(new GeomLine(lin)));
    }
    else if (c->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) {
        Handle_Geom_OffsetCurve oc = Handle_Geom_OffsetCurve::DownCast(c);
        return Py::asObject(new OffsetCurvePy(new GeomOffsetCurve(oc)));
    }
    else if (c->IsKind(STANDARD_TYPE(Geom_Parabola))) {
        Handle_Geom_Parabola par = Handle_Geom_Parabola::DownCast(c);
        return Py::asObject(new ParabolaPy(new GeomParabola(par)));
    }
    else if (c->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
        Handle_Geom_TrimmedCurve trc = Handle_Geom_TrimmedCurve::DownCast(c);
        return Py::asObject(new GeometryCurvePy(new GeomTrimmedCurve(trc)));
    }
    /*else if (c->IsKind(STANDARD_TYPE(Geom_BoundedCurve))) {
        Handle_Geom_BoundedCurve bc = Handle_Geom_BoundedCurve::DownCast(c);
        return Py::asObject(new GeometryCurvePy(new GeomBoundedCurve(bc)));
    }*/
    else if (c->IsKind(STANDARD_TYPE(Geom_BezierCurve))) {
        Handle_Geom_BezierCurve bezier = Handle_Geom_BezierCurve::DownCast(c);
        return Py::asObject(new BezierCurvePy(new GeomBezierCurve(bezier)));
    }
    else if (c->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
        Handle_Geom_BSplineCurve bspline = Handle_Geom_BSplineCurve::DownCast(c);
        return Py::asObject(new BSplineCurvePy(new GeomBSplineCurve(bspline)));
    }

    std::string err = "Unhandled curve type ";
    err += c->DynamicType()->Name();
    throw Py::TypeError(err);
}
开发者ID:hemanshupa,项目名称:FreeCAD_sf_master,代码行数:47,代码来源:GeometrySurfacePyImp.cpp


注:本文中的Handle_Geom_Curve::DynamicType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。