bool CSPropMaterial::ReadFromXML(TiXmlNode &root) { if (CSProperties::ReadFromXML(root)==false) return false; TiXmlElement* prop=root.ToElement(); if (prop==NULL) return false; int attr=1; prop->QueryIntAttribute("Isotropy",&attr); bIsotropy = attr>0; /*************** 3D - Properties *****************/ TiXmlElement* matProp=prop->FirstChildElement("Property"); if (matProp!=NULL) { ReadVectorTerm(Epsilon,*matProp,"Epsilon",1.0); ReadVectorTerm(Mue,*matProp,"Mue",1.0); ReadVectorTerm(Kappa,*matProp,"Kappa"); ReadVectorTerm(Sigma,*matProp,"Sigma"); ReadTerm(Density,*matProp,"Density",0.0); } /********** 3D - Properties Weight **************/ TiXmlElement *weight = prop->FirstChildElement("Weight"); if (weight!=NULL) { ReadVectorTerm(WeightEpsilon,*weight,"Epsilon",1.0); ReadVectorTerm(WeightMue,*weight,"Mue",1.0); ReadVectorTerm(WeightKappa,*weight,"Kappa",1.0); ReadVectorTerm(WeightSigma,*weight,"Sigma",1.0); ReadTerm(WeightDensity,*weight,"Density",1.0); } return true; }
bool CSPropExcitation::ReadFromXML(TiXmlNode &root) { if (CSProperties::ReadFromXML(root)==false) return false; TiXmlElement *prop = root.ToElement(); if (prop==NULL) return false; int iHelp; if (prop->QueryIntAttribute("Number",&iHelp)!=TIXML_SUCCESS) uiNumber=0; else uiNumber=(unsigned int)iHelp; if (prop->QueryIntAttribute("Type",&iExcitType)!=TIXML_SUCCESS) return false; if (ReadVectorTerm(Excitation,*prop,"Excite",0.0)==false) return false; ReadTerm(m_Frequency,*prop,"Frequency"); ReadTerm(Delay,*prop,"Delay"); TiXmlElement *weight = prop->FirstChildElement("Weight"); if (weight!=NULL) { ReadTerm(WeightFct[0],*weight,"X"); ReadTerm(WeightFct[1],*weight,"Y"); ReadTerm(WeightFct[2],*weight,"Z"); } ReadVectorTerm(PropagationDir,*prop,"PropDir",0.0); return true; }
bool CSPrimPolygon::ReadFromXML(TiXmlNode &root) { if (CSPrimitives::ReadFromXML(root)==false) return false; TiXmlElement *elem = root.ToElement(); if (elem==NULL) return false; if (ReadTerm(Elevation,*elem,"Elevation")==false) Elevation.SetValue(0); int help; if (elem->QueryIntAttribute("NormDir",&help)!=TIXML_SUCCESS) return false; m_NormDir=help; TiXmlElement *VT=root.FirstChildElement("Vertex"); if (vCoords.size()!=0) return false; int i=0; while (VT) { for (int n=0;n<2;++n) this->AddCoord(0.0); if (ReadTerm(vCoords.at(i*2),*VT,"X1")==false) return false; if (ReadTerm(vCoords.at(i*2+1),*VT,"X2")==false) return false; VT=VT->NextSiblingElement("Vertex"); ++i; }; return true; }
bool ParameterCoord::ReadFromXML(TiXmlElement *elem) { if (elem==NULL) return false; if (ReadTerm(*m_Coords[0],*elem,"X")==false) return false; if (ReadTerm(*m_Coords[1],*elem,"Y")==false) return false; if (ReadTerm(*m_Coords[2],*elem,"Z")==false) return false; return true; }
bool CSPrimSphericalShell::ReadFromXML(TiXmlNode &root) { if (CSPrimSphere::ReadFromXML(root)==false) return false; TiXmlElement *elem = root.ToElement(); if (elem==NULL) return false; if (ReadTerm(psShellWidth,*elem,"ShellWidth")==false) return false; return true; }
bool CSPrimLinPoly::ReadFromXML(TiXmlNode &root) { if (CSPrimPolygon::ReadFromXML(root)==false) return false; TiXmlElement *elem = root.ToElement(); if (elem==NULL) return false; if (ReadTerm(extrudeLength,*elem,"Length")==false) return false; return true; }
bool CSPrimRotPoly::ReadFromXML(TiXmlNode &root) { if (CSPrimPolygon::ReadFromXML(root)==false) return false; Elevation.SetValue(0); TiXmlElement *elem = root.ToElement(); if (elem==NULL) return false; int help; if (elem->QueryIntAttribute("RotAxisDir",&help)!=TIXML_SUCCESS) return false; m_RotAxisDir=help; TiXmlElement *NV=elem->FirstChildElement("Angles"); if (NV==NULL) return false; if (ReadTerm(StartStopAngle[0],*NV,"Start")==false) return false; if (ReadTerm(StartStopAngle[1],*NV,"Stop")==false) return false; return true; }
bool CSPropLumpedElement::ReadFromXML(TiXmlNode &root) { if (CSProperties::ReadFromXML(root)==false) return false; TiXmlElement* prop=root.ToElement(); if (prop==NULL) return false; if (prop->QueryIntAttribute("Direction",&m_ny)!=TIXML_SUCCESS) m_ny=-1; int caps=0; if (prop->QueryIntAttribute("Caps",&caps)!=TIXML_SUCCESS) m_Caps=true; else m_Caps = (bool)caps; if (ReadTerm(m_R,*prop,"R")==false) m_R.SetValue(NAN); if (ReadTerm(m_C,*prop,"C")==false) m_C.SetValue(NAN); if (ReadTerm(m_L,*prop,"L")==false) m_L.SetValue(NAN); return true; }
bool CSPrimMultiBox::ReadFromXML(TiXmlNode &root) { if (CSPrimitives::ReadFromXML(root)==false) return false;; TiXmlElement *SP=root.FirstChildElement("StartP"); TiXmlElement *EP=root.FirstChildElement("EndP"); if (vCoords.size()!=0) return false; int i=0; while ((SP!=NULL) && (EP!=NULL)) { for (int n=0;n<6;++n) this->AddCoord(0.0); if (ReadTerm(*vCoords.at(i*6),*SP,"X")==false) return false; if (ReadTerm(*vCoords.at(i*6+2),*SP,"Y")==false) return false; if (ReadTerm(*vCoords.at(i*6+4),*SP,"Z")==false) return false; if (ReadTerm(*vCoords.at(i*6+1),*EP,"X")==false) return false; if (ReadTerm(*vCoords.at(i*6+3),*EP,"Y")==false) return false; if (ReadTerm(*vCoords.at(i*6+5),*EP,"Z")==false) return false; // for (int n=0;n<6;++n) fprintf(stderr,"%e ",vCoords.at(i*6+n)->GetValue()); // fprintf(stderr,"\n"); SP=SP->NextSiblingElement("StartP"); EP=EP->NextSiblingElement("EndP"); ++i; }; return true; }
bool CSPrimRotPoly::ReadFromXML(TiXmlNode &root) { if (CSPrimPolygon::ReadFromXML(root)==false) return false; if (Elevation.GetValue()!=0) std::cerr << __func__ << ": Warning: An elevation for a rotational poly is not supported! Skipping!" << std::endl; Elevation.SetValue(0); TiXmlElement *elem = root.ToElement(); if (elem==NULL) return false; int help; if (elem->QueryIntAttribute("RotAxisDir",&help)!=TIXML_SUCCESS) return false; m_RotAxisDir=help; TiXmlElement *NV=elem->FirstChildElement("Angles"); if (NV==NULL) return false; if (ReadTerm(StartStopAngle[0],*NV,"Start")==false) return false; if (ReadTerm(StartStopAngle[1],*NV,"Stop")==false) return false; return true; }
bool CSPrimUserDefined::ReadFromXML(TiXmlNode &root) { if (CSPrimitives::ReadFromXML(root)==false) return false; int value; TiXmlElement* elem=root.ToElement(); if (elem==NULL) return false; if (elem->QueryIntAttribute("CoordSystem",&value)!=TIXML_SUCCESS) return false; SetCoordSystem((UserDefinedCoordSystem)value); //P1 TiXmlElement* P1=root.FirstChildElement("CoordShift"); if (P1==NULL) return false; if (ReadTerm(dPosShift[0],*P1,"X")==false) return false; if (ReadTerm(dPosShift[1],*P1,"Y")==false) return false; if (ReadTerm(dPosShift[2],*P1,"Z")==false) return false; TiXmlElement* FuncElem=root.FirstChildElement("Function"); if (FuncElem==NULL) return false; SetFunction(FuncElem->GetText()); return true; }
bool Lexer::GetNextToken(QueryToken* token) { while(!reader->Eos()) { int ch = reader->GetNext(); if ( ch == -1 ) break; // skipping whitespaces if( _istspace(ch)!=0 ) { continue; } TCHAR buf[2] = {TCHAR(ch),'\0'}; switch(ch) { case '+': token->set(buf, QueryToken::PLUS); return true; case '-': token->set(buf, QueryToken::MINUS); return true; case '(': token->set(buf, QueryToken::LPAREN); return true; case ')': token->set(buf, QueryToken::RPAREN); return true; case ':': token->set(buf, QueryToken::COLON); return true; case '!': token->set(buf, QueryToken::NOT); return true; case '^': token->set(buf, QueryToken::CARAT); return true; case '~': if( _istdigit( reader->Peek() )!=0 ) { TCHAR number[LUCENE_MAX_FIELD_LEN]; ReadIntegerNumber(ch, number,LUCENE_MAX_FIELD_LEN); token->set(number, QueryToken::SLOP); return true; }else{ token->set(buf, QueryToken::FUZZY); return true; } break; case '"': return ReadQuoted(ch, token); case '[': return ReadInclusiveRange(ch, token); case '{': return ReadExclusiveRange(ch, token); case ']': case '}': case '*': queryparser->throwParserException( _T("Unrecognized TCHAR %d at %d::%d."), ch, reader->Column(), reader->Line() ); return false; default: return ReadTerm(ch, token); // end of swith } } return false; }