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:
@@ -155,7 +155,7 @@ bool Reader::hasIntensities() const
|
||||
return (!intensity.empty());
|
||||
}
|
||||
|
||||
const std::vector<App::Color>& Reader::getColors() const
|
||||
const std::vector<Base::Color>& Reader::getColors() const
|
||||
{
|
||||
return colors;
|
||||
}
|
||||
@@ -1166,7 +1166,7 @@ void PcdReader::read(const std::string& filename)
|
||||
if (types[rgba] == "U") {
|
||||
for (Eigen::Index i = 0; i < numPoints; i++) {
|
||||
uint32_t packed = static_cast<uint32_t>(data(i, rgba));
|
||||
App::Color col;
|
||||
Base::Color col;
|
||||
col.setPackedARGB(packed);
|
||||
colors.emplace_back(col);
|
||||
}
|
||||
@@ -1178,7 +1178,7 @@ void PcdReader::read(const std::string& filename)
|
||||
float f = static_cast<float>(data(i, rgba));
|
||||
uint32_t packed {};
|
||||
std::memcpy(&packed, &f, sizeof(packed));
|
||||
App::Color col;
|
||||
Base::Color col;
|
||||
col.setPackedARGB(packed);
|
||||
colors.emplace_back(col);
|
||||
}
|
||||
@@ -1413,7 +1413,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<App::Color> getColors() const
|
||||
std::vector<Base::Color> getColors() const
|
||||
{
|
||||
return colors;
|
||||
}
|
||||
@@ -1705,9 +1705,9 @@ private:
|
||||
return pt;
|
||||
}
|
||||
|
||||
App::Color getColor(const Proto& proto, size_t index) const
|
||||
Base::Color getColor(const Proto& proto, size_t index) const
|
||||
{
|
||||
App::Color c;
|
||||
Base::Color c;
|
||||
c.r = static_cast<float>(proto.redData[index]) / 255.0F;
|
||||
c.g = static_cast<float>(proto.greenData[index]) / 255.0F;
|
||||
c.b = static_cast<float>(proto.blueData[index]) / 255.0F;
|
||||
@@ -1769,7 +1769,7 @@ private:
|
||||
bool checkState;
|
||||
double minDistance;
|
||||
const size_t buf_size = 1024;
|
||||
std::vector<App::Color> colors;
|
||||
std::vector<Base::Color> colors;
|
||||
std::vector<float> intensity;
|
||||
PointKernel points;
|
||||
std::vector<Base::Vector3f> normals;
|
||||
@@ -1817,7 +1817,7 @@ void Writer::setIntensities(const std::vector<float>& i)
|
||||
intensity = i;
|
||||
}
|
||||
|
||||
void Writer::setColors(const std::vector<App::Color>& c)
|
||||
void Writer::setColors(const std::vector<Base::Color>& c)
|
||||
{
|
||||
colors = c;
|
||||
}
|
||||
@@ -1972,7 +1972,7 @@ void PlyWriter::write(const std::string& filename)
|
||||
Eigen::Index col2 = col + 2;
|
||||
Eigen::Index col3 = col + 3;
|
||||
for (Eigen::Index i = 0; i < numPoints; i++) {
|
||||
App::Color c = colors[i];
|
||||
Base::Color c = colors[i];
|
||||
data(i, col0) = (c.r * 255.0F + 0.5F);
|
||||
data(i, col1) = (c.g * 255.0F + 0.5F);
|
||||
data(i, col2) = (c.b * 255.0F + 0.5F);
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
bool hasProperties() const;
|
||||
const std::vector<float>& getIntensities() const;
|
||||
bool hasIntensities() const;
|
||||
const std::vector<App::Color>& getColors() const;
|
||||
const std::vector<Base::Color>& getColors() const;
|
||||
bool hasColors() const;
|
||||
const std::vector<Base::Vector3f>& getNormals() const;
|
||||
bool hasNormals() const;
|
||||
@@ -74,7 +74,7 @@ protected:
|
||||
// NOLINTBEGIN
|
||||
PointKernel points;
|
||||
std::vector<float> intensity;
|
||||
std::vector<App::Color> colors;
|
||||
std::vector<Base::Color> colors;
|
||||
std::vector<Base::Vector3f> normals;
|
||||
int width {0};
|
||||
int height {1};
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
virtual void write(const std::string& filename) = 0;
|
||||
|
||||
void setIntensities(const std::vector<float>&);
|
||||
void setColors(const std::vector<App::Color>&);
|
||||
void setColors(const std::vector<Base::Color>&);
|
||||
void setNormals(const std::vector<Base::Vector3f>&);
|
||||
void setWidth(int);
|
||||
void setHeight(int);
|
||||
@@ -164,7 +164,7 @@ protected:
|
||||
// NOLINTBEGIN
|
||||
const PointKernel& points;
|
||||
std::vector<float> intensity;
|
||||
std::vector<App::Color> colors;
|
||||
std::vector<Base::Color> colors;
|
||||
std::vector<Base::Vector3f> normals;
|
||||
int width, height;
|
||||
Base::Placement placement;
|
||||
|
||||
@@ -113,7 +113,7 @@ void ViewProviderPoints::onChanged(const App::Property* prop)
|
||||
|
||||
void ViewProviderPoints::setVertexColorMode(App::PropertyColorList* pcProperty)
|
||||
{
|
||||
const std::vector<App::Color>& val = pcProperty->getValues();
|
||||
const std::vector<Base::Color>& val = pcProperty->getValues();
|
||||
|
||||
pcColorMat->diffuseColor.setNum(val.size());
|
||||
SbColor* col = pcColorMat->diffuseColor.startEditing();
|
||||
@@ -500,18 +500,18 @@ void ViewProviderScattered::cut(const std::vector<SbVec2f>& picked,
|
||||
}
|
||||
else if (type == App::PropertyColorList::getClassTypeId()) {
|
||||
// static_cast<App::PropertyColorList*>(it->second)->removeIndices(removeIndices);
|
||||
const std::vector<App::Color>& colors =
|
||||
const std::vector<Base::Color>& colors =
|
||||
static_cast<App::PropertyColorList*>(it.second)->getValues();
|
||||
|
||||
if (removeIndices.size() > colors.size()) {
|
||||
break;
|
||||
}
|
||||
|
||||
std::vector<App::Color> remainValue;
|
||||
std::vector<Base::Color> remainValue;
|
||||
remainValue.reserve(colors.size() - removeIndices.size());
|
||||
|
||||
std::vector<unsigned long>::iterator pos = removeIndices.begin();
|
||||
for (std::vector<App::Color>::const_iterator jt = colors.begin(); jt != colors.end();
|
||||
for (std::vector<Base::Color>::const_iterator jt = colors.begin(); jt != colors.end();
|
||||
++jt) {
|
||||
unsigned long index = jt - colors.begin();
|
||||
if (pos == removeIndices.end()) {
|
||||
|
||||
Reference in New Issue
Block a user