Example #1
0
const std::vector<std::string> & CDataArray::getAnnotationsString(size_t d, bool display) const
{
  assert(d < mModes.size());

  std::vector< std::string >::iterator itName = mAnnotationsString[d].begin();
  std::vector< std::string >::iterator endName = mAnnotationsString[d].end();

  if (mModes[d] == Mode::Numbers)
    {
      size_t Index = 1;

      for (; itName != endName; ++Index, ++itName)
        {
          *itName = StringPrint("%d", Index);
        }
    }
  else
    {
      std::vector<CRegisteredCommonName>::const_iterator itCN = mAnnotationsCN[d].begin();

      for (; itName != endName; ++itCN, ++itName)
        {
          *itName = createDisplayName(*itCN);
        }
    }

  return mAnnotationsString[d];
}
Example #2
0
void Area::loadARE(const Aurora::GFF3Struct &are) {
	// Tag

	_tag = are.getString("Tag");

	// Name

	_name = are.getString("Name");
	if (!_name.empty() && (*--_name.end() == '\n'))
		_name.erase(--_name.end());

	_displayName = createDisplayName(_name);

	// Tiles

	_width  = are.getUint("Width");
	_height = are.getUint("Height");

	_tilesetName = are.getString("Tileset");

	_tiles.resize(_width * _height);

	loadTiles(are.getList("Tile_List"));

	// Scripts
	readScripts(are);
}
Example #3
0
void CArrayAnnotation::setAnnotationCN(size_t d, size_t i, const std::string cn)
{
  assert(d < dimensionality());

  resizeOneDimension(d);
  assert(i < mAnnotationsCN[d].size());

  mAnnotationsCN[d][i] = cn;
  mAnnotationsString[d][i] = createDisplayName(cn);
}
Example #4
0
CDataArray::name_index_type CDataArray::displayNamesToCN(const std::vector< std::string > & DisplayNames) const
{
  assert(DisplayNames.size() == dimensionality()
         || dimensionality() == 0);

  name_index_type CNIndex(dimensionality());
  name_index_type::iterator to = CNIndex.begin();
  std::vector< std::string >::const_iterator it = DisplayNames.begin();
  std::vector< std::string >::const_iterator end = DisplayNames.end();
  std::vector< std::vector<CRegisteredCommonName> >::const_iterator itCNs = mAnnotationsCN.begin();
  size_t dimension = 0;

  for (; it != end && dimension < dimensionality(); ++it, ++itCNs, ++dimension, ++to)
    {
      std::vector<CRegisteredCommonName>::const_iterator itCN = itCNs->begin();
      std::vector<CRegisteredCommonName>::const_iterator endCN = itCNs->end();

      for (; itCN != endCN; ++itCN)
        {
          if (CCommonName::unescape(*it) == createDisplayName(*itCN))
            {
              *to = *itCN;
              break;
            }
        }

      if (itCN == endCN)
        {
          size_t index = C_INVALID_INDEX;
          bool ValidIndex = strToIndex(*it, index);

          if (ValidIndex)
            {
              if (itCNs->empty())
                {
                  *to = *it;
                }
              else
                {
                  *to = itCNs->operator [](index);
                }
            }
          else
            {
              *to = std::string("not found");
            }
        }
    }

  return CNIndex;
}
Example #5
0
void CArrayAnnotation::autoAnnotation(const size_t & d)
{
  resizeOneDimension(d);

  size_t i;

  for (i = 0; i < mAnnotationsCN[d].size(); ++i)
    {
      std::stringstream I;
      I << i;

      mAnnotationsCN[d][i] = CCopasiObjectName("String=" + I.str());
      mAnnotationsString[d][i] = createDisplayName(mAnnotationsCN[d][i]);
    }
}
Example #6
0
const std::vector<std::string> & CArrayAnnotation::getAnnotationsString(size_t d, bool display) const
{
  assert(d < mModes.size());

  std::vector<CRegisteredObjectName>::const_iterator itCN = mAnnotationsCN[d].begin();
  std::vector<CRegisteredObjectName>::const_iterator endCN = mAnnotationsCN[d].end();
  std::vector< std::string >::iterator itName = mAnnotationsString[d].begin();

  for (; itCN != endCN; ++itCN, ++itName)
    {
      *itName = createDisplayName(*itCN);
    }

  return mAnnotationsString[d];
}
Example #7
0
void CArrayAnnotation::updateDisplayNames() const
{
  std::vector< std::vector<CRegisteredObjectName> >::const_iterator itCNs = mAnnotationsCN.begin();
  std::vector< std::vector<CRegisteredObjectName> >::const_iterator endCNs = mAnnotationsCN.end();
  std::vector< std::vector< std::string > >::iterator itNames = mAnnotationsString.begin();

  for (; itCNs != endCNs; ++itCNs, ++itNames)
    {
      std::vector<CRegisteredObjectName>::const_iterator itCN = itCNs->begin();
      std::vector<CRegisteredObjectName>::const_iterator endCN = itCNs->end();
      std::vector< std::string >::iterator itName = itNames->begin();

      for (; itCN != endCN; ++itCN, ++itName)
        {
          *itName = createDisplayName(*itCN);
        }
    }
}