X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FCurveCreator%2FCurveCreator_Operation.cxx;h=fb346fee9ef31cc69d8e3254b984ee3bd65187ae;hb=09ece3edc1896e16a412b35810d76411f06d68ec;hp=173e1c8817fdcabd8c6ebf84940c751accafbd22;hpb=8866b5fcd5529bf033ebfb845dafdbaf33d3899c;p=modules%2Fgeom.git diff --git a/src/CurveCreator/CurveCreator_Operation.cxx b/src/CurveCreator/CurveCreator_Operation.cxx index 173e1c881..fb346fee9 100644 --- a/src/CurveCreator/CurveCreator_Operation.cxx +++ b/src/CurveCreator/CurveCreator_Operation.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2013-2023 CEA, EDF, OPEN CASCADE // // This library 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -23,6 +23,9 @@ #include "CurveCreator_Operation.hxx" #include "CurveCreator_Curve.hxx" #include "CurveCreator.hxx" +#include "CurveCreator_Section.hxx" +#include "CurveCreator_Utils.hxx" +#include #include #include @@ -114,6 +117,28 @@ bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType, return isOK; } +bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType, + const int theIntParam1, + const int theIntParam2[3]) +{ + bool isOK = false; + + if (theType == CurveCreator_Operation::SetColorSection) + { + int *pData = (int *)allocate(4*sizeof(int)); + + pData[0] = theIntParam1; + pData[1] = theIntParam2[0]; + pData[2] = theIntParam2[1]; + pData[3] = theIntParam2[2]; + myType = theType; + isOK = true; + } + + return isOK; +} + + //======================================================================= // function: Constructor // purpose: @@ -252,12 +277,12 @@ bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType, const int aNbPoints = theParamList1.size(); - CurveCreator_ICurve::SectionToPointCoordsList::const_iterator anIt = + CurveCreator_ICurve::SectionToPointCoordsList::const_iterator anIt = theParamList1.begin(); const int aNbCoords = anIt->second.size(); const size_t aSize = - sizeof(aNbPoints) + sizeof(aNbCoords) + + sizeof(aNbPoints) + sizeof(aNbCoords) + aNbPoints * (3*sizeof(int) + aNbCoords*sizeof(CurveCreator::TypeCoord)); int *pIntData = (int *)allocate(aSize); @@ -295,7 +320,7 @@ bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType, if (theType == CurveCreator_Operation::RemovePoints) { const int aNbPoints = theParamList1.size(); - CurveCreator_ICurve::SectionToPointList::const_iterator anIt = + CurveCreator_ICurve::SectionToPointList::const_iterator anIt = theParamList1.begin(); const size_t aSize = @@ -341,7 +366,7 @@ void CurveCreator_Operation::apply(CurveCreator_Curve *theCurve) int nbPoints = pInt[0]; int nbCoords = pInt[1]; - int nbParams = 3+nbCoords; + int nbParams = 3+nbCoords*sizeof(double)/sizeof(int); for (int i = 0; i < nbPoints*nbParams; i=i+nbParams) { aCoords.clear(); aPoints.clear(); @@ -363,6 +388,8 @@ void CurveCreator_Operation::apply(CurveCreator_Curve *theCurve) case CurveCreator_Operation::SetCoordinates: theCurve->setPointInternal( aSectionsMap ); break; + default: + break; } } break; @@ -414,7 +441,9 @@ void CurveCreator_Operation::apply(CurveCreator_Curve *theCurve) char* aPtr = ((char*)&pInt[2]); aPtr += (aName.length()) + 1; getCoords((int*)aPtr, aCoords); - theCurve->addSectionInternal(aName, aType, (pInt[1] != 0), aCoords); + Quantity_Color aLastColor = theCurve->getLastRemovedColor(); + theCurve->popLastRemovedColor(); + theCurve->addSectionInternal(aName, aType, (pInt[1] != 0), aCoords, aLastColor); } break; case CurveCreator_Operation::RemoveSection: @@ -426,6 +455,13 @@ void CurveCreator_Operation::apply(CurveCreator_Curve *theCurve) theCurve->setSectionNameInternal(pInt[0], aName); } break; + case CurveCreator_Operation::SetColorSection: + { + Quantity_Color aColor = CurveCreator_Utils::colorConv(QColor(pInt[1], pInt[2], pInt[3])); + theCurve->setColorSectionInternal(pInt[0], aColor); + //theCurve->redisplayCurve(false); + } + break; default: break; }