void Uc::import(File & f) { for (;;) { Q3CString s; switch (f.read(s)) { case -1: f.eof(); throw 0; case ')': return; case ATOM: if ((s == "logical_models") || (s == "logical_presentations")) { f.read("("); f.read("list"); f.read("unit_reference_list"); readObjects(f); } else readObject(f, s); break; default: f.syntaxError(s); } } }
/*!***************************************************************************** ******************************************************************************* \note init_user_simulation \date July 1998 \remarks initializes everything needed for the numerical simulation. ******************************************************************************* Function Parameters: [in]=input,[out]=output none ******************************************************************************/ int init_user_simulation(void) { int i,j,n; // initalize objects in the environment readObjects(config_files[OBJECTS]); // assign contact force mappings #include "LEKin_contact.h" #ifdef HAS_LOWER_BODY contacts[R_FOOT].active = FALSE; contacts[L_FOOT].active = FALSE; #endif #ifdef HAS_UPPER_BODY contacts[B_HEAD].active = FALSE; #endif // change numerical integration n_integration = 8; integrate_method = INTEGRATE_EULER; // change the freeze_base_pos[] array if needed // zero the state of the robot reset(); return TRUE; }
/*!***************************************************************************** ******************************************************************************* \note init_user_openGL \date July 1998 \remarks initializes everything needed for the graphics for this simulation ******************************************************************************* Function Parameters: [in]=input,[out]=output \param[in] argc : number of elements in argv \param[in] argv : array of argc character strings ******************************************************************************/ int init_user_openGL(int argc, char** argv) { int i,j,n; int rc; int ans; // we need the kinematics initialized init_kinematics(); // read objects readObjects(config_files[OBJECTS]); // assign contact force mappings #include "LEKin_contact.h" // create simulation windows if (!createWindows()) return FALSE; // user graphics addToUserGraphics("phantom","Display a phantom robot", displayPhantom,(N_CART+N_QUAT+n_dofs)*sizeof(float)); addToMan("comsDisplay","toggle drawing COMs per link",toggleCOMsDisplay); return TRUE; }
int AgiEngine::loadObjects(const char *fname) { Common::File fp; debugC(5, kDebugLevelResources, "(Loading objects '%s')", fname); if (!fp.open(fname)) return errBadFileOpen; return readObjects(fp, fp.size()); }
void Uc::readObjects(File & f) { for (;;) { Q3CString s; switch (f.read(s)) { case ')': return; case '(': break; default: f.syntaxError(s); } f.read("object"); if (f.read(s) != ATOM) f.syntaxError(s, "an atom"); if ((s == "Class") || (s == "Metaclass") || (s == "Instantiated_Class") || (s == "Parameterized_Class")) UmlClass::import(f, item(), s); else if (s == "UseCase") UmlUseCase::import(f, item()); else if (s == "UseCaseDiagram") UmlUseCaseDiagram::import(f, item()); else if (s == "InteractionDiagram") UmlSequenceDiagram::import(f, item()); else if (s == "ObjectDiagram") UmlCollaborationDiagram::import(f, item()); else if (s == "Class_Category") UmlUseCaseView::import(item(), f); else if (s == "logical_presentations") { f.read("("); f.read("list"); f.read("unit_reference_list"); readObjects(f); } else { if ((s != "Association") && // actor -----> UC ... (s != "Mechanism")) // seq/col diagram //UmlCom::trace("<br>" + s + " in " + Q3CString(f.name()) + " NOT MANAGED by UseCaseView::readObject()");//[jasa] original line UmlCom::trace("<br>" + s + " in " + Q3CString(f.name().toAscii()) + " NOT MANAGED by UseCaseView::readObject()");//[jasa] conversion from QString to Q3CString f.skipBlock(); } } }
// Read in the scene data, and load the necessary resources scene_data* loadScene(const std::string& fileName) { scene_data* scene = new scene_data; boost::property_tree::ptree pt; boost::property_tree::read_json(fileName, pt); readGeometry(scene, pt.get_child("geometry")); readTextures(scene, pt.get_child("textures")); readMaterials(scene, pt.get_child("materials")); readObjects(scene, pt.get_child("objects")); readLighting(scene, pt.get_child("lighting")); readDynamicLights(scene, pt.get_child("dynamic_lighting")); return scene; }
bool Reader::readBinaryGTO() { readIndexTable(); // OK to continue if this fails readHeader(); if (m_error) return false; readStringTable(); if (m_error) return false; readObjects(); if (m_error) return false; readComponents(); if (m_error) return false; readProperties(); if (m_error) return false; descriptionComplete(); if (m_mode & HeaderOnly) { return true; } Properties::iterator p = m_properties.begin(); for (Components::iterator i = m_components.begin(); i != m_components.end(); ++i) { ComponentInfo &comp = *i; if (comp.flags & Gto::Transposed) { cerr << "ERROR: Transposed data for '" << stringFromId( comp.object->name ) << "." << stringFromId( comp.name ) << "' is currently unsupported." << endl; abort(); } else { for (Properties::iterator e = p + comp.numProperties; p != e; ++p) { if (!readProperty(*p)) { return false; } } } } return true; }
bool LevelReader::readLevel(const std::string& fileName, LevelData& data) { XMLDocument xmlDoc; XMLError result = xmlDoc.LoadFile(fileName.c_str()); XMLCheckResult(result); XMLElement* map = xmlDoc.FirstChildElement("map"); if (map == nullptr) { g_logger->logError("LevelReader", "XML file could not be read, no map node found."); return false; } if (!readLevelProperties(map, data)) return false; if (!readFirstGridIDs(map, data)) return false; if (!readLayers(map, data)) return false; if (!readObjects(map, data)) return false; updateData(data); if (!checkData(data)) return false; return true; }
/*!***************************************************************************** ******************************************************************************* \note initSimulation \date July 1998 \remarks initializes everything needed for the simulation. ******************************************************************************* Function Parameters: [in]=input,[out]=output \param[in] argc : number of elements in argv \param[in] argv : array of argc character strings ******************************************************************************/ int initSimulation(int argc, char** argv) { int i,j,n; int rc; int ans; /* initialize the servos */ init_task_servo(); /* the first servo sets the sampling rate in collect data */ read_whichDOFs("task_sim_servo"); init_motor_servo(); read_whichDOFs("motor_sim_servo"); init_vision_servo(); read_whichDOFs("vision_sim_servo"); init_invdyn_servo(); read_whichDOFs("invdyn_sim_servo"); /* we need the dynamics initalized */ init_dynamics(); /* user specific tasks */ initUserTasks(); /* create simulation windows */ if (!createWindows()) return FALSE; /* reset motor_servo variables */ servo_enabled = 1; motor_servo_calls = 0; servo_time = 0; motor_servo_rate = SERVO_BASE_RATE; zero_integrator(); bzero((char *)&(joint_sim_state[1]),sizeof(SL_DJstate)*N_DOFS); for (i=1; i<=N_DOFS; ++i) { joint_sim_state[i].th = joint_default_state[i].th; joint_des_state[i].th = joint_default_state[i].th; } /* reset task_servo variables */ servo_enabled = 1; task_servo_calls = 0; task_servo_time = 0; task_servo_errors = 0; task_servo_rate = SERVO_BASE_RATE/(double) task_servo_ratio; setTaskByName(NO_TASK); setDefaultPosture(); changeCollectFreq(task_servo_rate); /* reset vision servo variables */ servo_enabled = 1; vision_servo_calls = 0; vision_servo_time = 0; vision_servo_errors = 0; vision_servo_rate = VISION_SERVO_RATE; /* initialize all vision variables to safe values */ init_vision_states(); init_learning(); /* reset the invdyn servo variables */ servo_enabled = 1; invdyn_servo_errors = 0; invdyn_lookup_data = 0; invdyn_learning_data = 0; /* initalize objects in the environment */ readObjects(); /* assign contact force mappings */ #include "LEKin_contact.h" initContacts(); return TRUE; }
ADXFDecoder::ADXFDecoder(const char *fname) : ASceneDecoder(fname) { init(); openFile(fname); readObjects(); }
/** * Loads an object file that is in the common VOL resource format. Expects * the file pointer to point to the last field in header, ie. file length. * This is used at least by the V1 booter games. */ int AgiEngine::loadObjects(Common::File &fp) { int flen = fp.readUint16LE(); return readObjects(fp, flen); }
int SC2Map::readMap() { HANDLE archive; string fullArchiveName( argPath ); fullArchiveName.append( archiveWithExt ); if( !SFileOpenArchive( fullArchiveName.data(), 0, 0, &archive ) ) { printWarning( "Could not open map MPQ archive file %s\n", archiveWithExt.data() ); return -1; } // the order of reading archive files is important--some // analysis data structures are depedenent on one another if( readGameStrings_txt( archive ) < 0 ) { printWarning( "Could not find a locale to extract map name, using archive filename instead.\n" ); mapName.assign( archiveName ); } // however we got a name for the map, make a version // that is valid for use in filenames makeMapNameValidForFilenames(); printMessage( " map name found for preferred locale: [%s]\n", mapName.data() ); printMessage( " map name as part of filenames: [%s]\n", mapNameInOutputFiles.data() ); if( readMapInfo( archive ) < 0 ) { printMessage( " No MapInfo file.\n" ); return -1; } if( debugMapInfo > 0 ) { printMessage( "End debugging MapInfo\n" ); exit( 0 ); } if( readt3HeightMap( archive ) < 0 ) { printMessage( " No t3HeightMap file.\n" ); return -1; } computePathingFromCliffChanges(); if( readt3Terrain_xml( archive ) < 0 ) { printMessage( " No Terrain.xml file, continuing...\n" ); } if( readPaintedPathingLayer( archive ) < 0 ) { printMessage( " No PaintedPathingLayer file, continuing...\n" ); } if( readObjects( archive ) < 0 ) { printMessage( " No Objects file, (StartLocs, resources, etc.), continuing...\n" ); } else { // only do this after all Objects are read applyFillsAndFootprints(); if( startLocs.empty() ) { printWarning( "No start locations have been placed, some outputs may have odd values.\n" ); } } if( debugObjects > 0 ) { printMessage( "End debugging Objects\n" ); exit( 0 ); } SFileCloseArchive( archive ); return 0; }
AWavefrontDecoder::AWavefrontDecoder(const char *fname) : AMeshDecoder(fname) { init(); openFile(fname); readObjects(); }