Exemplo n.º 1
0
void LDOMObjInStream::readChildData(LVariant &value)
{
  //LDomNode *pNode = m_data.current()->getCurChild();
  m_data.traverse();

  for (;;) {

    LDomNode *pNode = m_data.current();

    if (pNode->children.size()==0) {
      value.setStringValue(pNode->value);
      break;
    }

    //
    // Case: structured value
    //

    if (!value.isObject()) {
      // data inconsistency !!
      reportError();
      break;
    }
      
    LScriptable *pObjOrig = value.getObjectPtr();
    if (pObjOrig!=NULL) {
      // TO DO!!
      // Check compatibility between "value" and LDOM data
      LString clsnm = LDOMObjOutStream::getTypeName(pObjOrig);
      LString domname = m_data.current()->type_name;
      if (clsnm.equals(domname)) {
        // compatible object --> don't create new one
        pObjOrig->readFrom(*this);
        break;
      }
    }
      
    // incompatible obj --> create new obj based on the LDOM typename
    LSerializable *ptmp = readObjImpl();
    LScriptable *pObj = dynamic_cast<LScriptable *>(ptmp);
    if (pObj==NULL) {
      LOG_DPRINTLN("ERROR!!");
      reportError();
      delete ptmp;
      break;
    }
    else {
      // variant "value" own the created object "pObj"
      //LScrSp<LScriptable> *pSpObj = new LScrSp<LScriptable>(pObj);
      //value.setObjectPtr(pSpObj);
      value.setObjectPtr(pObj);
    }

    break;
  }
  m_data.popNode();
}
Exemplo n.º 2
0
RendererPtr Object::getRendererByType(const LString &type_name)
{
  rendtab_t::const_iterator i = m_rendtab.begin();
  rendtab_t::const_iterator e = m_rendtab.end();
  for (; i!=e; ++i) {
    if ( type_name.equals(i->second->getTypeName()) )
      return i->second;
  }

  return RendererPtr();
}
Exemplo n.º 3
0
bool Selection::equals(Selection *pSel) const
{
  LString tmp = toString();

  if (pSel==NULL) {
    if (tmp.isEmpty())
      return true;
    else
      return false;
  }

  return (tmp.equals(pSel->toString()));
}
Exemplo n.º 4
0
// write PDB file to stream
bool PDBFileWriter::write(qlib::OutStream &outs)
{
  m_pMol = getTarget<MolCoord>();

  if (m_pMol==NULL) {
    LOG_DPRINTLN("PDBWriter> MolCoord is not attached !!");
    return false;
  }

  // check extension record handlers
  PDBFileReader::HndlrTab &htab = PDBFileReader::m_htab;
  bool bUseHndlr = htab.size()>0;

  MolCoord *pMol = m_pMol;
  qlib::PrintStream prs(outs);

  //
  //  write header
  //
  //LString sbuf = pqsys->getVersion();
  //prs.formatln("REMARK   PDB File Generated by CueMol (ver %s)", sbuf.c_str());
  prs.formatln("REMARK   PDB File Generated by CueMol2");

  //
  //  write SSBOND record
  //
  writeSSBonds(prs);

  //
  //  write LINK record
  //
  writeLinks(prs);

  writeSecstr(prs);

  //
  //  write extension records (CRYST1)
  //
  if (bUseHndlr) {
    LString sbuf;
    PDBFileReader::HndlrTab::const_iterator iter = htab.begin();
    for (; iter!=htab.end(); ++iter) {
      PDBFileReader::RecordHandler *ph = iter->second;
      if (ph!=NULL && ph->write(sbuf, pMol)) {
        prs.println(sbuf);
      }
    }
  }
  
  //
  //  write body (ATOM/ANISOU records)
  //

  int nserial = 1;

  // Sort chain names by ASCII order
  // take care of '_' (empty) chain
  std::list<LString> chnames;
  {
    MolCoord::ChainIter iter = pMol->begin();
    bool bHasEmptyChain = false;
    for (; iter!=pMol->end(); ++iter) {
      MolChainPtr pChn = iter->second;
      LString chnam = (pChn->getName().c_str()); 
      if (chnam.equals("_")) {
        bHasEmptyChain = true;
        continue;
      }
      chnames.push_back(chnam);
    }
    chnames.sort();
    if (bHasEmptyChain)
      chnames.push_back("_");
  }
  
  std::list<LString>::const_iterator cniter = chnames.begin();
  for (; cniter!=chnames.end(); ++cniter) {
    LString chnam = *cniter;
    MolChainPtr pChn = pMol->getChain(chnam);

    // format chain name
    char cch = convChainName(chnam);

    LString resnam;
    MolChain::ResidCursor2 riter = pChn->begin2();
    // int nlastres = 0;
    for (; riter!=pChn->end2(); ++riter) {
      //MolResiduePtr pRes = *riter;
      MolResiduePtr pRes = riter->second;
      if (pRes.isnull()) continue;
      ResidIndex rindex = pRes->getIndex();
      resnam = pRes->getName();
      
      // format residue name
      // resnam = resnam.toUpperCase();
      resnam = resnam.substr(0,3);

      // sort atom by AID
      std::list<int> atmlist;
      {
        MolResidue::AtomCursor aiter = pRes->atomBegin();
        for (; aiter!=pRes->atomEnd(); ++aiter) {
          atmlist.push_back(aiter->second);
        }
        atmlist.sort();
      }

      std::list<int>::const_iterator iter = atmlist.begin();
      for (; iter!=atmlist.end(); ++iter) {
        int aid = *iter;
        MolAtomPtr pAtm = pMol->getAtom(aid);
        if (pAtm.isnull())
          continue;

        if (!m_pSel.isnull()) {
          if (!m_pSel->isSelected(pAtm))
            continue; // skip nonselected atom
        }

        writeAtomLine(nserial, rindex, resnam,
                      cch, pAtm, prs);
        nserial++;
      }
      // nlastres = rindex.first;
    }

    // print TER record
    /*prs.formatln("TER   "
                 "%5d"
                 "      "
                 "%3s "
                 "%1s"
                 "%4d"
                 "                                                      ",
                 nserial, resnam.c_str(), chnam.c_str(), nlastres);*/
    prs.println("TER");
    nserial ++;
  }  

  //prs.println("END                                                                             ");
  prs.println("END");
  return true;
}
Exemplo n.º 5
0
void PDBFileWriter::writeSecstr(qlib::PrintStream &prs)
{
  MolResiduePtr pRes1;

  int nhx = 1;
  MolCoordPtr pMol(m_pMol);
  ResidIterator riter(pMol); //(MolCoordPtr(m_pMol));

  // Write HELIX records
  for (riter.first(); riter.hasMore(); riter.next()) {
    LString sec;
    LString pfx;
    MolResiduePtr pRes = riter.get();
    pRes->getPropStr("secondary2", sec);

    // MB_DPRINTLN("%s%d => %s", pRes->getChainName().c_str(), pRes->getIndex().first, sec.c_str());

    if (sec.length()>=2)
      pfx= sec.substr(1,1);
    
    if (!(sec.startsWith("H")||sec.startsWith("G")||sec.startsWith("I")))
      continue;

    if (pfx.equals("s"))
      pRes1 = pRes;
    else if (pfx.equals("e")) {
      LString resn1 = pRes1->getName().substr(0,3);
      LString chn1 = pRes1->getChainName().substr(0,1);
      ResidIndex resix1 = pRes1->getIndex();
      char ins1 = resix1.second;
        if (ins1=='\0') ins1 = ' ';
      
      LString resn2 = pRes->getName().substr(0,3);
      LString chn2 = pRes->getChainName().substr(0,1);
      ResidIndex resix2 = pRes->getIndex();
      char ins2 = resix2.second;
      if (ins2=='\0') ins2 = ' ';
      
      prs.print("HELIX ");
      // helix seqno
      prs.format(" %3d", nhx);
        // helix ID
      prs.format(" %3d", nhx);
      
      // start resname
      prs.format(" %3s", resn1.c_str());
      prs.format(" %1s", chn1.c_str());
      prs.format(" %4d", resix1.first);
      prs.format("%c", ins1);
      
      // end resname
      prs.format(" %3s", resn2.c_str());
      prs.format(" %1s", chn2.c_str());
      prs.format(" %4d", resix2.first);
      prs.format("%c", ins2);
      
      // typeof helix
      int ntype = 1;
      if (sec.startsWith("G"))
        ntype = 5;
      else if (sec.startsWith("I"))
        ntype = 3;
      prs.format("%2d", ntype);
      
      prs.println("");
      ++nhx;
    }
  }

  // Write SHEET records
  int nsh = 1;
  for (riter.first(); riter.hasMore(); riter.next()) {
    LString sec;
    LString pfx;
    MolResiduePtr pRes = riter.get();
    pRes->getPropStr("secondary2", sec);

    // MB_DPRINTLN("%s%d => %s", pRes->getChainName().c_str(), pRes->getIndex().first, sec.c_str());

    if (sec.length()>=2)
      pfx= sec.substr(1,1);
    
    if (!(sec.startsWith("E")))
      continue;

    if (pfx.equals("s"))
      pRes1 = pRes;
    else if (pfx.equals("e")) {
      
      LString resn1 = pRes1->getName().substr(0,3);
      LString chn1 = pRes1->getChainName().substr(0,1);
      ResidIndex resix1 = pRes1->getIndex();
      char ins1 = resix1.second;
      if (ins1=='\0') ins1 = ' ';
      
      LString resn2 = pRes->getName().substr(0,3);
      LString chn2 = pRes->getChainName().substr(0,1);
      ResidIndex resix2 = pRes->getIndex();
      char ins2 = resix2.second;
      if (ins2=='\0') ins2 = ' ';
      
      prs.print("SHEET ");
      // helix seqno
      prs.format(" %3d", nsh);
      // helix ID
      prs.format(" %3d", nsh);
      // num of strands
      prs.print(" 1");

      // start resname
      prs.format(" %3s", resn1.c_str());
      prs.format(" %1s", chn1.c_str());
      prs.format("%4d", resix1.first);
      prs.format("%c", ins1);
      
      // end resname
      prs.format(" %3s", resn2.c_str());
      prs.format(" %1s", chn2.c_str());
      prs.format("%4d", resix2.first);
      prs.format("%c", ins2);
      
      // direction
      prs.print(" 0");

      prs.println("");
      ++nsh;
    }
  } // for

}
Exemplo n.º 6
0
bool PDBFileWriter::writeAtomLine(int nserial, const ResidIndex &rindex,
                                  const char *resnam, char chainch,
                                  MolAtomPtr pa, qlib::PrintStream &prs)
{
  int resind = rindex.first;
  char inscode = rindex.second;
  LString atomnam = pa->getName().c_str();
  // atomnam = atomnam.toUpperCase();

  // conv ILE's CD name
  // (CD is converted to CD1 in PDBFileReader, so this should not occur)
  if (LChar::equals(resnam, "ILE") && atomnam.equals("CD"))
    atomnam = "CD1";

#ifdef QTL_CONV
  // conv nucl's prime to aster
  atomnam.replace('\'', '*');

  // convert THY's C5A to C5M
  if (LChar::equals(resnam, "THY") &&
      atomnam.equals("C5A")) {
    atomnam = "C5M";
  }

  // conv nucl name
  if (LChar::equals(resnam, "ADE")) {
    resnam = "  A";
  }
  else if (LChar::equals(resnam, "THY")) {
    resnam = "  T";
  }
  else if (LChar::equals(resnam, "GUA")) {
    resnam = "  G";
  }
  else if (LChar::equals(resnam, "CYT")) {
    resnam = "  C";
  }
  else if (LChar::equals(resnam, "URI")) {
    resnam = "  U";
  }
#endif

  LString shead;

  shead = LString::format("%5d ", nserial);

  // format atom name
  shead += formatAtomName(pa);

  shead += LString::format("%3s "
                           "%c"
                           "%4d"
                           "%c",
                           resnam,
                           chainch,
                           resind,
                           (inscode=='\0') ? ' ' : inscode);
                           
  //////////
  // output to the stream

  prs.print("ATOM  ");
  prs.print(shead);

  // Get atom position before applying xformMat, if xformMat is set
  Vector4D pos = pa->getRawPos();

  prs.formatln("   "
               "%8.3f"
               "%8.3f"
               "%8.3f"
               "%6.2f"
               "%6.2f"
               "          "
               "    ",
               pos.x(),
               pos.y(),
               pos.z(),
               pa->getOcc(),
               pa->getBfac());

  if (pa->hasAnIsoU()) {
    prs.print("ANISOU");
    prs.print(shead);

    int u11 = int(pa->getU(0,0) * 1.0e4);
    int u22 = int(pa->getU(1,1) * 1.0e4);
    int u33 = int(pa->getU(2,2) * 1.0e4);
    int u12 = int(pa->getU(0,1) * 1.0e4);
    int u13 = int(pa->getU(0,2) * 1.0e4);
    int u23 = int(pa->getU(1,2) * 1.0e4);

    prs.formatln(" "
                 " %6d"
                 " %6d"
                 " %6d"
                 " %6d"
                 " %6d"
                 " %6d"
                 "          ",
                 u11, u22, u33, u12, u13, u23);
  }

  return true;
}
Exemplo n.º 7
0
/// read one MOL entry from stream
bool MOL2MolReader::readMol(qlib::LineStream &lin, bool bskip)
{
  LString sline;
  std::vector<LString> slist;
  
  for (;;) {
    sline = lin.readLine().chomp();
    if (sline.isEmpty() && !lin.ready())
      return false; // EOF
  
    if (sline.equals("@<TRIPOS>MOLECULE")) {
      break;
    }
  }

  // mol_name
  LString cmpd_name = lin.readLine().trim(" \t\r\n");
  if (cmpd_name.isEmpty())
    cmpd_name = "_"; // XXX

  // molecule info
  sline = lin.readLine().chomp();
  split(sline, ' ', std::back_inserter(slist));
  if (slist.size()<1) {
    MB_THROW(MOL2FormatException, "Invalid atom info record");
  }
  int natoms;
  if (!slist[0].toInt(&natoms)) {
    MB_THROW(MOL2FormatException, "Invalid atom info record");
  }
  int nbonds=0;
  if (slist.size()>1) {
    if (!slist[1].toInt(&nbonds)) {
      MB_THROW(MOL2FormatException, "Invalid atom info record");
    }
  }

  // mol_type
  LString mol_type = lin.readLine().chomp();
  bool bApplyTopo = false;
  if (mol_type.equals("PROTEIN") ||
      mol_type.equals("NUCLEIC_ACID"))
    bApplyTopo = true;    

  // Ignore charge_type
  // Ignore mol_comment

  // Search ATOM record
  for (;;) {
    sline = lin.readLine().chomp();
    if (sline.isEmpty() && !lin.ready())
      return false; // EOF
  
    if (sline.equals("@<TRIPOS>ATOM")) {
      break;
    }
  }

  int i, idot, iresid, naid, ind, prev_resid;
  ElemID eleid;
  double xx, yy, zz;
  LString aname, atype, satom, res_name;
  std::map<int,int> atommap;
  std::map<LString, int> aname_counts;
  std::map<LString, int>::iterator an_iter;

  // XXXX
  prev_resid = -999999;
  
  for (i=0; i<natoms; ++i) {
    //LOG_DPRINTLN("i=%d, natoms=%d", i, natoms);

    sline = lin.readLine().chomp();
    slist.clear();
    split(sline, ' ', std::back_inserter(slist));
    if (slist.size()<8) {
      MB_THROW(MOL2FormatException, "Invalid atom record");
    }

    if (!slist[0].toInt(&ind)) {
      MB_THROW(MOL2FormatException, "Invalid atom ID record");
    }

    aname = slist[1];
    an_iter = aname_counts.find(aname);
    if (an_iter==aname_counts.end()) {
      aname_counts.insert(std::pair<LString, int>(aname, 1));
    }
    else {
      an_iter->second = an_iter->second + 1;
      aname = LString::format("%d%s", an_iter->second, aname.c_str());
    }

    if (!slist[2].toRealNum(&xx)) {
      MB_THROW(MOL2FormatException, "Invalid atom coord record");
    }
    if (!slist[3].toRealNum(&yy)) {
      MB_THROW(MOL2FormatException, "Invalid atom coord record");
    }
    if (!slist[4].toRealNum(&zz)) {
      MB_THROW(MOL2FormatException, "Invalid atom coord record");
    }

    atype = slist[5];

    satom = "";
    idot = atype.indexOf('.');
    if (idot<0) {
      satom = atype;
    }
    else if (idot>0) {
      satom = atype.substr(0, idot);
    }
    else {
      MB_THROW(MOL2FormatException, "Invalid SYBYL atom type");
    }

    iresid = 0;
    if (!slist[6].toInt(&iresid)) {
      MB_THROW(MOL2FormatException, "Invalid atom resid record");
    }

    res_name = slist[7];
    if (res_name.equals("<0>"))
      res_name = cmpd_name;

    if (bApplyTopo) {
      // protein or nucleic acid
      // strip residue number from res_name
      int ntmp;
      if (res_name.substr(3).toInt(&ntmp)) {
	res_name = res_name.substr(0, 3);
	iresid = ntmp;
      }

      if (iresid!=prev_resid)
	// residue is changed --> clear atom name count
	aname_counts.clear();
    }

    eleid = ElemSym::str2SymID(satom);

    // LOG_DPRINTLN("Atom: %f, %f, %f, <%s> %d", xx, yy, zz, aname.c_str(), eleid);

    if (!bskip) {
      MolAtomPtr pAtom = MolAtomPtr(MB_NEW MolAtom());
      pAtom->setParentUID(m_pMol->getUID());
      pAtom->setName(aname);
      pAtom->setElement(eleid);

      pAtom->setChainName(m_sCurrChName);
      pAtom->setResIndex(iresid);
      pAtom->setResName(res_name);
    
      pAtom->setPos(Vector4D(xx,yy,zz));
      pAtom->setBfac(0.0);
      pAtom->setOcc(1.0);
    
      naid = m_pMol->appendAtom(pAtom);
      if (naid<0)
	MB_THROW(MOL2FormatException, "appendAtom() failed");

      atommap.insert(std::pair<int,int>(ind, naid));
      m_nReadAtoms++;
    }

    prev_resid = iresid;

  }
  
  // Search BOND record
  for (;;) {
    sline = lin.readLine().chomp();
    if (sline.isEmpty() && !lin.ready())
      return false; // EOF
  
    if (sline.equals("@<TRIPOS>BOND")) {
      break;
    }
  }

  int natm1, natm2;
  int natm_id1, natm_id2;
  std::map<int,int>::const_iterator iter;
  
  for (i=0; i<nbonds; ++i) {

    sline = lin.readLine().chomp();
    slist.clear();
    split(sline, ' ', std::back_inserter(slist));
    if (slist.size()<4) {
      MB_THROW(MOL2FormatException, "Invalid bond record");
    }

    if (!slist[1].toInt(&natm1)) {
      MB_THROW(MOL2FormatException, "Invalid bond line (atom1)");
    }
    if (!slist[2].toInt(&natm2)) {
      MB_THROW(MOL2FormatException, "Invalid bond line (atom2)");
    }
    LString sbont = slist[3];

    if (!bskip) {
      iter = atommap.find(natm1);
      if (iter==atommap.end())
	MB_THROW(MOL2FormatException, "Invalid bond line (bond atom1 not found)");
      natm_id1 = iter->second;

      iter = atommap.find(natm2);
      if (iter==atommap.end())
	MB_THROW(MOL2FormatException, "Invalid bond line (bond atom2 not found)");
      natm_id2 = iter->second;

      MolBond *pB = m_pMol->makeBond(natm_id1, natm_id2, true);
      if (pB==NULL)
	MB_THROW(MOL2FormatException, "makeBond failed");

      if (sbont.equals("1"))
	pB->setType(MolBond::SINGLE);
      else if (sbont.equals("2"))
	pB->setType(MolBond::DOUBLE);
      else if (sbont.equals("3"))
	pB->setType(MolBond::TRIPLE);
      else if (sbont.equals("ar")||sbont.equals("am"))
	pB->setType(MolBond::DELOC);

      m_nReadBonds++;
    }

    //LOG_DPRINTLN("bond %d<-->%d: %d", natm_id1, natm_id2, nbont);
  }
  
  if (bApplyTopo) {
    m_pMol->applyTopology();
    if (mol_type.equals("PROTEIN"))
      m_pMol->calcProt2ndry(-500.0);
    if (mol_type.equals("NUCLEIC_ACID"))
      m_pMol->calcBasePair(3.7, 30);
  }
  else {
    // Set noautogen prop to this residue,
    // to avoid topology autogen, when saved to and loaded from the qdf stream.
    if (!bskip) {
      iter = atommap.begin();
      if (iter!=atommap.end()) {
	int aid0 = iter->second;
	MolAtomPtr pA = m_pMol->getAtom(aid0);
	if (!pA.isnull()) {
	  MolResiduePtr pRes = pA->getParentResidue();
	  if (!pRes.isnull()) {
	    pRes->setPropStr("noautogen", "true");
	  }
	}
      }      
    }
  }
  /*
  */

  return true;
}
Exemplo n.º 8
0
void XmlRpcMgr::chkCred(const LString &c)
{
  // TO DO: implementation
  if (!c.equals("XXX"))
    throw( xmlrpc_c::fault("Invalid credential", xmlrpc_c::fault::CODE_UNSPECIFIED) );
}
Exemplo n.º 9
0
///
///   main routine for CueTTY (CLI version)
///
int main(int argc, const char *argv[])
{
  if (qlib::init())
    MB_DPRINTLN("qlib::init() OK.");
  else {
    LOG_DPRINTLN("Init: ERROR!!");
    return -1;
  }

  int i;
  LString loadscr;
  LString confpath;
  std::deque<LString> args2;

  for (i=1; i<argc; ++i) {
    MB_DPRINTLN("arg%d=%s", i, argv[i]);
    LString value = argv[i];

    if (value.equals("-conf")) {
      ++i;
      if (i>=argc) break;
      confpath = argv[i];
      ++i;
    }

    break;
  }
  
  for (; i<argc; ++i) {
    MB_DPRINTLN("arg%d=%s", i, argv[i]);
    args2.push_back(argv[i]);
  }

  if (args2.size()>0)
    loadscr = args2.front();

  if (confpath.isEmpty()) {
    confpath = DEFAULT_CONFIG;
  }

  if (!qsys::init(confpath)) {
    LOG_DPRINTLN("Qsys Init (%s): ERROR!!", confpath.c_str());
    return -1;
  }

  MB_DPRINTLN("main> confpath=%s", confpath.c_str());

  // load molstr/lwview module
  molstr::init();
  lwview::init();
  anim::init();

#if !defined(QM_BUILD_LW)
  // load other modules
  render::init();
  molvis::init();
  xtal::init();
  symm::init();
  surface::init();
  molanl::init();
#endif

#ifdef HAVE_JAVASCRIPT
  // load internal JS module
  jsbr::init();
#endif

#ifdef HAVE_PYTHON
  // load python module
  pybr::init();
#endif

  //////////

  if (!loadscr.isEmpty()) {
    process_input(loadscr, args2);
  }

  //////////

#ifdef HAVE_PYTHON
  // unload python module
  pybr::fini();
  MB_DPRINTLN("=== pybr::fini() OK ===");
#endif

#ifdef HAVE_JAVASCRIPT
  jsbr::fini();
  MB_DPRINTLN("=== jsbr::fini() OK ===");
#endif

#if !defined(QM_BUILD_LW)
  // load other modules
  render::fini();
  molvis::fini();
  xtal::fini();
  symm::fini();
  surface::fini();
  molanl::fini();
#endif

  anim::fini();
  lwview::fini();
  molstr::fini();
  MB_DPRINTLN("=== molstr::fini() OK ===");

  qsys::fini();
  MB_DPRINTLN("=== qsys::fini() OK ===");

  qlib::fini();

  std::cerr << "=== Terminated normaly ===" << std::endl;
  return 0;
}
Exemplo n.º 10
0
qlib::LScrSp<qlib::LScrObjBase> SceneXMLReader::fromByteArray(const qlib::LScrSp<qlib::LByteArray> &pbuf)
{
  qlib::uid_t nSceneID = m_pClient->getUID();

  // Enter the context
  AutoStyleCtxt style_ctxt(nSceneID);

  MB_DPRINTLN("fromXML\n%s<<<", pbuf->data());
  MB_DPRINTLN("Length: %d", pbuf->size());

  //
  // Setup streams
  //
  qlib::StrInStream fis(pbuf);
  qlib::LDom2InStream ois(fis);

  qlib::LDom2Tree tree;
  ois.read(tree);
  qlib::LDom2Node *pNode = tree.top();
  //pNode->dump();

  qlib::LScrSp<qlib::LScrObjBase> pSObj;
  LString tag = pNode->getTagName();
  LString type_name = pNode->getTypeName();
  if (tag.equals("renderer") && !type_name.isEmpty()) {
    // pbuf contains Renderer
    RendererFactory *pRF = RendererFactory::getInstance();
    RendererPtr pRend = pRF->create(type_name);
    pRend->resetAllProps();
    pRend->readFrom2(pNode);
    pSObj = pRend;
  }
  else if (tag.equals("object") && !type_name.isEmpty()) {
    ObjectPtr pObj = pNode->createObjByTypeNameT<Object>();
    pObj->readFrom2(pNode);

    LString src = pObj->getSource();
    LString altsrc = pObj->getAltSource();
    LString srctype = pObj->getSourceType();
    pNode->requestDataLoad(src, altsrc, srctype, pObj.get());

    pSObj = pObj;

    // clearChunkMap();
    procDataSrcLoad(ois, pNode);
    procDataChunks(ois, pNode);
    // clearChunkMap();

  }
  else if (tag.equals("camera")) {
    // pbuf contains Camera
    CameraPtr pCam(MB_NEW Camera);
    pCam->readFrom2(pNode);
    pSObj = pCam;
  }
  else {
    MB_DPRINTLN("readRendFromXML> ERROR, Invalid QSC XML");
    return pSObj;
  }


  return pSObj;
}