QJSValue THREEVector3::applyProjection(QJSValue threeMatrix4) { THREEMatrix4 *m = THREEMatrix4::getAsTHREEMatrix4(threeMatrix4); if (!m) { qDebug() << "THREEVector3::" << __FUNCTION__ << " parameter was not THREEMatrix4 was " << threeMatrix4.toQObject(); return m_engine->newQObject(this); } return m_engine->newQObject(_applyProjection(m)); }
int main(int argc, char ** argv) { // process options if(argc == 1 || (argc > 1 && strcmp(argv[1],"-h") == 0) ) { help(argv[0]); exit(0); } // Since the output of this program will be compared with // a master output file, turn off ICU message loading. MessageLoader::_useDefaultMsg = true; String testOption; String className; String nameSpace; for(int i = 0; i < argc; i++) { if((strcmp(argv[i],"-test") == 0) && (i+1 < argc)) testOption = argv[i+1]; if((strcmp(argv[i],"-className") == 0) && (i+1 < argc)) className = argv[i+1]; if((strcmp(argv[i],"-nameSpace") == 0) && (i+1 < argc)) nameSpace = argv[i+1]; } String lang("WQL"); Array<CQLSelectStatement> _statements; // setup test environment // get the configuration variable PEGASUS_HOME const char* peg_home = getenv("PEGASUS_HOME"); // get the makefile build config variable REPOSITORY_NAME const char* repo_name = getenv("REPOSITORY_NAME"); if (peg_home == NULL) exit(-1); if (repo_name == NULL) repo_name = "repository"; String repositoryDir(peg_home); repositoryDir.append("/"); repositoryDir.append(repo_name); CIMNamespaceName _ns; if(nameSpace != String::EMPTY) { _ns = nameSpace; } else { cout << "Using root/SampleProvider as default namespace." << endl; _ns = String("root/SampleProvider"); } CIMRepository* _rep = new CIMRepository(repositoryDir); RepositoryQueryContext _ctx(_ns, _rep); char text[1024]; char* _text; // setup Test Instances Array<CIMInstance> _instances; if(className != String::EMPTY) { try { const CIMName _testclass(className); _instances = _rep->enumerateInstances( _ns, _testclass, true ); // deep inh true } catch(Exception& e) { cout << endl << endl << "Exception: Invalid namespace/class: " << e.getMessage() << endl << endl; } } else { // load default class names cout << endl << "Using default class names to test queries. " << endl << endl; const CIMName _testclass(String("QExpr_TestPropertyTypes")); const CIMName _testclass2(String("QExpr_TestElement")); try { _instances = _rep->enumerateInstances( _ns, _testclass, true ); // deep inh true _instances.appendArray(_rep->enumerateInstances( _ns, _testclass2, true )); // deep inh true } catch(Exception& e) { cout << endl << endl << "Exception: Invalid namespace/class: " << e.getMessage() << endl << endl; } } // setup input stream if(argc >= 2) { ifstream queryInputSource(argv[1]); if(!queryInputSource) { cout << "Cannot open input file.\n" << endl; return 1; } int cnt = 0; while(!queryInputSource.eof()) { queryInputSource.getline(text, 1024); char* _ptr = text; _text = strcat(_ptr,"\n"); // check for comments and ignore // a comment starts with a # as the first non whitespace character on the line char _comment = '#'; int i = 0; while(text[i] == ' ' || text[i] == '\t') i++; // ignore whitespace if(text[i] != _comment) { if(!(strlen(_text) < 2)) { String query(text); if(query == "WQL:\n") lang = "WQL"; else if(query == "CQL:\n") lang = "CIM:CQL"; else { try { QueryExpression qexpr; if(cnt % 2) { qexpr = QueryExpression(lang,query); qexpr.setQueryContext(_ctx); } else { qexpr = QueryExpression(lang,query,_ctx); } cnt++; SelectStatement* ss = qexpr.getSelectStatement(); String returnQuery = qexpr.getQuery(); PEGASUS_ASSERT(returnQuery == query); String returnLang = qexpr.getQueryLanguage(); PEGASUS_ASSERT(returnLang == lang); QueryExpression copy(qexpr); PEGASUS_ASSERT(copy.getQuery() == qexpr.getQuery()); PEGASUS_ASSERT(copy.getQueryLanguage() == qexpr.getQueryLanguage()); _applyProjection(qexpr,_instances, testOption, lang); _getPropertyList(qexpr,_instances, _ns, testOption,lang); _validate(qexpr,lang, testOption); _evaluate(qexpr,_instances, testOption,lang); } catch(Exception& e) { cout << e.getMessage() << endl; } catch(...) { cout << "CAUGHT ... BADNESS HAPPENED!!!" << endl; } } } } // while (!eof) behaves differently on HP-UX, seems // like it takes an extra iteration to hit eof. This // leaves "text" with the previous value from // getline(..), which causes a duplicate parse of // the last select statement in the query file, // FIX: we clear text before doing another getline(..) text[0] = 0; } queryInputSource.close(); } else { cout << "Invalid number of arguments.\n" << endl; } delete _rep; return 0; }
/*! * \internal */ THREEVector3 *THREEVector3::_unproject(THREEMatrix4 *projectionMatrix, THREEMatrix4 *matrixWorld) { static THREEMatrix4 matrix(parent(), m_engine); matrix._multiplyMatrices(matrixWorld, projectionMatrix); _applyProjection(&matrix); return this; }