本文整理汇总了C++中RenderObject::getNumElements方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderObject::getNumElements方法的具体用法?C++ RenderObject::getNumElements怎么用?C++ RenderObject::getNumElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderObject
的用法示例。
在下文中一共展示了RenderObject::getNumElements方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModuleName
void
ModuleFeedbackManager::updateColorBar(RenderObject *containerObject)
{
RenderObject *colorObj = NULL;
const char *colormapString = NULL;
if (containerObject)
{
colorObj = containerObject->getColors();
if (!colorObj)
colorObj = containerObject->getTexture();
if (colorObj)
{
colormapString = colorObj->getAttribute("COLORMAP");
if (colormapString == NULL && colorObj->isSet())
{
size_t noElems = colorObj->getNumElements();
for (size_t elem = 0; elem < noElems; ++elem)
{
colormapString = colorObj->getElement(elem)->getAttribute("COLORMAP");
if (colormapString)
break;
}
}
// compute colorbar
std::string tmpStr = ModuleName(geomObjectName_.c_str());
const char *modname = tmpStr.c_str();
float min = 0.0;
float max = 1.0;
int numColors;
float *r = NULL;
float *g = NULL;
float *b = NULL;
float *a = NULL;
char *species = NULL;
if (colormapString)
{
//cerr << "ModuleFeedbackManager::updateColorBar(..) COLORMAPSTRING " << colormapString << endl;
ColorBar::parseAttrib(colormapString, species, min, max, numColors, r, g, b, a);
}
else
{
species = new char[16];
strcpy(species, "NoColors");
numColors = 2;
min = 0.0;
min = 1.0;
r = new float[2];
g = new float[2];
b = new float[2];
a = new float[2];
r[0] = 0.0;
g[0] = 0.0;
b[0] = 0.0;
a[0] = 1.0;
r[1] = 1.0;
g[1] = 1.0;
b[1] = 1.0;
a[1] = 1.0;
}
// color bar
if (colorBar_)
{
colorBar_->update(species, min, max, numColors, r, g, b, a);
}
else
{
//cerr << "ModuleFeedbackManager::updateColorBar(..) MODNAME <" << modname << ">" << endl;
colorBar_ = new ColorBar(colorsButton_, menu_,
modname, species, min, max, numColors, r, g, b, a);
}
delete[] species;
delete[] r;
delete[] g;
delete[] b;
delete[] a;
}
else // container without colors
{
if (colorBar_) // the previous object had colors
delete colorBar_;
colorBar_ = NULL;
}
}
else // no container
{
if (colorBar_) //the previous object had colors
delete colorBar_;
colorBar_ = NULL;
}
}