| 200 | } |
| 201 | |
| 202 | bool ImportOCAF2::getColor(const TopoDS_Shape& shape, Info& info, bool check, bool noDefault) |
| 203 | { |
| 204 | bool ret = false; |
| 205 | Quantity_ColorRGBA aColor; |
| 206 | if (aColorTool->GetColor(shape, XCAFDoc_ColorSurf, aColor)) { |
| 207 | Base::Color c = Tools::convertColor(aColor); |
| 208 | if (!check || info.faceColor != c) { |
| 209 | info.faceColor = c; |
| 210 | info.hasFaceColor = true; |
| 211 | ret = true; |
| 212 | } |
| 213 | } |
| 214 | if (!noDefault && !info.hasFaceColor && aColorTool->GetColor(shape, XCAFDoc_ColorGen, aColor)) { |
| 215 | Base::Color c = Tools::convertColor(aColor); |
| 216 | if (!check || info.faceColor != c) { |
| 217 | info.faceColor = c; |
| 218 | info.hasFaceColor = true; |
| 219 | ret = true; |
| 220 | } |
| 221 | } |
| 222 | if (aColorTool->GetColor(shape, XCAFDoc_ColorCurv, aColor)) { |
| 223 | Base::Color c = Tools::convertColor(aColor); |
| 224 | // Some STEP include a curve color with the same value of the face |
| 225 | // color. And this will look weird in FC. So for shape with face |
| 226 | // we'll ignore the curve color, if it is the same as the face color. |
| 227 | if ((c != info.faceColor || !TopExp_Explorer(shape, TopAbs_FACE).More()) |
| 228 | && (!check || info.edgeColor != c)) { |
| 229 | info.edgeColor = c; |
| 230 | info.hasEdgeColor = true; |
| 231 | ret = true; |
| 232 | } |
| 233 | } |
| 234 | if (!check) { |
| 235 | if (!info.hasFaceColor) { |
| 236 | info.faceColor = options.defaultFaceColor; |
| 237 | } |
| 238 | if (!info.hasEdgeColor) { |
| 239 | info.edgeColor = options.defaultEdgeColor; |
| 240 | } |
| 241 | } |
| 242 | return ret; |
| 243 | } |
| 244 | |
| 245 | App::DocumentObject* ImportOCAF2::expandShape(App::Document* doc, TDF_Label label, const TopoDS_Shape& shape) |
| 246 | { |