void PDF3DFigurePage_LoadPointLineGeometry::_addToLineCache()
{
  // Get highest type ID from positions and connections
  int highestTypeID = 0;
  std::map<int, int> typeIDMap;

  // Scan all positions and get all type ID from them
  for (XMarkerList::const_iterator it = _outCachedLinePositionsList.cbegin(); it != _outCachedLinePositionsList.cend(); ++it)
  {
    XMarker thisMarker = *it;

    if (thisMarker.type > highestTypeID)
    {
      highestTypeID = thisMarker.type;
    }
  }

  // Scan all connections and get all type ID from them
  for (IndexPairList::const_iterator it = _outCachedLineConnectionsList.cbegin(); it != _outCachedLineConnectionsList.cend(); ++it)
  {
    IndexPair thisPair = *it;

    if (thisPair.type > highestTypeID)
    {
      highestTypeID = thisPair.type;
    }
  }

  // Add positions 
  for (XMarkerList::const_iterator it = _outPositionsList.cbegin(); it != _outPositionsList.cend(); ++it)
  {
    XMarker inMarker  = *it;
    int inMarkerType  = inMarker.type;
    int newMarkerType = inMarker.type;

    // Check if type ID must be modified
    if (inMarkerType <= highestTypeID)
    {
      std::map<int, int>::iterator findIt = typeIDMap.find(inMarkerType);

      if (findIt == typeIDMap.end())
      {
        // inMarkerType has not yet been added to map, so add it now
        newMarkerType = highestTypeID + 1;
        typeIDMap[inMarkerType] = newMarkerType;
        highestTypeID++;
      }
      else
      {
        newMarkerType = typeIDMap[inMarkerType];
      }
    }
    
    XMarker newCachedMarker(Vector6(inMarker.x(), inMarker.y(), inMarker.z(), inMarker.c(), inMarker.t(), inMarker.u()), newMarkerType, inMarker.name());

    _outCachedLinePositionsList.appendItem(newCachedMarker);
  }

  // Add connections
  for (IndexPairList::const_iterator it = _outConnectionsList.cbegin(); it != _outConnectionsList.cend(); ++it)
  {
    IndexPair inPair = *it;
    int inPairType = inPair.type;
    int newPairType = inPair.type;

    // Check if type ID must be modified
    if (inPairType <= highestTypeID)
    {
      std::map<int, int>::iterator findIt = typeIDMap.find(inPairType);

      if (findIt == typeIDMap.end())
      {
        // newPairType has not yet been added to map -> skip this connection!
        inPairType = ML_INT16_MIN;
      }
      else
      {
        newPairType = typeIDMap[inPairType];
      }
    }

    if (inPairType > ML_INT16_MIN)
    {
      IndexPair newCachedPair(inPair.index1, inPair.index2, newPairType, inPair.name());

      _outCachedLineConnectionsList.appendItem(newCachedPair);
    }
  }

  // Deselect items
  _outCachedLinePositionsList.selectItemAt(-1);
  _outCachedLineConnectionsList.selectItemAt(-1);

  // Notify observers
  _outCachedLinePositionsListFld->touch();
  _outCachedLineConnectionsListFld->touch();
}