20 using namespace UT::Literal;
23 namespace SOP_WatershedEnums
52 myMinima =
"minima"_sh;
54 myMaxima =
"maxima"_sh;
55 myGenSaddleEdges =
false;
56 mySaddleEdges =
"valleys"_sh;
57 myGenRidgeEdges =
false;
58 myRidgeEdges =
"ridges"_sh;
59 myGenValleyEdges =
false;
60 myValleyEdges =
"valleys"_sh;
70 if (myGroup != src.myGroup)
return false;
71 if (mySrcAttrib != src.mySrcAttrib)
return false;
72 if (mySrcComp != src.mySrcComp)
return false;
73 if (myCellStructure != src.myCellStructure)
return false;
74 if (myThreshold != src.myThreshold)
return false;
75 if (myGenMinima != src.myGenMinima)
return false;
76 if (myMinima != src.myMinima)
return false;
77 if (myGenMaxima != src.myGenMaxima)
return false;
78 if (myMaxima != src.myMaxima)
return false;
79 if (myGenSaddleEdges != src.myGenSaddleEdges)
return false;
80 if (mySaddleEdges != src.mySaddleEdges)
return false;
81 if (myGenRidgeEdges != src.myGenRidgeEdges)
return false;
82 if (myRidgeEdges != src.myRidgeEdges)
return false;
83 if (myGenValleyEdges != src.myGenValleyEdges)
return false;
84 if (myValleyEdges != src.myValleyEdges)
return false;
101 graph->
evalOpParm(myGroup, nodeidx,
"group", time, 0);
102 mySrcAttrib =
"P"_sh;
104 graph->
evalOpParm(mySrcAttrib, nodeidx,
"srcattrib", time, 0);
107 graph->
evalOpParm(mySrcComp, nodeidx,
"srccomp", time, 0);
110 graph->
evalOpParm(myCellStructure, nodeidx,
"cellstructure", time, 0);
113 graph->
evalOpParm(myThreshold, nodeidx,
"threshold", time, 0);
116 graph->
evalOpParm(myGenMinima, nodeidx,
"genminima", time, 0);
117 myMinima =
"minima"_sh;
118 if (
true && ( (!(((getGenMinima()==0)))) ) )
119 graph->
evalOpParm(myMinima, nodeidx,
"minima", time, 0);
122 graph->
evalOpParm(myGenMaxima, nodeidx,
"genmaxima", time, 0);
123 myMaxima =
"maxima"_sh;
124 if (
true && ( (!(((getGenMaxima()==0)))) ) )
125 graph->
evalOpParm(myMaxima, nodeidx,
"maxima", time, 0);
126 myGenSaddleEdges =
false;
128 graph->
evalOpParm(myGenSaddleEdges, nodeidx,
"gensaddleedges", time, 0);
129 mySaddleEdges =
"valleys"_sh;
130 if (
true && ( (!(((getGenSaddleEdges()==0)))) ) )
131 graph->
evalOpParm(mySaddleEdges, nodeidx,
"saddleedges", time, 0);
132 myGenRidgeEdges =
false;
134 graph->
evalOpParm(myGenRidgeEdges, nodeidx,
"genridgeedges", time, 0);
135 myRidgeEdges =
"ridges"_sh;
136 if (
true && ( (!(((getGenRidgeEdges()==0)))) ) )
137 graph->
evalOpParm(myRidgeEdges, nodeidx,
"ridgeedges", time, 0);
138 myGenValleyEdges =
false;
140 graph->
evalOpParm(myGenValleyEdges, nodeidx,
"genvalleyedges", time, 0);
141 myValleyEdges =
"valleys"_sh;
142 if (
true && ( (!(((getGenValleyEdges()==0)))) ) )
143 graph->
evalOpParm(myValleyEdges, nodeidx,
"valleyedges", time, 0);
159 template <
typename T>
166 if (idx.
size() != instance.
size()+1)
171 coerceValue(value, myGroup);
174 coerceValue(value, mySrcAttrib);
177 coerceValue(value, mySrcComp);
180 coerceValue(value, myCellStructure);
183 coerceValue(value, myThreshold);
186 coerceValue(value, myGenMinima);
189 coerceValue(value, myMinima);
192 coerceValue(value, myGenMaxima);
195 coerceValue(value, myMaxima);
198 coerceValue(value, myGenSaddleEdges);
201 coerceValue(value, mySaddleEdges);
204 coerceValue(value, myGenRidgeEdges);
207 coerceValue(value, myRidgeEdges);
210 coerceValue(value, myGenValleyEdges);
213 coerceValue(value, myValleyEdges);
220 { doGetParmValue(idx, instance, value); }
222 { doGetParmValue(idx, instance, value); }
224 { doGetParmValue(idx, instance, value); }
226 { doGetParmValue(idx, instance, value); }
228 { doGetParmValue(idx, instance, value); }
230 { doGetParmValue(idx, instance, value); }
232 { doGetParmValue(idx, instance, value); }
234 { doGetParmValue(idx, instance, value); }
236 { doGetParmValue(idx, instance, value); }
238 { doGetParmValue(idx, instance, value); }
240 { doGetParmValue(idx, instance, value); }
242 template <
typename T>
249 if (idx.
size() != instance.
size()+1)
254 coerceValue(myGroup, value);
257 coerceValue(mySrcAttrib, value);
260 coerceValue(mySrcComp, value);
263 coerceValue(myCellStructure, value);
266 coerceValue(myThreshold, value);
269 coerceValue(myGenMinima, value);
272 coerceValue(myMinima, value);
275 coerceValue(myGenMaxima, value);
278 coerceValue(myMaxima, value);
281 coerceValue(myGenSaddleEdges, value);
284 coerceValue(mySaddleEdges, value);
287 coerceValue(myGenRidgeEdges, value);
290 coerceValue(myRidgeEdges, value);
293 coerceValue(myGenValleyEdges, value);
296 coerceValue(myValleyEdges, value);
303 { doSetParmValue(idx, instance, value); }
305 { doSetParmValue(idx, instance, value); }
307 { doSetParmValue(idx, instance, value); }
309 { doSetParmValue(idx, instance, value); }
311 { doSetParmValue(idx, instance, value); }
313 { doSetParmValue(idx, instance, value); }
315 { doSetParmValue(idx, instance, value); }
317 { doSetParmValue(idx, instance, value); }
319 { doSetParmValue(idx, instance, value); }
321 { doSetParmValue(idx, instance, value); }
323 { doSetParmValue(idx, instance, value); }
339 if (fieldnum.
size() < 1)
350 return "cellstructure";
362 return "gensaddleedges";
364 return "saddleedges";
366 return "genridgeedges";
370 return "genvalleyedges";
372 return "valleyedges";
380 if (fieldnum.
size() < 1)
381 return PARM_UNSUPPORTED;
416 return PARM_UNSUPPORTED;
452 loadData(is, rampdata);
470 int typelen = colon - data.
buffer();
484 {
int64 iv =
v; UTwrite(os, &iv); }
486 { UTwrite<fpreal64>(os, &
v); }
488 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
490 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
491 UTwrite<fpreal64>(os, &v.
z()); }
493 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
494 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
506 if (s) s->save(ostr);
508 saveData(os, result);
515 ostr << s->getDataTypeToken();
520 saveData(os, result);
524 void save(std::ostream &os)
const
528 saveData(os, myGroup);
529 saveData(os, mySrcAttrib);
530 saveData(os, mySrcComp);
531 saveData(os, myCellStructure);
532 saveData(os, myThreshold);
533 saveData(os, myGenMinima);
534 saveData(os, myMinima);
535 saveData(os, myGenMaxima);
536 saveData(os, myMaxima);
537 saveData(os, myGenSaddleEdges);
538 saveData(os, mySaddleEdges);
539 saveData(os, myGenRidgeEdges);
540 saveData(os, myRidgeEdges);
541 saveData(os, myGenValleyEdges);
542 saveData(os, myValleyEdges);
555 loadData(is, myGroup);
556 loadData(is, mySrcAttrib);
557 loadData(is, mySrcComp);
558 loadData(is, myCellStructure);
559 loadData(is, myThreshold);
560 loadData(is, myGenMinima);
561 loadData(is, myMinima);
562 loadData(is, myGenMaxima);
563 loadData(is, myMaxima);
564 loadData(is, myGenSaddleEdges);
565 loadData(is, mySaddleEdges);
566 loadData(is, myGenRidgeEdges);
567 loadData(is, myRidgeEdges);
568 loadData(is, myGenValleyEdges);
569 loadData(is, myValleyEdges);
579 if (!thissop)
return getGroup();
581 OP_Utils::evalOpParm(result, thissop,
"group", cookparms.
getCookTime(), 0);
589 if (!thissop)
return getSrcAttrib();
591 OP_Utils::evalOpParm(result, thissop,
"srcattrib", cookparms.
getCookTime(), 0);
599 if (!thissop)
return getSrcComp();
601 OP_Utils::evalOpParm(result, thissop,
"srccomp", cookparms.
getCookTime(), 0);
609 if (!thissop)
return getCellStructure();
611 OP_Utils::evalOpParm(result, thissop,
"cellstructure", cookparms.
getCookTime(), 0);
619 if (!thissop)
return getThreshold();
621 OP_Utils::evalOpParm(result, thissop,
"threshold", cookparms.
getCookTime(), 0);
629 if (!thissop)
return getGenMinima();
631 OP_Utils::evalOpParm(result, thissop,
"genminima", cookparms.
getCookTime(), 0);
639 if (!thissop)
return getMinima();
641 OP_Utils::evalOpParm(result, thissop,
"minima", cookparms.
getCookTime(), 0);
649 if (!thissop)
return getGenMaxima();
651 OP_Utils::evalOpParm(result, thissop,
"genmaxima", cookparms.
getCookTime(), 0);
659 if (!thissop)
return getMaxima();
661 OP_Utils::evalOpParm(result, thissop,
"maxima", cookparms.
getCookTime(), 0);
669 if (!thissop)
return getGenSaddleEdges();
671 OP_Utils::evalOpParm(result, thissop,
"gensaddleedges", cookparms.
getCookTime(), 0);
679 if (!thissop)
return getSaddleEdges();
681 OP_Utils::evalOpParm(result, thissop,
"saddleedges", cookparms.
getCookTime(), 0);
689 if (!thissop)
return getGenRidgeEdges();
691 OP_Utils::evalOpParm(result, thissop,
"genridgeedges", cookparms.
getCookTime(), 0);
699 if (!thissop)
return getRidgeEdges();
701 OP_Utils::evalOpParm(result, thissop,
"ridgeedges", cookparms.
getCookTime(), 0);
709 if (!thissop)
return getGenValleyEdges();
711 OP_Utils::evalOpParm(result, thissop,
"genvalleyedges", cookparms.
getCookTime(), 0);
719 if (!thissop)
return getValleyEdges();
721 OP_Utils::evalOpParm(result, thissop,
"valleyedges", cookparms.
getCookTime(), 0);
729 int64 myCellStructure;
735 bool myGenSaddleEdges;
737 bool myGenRidgeEdges;
739 bool myGenValleyEdges;
void setMaxima(const UT_StringHolder &val)
UT_StringHolder opRidgeEdges(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Matrix4D v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
SOP_Node * getNode() const
CellStructure opCellStructure(const SOP_NodeVerb::CookParms &cookparms) const
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
bool getGenSaddleEdges() const
static void loadData(UT_IStream &is, int64 &v)
void setMinima(const UT_StringHolder &val)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void save(std::ostream &os) const
bool load(UT_IStream &is)
exint bread(int32 *buffer, exint asize=1)
GT_API const UT_StringHolder time
void setThreshold(fpreal64 val)
GLuint const GLfloat * val
const UT_StringHolder & getSaddleEdges() const
UT_StringHolder opMaxima(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE const char * buffer() const
bool opGenMinima(const SOP_NodeVerb::CookParms &cookparms) const
const SOP_GraphProxy * graph() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
An output stream object that owns its own string buffer storage.
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
static void loadData(UT_IStream &is, bool &v)
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
static void saveData(std::ostream &os, bool v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void saveData(std::ostream &os, UT_Vector4D v)
void setGenSaddleEdges(bool val)
const UT_StringHolder & getSrcAttrib() const
bool getGenMaxima() const
bool getGenValleyEdges() const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
bool operator==(const SOP_WatershedParms &src) const
bool opGenValleyEdges(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Matrix3D v)
void setSrcComp(SrcComp val)
static void loadData(UT_IStream &is, UT_Vector4I &v)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
CellStructure getCellStructure() const
bool operator!=(const SOP_WatershedParms &src) const
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_StringHolder s)
bool getGenMinima() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
const UT_StringHolder & getMinima() const
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
void setGenMinima(bool val)
static void loadData(UT_IStream &is, fpreal64 &v)
UT_StringHolder opSaddleEdges(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
GLint GLenum GLsizei GLint GLsizei const void * data
bool opGenMaxima(const SOP_NodeVerb::CookParms &cookparms) const
SrcComp getSrcComp() const
void setRidgeEdges(const UT_StringHolder &val)
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void loadData(UT_IStream &is, UT_Vector3I &v)
void setGenMaxima(bool val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
void loadFromOpSubclass(const LoadParms &loadparms) override
static void saveData(std::ostream &os, fpreal64 v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
fpreal64 getThreshold() const
void setValleyEdges(const UT_StringHolder &val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
const char * getNestParmName(TempIndex fieldnum) const override
void setCellStructure(CellStructure val)
void saveBinary(std::ostream &os) const
Save string to binary stream.
static void saveData(std::ostream &os, int64 v)
void setSaddleEdges(const UT_StringHolder &val)
void setGenValleyEdges(bool val)
GT_API const UT_StringHolder version
DEP_MicroNode * depnode() const
void setSrcAttrib(const UT_StringHolder &val)
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
static void loadData(UT_IStream &is, UT_Vector2D &v)
const UT_StringHolder & getMaxima() const
Utility class for containing a color ramp.
const UT_StringHolder & getGroup() const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
fpreal64 opThreshold(const SOP_NodeVerb::CookParms &cookparms) const
GLdouble GLdouble GLdouble r
UT_StringHolder opValleyEdges(const SOP_NodeVerb::CookParms &cookparms) const
const UT_StringHolder & getValleyEdges() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
const UT_StringHolder & getRidgeEdges() const
fpreal getCookTime() const
bool opGenSaddleEdges(const SOP_NodeVerb::CookParms &cookparms) const
void copyFrom(const SOP_NodeParms *src) override
SrcComp opSrcComp(const SOP_NodeVerb::CookParms &cookparms) const
const char * findChar(int c) const
static void loadData(UT_IStream &is, UT_Vector4D &v)
bool opGenRidgeEdges(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
bool getGenRidgeEdges() const
static void saveData(std::ostream &os, UT_Vector2D v)
static void saveData(std::ostream &os, UT_Vector3D v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
GLsizei const GLfloat * value
UT_StringHolder opSrcAttrib(const SOP_NodeVerb::CookParms &cookparms) const
void setGenRidgeEdges(bool val)
static void saveData(std::ostream &os, UT_Matrix2D v)
const OP_Context & context() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
void setGroup(const UT_StringHolder &val)
ParmType getNestParmType(TempIndex fieldnum) const override
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
~SOP_WatershedParms() override
SYS_FORCE_INLINE bool isstring() const
static void loadData(UT_IStream &is, UT_Matrix3D &v)
exint getNestNumParms(TempIndex idx) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
UT_StringHolder opMinima(const SOP_NodeVerb::CookParms &cookparms) const