VectorLocalization2D::VectorLocalization2D(const char* _mapsFolder)
{
  mapsFolder = string(_mapsFolder);
  loadAtlas();
  numParticles = 0;
  particles.clear();
}
Picture PictureBank::Impl::tryLoadPicture(const std::string& name)
{
  vfs::Path realPath( name );  

  bool fileExist = false;
  if( realPath.extension().empty() )
  {
    for( auto& ext : picExentions )
    {
      realPath = name + ext;

      if( realPath.exist() )
      {
        fileExist = true;
        break;
      }
    }
  }

  if( fileExist )
  {    
    vfs::NFile file = vfs::NFile::open( realPath );
    if( file.isOpen() )
    {
      Picture ret = PictureLoader::instance().load( file );
      return ret;
    }
  }

  unsigned int hash = Hash( name );
  for( auto& curAtlass : atlases )
  {
    bool found = curAtlass.find( hash );
    if( found )
    {
      loadAtlas( curAtlass.filename );
      //unloadAtlas.erase( i );
      break;
    }
  }

  CachedPictures::iterator it = resources.find( hash );
  if( it != resources.end() )
  {
    return it->second;
  }

  Logger::warning( "PictureBank: Unknown resource %s", name.c_str() );
  return Picture::getInvalid();
}
// display OpenGL graphics
void CompartmentMapWidget::initializeGL()
{
    qDebug()<<"CompartmentMapWidget initializeGL ... ...";

    _isSoftwareGL = false;
    GLeeInit();

    renderer = new Renderer_gl1(this);

    // settings
    renderer->bShowBoundingBox = false; //
    renderer->bShowAxes        = false;

    renderer->tryTexCompress = false; // texture
    renderer->tryTex3D       = false;
    renderer->tryTexNPT      = false;
    renderer->tryTexStream   = true;

    renderer->lineType   = false; // swc

    // prepare
    if (renderer)
    {
        loadAtlas();
        if(renderer->hasError())	POST_CLOSE(this);

        //qDebug()<<"label surf ..."<<((Renderer_gl1 *)renderer)->listLabelSurf.size();
        //qDebug()<<"triangle ..."<<((Renderer_gl1 *)renderer)->list_listTriangle.size();
        //qDebug()<<"glist label ..."<<((Renderer_gl1 *)renderer)->list_glistLabel.size();

        listLabelSurf = ((Renderer_gl1 *)renderer)->getListLabelSurf();

        pCompartmentComboBox->addItem("All On", true);
        pCompartmentComboBox->addItem("All Off", false);
        for(int i=0; i<listLabelSurf.size(); i++)
        {
            pCompartmentComboBox->addItem(listLabelSurf[i].name, true);
        }

        update();
    }

}
VectorLocalization2D::VectorLocalization2D(int _numParticles)
{
  loadAtlas();
  numParticles = _numParticles;
  particles.resize(_numParticles);
}