Skip to content

Commit

Permalink
[all] Replace all sofa::defaulttypes::RGBAColor to sofa::helper::type…
Browse files Browse the repository at this point in the history
…s::RGBAColor (#1463)

* [all] Replace all sofa::defaulttypes::RGBAColor to sofa::helper::types::RGBAColor

* [SofaHelper] Add RGBAColor_fwd.h for forward declaration.

* [SofaHelper] update RGBAColor_fwd.h
  • Loading branch information
damienmarchal authored Sep 2, 2020
1 parent 295ca80 commit 5997b93
Show file tree
Hide file tree
Showing 121 changed files with 346 additions and 318 deletions.
4 changes: 2 additions & 2 deletions SofaKernel/modules/SofaBaseVisual/BackgroundSetting.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <sofa/core/objectmodel/ConfigurationSetting.h>
#include <sofa/core/objectmodel/DataFileName.h>
#include <sofa/defaulttype/Vec.h>
#include <sofa/defaulttype/RGBAColor.h>
#include <sofa/helper/types/RGBAColor.h>

namespace sofa
{
Expand All @@ -47,7 +47,7 @@ class SOFA_BASE_VISUAL_API BackgroundSetting: public core::objectmodel::Configur
BackgroundSetting(); ///< Default constructor

public:
Data<defaulttype::RGBAColor> color; ///< Color of the Background of the Viewer.
Data<sofa::helper::types::RGBAColor> color; ///< Color of the Background of the Viewer.
sofa::core::objectmodel::DataFileName image; ///< Image to be used as background of the viewer.

};
Expand Down
2 changes: 1 addition & 1 deletion SofaKernel/modules/SofaBaseVisual/VisualModelImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace component

namespace visualmodel
{

using sofa::helper::types::RGBAColor;
using namespace sofa::defaulttype;
using namespace sofa::core::topology;
using namespace sofa::core::loader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ CollisionModel::CollisionModel()
, contactFriction(initData(&contactFriction, (SReal)0.0, "contactFriction", "Contact friction coefficient (dry or viscous or unused depending on the contact method)"))
, contactRestitution(initData(&contactRestitution, (SReal)0.0, "contactRestitution", "Contact coefficient of restitution"))
, contactResponse(initData(&contactResponse, "contactResponse", "if set, indicate to the ContactManager that this model should use the given class of contacts.\nNote that this is only indicative, and in particular if both collision models specify a different class it is up to the manager to choose."))
, color(initData(&color, defaulttype::RGBAColor(1,0,0,1), "color", "color used to display the collision model if requested"))
, color(initData(&color, sofa::helper::types::RGBAColor(1,0,0,1), "color", "color used to display the collision model if requested"))
, group(initData(&group,"group","IDs of the groups containing this model. No collision can occur between collision models included in a common group (e.g. allowing the same object to have multiple collision models)"))
, size(0)
, numberOfContacts(0)
Expand Down
6 changes: 3 additions & 3 deletions SofaKernel/modules/SofaCore/src/sofa/core/CollisionModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <sofa/core/CollisionElement.h>

//todo(dmarchal 2018-06-19) I really wonder why a collision model has a dependency to a RGBAColors.
#include <sofa/defaulttype/RGBAColor.h>
#include <sofa/helper/types/RGBAColor.h>

namespace sofa
{
Expand Down Expand Up @@ -382,7 +382,7 @@ class SOFA_CORE_API CollisionModel : public virtual objectmodel::BaseObject
/// Set a color that can be used to display this CollisionModel

void setColor4f(const float *c) {
color.setValue(defaulttype::RGBAColor(c[0],c[1],c[2],c[3]));
color.setValue(sofa::helper::types::RGBAColor(c[0],c[1],c[2],c[3]));
}

/// Set of differents parameters
Expand Down Expand Up @@ -426,7 +426,7 @@ class SOFA_CORE_API CollisionModel : public virtual objectmodel::BaseObject
Data<std::string> contactResponse;

/// color used to display the collision model if requested
Data<defaulttype::RGBAColor> color;
Data<sofa::helper::types::RGBAColor> color;

/// No collision can occur between collision
/// models included in a common group (i.e. sharing a common id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ namespace sofa
{
namespace defaulttype
{
using sofa::helper::types::RGBAColor ;
[[deprecated("sofa::helper::types::RGBAColor is now part in sofa::helper::types::RGBAColor. Please update your code.")]]
typedef sofa::helper::types::RGBAColor RGBAColor;
} // namespace defaulttype
} // namespace sofa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
#include <SofaDeformable/config.h>
#include <sofa/core/behavior/ForceField.h>
#include <sofa/core/BaseMapping.h>
#include <sofa/defaulttype/RGBAColor.h>

#include <sofa/helper/types/RGBAColor.h>

namespace sofa
{
Expand Down Expand Up @@ -91,7 +90,7 @@ class PolynomialRestShapeSpringsForceField : public core::behavior::ForceField<D

Data<bool> d_recomputeIndices;
Data<bool> d_drawSpring; ///< draw Spring
Data<defaulttype::RGBAColor> d_springColor;
Data<sofa::helper::types::RGBAColor> d_springColor;
Data<float> d_showIndicesScale;

Data<VecReal> d_zeroLength; /// Springs initial lengths
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ PolynomialRestShapeSpringsForceField<DataTypes>::PolynomialRestShapeSpringsForce
, d_polynomialDegree(initData(&d_polynomialDegree, "polynomialDegree", "vector of values that show polynomials degrees"))
, d_recomputeIndices(initData(&d_recomputeIndices, false, "recompute_indices", "Recompute indices (should be false for BBOX)"))
, d_drawSpring(initData(&d_drawSpring,false,"drawSpring","draw Spring"))
, d_springColor(initData(&d_springColor, defaulttype::RGBAColor(0.0f, 1.0f, 0.0f, 1.0f), "springColor","spring color"))
, d_springColor(initData(&d_springColor, sofa::helper::types::RGBAColor(0.0f, 1.0f, 0.0f, 1.0f), "springColor","spring color"))
, d_showIndicesScale(initData(&d_showIndicesScale, (float)0.02, "showIndicesScale", "Scale for indices display. (default=0.02)"))
, d_zeroLength(initData(&d_zeroLength,"initialLength","initial virtual length of the spring"))
, d_smoothShift(initData(&d_smoothShift,double(0.0),"smoothShift","denominator correction adding shift value"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
#include <SofaDeformable/config.h>
#include <sofa/core/behavior/PairInteractionForceField.h>
#include <sofa/core/BaseMapping.h>
#include <sofa/defaulttype/RGBAColor.h>

#include <sofa/helper/types/RGBAColor.h>

namespace sofa
{
Expand Down Expand Up @@ -84,7 +83,7 @@ class PolynomialSpringsForceField : public core::behavior::PairInteractionForceF

Data<int> d_drawMode; /// Draw Mode: 0=Line - 1=Cylinder - 2=Arrow
Data<float> d_showArrowSize; ///< size of the axis
Data<defaulttype::RGBAColor> d_springColor;
Data<sofa::helper::types::RGBAColor> d_springColor;
Data<float> d_showIndicesScale;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ PolynomialSpringsForceField<DataTypes>::PolynomialSpringsForceField(MechanicalSt
, d_compressible(initData(&d_compressible, false, "compressible", "Indicates if object compresses without reactio force"))
, d_drawMode(initData(&d_drawMode, 0, "drawMode", "The way springs will be drawn:\n- 0: Line\n- 1:Cylinder\n- 2: Arrow"))
, d_showArrowSize(initData(&d_showArrowSize, 0.01f, "showArrowSize","size of the axis"))
, d_springColor(initData(&d_springColor, defaulttype::RGBAColor(0.0f, 1.0f, 0.0f, 1.0f), "springColor", "spring color"))
, d_springColor(initData(&d_springColor, sofa::helper::types::RGBAColor(0.0f, 1.0f, 0.0f, 1.0f), "springColor", "spring color"))
, d_showIndicesScale(initData(&d_showIndicesScale, (float)0.02, "showIndicesScale", "Scale for indices display. (default=0.02)"))
, m_dimension(Coord::total_size)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define SOFA_COMPONENT_FORCEFIELD_RESTSHAPESPRINGFORCEFIELD_H
#include "config.h"

#include <sofa/defaulttype/RGBAColor.h>
#include <sofa/helper/types/RGBAColor.h>

#include <sofa/core/behavior/ForceField.h>
#include <sofa/core/objectmodel/Data.h>
Expand Down Expand Up @@ -84,7 +84,7 @@ class RestShapeSpringsForceField : public core::behavior::ForceField<DataTypes>
Data< helper::vector< unsigned int > > d_external_points; ///< points from the external Mechancial State that define the rest shape springs
Data< bool > d_recompute_indices; ///< Recompute indices (should be false for BBOX)
Data< bool > d_drawSpring; ///< draw Spring
Data< defaulttype::RGBAColor > d_springColor; ///< spring color. (default=[0.0,1.0,0.0,1.0])
Data< sofa::helper::types::RGBAColor > d_springColor; ///< spring color. (default=[0.0,1.0,0.0,1.0])

SingleLink<RestShapeSpringsForceField<DataTypes>, sofa::core::behavior::MechanicalState< DataTypes >, BaseLink::FLAG_STOREPATH|BaseLink::FLAG_STRONGLINK> l_restMState;
linearsolver::EigenBaseSparseMatrix<typename DataTypes::Real> matS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <sofa/defaulttype/VecTypes.h>
#include <sofa/defaulttype/RigidTypes.h>

#include <sofa/defaulttype/RGBAColor.h>
#include <sofa/helper/types/RGBAColor.h>

namespace sofa
{
Expand Down Expand Up @@ -60,7 +60,7 @@ RestShapeSpringsForceField<DataTypes>::RestShapeSpringsForceField()
, d_external_points(initData(&d_external_points, "external_points", "points from the external Mechancial State that define the rest shape springs"))
, d_recompute_indices(initData(&d_recompute_indices, true, "recompute_indices", "Recompute indices (should be false for BBOX)"))
, d_drawSpring(initData(&d_drawSpring,false,"drawSpring","draw Spring"))
, d_springColor(initData(&d_springColor, defaulttype::RGBAColor(0.0,1.0,0.0,1.0), "springColor","spring color. (default=[0.0,1.0,0.0,1.0])"))
, d_springColor(initData(&d_springColor, sofa::helper::types::RGBAColor(0.0,1.0,0.0,1.0), "springColor","spring color. (default=[0.0,1.0,0.0,1.0])"))
, l_restMState(initLink("external_rest_shape", "rest_shape can be defined by the position of an external Mechanical State"))
{
}
Expand Down
1 change: 1 addition & 0 deletions SofaKernel/modules/SofaHelper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ set(HEADER_FILES
${SRC_ROOT}/vector_algebra.h
${SRC_ROOT}/vector_device.h
${SRC_ROOT}/types/RGBAColor.h
${SRC_ROOT}/types/RGBAColor_fwd.h
${SRC_ROOT}/types/Material.h
${SRC_ROOT}/logging/Messaging.h
${SRC_ROOT}/logging/Message.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ using sofa::defaulttype::Vec4d ;
#include <sofa/core/objectmodel/Data.h>
using sofa::core::objectmodel::Data ;

#include <sofa/defaulttype/RGBAColor.h>
using sofa::defaulttype::RGBAColor ;
#include <sofa/helper/types/RGBAColor.h>
using sofa::helper::types::RGBAColor ;

#include <sofa/helper/testing/BaseTest.h>
using sofa::helper::testing::BaseTest ;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture *
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
* *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*******************************************************************************
* Authors: The SOFA Team and external contributors (see Authors.txt) *
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#pragma once

namespace sofa::helper::types
{
class RGBAColor;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <CGALPlugin/Refine2DMesh.h>
#include <sofa/core/visual/VisualParams.h>
#include <sofa/defaulttype/RGBAColor.h>
#include <sofa/helper/types/RGBAColor.h>

#define CGAL_MESH_2_VERBOSE

Expand Down Expand Up @@ -377,7 +377,7 @@ namespace cgal

const VecCoord& seeds = d_seedPoints.getValue();
sofa::helper::vector<sofa::defaulttype::Vec3> points;
sofa::defaulttype::RGBAColor color(0.0, 0.0, 1.0, 1);
sofa::helper::types::RGBAColor color(0.0, 0.0, 1.0, 1);

for (unsigned int i = 0; i < seeds.size(); i++)
points.push_back(seeds[i]);
Expand All @@ -392,7 +392,7 @@ namespace cgal

const VecCoord& regions = d_regionPoints.getValue();
sofa::helper::vector<sofa::defaulttype::Vec3> points;
sofa::defaulttype::RGBAColor color(1.0, 0.0, 0.0, 1);
sofa::helper::types::RGBAColor color(1.0, 0.0, 0.0, 1);

for (unsigned int i = 0; i < regions.size(); i++)
points.push_back(regions[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class SOFA_Compliant_gui_API CompliantAttachPerformer: public TInteractionPerfor
SReal _compliance;
bool _isCompliance;
SReal _arrowSize;
defaulttype::RGBAColor _color;
sofa::helper::types::RGBAColor _color;
bool _visualmodel; // to be able to export the mouse spring in obj


Expand Down
6 changes: 3 additions & 3 deletions applications/plugins/Compliant/mapping/AdditionMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "ConstantAssembledMapping.h"
#include "ConstantAssembledMultiMapping.h"
#include <sofa/defaulttype/RGBAColor.h>
#include <sofa/helper/types/RGBAColor.h>
#include <sofa/core/visual/VisualParams.h>

namespace sofa
Expand Down Expand Up @@ -42,15 +42,15 @@ class SOFA_Compliant_API AdditionMapping : public ConstantAssembledMapping<TIn,

Data< pairs_type > pairs; ///< index pairs for computing deltas
Data< SReal > d_showObjectScale; ///< drawing size
Data< defaulttype::RGBAColor > d_color; ///< drawing color
Data< sofa::helper::types::RGBAColor > d_color; ///< drawing color




AdditionMapping()
: pairs( initData(&pairs, "pairs", "index pairs for computing additions") )
, d_showObjectScale(initData(&d_showObjectScale, SReal(-1), "showObjectScale", "Scale for object display"))
, d_color(initData(&d_color, defaulttype::RGBAColor(1,1,0,1), "showColor", "Color for object display. (default=[1.0,1.0,0.0,1.0])"))
, d_color(initData(&d_color, sofa::helper::types::RGBAColor(1,1,0,1), "showColor", "Color for object display. (default=[1.0,1.0,0.0,1.0])"))
{}

enum {Nin = TIn::deriv_total_size, Nout = TOut::deriv_total_size };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "ConstantAssembledMapping.h"
#include <sofa/core/visual/VisualParams.h>
#include <sofa/defaulttype/RGBAColor.h>
#include <sofa/helper/types/RGBAColor.h>

namespace sofa
{
Expand Down Expand Up @@ -43,7 +43,7 @@ class DifferenceFromTargetMapping : public ConstantAssembledMapping<TIn, TOut>

Data< bool > d_inverted; ///< target-p (rather than p-target)
Data< SReal > d_showObjectScale; ///< drawing size
Data< defaulttype::RGBAColor > d_color; ///< drawing color
Data< sofa::helper::types::RGBAColor > d_color; ///< drawing color


DifferenceFromTargetMapping()
Expand All @@ -52,7 +52,7 @@ class DifferenceFromTargetMapping : public ConstantAssembledMapping<TIn, TOut>
, d_targetIndices( initData(&d_targetIndices, "targetIndices", "target indices in target positions which who computes deltas") )
, d_inverted( initData(&d_inverted, false, "inverted", "target-p (rather than p-target)") )
, d_showObjectScale(initData(&d_showObjectScale, SReal(0), "showObjectScale", "Scale for object display"))
, d_color(initData(&d_color, defaulttype::RGBAColor(1,1,0,1), "showColor", "Color for object display. (default=[1.0,1.0,0.0,1.0])"))
, d_color(initData(&d_color, sofa::helper::types::RGBAColor(1,1,0,1), "showColor", "Color for object display. (default=[1.0,1.0,0.0,1.0])"))
{

// backward compatibility with OffsetMapping, a previous identical mapping
Expand Down
6 changes: 3 additions & 3 deletions applications/plugins/Compliant/mapping/DifferenceMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "ConstantAssembledMapping.h"
#include "ConstantAssembledMultiMapping.h"

#include <sofa/defaulttype/RGBAColor.h>
#include <sofa/helper/types/RGBAColor.h>
#include <sofa/core/visual/VisualParams.h>

namespace sofa
Expand Down Expand Up @@ -39,15 +39,15 @@ class SOFA_Compliant_API DifferenceMapping : public ConstantAssembledMapping<TIn

Data< pairs_type > pairs; ///< index pairs for computing deltas
Data< SReal > d_showObjectScale; ///< drawing size
Data< defaulttype::RGBAColor > d_color; ///< drawing color
Data< sofa::helper::types::RGBAColor > d_color; ///< drawing color




DifferenceMapping()
: pairs( initData(&pairs, "pairs", "index pairs for computing deltas") )
, d_showObjectScale(initData(&d_showObjectScale, SReal(-1), "showObjectScale", "Scale for object display"))
, d_color(initData(&d_color, defaulttype::RGBAColor(1,1,0,1), "showColor", "Color for object display. (default=[1.0,1.0,0.0,1.0])"))
, d_color(initData(&d_color, sofa::helper::types::RGBAColor(1,1,0,1), "showColor", "Color for object display. (default=[1.0,1.0,0.0,1.0])"))
{}

enum {Nin = TIn::deriv_total_size, Nout = TOut::deriv_total_size };
Expand Down
6 changes: 3 additions & 3 deletions applications/plugins/Compliant/mapping/SafeDistanceMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "AssembledMapping.h"
#include "AssembledMultiMapping.h"
#include <sofa/defaulttype/RGBAColor.h>
#include <sofa/helper/types/RGBAColor.h>
#include <sofa/core/visual/VisualParams.h>

namespace sofa
Expand Down Expand Up @@ -52,7 +52,7 @@ class SOFA_Compliant_API SafeDistanceMapping : public AssembledMapping<TIn, TOut
Data< unsigned > d_geometricStiffness; ///< how to compute geometric stiffness (0->no GS, 1->exact GS, 2->stabilized GS)

Data< SReal > d_showObjectScale; ///< drawing size
Data< defaulttype::RGBAColor > d_color; ///< drawing color
Data< sofa::helper::types::RGBAColor > d_color; ///< drawing color

protected:

Expand All @@ -69,7 +69,7 @@ class SOFA_Compliant_API SafeDistanceMapping : public AssembledMapping<TIn, TOut
, d_epsilonLength( initData(&d_epsilonLength, 1e-4, "epsilonLength", "Threshold to consider a length too close to 0") )
, d_geometricStiffness( initData(&d_geometricStiffness, 2u, "geometricStiffness", "0 -> no GS, 1 -> exact GS, 2 -> stabilized GS (default)") )
, d_showObjectScale(initData(&d_showObjectScale, SReal(-1), "showObjectScale", "Scale for object display"))
, d_color(initData(&d_color, defaulttype::RGBAColor(1,1,0,1), "showColor", "Color for object display. (default=[1.0,1.0,0.0,1.0])"))
, d_color(initData(&d_color, sofa::helper::types::RGBAColor(1,1,0,1), "showColor", "Color for object display. (default=[1.0,1.0,0.0,1.0])"))
{}

enum {Nin = TIn::deriv_total_size, Nout = TOut::deriv_total_size };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ CompliantAttachButtonSetting::CompliantAttachButtonSetting()
: compliance(initData(&compliance, (SReal)1e-3, "compliance", "Compliance of the manipulator. 0 is rigid, the bigger the softer. Negative values make no sense."))
, isCompliance(initData(&isCompliance, false, "isCompliance", "Is the mouse interaction treated as a compliance? (otherwise as a stiffness)"))
, arrowSize(initData(&arrowSize, SReal(0), "arrowSize", ""))
, color(initData(&color, defaulttype::RGBAColor(1,0,0,1), "color", ""))
, color(initData(&color, sofa::helper::types::RGBAColor(1,0,0,1), "color", ""))
, visualmodel(initData(&visualmodel, false, "visualmodel", ""))
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <sofa/core/objectmodel/ConfigurationSetting.h>
#include <SofaGraphComponent/MouseButtonSetting.h>

#include <sofa/defaulttype/RGBAColor.h>
#include <sofa/helper/types/RGBAColor.h>

namespace sofa
{
Expand All @@ -51,7 +51,7 @@ class SOFA_Compliant_API CompliantAttachButtonSetting: public MouseButtonSetting
Data<SReal> compliance; ///< Compliance of the manipulator. 0 is rigid, the bigger the softer. Negative values make no sense.
Data<bool> isCompliance; ///< Is the mouse interaction treated as a compliance? (otherwise as a stiffness)
Data<SReal> arrowSize;
Data<defaulttype::RGBAColor> color;
Data<sofa::helper::types::RGBAColor> color;
Data<bool> visualmodel;
};

Expand Down
Loading

0 comments on commit 5997b93

Please sign in to comment.