当前位置: 首页>>代码示例>>C++>>正文


C++ ColorMap类代码示例

本文整理汇总了C++中ColorMap的典型用法代码示例。如果您正苦于以下问题:C++ ColorMap类的具体用法?C++ ColorMap怎么用?C++ ColorMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ColorMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setRange

void TransferFunctionEditor::loadState(Value& in)
{
	transferFunction.loadState(in);
	
	setRange(transferFunction.GetMin(), transferFunction.GetMax());

  transferFunctionAlphaScalingSlider.setValue(int(transferFunction.GetScale() * (transferFunctionAlphaScalingSlider.minimum() + transferFunctionAlphaScalingSlider.maximum())));

	QVector<QPointF> points;
	for (int i = 0; i < transferFunction.GetAlphas().size(); i++)
		points.push_back(QPointF(transferFunction.GetAlphas()[i].x, transferFunction.GetAlphas()[i].y));

  transferFunctionAlphaWidget.setPoints(points);

	if (in.HasMember("Colormap"))
	{
		ColorMap cmap;
		cmap.loadState(in["Colormap"]);

		int colorMapIndex;
		for(colorMapIndex = 0; colorMapIndex < colorMaps.size(); colorMapIndex++)
			if (colorMaps[colorMapIndex].getName() == cmap.getName())
				break;

		if (colorMapIndex == colorMaps.size())
			addColorMap(VColorMap(cmap));

		colorMapComboBox.setCurrentIndex(colorMapIndex);
	}

}
开发者ID:TACC,项目名称:VolViewer,代码行数:31,代码来源:TransferFunctionEditor.cpp

示例2: cmap_pylookup

static PyObject *
cmap_pylookup(PyObject *self, PyObject *args)
{
    PyObject *pyobj, *pyret;
    double d;
    rgba_t color;
    ColorMap *cmap;

    if(!PyArg_ParseTuple(args,"Od", &pyobj, &d))
    {
	return NULL;
    }

    cmap = (ColorMap *)PyCObject_AsVoidPtr(pyobj);
    if(!cmap)
    {
	return NULL;
    }

    color = cmap->lookup(d);
    
    pyret = Py_BuildValue("iiii",color.r,color.g,color.b,color.a);

    return pyret;
}
开发者ID:Bookaa,项目名称:gnofract4d.simplify,代码行数:25,代码来源:fract4dmodule_gmp.cpp

示例3: Q_ASSERT

void ConfigurationParser::readMap()
{
    Q_ASSERT(isStartElement()
              && name() == "map");

    while(!atEnd()) {
        readNext();

        if(isEndElement())
            break;

        if(isStartElement()) {
            if(name() == "geometry") {
                readGeometry();
            }
            else if (name() == "layer") {
                DataLayer *layer = readLayer();
                if(layer) {
                    m_layers.insert(layer->name(), layer);
                }
            }
            else if (name() == "colorMap") {
                ColorMap colorMap = ColorMap::readColorMap(this);
                m_colorMaps.insert(colorMap.name(), colorMap);
            }
            else {
                readUnknownElement();
            }
        }
    }
}
开发者ID:bholst,项目名称:OceanVisServer,代码行数:31,代码来源:ConfigurationParser.cpp

示例4: cmap_pylookup_with_flags

static PyObject *
cmap_pylookup_with_flags(PyObject *self, PyObject *args)
{
    PyObject *pyobj, *pyret;
    double d;
    rgba_t color;
    ColorMap *cmap;
    int inside;
    int solid;

    if(!PyArg_ParseTuple(args,"Odii", &pyobj, &d, &solid, &inside))
    {
	return NULL;
    }

    cmap = (ColorMap *)PyCObject_AsVoidPtr(pyobj);
    if(!cmap)
    {
	return NULL;
    }

    color = cmap->lookup_with_transfer(d,solid,inside);
    
    pyret = Py_BuildValue("iiii",color.r,color.g,color.b,color.a);

    return pyret;
}
开发者ID:Bookaa,项目名称:gnofract4d.simplify,代码行数:27,代码来源:fract4dmodule_gmp.cpp

示例5: addXmlColors

void addXmlColors(
	TiXmlElement *rootElement,
	const ColorMap &colors,
	bool /*old*/)
{
	TiXmlElement *colorsElement = new TiXmlElement("Colors");

	for (ColorMap::const_iterator it = colors.begin(); it != colors.end(); it++)
	{
		unsigned int ldrawNum = it->first;
		const Color &color = it->second;
		TiXmlElement *colorElement = new TiXmlElement("Color");
		char numberBuf[128];

		sprintf(numberBuf, "%d", ldrawNum);
		addElement(colorElement, "LDrawNumber", numberBuf);
		addElement(colorElement, "POVName", color.lgeoName);
		//if (old)
		//{
		//	addElement(colorElement, "POVVersion", "3.0");
		//}
		addElement(colorElement, "Dependency", "LGColors");
		if (color.transparent)
		{
			addElement(colorElement, "IoR", "lg_ior");
		}
		colorsElement->LinkEndChild(colorElement);
	}
	rootElement->LinkEndChild(colorsElement);
}
开发者ID:HazenBabcock,项目名称:LDView,代码行数:30,代码来源:LGEOTables.cpp

示例6: toLowerI

 static const Color *create_named_color(std::string str){
   toLowerI(str);
   static ColorMap cm;
   ColorMap::iterator it = cm.find(str);
   if(it != cm.end()) return  &it->second;
   else return 0;
 }
开发者ID:ethz-asl,项目名称:iclcv,代码行数:7,代码来源:Color.cpp

示例7: Color

int Color(ColorVector& colors) {
  int maxColorUsed = 0;

  //Reset all the colors
  for(ColorVertex* cVertex:  adjacencyList) {
    cVertex->setColor(-1);
  }

  for(ColorVertex* cVertex:  adjacencyList) {
    ColorMap cmap;
    for(Edge* edge: cVertex->edges) {
      cmap[((ColorVertex *)(edge->getVertex()))->getColor()] = true;
    }
    for(color_t color: colors) {
      if(cmap.find(color) == cmap.end()) {
        cout << color << endl;
        cVertex->setColor(color);
        if(color > maxColorUsed) {
          maxColorUsed = color;
        }
        break;
      }
    }
  }
  return maxColorUsed;
}
开发者ID:vigneshere,项目名称:algo-datastructure,代码行数:26,代码来源:graphcolor.cpp

示例8: init

ColorMap::ColorMap(const ColorMap &o)
{
    init(o.getCols(),o.getRows());

    for(int row=0; row<rows; row++)
        for(int col=0; col<cols; col++)
            c[row][col] = o.get(row,col);
}
开发者ID:rumkex,项目名称:GPSTk,代码行数:8,代码来源:ColorMap.cpp

示例9: createSequential

ColorMap ColorMap::createSequential(const tgt::Color& base) {
    ColorMap cm;
    cm.colors_.clear();
    cm.addColorLast(tgt::Color(1.f, 1.f, 1.f, 1.f));
    cm.addColorLast(base);
    cm.setName("Sequential");
    return cm;
}
开发者ID:molsimmsu,项目名称:3mview,代码行数:8,代码来源:colormap.cpp

示例10: getColorByName

// ----------------------------------------------------------------------------
//
bool RGBWA::getColorByName( LPCSTR color_name, RGBWA& rgb ) {
    ColorMap::iterator it = predefinedColors.find( color_name );
    if ( it == predefinedColors.end() )
        return false;

    rgb = (*it).second;
    return true;
}
开发者ID:glocklueng,项目名称:DMXStudio,代码行数:10,代码来源:RGBWA.cpp

示例11: createGermany

ColorMap ColorMap::createGermany() {
    ColorMap cm;
    cm.colors_.clear();
    cm.addColorLast(tgt::Color(0.f, 0.f, 0.f, 1.f));
    cm.addColorLast(tgt::Color(1.f, 0.f, 0.f, 1.f));
    cm.addColorLast(tgt::Color(1.f, 0.8f, 0.f, 1.f));
    cm.setName("Germany");
    return cm;
}
开发者ID:molsimmsu,项目名称:3mview,代码行数:9,代码来源:colormap.cpp

示例12: createColdHot

ColorMap ColorMap::createColdHot() {
    ColorMap cm;
    cm.colors_.clear();
    cm.addColorLast(tgt::Color(0.f, 0.f, 1.f, 1.f));
    cm.addColorLast(tgt::Color(1.f, 1.f, 1.f, 1.f));
    cm.addColorLast(tgt::Color(1.f, 0.f, 0.f, 1.f));
    cm.setName("Cold Hot");
    return cm;
}
开发者ID:molsimmsu,项目名称:3mview,代码行数:9,代码来源:colormap.cpp

示例13: MakeColorMap

static void MakeColorMap (ColorMap& cmap)
{
  cmap.Load("copper-256"); 			       // load a default colormap
  if (! cmap) Matpack.Error("Can't load colormap");
  cmap.Reverse();					      // reverse ordering
  int i, n = cmap.Size();				   // change colormap now
  for (i = 0;  i < 20; i++) cmap[i] = ColorB(0,100+2*i,160+2*i);         // water
  for (i = 20; i < 80; i++) cmap[i] = ColorB(2*i+20,2*i+20,i/2+10);   // mangrove
  for (i = 1;  i < 60; i++) cmap[n-i] = ColorB(255-i,250-i,250-2*i);      // snow
}
开发者ID:lucafuji,项目名称:Gene-Correlation,代码行数:10,代码来源:fractal-surface.cpp

示例14: createSpectral

ColorMap ColorMap::createSpectral() {
    ColorMap cm;
    cm.colors_.clear();
    cm.addColorLast(tgt::Color(1.f, 0.f, 0.f, 1.f));
    cm.addColorLast(tgt::Color(1.f, 1.f, 0.f, 1.f));
    cm.addColorLast(tgt::Color(0.f, 1.f, 0.f, 1.f));
    cm.addColorLast(tgt::Color(0.f, 0.f, 1.f, 1.f));
    cm.setName("Spectral");
    return cm;
}
开发者ID:molsimmsu,项目名称:3mview,代码行数:10,代码来源:colormap.cpp

示例15: LOCALARRAY

bool EdgeColoringTest<DefaultStructs>::test(const Graph &graph, const ColorMap &colors)
{
	typedef typename Graph::PVertex Vert;
	typedef typename Graph::PEdge Edge;
	const EdgeDirection Mask = EdDirIn|EdDirOut|EdUndir;
	int degree = graph.Delta(Mask);
	int LOCALARRAY(kolory, degree+1);
	int lenKolory = 0;
	for(Vert vv = graph.getVert(); vv; vv = graph.getVertNext(vv)) {
		lenKolory = 0;
		for(Edge ee = graph.getEdge(vv, Mask); ee;
			ee = graph.getEdgeNext(vv, ee, Mask))
		{
			if(!colors.hasKey(ee)) return false;
			int col = colors[ee];
			if(col<0) return false;
			kolory[lenKolory++] = col;
		}
		DefaultStructs::sort(kolory, kolory+lenKolory);
		int tmpLen = std::unique(kolory, kolory+lenKolory)-kolory;
		if(tmpLen!=lenKolory)
			return false;
	}
	return true;
}
开发者ID:goluch,项目名称:koala_unittest,代码行数:25,代码来源:edge.hpp


注:本文中的ColorMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。