Base: Move App::Color to Base
Every basic data type is stored in Base module, color is standing out as one that does not. Moving it to Base opens possibilities to integrate it better with the rest of FreeCAD.
This commit is contained in:
@@ -341,8 +341,8 @@ private:
|
||||
return Py::None();
|
||||
}
|
||||
|
||||
static std::map<std::string, App::Color> getShapeColors(App::DocumentObject* obj,
|
||||
const char* subname)
|
||||
static std::map<std::string, Base::Color> getShapeColors(App::DocumentObject* obj,
|
||||
const char* subname)
|
||||
{
|
||||
auto vp = Gui::Application::Instance->getViewProvider(obj);
|
||||
if (vp) {
|
||||
|
||||
@@ -35,7 +35,7 @@ ExportOCAFGui::ExportOCAFGui(Handle(TDocStd_Document) hDoc, bool explicitPlaceme
|
||||
: ExportOCAF(hDoc, explicitPlacement)
|
||||
{}
|
||||
|
||||
void ExportOCAFGui::findColors(Part::Feature* part, std::vector<App::Color>& colors) const
|
||||
void ExportOCAFGui::findColors(Part::Feature* part, std::vector<Base::Color>& colors) const
|
||||
{
|
||||
Gui::ViewProvider* vp = Gui::Application::Instance->getViewProvider(part);
|
||||
if (vp && vp->isDerivedFrom<PartGui::ViewProviderPartExt>()) {
|
||||
|
||||
@@ -33,7 +33,7 @@ class ExportOCAFGui: public Import::ExportOCAF
|
||||
{
|
||||
public:
|
||||
ExportOCAFGui(Handle(TDocStd_Document) hDoc, bool explicitPlacement);
|
||||
void findColors(Part::Feature* part, std::vector<App::Color>& colors) const override;
|
||||
void findColors(Part::Feature* part, std::vector<Base::Color>& colors) const override;
|
||||
};
|
||||
|
||||
} // namespace ImportGui
|
||||
|
||||
@@ -38,7 +38,7 @@ ImportOCAFGui::ImportOCAFGui(Handle(TDocStd_Document) hDoc,
|
||||
: ImportOCAF2(hDoc, pDoc, name)
|
||||
{}
|
||||
|
||||
void ImportOCAFGui::applyFaceColors(Part::Feature* part, const std::vector<App::Color>& colors)
|
||||
void ImportOCAFGui::applyFaceColors(Part::Feature* part, const std::vector<Base::Color>& colors)
|
||||
{
|
||||
auto vp = dynamic_cast<PartGui::ViewProviderPartExt*>(
|
||||
Gui::Application::Instance->getViewProvider(part));
|
||||
@@ -58,7 +58,7 @@ void ImportOCAFGui::applyFaceColors(Part::Feature* part, const std::vector<App::
|
||||
}
|
||||
}
|
||||
|
||||
void ImportOCAFGui::applyEdgeColors(Part::Feature* part, const std::vector<App::Color>& colors)
|
||||
void ImportOCAFGui::applyEdgeColors(Part::Feature* part, const std::vector<Base::Color>& colors)
|
||||
{
|
||||
auto vp = dynamic_cast<PartGui::ViewProviderPartExt*>(
|
||||
Gui::Application::Instance->getViewProvider(part));
|
||||
@@ -73,7 +73,7 @@ void ImportOCAFGui::applyEdgeColors(Part::Feature* part, const std::vector<App::
|
||||
}
|
||||
}
|
||||
|
||||
void ImportOCAFGui::applyLinkColor(App::DocumentObject* obj, int index, App::Color color)
|
||||
void ImportOCAFGui::applyLinkColor(App::DocumentObject* obj, int index, Base::Color color)
|
||||
{
|
||||
auto vp =
|
||||
dynamic_cast<Gui::ViewProviderLink*>(Gui::Application::Instance->getViewProvider(obj));
|
||||
@@ -98,7 +98,7 @@ void ImportOCAFGui::applyLinkColor(App::DocumentObject* obj, int index, App::Col
|
||||
}
|
||||
|
||||
void ImportOCAFGui::applyElementColors(App::DocumentObject* obj,
|
||||
const std::map<std::string, App::Color>& colors)
|
||||
const std::map<std::string, Base::Color>& colors)
|
||||
{
|
||||
auto vp = Gui::Application::Instance->getViewProvider(obj);
|
||||
if (!vp) {
|
||||
|
||||
@@ -36,11 +36,11 @@ public:
|
||||
ImportOCAFGui(Handle(TDocStd_Document) hDoc, App::Document* pDoc, const std::string& name);
|
||||
|
||||
private:
|
||||
void applyFaceColors(Part::Feature* part, const std::vector<App::Color>& colors) override;
|
||||
void applyEdgeColors(Part::Feature* part, const std::vector<App::Color>& colors) override;
|
||||
void applyLinkColor(App::DocumentObject* obj, int index, App::Color color) override;
|
||||
void applyFaceColors(Part::Feature* part, const std::vector<Base::Color>& colors) override;
|
||||
void applyEdgeColors(Part::Feature* part, const std::vector<Base::Color>& colors) override;
|
||||
void applyLinkColor(App::DocumentObject* obj, int index, Base::Color color) override;
|
||||
void applyElementColors(App::DocumentObject* obj,
|
||||
const std::map<std::string, App::Color>& colors) override;
|
||||
const std::map<std::string, Base::Color>& colors) override;
|
||||
};
|
||||
|
||||
} // namespace ImportGui
|
||||
|
||||
@@ -69,7 +69,7 @@ ImpExpDxfReadGui::ImpExpDxfReadGui(const std::string& filepath, App::Document* p
|
||||
void ImpExpDxfReadGui::ApplyGuiStyles(Part::Feature* object) const
|
||||
{
|
||||
auto view = static_cast<PartGui::ViewProviderPart*>(GuiDocument->getViewProvider(object));
|
||||
App::Color color = ObjectColor(m_entityAttributes.m_Color);
|
||||
Base::Color color = ObjectColor(m_entityAttributes.m_Color);
|
||||
view->LineColor.setValue(color);
|
||||
view->PointColor.setValue(color);
|
||||
view->ShapeAppearance.setDiffuseColor(color);
|
||||
@@ -82,7 +82,7 @@ void ImpExpDxfReadGui::ApplyGuiStyles(App::FeaturePython* object) const
|
||||
static Base::Type PropertyColorType = App::PropertyColor::getClassTypeId();
|
||||
|
||||
auto view = static_cast<Gui::ViewProviderDocumentObject*>(GuiDocument->getViewProvider(object));
|
||||
App::Color color = ObjectColor(m_entityAttributes.m_Color);
|
||||
Base::Color color = ObjectColor(m_entityAttributes.m_Color);
|
||||
|
||||
// The properties on this object depend on which Python object is wrapped around it.
|
||||
// For now we look for the two colors we expect in text and dimensions, and check that they
|
||||
|
||||
Reference in New Issue
Block a user