Exemplo n.º 1
0
ShadedSurfaceLayer::ShadedSurfaceLayer(DataGrid* grid)
: Layer(),
  _DataGrid(grid),
  _Ramp(DefaultColorRamp),
  _TexBitmap(0),
  _TexWidth(0),
  _TexHeight(0),
  _TextureID(-1),
  _DisplayList(0),
  _Compiled(false)
{
  if(_DataGrid)
  {
    Variant value;
    MPI_Offset pos[MAX_DIMS];
    _MinVal = MaxVariant(MPITypeToVariantType(_DataGrid->GetType()));
    _MaxVal = MinVariant(MPITypeToVariantType(_DataGrid->GetType()));
    for(pos[XDIM] = 0; pos[XDIM] < _DataGrid->GetDimLen(XDIM); pos[XDIM]++)
    {
      for(pos[YDIM] = 0; pos[YDIM] < _DataGrid->GetDimLen(YDIM); pos[YDIM]++)
      {
        if(_DataGrid->HasData(pos))
        {
          _DataGrid->GetElemAsVariant(pos, &value);
          if(0 > VariantCompare(value, _MinVal)) _MinVal = value;
          if(0 < VariantCompare(value, _MaxVal)) _MaxVal = value;
        }
      }
    }

    printf("min=%f, max=%f\n", 
           VariantValueAsDouble(_MinVal), VariantValueAsDouble(_MaxVal));
  }
}
Exemplo n.º 2
0
int CALLBACK CShellBrowser::SortByItemDetails(const BasicItemInfo_t &itemInfo1, const BasicItemInfo_t &itemInfo2, const SHCOLUMNID *pscid) const
{
	VARIANT vt1;
	HRESULT hr1 = GetItemDetailsRawData(itemInfo1, pscid, &vt1);

	VARIANT vt2;
	HRESULT hr2 = GetItemDetailsRawData(itemInfo2, pscid, &vt2);

	int ret = 0;

	if (SUCCEEDED(hr1) && SUCCEEDED(hr2) && vt1.vt == vt2.vt)
	{
		ret = VariantCompare(vt1, vt2);
	}

	if (SUCCEEDED(hr1))
	{
		VariantClear(&vt1);
	}

	if (SUCCEEDED(hr2))
	{
		VariantClear(&vt2);
	}

	return ret;
}