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:
@@ -273,7 +273,6 @@ SET(FreeCADApp_CPP_SRCS
|
||||
AutoTransaction.cpp
|
||||
Branding.cpp
|
||||
CleanupProcess.cpp
|
||||
Color.cpp
|
||||
ColorModel.cpp
|
||||
ComplexGeoData.cpp
|
||||
ComplexGeoDataPyImp.cpp
|
||||
@@ -303,7 +302,6 @@ SET(FreeCADApp_HPP_SRCS
|
||||
AutoTransaction.h
|
||||
Branding.h
|
||||
CleanupProcess.h
|
||||
Color.h
|
||||
ColorModel.h
|
||||
ComplexGeoData.h
|
||||
ElementMap.h
|
||||
|
||||
@@ -138,8 +138,8 @@ void ColorField::rebuild()
|
||||
fConstant = -fAscent * fMin;
|
||||
}
|
||||
|
||||
// fuellt das Array von Farbe 1, Index 1 bis Farbe 2, Index 2
|
||||
void ColorField::interpolate(Color clCol1, std::size_t usInd1, Color clCol2, std::size_t usInd2)
|
||||
// fills the array from color 1, index 1 to color 2, index 2
|
||||
void ColorField::interpolate(Base::Color clCol1, std::size_t usInd1, Base::Color clCol2, std::size_t usInd2)
|
||||
{
|
||||
float fStep = 1.0f, fLen = float(usInd2 - usInd1);
|
||||
|
||||
@@ -154,7 +154,7 @@ void ColorField::interpolate(Color clCol1, std::size_t usInd1, Color clCol2, std
|
||||
float ucR = clCol1.r + fR * fStep;
|
||||
float ucG = clCol1.g + fG * fStep;
|
||||
float ucB = clCol1.b + fB * fStep;
|
||||
colorField[i] = Color(ucR, ucG, ucB);
|
||||
colorField[i] = Base::Color(ucR, ucG, ucB);
|
||||
fStep += 1.0f;
|
||||
}
|
||||
}
|
||||
@@ -370,20 +370,20 @@ bool ColorLegend::setValue(std::size_t ulPos, float fVal)
|
||||
}
|
||||
}
|
||||
|
||||
Color ColorLegend::getColor(std::size_t ulPos) const
|
||||
Base::Color ColorLegend::getColor(std::size_t ulPos) const
|
||||
{
|
||||
if (ulPos < colorFields.size()) {
|
||||
return colorFields[ulPos];
|
||||
}
|
||||
else {
|
||||
return Color();
|
||||
return Base::Color();
|
||||
}
|
||||
}
|
||||
|
||||
// color as: 0x00rrggbb
|
||||
uint32_t ColorLegend::getPackedColor(std::size_t ulPos) const
|
||||
{
|
||||
Color clRGB = getColor(ulPos);
|
||||
Base::Color clRGB = getColor(ulPos);
|
||||
return clRGB.getPackedValue();
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ std::size_t ColorLegend::addMin(const std::string& rclName)
|
||||
names.push_front(rclName);
|
||||
values.push_front(values.front() - 1.0f);
|
||||
|
||||
Color clNewRGB;
|
||||
Base::Color clNewRGB;
|
||||
clNewRGB.r = ((float)rand() / (float)RAND_MAX);
|
||||
clNewRGB.g = ((float)rand() / (float)RAND_MAX);
|
||||
clNewRGB.b = ((float)rand() / (float)RAND_MAX);
|
||||
@@ -417,7 +417,7 @@ std::size_t ColorLegend::addMax(const std::string& rclName)
|
||||
names.push_back(rclName);
|
||||
values.push_back(values.back() + 1.0f);
|
||||
|
||||
Color clNewRGB;
|
||||
Base::Color clNewRGB;
|
||||
clNewRGB.r = ((float)rand() / (float)RAND_MAX);
|
||||
clNewRGB.g = ((float)rand() / (float)RAND_MAX);
|
||||
clNewRGB.b = ((float)rand() / (float)RAND_MAX);
|
||||
@@ -481,7 +481,7 @@ void ColorLegend::resize(std::size_t ulCt)
|
||||
bool ColorLegend::setColor(std::size_t ulPos, float ucRed, float ucGreen, float ucBlue)
|
||||
{
|
||||
if (ulPos < names.size()) {
|
||||
colorFields[ulPos] = Color(ucRed, ucGreen, ucBlue);
|
||||
colorFields[ulPos] = Base::Color(ucRed, ucGreen, ucBlue);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+70
-71
@@ -32,7 +32,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace App
|
||||
{
|
||||
|
||||
@@ -64,7 +63,7 @@ namespace App
|
||||
class AppExport ValueFloatToRGB
|
||||
{
|
||||
public:
|
||||
virtual Color getColor(float fVal) const = 0;
|
||||
virtual Base::Color getColor(float fVal) const = 0;
|
||||
|
||||
protected:
|
||||
ValueFloatToRGB() = default;
|
||||
@@ -87,7 +86,7 @@ public:
|
||||
{
|
||||
return colors.size();
|
||||
}
|
||||
std::vector<Color> colors;
|
||||
std::vector<Base::Color> colors;
|
||||
};
|
||||
|
||||
class AppExport ColorModelBlueGreenRed: public ColorModel
|
||||
@@ -96,11 +95,11 @@ public:
|
||||
ColorModelBlueGreenRed()
|
||||
: ColorModel(5)
|
||||
{
|
||||
colors[0] = Color(0, 0, 1);
|
||||
colors[1] = Color(0, 1, 1);
|
||||
colors[2] = Color(0, 1, 0);
|
||||
colors[3] = Color(1, 1, 0);
|
||||
colors[4] = Color(1, 0, 0);
|
||||
colors[0] = Base::Color(0, 0, 1);
|
||||
colors[1] = Base::Color(0, 1, 1);
|
||||
colors[2] = Base::Color(0, 1, 0);
|
||||
colors[3] = Base::Color(1, 1, 0);
|
||||
colors[4] = Base::Color(1, 0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -110,9 +109,9 @@ public:
|
||||
ColorModelBlueCyanGreen()
|
||||
: ColorModel(3)
|
||||
{
|
||||
colors[0] = Color(0, 0, 1);
|
||||
colors[1] = Color(0, 1, 1);
|
||||
colors[2] = Color(0, 1, 0);
|
||||
colors[0] = Base::Color(0, 0, 1);
|
||||
colors[1] = Base::Color(0, 1, 1);
|
||||
colors[2] = Base::Color(0, 1, 0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -122,9 +121,9 @@ public:
|
||||
ColorModelGreenYellowRed()
|
||||
: ColorModel(3)
|
||||
{
|
||||
colors[0] = Color(0, 1, 0);
|
||||
colors[1] = Color(1, 1, 0);
|
||||
colors[2] = Color(1, 0, 0);
|
||||
colors[0] = Base::Color(0, 1, 0);
|
||||
colors[1] = Base::Color(1, 1, 0);
|
||||
colors[2] = Base::Color(1, 0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -134,11 +133,11 @@ public:
|
||||
ColorModelRedGreenBlue()
|
||||
: ColorModel(5)
|
||||
{
|
||||
colors[0] = Color(1, 0, 0);
|
||||
colors[1] = Color(1, 1, 0);
|
||||
colors[2] = Color(0, 1, 0);
|
||||
colors[3] = Color(0, 1, 1);
|
||||
colors[4] = Color(0, 0, 1);
|
||||
colors[0] = Base::Color(1, 0, 0);
|
||||
colors[1] = Base::Color(1, 1, 0);
|
||||
colors[2] = Base::Color(0, 1, 0);
|
||||
colors[3] = Base::Color(0, 1, 1);
|
||||
colors[4] = Base::Color(0, 0, 1);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -148,9 +147,9 @@ public:
|
||||
ColorModelGreenCyanBlue()
|
||||
: ColorModel(3)
|
||||
{
|
||||
colors[0] = Color(0, 1, 0);
|
||||
colors[1] = Color(0, 1, 1);
|
||||
colors[2] = Color(0, 0, 1);
|
||||
colors[0] = Base::Color(0, 1, 0);
|
||||
colors[1] = Base::Color(0, 1, 1);
|
||||
colors[2] = Base::Color(0, 0, 1);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -160,9 +159,9 @@ public:
|
||||
ColorModelRedYellowGreen()
|
||||
: ColorModel(3)
|
||||
{
|
||||
colors[0] = Color(1, 0, 0);
|
||||
colors[1] = Color(1, 1, 0);
|
||||
colors[2] = Color(0, 1, 0);
|
||||
colors[0] = Base::Color(1, 0, 0);
|
||||
colors[1] = Base::Color(1, 1, 0);
|
||||
colors[2] = Base::Color(0, 1, 0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -172,11 +171,11 @@ public:
|
||||
ColorModelBlueWhiteRed()
|
||||
: ColorModel(5)
|
||||
{
|
||||
colors[0] = Color(0, 0, 1);
|
||||
colors[1] = Color(float(85.0 / 255), float(170.0 / 255), 1);
|
||||
colors[2] = Color(1, 1, 1);
|
||||
colors[3] = Color(1, float(85.0 / 255), 0);
|
||||
colors[4] = Color(1, 0, 0);
|
||||
colors[0] = Base::Color(0, 0, 1);
|
||||
colors[1] = Base::Color(float(85.0 / 255), float(170.0 / 255), 1);
|
||||
colors[2] = Base::Color(1, 1, 1);
|
||||
colors[3] = Base::Color(1, float(85.0 / 255), 0);
|
||||
colors[4] = Base::Color(1, 0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -186,9 +185,9 @@ public:
|
||||
ColorModelBlueWhite()
|
||||
: ColorModel(3)
|
||||
{
|
||||
colors[0] = Color(0, 0, 1);
|
||||
colors[1] = Color(float(85.0 / 255), float(170.0 / 255), 1);
|
||||
colors[2] = Color(1, 1, 1);
|
||||
colors[0] = Base::Color(0, 0, 1);
|
||||
colors[1] = Base::Color(float(85.0 / 255), float(170.0 / 255), 1);
|
||||
colors[2] = Base::Color(1, 1, 1);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -198,9 +197,9 @@ public:
|
||||
ColorModelWhiteRed()
|
||||
: ColorModel(3)
|
||||
{
|
||||
colors[0] = Color(1, 1, 1);
|
||||
colors[1] = Color(1, float(85.0 / 255), 0);
|
||||
colors[2] = Color(1, 0, 0);
|
||||
colors[0] = Base::Color(1, 1, 1);
|
||||
colors[1] = Base::Color(1, float(85.0 / 255), 0);
|
||||
colors[2] = Base::Color(1, 0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -210,8 +209,8 @@ public:
|
||||
ColorModelBlackWhite()
|
||||
: ColorModel(2)
|
||||
{
|
||||
colors[0] = Color(0, 0, 0);
|
||||
colors[1] = Color(1, 1, 1);
|
||||
colors[0] = Base::Color(0, 0, 0);
|
||||
colors[1] = Base::Color(1, 1, 1);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -221,8 +220,8 @@ public:
|
||||
ColorModelBlackGray()
|
||||
: ColorModel(2)
|
||||
{
|
||||
colors[0] = Color(0.0f, 0.0f, 0.0f);
|
||||
colors[1] = Color(0.5f, 0.5f, 0.5f);
|
||||
colors[0] = Base::Color(0.0f, 0.0f, 0.0f);
|
||||
colors[1] = Base::Color(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -232,8 +231,8 @@ public:
|
||||
ColorModelGrayWhite()
|
||||
: ColorModel(2)
|
||||
{
|
||||
colors[0] = Color(0.5f, 0.5f, 0.5f);
|
||||
colors[1] = Color(1.0f, 1.0f, 1.0f);
|
||||
colors[0] = Base::Color(0.5f, 0.5f, 0.5f);
|
||||
colors[1] = Base::Color(1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -243,8 +242,8 @@ public:
|
||||
ColorModelWhiteBlack()
|
||||
: ColorModel(2)
|
||||
{
|
||||
colors[0] = Color(1, 1, 1);
|
||||
colors[1] = Color(0, 0, 0);
|
||||
colors[0] = Base::Color(1, 1, 1);
|
||||
colors[1] = Base::Color(0, 0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -254,8 +253,8 @@ public:
|
||||
ColorModelWhiteGray()
|
||||
: ColorModel(2)
|
||||
{
|
||||
colors[0] = Color(1.0f, 1.0f, 1.0f);
|
||||
colors[1] = Color(0.5f, 0.5f, 0.5f);
|
||||
colors[0] = Base::Color(1.0f, 1.0f, 1.0f);
|
||||
colors[1] = Base::Color(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -265,8 +264,8 @@ public:
|
||||
ColorModelGrayBlack()
|
||||
: ColorModel(2)
|
||||
{
|
||||
colors[0] = Color(0.5f, 0.5f, 0.5f);
|
||||
colors[1] = Color(0.0f, 0.0f, 0.0f);
|
||||
colors[0] = Base::Color(0.5f, 0.5f, 0.5f);
|
||||
colors[1] = Base::Color(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -320,7 +319,7 @@ public:
|
||||
{
|
||||
return colorModel;
|
||||
}
|
||||
void setDirect(std::size_t usInd, Color clCol)
|
||||
void setDirect(std::size_t usInd, Base::Color clCol)
|
||||
{
|
||||
colorField[usInd] = clCol;
|
||||
}
|
||||
@@ -333,11 +332,11 @@ public:
|
||||
return fMax;
|
||||
}
|
||||
|
||||
Color getColor(std::size_t usIndex) const
|
||||
Base::Color getColor(std::size_t usIndex) const
|
||||
{
|
||||
return colorField[usIndex];
|
||||
}
|
||||
inline Color getColor(float fVal) const;
|
||||
inline Base::Color getColor(float fVal) const;
|
||||
inline std::size_t getColorIndex(float fVal) const;
|
||||
|
||||
protected:
|
||||
@@ -345,13 +344,13 @@ protected:
|
||||
float fMin, fMax;
|
||||
float fAscent, fConstant; // Index := _fConstant + _fAscent * WERT
|
||||
std::size_t ctColors;
|
||||
std::vector<Color> colorField;
|
||||
std::vector<Base::Color> colorField;
|
||||
|
||||
void rebuild();
|
||||
void interpolate(Color clCol1, std::size_t usPos1, Color clCol2, std::size_t usPos2);
|
||||
void interpolate(Base::Color clCol1, std::size_t usPos1, Base::Color clCol2, std::size_t usPos2);
|
||||
};
|
||||
|
||||
inline Color ColorField::getColor(float fVal) const
|
||||
inline Base::Color ColorField::getColor(float fVal) const
|
||||
{
|
||||
// if the value is outside or at the border of the range
|
||||
std::size_t ct = colorModel.getCountColors() - 1;
|
||||
@@ -362,16 +361,16 @@ inline Color ColorField::getColor(float fVal) const
|
||||
return colorModel.colors[ct];
|
||||
}
|
||||
|
||||
// get the color field position (with 0 < t < 1)
|
||||
// get the Base::Color field position (with 0 < t < 1)
|
||||
float t = (fVal - fMin) / (fMax - fMin);
|
||||
Color col(1.0f, 1.0f, 1.0f); // white as default
|
||||
Base::Color col(1.0f, 1.0f, 1.0f); // white as default
|
||||
for (std::size_t i = 0; i < ct; i++) {
|
||||
float r = (float)(i + 1) / (float)ct;
|
||||
if (t < r) {
|
||||
// calculate the exact position in the subrange
|
||||
float s = t * float(ct) - float(i);
|
||||
Color c1 = colorModel.colors[i];
|
||||
Color c2 = colorModel.colors[i + 1];
|
||||
Base::Color c1 = colorModel.colors[i];
|
||||
Base::Color c2 = colorModel.colors[i + 1];
|
||||
col.r = (1.0f - s) * c1.r + s * c2.r;
|
||||
col.g = (1.0f - s) * c1.g + s * c2.g;
|
||||
col.b = (1.0f - s) * c1.b + s * c2.b;
|
||||
@@ -484,11 +483,11 @@ public:
|
||||
return profile.fMax;
|
||||
}
|
||||
|
||||
inline Color getColor(float fVal) const;
|
||||
inline Base::Color getColor(float fVal) const;
|
||||
inline std::size_t getColorIndex(float fVal) const;
|
||||
|
||||
private:
|
||||
inline Color _getColor(float fVal) const;
|
||||
inline Base::Color _getColor(float fVal) const;
|
||||
|
||||
protected:
|
||||
void createStandardPacks();
|
||||
@@ -525,7 +524,7 @@ public:
|
||||
void removeFirst();
|
||||
void removeLast();
|
||||
|
||||
Color getColor(std::size_t ulPos) const;
|
||||
Base::Color getColor(std::size_t ulPos) const;
|
||||
uint32_t getPackedColor(std::size_t ulPos) const;
|
||||
bool setColor(std::size_t ulPos, float ucRed, float ucGreen, float ucBlue);
|
||||
bool setColor(std::size_t ulPos, unsigned long ulColor);
|
||||
@@ -548,17 +547,17 @@ public:
|
||||
inline float getMinValue() const;
|
||||
inline float getMaxValue() const;
|
||||
|
||||
inline Color getColor(float fVal) const;
|
||||
inline Base::Color getColor(float fVal) const;
|
||||
inline std::size_t getColorIndex(float fVal) const;
|
||||
|
||||
protected:
|
||||
std::deque<Color> colorFields;
|
||||
std::deque<Base::Color> colorFields;
|
||||
std::deque<std::string> names;
|
||||
std::deque<float> values;
|
||||
bool outsideGrayed {false};
|
||||
};
|
||||
|
||||
inline Color ColorLegend::getColor(float fVal) const
|
||||
inline Base::Color ColorLegend::getColor(float fVal) const
|
||||
{
|
||||
std::deque<float>::const_iterator pI;
|
||||
for (pI = values.begin(); pI != values.end(); ++pI) {
|
||||
@@ -569,7 +568,7 @@ inline Color ColorLegend::getColor(float fVal) const
|
||||
|
||||
if (outsideGrayed) {
|
||||
if ((pI == values.begin()) || (pI == values.end())) {
|
||||
return Color(0.5f, 0.5f, 0.5f);
|
||||
return Base::Color(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
else {
|
||||
return colorFields[pI - values.begin() - 1];
|
||||
@@ -617,23 +616,23 @@ inline float ColorLegend::getMaxValue() const
|
||||
return values.back();
|
||||
}
|
||||
|
||||
inline Color ColorGradient::getColor(float fVal) const
|
||||
inline Base::Color ColorGradient::getColor(float fVal) const
|
||||
{
|
||||
Color color = _getColor(fVal);
|
||||
Base::Color Color = _getColor(fVal);
|
||||
if (isOutsideInvisible()) {
|
||||
if (isOutOfRange(fVal)) {
|
||||
color.a = 0.2F;
|
||||
Color.a = 0.2F;
|
||||
}
|
||||
}
|
||||
|
||||
return color;
|
||||
return Color;
|
||||
}
|
||||
|
||||
inline Color ColorGradient::_getColor(float fVal) const
|
||||
inline Base::Color ColorGradient::_getColor(float fVal) const
|
||||
{
|
||||
if (isOutsideGrayed()) {
|
||||
if (isOutOfRange(fVal)) {
|
||||
return Color(0.5f, 0.5f, 0.5f);
|
||||
return Base::Color(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ FeatureTest::FeatureTest()
|
||||
ADD_PROPERTY(ConstraintFloat, (5.0));
|
||||
ConstraintFloat.setConstraints(&floatPercent);
|
||||
|
||||
App::Color c;
|
||||
Base::Color c;
|
||||
App::Material mat(App::Material::GOLD);
|
||||
ADD_PROPERTY(Colour, (c));
|
||||
ADD_PROPERTY(ColourList, (c));
|
||||
|
||||
@@ -339,7 +339,7 @@ App::Material Material::getDefaultAppearance()
|
||||
ParameterGrp::handle hGrp =
|
||||
App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
|
||||
auto getColor = [hGrp](const char* parameter, App::Color& color) {
|
||||
auto getColor = [hGrp](const char* parameter, Base::Color& color) {
|
||||
uint32_t packed = color.getPackedRGB();
|
||||
packed = hGrp->GetUnsigned(parameter, packed);
|
||||
color.setPackedRGB(packed);
|
||||
@@ -363,10 +363,10 @@ App::Material Material::getDefaultAppearance()
|
||||
float red = static_cast<float>(intRandom(0, 255)) / 255.0F;
|
||||
float green = static_cast<float>(intRandom(0, 255)) / 255.0F;
|
||||
float blue = static_cast<float>(intRandom(0, 255)) / 255.0F;
|
||||
mat.diffuseColor = App::Color(red, green, blue);
|
||||
mat.diffuseColor = Base::Color(red, green, blue);
|
||||
}
|
||||
else {
|
||||
// Color = (204, 204, 230) = 3435980543UL
|
||||
// Base::Color = (204, 204, 230) = 3435980543UL
|
||||
getColor("DefaultShapeColor", mat.diffuseColor);
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -24,7 +24,7 @@
|
||||
#ifndef APP_MATERIAL_H
|
||||
#define APP_MATERIAL_H
|
||||
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
|
||||
namespace App
|
||||
{
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
* \li Ruby
|
||||
* \li Emerald
|
||||
* Furthermore there two additional modes \a Default which defines a kind of grey metallic and
|
||||
* user defined that does nothing. The Color and the other properties of the material are
|
||||
* user defined that does nothing. The Base::Color and the other properties of the material are
|
||||
* defined in the range [0-1]. If \a MatName is an unknown material name then the type
|
||||
* USER_DEFINED is set and the material doesn't get changed.
|
||||
*/
|
||||
@@ -125,10 +125,10 @@ public:
|
||||
/** @name Properties */
|
||||
//@{
|
||||
// NOLINTBEGIN
|
||||
Color ambientColor; /**< Defines the ambient color. */
|
||||
Color diffuseColor; /**< Defines the diffuse color. */
|
||||
Color specularColor; /**< Defines the specular color. */
|
||||
Color emissiveColor; /**< Defines the emissive color. */
|
||||
Base::Color ambientColor; /**< Defines the ambient color. */
|
||||
Base::Color diffuseColor; /**< Defines the diffuse color. */
|
||||
Base::Color specularColor; /**< Defines the specular color. */
|
||||
Base::Color emissiveColor; /**< Defines the emissive color. */
|
||||
float shininess;
|
||||
float transparency;
|
||||
std::string image;
|
||||
|
||||
@@ -64,7 +64,7 @@ Satin, Metalized, Neon GNC, Chrome, Aluminium, Obsidian, Neon PHC, Jade, Ruby or
|
||||
</Attribute>
|
||||
<CustomAttributes />
|
||||
<ClassDeclarations>public:
|
||||
static App::Color toColor(PyObject* value);
|
||||
static Base::Color toColor(PyObject* value);
|
||||
</ClassDeclarations>
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
|
||||
using namespace App;
|
||||
|
||||
Color MaterialPy::toColor(PyObject* value)
|
||||
Base::Color MaterialPy::toColor(PyObject* value)
|
||||
{
|
||||
Color cCol;
|
||||
Base::Color cCol;
|
||||
if (PyTuple_Check(value) && (PyTuple_Size(value) == 3 || PyTuple_Size(value) == 4)) {
|
||||
PyObject* item {};
|
||||
item = PyTuple_GetItem(value, 0);
|
||||
|
||||
@@ -2301,7 +2301,7 @@ PropertyColor::~PropertyColor() = default;
|
||||
//**************************************************************************
|
||||
// Base class implementer
|
||||
|
||||
void PropertyColor::setValue(const Color& col)
|
||||
void PropertyColor::setValue(const Base::Color& col)
|
||||
{
|
||||
aboutToSetValue();
|
||||
_cCol = col;
|
||||
@@ -2322,7 +2322,7 @@ void PropertyColor::setValue(float r, float g, float b, float a)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
const Color& PropertyColor::getValue() const
|
||||
const Base::Color& PropertyColor::getValue() const
|
||||
{
|
||||
return _cCol;
|
||||
}
|
||||
@@ -2345,7 +2345,7 @@ PyObject* PropertyColor::getPyObject()
|
||||
|
||||
void PropertyColor::setPyObject(PyObject* value)
|
||||
{
|
||||
App::Color cCol;
|
||||
Base::Color cCol;
|
||||
if (PyTuple_Check(value) && (PyTuple_Size(value) == 3 || PyTuple_Size(value) == 4)) {
|
||||
PyObject* item;
|
||||
item = PyTuple_GetItem(value, 0);
|
||||
@@ -2485,7 +2485,7 @@ PyObject* PropertyColorList::getPyObject()
|
||||
return list;
|
||||
}
|
||||
|
||||
Color PropertyColorList::getPyValue(PyObject* item) const
|
||||
Base::Color PropertyColorList::getPyValue(PyObject* item) const
|
||||
{
|
||||
PropertyColor col;
|
||||
col.setPyObject(item);
|
||||
@@ -2529,7 +2529,7 @@ void PropertyColorList::RestoreDocFile(Base::Reader& reader)
|
||||
Base::InputStream str(reader);
|
||||
uint32_t uCt = 0;
|
||||
str >> uCt;
|
||||
std::vector<Color> values(uCt);
|
||||
std::vector<Base::Color> values(uCt);
|
||||
uint32_t value; // must be 32 bit long
|
||||
for (auto& it : values) {
|
||||
str >> value;
|
||||
@@ -2552,7 +2552,7 @@ void PropertyColorList::Paste(const Property& from)
|
||||
|
||||
unsigned int PropertyColorList::getMemSize() const
|
||||
{
|
||||
return static_cast<unsigned int>(_lValueList.size() * sizeof(Color));
|
||||
return static_cast<unsigned int>(_lValueList.size() * sizeof(Base::Color));
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@@ -2573,7 +2573,7 @@ void PropertyMaterial::setValue(const Material& mat)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyMaterial::setValue(const Color& col)
|
||||
void PropertyMaterial::setValue(const Base::Color& col)
|
||||
{
|
||||
setDiffuseColor(col);
|
||||
}
|
||||
@@ -2593,7 +2593,7 @@ const Material& PropertyMaterial::getValue() const
|
||||
return _cMat;
|
||||
}
|
||||
|
||||
void PropertyMaterial::setAmbientColor(const Color& col)
|
||||
void PropertyMaterial::setAmbientColor(const Base::Color& col)
|
||||
{
|
||||
aboutToSetValue();
|
||||
_cMat.ambientColor = col;
|
||||
@@ -2614,7 +2614,7 @@ void PropertyMaterial::setAmbientColor(uint32_t rgba)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyMaterial::setDiffuseColor(const Color& col)
|
||||
void PropertyMaterial::setDiffuseColor(const Base::Color& col)
|
||||
{
|
||||
aboutToSetValue();
|
||||
_cMat.diffuseColor = col;
|
||||
@@ -2635,7 +2635,7 @@ void PropertyMaterial::setDiffuseColor(uint32_t rgba)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyMaterial::setSpecularColor(const Color& col)
|
||||
void PropertyMaterial::setSpecularColor(const Base::Color& col)
|
||||
{
|
||||
aboutToSetValue();
|
||||
_cMat.specularColor = col;
|
||||
@@ -2656,7 +2656,7 @@ void PropertyMaterial::setSpecularColor(uint32_t rgba)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyMaterial::setEmissiveColor(const Color& col)
|
||||
void PropertyMaterial::setEmissiveColor(const Base::Color& col)
|
||||
{
|
||||
aboutToSetValue();
|
||||
_cMat.emissiveColor = col;
|
||||
@@ -2691,22 +2691,22 @@ void PropertyMaterial::setTransparency(float val)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
const Color& PropertyMaterial::getAmbientColor() const
|
||||
const Base::Color& PropertyMaterial::getAmbientColor() const
|
||||
{
|
||||
return _cMat.ambientColor;
|
||||
}
|
||||
|
||||
const Color& PropertyMaterial::getDiffuseColor() const
|
||||
const Base::Color& PropertyMaterial::getDiffuseColor() const
|
||||
{
|
||||
return _cMat.diffuseColor;
|
||||
}
|
||||
|
||||
const Color& PropertyMaterial::getSpecularColor() const
|
||||
const Base::Color& PropertyMaterial::getSpecularColor() const
|
||||
{
|
||||
return _cMat.specularColor;
|
||||
}
|
||||
|
||||
const Color& PropertyMaterial::getEmissiveColor() const
|
||||
const Base::Color& PropertyMaterial::getEmissiveColor() const
|
||||
{
|
||||
return _cMat.emissiveColor;
|
||||
}
|
||||
@@ -2894,7 +2894,7 @@ void PropertyMaterialList::setValue(int index, const Material& mat)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyMaterialList::setAmbientColor(const Color& col)
|
||||
void PropertyMaterialList::setAmbientColor(const Base::Color& col)
|
||||
{
|
||||
aboutToSetValue();
|
||||
setMinimumSizeOne();
|
||||
@@ -2924,7 +2924,7 @@ void PropertyMaterialList::setAmbientColor(uint32_t rgba)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyMaterialList::setAmbientColor(int index, const Color& col)
|
||||
void PropertyMaterialList::setAmbientColor(int index, const Base::Color& col)
|
||||
{
|
||||
verifyIndex(index);
|
||||
|
||||
@@ -2954,7 +2954,7 @@ void PropertyMaterialList::setAmbientColor(int index, uint32_t rgba)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyMaterialList::setDiffuseColor(const Color& col)
|
||||
void PropertyMaterialList::setDiffuseColor(const Base::Color& col)
|
||||
{
|
||||
aboutToSetValue();
|
||||
setMinimumSizeOne();
|
||||
@@ -2984,7 +2984,7 @@ void PropertyMaterialList::setDiffuseColor(uint32_t rgba)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyMaterialList::setDiffuseColor(int index, const Color& col)
|
||||
void PropertyMaterialList::setDiffuseColor(int index, const Base::Color& col)
|
||||
{
|
||||
verifyIndex(index);
|
||||
|
||||
@@ -3014,7 +3014,7 @@ void PropertyMaterialList::setDiffuseColor(int index, uint32_t rgba)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyMaterialList::setDiffuseColors(const std::vector<App::Color>& colors)
|
||||
void PropertyMaterialList::setDiffuseColors(const std::vector<Base::Color>& colors)
|
||||
{
|
||||
aboutToSetValue();
|
||||
setSize(colors.size(), _lValueList[0]);
|
||||
@@ -3025,7 +3025,7 @@ void PropertyMaterialList::setDiffuseColors(const std::vector<App::Color>& color
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyMaterialList::setSpecularColor(const Color& col)
|
||||
void PropertyMaterialList::setSpecularColor(const Base::Color& col)
|
||||
{
|
||||
aboutToSetValue();
|
||||
setMinimumSizeOne();
|
||||
@@ -3055,7 +3055,7 @@ void PropertyMaterialList::setSpecularColor(uint32_t rgba)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyMaterialList::setSpecularColor(int index, const Color& col)
|
||||
void PropertyMaterialList::setSpecularColor(int index, const Base::Color& col)
|
||||
{
|
||||
verifyIndex(index);
|
||||
|
||||
@@ -3085,7 +3085,7 @@ void PropertyMaterialList::setSpecularColor(int index, uint32_t rgba)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyMaterialList::setEmissiveColor(const Color& col)
|
||||
void PropertyMaterialList::setEmissiveColor(const Base::Color& col)
|
||||
{
|
||||
aboutToSetValue();
|
||||
setMinimumSizeOne();
|
||||
@@ -3115,7 +3115,7 @@ void PropertyMaterialList::setEmissiveColor(uint32_t rgba)
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyMaterialList::setEmissiveColor(int index, const Color& col)
|
||||
void PropertyMaterialList::setEmissiveColor(int index, const Base::Color& col)
|
||||
{
|
||||
verifyIndex(index);
|
||||
|
||||
@@ -3196,29 +3196,29 @@ void PropertyMaterialList::setTransparencies(const std::vector<float>& transpare
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
const Color& PropertyMaterialList::getAmbientColor() const
|
||||
const Base::Color& PropertyMaterialList::getAmbientColor() const
|
||||
{
|
||||
return _lValueList[0].ambientColor;
|
||||
}
|
||||
|
||||
const Color& PropertyMaterialList::getAmbientColor(int index) const
|
||||
const Base::Color& PropertyMaterialList::getAmbientColor(int index) const
|
||||
{
|
||||
return _lValueList[index].ambientColor;
|
||||
}
|
||||
|
||||
const Color& PropertyMaterialList::getDiffuseColor() const
|
||||
const Base::Color& PropertyMaterialList::getDiffuseColor() const
|
||||
{
|
||||
return _lValueList[0].diffuseColor;
|
||||
}
|
||||
|
||||
const Color& PropertyMaterialList::getDiffuseColor(int index) const
|
||||
const Base::Color& PropertyMaterialList::getDiffuseColor(int index) const
|
||||
{
|
||||
return _lValueList[index].diffuseColor;
|
||||
}
|
||||
|
||||
std::vector<App::Color> PropertyMaterialList::getDiffuseColors() const
|
||||
std::vector<Base::Color> PropertyMaterialList::getDiffuseColors() const
|
||||
{
|
||||
std::vector<App::Color> list;
|
||||
std::vector<Base::Color> list;
|
||||
for (auto& material : _lValueList) {
|
||||
list.push_back(material.diffuseColor);
|
||||
}
|
||||
@@ -3226,22 +3226,22 @@ std::vector<App::Color> PropertyMaterialList::getDiffuseColors() const
|
||||
return list;
|
||||
}
|
||||
|
||||
const Color& PropertyMaterialList::getSpecularColor() const
|
||||
const Base::Color& PropertyMaterialList::getSpecularColor() const
|
||||
{
|
||||
return _lValueList[0].specularColor;
|
||||
}
|
||||
|
||||
const Color& PropertyMaterialList::getSpecularColor(int index) const
|
||||
const Base::Color& PropertyMaterialList::getSpecularColor(int index) const
|
||||
{
|
||||
return _lValueList[index].specularColor;
|
||||
}
|
||||
|
||||
const Color& PropertyMaterialList::getEmissiveColor() const
|
||||
const Base::Color& PropertyMaterialList::getEmissiveColor() const
|
||||
{
|
||||
return _lValueList[0].emissiveColor;
|
||||
}
|
||||
|
||||
const Color& PropertyMaterialList::getEmissiveColor(int index) const
|
||||
const Base::Color& PropertyMaterialList::getEmissiveColor(int index) const
|
||||
{
|
||||
return _lValueList[index].emissiveColor;
|
||||
}
|
||||
|
||||
+34
-34
@@ -999,7 +999,7 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
/** Color properties
|
||||
/** Base::Color properties
|
||||
* This is the father of all properties handling colors.
|
||||
*/
|
||||
class AppExport PropertyColor: public Property
|
||||
@@ -1021,13 +1021,13 @@ public:
|
||||
|
||||
/** Sets the property
|
||||
*/
|
||||
void setValue(const Color& col);
|
||||
void setValue(const Base::Color& col);
|
||||
void setValue(float r, float g, float b, float a = 1.0F);
|
||||
void setValue(uint32_t rgba);
|
||||
|
||||
/** This method returns a string representation of the property
|
||||
*/
|
||||
const Color& getValue() const;
|
||||
const Base::Color& getValue() const;
|
||||
|
||||
const char* getEditorName() const override
|
||||
{
|
||||
@@ -1045,7 +1045,7 @@ public:
|
||||
|
||||
unsigned int getMemSize() const override
|
||||
{
|
||||
return sizeof(Color);
|
||||
return sizeof(Base::Color);
|
||||
}
|
||||
|
||||
bool isSame(const Property& other) const override
|
||||
@@ -1058,10 +1058,10 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
Color _cCol;
|
||||
Base::Color _cCol;
|
||||
};
|
||||
|
||||
class AppExport PropertyColorList: public PropertyListsT<Color>
|
||||
class AppExport PropertyColorList: public PropertyListsT<Base::Color>
|
||||
{
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
|
||||
@@ -1091,7 +1091,7 @@ public:
|
||||
unsigned int getMemSize() const override;
|
||||
|
||||
protected:
|
||||
Color getPyValue(PyObject* py) const override;
|
||||
Base::Color getPyValue(PyObject* py) const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -1118,19 +1118,19 @@ public:
|
||||
/** Sets the property
|
||||
*/
|
||||
void setValue(const Material& mat);
|
||||
void setValue(const Color& col);
|
||||
void setValue(const Base::Color& col);
|
||||
void setValue(float r, float g, float b, float a = 1.0F);
|
||||
void setValue(uint32_t rgba);
|
||||
void setAmbientColor(const Color& col);
|
||||
void setAmbientColor(const Base::Color& col);
|
||||
void setAmbientColor(float r, float g, float b, float a = 1.0F);
|
||||
void setAmbientColor(uint32_t rgba);
|
||||
void setDiffuseColor(const Color& col);
|
||||
void setDiffuseColor(const Base::Color& col);
|
||||
void setDiffuseColor(float r, float g, float b, float a = 1.0F);
|
||||
void setDiffuseColor(uint32_t rgba);
|
||||
void setSpecularColor(const Color& col);
|
||||
void setSpecularColor(const Base::Color& col);
|
||||
void setSpecularColor(float r, float g, float b, float a = 1.0F);
|
||||
void setSpecularColor(uint32_t rgba);
|
||||
void setEmissiveColor(const Color& col);
|
||||
void setEmissiveColor(const Base::Color& col);
|
||||
void setEmissiveColor(float r, float g, float b, float a = 1.0F);
|
||||
void setEmissiveColor(uint32_t rgba);
|
||||
void setShininess(float);
|
||||
@@ -1139,10 +1139,10 @@ public:
|
||||
/** This method returns a string representation of the property
|
||||
*/
|
||||
const Material& getValue() const;
|
||||
const Color& getAmbientColor() const;
|
||||
const Color& getDiffuseColor() const;
|
||||
const Color& getSpecularColor() const;
|
||||
const Color& getEmissiveColor() const;
|
||||
const Base::Color& getAmbientColor() const;
|
||||
const Base::Color& getDiffuseColor() const;
|
||||
const Base::Color& getSpecularColor() const;
|
||||
const Base::Color& getEmissiveColor() const;
|
||||
double getShininess() const;
|
||||
double getTransparency() const;
|
||||
|
||||
@@ -1204,32 +1204,32 @@ public:
|
||||
void setValue(const Material& mat);
|
||||
void setValue(int index, const Material& mat);
|
||||
|
||||
void setAmbientColor(const Color& col);
|
||||
void setAmbientColor(const Base::Color& col);
|
||||
void setAmbientColor(float r, float g, float b, float a = 1.0F);
|
||||
void setAmbientColor(uint32_t rgba);
|
||||
void setAmbientColor(int index, const Color& col);
|
||||
void setAmbientColor(int index, const Base::Color& col);
|
||||
void setAmbientColor(int index, float r, float g, float b, float a = 1.0F);
|
||||
void setAmbientColor(int index, uint32_t rgba);
|
||||
|
||||
void setDiffuseColor(const Color& col);
|
||||
void setDiffuseColor(const Base::Color& col);
|
||||
void setDiffuseColor(float r, float g, float b, float a = 1.0F);
|
||||
void setDiffuseColor(uint32_t rgba);
|
||||
void setDiffuseColor(int index, const Color& col);
|
||||
void setDiffuseColor(int index, const Base::Color& col);
|
||||
void setDiffuseColor(int index, float r, float g, float b, float a = 1.0F);
|
||||
void setDiffuseColor(int index, uint32_t rgba);
|
||||
void setDiffuseColors(const std::vector<App::Color>& colors);
|
||||
void setDiffuseColors(const std::vector<Base::Color>& colors);
|
||||
|
||||
void setSpecularColor(const Color& col);
|
||||
void setSpecularColor(const Base::Color& col);
|
||||
void setSpecularColor(float r, float g, float b, float a = 1.0F);
|
||||
void setSpecularColor(uint32_t rgba);
|
||||
void setSpecularColor(int index, const Color& col);
|
||||
void setSpecularColor(int index, const Base::Color& col);
|
||||
void setSpecularColor(int index, float r, float g, float b, float a = 1.0F);
|
||||
void setSpecularColor(int index, uint32_t rgba);
|
||||
|
||||
void setEmissiveColor(const Color& col);
|
||||
void setEmissiveColor(const Base::Color& col);
|
||||
void setEmissiveColor(float r, float g, float b, float a = 1.0F);
|
||||
void setEmissiveColor(uint32_t rgba);
|
||||
void setEmissiveColor(int index, const Color& col);
|
||||
void setEmissiveColor(int index, const Base::Color& col);
|
||||
void setEmissiveColor(int index, float r, float g, float b, float a = 1.0F);
|
||||
void setEmissiveColor(int index, uint32_t rgba);
|
||||
|
||||
@@ -1240,18 +1240,18 @@ public:
|
||||
void setTransparency(int index, float);
|
||||
void setTransparencies(const std::vector<float>& transparencies);
|
||||
|
||||
const Color& getAmbientColor() const;
|
||||
const Color& getAmbientColor(int index) const;
|
||||
const Base::Color& getAmbientColor() const;
|
||||
const Base::Color& getAmbientColor(int index) const;
|
||||
|
||||
const Color& getDiffuseColor() const;
|
||||
const Color& getDiffuseColor(int index) const;
|
||||
std::vector<App::Color> getDiffuseColors() const;
|
||||
const Base::Color& getDiffuseColor() const;
|
||||
const Base::Color& getDiffuseColor(int index) const;
|
||||
std::vector<Base::Color> getDiffuseColors() const;
|
||||
|
||||
const Color& getSpecularColor() const;
|
||||
const Color& getSpecularColor(int index) const;
|
||||
const Base::Color& getSpecularColor() const;
|
||||
const Base::Color& getSpecularColor(int index) const;
|
||||
|
||||
const Color& getEmissiveColor() const;
|
||||
const Color& getEmissiveColor(int index) const;
|
||||
const Base::Color& getEmissiveColor() const;
|
||||
const Base::Color& getEmissiveColor(int index) const;
|
||||
|
||||
float getShininess() const;
|
||||
float getShininess(int index) const;
|
||||
|
||||
@@ -173,6 +173,7 @@ SET(FreeCADBase_CPP_SRCS
|
||||
Builder3D.cpp
|
||||
Console.cpp
|
||||
ConsoleObserver.cpp
|
||||
Color.cpp
|
||||
CoordinateSystem.cpp
|
||||
CoordinateSystemPyImp.cpp
|
||||
Debugger.cpp
|
||||
@@ -244,6 +245,7 @@ SET(FreeCADBase_HPP_SRCS
|
||||
Console.h
|
||||
ConsoleObserver.h
|
||||
Converter.h
|
||||
Color.h
|
||||
CoordinateSystem.h
|
||||
Debugger.h
|
||||
DualNumber.h
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "Color.h"
|
||||
|
||||
using namespace App;
|
||||
using namespace Base;
|
||||
|
||||
|
||||
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <FCGlobal.h>
|
||||
|
||||
// NOLINTBEGIN(readability-magic-numbers)
|
||||
namespace App
|
||||
namespace Base
|
||||
{
|
||||
|
||||
template<class color_type>
|
||||
@@ -86,7 +86,7 @@ private:
|
||||
|
||||
/** Color class
|
||||
*/
|
||||
class AppExport Color
|
||||
class BaseExport Color
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@@ -226,7 +226,92 @@ public:
|
||||
float r {}, g {}, b {}, a {};
|
||||
};
|
||||
|
||||
} // namespace App
|
||||
// Specialization for Color
|
||||
template<>
|
||||
struct color_traits<Base::Color>
|
||||
{
|
||||
using color_type = Base::Color;
|
||||
color_traits() = default;
|
||||
explicit color_traits(const color_type& ct)
|
||||
: ct(ct)
|
||||
{}
|
||||
float redF() const
|
||||
{
|
||||
return ct.r;
|
||||
}
|
||||
float greenF() const
|
||||
{
|
||||
return ct.g;
|
||||
}
|
||||
float blueF() const
|
||||
{
|
||||
return ct.b;
|
||||
}
|
||||
float alphaF() const
|
||||
{
|
||||
return ct.a;
|
||||
}
|
||||
void setRedF(float red)
|
||||
{
|
||||
ct.r = red;
|
||||
}
|
||||
void setGreenF(float green)
|
||||
{
|
||||
ct.g = green;
|
||||
}
|
||||
void setBlueF(float blue)
|
||||
{
|
||||
ct.b = blue;
|
||||
}
|
||||
void setAlphaF(float alpha)
|
||||
{
|
||||
ct.a = alpha;
|
||||
}
|
||||
int red() const
|
||||
{
|
||||
return int(std::lround(ct.r * 255.0F));
|
||||
}
|
||||
int green() const
|
||||
{
|
||||
return int(std::lround(ct.g * 255.0F));
|
||||
}
|
||||
int blue() const
|
||||
{
|
||||
return int(std::lround(ct.b * 255.0F));
|
||||
}
|
||||
int alpha() const
|
||||
{
|
||||
return int(std::lround(ct.a * 255.0F));
|
||||
}
|
||||
void setRed(int red)
|
||||
{
|
||||
ct.r = static_cast<float>(red) / 255.0F;
|
||||
}
|
||||
void setGreen(int green)
|
||||
{
|
||||
ct.g = static_cast<float>(green) / 255.0F;
|
||||
}
|
||||
void setBlue(int blue)
|
||||
{
|
||||
ct.b = static_cast<float>(blue) / 255.0F;
|
||||
}
|
||||
void setAlpha(int alpha)
|
||||
{
|
||||
ct.a = static_cast<float>(alpha) / 255.0F;
|
||||
}
|
||||
static color_type makeColor(int red, int green, int blue, int alpha = 255)
|
||||
{
|
||||
return color_type {static_cast<float>(red) / 255.0F,
|
||||
static_cast<float>(green) / 255.0F,
|
||||
static_cast<float>(blue) / 255.0F,
|
||||
static_cast<float>(alpha) / 255.0F};
|
||||
}
|
||||
|
||||
private:
|
||||
color_type ct;
|
||||
};
|
||||
|
||||
} // namespace Base
|
||||
// NOLINTEND(readability-magic-numbers)
|
||||
|
||||
#endif // APP_COLOR_H
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#ifndef BASE_PARAMETER_H
|
||||
#define BASE_PARAMETER_H
|
||||
#include <Base/Color.h>
|
||||
|
||||
// Python stuff
|
||||
using PyObject = struct _object;
|
||||
|
||||
@@ -95,7 +95,7 @@ void StdCmdRandomColor::activated(int iMsg)
|
||||
auto fGrn = (float)rand()/fMax;
|
||||
auto fBlu = (float)rand()/fMax;
|
||||
// NOLINTEND
|
||||
auto objColor = App::Color(fRed, fGrn, fBlu);
|
||||
auto objColor = Base::Color(fRed, fGrn, fBlu);
|
||||
|
||||
auto vpLink = dynamic_cast<ViewProviderLink*>(view);
|
||||
if (vpLink) {
|
||||
|
||||
@@ -29,9 +29,13 @@
|
||||
#include <vector>
|
||||
#include <App/Material.h>
|
||||
|
||||
namespace App
|
||||
namespace Base
|
||||
{
|
||||
class Color;
|
||||
}
|
||||
|
||||
namespace App
|
||||
{
|
||||
class Material;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
# include <Inventor/nodes/SoTranslation.h>
|
||||
#endif
|
||||
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
#include <Gui/ViewParams.h>
|
||||
|
||||
#include "SoAxisCrossKit.h"
|
||||
@@ -225,23 +225,23 @@ SoAxisCrossKit::createAxes()
|
||||
set("zAxis.appearance.drawStyle", "lineWidth 1");
|
||||
|
||||
unsigned long colorLong;
|
||||
App::Color color;
|
||||
Base::Color color;
|
||||
std::stringstream parameterstring;
|
||||
|
||||
colorLong = Gui::ViewParams::instance()->getAxisXColor();
|
||||
color = App::Color(static_cast<uint32_t>(colorLong));
|
||||
color = Base::Color(static_cast<uint32_t>(colorLong));
|
||||
parameterstring << "diffuseColor " << color.r << " " << color.g << " " << color.b;
|
||||
set("xAxis.appearance.material", parameterstring.str().c_str());
|
||||
set("xHead.appearance.material", parameterstring.str().c_str());
|
||||
|
||||
colorLong = Gui::ViewParams::instance()->getAxisYColor();
|
||||
color = App::Color(static_cast<uint32_t>(colorLong));
|
||||
color = Base::Color(static_cast<uint32_t>(colorLong));
|
||||
parameterstring << "diffuseColor " << color.r << " " << color.g << " " << color.b;
|
||||
set("yAxis.appearance.material", parameterstring.str().c_str());
|
||||
set("yHead.appearance.material", parameterstring.str().c_str());
|
||||
|
||||
colorLong = Gui::ViewParams::instance()->getAxisZColor();
|
||||
color = App::Color(static_cast<uint32_t>(colorLong));
|
||||
color = Base::Color(static_cast<uint32_t>(colorLong));
|
||||
parameterstring << "diffuseColor " << color.r << " " << color.g << " " << color.b;
|
||||
set("zAxis.appearance.material", parameterstring.str().c_str());
|
||||
set("zHead.appearance.material", parameterstring.str().c_str());
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
#include "View3DInventor.h"
|
||||
#include "View3DInventorViewer.h"
|
||||
#include "Dialogs/DlgObjectSelection.h"
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
|
||||
FC_LOG_LEVEL_INIT("MainWindow",false,true,true)
|
||||
|
||||
@@ -2348,15 +2348,15 @@ void MainWindow::setWindowTitle(const QString& string)
|
||||
auto format = QStringLiteral("#statusBar{color: %1}");
|
||||
if (strcmp(sReason, "colorText") == 0) {
|
||||
unsigned long col = rclGrp.GetUnsigned(sReason);
|
||||
this->msg = format.arg(App::Color::fromPackedRGB<QColor>(col).name());
|
||||
this->msg = format.arg(Base::Color::fromPackedRGB<QColor>(col).name());
|
||||
}
|
||||
else if (strcmp(sReason, "colorWarning") == 0) {
|
||||
unsigned long col = rclGrp.GetUnsigned(sReason);
|
||||
this->wrn = format.arg(App::Color::fromPackedRGB<QColor>(col).name());
|
||||
this->wrn = format.arg(Base::Color::fromPackedRGB<QColor>(col).name());
|
||||
}
|
||||
else if (strcmp(sReason, "colorError") == 0) {
|
||||
unsigned long col = rclGrp.GetUnsigned(sReason);
|
||||
this->err = format.arg(App::Color::fromPackedRGB<QColor>(col).name());
|
||||
this->err = format.arg(Base::Color::fromPackedRGB<QColor>(col).name());
|
||||
}
|
||||
else if (strcmp(sReason, "colorCritical") == 0) {
|
||||
unsigned long col = rclGrp.GetUnsigned(sReason);
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
# include <QPainterPath>
|
||||
#endif
|
||||
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Eigen/Dense>
|
||||
|
||||
@@ -180,9 +180,9 @@ public:
|
||||
float m_InactiveOpacity = 0.5;
|
||||
SbVec2s m_PosOffset = SbVec2s(0,0);
|
||||
|
||||
App::Color m_xColor;
|
||||
App::Color m_yColor;
|
||||
App::Color m_zColor;
|
||||
Base::Color m_xColor;
|
||||
Base::Color m_yColor;
|
||||
Base::Color m_zColor;
|
||||
|
||||
bool m_Prepared = false;
|
||||
static vector<string> m_commands;
|
||||
@@ -1181,11 +1181,11 @@ void NaviCube::updateColors()
|
||||
unsigned long colorLong;
|
||||
|
||||
colorLong = Gui::ViewParams::instance()->getAxisXColor();
|
||||
m_NaviCubeImplementation->m_xColor = App::Color(static_cast<uint32_t>(colorLong));
|
||||
m_NaviCubeImplementation->m_xColor = Base::Color(static_cast<uint32_t>(colorLong));
|
||||
colorLong = Gui::ViewParams::instance()->getAxisYColor();
|
||||
m_NaviCubeImplementation->m_yColor = App::Color(static_cast<uint32_t>(colorLong));
|
||||
m_NaviCubeImplementation->m_yColor = Base::Color(static_cast<uint32_t>(colorLong));
|
||||
colorLong = Gui::ViewParams::instance()->getAxisZColor();
|
||||
m_NaviCubeImplementation->m_zColor = App::Color(static_cast<uint32_t>(colorLong));
|
||||
m_NaviCubeImplementation->m_zColor = Base::Color(static_cast<uint32_t>(colorLong));
|
||||
}
|
||||
|
||||
void NaviCube::setNaviCubeCommands(const std::vector<std::string>& cmd)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
|
||||
#include "PrefWidgets.h"
|
||||
|
||||
@@ -562,12 +562,12 @@ void PrefColorButton::restorePreferences()
|
||||
if (!m_Restored)
|
||||
m_Default = color();
|
||||
|
||||
unsigned int icol = App::Color::asPackedRGBA<QColor>(m_Default);
|
||||
unsigned int icol = Base::Color::asPackedRGBA<QColor>(m_Default);
|
||||
|
||||
unsigned long lcol = static_cast<unsigned long>(icol);
|
||||
lcol = getWindowParameter()->GetUnsigned(entryName(), lcol);
|
||||
icol = static_cast<unsigned int>(lcol);
|
||||
QColor value = App::Color::fromPackedRGBA<QColor>(icol);
|
||||
QColor value = Base::Color::fromPackedRGBA<QColor>(icol);
|
||||
if (!this->allowTransparency())
|
||||
value.setAlpha(0xff);
|
||||
setColor(value);
|
||||
@@ -583,7 +583,7 @@ void PrefColorButton::savePreferences()
|
||||
|
||||
QColor col = color();
|
||||
// (r,g,b,a) with a = 255 (opaque)
|
||||
unsigned int icol = App::Color::asPackedRGBA<QColor>(col);
|
||||
unsigned int icol = Base::Color::asPackedRGBA<QColor>(col);
|
||||
unsigned long lcol = static_cast<unsigned long>(icol);
|
||||
getWindowParameter()->SetUnsigned( entryName(), lcol );
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <QFontDatabase>
|
||||
#endif
|
||||
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
#include <Gui/PythonEditor.h>
|
||||
#include <Gui/Tools.h>
|
||||
|
||||
@@ -85,63 +85,63 @@ DlgSettingsEditor::DlgSettingsEditor(QWidget* parent)
|
||||
d = new DlgSettingsEditorP();
|
||||
QColor col;
|
||||
col = qApp->palette().windowText().color();
|
||||
unsigned int lText = App::Color::asPackedRGB<QColor>(col);
|
||||
unsigned int lText = Base::Color::asPackedRGB<QColor>(col);
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Text")), lText));
|
||||
|
||||
unsigned int lBookmarks = App::Color::asPackedRGB<QColor>(QColor(Qt::cyan));
|
||||
unsigned int lBookmarks = Base::Color::asPackedRGB<QColor>(QColor(Qt::cyan));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Bookmark")), lBookmarks));
|
||||
|
||||
unsigned int lBreakpnts = App::Color::asPackedRGB<QColor>(QColor(Qt::red));
|
||||
unsigned int lBreakpnts = Base::Color::asPackedRGB<QColor>(QColor(Qt::red));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Breakpoint")), lBreakpnts));
|
||||
|
||||
unsigned int lKeywords = App::Color::asPackedRGB<QColor>(QColor(Qt::blue));
|
||||
unsigned int lKeywords = Base::Color::asPackedRGB<QColor>(QColor(Qt::blue));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Keyword")), lKeywords));
|
||||
|
||||
unsigned int lComments = App::Color::asPackedRGB<QColor>(QColor(0, 170, 0));
|
||||
unsigned int lComments = Base::Color::asPackedRGB<QColor>(QColor(0, 170, 0));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Comment")), lComments));
|
||||
|
||||
unsigned int lBlockCom = App::Color::asPackedRGB<QColor>(QColor(160, 160, 164));
|
||||
unsigned int lBlockCom = Base::Color::asPackedRGB<QColor>(QColor(160, 160, 164));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Block comment")), lBlockCom));
|
||||
|
||||
unsigned int lNumbers = App::Color::asPackedRGB<QColor>(QColor(Qt::blue));
|
||||
unsigned int lNumbers = Base::Color::asPackedRGB<QColor>(QColor(Qt::blue));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Number")), lNumbers));
|
||||
|
||||
unsigned int lStrings = App::Color::asPackedRGB<QColor>(QColor(Qt::red));
|
||||
unsigned int lStrings = Base::Color::asPackedRGB<QColor>(QColor(Qt::red));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("String")), lStrings));
|
||||
|
||||
unsigned int lCharacter = App::Color::asPackedRGB<QColor>(QColor(Qt::red));
|
||||
unsigned int lCharacter = Base::Color::asPackedRGB<QColor>(QColor(Qt::red));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Character")), lCharacter));
|
||||
|
||||
unsigned int lClass = App::Color::asPackedRGB<QColor>(QColor(255, 170, 0));
|
||||
unsigned int lClass = Base::Color::asPackedRGB<QColor>(QColor(255, 170, 0));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Class name")), lClass));
|
||||
|
||||
unsigned int lDefine = App::Color::asPackedRGB<QColor>(QColor(255, 170, 0));
|
||||
unsigned int lDefine = Base::Color::asPackedRGB<QColor>(QColor(255, 170, 0));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Define name")), lDefine));
|
||||
|
||||
unsigned int lOperat = App::Color::asPackedRGB<QColor>(QColor(160, 160, 164));
|
||||
unsigned int lOperat = Base::Color::asPackedRGB<QColor>(QColor(160, 160, 164));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Operator")), lOperat));
|
||||
|
||||
unsigned int lPyOutput = App::Color::asPackedRGB<QColor>(QColor(170, 170, 127));
|
||||
unsigned int lPyOutput = Base::Color::asPackedRGB<QColor>(QColor(170, 170, 127));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Python output")), lPyOutput));
|
||||
|
||||
unsigned int lPyError = App::Color::asPackedRGB<QColor>(QColor(Qt::red));
|
||||
unsigned int lPyError = Base::Color::asPackedRGB<QColor>(QColor(Qt::red));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Python error")), lPyError));
|
||||
|
||||
unsigned int lCLine = App::Color::asPackedRGB<QColor>(QColor(224, 224, 224));
|
||||
unsigned int lCLine = Base::Color::asPackedRGB<QColor>(QColor(224, 224, 224));
|
||||
d->colormap.push_back(
|
||||
QPair<QString, unsigned int>(QString::fromLatin1(QT_TR_NOOP("Current line highlight")),
|
||||
lCLine));
|
||||
@@ -195,14 +195,14 @@ void DlgSettingsEditor::onDisplayItemsCurrentItemChanged(QTreeWidgetItem* item)
|
||||
{
|
||||
int index = ui->displayItems->indexOfTopLevelItem(item);
|
||||
unsigned int col = d->colormap[index].second;
|
||||
ui->colorButton->setColor(App::Color::fromPackedRGB<QColor>(col));
|
||||
ui->colorButton->setColor(Base::Color::fromPackedRGB<QColor>(col));
|
||||
}
|
||||
|
||||
/** Updates the color map if a color was changed */
|
||||
void DlgSettingsEditor::onColorButtonChanged()
|
||||
{
|
||||
QColor col = ui->colorButton->color();
|
||||
unsigned int lcol = App::Color::asPackedRGB<QColor>(col);
|
||||
unsigned int lcol = Base::Color::asPackedRGB<QColor>(col);
|
||||
|
||||
int index = ui->displayItems->indexOfTopLevelItem(ui->displayItems->currentItem());
|
||||
d->colormap[index].second = lcol;
|
||||
@@ -272,7 +272,7 @@ void DlgSettingsEditor::loadSettings()
|
||||
auto col = static_cast<unsigned long>(textColor);
|
||||
col = hGrp->GetUnsigned(textType.toLatin1(), col);
|
||||
textColor = static_cast<unsigned int>(col);
|
||||
QColor color = App::Color::fromPackedRGB<QColor>(col);
|
||||
QColor color = Base::Color::fromPackedRGB<QColor>(col);
|
||||
pythonSyntax->setColor(textType, color);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Interpreter.h>
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
|
||||
#include "PythonConsole.h"
|
||||
#include "PythonConsolePy.h"
|
||||
@@ -947,7 +947,7 @@ void PythonConsole::changeEvent(QEvent *e)
|
||||
else if (e->type() == QEvent::StyleChange) {
|
||||
QPalette pal = qApp->palette();
|
||||
QColor color = pal.windowText().color();
|
||||
unsigned int text = App::Color::asPackedRGB<QColor>(color);
|
||||
unsigned int text = Base::Color::asPackedRGB<QColor>(color);
|
||||
auto value = static_cast<unsigned long>(text);
|
||||
// if this parameter is not already set use the style's window text color
|
||||
value = getWindowParameter()->GetUnsigned("Text", value);
|
||||
|
||||
@@ -638,7 +638,7 @@ void SIM::Coin3D::Quarter::SoQTQuarterAdaptor::draw2DString(
|
||||
const char* str,
|
||||
SbVec2s glsize,
|
||||
SbVec2f position,
|
||||
App::Color color = App::Color(1.0F, 1.0F, 0.0F)) // retains yellow as default color
|
||||
Base::Color color = Base::Color(1.0F, 1.0F, 0.0F)) // retains yellow as default color
|
||||
{
|
||||
// Store GL state.
|
||||
glPushAttrib(GL_ENABLE_BIT|GL_CURRENT_BIT);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <Inventor/lists/SoCallbackList.h>
|
||||
#include <Inventor/sensors/SoTimerSensor.h>
|
||||
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
|
||||
#include "QuarterWidget.h"
|
||||
|
||||
@@ -152,7 +152,7 @@ private:
|
||||
SoNode * m_storedcamera = nullptr;
|
||||
|
||||
protected:
|
||||
static void draw2DString(const char * str, SbVec2s glsize, SbVec2f position, App::Color color);
|
||||
static void draw2DString(const char * str, SbVec2s glsize, SbVec2f position, Base::Color color);
|
||||
static void printString(const char * str);
|
||||
SbVec2f framesPerSecond; // NOLINT
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Interpreter.h>
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
|
||||
#include "ReportView.h"
|
||||
#include "Application.h"
|
||||
@@ -566,7 +566,7 @@ void ReportOutput::changeEvent(QEvent *ev)
|
||||
if (ev->type() == QEvent::StyleChange) {
|
||||
QPalette pal = qApp->palette();
|
||||
QColor color = pal.windowText().color();
|
||||
unsigned int text = App::Color::asPackedRGB<QColor>(color);
|
||||
unsigned int text = Base::Color::asPackedRGB<QColor>(color);
|
||||
auto value = static_cast<unsigned long>(text);
|
||||
// if this parameter is not already set use the style's window text color
|
||||
value = getWindowParameter()->GetUnsigned("colorText", value);
|
||||
@@ -831,7 +831,7 @@ void ReportOutput::OnChange(Base::Subject<const char*> &rCaller, const char * sR
|
||||
}
|
||||
else if (strcmp(sReason, "colorText") == 0) {
|
||||
unsigned long col = rclGrp.GetUnsigned( sReason );
|
||||
reportHl->setTextColor(App::Color::fromPackedRGB<QColor>(col));
|
||||
reportHl->setTextColor(Base::Color::fromPackedRGB<QColor>(col));
|
||||
}
|
||||
else if (strcmp(sReason, "colorCriticalText") == 0) {
|
||||
unsigned long col = rclGrp.GetUnsigned( sReason );
|
||||
@@ -839,15 +839,15 @@ void ReportOutput::OnChange(Base::Subject<const char*> &rCaller, const char * sR
|
||||
}
|
||||
else if (strcmp(sReason, "colorLogging") == 0) {
|
||||
unsigned long col = rclGrp.GetUnsigned( sReason );
|
||||
reportHl->setLogColor(App::Color::fromPackedRGB<QColor>(col));
|
||||
reportHl->setLogColor(Base::Color::fromPackedRGB<QColor>(col));
|
||||
}
|
||||
else if (strcmp(sReason, "colorWarning") == 0) {
|
||||
unsigned long col = rclGrp.GetUnsigned( sReason );
|
||||
reportHl->setWarningColor(App::Color::fromPackedRGB<QColor>(col));
|
||||
reportHl->setWarningColor(Base::Color::fromPackedRGB<QColor>(col));
|
||||
}
|
||||
else if (strcmp(sReason, "colorError") == 0) {
|
||||
unsigned long col = rclGrp.GetUnsigned( sReason );
|
||||
reportHl->setErrorColor(App::Color::fromPackedRGB<QColor>(col));
|
||||
reportHl->setErrorColor(Base::Color::fromPackedRGB<QColor>(col));
|
||||
}
|
||||
else if (strcmp(sReason, "checkGoToEnd") == 0) {
|
||||
gotoEnd = rclGrp.GetBool(sReason, gotoEnd);
|
||||
|
||||
@@ -125,8 +125,8 @@ int SoFCSelectionContext::merge(int status, SoFCSelectionContextBasePtr &output,
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool SoFCSelectionContextEx::setColors(
|
||||
const std::map<std::string,App::Color> &colors, const std::string &element) {
|
||||
std::map<int,App::Color> tmp;
|
||||
const std::map<std::string,Base::Color> &colors, const std::string &element) {
|
||||
std::map<int,Base::Color> tmp;
|
||||
auto it = colors.find("");
|
||||
if(it!=colors.end())
|
||||
tmp[-1] = it->second;
|
||||
@@ -149,7 +149,7 @@ bool SoFCSelectionContextEx::setColors(
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t SoFCSelectionContextEx::packColor(const App::Color &c, bool &hasTransparency) {
|
||||
uint32_t SoFCSelectionContextEx::packColor(const Base::Color &c, bool &hasTransparency) {
|
||||
float trans = std::max(trans0,c.a);
|
||||
if(trans>0)
|
||||
hasTransparency = true;
|
||||
|
||||
@@ -105,11 +105,11 @@ using SoFCSelectionContextExPtr = std::shared_ptr<SoFCSelectionContextEx>;
|
||||
|
||||
struct GuiExport SoFCSelectionContextEx : SoFCSelectionContext
|
||||
{
|
||||
std::map<int,App::Color> colors;
|
||||
std::map<int,Base::Color> colors;
|
||||
float trans0 = 0.0;
|
||||
|
||||
bool setColors(const std::map<std::string,App::Color> &colors, const std::string &element);
|
||||
uint32_t packColor(const App::Color &c, bool &hasTransparency);
|
||||
bool setColors(const std::map<std::string,Base::Color> &colors, const std::string &element);
|
||||
uint32_t packColor(const Base::Color &c, bool &hasTransparency);
|
||||
bool applyColor(int idx, std::vector<uint32_t> &packedColors, bool &hasTransparency);
|
||||
bool isSingleColor(uint32_t &color, bool &hasTransparency);
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ public:
|
||||
return overrideColor;
|
||||
}
|
||||
|
||||
void setColorOverride(App::Color c) {
|
||||
void setColorOverride(Base::Color c) {
|
||||
overrideColor = true;
|
||||
colorOverride = SbColor(c.r,c.g,c.b);
|
||||
transOverride = c.a;
|
||||
@@ -425,13 +425,13 @@ public:
|
||||
_secondary = enable;
|
||||
}
|
||||
|
||||
const std::map<std::string,App::Color> &getColors() const {
|
||||
const std::map<std::string,Base::Color> &getColors() const {
|
||||
return _colors;
|
||||
}
|
||||
void setColors(const std::map<std::string,App::Color> &colors) {
|
||||
void setColors(const std::map<std::string,Base::Color> &colors) {
|
||||
_colors = colors;
|
||||
}
|
||||
void swapColors(std::map<std::string,App::Color> &colors) {
|
||||
void swapColors(std::map<std::string,Base::Color> &colors) {
|
||||
_colors.swap(colors);
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ private:
|
||||
Type _type;
|
||||
SbColor _color;
|
||||
const SoDetail* _det{nullptr};
|
||||
std::map<std::string,App::Color> _colors;
|
||||
std::map<std::string,Base::Color> _colors;
|
||||
bool _secondary;
|
||||
};
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ void SoFCColorBar::customize(SoFCColorBarBase* child)
|
||||
}
|
||||
}
|
||||
|
||||
App::Color SoFCColorBar::getColor( float fVal ) const
|
||||
Base::Color SoFCColorBar::getColor( float fVal ) const
|
||||
{
|
||||
return this->getActiveBar()->getColor( fVal );
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
*
|
||||
* This method must be implemented in subclasses.
|
||||
*/
|
||||
App::Color getColor(float fVal) const override = 0;
|
||||
Base::Color getColor(float fVal) const override = 0;
|
||||
/**
|
||||
* Returns always true if the color bar is in mode to show colors to arbitrary values of \a fVal,
|
||||
* otherwise true is returned if \a fVal is within the specified parameter range, if not false is
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
/**
|
||||
* Returns the associated color to the value \a fVal of the currently active color bar.
|
||||
*/
|
||||
App::Color getColor(float fVal) const override;
|
||||
Base::Color getColor(float fVal) const override;
|
||||
/**
|
||||
* Sets whether values outside the range should be in gray,
|
||||
*/
|
||||
|
||||
@@ -105,7 +105,7 @@ const char* SoFCColorGradient::getColorBarName() const
|
||||
|
||||
void SoFCColorGradient::applyFormat(const SoLabelTextFormat& fmt)
|
||||
{
|
||||
auto textColor = App::Color(fmt.textColor);
|
||||
auto textColor = Base::Color(fmt.textColor);
|
||||
|
||||
for (int j = 0; j < labels->getNumChildren(); j++) {
|
||||
if (labels->getChild(j)->getTypeId() == SoBaseColor::getClassTypeId()) {
|
||||
@@ -131,7 +131,7 @@ void SoFCColorGradient::setMarkerLabel(const SoMFString& label)
|
||||
auto trans = new SoTransform;
|
||||
|
||||
SoLabelTextFormat fmt = getFormat();
|
||||
auto textColor = App::Color(fmt.textColor);
|
||||
auto textColor = Base::Color(fmt.textColor);
|
||||
auto textFont = new SoFont;
|
||||
auto color = new SoBaseColor;
|
||||
textFont->name.setValue("Helvetica,Arial,Times New Roman");
|
||||
@@ -356,7 +356,7 @@ SoMaterial* SoFCColorGradient::createMaterial() const
|
||||
auto mat = new SoMaterial;
|
||||
mat->diffuseColor.setNum(2 * numColors);
|
||||
for (int k = 0; k < numColors; k++) {
|
||||
App::Color col = model.colors[numColors - k - 1];
|
||||
Base::Color col = model.colors[numColors - k - 1];
|
||||
mat->diffuseColor.set1Value(2 * k, col.r, col.g, col.b);
|
||||
mat->diffuseColor.set1Value(2 * k + 1, col.r, col.g, col.b);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
/**
|
||||
* Returns the associated color to the value \a fVal.
|
||||
*/
|
||||
App::Color getColor (float fVal) const override { return _cColGrad.getColor(fVal); }
|
||||
Base::Color getColor (float fVal) const override { return _cColGrad.getColor(fVal); }
|
||||
void setOutsideGrayed (bool bVal) override { _cColGrad.setOutsideGrayed(bVal); }
|
||||
/**
|
||||
* Returns always true if the gradient is in mode to show colors to arbitrary values of \a fVal,
|
||||
|
||||
@@ -339,7 +339,7 @@ void SoFCColorLegend::setColorLegend(const App::ColorLegend& legend)
|
||||
auto mat = new SoMaterial;
|
||||
mat->diffuseColor.setNum(intFields);
|
||||
for (std::size_t k = 0; k < numFields; k++) {
|
||||
App::Color col = legend.getColor(k);
|
||||
Base::Color col = legend.getColor(k);
|
||||
mat->diffuseColor.set1Value(k, col.r, col.g, col.b);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
void setColorLegend (const App::ColorLegend& legend);
|
||||
|
||||
unsigned short getColorIndex (float fVal) const { return _currentLegend.getColorIndex(fVal); }
|
||||
App::Color getColor (float fVal) const override { return _currentLegend.getColor(fVal); }
|
||||
Base::Color getColor (float fVal) const override { return _currentLegend.getColor(fVal); }
|
||||
void setOutsideGrayed (bool bVal) override { _currentLegend.setOutsideGrayed(bVal); }
|
||||
bool isVisible (float) const override { return false; }
|
||||
float getMinValue () const override { return _currentLegend.getMinValue(); }
|
||||
|
||||
@@ -190,13 +190,13 @@ public:
|
||||
|
||||
void apply()
|
||||
{
|
||||
std::map<std::string, App::Color> info;
|
||||
std::map<std::string, Base::Color> info;
|
||||
int count = ui->elementList->count();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
auto item = ui->elementList->item(i);
|
||||
auto col = item->data(Qt::UserRole).value<QColor>();
|
||||
std::string sub = qPrintable(item->data(Qt::UserRole + 1).value<QString>());
|
||||
info.emplace(sub, App::Color::fromValue<QColor>(col));
|
||||
info.emplace(sub, Base::Color::fromValue<QColor>(col));
|
||||
}
|
||||
if (!App::GetApplication().getActiveTransaction()) {
|
||||
App::GetApplication().setActiveTransaction("Set colors");
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "TextEdit.h"
|
||||
#include "SyntaxHighlighter.h"
|
||||
#include "Tools.h"
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
|
||||
|
||||
using namespace Gui;
|
||||
@@ -375,7 +375,7 @@ void TextEditor::highlightCurrentLine()
|
||||
if (!isReadOnly() && isEnabledHighlightCurrentLine()) {
|
||||
QTextEdit::ExtraSelection selection;
|
||||
QColor lineColor = d->colormap[QLatin1String("Current line highlight")];
|
||||
unsigned int col = App::Color::asPackedRGB<QColor>(lineColor);
|
||||
unsigned int col = Base::Color::asPackedRGB<QColor>(lineColor);
|
||||
ParameterGrp::handle hPrefGrp = getWindowParameter();
|
||||
auto value = static_cast<unsigned long>(col);
|
||||
value = hPrefGrp->GetUnsigned( "Current line highlight", value);
|
||||
@@ -457,7 +457,7 @@ void TextEditor::OnChange(Base::Subject<const char*> &rCaller,const char* sReaso
|
||||
QMap<QString, QColor>::Iterator it = d->colormap.find(QString::fromLatin1(sReason));
|
||||
if (it != d->colormap.end()) {
|
||||
QColor color = it.value();
|
||||
unsigned int col = App::Color::asPackedRGB<QColor>(color);
|
||||
unsigned int col = Base::Color::asPackedRGB<QColor>(color);
|
||||
auto value = static_cast<unsigned long>(col);
|
||||
value = hPrefGrp->GetUnsigned(sReason, value);
|
||||
col = static_cast<unsigned int>(value);
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
#ifndef GUI_COLORTRAITS_H
|
||||
#define GUI_COLORTRAITS_H
|
||||
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
#include <Inventor/SbColor.h>
|
||||
#include <Inventor/SbColor4f.h>
|
||||
#include <QColor>
|
||||
|
||||
namespace App
|
||||
namespace Base
|
||||
{
|
||||
// Specialization for SbColor
|
||||
template<>
|
||||
@@ -201,91 +201,6 @@ private:
|
||||
color_type ct;
|
||||
};
|
||||
|
||||
// Specialization for Color
|
||||
template<>
|
||||
struct color_traits<App::Color>
|
||||
{
|
||||
using color_type = App::Color;
|
||||
color_traits() = default;
|
||||
explicit color_traits(const color_type& ct)
|
||||
: ct(ct)
|
||||
{}
|
||||
float redF() const
|
||||
{
|
||||
return ct.r;
|
||||
}
|
||||
float greenF() const
|
||||
{
|
||||
return ct.g;
|
||||
}
|
||||
float blueF() const
|
||||
{
|
||||
return ct.b;
|
||||
}
|
||||
float alphaF() const
|
||||
{
|
||||
return ct.a;
|
||||
}
|
||||
void setRedF(float red)
|
||||
{
|
||||
ct.r = red;
|
||||
}
|
||||
void setGreenF(float green)
|
||||
{
|
||||
ct.g = green;
|
||||
}
|
||||
void setBlueF(float blue)
|
||||
{
|
||||
ct.b = blue;
|
||||
}
|
||||
void setAlphaF(float alpha)
|
||||
{
|
||||
ct.a = alpha;
|
||||
}
|
||||
int red() const
|
||||
{
|
||||
return int(std::lround(ct.r * 255.0F));
|
||||
}
|
||||
int green() const
|
||||
{
|
||||
return int(std::lround(ct.g * 255.0F));
|
||||
}
|
||||
int blue() const
|
||||
{
|
||||
return int(std::lround(ct.b * 255.0F));
|
||||
}
|
||||
int alpha() const
|
||||
{
|
||||
return int(std::lround(ct.a * 255.0F));
|
||||
}
|
||||
void setRed(int red)
|
||||
{
|
||||
ct.r = static_cast<float>(red) / 255.0F;
|
||||
}
|
||||
void setGreen(int green)
|
||||
{
|
||||
ct.g = static_cast<float>(green) / 255.0F;
|
||||
}
|
||||
void setBlue(int blue)
|
||||
{
|
||||
ct.b = static_cast<float>(blue) / 255.0F;
|
||||
}
|
||||
void setAlpha(int alpha)
|
||||
{
|
||||
ct.a = static_cast<float>(alpha) / 255.0F;
|
||||
}
|
||||
static color_type makeColor(int red, int green, int blue, int alpha = 255)
|
||||
{
|
||||
return color_type{static_cast<float>(red) / 255.0F,
|
||||
static_cast<float>(green) / 255.0F,
|
||||
static_cast<float>(blue) / 255.0F,
|
||||
static_cast<float>(alpha) / 255.0F};
|
||||
}
|
||||
|
||||
private:
|
||||
color_type ct;
|
||||
};
|
||||
|
||||
// Specialization for QColor
|
||||
template<>
|
||||
struct color_traits<QColor>
|
||||
|
||||
+4
-4
@@ -46,7 +46,7 @@
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/Writer.h>
|
||||
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObjectGroup.h>
|
||||
#include <App/AutoTransaction.h>
|
||||
@@ -109,7 +109,7 @@ static bool isSelectionCheckBoxesEnabled() {
|
||||
void TreeParams::onItemBackgroundChanged()
|
||||
{
|
||||
if (getItemBackground()) {
|
||||
App::Color color;
|
||||
Base::Color color;
|
||||
color.setPackedValue(getItemBackground());
|
||||
QColor col;
|
||||
col.setRedF(color.r);
|
||||
@@ -3812,7 +3812,7 @@ void DocumentItem::slotInEdit(const Gui::ViewProviderDocumentObject& v)
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/TreeView");
|
||||
unsigned long col = hGrp->GetUnsigned("TreeEditColor", 563609599);
|
||||
QColor color(App::Color::fromPackedRGB<QColor>(col));
|
||||
QColor color(Base::Color::fromPackedRGB<QColor>(col));
|
||||
|
||||
if (!getTree()->editingItem) {
|
||||
auto doc = Application::Instance->editDocument();
|
||||
@@ -5255,7 +5255,7 @@ void DocumentObjectItem::setHighlight(bool set, Gui::HighlightMode high) {
|
||||
f.setOverline(overlined);
|
||||
|
||||
unsigned long col = hGrp->GetUnsigned("TreeActiveColor", 1538528255);
|
||||
color = App::Color::fromPackedRGB<QColor>(col);
|
||||
color = Base::Color::fromPackedRGB<QColor>(col);
|
||||
}
|
||||
else {
|
||||
f.setBold(false);
|
||||
|
||||
+2
-2
@@ -94,8 +94,8 @@ private:
|
||||
|
||||
// Specialization for Color
|
||||
template <>
|
||||
struct vec_traits<App::Color> {
|
||||
using vec_type = App::Color;
|
||||
struct vec_traits<Base::Color> {
|
||||
using vec_type = Base::Color;
|
||||
using float_type = float;
|
||||
explicit vec_traits(const vec_type& v) : v(v){}
|
||||
inline std::tuple<float_type,float_type,float_type> get() const {
|
||||
|
||||
@@ -1432,7 +1432,7 @@ void View3DInventorViewer::showRotationCenter(bool show)
|
||||
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
|
||||
->GetUnsigned("RotationCenterColor", 4278190131); // NOLINT
|
||||
|
||||
QColor color = App::Color::fromPackedRGBA<QColor>(rotationCenterColor);
|
||||
QColor color = Base::Color::fromPackedRGBA<QColor>(rotationCenterColor);
|
||||
|
||||
rotationCenterGroup = new SoSkipBoundingGroup();
|
||||
|
||||
@@ -2461,7 +2461,7 @@ void View3DInventorViewer::renderScene()
|
||||
draw2DString(stream.str().c_str(),
|
||||
SbVec2s(10, 10),
|
||||
SbVec2f((overlayLeftWidgets.empty() ? 0.1f : 1.1f), 0.1f),
|
||||
App::Color(static_cast<uint32_t>(axisLetterColor))); // NOLINT
|
||||
Base::Color(static_cast<uint32_t>(axisLetterColor))); // NOLINT
|
||||
}
|
||||
|
||||
if (naviCubeEnabled) {
|
||||
@@ -3748,11 +3748,11 @@ void View3DInventorViewer::updateColors()
|
||||
unsigned long colorLong;
|
||||
|
||||
colorLong = Gui::ViewParams::instance()->getAxisXColor();
|
||||
m_xColor = App::Color(static_cast<uint32_t>(colorLong));
|
||||
m_xColor = Base::Color(static_cast<uint32_t>(colorLong));
|
||||
colorLong = Gui::ViewParams::instance()->getAxisYColor();
|
||||
m_yColor = App::Color(static_cast<uint32_t>(colorLong));
|
||||
m_yColor = Base::Color(static_cast<uint32_t>(colorLong));
|
||||
colorLong = Gui::ViewParams::instance()->getAxisZColor();
|
||||
m_zColor = App::Color(static_cast<uint32_t>(colorLong));
|
||||
m_zColor = Base::Color(static_cast<uint32_t>(colorLong));
|
||||
|
||||
naviCube->updateColors();
|
||||
|
||||
|
||||
@@ -534,9 +534,9 @@ private:
|
||||
bool vboEnabled;
|
||||
bool naviCubeEnabled;
|
||||
|
||||
App::Color m_xColor;
|
||||
App::Color m_yColor;
|
||||
App::Color m_zColor;
|
||||
Base::Color m_xColor;
|
||||
Base::Color m_yColor;
|
||||
Base::Color m_zColor;
|
||||
|
||||
bool editing;
|
||||
QCursor editCursor, zoomCursor, panCursor, spinCursor;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Builder3D.h>
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
|
||||
#include "NaviCube.h"
|
||||
#include "Navigation/NavigationStyle.h"
|
||||
@@ -542,19 +542,19 @@ void NaviCubeSettings::parameterChanged(const char* Name)
|
||||
}
|
||||
else if (strcmp(Name, "BaseColor") == 0) {
|
||||
unsigned long col = hGrp->GetUnsigned("BaseColor", 3806916544);
|
||||
nc->setBaseColor(App::Color::fromPackedRGBA<QColor>(col));
|
||||
nc->setBaseColor(Base::Color::fromPackedRGBA<QColor>(col));
|
||||
// update default contrast colors
|
||||
parameterChanged("EmphaseColor");
|
||||
}
|
||||
else if (strcmp(Name, "EmphaseColor") == 0) {
|
||||
App::Color bc((uint32_t)hGrp->GetUnsigned("BaseColor", 3806916544));
|
||||
Base::Color bc((uint32_t)hGrp->GetUnsigned("BaseColor", 3806916544));
|
||||
unsigned long d = bc.r + bc.g + bc.b >= 1.5f ? 255 : 4294967295;
|
||||
unsigned long col = hGrp->GetUnsigned("EmphaseColor", d);
|
||||
nc->setEmphaseColor(App::Color::fromPackedRGBA<QColor>(col));
|
||||
nc->setEmphaseColor(Base::Color::fromPackedRGBA<QColor>(col));
|
||||
}
|
||||
else if (strcmp(Name, "HiliteColor") == 0) {
|
||||
unsigned long col = hGrp->GetUnsigned("HiliteColor", 2867003391);
|
||||
nc->setHiliteColor(App::Color::fromPackedRGBA<QColor>(col));
|
||||
nc->setHiliteColor(Base::Color::fromPackedRGBA<QColor>(col));
|
||||
}
|
||||
else if (strcmp(Name, "BorderWidth") == 0) {
|
||||
nc->setBorderWidth(hGrp->GetFloat("BorderWidth", 1.1));
|
||||
|
||||
@@ -58,8 +58,6 @@ class QObject;
|
||||
|
||||
namespace Base {
|
||||
class Matrix4D;
|
||||
}
|
||||
namespace App {
|
||||
class Color;
|
||||
}
|
||||
|
||||
@@ -418,11 +416,11 @@ public:
|
||||
/** @name Color management methods
|
||||
*/
|
||||
//@{
|
||||
virtual std::map<std::string, App::Color> getElementColors(const char *element=nullptr) const {
|
||||
virtual std::map<std::string, Base::Color> getElementColors(const char *element=nullptr) const {
|
||||
(void)element;
|
||||
return {};
|
||||
}
|
||||
virtual void setElementColors(const std::map<std::string, App::Color> &colors) {
|
||||
virtual void setElementColors(const std::map<std::string, Base::Color> &colors) {
|
||||
(void)colors;
|
||||
}
|
||||
static const std::string &hiddenMarker();
|
||||
|
||||
@@ -116,7 +116,7 @@ ViewProviderAnnotation::~ViewProviderAnnotation()
|
||||
void ViewProviderAnnotation::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (prop == &TextColor) {
|
||||
const App::Color& c = TextColor.getValue();
|
||||
const Base::Color& c = TextColor.getValue();
|
||||
pColor->rgb.setValue(c.r,c.g,c.b);
|
||||
}
|
||||
else if (prop == &Justification) {
|
||||
@@ -315,7 +315,7 @@ ViewProviderAnnotationLabel::~ViewProviderAnnotationLabel()
|
||||
void ViewProviderAnnotationLabel::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (prop == &BackgroundColor) {
|
||||
const App::Color& c = BackgroundColor.getValue();
|
||||
const Base::Color& c = BackgroundColor.getValue();
|
||||
pColor->rgb.setValue(c.r,c.g,c.b);
|
||||
}
|
||||
if (prop == &TextColor || prop == &BackgroundColor ||
|
||||
@@ -454,10 +454,10 @@ void ViewProviderAnnotationLabel::drawImage(const std::vector<std::string>& s)
|
||||
QFontMetrics fm(font);
|
||||
int w = 0;
|
||||
int h = fm.height() * s.size();
|
||||
const App::Color& b = this->BackgroundColor.getValue();
|
||||
const Base::Color& b = this->BackgroundColor.getValue();
|
||||
QColor brush;
|
||||
brush.setRgbF(b.r,b.g,b.b);
|
||||
const App::Color& t = this->TextColor.getValue();
|
||||
const Base::Color& t = this->TextColor.getValue();
|
||||
QColor front;
|
||||
front.setRgbF(t.r,t.g,t.b);
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ ViewProviderColorBuilder::~ViewProviderColorBuilder() = default;
|
||||
void ViewProviderColorBuilder::buildNodes(const App::Property* prop, std::vector<SoNode*>& node) const
|
||||
{
|
||||
const auto color = static_cast<const App::PropertyColorList*>(prop);
|
||||
const std::vector<App::Color>& val = color->getValues();
|
||||
const std::vector<Base::Color>& val = color->getValues();
|
||||
unsigned long i=0;
|
||||
|
||||
auto material = new SoMaterial();
|
||||
|
||||
@@ -34,7 +34,7 @@ PROPERTY_SOURCE(Gui::ViewProviderFeature, Gui::ViewProviderDocumentObject)
|
||||
|
||||
ViewProviderFeature::ViewProviderFeature()
|
||||
{
|
||||
App::Color c;
|
||||
Base::Color c;
|
||||
ADD_PROPERTY(ColourList,(c));
|
||||
}
|
||||
|
||||
|
||||
@@ -997,7 +997,7 @@ void LinkView::setMaterial(int index, const App::Material *material) {
|
||||
pcLinkRoot->removeColorOverride();
|
||||
return;
|
||||
}
|
||||
App::Color c = material->diffuseColor;
|
||||
Base::Color c = material->diffuseColor;
|
||||
c.setTransparency(material->transparency);
|
||||
pcLinkRoot->setColorOverride(c);
|
||||
for(int i=0;i<getSize();++i)
|
||||
@@ -1010,7 +1010,7 @@ void LinkView::setMaterial(int index, const App::Material *material) {
|
||||
info.pcRoot->removeColorOverride();
|
||||
return;
|
||||
}
|
||||
App::Color c = material->diffuseColor;
|
||||
Base::Color c = material->diffuseColor;
|
||||
c.setTransparency(material->transparency);
|
||||
info.pcRoot->setColorOverride(c);
|
||||
}
|
||||
@@ -2933,7 +2933,7 @@ PyObject *ViewProviderLink::getPyLinkView() {
|
||||
return linkView->getPyObject();
|
||||
}
|
||||
|
||||
std::map<std::string, App::Color> ViewProviderLink::getElementColors(const char *subname) const {
|
||||
std::map<std::string, Base::Color> ViewProviderLink::getElementColors(const char *subname) const {
|
||||
bool isPrefix = true;
|
||||
if(!subname)
|
||||
subname = "";
|
||||
@@ -2941,7 +2941,7 @@ std::map<std::string, App::Color> ViewProviderLink::getElementColors(const char
|
||||
auto len = strlen(subname);
|
||||
isPrefix = !len || subname[len-1]=='.';
|
||||
}
|
||||
std::map<std::string, App::Color> colors;
|
||||
std::map<std::string, Base::Color> colors;
|
||||
auto ext = getLinkExtension();
|
||||
if(!ext || ! ext->getColoredElementsProperty())
|
||||
return colors;
|
||||
@@ -2951,7 +2951,7 @@ std::map<std::string, App::Color> ViewProviderLink::getElementColors(const char
|
||||
std::string wildcard(subname);
|
||||
if(wildcard == "Face" || wildcard == "Face*" || wildcard.empty()) {
|
||||
if(wildcard.size()==4 || OverrideMaterial.getValue()) {
|
||||
App::Color c = ShapeMaterial.getValue().diffuseColor;
|
||||
Base::Color c = ShapeMaterial.getValue().diffuseColor;
|
||||
c.setTransparency(ShapeMaterial.getValue().transparency);
|
||||
colors["Face"] = c;
|
||||
if(wildcard.size()==4)
|
||||
@@ -3072,9 +3072,9 @@ std::map<std::string, App::Color> ViewProviderLink::getElementColors(const char
|
||||
bool found = true;
|
||||
if(colors.empty()) {
|
||||
found = false;
|
||||
colors.emplace(subname,App::Color());
|
||||
colors.emplace(subname,Base::Color());
|
||||
}
|
||||
std::map<std::string, App::Color> ret;
|
||||
std::map<std::string, Base::Color> ret;
|
||||
for(const auto &v : colors) {
|
||||
const char *pos = nullptr;
|
||||
auto sobj = getObject()->resolve(v.first.c_str(),nullptr,nullptr,&pos);
|
||||
@@ -3098,18 +3098,18 @@ std::map<std::string, App::Color> ViewProviderLink::getElementColors(const char
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ViewProviderLink::setElementColors(const std::map<std::string, App::Color> &colorMap) {
|
||||
void ViewProviderLink::setElementColors(const std::map<std::string, Base::Color> &colorMap) {
|
||||
auto ext = getLinkExtension();
|
||||
if(!ext || ! ext->getColoredElementsProperty())
|
||||
return;
|
||||
|
||||
// For checking and collapsing array element color
|
||||
std::map<std::string,std::map<int,App::Color> > subMap;
|
||||
std::map<std::string,std::map<int,Base::Color> > subMap;
|
||||
int element_count = ext->getElementCountValue();
|
||||
|
||||
std::vector<std::string> subs;
|
||||
std::vector<App::Color> colors;
|
||||
App::Color faceColor;
|
||||
std::vector<Base::Color> colors;
|
||||
Base::Color faceColor;
|
||||
bool hasFaceColor = false;
|
||||
for(const auto &v : colorMap) {
|
||||
if(!hasFaceColor && v.first == "Face") {
|
||||
@@ -3133,7 +3133,7 @@ void ViewProviderLink::setElementColors(const std::map<std::string, App::Color>
|
||||
}
|
||||
for(auto &v : subMap) {
|
||||
if(element_count == (int)v.second.size()) {
|
||||
App::Color firstColor = v.second.begin()->second;
|
||||
Base::Color firstColor = v.second.begin()->second;
|
||||
subs.push_back(v.first);
|
||||
colors.push_back(firstColor);
|
||||
for(auto it=v.second.begin();it!=v.second.end();) {
|
||||
@@ -3179,7 +3179,7 @@ void ViewProviderLink::applyColors() {
|
||||
// reset color and visibility first
|
||||
action.apply(linkView->getLinkRoot());
|
||||
|
||||
std::map<std::string, std::map<std::string,App::Color> > colorMap;
|
||||
std::map<std::string, std::map<std::string,Base::Color> > colorMap;
|
||||
std::set<std::string> hideList;
|
||||
auto colors = getElementColors();
|
||||
colors.erase("Face");
|
||||
|
||||
@@ -248,8 +248,8 @@ public:
|
||||
|
||||
static void updateLinks(ViewProvider *vp);
|
||||
|
||||
std::map<std::string, App::Color> getElementColors(const char *subname=nullptr) const override;
|
||||
void setElementColors(const std::map<std::string, App::Color> &colors) override;
|
||||
std::map<std::string, Base::Color> getElementColors(const char *subname=nullptr) const override;
|
||||
void setElementColors(const std::map<std::string, Base::Color> &colors) override;
|
||||
|
||||
void setOverrideMode(const std::string &mode) override;
|
||||
|
||||
|
||||
@@ -484,7 +484,7 @@ PyObject* ViewProviderPy::setElementColors(PyObject* args)
|
||||
if(!PyDict_Check(pyObj))
|
||||
throw Py::TypeError("Expect a dict");
|
||||
|
||||
std::map<std::string,App::Color> colors;
|
||||
std::map<std::string,Base::Color> colors;
|
||||
Py::Dict dict(pyObj);
|
||||
for(auto it=dict.begin();it!=dict.end();++it) {
|
||||
const auto &value = *it;
|
||||
|
||||
+3
-3
@@ -671,7 +671,7 @@ QColor ColorButton::color() const
|
||||
*/
|
||||
void ColorButton::setPackedColor(uint32_t c)
|
||||
{
|
||||
App::Color color;
|
||||
Base::Color color;
|
||||
color.setPackedValue(c);
|
||||
d->col.setRedF(color.r);
|
||||
d->col.setGreenF(color.g);
|
||||
@@ -686,7 +686,7 @@ void ColorButton::setPackedColor(uint32_t c)
|
||||
*/
|
||||
uint32_t ColorButton::packedColor() const
|
||||
{
|
||||
App::Color color(d->col.redF(), d->col.greenF(), d->col.blueF(), d->col.alphaF());
|
||||
Base::Color color(d->col.redF(), d->col.greenF(), d->col.blueF(), d->col.alphaF());
|
||||
return color.getPackedValue();
|
||||
}
|
||||
|
||||
@@ -1009,7 +1009,7 @@ void StatefulLabel::setState(QString state)
|
||||
if (unsignedEntry.first == entry->second.preferenceString) {
|
||||
// Convert the stored Uint into usable color data:
|
||||
unsigned int col = unsignedEntry.second;
|
||||
QColor qcolor(App::Color::fromPackedRGB<QColor>(col));
|
||||
QColor qcolor(Base::Color::fromPackedRGB<QColor>(col));
|
||||
this->setStyleSheet(QStringLiteral("Gui--StatefulLabel{ color : rgba(%1,%2,%3,%4) ;}").arg(qcolor.red()).arg(qcolor.green()).arg(qcolor.blue()).arg(qcolor.alpha()));
|
||||
_styleCache[state] = this->styleSheet();
|
||||
return;
|
||||
|
||||
@@ -3453,7 +3453,7 @@ QVariant PropertyColorItem::value(const App::Property* prop) const
|
||||
{
|
||||
assert(prop && prop->isDerivedFrom<App::PropertyColor>());
|
||||
|
||||
App::Color value = static_cast<const App::PropertyColor*>(prop)->getValue();
|
||||
Base::Color value = static_cast<const App::PropertyColor*>(prop)->getValue();
|
||||
return QVariant(value.asValue<QColor>());
|
||||
}
|
||||
|
||||
@@ -3777,13 +3777,13 @@ void PropertyMaterialItem::setValue(const QVariant& value)
|
||||
}
|
||||
|
||||
auto mat = value.value<Material>();
|
||||
App::Color dc;
|
||||
Base::Color dc;
|
||||
dc.setValue<QColor>(mat.diffuseColor);
|
||||
App::Color ac;
|
||||
Base::Color ac;
|
||||
ac.setValue<QColor>(mat.ambientColor);
|
||||
App::Color sc;
|
||||
Base::Color sc;
|
||||
sc.setValue<QColor>(mat.specularColor);
|
||||
App::Color ec;
|
||||
Base::Color ec;
|
||||
ec.setValue<QColor>(mat.emissiveColor);
|
||||
float s = mat.shininess;
|
||||
float t = mat.transparency;
|
||||
@@ -4284,13 +4284,13 @@ void PropertyMaterialListItem::setValue(const QVariant& value)
|
||||
str << "(";
|
||||
|
||||
auto mat = list[0].value<Material>();
|
||||
App::Color dc;
|
||||
Base::Color dc;
|
||||
dc.setValue<QColor>(mat.diffuseColor);
|
||||
App::Color ac;
|
||||
Base::Color ac;
|
||||
ac.setValue<QColor>(mat.ambientColor);
|
||||
App::Color sc;
|
||||
Base::Color sc;
|
||||
sc.setValue<QColor>(mat.specularColor);
|
||||
App::Color ec;
|
||||
Base::Color ec;
|
||||
ec.setValue<QColor>(mat.emissiveColor);
|
||||
float s = mat.shininess;
|
||||
float t = mat.transparency;
|
||||
|
||||
@@ -387,7 +387,7 @@ void ViewProviderPath::onChanged(const App::Property* prop)
|
||||
}
|
||||
else if (prop == &NormalColor) {
|
||||
if (!colorindex.empty() && coordStart >= 0 && coordStart < (int)colorindex.size()) {
|
||||
const App::Color& c = NormalColor.getValue();
|
||||
const Base::Color& c = NormalColor.getValue();
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/CAM");
|
||||
unsigned long rcol =
|
||||
@@ -429,7 +429,7 @@ void ViewProviderPath::onChanged(const App::Property* prop)
|
||||
}
|
||||
}
|
||||
else if (prop == &MarkerColor) {
|
||||
const App::Color& c = MarkerColor.getValue();
|
||||
const Base::Color& c = MarkerColor.getValue();
|
||||
pcMarkerColor->rgb.setValue(c.r, c.g, c.b);
|
||||
}
|
||||
else if (prop == &ShowNodes) {
|
||||
|
||||
@@ -636,7 +636,7 @@ def getrgb(color):
|
||||
|
||||
Parameters
|
||||
----------
|
||||
color : App::Color::Color
|
||||
color : Base::Color::Color
|
||||
FreeCAD color.
|
||||
|
||||
Returns
|
||||
|
||||
@@ -58,7 +58,7 @@ FeatureViewAnnotation::~FeatureViewAnnotation()
|
||||
App::DocumentObjectExecReturn* FeatureViewAnnotation::execute(void)
|
||||
{
|
||||
stringstream result, hr, hg, hb;
|
||||
const App::Color& c = TextColor.getValue();
|
||||
const Base::Color& c = TextColor.getValue();
|
||||
hr << hex << setfill('0') << setw(2) << (int)(255.0 * c.r);
|
||||
hg << hex << setfill('0') << setw(2) << (int)(255.0 * c.g);
|
||||
hb << hex << setfill('0') << setw(2) << (int)(255.0 * c.b);
|
||||
|
||||
@@ -153,7 +153,7 @@ App::DocumentObjectExecReturn* FeatureViewSpreadsheet::execute(void)
|
||||
// create the containing group
|
||||
std::string ViewName = Label.getValue();
|
||||
std::stringstream result, hr, hg, hb;
|
||||
const App::Color& c = Color.getValue();
|
||||
const Base::Color& c = Color.getValue();
|
||||
hr << std::hex << std::setfill('0') << std::setw(2) << (int)(255.0 * c.r);
|
||||
hg << std::hex << std::setfill('0') << std::setw(2) << (int)(255.0 * c.g);
|
||||
hb << std::hex << std::setfill('0') << std::setw(2) << (int)(255.0 * c.b);
|
||||
@@ -207,7 +207,7 @@ App::DocumentObjectExecReturn* FeatureViewSpreadsheet::execute(void)
|
||||
std::string textstyle = "";
|
||||
Spreadsheet::Cell* cell = sheet->getCell(address);
|
||||
if (cell) {
|
||||
App::Color f, b;
|
||||
Base::Color f, b;
|
||||
std::set<std::string> st;
|
||||
int colspan, rowspan;
|
||||
if (cell->getBackground(b)) {
|
||||
|
||||
@@ -67,7 +67,7 @@ void ViewProviderFemConstraintOnBoundary::highlightReferences(const bool on)
|
||||
if (originalPointColors[base].empty()) {
|
||||
originalPointColors[base] = vp->PointColorArray.getValues();
|
||||
}
|
||||
std::vector<App::Color> colors = originalPointColors[base];
|
||||
std::vector<Base::Color> colors = originalPointColors[base];
|
||||
|
||||
// go through the subelements with constraint and recolor them
|
||||
// TODO: Replace `ShapeAppearance` with anything more appropriate
|
||||
@@ -82,7 +82,7 @@ void ViewProviderFemConstraintOnBoundary::highlightReferences(const bool on)
|
||||
if (originalLineColors[base].empty()) {
|
||||
originalLineColors[base] = vp->LineColorArray.getValues();
|
||||
}
|
||||
std::vector<App::Color> colors = originalLineColors[base];
|
||||
std::vector<Base::Color> colors = originalLineColors[base];
|
||||
|
||||
// go through the subelements with constraint and recolor them
|
||||
// TODO: Replace `ShapeAppearance` with anything more appropriate
|
||||
@@ -97,7 +97,7 @@ void ViewProviderFemConstraintOnBoundary::highlightReferences(const bool on)
|
||||
if (originalFaceColors[base].empty()) {
|
||||
originalFaceColors[base] = vp->ShapeAppearance.getDiffuseColors();
|
||||
}
|
||||
std::vector<App::Color> colors = originalFaceColors[base];
|
||||
std::vector<Base::Color> colors = originalFaceColors[base];
|
||||
|
||||
// go through the subelements with constraint and recolor them
|
||||
// TODO: Replace shape DiffuseColor with anything more appropriate
|
||||
|
||||
@@ -46,9 +46,9 @@ public:
|
||||
void highlightReferences(const bool on) override;
|
||||
|
||||
private:
|
||||
std::map<Part::Feature*, std::vector<App::Color>> originalPointColors;
|
||||
std::map<Part::Feature*, std::vector<App::Color>> originalLineColors;
|
||||
std::map<Part::Feature*, std::vector<App::Color>> originalFaceColors;
|
||||
std::map<Part::Feature*, std::vector<Base::Color>> originalPointColors;
|
||||
std::map<Part::Feature*, std::vector<Base::Color>> originalLineColors;
|
||||
std::map<Part::Feature*, std::vector<Base::Color>> originalFaceColors;
|
||||
};
|
||||
|
||||
} // namespace FemGui
|
||||
|
||||
@@ -192,13 +192,13 @@ ViewProviderFemMesh::ViewProviderFemMesh()
|
||||
{
|
||||
sPixmap = "fem-femmesh-from-shape";
|
||||
|
||||
ADD_PROPERTY(PointColor, (App::Color(0.7f, 0.7f, 0.7f)));
|
||||
ADD_PROPERTY(PointColor, (Base::Color(0.7f, 0.7f, 0.7f)));
|
||||
ADD_PROPERTY(PointSize, (5.0f));
|
||||
PointSize.setConstraints(&floatRange);
|
||||
ADD_PROPERTY(LineWidth, (1.0f));
|
||||
LineWidth.setConstraints(&floatRange);
|
||||
|
||||
ShapeAppearance.setDiffuseColor(App::Color(1.0f, 0.7f, 0.0f));
|
||||
ShapeAppearance.setDiffuseColor(Base::Color(1.0f, 0.7f, 0.0f));
|
||||
Transparency.setValue(0);
|
||||
ADD_PROPERTY(BackfaceCulling, (true));
|
||||
ADD_PROPERTY(ShowInner, (false));
|
||||
@@ -412,7 +412,7 @@ void ViewProviderFemMesh::onChanged(const App::Property* prop)
|
||||
pcPointStyle->pointSize = PointSize.getValue();
|
||||
}
|
||||
else if (prop == &PointColor) {
|
||||
const App::Color& c = PointColor.getValue();
|
||||
const Base::Color& c = PointColor.getValue();
|
||||
pcPointMaterial->diffuseColor.setValue(c.r, c.g, c.b);
|
||||
}
|
||||
else if (prop == &BackfaceCulling) {
|
||||
@@ -683,11 +683,11 @@ void ViewProviderFemMesh::applyDisplacementToNodes(double factor)
|
||||
}
|
||||
|
||||
void ViewProviderFemMesh::setColorByNodeId(const std::vector<long>& NodeIds,
|
||||
const std::vector<App::Color>& NodeColors)
|
||||
const std::vector<Base::Color>& NodeColors)
|
||||
{
|
||||
long endId = *(std::max_element(NodeIds.begin(), NodeIds.end()));
|
||||
|
||||
std::vector<App::Color> colorVec(endId + 1, App::Color(0, 1, 0));
|
||||
std::vector<Base::Color> colorVec(endId + 1, Base::Color(0, 1, 0));
|
||||
long i = 0;
|
||||
for (std::vector<long>::const_iterator it = NodeIds.begin(); it != NodeIds.end(); ++it, i++) {
|
||||
colorVec[*it] = NodeColors[i];
|
||||
@@ -696,7 +696,7 @@ void ViewProviderFemMesh::setColorByNodeId(const std::vector<long>& NodeIds,
|
||||
setColorByNodeIdHelper(colorVec);
|
||||
}
|
||||
|
||||
void ViewProviderFemMesh::setColorByNodeIdHelper(const std::vector<App::Color>& colorVec)
|
||||
void ViewProviderFemMesh::setColorByNodeIdHelper(const std::vector<Base::Color>& colorVec)
|
||||
{
|
||||
pcMatBinding->value = SoMaterialBinding::PER_VERTEX_INDEXED;
|
||||
|
||||
@@ -716,43 +716,43 @@ void ViewProviderFemMesh::setColorByNodeIdHelper(const std::vector<App::Color>&
|
||||
|
||||
void ViewProviderFemMesh::resetColorByNodeId()
|
||||
{
|
||||
const App::Color& c = ShapeAppearance.getDiffuseColor();
|
||||
const Base::Color& c = ShapeAppearance.getDiffuseColor();
|
||||
NodeColorArray.setValue(c);
|
||||
}
|
||||
|
||||
void ViewProviderFemMesh::setColorByNodeId(
|
||||
const std::map<std::vector<long>, App::Color>& elemColorMap)
|
||||
const std::map<std::vector<long>, Base::Color>& elemColorMap)
|
||||
{
|
||||
setColorByIdHelper(elemColorMap, vNodeElementIdx, 0, NodeColorArray);
|
||||
}
|
||||
|
||||
void ViewProviderFemMesh::setColorByElementId(
|
||||
const std::map<std::vector<long>, App::Color>& elemColorMap)
|
||||
const std::map<std::vector<long>, Base::Color>& elemColorMap)
|
||||
{
|
||||
setColorByIdHelper(elemColorMap, vFaceElementIdx, 3, ElementColorArray);
|
||||
}
|
||||
|
||||
void ViewProviderFemMesh::setColorByIdHelper(
|
||||
const std::map<std::vector<long>, App::Color>& elemColorMap,
|
||||
const std::map<std::vector<long>, Base::Color>& elemColorMap,
|
||||
const std::vector<unsigned long>& vElementIdx,
|
||||
int rShift,
|
||||
App::PropertyColorList& prop)
|
||||
{
|
||||
std::vector<App::Color> vecColor(vElementIdx.size());
|
||||
std::map<long, const App::Color*> colorMap;
|
||||
std::vector<Base::Color> vecColor(vElementIdx.size());
|
||||
std::map<long, const Base::Color*> colorMap;
|
||||
for (const auto& m : elemColorMap) {
|
||||
for (long i : m.first) {
|
||||
colorMap[i] = &m.second;
|
||||
}
|
||||
}
|
||||
|
||||
App::Color baseDif = ShapeAppearance.getDiffuseColor();
|
||||
Base::Color baseDif = ShapeAppearance.getDiffuseColor();
|
||||
int i = 0;
|
||||
for (std::vector<unsigned long>::const_iterator it = vElementIdx.begin();
|
||||
it != vElementIdx.end();
|
||||
++it, i++) {
|
||||
unsigned long ElemIdx = ((*it) >> rShift);
|
||||
const std::map<long, const App::Color*>::const_iterator pos = colorMap.find(ElemIdx);
|
||||
const std::map<long, const Base::Color*>::const_iterator pos = colorMap.find(ElemIdx);
|
||||
vecColor[i] = pos == colorMap.end() ? baseDif : *pos->second;
|
||||
}
|
||||
|
||||
@@ -762,10 +762,10 @@ void ViewProviderFemMesh::setColorByIdHelper(
|
||||
void ViewProviderFemMesh::setMaterialOverall() const
|
||||
{
|
||||
const App::Material& mat = ShapeAppearance[0];
|
||||
App::Color baseDif = mat.diffuseColor;
|
||||
App::Color baseAmb = mat.ambientColor;
|
||||
App::Color baseSpe = mat.specularColor;
|
||||
App::Color baseEmi = mat.emissiveColor;
|
||||
Base::Color baseDif = mat.diffuseColor;
|
||||
Base::Color baseAmb = mat.ambientColor;
|
||||
Base::Color baseSpe = mat.specularColor;
|
||||
Base::Color baseEmi = mat.emissiveColor;
|
||||
float baseShi = mat.shininess;
|
||||
float baseTra = mat.transparency;
|
||||
|
||||
@@ -793,15 +793,15 @@ void ViewProviderFemMesh::setMaterialByColorArray(
|
||||
const std::vector<unsigned long>& vElementIdx) const
|
||||
{
|
||||
const App::Material& baseMat = ShapeAppearance[0];
|
||||
App::Color baseDif = baseMat.diffuseColor;
|
||||
App::Color baseAmb = baseMat.ambientColor;
|
||||
App::Color baseSpe = baseMat.specularColor;
|
||||
App::Color baseEmi = baseMat.emissiveColor;
|
||||
Base::Color baseDif = baseMat.diffuseColor;
|
||||
Base::Color baseAmb = baseMat.ambientColor;
|
||||
Base::Color baseSpe = baseMat.specularColor;
|
||||
Base::Color baseEmi = baseMat.emissiveColor;
|
||||
float baseShi = baseMat.shininess;
|
||||
float baseTra = baseMat.transparency;
|
||||
|
||||
// resizing and writing the color vector:
|
||||
std::vector<App::Color> vecColor = prop->getValue();
|
||||
std::vector<Base::Color> vecColor = prop->getValue();
|
||||
size_t elemSize = vElementIdx.size();
|
||||
if (vecColor.size() == 1) {
|
||||
pcMatBinding->value = SoMaterialBinding::OVERALL;
|
||||
@@ -844,7 +844,7 @@ void ViewProviderFemMesh::setMaterialByColorArray(
|
||||
vecColor.resize(elemSize, baseDif);
|
||||
|
||||
int i = 0;
|
||||
for (const App::Color& c : vecColor) {
|
||||
for (const Base::Color& c : vecColor) {
|
||||
diffuse[i] = SbColor(c.r, c.g, c.b);
|
||||
ambient[i] = SbColor(baseAmb.r, baseAmb.g, baseAmb.b);
|
||||
specular[i] = SbColor(baseSpe.r, baseSpe.g, baseSpe.b);
|
||||
@@ -866,7 +866,7 @@ void ViewProviderFemMesh::setMaterialByColorArray(
|
||||
|
||||
void ViewProviderFemMesh::resetColorByElementId()
|
||||
{
|
||||
const App::Color& c = ShapeAppearance.getDiffuseColor();
|
||||
const Base::Color& c = ShapeAppearance.getDiffuseColor();
|
||||
ElementColorArray.setValue(c);
|
||||
}
|
||||
|
||||
|
||||
@@ -114,9 +114,9 @@ public:
|
||||
//@{
|
||||
|
||||
/// set the color for each node
|
||||
void setColorByNodeId(const std::map<std::vector<long>, App::Color>& NodeColorMap);
|
||||
void setColorByNodeId(const std::map<std::vector<long>, Base::Color>& NodeColorMap);
|
||||
void setColorByNodeId(const std::vector<long>& NodeIds,
|
||||
const std::vector<App::Color>& NodeColors);
|
||||
const std::vector<Base::Color>& NodeColors);
|
||||
|
||||
/// reset the view of the node colors
|
||||
void resetColorByNodeId();
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
/// reaply the node displacement with a certain factor and do a redraw
|
||||
void applyDisplacementToNodes(double factor);
|
||||
/// set the color for each element
|
||||
void setColorByElementId(const std::map<std::vector<long>, App::Color>& ElementColorMap);
|
||||
void setColorByElementId(const std::map<std::vector<long>, Base::Color>& ElementColorMap);
|
||||
/// reset the view of the element colors
|
||||
void resetColorByElementId();
|
||||
void setMaterialByElement();
|
||||
@@ -151,9 +151,9 @@ protected:
|
||||
/// get called by the container whenever a property has been changed
|
||||
void onChanged(const App::Property* prop) override;
|
||||
|
||||
void setColorByNodeIdHelper(const std::vector<App::Color>&);
|
||||
void setColorByNodeIdHelper(const std::vector<Base::Color>&);
|
||||
void setDisplacementByNodeIdHelper(const std::vector<Base::Vector3d>& DispVector, long startId);
|
||||
void setColorByIdHelper(const std::map<std::vector<long>, App::Color>& elemColorMap,
|
||||
void setColorByIdHelper(const std::map<std::vector<long>, Base::Color>& elemColorMap,
|
||||
const std::vector<unsigned long>& vElementIdx,
|
||||
int rShift,
|
||||
App::PropertyColorList& prop);
|
||||
|
||||
@@ -41,7 +41,7 @@ PyObject* ViewProviderFemMeshPy::applyDisplacement(PyObject* args)
|
||||
}
|
||||
|
||||
|
||||
App::Color calcColor(double value, double min, double max)
|
||||
Base::Color calcColor(double value, double min, double max)
|
||||
{
|
||||
if (max < 0) {
|
||||
max = 0;
|
||||
@@ -51,27 +51,27 @@ App::Color calcColor(double value, double min, double max)
|
||||
}
|
||||
|
||||
if (value < min) {
|
||||
return App::Color(0.0, 0.0, 1.0);
|
||||
return Base::Color(0.0, 0.0, 1.0);
|
||||
}
|
||||
if (value > max) {
|
||||
return App::Color(1.0, 0.0, 0.0);
|
||||
return Base::Color(1.0, 0.0, 0.0);
|
||||
}
|
||||
if (value == 0.0) {
|
||||
return App::Color(0.0, 1.0, 0.0);
|
||||
return Base::Color(0.0, 1.0, 0.0);
|
||||
}
|
||||
if (value > max / 2.0) {
|
||||
return App::Color(1.0, 1 - ((value - (max / 2.0)) / (max / 2.0)), 0.0);
|
||||
return Base::Color(1.0, 1 - ((value - (max / 2.0)) / (max / 2.0)), 0.0);
|
||||
}
|
||||
if (value > 0.0) {
|
||||
return App::Color(value / (max / 2.0), 1.0, 0.0);
|
||||
return Base::Color(value / (max / 2.0), 1.0, 0.0);
|
||||
}
|
||||
if (value < min / 2.0) {
|
||||
return App::Color(0.0, 1 - ((value - (min / 2.0)) / (min / 2.0)), 1.0);
|
||||
return Base::Color(0.0, 1 - ((value - (min / 2.0)) / (min / 2.0)), 1.0);
|
||||
}
|
||||
if (value < 0.0) {
|
||||
return App::Color(0.0, 1.0, value / (min / 2.0));
|
||||
return Base::Color(0.0, 1.0, value / (min / 2.0));
|
||||
}
|
||||
return App::Color(0, 0, 0);
|
||||
return Base::Color(0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ PyObject* ViewProviderFemMeshPy::setNodeColorByScalars(PyObject* args)
|
||||
PyErr_SetString(PyExc_ValueError, "PyList_Size < 0. That is not a valid list!");
|
||||
Py_Return;
|
||||
}
|
||||
std::vector<App::Color> node_colors(num_items);
|
||||
std::vector<Base::Color> node_colors(num_items);
|
||||
for (int i = 0; i < num_items; i++) {
|
||||
PyObject* id_py = PyList_GetItem(node_ids_py, i);
|
||||
long id = PyLong_AsLong(id_py);
|
||||
@@ -182,9 +182,9 @@ Py::Dict ViewProviderFemMeshPy::getNodeColor() const
|
||||
namespace
|
||||
{
|
||||
|
||||
std::map<std::vector<long>, App::Color> colorMapFromDict(Py::Dict& arg)
|
||||
std::map<std::vector<long>, Base::Color> colorMapFromDict(Py::Dict& arg)
|
||||
{
|
||||
std::map<std::vector<long>, App::Color> colorMap;
|
||||
std::map<std::vector<long>, Base::Color> colorMap;
|
||||
for (Py::Dict::iterator it = arg.begin(); it != arg.end(); ++it) {
|
||||
std::vector<long> vecId;
|
||||
const Py::Object& id = (*it).first;
|
||||
@@ -199,7 +199,7 @@ std::map<std::vector<long>, App::Color> colorMapFromDict(Py::Dict& arg)
|
||||
}
|
||||
const Py::Object& value = (*it).second;
|
||||
Py::Tuple color(value);
|
||||
colorMap[vecId] = App::Color(Py::Float(color[0]), Py::Float(color[1]), Py::Float(color[2]));
|
||||
colorMap[vecId] = Base::Color(Py::Float(color[0]), Py::Float(color[1]), Py::Float(color[2]));
|
||||
}
|
||||
|
||||
return colorMap;
|
||||
|
||||
@@ -701,8 +701,8 @@ void ViewProviderFemPostObject::WriteColorData(bool ResetColorBarRange)
|
||||
m_matPlainEdges->transparency.setNum(numPts);
|
||||
float* transp = m_material->transparency.startEditing();
|
||||
float* edgeTransp = m_matPlainEdges->transparency.startEditing();
|
||||
App::Color c;
|
||||
App::Color cEdge = EdgeColor.getValue();
|
||||
Base::Color c;
|
||||
Base::Color cEdge = EdgeColor.getValue();
|
||||
for (int i = 0; i < numPts; i++) {
|
||||
|
||||
double value = 0;
|
||||
@@ -928,7 +928,7 @@ void ViewProviderFemPostObject::onChanged(const App::Property* prop)
|
||||
m_drawStyle->pointSize.setValue(PointSize.getValue());
|
||||
}
|
||||
else if (prop == &EdgeColor && setupPipeline()) {
|
||||
App::Color c = EdgeColor.getValue();
|
||||
Base::Color c = EdgeColor.getValue();
|
||||
SbColor* edgeColor = m_matPlainEdges->diffuseColor.startEditing();
|
||||
for (int i = 0; i < m_matPlainEdges->diffuseColor.getNum(); ++i) {
|
||||
edgeColor[i].setValue(c.r, c.g, c.b);
|
||||
|
||||
@@ -281,7 +281,7 @@ private:
|
||||
try {
|
||||
Py::Sequence list(object);
|
||||
std::vector<App::DocumentObject*> objs;
|
||||
std::map<Part::Feature*, std::vector<App::Color>> partColor;
|
||||
std::map<Part::Feature*, std::vector<Base::Color>> partColor;
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
PyObject* item = (*it).ptr();
|
||||
if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) {
|
||||
@@ -310,7 +310,7 @@ private:
|
||||
hApp->NewDocument(TCollection_ExtendedString("MDTV-CAF"), hDoc);
|
||||
|
||||
auto getShapeColors = [partColor](App::DocumentObject* obj, const char* subname) {
|
||||
std::map<std::string, App::Color> cols;
|
||||
std::map<std::string, Base::Color> cols;
|
||||
auto it = partColor.find(dynamic_cast<Part::Feature*>(obj));
|
||||
if (it != partColor.end() && boost::starts_with(subname, "Face")) {
|
||||
const auto& colors = it->second;
|
||||
|
||||
@@ -133,7 +133,7 @@ void ExportOCAF::exportObjects(std::vector<App::DocumentObject*>& objs)
|
||||
std::vector<int> part_id;
|
||||
getFreeLabels(hierarchical_label, FreeLabels, part_id);
|
||||
|
||||
std::vector<std::vector<App::Color>> Colors;
|
||||
std::vector<std::vector<Base::Color>> Colors;
|
||||
getPartColors(hierarchical_part, FreeLabels, part_id, Colors);
|
||||
reallocateFreeShape(hierarchical_part, FreeLabels, part_id, Colors);
|
||||
|
||||
@@ -179,7 +179,7 @@ int ExportOCAF::exportObject(App::DocumentObject* obj,
|
||||
|
||||
if (obj->isDerivedFrom<Part::Feature>()) {
|
||||
Part::Feature* part = static_cast<Part::Feature*>(obj);
|
||||
std::vector<App::Color> colors;
|
||||
std::vector<Base::Color> colors;
|
||||
findColors(part, colors);
|
||||
|
||||
return_label =
|
||||
@@ -221,7 +221,7 @@ void ExportOCAF::createNode(App::Part* part,
|
||||
}
|
||||
|
||||
int ExportOCAF::saveShape(Part::Feature* part,
|
||||
const std::vector<App::Color>& colors,
|
||||
const std::vector<Base::Color>& colors,
|
||||
std::vector<TDF_Label>& hierarchical_label,
|
||||
std::vector<TopLoc_Location>& hierarchical_loc,
|
||||
std::vector<App::DocumentObject*>& hierarchical_part)
|
||||
@@ -301,7 +301,7 @@ int ExportOCAF::saveShape(Part::Feature* part,
|
||||
}
|
||||
|
||||
if (!faceLabel.IsNull()) {
|
||||
const App::Color& color = colors[index - 1];
|
||||
const Base::Color& color = colors[index - 1];
|
||||
col = Tools::convertColor(color);
|
||||
aColorTool->SetColor(faceLabel, col, XCAFDoc_ColorSurf);
|
||||
}
|
||||
@@ -310,7 +310,7 @@ int ExportOCAF::saveShape(Part::Feature* part,
|
||||
}
|
||||
}
|
||||
else if (!colors.empty()) {
|
||||
App::Color color = colors.front();
|
||||
Base::Color color = colors.front();
|
||||
col = Tools::convertColor(color);
|
||||
aColorTool->SetColor(shapeLabel, col, XCAFDoc_ColorGen);
|
||||
}
|
||||
@@ -347,12 +347,12 @@ void ExportOCAF::getFreeLabels(std::vector<TDF_Label>& hierarchical_label,
|
||||
void ExportOCAF::getPartColors(std::vector<App::DocumentObject*> hierarchical_part,
|
||||
std::vector<TDF_Label> FreeLabels,
|
||||
std::vector<int> part_id,
|
||||
std::vector<std::vector<App::Color>>& Colors) const
|
||||
std::vector<std::vector<Base::Color>>& Colors) const
|
||||
{
|
||||
// I am seeking for the colors of each parts
|
||||
std::size_t n = FreeLabels.size();
|
||||
for (std::size_t i = 0; i < n; i++) {
|
||||
std::vector<App::Color> colors;
|
||||
std::vector<Base::Color> colors;
|
||||
Part::Feature* part = static_cast<Part::Feature*>(hierarchical_part.at(part_id.at(i)));
|
||||
findColors(part, colors);
|
||||
Colors.push_back(colors);
|
||||
@@ -362,7 +362,7 @@ void ExportOCAF::getPartColors(std::vector<App::DocumentObject*> hierarchical_pa
|
||||
void ExportOCAF::reallocateFreeShape(std::vector<App::DocumentObject*> hierarchical_part,
|
||||
std::vector<TDF_Label> FreeLabels,
|
||||
std::vector<int> part_id,
|
||||
std::vector<std::vector<App::Color>>& Colors)
|
||||
std::vector<std::vector<Base::Color>>& Colors)
|
||||
{
|
||||
std::size_t n = FreeLabels.size();
|
||||
for (std::size_t i = 0; i < n; i++) {
|
||||
@@ -372,7 +372,7 @@ void ExportOCAF::reallocateFreeShape(std::vector<App::DocumentObject*> hierarchi
|
||||
Part::Feature* part = static_cast<Part::Feature*>(hierarchical_part.at(part_id.at(i)));
|
||||
aShapeTool->SetShape(label, part->Shape.getValue());
|
||||
// Add color information
|
||||
std::vector<App::Color> colors;
|
||||
std::vector<Base::Color> colors;
|
||||
colors = Colors.at(i);
|
||||
TopoDS_Shape baseShape = part->Shape.getValue();
|
||||
|
||||
@@ -409,7 +409,7 @@ void ExportOCAF::reallocateFreeShape(std::vector<App::DocumentObject*> hierarchi
|
||||
}
|
||||
|
||||
if (!faceLabel.IsNull()) {
|
||||
const App::Color& color = colors[index - 1];
|
||||
const Base::Color& color = colors[index - 1];
|
||||
col = Tools::convertColor(color);
|
||||
aColorTool->SetColor(faceLabel, col, XCAFDoc_ColorSurf);
|
||||
}
|
||||
@@ -419,7 +419,7 @@ void ExportOCAF::reallocateFreeShape(std::vector<App::DocumentObject*> hierarchi
|
||||
}
|
||||
}
|
||||
else if (!colors.empty()) {
|
||||
App::Color color = colors.front();
|
||||
Base::Color color = colors.front();
|
||||
col = Tools::convertColor(color);
|
||||
aColorTool->SetColor(label, col, XCAFDoc_ColorGen);
|
||||
}
|
||||
@@ -463,9 +463,9 @@ ExportOCAFCmd::ExportOCAFCmd(Handle(TDocStd_Document) h, bool explicitPlacement)
|
||||
: ExportOCAF(h, explicitPlacement)
|
||||
{}
|
||||
|
||||
void ExportOCAFCmd::findColors(Part::Feature* part, std::vector<App::Color>& colors) const
|
||||
void ExportOCAFCmd::findColors(Part::Feature* part, std::vector<Base::Color>& colors) const
|
||||
{
|
||||
std::map<Part::Feature*, std::vector<App::Color>>::const_iterator it = partColors.find(part);
|
||||
std::map<Part::Feature*, std::vector<Base::Color>>::const_iterator it = partColors.find(part);
|
||||
if (it != partColors.end()) {
|
||||
colors = it->second;
|
||||
}
|
||||
|
||||
@@ -65,18 +65,18 @@ public:
|
||||
std::vector<TopLoc_Location>& hierarchical_loc,
|
||||
std::vector<App::DocumentObject*>& hierarchical_part);
|
||||
int saveShape(Part::Feature* part,
|
||||
const std::vector<App::Color>&,
|
||||
const std::vector<Base::Color>&,
|
||||
std::vector<TDF_Label>& hierarchical_label,
|
||||
std::vector<TopLoc_Location>& hierarchical_loc,
|
||||
std::vector<App::DocumentObject*>& hierarchical_part);
|
||||
void getPartColors(std::vector<App::DocumentObject*> hierarchical_part,
|
||||
std::vector<TDF_Label> FreeLabels,
|
||||
std::vector<int> part_id,
|
||||
std::vector<std::vector<App::Color>>& Colors) const;
|
||||
std::vector<std::vector<Base::Color>>& Colors) const;
|
||||
void reallocateFreeShape(std::vector<App::DocumentObject*> hierarchical_part,
|
||||
std::vector<TDF_Label> FreeLabels,
|
||||
std::vector<int> part_id,
|
||||
std::vector<std::vector<App::Color>>& Colors);
|
||||
std::vector<std::vector<Base::Color>>& Colors);
|
||||
void getFreeLabels(std::vector<TDF_Label>& hierarchical_label,
|
||||
std::vector<TDF_Label>& labels,
|
||||
std::vector<int>& label_part_id);
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
std::vector<TopLoc_Location>& hierarchical_loc);
|
||||
|
||||
private:
|
||||
virtual void findColors(Part::Feature*, std::vector<App::Color>&) const
|
||||
virtual void findColors(Part::Feature*, std::vector<Base::Color>&) const
|
||||
{}
|
||||
std::vector<App::DocumentObject*> filterPart(App::Part* part) const;
|
||||
|
||||
@@ -108,16 +108,16 @@ class ImportExport ExportOCAFCmd: public ExportOCAF
|
||||
{
|
||||
public:
|
||||
ExportOCAFCmd(Handle(TDocStd_Document) h, bool explicitPlacement);
|
||||
void setPartColorsMap(const std::map<Part::Feature*, std::vector<App::Color>>& colors)
|
||||
void setPartColorsMap(const std::map<Part::Feature*, std::vector<Base::Color>>& colors)
|
||||
{
|
||||
partColors = colors;
|
||||
}
|
||||
|
||||
private:
|
||||
void findColors(Part::Feature*, std::vector<App::Color>&) const override;
|
||||
void findColors(Part::Feature*, std::vector<Base::Color>&) const override;
|
||||
|
||||
private:
|
||||
std::map<Part::Feature*, std::vector<App::Color>> partColors;
|
||||
std::map<Part::Feature*, std::vector<Base::Color>> partColors;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ void ExportOCAF2::setupObject(TDF_Label label,
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<std::string, std::map<std::string, App::Color>> colors;
|
||||
std::map<std::string, std::map<std::string, Base::Color>> colors;
|
||||
static std::string marker(App::DocumentObject::hiddenMarker() + "*");
|
||||
static std::array<const char*, 3> keys = {"Face*", "Edge*", marker.c_str()};
|
||||
std::string childName;
|
||||
@@ -280,7 +280,7 @@ void ExportOCAF2::setupObject(TDF_Label label,
|
||||
aColorTool->SetVisibility(nodeLabel, Standard_False);
|
||||
continue;
|
||||
}
|
||||
const App::Color& c = vv.second;
|
||||
const Base::Color& c = vv.second;
|
||||
Quantity_ColorRGBA color = Tools::convertColor(c);
|
||||
auto colorType = vv.first[0] == 'F' ? XCAFDoc_ColorSurf : XCAFDoc_ColorCurv;
|
||||
if (vv.first == "Face" || vv.first == "Edge") {
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Import
|
||||
struct ImportExport ExportOCAFOptions
|
||||
{
|
||||
ExportOCAFOptions();
|
||||
App::Color defaultColor;
|
||||
Base::Color defaultColor;
|
||||
bool exportHidden = true;
|
||||
bool keepPlacement = false;
|
||||
};
|
||||
@@ -60,7 +60,7 @@ class ImportExport ExportOCAF2
|
||||
{
|
||||
public:
|
||||
using GetShapeColorsFunc =
|
||||
std::function<std::map<std::string, App::Color>(App::DocumentObject*, const char*)>;
|
||||
std::function<std::map<std::string, Base::Color>(App::DocumentObject*, const char*)>;
|
||||
explicit ExportOCAF2(Handle(TDocStd_Document) hDoc,
|
||||
GetShapeColorsFunc func = GetShapeColorsFunc());
|
||||
|
||||
|
||||
@@ -394,12 +394,12 @@ void ImportOCAF::createShape(const TopoDS_Shape& aShape,
|
||||
void ImportOCAF::loadColors(Part::Feature* part, const TopoDS_Shape& aShape)
|
||||
{
|
||||
Quantity_ColorRGBA aColor;
|
||||
App::Color color(0.8f, 0.8f, 0.8f);
|
||||
Base::Color color(0.8f, 0.8f, 0.8f);
|
||||
if (aColorTool->GetColor(aShape, XCAFDoc_ColorGen, aColor)
|
||||
|| aColorTool->GetColor(aShape, XCAFDoc_ColorSurf, aColor)
|
||||
|| aColorTool->GetColor(aShape, XCAFDoc_ColorCurv, aColor)) {
|
||||
color = Tools::convertColor(aColor);
|
||||
std::vector<App::Color> colors;
|
||||
std::vector<Base::Color> colors;
|
||||
colors.push_back(color);
|
||||
applyColors(part, colors);
|
||||
}
|
||||
@@ -412,7 +412,7 @@ void ImportOCAF::loadColors(Part::Feature* part, const TopoDS_Shape& aShape)
|
||||
}
|
||||
|
||||
bool found_face_color = false;
|
||||
std::vector<App::Color> faceColors;
|
||||
std::vector<Base::Color> faceColors;
|
||||
faceColors.resize(faces.Extent(), color);
|
||||
xp.Init(aShape, TopAbs_FACE);
|
||||
while (xp.More()) {
|
||||
@@ -438,7 +438,7 @@ ImportOCAFCmd::ImportOCAFCmd(Handle(TDocStd_Document) h, App::Document* d, const
|
||||
: ImportOCAF(h, d, name)
|
||||
{}
|
||||
|
||||
void ImportOCAFCmd::applyColors(Part::Feature* part, const std::vector<App::Color>& colors)
|
||||
void ImportOCAFCmd::applyColors(Part::Feature* part, const std::vector<Base::Color>& colors)
|
||||
{
|
||||
partColors[part] = colors;
|
||||
}
|
||||
@@ -503,7 +503,7 @@ void ImportXCAF::createShape(const TopoDS_Shape& shape, bool perface, bool setna
|
||||
std::map<Standard_Integer, Quantity_ColorRGBA>::const_iterator jt;
|
||||
jt = myColorMap.find(Part::ShapeMapHasher {}(shape));
|
||||
|
||||
App::Color partColor(0.8f, 0.8f, 0.8f);
|
||||
Base::Color partColor(0.8f, 0.8f, 0.8f);
|
||||
|
||||
|
||||
// set label name if defined
|
||||
@@ -524,7 +524,7 @@ void ImportXCAF::createShape(const TopoDS_Shape& shape, bool perface, bool setna
|
||||
xp.Next();
|
||||
}
|
||||
|
||||
std::vector<App::Color> faceColors;
|
||||
std::vector<Base::Color> faceColors;
|
||||
faceColors.resize(faces.Extent(), partColor);
|
||||
xp.Init(shape, TopAbs_FACE);
|
||||
while (xp.More()) {
|
||||
|
||||
@@ -81,7 +81,7 @@ private:
|
||||
const std::string&,
|
||||
std::vector<App::DocumentObject*>&);
|
||||
void loadColors(Part::Feature* part, const TopoDS_Shape& aShape);
|
||||
virtual void applyColors(Part::Feature*, const std::vector<App::Color>&)
|
||||
virtual void applyColors(Part::Feature*, const std::vector<Base::Color>&)
|
||||
{}
|
||||
static void tryPlacementFromLoc(App::GeoFeature*, const TopLoc_Location&);
|
||||
static void tryPlacementFromMatrix(App::GeoFeature*, const Base::Matrix4D&);
|
||||
@@ -100,16 +100,16 @@ class ImportExport ImportOCAFCmd: public ImportOCAF
|
||||
{
|
||||
public:
|
||||
ImportOCAFCmd(Handle(TDocStd_Document) h, App::Document* d, const std::string& name);
|
||||
std::map<Part::Feature*, std::vector<App::Color>> getPartColorsMap() const
|
||||
std::map<Part::Feature*, std::vector<Base::Color>> getPartColorsMap() const
|
||||
{
|
||||
return partColors;
|
||||
}
|
||||
|
||||
private:
|
||||
void applyColors(Part::Feature* part, const std::vector<App::Color>& colors) override;
|
||||
void applyColors(Part::Feature* part, const std::vector<Base::Color>& colors) override;
|
||||
|
||||
private:
|
||||
std::map<Part::Feature*, std::vector<App::Color>> partColors;
|
||||
std::map<Part::Feature*, std::vector<Base::Color>> partColors;
|
||||
};
|
||||
|
||||
class ImportXCAF
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
private:
|
||||
void createShape(const TopoDS_Shape& shape, bool perface = false, bool setname = false) const;
|
||||
void loadShapes(const TDF_Label& label);
|
||||
virtual void applyColors(Part::Feature*, const std::vector<App::Color>&)
|
||||
virtual void applyColors(Part::Feature*, const std::vector<Base::Color>&)
|
||||
{}
|
||||
|
||||
private:
|
||||
|
||||
@@ -204,7 +204,7 @@ bool ImportOCAF2::getColor(const TopoDS_Shape& shape, Info& info, bool check, bo
|
||||
bool ret = false;
|
||||
Quantity_ColorRGBA aColor;
|
||||
if (aColorTool->GetColor(shape, XCAFDoc_ColorSurf, aColor)) {
|
||||
App::Color c = Tools::convertColor(aColor);
|
||||
Base::Color c = Tools::convertColor(aColor);
|
||||
if (!check || info.faceColor != c) {
|
||||
info.faceColor = c;
|
||||
info.hasFaceColor = true;
|
||||
@@ -212,7 +212,7 @@ bool ImportOCAF2::getColor(const TopoDS_Shape& shape, Info& info, bool check, bo
|
||||
}
|
||||
}
|
||||
if (!noDefault && !info.hasFaceColor && aColorTool->GetColor(shape, XCAFDoc_ColorGen, aColor)) {
|
||||
App::Color c = Tools::convertColor(aColor);
|
||||
Base::Color c = Tools::convertColor(aColor);
|
||||
if (!check || info.faceColor != c) {
|
||||
info.faceColor = c;
|
||||
info.hasFaceColor = true;
|
||||
@@ -220,7 +220,7 @@ bool ImportOCAF2::getColor(const TopoDS_Shape& shape, Info& info, bool check, bo
|
||||
}
|
||||
}
|
||||
if (aColorTool->GetColor(shape, XCAFDoc_ColorCurv, aColor)) {
|
||||
App::Color c = Tools::convertColor(aColor);
|
||||
Base::Color c = Tools::convertColor(aColor);
|
||||
// Some STEP include a curve color with the same value of the face
|
||||
// color. And this will look weird in FC. So for shape with face
|
||||
// we'll ignore the curve color, if it is the same as the face color.
|
||||
@@ -296,8 +296,8 @@ bool ImportOCAF2::createObject(App::Document* doc,
|
||||
bool hasEdgeColors = false;
|
||||
|
||||
Part::TopoShape tshape(shape);
|
||||
std::vector<App::Color> faceColors;
|
||||
std::vector<App::Color> edgeColors;
|
||||
std::vector<Base::Color> faceColors;
|
||||
std::vector<Base::Color> edgeColors;
|
||||
|
||||
TDF_LabelSequence seq;
|
||||
if (!label.IsNull() && aShapeTool->GetSubShapes(label, seq)) {
|
||||
@@ -328,7 +328,7 @@ bool ImportOCAF2::createObject(App::Document* doc,
|
||||
}
|
||||
|
||||
bool foundFaceColor = false, foundEdgeColor = false;
|
||||
App::Color faceColor, edgeColor;
|
||||
Base::Color faceColor, edgeColor;
|
||||
Quantity_ColorRGBA aColor;
|
||||
if (aColorTool->GetColor(l, XCAFDoc_ColorSurf, aColor)
|
||||
|| aColorTool->GetColor(l, XCAFDoc_ColorGen, aColor)) {
|
||||
@@ -585,7 +585,7 @@ App::DocumentObject* ImportOCAF2::loadShapes()
|
||||
}
|
||||
|
||||
void ImportOCAF2::getSHUOColors(TDF_Label label,
|
||||
std::map<std::string, App::Color>& colors,
|
||||
std::map<std::string, Base::Color>& colors,
|
||||
bool appendFirst)
|
||||
{
|
||||
TDF_AttributeSequence seq;
|
||||
@@ -638,7 +638,7 @@ void ImportOCAF2::getSHUOColors(TDF_Label label,
|
||||
}
|
||||
if (!aColorTool->IsVisible(slabel)) {
|
||||
subname += App::DocumentObject::hiddenMarker();
|
||||
colors.emplace(subname, App::Color());
|
||||
colors.emplace(subname, Base::Color());
|
||||
}
|
||||
else {
|
||||
Quantity_ColorRGBA aColor;
|
||||
@@ -685,7 +685,7 @@ App::DocumentObject* ImportOCAF2::loadShape(App::Document* doc,
|
||||
return it->second.obj;
|
||||
}
|
||||
|
||||
std::map<std::string, App::Color> shuoColors;
|
||||
std::map<std::string, Base::Color> shuoColors;
|
||||
if (!options.useLinkGroup) {
|
||||
getSHUOColors(label, shuoColors, false);
|
||||
}
|
||||
@@ -735,7 +735,7 @@ struct ChildInfo
|
||||
{
|
||||
std::vector<Base::Placement> plas;
|
||||
boost::dynamic_bitset<> vis;
|
||||
std::map<size_t, App::Color> colors;
|
||||
std::map<size_t, Base::Color> colors;
|
||||
std::vector<TDF_Label> labels;
|
||||
TopoDS_Shape shape;
|
||||
};
|
||||
@@ -751,7 +751,7 @@ bool ImportOCAF2::createAssembly(App::Document* _doc,
|
||||
std::vector<App::DocumentObject*> children;
|
||||
std::map<App::DocumentObject*, ChildInfo> childrenMap;
|
||||
boost::dynamic_bitset<> visibilities;
|
||||
std::map<std::string, App::Color> shuoColors;
|
||||
std::map<std::string, Base::Color> shuoColors;
|
||||
|
||||
auto doc = _doc;
|
||||
if (newDoc) {
|
||||
@@ -877,7 +877,7 @@ ImportOCAFExt::ImportOCAFExt(Handle(TDocStd_Document) hStdDoc,
|
||||
: ImportOCAF2(hStdDoc, doc, name)
|
||||
{}
|
||||
|
||||
void ImportOCAFExt::applyFaceColors(Part::Feature* part, const std::vector<App::Color>& colors)
|
||||
void ImportOCAFExt::applyFaceColors(Part::Feature* part, const std::vector<Base::Color>& colors)
|
||||
{
|
||||
partColors[part] = colors;
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ namespace Import
|
||||
struct ImportExport ImportOCAFOptions
|
||||
{
|
||||
ImportOCAFOptions();
|
||||
App::Color defaultFaceColor;
|
||||
App::Color defaultEdgeColor;
|
||||
Base::Color defaultFaceColor;
|
||||
Base::Color defaultEdgeColor;
|
||||
bool merge = false;
|
||||
bool useLinkGroup = false;
|
||||
bool useBaseName = true;
|
||||
@@ -130,8 +130,8 @@ private:
|
||||
std::string baseName;
|
||||
App::DocumentObject* obj = nullptr;
|
||||
App::PropertyPlacement* propPlacement = nullptr;
|
||||
App::Color faceColor;
|
||||
App::Color edgeColor;
|
||||
Base::Color faceColor;
|
||||
Base::Color edgeColor;
|
||||
bool hasFaceColor = false;
|
||||
bool hasEdgeColor = false;
|
||||
int free = true;
|
||||
@@ -162,19 +162,19 @@ private:
|
||||
bool
|
||||
getColor(const TopoDS_Shape& shape, Info& info, bool check = false, bool noDefault = false);
|
||||
void
|
||||
getSHUOColors(TDF_Label label, std::map<std::string, App::Color>& colors, bool appendFirst);
|
||||
getSHUOColors(TDF_Label label, std::map<std::string, Base::Color>& colors, bool appendFirst);
|
||||
void setObjectName(Info& info, TDF_Label label);
|
||||
std::string getLabelName(TDF_Label label);
|
||||
App::DocumentObject*
|
||||
expandShape(App::Document* doc, TDF_Label label, const TopoDS_Shape& shape);
|
||||
|
||||
virtual void applyEdgeColors(Part::Feature*, const std::vector<App::Color>&)
|
||||
virtual void applyEdgeColors(Part::Feature*, const std::vector<Base::Color>&)
|
||||
{}
|
||||
virtual void applyFaceColors(Part::Feature*, const std::vector<App::Color>&)
|
||||
virtual void applyFaceColors(Part::Feature*, const std::vector<Base::Color>&)
|
||||
{}
|
||||
virtual void applyElementColors(App::DocumentObject*, const std::map<std::string, App::Color>&)
|
||||
virtual void applyElementColors(App::DocumentObject*, const std::map<std::string, Base::Color>&)
|
||||
{}
|
||||
virtual void applyLinkColor(App::DocumentObject*, int /*index*/, App::Color)
|
||||
virtual void applyLinkColor(App::DocumentObject*, int /*index*/, Base::Color)
|
||||
{}
|
||||
|
||||
private:
|
||||
@@ -187,7 +187,7 @@ private:
|
||||
{}
|
||||
|
||||
private:
|
||||
void applyColors(Part::Feature* part, const std::vector<App::Color>& colors) override
|
||||
void applyColors(Part::Feature* part, const std::vector<Base::Color>& colors) override
|
||||
{
|
||||
myParent.applyFaceColors(part, colors);
|
||||
}
|
||||
@@ -217,16 +217,16 @@ class ImportExport ImportOCAFExt: public ImportOCAF2
|
||||
public:
|
||||
ImportOCAFExt(Handle(TDocStd_Document) hStdDoc, App::Document* doc, const std::string& name);
|
||||
|
||||
std::map<Part::Feature*, std::vector<App::Color>> partColors;
|
||||
std::map<Part::Feature*, std::vector<Base::Color>> partColors;
|
||||
|
||||
private:
|
||||
void applyFaceColors(Part::Feature* part, const std::vector<App::Color>& colors) override;
|
||||
void applyFaceColors(Part::Feature* part, const std::vector<Base::Color>& colors) override;
|
||||
};
|
||||
|
||||
struct ImportExport ExportOCAFOptions
|
||||
{
|
||||
ExportOCAFOptions();
|
||||
App::Color defaultColor;
|
||||
Base::Color defaultColor;
|
||||
bool exportHidden = true;
|
||||
bool keepPlacement = false;
|
||||
};
|
||||
@@ -235,7 +235,7 @@ class ImportExport ExportOCAF2
|
||||
{
|
||||
public:
|
||||
using GetShapeColorsFunc =
|
||||
std::function<std::map<std::string, App::Color>(App::DocumentObject*, const char*)>;
|
||||
std::function<std::map<std::string, Base::Color>(App::DocumentObject*, const char*)>;
|
||||
explicit ExportOCAF2(Handle(TDocStd_Document) h,
|
||||
GetShapeColorsFunc func = GetShapeColorsFunc());
|
||||
|
||||
|
||||
@@ -251,14 +251,14 @@ void ImportOCAFAssembly::createShape(const TopoDS_Shape& aShape,
|
||||
part->Label.setValue(name);
|
||||
|
||||
Quantity_Color aColor;
|
||||
App::Color color(0.8f, 0.8f, 0.8f);
|
||||
Base::Color color(0.8f, 0.8f, 0.8f);
|
||||
if (aColorTool->GetColor(aShape, XCAFDoc_ColorGen, aColor)
|
||||
|| aColorTool->GetColor(aShape, XCAFDoc_ColorSurf, aColor)
|
||||
|| aColorTool->GetColor(aShape, XCAFDoc_ColorCurv, aColor)) {
|
||||
color.r = (float)aColor.Red();
|
||||
color.g = (float)aColor.Green();
|
||||
color.b = (float)aColor.Blue();
|
||||
std::vector<App::Color> colors;
|
||||
std::vector<Base::Color> colors;
|
||||
colors.push_back(color);
|
||||
applyColors(part, colors);
|
||||
}
|
||||
@@ -270,7 +270,7 @@ void ImportOCAFAssembly::createShape(const TopoDS_Shape& aShape,
|
||||
xp.Next();
|
||||
}
|
||||
bool found_face_color = false;
|
||||
std::vector<App::Color> faceColors;
|
||||
std::vector<Base::Color> faceColors;
|
||||
faceColors.resize(faces.Extent(), color);
|
||||
xp.Init(aShape, TopAbs_FACE);
|
||||
while (xp.More()) {
|
||||
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
int dep);
|
||||
void createShape(const TDF_Label& label, const TopLoc_Location&, const std::string&);
|
||||
void createShape(const TopoDS_Shape& label, const TopLoc_Location&, const std::string&);
|
||||
virtual void applyColors(Part::Feature*, const std::vector<App::Color>&)
|
||||
virtual void applyColors(Part::Feature*, const std::vector<Base::Color>&)
|
||||
{}
|
||||
|
||||
private:
|
||||
|
||||
@@ -46,24 +46,24 @@ FC_LOG_LEVEL_INIT("Import", true, true)
|
||||
|
||||
using namespace Import;
|
||||
|
||||
App::Color Tools::convertColor(const Quantity_ColorRGBA& rgba)
|
||||
Base::Color Tools::convertColor(const Quantity_ColorRGBA& rgba)
|
||||
{
|
||||
Standard_Real red, green, blue;
|
||||
rgba.GetRGB().Values(red, green, blue, OCC_COLOR_SPACE);
|
||||
return App::Color(static_cast<float>(red),
|
||||
static_cast<float>(green),
|
||||
static_cast<float>(blue),
|
||||
static_cast<float>(rgba.Alpha()));
|
||||
return Base::Color(static_cast<float>(red),
|
||||
static_cast<float>(green),
|
||||
static_cast<float>(blue),
|
||||
static_cast<float>(rgba.Alpha()));
|
||||
}
|
||||
|
||||
Quantity_ColorRGBA Tools::convertColor(const App::Color& col)
|
||||
Quantity_ColorRGBA Tools::convertColor(const Base::Color& col)
|
||||
{
|
||||
return Quantity_ColorRGBA(Quantity_Color(col.r, col.g, col.b, OCC_COLOR_SPACE), col.a);
|
||||
}
|
||||
|
||||
static inline std::ostream& operator<<(std::ostream& os, const Quantity_ColorRGBA& rgba)
|
||||
{
|
||||
App::Color color = Tools::convertColor(rgba);
|
||||
Base::Color color = Tools::convertColor(rgba);
|
||||
auto toHex = [](float v) {
|
||||
return boost::format("%02X") % static_cast<int>(v * 255);
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <XCAFDoc_ColorTool.hxx>
|
||||
#include <XCAFDoc_ShapeTool.hxx>
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
|
||||
#include <Standard_Version.hxx>
|
||||
|
||||
@@ -60,8 +60,8 @@ struct LabelHasher
|
||||
|
||||
struct Tools
|
||||
{
|
||||
static App::Color convertColor(const Quantity_ColorRGBA& rgba);
|
||||
static Quantity_ColorRGBA convertColor(const App::Color& col);
|
||||
static Base::Color convertColor(const Quantity_ColorRGBA& rgba);
|
||||
static Quantity_ColorRGBA convertColor(const Base::Color& col);
|
||||
static std::string labelName(TDF_Label label);
|
||||
static void printLabel(TDF_Label label,
|
||||
Handle(XCAFDoc_ShapeTool) aShapeTool,
|
||||
|
||||
@@ -644,7 +644,7 @@ ImpExpDxfRead::MakeLayer(const std::string& name, ColorIndex_t color, std::strin
|
||||
{
|
||||
if (m_preserveLayers) {
|
||||
// Hidden layers are implemented in the wrapup code after the entire file has been read.
|
||||
App::Color appColor = ObjectColor(color);
|
||||
Base::Color appColor = ObjectColor(color);
|
||||
PyObject* draftModule = nullptr;
|
||||
PyObject* layer = nullptr;
|
||||
draftModule = getDraftModule();
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "dxf.h"
|
||||
#include <App/Application.h>
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Interpreter.h>
|
||||
@@ -3027,13 +3027,13 @@ inline static double level(int distance, double blackLevel)
|
||||
// 8 and beyond yield the black level
|
||||
return blackLevel;
|
||||
}
|
||||
inline static App::Color wheel(int hue, double blackLevel, double multiplier = 1.0)
|
||||
inline static Base::Color wheel(int hue, double blackLevel, double multiplier = 1.0)
|
||||
{
|
||||
return App::Color((float)(level(hue - 0, blackLevel) * multiplier),
|
||||
(float)(level(hue - 8, blackLevel) * multiplier),
|
||||
(float)(level(hue - 16, blackLevel) * multiplier));
|
||||
return Base::Color((float)(level(hue - 0, blackLevel) * multiplier),
|
||||
(float)(level(hue - 8, blackLevel) * multiplier),
|
||||
(float)(level(hue - 16, blackLevel) * multiplier));
|
||||
}
|
||||
App::Color CDxfRead::ObjectColor(ColorIndex_t index)
|
||||
Base::Color CDxfRead::ObjectColor(ColorIndex_t index)
|
||||
{
|
||||
// TODO: If it is ColorByBlock we need to use the color of the INSERT entity.
|
||||
// This is tricky because a block can itself contain INSERT entities and we don't currently
|
||||
@@ -3050,28 +3050,28 @@ App::Color CDxfRead::ObjectColor(ColorIndex_t index)
|
||||
// The AA fades as AA 7E 56 45 35 which is almost the exact same percentages.
|
||||
// For hue, (index-10)/10 : 0 is ff0000, and each step linearly adds green until 4 is pure
|
||||
// yellow ffff00, then red starts to fade... until but not including 24 which is back to ff0000.
|
||||
App::Color result = App::Color();
|
||||
Base::Color result = Base::Color();
|
||||
if (index == 0) {
|
||||
// Technically, 0 is BYBLOCK and not a real color, but all that means is that an object in a
|
||||
// block cannot specifically ask to be black. These colors are all contrasted to the
|
||||
// background so there is no objective black colour, through 255 is an objective white.
|
||||
result = App::Color();
|
||||
result = Base::Color();
|
||||
}
|
||||
else if (index < 7) {
|
||||
result = wheel((index - 1) * 4, 0x00);
|
||||
}
|
||||
else if (index == 7) {
|
||||
result = App::Color(1, 1, 1);
|
||||
result = Base::Color(1, 1, 1);
|
||||
}
|
||||
else if (index == 8) {
|
||||
result = App::Color(0.5, 0.5, 0.5);
|
||||
result = Base::Color(0.5, 0.5, 0.5);
|
||||
}
|
||||
else if (index == 9) {
|
||||
result = App::Color(0.75, 0.75, 0.75);
|
||||
result = Base::Color(0.75, 0.75, 0.75);
|
||||
}
|
||||
else if (index >= 250) {
|
||||
auto brightness = (float)((index - 250 + (255 - index) * 0.2) / 5);
|
||||
result = App::Color(brightness, brightness, brightness);
|
||||
result = Base::Color(brightness, brightness, brightness);
|
||||
}
|
||||
else {
|
||||
static const std::array<float, 5> fades = {1.00F, 0.74F, 0.50F, 0.40F, 0.30F};
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <Base/Matrix.h>
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Base/Console.h>
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
#include <Mod/Import/ImportGlobal.h>
|
||||
|
||||
// For some reason Cpplint complains about some of the categories used by Clang-tidy
|
||||
@@ -923,7 +923,7 @@ public:
|
||||
{
|
||||
return m_entityAttributes.m_LineType[0] == 'h' || m_entityAttributes.m_LineType[0] == 'H';
|
||||
}
|
||||
static App::Color ObjectColor(ColorIndex_t colorIndex); // as rgba value
|
||||
static Base::Color ObjectColor(ColorIndex_t colorIndex); // as rgba value
|
||||
|
||||
#ifdef DEBUG
|
||||
protected:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -413,7 +413,7 @@ void ViewProviderInspection::setDistances()
|
||||
|
||||
unsigned long j = 0;
|
||||
for (std::vector<float>::const_iterator jt = fValues.begin(); jt != fValues.end(); ++jt, j++) {
|
||||
App::Color col = pcColorBar->getColor(*jt);
|
||||
Base::Color col = pcColorBar->getColor(*jt);
|
||||
cols[j] = SbColor(col.r, col.g, col.b);
|
||||
if (pcColorBar->isVisible(*jt)) {
|
||||
tran[j] = 0.0f;
|
||||
|
||||
@@ -143,7 +143,7 @@ std::shared_ptr<App::Material> MaterialManager::defaultAppearance()
|
||||
ParameterGrp::handle hGrp =
|
||||
App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
|
||||
auto getColor = [hGrp](const char* parameter, App::Color& color) {
|
||||
auto getColor = [hGrp](const char* parameter, Base::Color& color) {
|
||||
uint32_t packed = color.getPackedRGB();
|
||||
packed = hGrp->GetUnsigned(parameter, packed);
|
||||
color.setPackedRGB(packed);
|
||||
@@ -162,7 +162,7 @@ std::shared_ptr<App::Material> MaterialManager::defaultAppearance()
|
||||
float red = static_cast<float>(intRandom(0, 255)) / 255.0F;
|
||||
float green = static_cast<float>(intRandom(0, 255)) / 255.0F;
|
||||
float blue = static_cast<float>(intRandom(0, 255)) / 255.0F;
|
||||
mat.diffuseColor = App::Color(red, green, blue, 1.0);
|
||||
mat.diffuseColor = Base::Color(red, green, blue, 1.0);
|
||||
}
|
||||
else {
|
||||
getColor("DefaultShapeColor", mat.diffuseColor);
|
||||
|
||||
@@ -142,7 +142,7 @@ QString MaterialProperty::getYAMLString() const
|
||||
return _valuePtr->getYAMLString();
|
||||
}
|
||||
|
||||
App::Color MaterialProperty::getColor() const
|
||||
Base::Color MaterialProperty::getColor() const
|
||||
{
|
||||
auto colorString = getValue().toString();
|
||||
std::stringstream stream(colorString.toStdString());
|
||||
@@ -163,7 +163,7 @@ App::Color MaterialProperty::getColor() const
|
||||
stream >> alpha;
|
||||
}
|
||||
|
||||
App::Color color(red, green, blue, alpha);
|
||||
Base::Color color(red, green, blue, alpha);
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ void MaterialProperty::setURL(const QString& value)
|
||||
_valuePtr->setValue(QVariant(value));
|
||||
}
|
||||
|
||||
void MaterialProperty::setColor(const App::Color& value)
|
||||
void MaterialProperty::setColor(const Base::Color& value)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "(" << value.r << ", " << value.g << ", " << value.b << ", " << value.a << ")";
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <QTextStream>
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
#include <App/Material.h>
|
||||
#include <Base/BaseClass.h>
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
{
|
||||
return getValue().toString();
|
||||
}
|
||||
App::Color getColor() const;
|
||||
Base::Color getColor() const;
|
||||
|
||||
MaterialProperty& getColumn(int column);
|
||||
const MaterialProperty& getColumn(int column) const;
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
void setQuantity(const QString& value);
|
||||
void setList(const QList<QVariant>& value);
|
||||
void setURL(const QString& value);
|
||||
void setColor(const App::Color& value);
|
||||
void setColor(const Base::Color& value);
|
||||
|
||||
MaterialProperty& operator=(const MaterialProperty& other);
|
||||
friend QTextStream& operator<<(QTextStream& output, const MaterialProperty& property);
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
bool hasElementColor = false;
|
||||
for (const auto& view : views) {
|
||||
if (auto* prop = dynamic_cast<App::PropertyColor*>(view->getPropertyByName(property))) {
|
||||
App::Color color = prop->getValue();
|
||||
Base::Color color = prop->getValue();
|
||||
QSignalBlocker block(buttonColor);
|
||||
buttonColor->setColor(color.asValue<QColor>());
|
||||
hasElementColor = true;
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
for (const auto& view : views) {
|
||||
if (auto* prop =
|
||||
dynamic_cast<App::PropertyMaterial*>(view->getPropertyByName(property))) {
|
||||
App::Color color = prop->getDiffuseColor();
|
||||
Base::Color color = prop->getDiffuseColor();
|
||||
QSignalBlocker block(buttonColor);
|
||||
buttonColor->setColor(color.asValue<QColor>());
|
||||
hasElementColor = true;
|
||||
@@ -310,7 +310,7 @@ void DlgDisplayPropertiesImp::slotChangedObject(const Gui::ViewProvider& obj,
|
||||
}
|
||||
std::string prop_name = name;
|
||||
if (prop.is<App::PropertyColor>()) {
|
||||
App::Color value = static_cast<const App::PropertyColor&>(prop).getValue();
|
||||
Base::Color value = static_cast<const App::PropertyColor&>(prop).getValue();
|
||||
if (prop_name == "LineColor") {
|
||||
bool blocked = d->ui.buttonLineColor->blockSignals(true);
|
||||
d->ui.buttonLineColor->setColor(value.asValue<QColor>());
|
||||
@@ -479,7 +479,7 @@ void DlgDisplayPropertiesImp::onButtonLineColorChanged()
|
||||
{
|
||||
std::vector<Gui::ViewProvider*> Provider = getSelection();
|
||||
QColor s = d->ui.buttonLineColor->color();
|
||||
App::Color c {};
|
||||
Base::Color c {};
|
||||
c.setValue<QColor>(s);
|
||||
for (auto it : Provider) {
|
||||
if (auto* prop = dynamic_cast<App::PropertyColor*>(it->getPropertyByName("LineColor"))) {
|
||||
@@ -492,7 +492,7 @@ void DlgDisplayPropertiesImp::onButtonPointColorChanged()
|
||||
{
|
||||
std::vector<Gui::ViewProvider*> Provider = getSelection();
|
||||
QColor s = d->ui.buttonPointColor->color();
|
||||
App::Color c {};
|
||||
Base::Color c {};
|
||||
c.setValue<QColor>(s);
|
||||
for (auto it : Provider) {
|
||||
if (auto* prop = dynamic_cast<App::PropertyColor*>(it->getPropertyByName("PointColor"))) {
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
using namespace MatGui;
|
||||
|
||||
ColorWidget::ColorWidget(const App::Color& color, QWidget* parent)
|
||||
ColorWidget::ColorWidget(const Base::Color& color, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
_color = color.asValue<QColor>();
|
||||
|
||||
@@ -46,7 +46,7 @@ class ColorWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ColorWidget(const App::Color& color, QWidget* parent = nullptr);
|
||||
explicit ColorWidget(const Base::Color& color, QWidget* parent = nullptr);
|
||||
~ColorWidget() override = default;
|
||||
|
||||
QSize sizeHint() const override { return {75,23}; }
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <QSpacerItem>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Command.h>
|
||||
|
||||
@@ -46,25 +46,25 @@ Base::Reference<ParameterGrp> Preferences::getPreferenceGroup(const char* Name)
|
||||
->GetGroup(Name);
|
||||
}
|
||||
|
||||
App::Color Preferences::defaultLineColor()
|
||||
Base::Color Preferences::defaultLineColor()
|
||||
{
|
||||
App::Color fcColor;
|
||||
Base::Color fcColor;
|
||||
fcColor.setPackedValue(
|
||||
getPreferenceGroup("Appearance")->GetUnsigned("DefaultLineColor", 0x3CF00000));
|
||||
return fcColor;
|
||||
}
|
||||
|
||||
App::Color Preferences::defaultTextColor()
|
||||
Base::Color Preferences::defaultTextColor()
|
||||
{
|
||||
App::Color fcColor;
|
||||
Base::Color fcColor;
|
||||
fcColor.setPackedValue(
|
||||
getPreferenceGroup("Appearance")->GetUnsigned("DefaultTextColor", 0x00000000));
|
||||
return fcColor;
|
||||
}
|
||||
|
||||
App::Color Preferences::defaultTextBackgroundColor()
|
||||
Base::Color Preferences::defaultTextBackgroundColor()
|
||||
{
|
||||
App::Color fcColor;
|
||||
Base::Color fcColor;
|
||||
fcColor.setPackedValue(
|
||||
getPreferenceGroup("Appearance")->GetUnsigned("DefaultTextBackgroundColor", 0x3CF00000));
|
||||
return fcColor;
|
||||
|
||||
@@ -44,10 +44,10 @@ class MeasureExport Preferences
|
||||
public:
|
||||
static Base::Reference<ParameterGrp> getPreferenceGroup(const char* Name);
|
||||
|
||||
static App::Color defaultLineColor();
|
||||
static App::Color defaultTextColor();
|
||||
static Base::Color defaultLineColor();
|
||||
static Base::Color defaultTextColor();
|
||||
static int defaultFontSize();
|
||||
static App::Color defaultTextBackgroundColor();
|
||||
static Base::Color defaultTextBackgroundColor();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -237,16 +237,16 @@ void ViewProviderMeasureBase::finishRestoring()
|
||||
void ViewProviderMeasureBase::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (prop == &TextColor) {
|
||||
const App::Color& color = TextColor.getValue();
|
||||
const Base::Color& color = TextColor.getValue();
|
||||
pLabel->textColor.setValue(color.r, color.g, color.b);
|
||||
updateIcon();
|
||||
}
|
||||
else if (prop == &TextBackgroundColor) {
|
||||
const App::Color& color = TextBackgroundColor.getValue();
|
||||
const Base::Color& color = TextBackgroundColor.getValue();
|
||||
pLabel->backgroundColor.setValue(color.r, color.g, color.b);
|
||||
}
|
||||
else if (prop == &LineColor) {
|
||||
const App::Color& color = LineColor.getValue();
|
||||
const Base::Color& color = LineColor.getValue();
|
||||
pColor->rgb.setValue(color.r, color.g, color.b);
|
||||
}
|
||||
else if (prop == &FontSize) {
|
||||
|
||||
@@ -109,7 +109,7 @@ bool ReaderOBJ::Load(std::istream& str)
|
||||
float b = std::min<int>(std::atof(what[12].first), 255) / 255.0F;
|
||||
meshPoints.push_back(MeshPoint(Base::Vector3f(fX, fY, fZ)));
|
||||
|
||||
App::Color c(r, g, b);
|
||||
Base::Color c(r, g, b);
|
||||
unsigned long prop = static_cast<uint32_t>(c.getPackedValue());
|
||||
meshPoints.back().SetProperty(prop);
|
||||
rgb_value = MeshIO::PER_VERTEX;
|
||||
@@ -123,7 +123,7 @@ bool ReaderOBJ::Load(std::istream& str)
|
||||
float b = static_cast<float>(std::atof(what[16].first));
|
||||
meshPoints.push_back(MeshPoint(Base::Vector3f(fX, fY, fZ)));
|
||||
|
||||
App::Color c(r, g, b);
|
||||
Base::Color c(r, g, b);
|
||||
unsigned long prop = static_cast<uint32_t>(c.getPackedValue());
|
||||
meshPoints.back().SetProperty(prop);
|
||||
rgb_value = MeshIO::PER_VERTEX;
|
||||
@@ -213,7 +213,7 @@ bool ReaderOBJ::Load(std::istream& str)
|
||||
|
||||
for (const auto& it : meshPoints) {
|
||||
unsigned long prop = it._ulProp;
|
||||
App::Color c;
|
||||
Base::Color c;
|
||||
c.setPackedValue(static_cast<uint32_t>(prop));
|
||||
_material->diffuseColor.push_back(c);
|
||||
}
|
||||
@@ -224,7 +224,7 @@ bool ReaderOBJ::Load(std::istream& str)
|
||||
// calling instance but the color list is pre-filled with a default value
|
||||
if (_material) {
|
||||
_material->binding = MeshIO::PER_FACE;
|
||||
_material->diffuseColor.resize(meshFacets.size(), App::Color(0.8F, 0.8F, 0.8F));
|
||||
_material->diffuseColor.resize(meshFacets.size(), Base::Color(0.8F, 0.8F, 0.8F));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,27 +259,27 @@ bool ReaderOBJ::LoadMaterial(std::istream& str)
|
||||
return false;
|
||||
}
|
||||
|
||||
std::map<std::string, App::Color> materialAmbientColor;
|
||||
std::map<std::string, App::Color> materialDiffuseColor;
|
||||
std::map<std::string, App::Color> materialSpecularColor;
|
||||
std::map<std::string, Base::Color> materialAmbientColor;
|
||||
std::map<std::string, Base::Color> materialDiffuseColor;
|
||||
std::map<std::string, Base::Color> materialSpecularColor;
|
||||
std::map<std::string, float> materialTransparency;
|
||||
std::string materialName;
|
||||
std::vector<App::Color> ambientColor;
|
||||
std::vector<App::Color> diffuseColor;
|
||||
std::vector<App::Color> specularColor;
|
||||
std::vector<Base::Color> ambientColor;
|
||||
std::vector<Base::Color> diffuseColor;
|
||||
std::vector<Base::Color> specularColor;
|
||||
std::vector<float> transparency;
|
||||
|
||||
auto readColor = [](const std::vector<std::string>& tokens) -> App::Color {
|
||||
auto readColor = [](const std::vector<std::string>& tokens) -> Base::Color {
|
||||
if (tokens.size() == 2) {
|
||||
// If only R is given then G and B will be equal
|
||||
float r = boost::lexical_cast<float>(tokens[1]);
|
||||
return App::Color(r, r, r);
|
||||
return Base::Color(r, r, r);
|
||||
}
|
||||
if (tokens.size() == 4) {
|
||||
float r = boost::lexical_cast<float>(tokens[1]);
|
||||
float g = boost::lexical_cast<float>(tokens[2]);
|
||||
float b = boost::lexical_cast<float>(tokens[3]);
|
||||
return App::Color(r, g, b);
|
||||
return Base::Color(r, g, b);
|
||||
}
|
||||
|
||||
throw std::length_error("Unexpected number of tokens");
|
||||
@@ -322,21 +322,21 @@ bool ReaderOBJ::LoadMaterial(std::istream& str)
|
||||
{
|
||||
auto jt = materialAmbientColor.find(it.first);
|
||||
if (jt != materialAmbientColor.end()) {
|
||||
std::vector<App::Color> mat(it.second, jt->second);
|
||||
std::vector<Base::Color> mat(it.second, jt->second);
|
||||
ambientColor.insert(ambientColor.end(), mat.begin(), mat.end());
|
||||
}
|
||||
}
|
||||
{
|
||||
auto jt = materialDiffuseColor.find(it.first);
|
||||
if (jt != materialDiffuseColor.end()) {
|
||||
std::vector<App::Color> mat(it.second, jt->second);
|
||||
std::vector<Base::Color> mat(it.second, jt->second);
|
||||
diffuseColor.insert(diffuseColor.end(), mat.begin(), mat.end());
|
||||
}
|
||||
}
|
||||
{
|
||||
auto jt = materialSpecularColor.find(it.first);
|
||||
if (jt != materialSpecularColor.end()) {
|
||||
std::vector<App::Color> mat(it.second, jt->second);
|
||||
std::vector<Base::Color> mat(it.second, jt->second);
|
||||
specularColor.insert(specularColor.end(), mat.begin(), mat.end());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,13 +122,13 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
auto transformColors = [](const std::vector<App::Color>& input) {
|
||||
auto transformColors = [](const std::vector<Base::Color>& input) {
|
||||
std::vector<Base::ColorRGB> output;
|
||||
output.reserve(input.size());
|
||||
std::transform(input.cbegin(),
|
||||
input.cend(),
|
||||
std::back_inserter(output),
|
||||
[](const App::Color& col) {
|
||||
[](const Base::Color& col) {
|
||||
return Base::ColorRGB {col.r, col.g, col.b};
|
||||
});
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ using namespace MeshCore;
|
||||
|
||||
struct WriterOBJ::Color_Less
|
||||
{
|
||||
bool operator()(const App::Color& x, const App::Color& y) const
|
||||
bool operator()(const Base::Color& x, const Base::Color& y) const
|
||||
{
|
||||
if (x.r != y.r) {
|
||||
return x.r < y.r;
|
||||
@@ -131,7 +131,7 @@ bool WriterOBJ::Save(std::ostream& out)
|
||||
}
|
||||
|
||||
if (exportColorPerVertex) {
|
||||
App::Color c;
|
||||
Base::Color c;
|
||||
if (_material->binding == MeshIO::PER_VERTEX) {
|
||||
c = _material->diffuseColor[index];
|
||||
}
|
||||
@@ -171,14 +171,14 @@ bool WriterOBJ::Save(std::ostream& out)
|
||||
// facet indices (no texture and normal indices)
|
||||
|
||||
// make sure to use the 'usemtl' statement as less often as possible
|
||||
std::vector<App::Color> colors = _material->diffuseColor;
|
||||
std::vector<Base::Color> colors = _material->diffuseColor;
|
||||
std::sort(colors.begin(), colors.end(), Color_Less());
|
||||
colors.erase(std::unique(colors.begin(), colors.end()), colors.end());
|
||||
|
||||
std::size_t index = 0;
|
||||
App::Color prev;
|
||||
Base::Color prev;
|
||||
int faceIdx = 1;
|
||||
const std::vector<App::Color>& Kd = _material->diffuseColor;
|
||||
const std::vector<Base::Color>& Kd = _material->diffuseColor;
|
||||
for (auto it = rFacets.begin(); it != rFacets.end(); ++it, index++) {
|
||||
if (index == 0 || prev != Kd[index]) {
|
||||
prev = Kd[index];
|
||||
@@ -209,13 +209,13 @@ bool WriterOBJ::Save(std::ostream& out)
|
||||
else {
|
||||
if (exportColorPerFace) {
|
||||
// make sure to use the 'usemtl' statement as less often as possible
|
||||
std::vector<App::Color> colors = _material->diffuseColor;
|
||||
std::vector<Base::Color> colors = _material->diffuseColor;
|
||||
std::sort(colors.begin(), colors.end(), Color_Less());
|
||||
colors.erase(std::unique(colors.begin(), colors.end()), colors.end());
|
||||
|
||||
bool first = true;
|
||||
App::Color prev;
|
||||
const std::vector<App::Color>& Kd = _material->diffuseColor;
|
||||
Base::Color prev;
|
||||
const std::vector<Base::Color>& Kd = _material->diffuseColor;
|
||||
|
||||
for (const auto& gt : _groups) {
|
||||
out << "g " << Base::Tools::escapedUnicodeFromUtf8(gt.name.c_str()) << '\n';
|
||||
@@ -263,7 +263,7 @@ bool WriterOBJ::SaveMaterial(std::ostream& out)
|
||||
if (_material) {
|
||||
if (_material->binding == MeshIO::PER_FACE) {
|
||||
|
||||
std::vector<App::Color> Kd = _material->diffuseColor;
|
||||
std::vector<Base::Color> Kd = _material->diffuseColor;
|
||||
std::sort(Kd.begin(), Kd.end(), Color_Less());
|
||||
Kd.erase(std::unique(Kd.begin(), Kd.end()), Kd.end());
|
||||
|
||||
|
||||
@@ -481,7 +481,7 @@ bool MeshInput::LoadOFF(std::istream& input)
|
||||
boost::cmatch what;
|
||||
|
||||
bool colorPerVertex = false;
|
||||
std::vector<App::Color> diffuseColor;
|
||||
std::vector<Base::Color> diffuseColor;
|
||||
MeshPointArray meshPoints;
|
||||
MeshFacetArray meshFacets;
|
||||
|
||||
@@ -1808,7 +1808,7 @@ bool MeshOutput::SaveAsymptote(std::ostream& out) const
|
||||
bool saveFaceColor = (_material && _material->binding == MeshIO::PER_FACE
|
||||
&& _material->diffuseColor.size() == rFacets.size());
|
||||
// global mesh color
|
||||
App::Color mc(0.8F, 0.8F, 0.8F);
|
||||
Base::Color mc(0.8F, 0.8F, 0.8F);
|
||||
if (_material && _material->binding == MeshIO::OVERALL && _material->diffuseColor.size() == 1) {
|
||||
mc = _material->diffuseColor[0];
|
||||
}
|
||||
@@ -1831,7 +1831,7 @@ bool MeshOutput::SaveAsymptote(std::ostream& out) const
|
||||
const MeshFacet& face = rFacets[index];
|
||||
out << ",\n new pen[] {";
|
||||
for (int i = 0; i < 3; i++) {
|
||||
const App::Color& c = _material->diffuseColor[face._aulPoints[i]];
|
||||
const Base::Color& c = _material->diffuseColor[face._aulPoints[i]];
|
||||
out << "rgb(" << c.r << ", " << c.g << ", " << c.b << ")";
|
||||
if (i < 2) {
|
||||
out << ", ";
|
||||
@@ -1840,7 +1840,7 @@ bool MeshOutput::SaveAsymptote(std::ostream& out) const
|
||||
out << "}));\n";
|
||||
}
|
||||
else if (saveFaceColor) {
|
||||
const App::Color& c = _material->diffuseColor[index];
|
||||
const Base::Color& c = _material->diffuseColor[index];
|
||||
out << "),\n rgb(" << c.r << ", " << c.g << ", " << c.b << "));\n";
|
||||
}
|
||||
else {
|
||||
@@ -1912,7 +1912,7 @@ bool MeshOutput::SaveOFF(std::ostream& out) const
|
||||
}
|
||||
|
||||
if (exportColor) {
|
||||
App::Color c;
|
||||
Base::Color c;
|
||||
if (_material->binding == MeshIO::PER_VERTEX) {
|
||||
c = _material->diffuseColor[index];
|
||||
}
|
||||
@@ -1984,7 +1984,7 @@ bool MeshOutput::SaveBinaryPLY(std::ostream& out) const
|
||||
os << p.x << p.y << p.z;
|
||||
}
|
||||
if (saveVertexColor) {
|
||||
const App::Color& c = _material->diffuseColor[i];
|
||||
const Base::Color& c = _material->diffuseColor[i];
|
||||
uint8_t r = uint8_t(255.0F * c.r);
|
||||
uint8_t g = uint8_t(255.0F * c.g);
|
||||
uint8_t b = uint8_t(255.0F * c.b);
|
||||
@@ -2046,7 +2046,7 @@ bool MeshOutput::SaveAsciiPLY(std::ostream& out) const
|
||||
out << p.x << " " << p.y << " " << p.z;
|
||||
}
|
||||
|
||||
const App::Color& c = _material->diffuseColor[i];
|
||||
const Base::Color& c = _material->diffuseColor[i];
|
||||
int r = (int)(255.0F * c.r);
|
||||
int g = (int)(255.0F * c.g);
|
||||
int b = (int)(255.0F * c.b);
|
||||
@@ -2359,7 +2359,7 @@ bool MeshOutput::SaveX3DContent(std::ostream& out, bool exportViewpoints) const
|
||||
bbox = bbox.Transformed(_transform);
|
||||
}
|
||||
|
||||
App::Color mat(0.65F, 0.65F, 0.65F);
|
||||
Base::Color mat(0.65F, 0.65F, 0.65F);
|
||||
if (_material && _material->binding == MeshIO::Binding::OVERALL) {
|
||||
if (!_material->diffuseColor.empty()) {
|
||||
mat = _material->diffuseColor.front();
|
||||
@@ -2679,7 +2679,7 @@ bool MeshOutput::SaveVRML(std::ostream& output) const
|
||||
<< " Material {\n";
|
||||
if (_material && _material->binding == MeshIO::OVERALL) {
|
||||
if (!_material->diffuseColor.empty()) {
|
||||
App::Color c = _material->diffuseColor.front();
|
||||
Base::Color c = _material->diffuseColor.front();
|
||||
output << " diffuseColor " << c.r << " " << c.g << " " << c.b << "\n";
|
||||
}
|
||||
else {
|
||||
@@ -2828,7 +2828,7 @@ void MeshCleanup::RemoveInvalidFacets()
|
||||
// adjust the material array if needed
|
||||
if (materialArray && materialArray->binding == MeshIO::PER_FACE
|
||||
&& materialArray->diffuseColor.size() == facetArray.size()) {
|
||||
std::vector<App::Color> colors;
|
||||
std::vector<Base::Color> colors;
|
||||
colors.reserve(facetArray.size() - countInvalidFacets);
|
||||
for (std::size_t index = 0; index < facetArray.size(); index++) {
|
||||
if (facetArray[index].IsValid()) {
|
||||
@@ -2887,7 +2887,7 @@ void MeshCleanup::RemoveInvalidPoints()
|
||||
// adjust the material array if needed
|
||||
if (materialArray && materialArray->binding == MeshIO::PER_VERTEX
|
||||
&& materialArray->diffuseColor.size() == pointArray.size()) {
|
||||
std::vector<App::Color> colors;
|
||||
std::vector<Base::Color> colors;
|
||||
colors.reserve(validPoints);
|
||||
for (std::size_t index = 0; index < pointArray.size(); index++) {
|
||||
if (pointArray[index].IsValid()) {
|
||||
|
||||
@@ -82,10 +82,10 @@ struct MeshExport Material
|
||||
MeshIO::Binding binding {MeshIO::OVERALL};
|
||||
mutable std::string library;
|
||||
|
||||
std::vector<App::Color> ambientColor; /**< Defines the ambient color. */
|
||||
std::vector<App::Color> diffuseColor; /**< Defines the diffuse color. */
|
||||
std::vector<App::Color> specularColor; /**< Defines the specular color. */
|
||||
std::vector<App::Color> emissiveColor; /**< Defines the emissive color. */
|
||||
std::vector<Base::Color> ambientColor; /**< Defines the ambient color. */
|
||||
std::vector<Base::Color> diffuseColor; /**< Defines the diffuse color. */
|
||||
std::vector<Base::Color> specularColor; /**< Defines the specular color. */
|
||||
std::vector<Base::Color> emissiveColor; /**< Defines the emissive color. */
|
||||
std::vector<float> shininess;
|
||||
std::vector<float> transparency;
|
||||
|
||||
|
||||
@@ -65,19 +65,19 @@ void Importer::load(const std::string& fileName)
|
||||
}
|
||||
}
|
||||
|
||||
void Importer::addVertexColors(Feature* feature, const std::vector<App::Color>& colors)
|
||||
void Importer::addVertexColors(Feature* feature, const std::vector<Base::Color>& colors)
|
||||
{
|
||||
addColors(feature, "VertexColors", colors);
|
||||
}
|
||||
|
||||
void Importer::addFaceColors(Feature* feature, const std::vector<App::Color>& colors)
|
||||
void Importer::addFaceColors(Feature* feature, const std::vector<Base::Color>& colors)
|
||||
{
|
||||
addColors(feature, "FaceColors", colors);
|
||||
}
|
||||
|
||||
void Importer::addColors(Feature* feature,
|
||||
const std::string& property,
|
||||
const std::vector<App::Color>& colors)
|
||||
const std::vector<Base::Color>& colors)
|
||||
{
|
||||
App::PropertyColorList* prop = static_cast<App::PropertyColorList*>(
|
||||
feature->addDynamicProperty("App::PropertyColorList", property.c_str()));
|
||||
@@ -105,7 +105,7 @@ void Importer::createMeshFromSegments(const std::string& name,
|
||||
if (mat.binding == MeshCore::MeshIO::PER_FACE
|
||||
&& mat.diffuseColor.size() == mesh.countFacets()) {
|
||||
|
||||
std::vector<App::Color> diffuseColor;
|
||||
std::vector<Base::Color> diffuseColor;
|
||||
diffuseColor.reserve(group.getIndices().size());
|
||||
for (const auto& it : group.getIndices()) {
|
||||
diffuseColor.push_back(mat.diffuseColor[it]);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user