removeResults(1); // for case the point type was switched from multi-results type
std::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
aConstr->setInfinite(true);
- aConstr->setShape(aShape);
+ aConstr->setShape(aShape);
+ aConstr->setColor(ModelAPI_ResultConstruction::ModelApi_PointColor::DEFAULT_COLOR(),
+ ModelAPI_ResultConstruction::ModelApi_PointColor::COLOR_CONFIG_NAME()); /// set point color
setResult(aConstr);
}
std::string& theDefault)
{
theSection = "Visualization";
- theName = "result_construction_color";
- theDefault = DEFAULT_COLOR();
+ theName = getColorConfigName();
+ theDefault = getColor();
}
void Model_ResultConstruction::setShape(std::shared_ptr<GeomAPI_Shape> theShape)
return group();
}
+ModelAPI_ResultConstruction::ModelAPI_ResultConstruction(){
+ setColor(DEFAULT_COLOR(), DEFAULT_COLOR_CONFIG_NAME());
+}
class ModelAPI_ResultConstruction : public ModelAPI_Result
{
public:
+ ModelAPI_ResultConstruction();
+
/// Returns the group identifier of this result
MODELAPI_EXPORT virtual std::string groupName();
virtual bool isInfinite() = 0;
/// Sets the flag that it is infinite
virtual void setInfinite(const bool theInfinite) = 0;
+
+ /*************************************************************************/
+ /// Changes for custom point color
+
+ inline static const std::string& DEFAULT_COLOR_CONFIG_NAME()
+ {
+ static const std::string RESULT_CONSTRUCTION_COLOR_CONFIG_NAME("result_construction_color");
+ return RESULT_CONSTRUCTION_COLOR_CONFIG_NAME;
+ }
+
+ inline void setColor(const std::string myColor, const std::string & myColorConfigName)
+ {
+ color = myColor;
+ colorConfigName = myColorConfigName;
+ }
+
+ inline const std::string & getColor() const
+ {
+ return color;
+ }
+
+ inline const std::string & getColorConfigName() const
+ {
+ return colorConfigName;
+ }
+
+private:
+ std::string color;
+ std::string colorConfigName;
+
+public:
+
+ /// Specific properties for point
+ class ModelApi_PointColor
+ {
+ public:
+ /// default color for a point construction
+ inline static const std::string& DEFAULT_COLOR()
+ {
+ static const std::string POINT_CONSTRUCTION_COLOR("85,85,0");
+ return POINT_CONSTRUCTION_COLOR;
+ }
+
+ inline static const std::string COLOR_CONFIG_NAME()
+ {
+ static const std::string POINT_CONFIG_COLOR_NAME("result_point_color");
+ return POINT_CONFIG_COLOR_NAME;
+ }
+ };
+ /*************************************************************************/
};
//! Pointer on feature object
Config_PropManager::registerProp("Visualization", "result_group_color", "Group color",
Config_Prop::Color, ModelAPI_ResultGroup::DEFAULT_COLOR());
- Config_PropManager::registerProp("Visualization", "result_construction_color",
- "Construction color",
- Config_Prop::Color,
- ModelAPI_ResultConstruction::DEFAULT_COLOR());
+ Config_PropManager::registerProp("Visualization",
+ ModelAPI_ResultConstruction::DEFAULT_COLOR_CONFIG_NAME(),
+ "Construction color", Config_Prop::Color,
+ ModelAPI_ResultConstruction::DEFAULT_COLOR());
+
+ Config_PropManager::registerProp("Visualization",
+ ModelAPI_ResultConstruction::ModelApi_PointColor::COLOR_CONFIG_NAME(),
+ "Construction point color", Config_Prop::Color,
+ ModelAPI_ResultConstruction::ModelApi_PointColor::DEFAULT_COLOR());
+
Config_PropManager::registerProp("Visualization", "result_part_color", "Part color",
Config_Prop::Color, ModelAPI_ResultPart::DEFAULT_COLOR());