| |
|
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| |
|
| | #include <FCConfig.h>
|
| |
|
| | #include <Standard_Version.hxx>
|
| | #if OCC_VERSION_HEX < 0x070600
|
| | # include <BRepAdaptor_HCurve.hxx>
|
| | #endif
|
| | #include <Approx_Curve3d.hxx>
|
| | #include <BRepAdaptor_Curve.hxx>
|
| | #include <BRepBuilderAPI_MakeEdge.hxx>
|
| | #include <BRepBuilderAPI_MakeVertex.hxx>
|
| | #include <BRep_Builder.hxx>
|
| | #include <GCPnts_UniformAbscissa.hxx>
|
| | #include <GeomAPI_Interpolate.hxx>
|
| | #include <GeomAPI_PointsToBSpline.hxx>
|
| | #include <Geom_BSplineCurve.hxx>
|
| | #include <TColgp_Array1OfPnt.hxx>
|
| | #include <TopExp_Explorer.hxx>
|
| | #include <TopoDS.hxx>
|
| | #include <TopoDS_Compound.hxx>
|
| | #include <TopoDS_Edge.hxx>
|
| | #include <TopoDS_Shape.hxx>
|
| | #include <TopoDS_Vertex.hxx>
|
| | #include <gp_Ax1.hxx>
|
| | #include <gp_Ax2.hxx>
|
| | #include <gp_Circ.hxx>
|
| | #include <gp_Dir.hxx>
|
| | #include <gp_Elips.hxx>
|
| | #include <gp_Pnt.hxx>
|
| | #include <gp_Vec.hxx>
|
| |
|
| | #include <regex>
|
| |
|
| | #include <App/Link.h>
|
| |
|
| | #include <Gui/Application.h>
|
| | #include <Gui/ViewProvider.h>
|
| | #include <Gui/ViewProviderDocumentObject.h>
|
| | #include <Gui/ViewProviderLink.h>
|
| | #include <Mod/Part/Gui/ViewProvider.h>
|
| |
|
| | #include "ImpExpDxfGui.h"
|
| |
|
| | using namespace ImportGui;
|
| |
|
| | ImpExpDxfReadGui::ImpExpDxfReadGui(const std::string& filepath, App::Document* pcDoc)
|
| | : ImpExpDxfRead(filepath, pcDoc)
|
| | , GuiDocument(Gui::Application::Instance->getDocument(pcDoc))
|
| | {}
|
| |
|
| | void ImpExpDxfReadGui::ApplyGuiStyles(Part::Feature* object) const
|
| | {
|
| | auto view = static_cast<PartGui::ViewProviderPart*>(GuiDocument->getViewProvider(object));
|
| | Base::Color color = ObjectColor(m_entityAttributes.m_Color);
|
| | view->LineColor.setValue(color);
|
| | view->PointColor.setValue(color);
|
| | view->ShapeAppearance.setDiffuseColor(color);
|
| | view->DrawStyle.setValue(GetDrawStyle());
|
| | view->Transparency.setValue(0);
|
| | }
|
| |
|
| | void ImpExpDxfReadGui::ApplyGuiStyles(App::Link* object) const
|
| | {
|
| | auto view = GuiDocument->getViewProvider(object);
|
| |
|
| |
|
| | auto* vpLink = dynamic_cast<Gui::ViewProviderLink*>(view);
|
| | if (!vpLink) {
|
| | return;
|
| | }
|
| |
|
| | if (m_preserveColors) {
|
| |
|
| |
|
| |
|
| | Base::Color color = ObjectColor(m_entityAttributes.m_Color);
|
| |
|
| |
|
| |
|
| |
|
| | if (auto* prop = view->getPropertyByName("LineColor")) {
|
| | static_cast<App::PropertyColor*>(prop)->setValue(color);
|
| | }
|
| | if (auto* prop = view->getPropertyByName("PointColor")) {
|
| | static_cast<App::PropertyColor*>(prop)->setValue(color);
|
| | }
|
| | if (auto* prop = view->getPropertyByName("ShapeColor")) {
|
| | static_cast<App::PropertyColor*>(prop)->setValue(color);
|
| | }
|
| | if (auto* prop = view->getPropertyByName("DrawStyle")) {
|
| | static_cast<App::PropertyEnumeration*>(prop)->setValue(GetDrawStyle());
|
| | }
|
| | if (auto* prop = view->getPropertyByName("Transparency")) {
|
| | static_cast<App::PropertyInteger*>(prop)->setValue(0);
|
| | }
|
| | }
|
| | }
|
| |
|
| | void ImpExpDxfReadGui::ApplyGuiStyles(App::FeaturePython* object) const
|
| | {
|
| | static Base::Type PropertyColorType = App::PropertyColor::getClassTypeId();
|
| |
|
| | auto view = static_cast<Gui::ViewProviderDocumentObject*>(GuiDocument->getViewProvider(object));
|
| | Base::Color color = ObjectColor(m_entityAttributes.m_Color);
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | auto prop = view->getPropertyByName("TextColor");
|
| | if (prop != nullptr && prop->getTypeId() == PropertyColorType) {
|
| | static_cast<App::PropertyColor*>(prop)->setValue(color);
|
| | }
|
| | prop = view->getPropertyByName("LineColor");
|
| | if (prop != nullptr && prop->getTypeId() == PropertyColorType) {
|
| | static_cast<App::PropertyColor*>(prop)->setValue(color);
|
| | }
|
| | prop = view->getPropertyByName("DrawStyle");
|
| | if (prop != nullptr && prop->getTypeId() == PropertyColorType) {
|
| | static_cast<App::PropertyColor*>(prop)->setValue(GetDrawStyle());
|
| | }
|
| | }
|
| |
|
| | int ImpExpDxfReadGui::GetDrawStyle() const
|
| | {
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | static std::array<std::regex, 4> matchers {
|
| |
|
| |
|
| |
|
| | std::basic_regex("^cont|^byblock$", std::regex::icase),
|
| |
|
| | std::basic_regex("^hidden|^border|^dash", std::regex::icase),
|
| |
|
| | std::basic_regex("^dot", std::regex::icase),
|
| |
|
| | std::basic_regex("dot.*dash|dash.*dot|^cent(er|re)|^divide|^phantom", std::regex::icase)
|
| | };
|
| |
|
| |
|
| |
|
| |
|
| | for (int i = matchers.size(); --i >= 0;) {
|
| | if (regex_search(m_entityAttributes.m_LineType, matchers.at(i))) {
|
| | return i;
|
| | }
|
| | }
|
| |
|
| | return 0;
|
| | }
|
| |
|