本文整理汇总了C++中misc::ConfigurationFileSection类的典型用法代码示例。如果您正苦于以下问题:C++ ConfigurationFileSection类的具体用法?C++ ConfigurationFileSection怎么用?C++ ConfigurationFileSection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigurationFileSection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: initialize
void Listener::initialize(const Misc::ConfigurationFileSection& configFileSection)
{
/* Read the listener's name: */
std::string name=configFileSection.retrieveString("./name");
listenerName=new char[name.size()+1];
strcpy(listenerName,name.c_str());
/* Determine whether the listener is head-tracked: */
headTracked=configFileSection.retrieveValue<bool>("./headTracked",false);
if(headTracked)
{
/* Retrieve head tracking device pointer: */
headDevice=findInputDevice(configFileSection.retrieveString("./headDevice").c_str());
if(headDevice==0)
Misc::throwStdErr("Listener: Head device \"%s\" not found",configFileSection.retrieveString("./headDevice").c_str());
}
else
{
/* Retrieve fixed head position/orientation: */
headDeviceTransformation=configFileSection.retrieveValue<TrackerState>("./headDeviceTransformation");
}
/* Get head position and listening and up directions in head device coordinates: */
deviceHeadPosition=configFileSection.retrieveValue<Point>("./headPosition",Point::origin);
deviceListenDirection=configFileSection.retrieveValue<Vector>("./listenDirection",Vector(0,1,0));
deviceUpDirection=configFileSection.retrieveValue<Vector>("./upDirection",Vector(0,0,1));
}
开发者ID:jrevote,项目名称:3DA-Vrui,代码行数:27,代码来源:Listener.cpp
示例2: viewer
ToolKillZoneFrustum::ToolKillZoneFrustum(const Misc::ConfigurationFileSection& configFileSection)
:ToolKillZone(configFileSection),
viewer(0),screen(0)
{
/* Get the viewer: */
std::string viewerName=configFileSection.retrieveString("./killZoneViewerName");
viewer=findViewer(viewerName.c_str());
if(viewer==0)
Misc::throwStdErr("ToolKillZoneFrustum::ToolKillZoneFrustum: Viewer %s not found",viewerName.c_str());
/* Get the screen: */
std::string screenName=configFileSection.retrieveString("./killZoneScreenName");
screen=findScreen(screenName.c_str());
if(screen==0)
Misc::throwStdErr("ToolKillZoneFrustum::ToolKillZoneFrustum: Screen %s not found",screenName.c_str());
/* Read box' center and size: */
Point boxCenter=configFileSection.retrieveValue<Point>("./killZoneCenter");
Vector boxSize=configFileSection.retrieveValue<Vector>("./killZoneSize");
/* Transform box center and size to screen coordinates: */
ONTransform screenT=screen->getScreenTransformation();
boxCenter=screenT.inverseTransform(boxCenter);
boxCenter[2]=Scalar(0);
boxSize=screenT.inverseTransform(boxSize);
boxSize[2]=Scalar(0);
box=Box(boxCenter-boxSize*Scalar(0.5),boxCenter+boxSize*Scalar(0.5));
}
开发者ID:jrevote,项目名称:3DA-Vrui,代码行数:28,代码来源:ToolKillZoneFrustum.cpp
示例3: initialize
void Viewer::initialize(const Misc::ConfigurationFileSection& configFileSection)
{
/* Read the viewer's name: */
std::string name=configFileSection.retrieveString("./name");
viewerName=new char[name.size()+1];
strcpy(viewerName,name.c_str());
/* Determine whether the viewer is head-tracked: */
headTracked=configFileSection.retrieveValue<bool>("./headTracked",false);
if(headTracked)
{
/* Retrieve head tracking device pointer: */
headDevice=findInputDevice(configFileSection.retrieveString("./headDevice").c_str());
if(headDevice==0)
Misc::throwStdErr("Viewer: Head device \"%s\" not found",configFileSection.retrieveString("./headDevice").c_str());
}
else
{
/* Retrieve fixed head position/orientation: */
headDeviceTransformation=configFileSection.retrieveValue<TrackerState>("./headDeviceTransformation");
}
/* Get view direction and eye positions in head device coordinates: */
deviceViewDirection=configFileSection.retrieveValue<Vector>("./viewDirection",Vector(0,1,0));
deviceMonoEyePosition=configFileSection.retrieveValue<Point>("./monoEyePosition",Point::origin);
deviceLeftEyePosition=configFileSection.retrieveValue<Point>("./leftEyePosition",Point::origin);
deviceRightEyePosition=configFileSection.retrieveValue<Point>("./rightEyePosition",Point::origin);
/* Create the viewer's light source: */
lightsource=getLightsourceManager()->createLightsource(true);
/* Get head light enable flag: */
if(!configFileSection.retrieveValue<bool>("./headLightEnabled",true))
lightsource->disable();
/* Get head light position and direction in head device coordinates: */
headLightDevicePosition=configFileSection.retrieveValue<Point>("./headLightPosition",Point::origin);
headLightDeviceDirection=configFileSection.retrieveValue<Vector>("./headLightDirection",Vector(0,1,0));
/* Retrieve head light settings: */
GLLight::Color headLightColor=configFileSection.retrieveValue<GLLight::Color>("./headLightColor",GLLight::Color(1.0f,1.0f,1.0f));
lightsource->getLight().diffuse=headLightColor;
lightsource->getLight().specular=headLightColor;
lightsource->getLight().spotCutoff=configFileSection.retrieveValue<GLfloat>("./headLightSpotCutoff",180.0f);
lightsource->getLight().spotExponent=configFileSection.retrieveValue<GLfloat>("./headLightSpotExponent",0.0f);
/* Initialize transient state if head tracking is disabled: */
if(!headTracked)
{
/* Initialize transient state: */
Point hlp=headDeviceTransformation.transform(headLightDevicePosition);
lightsource->getLight().position=GLLight::Position(GLfloat(hlp[0]),GLfloat(hlp[1]),GLfloat(hlp[2]),1.0f);
Vector hld=headDeviceTransformation.transform(headLightDeviceDirection);
hld.normalize();
lightsource->getLight().spotDirection=GLLight::SpotDirection(GLfloat(hld[0]),GLfloat(hld[1]),GLfloat(hld[2]));
}
}
开发者ID:jrevote,项目名称:3DA-Vrui,代码行数:57,代码来源:Viewer.cpp
示例4: movieFile
TheoraMovieSaver::TheoraMovieSaver(const Misc::ConfigurationFileSection& configFileSection)
:MovieSaver(configFileSection),
movieFile(IO::openFile(configFileSection.retrieveString("./movieFileName").c_str(),IO::File::WriteOnly)),
oggStream(1),
theoraBitrate(0),theoraQuality(32),theoraGopSize(32),
imageExtractor(0)
{
movieFile->setEndianness(Misc::LittleEndian);
/* Read the encoder parameters: */
theoraBitrate=configFileSection.retrieveValue<int>("./movieBitrate",theoraBitrate);
if(theoraBitrate<0)
theoraBitrate=0;
theoraQuality=configFileSection.retrieveValue<int>("./movieQuality",theoraQuality);
if(theoraQuality<0)
theoraQuality=0;
if(theoraQuality>63)
theoraQuality=63;
theoraGopSize=configFileSection.retrieveValue<int>("./movieGopSize",theoraGopSize);
if(theoraGopSize<1)
theoraGopSize=1;
/* Set the Theora frame rate and adjust the initially configured frame rate: */
theoraFrameRate=int(frameRate+0.5);
frameRate=theoraFrameRate;
frameInterval=Misc::Time(1.0/frameRate);
}
开发者ID:Doc-Ok,项目名称:OpticalTracking,代码行数:27,代码来源:TheoraMovieSaver.cpp
示例5: alDevice
SoundContext::SoundContext(const Misc::ConfigurationFileSection& configFileSection,VruiState* sVruiState)
:vruiState(sVruiState),
#ifdef VRUI_USE_OPENAL
alDevice(0),alContext(0),
#endif
contextData(0),
listener(findListener(configFileSection.retrieveString("./listenerName").c_str()))
{
#ifdef VRUI_USE_OPENAL
/* Open the OpenAL device: */
std::string alDeviceName=configFileSection.retrieveValue<std::string>("./deviceName","Default");
alDevice=alcOpenDevice(alDeviceName!="Default"?alDeviceName.c_str():0);
if(alDevice==0)
Misc::throwStdErr("SoundContext::SoundContext: Could not open OpenAL sound device %s",alDeviceName.c_str());
/* Create an OpenAL context: */
alContext=alcCreateContext(alDevice,0);
if(alContext==0)
{
alcCloseDevice(alDevice);
Misc::throwStdErr("SoundContext::SoundContext: Could not create OpenAL context for sound device %s",alDeviceName.c_str());
}
#endif
/* Create an AL context data object: */
contextData=new ALContextData(101);
/* Initialize the sound context's OpenAL context: */
makeCurrent();
/* Initialize application sound state: */
if(vruiState->perSoundInitFunction!=0)
vruiState->perSoundInitFunction(*contextData,vruiState->perSoundInitFunctionData);
}
开发者ID:jrevote,项目名称:3DA-Vrui,代码行数:34,代码来源:SoundContext.cpp
示例6: xyzhpr
InputDeviceAdapterVisBox::InputDeviceAdapterVisBox(InputDeviceManager* sInputDeviceManager,const Misc::ConfigurationFileSection& configFileSection)
:InputDeviceAdapter(sInputDeviceManager),
xyzhpr((const float*)-1)
{
/* Retrieve the shared memory key from the configuration file: */
key_t sharedMemoryKey=key_t(configFileSection.retrieveValue<int>("./sharedMemoryKey",0xDEAD));
/* Try attaching to the shared memory segment: */
int sharedMemoryID=shmget(sharedMemoryKey,6*sizeof(float),0777);
if(sharedMemoryID<0)
Misc::throwStdErr("InputDeviceAdapterVisBox::InputDeviceAdapterVisBox: Could not attach to shared memory segment using key %x",int(sharedMemoryKey));
/* Get the pointer to the tracker state variables: */
xyzhpr=reinterpret_cast<const float*>(shmat(sharedMemoryID,0,SHM_RDONLY));
if(xyzhpr==(const float*)-1)
Misc::throwStdErr("InputDeviceAdapterVisBox::InputDeviceAdapterVisBox: Could not map shared memory segment using key %x",int(sharedMemoryKey));
/* Allocate new adapter state arrays: */
numInputDevices=1;
inputDevices=new InputDevice*[numInputDevices];
/* Create new input device: */
std::string deviceName=configFileSection.retrieveString("./name");
inputDevices[0]=inputDeviceManager->createInputDevice(deviceName.c_str(),InputDevice::TRACK_POS|InputDevice::TRACK_DIR|InputDevice::TRACK_ORIENT,0,0,true);
inputDevices[0]->setDeviceRayDirection(configFileSection.retrieveValue<Vector>("./deviceRayDirection",Vector(0,1,0)));
/* Initialize the new device's glyph from the current configuration file section: */
Glyph& deviceGlyph=inputDeviceManager->getInputGraphManager()->getInputDeviceGlyph(inputDevices[0]);
deviceGlyph.configure(configFileSection,"./deviceGlyphType","./deviceGlyphMaterial");
/* Set device's linear and angular velocities to zero, because we don't know any better: */
inputDevices[0]->setLinearVelocity(Vector::zero);
inputDevices[0]->setAngularVelocity(Vector::zero);
}
开发者ID:VisualIdeation,项目名称:Vrui,代码行数:34,代码来源:InputDeviceAdapterVisBox.cpp
示例7: configure
void Glyph::configure(const Misc::ConfigurationFileSection& configFileSection,const char* glyphTypeTagName,const char* glyphMaterialTagName)
{
/* Retrieve glyph type as string: */
std::string glyphTypeName=configFileSection.retrieveString(glyphTypeTagName,"None");
if(glyphTypeName!="None")
{
if(glyphTypeName=="Cone")
glyphType=CONE;
else if(glyphTypeName=="Cube")
glyphType=CUBE;
else if(glyphTypeName=="Sphere")
glyphType=SPHERE;
else if(glyphTypeName=="Crossball")
glyphType=CROSSBALL;
else if(glyphTypeName=="Box")
glyphType=BOX;
else if(glyphTypeName=="Cursor")
glyphType=CURSOR;
else
Misc::throwStdErr("GlyphRenderer::Glyph: Invalid glyph type %s",glyphTypeName.c_str());
enabled=true;
glyphMaterial=configFileSection.retrieveValue<GLMaterial>(glyphMaterialTagName,glyphMaterial);
}
else
enabled=false;
}
开发者ID:VisualIdeation,项目名称:Vrui-2.3-001,代码行数:26,代码来源:GlyphRenderer.cpp
示例8: configure
void Glyph::configure(const Misc::ConfigurationFileSection& configFileSection,const char* glyphTypeTagName,const char* glyphMaterialTagName)
{
/* Retrieve glyph type as string and set it: */
setGlyphType(configFileSection.retrieveString(glyphTypeTagName,"None").c_str());
/* Retrieve the glyph material: */
glyphMaterial=configFileSection.retrieveValue<GLMaterial>(glyphMaterialTagName,glyphMaterial);
}
开发者ID:chebee7i,项目名称:Vrui,代码行数:8,代码来源:GlyphRenderer.cpp
示例9: getInputDeviceDataFileName
std::string InputDeviceDataSaver::getInputDeviceDataFileName(const Misc::ConfigurationFileSection& configFileSection)
{
/* Retrieve the base file name: */
std::string inputDeviceDataFileName=configFileSection.retrieveString("./inputDeviceDataFileName");
/* Make the file name unique: */
char numberedFileName[1024];
Misc::createNumberedFileName(inputDeviceDataFileName.c_str(),4,numberedFileName);
return numberedFileName;
}
开发者ID:VisualIdeation,项目名称:Vrui,代码行数:10,代码来源:InputDeviceDataSaver.cpp
示例10: saveConfiguration
void VideoDevice::saveConfiguration(Misc::ConfigurationFileSection& cfg) const
{
/* Get the device's current video format: */
VideoDataFormat currentFormat=getVideoFormat();
/* Save the current frame size: */
cfg.storeValueWC("./frameSize",currentFormat.size,Misc::CFixedArrayValueCoder<unsigned int,2>());
/* Save the current frame rate: */
cfg.storeValue("./frameRate",double(currentFormat.frameIntervalDenominator)/double(currentFormat.frameIntervalCounter));
/* Check if the current pixel format is a valid FourCC code: */
char fourCCBuffer[5];
currentFormat.getFourCC(fourCCBuffer);
bool valid=true;
for(int i=0;i<4&&valid;++i)
valid=fourCCBuffer[i]>=32&&fourCCBuffer[i]<127&&fourCCBuffer[i]!='"';
if(valid)
{
/* Save the current pixel format as a FourCC code: */
cfg.storeValue<std::string>("./pixelFormat",fourCCBuffer);
}
else
{
/* Save the current pixel format as a hexadecimal number: */
char hexBuffer[9];
unsigned int pixelFormat=currentFormat.pixelFormat;
for(int i=0;i<8;++i,pixelFormat>>=4)
{
if((pixelFormat&0x0fU)>=10U)
hexBuffer[7-i]=(pixelFormat&0x0fU)+'a';
else
hexBuffer[7-i]=(pixelFormat&0x0fU)+'0';
}
hexBuffer[8]='\0';
cfg.storeString("./pixelFormatHex",hexBuffer);
}
}
开发者ID:KeckCAVES,项目名称:Vrui,代码行数:38,代码来源:VideoDevice.cpp
示例11: numInputDevices
InputDeviceDataSaver::InputDeviceDataSaver(const Misc::ConfigurationFileSection& configFileSection,InputDeviceManager& inputDeviceManager)
:inputDeviceDataFile(getInputDeviceDataFileName(configFileSection).c_str(),"wb",Misc::File::LittleEndian),
numInputDevices(inputDeviceManager.getNumInputDevices()),
inputDevices(new InputDevice*[numInputDevices]),
soundRecorder(0),
firstFrame(true)
{
/* Save number of input devices: */
inputDeviceDataFile.write<int>(numInputDevices);
/* Save layout of all input devices in the input device manager: */
for(int i=0;i<numInputDevices;++i)
{
/* Get pointer to the input device: */
inputDevices[i]=inputDeviceManager.getInputDevice(i);
/* Save input device's layout: */
char name[40];
strncpy(name,inputDevices[i]->getDeviceName(),40);
name[39]='\0';
inputDeviceDataFile.write(name,40);
inputDeviceDataFile.write<int>(inputDevices[i]->getTrackType());
inputDeviceDataFile.write<int>(inputDevices[i]->getNumButtons());
inputDeviceDataFile.write<int>(inputDevices[i]->getNumValuators());
inputDeviceDataFile.write(inputDevices[i]->getDeviceRayDirection().getComponents(),3);
}
/* Check if the user wants to record a commentary track: */
std::string soundFileName=configFileSection.retrieveString("./soundFileName","");
if(soundFileName!="")
{
try
{
/* Create a sound data format for recording: */
Sound::SoundDataFormat soundFormat;
soundFormat.bitsPerSample=configFileSection.retrieveValue<int>("./sampleResolution",soundFormat.bitsPerSample);
soundFormat.samplesPerFrame=configFileSection.retrieveValue<int>("./numChannels",soundFormat.samplesPerFrame);
soundFormat.framesPerSecond=configFileSection.retrieveValue<int>("./sampleRate",soundFormat.framesPerSecond);
/* Create a sound recorder for the given sound file name: */
char numberedFileName[1024];
soundRecorder=new Sound::SoundRecorder(soundFormat,Misc::createNumberedFileName(soundFileName.c_str(),4,numberedFileName));
}
catch(std::runtime_error error)
{
/* Print a message, but carry on: */
std::cerr<<"InputDeviceDataSaver: Disabling sound recording due to exception "<<error.what()<<std::endl;
}
}
}
开发者ID:VisualIdeation,项目名称:Vrui,代码行数:50,代码来源:InputDeviceDataSaver.cpp
示例12: configFileSection
VisletManager::VisletManager(const Misc::ConfigurationFileSection& sConfigFileSection)
:Plugins::FactoryManager<VisletFactory>(sConfigFileSection.retrieveString("./visletDsoNameTemplate",SYSVISLETDSONAMETEMPLATE)),
configFileSection(sConfigFileSection)
{
typedef std::vector<std::string> StringList;
/* Get additional search paths from configuration file section and add them to the factory manager: */
StringList visletSearchPaths=configFileSection.retrieveValue<StringList>("./visletSearchPaths",StringList());
for(StringList::const_iterator vspIt=visletSearchPaths.begin();vspIt!=visletSearchPaths.end();++vspIt)
{
/* Add the path: */
getDsoLocator().addPath(*vspIt);
}
}
开发者ID:jrevote,项目名称:3DA-Vrui,代码行数:14,代码来源:VisletManager.cpp
示例13: createInputDevice
void InputDeviceAdapter::createInputDevice(int deviceIndex,const Misc::ConfigurationFileSection& configFileSection)
{
/* Read input device name: */
std::string name=configFileSection.retrieveString("./name");
/* Determine input device type: */
int trackType=InputDevice::TRACK_NONE;
std::string trackTypeString=configFileSection.retrieveString("./trackType","None");
if(trackTypeString=="None")
trackType=InputDevice::TRACK_NONE;
else if(trackTypeString=="3D")
trackType=InputDevice::TRACK_POS;
else if(trackTypeString=="Ray")
trackType=InputDevice::TRACK_POS|InputDevice::TRACK_DIR;
else if(trackTypeString=="6D")
trackType=InputDevice::TRACK_POS|InputDevice::TRACK_DIR|InputDevice::TRACK_ORIENT;
else
Misc::throwStdErr("InputDeviceAdapter: Unknown tracking type \"%s\"",trackTypeString.c_str());
/* Determine numbers of buttons and valuators: */
int numButtons=configFileSection.retrieveValue<int>("./numButtons",0);
int numValuators=configFileSection.retrieveValue<int>("./numValuators",0);
/* Create new input device as a physical device: */
InputDevice* newDevice=inputDeviceManager->createInputDevice(name.c_str(),trackType,numButtons,numValuators,true);
Vector deviceRayDirection=configFileSection.retrieveValue<Vector>("./deviceRayDirection",Vector(0,1,0));
Scalar deviceRayStart=configFileSection.retrieveValue<Scalar>("./deviceRayStart",-getInchFactor());
newDevice->setDeviceRay(deviceRayDirection,deviceRayStart);
/* Initialize the new device's glyph from the current configuration file section: */
Glyph& deviceGlyph=inputDeviceManager->getInputGraphManager()->getInputDeviceGlyph(newDevice);
deviceGlyph.configure(configFileSection,"./deviceGlyphType","./deviceGlyphMaterial");
/* Save the new input device: */
inputDevices[deviceIndex]=newDevice;
}
开发者ID:Doc-Ok,项目名称:OpticalTracking,代码行数:36,代码来源:InputDeviceAdapter.cpp
示例14:
void SixAxisNavigationToolFactory::Configuration::load(const Misc::ConfigurationFileSection& cfs)
{
/* Get parameters: */
translateFactor=cfs.retrieveValue<Scalar>("./translateFactor",translateFactor);
translations=cfs.retrieveValue<Misc::FixedArray<Vector,3> >("./translationVectors",translations);
rotateFactor=cfs.retrieveValue<Scalar>("./rotateFactor",rotateFactor);
rotations=cfs.retrieveValue<Misc::FixedArray<Vector,3> >("./scaledRotationAxes",rotations);
zoomFactor=cfs.retrieveValue<Scalar>("./zoomFactor",zoomFactor);
if(cfs.hasTag("./navigationCenter"))
navigationCenter=cfs.retrieveValue<Point>("./navigationCenter",navigationCenter);
else
followDisplayCenter=true;
invertNavigation=cfs.retrieveValue<bool>("./invertNavigation",invertNavigation);
showNavigationCenter=cfs.retrieveValue<bool>("./showNavigationCenter",showNavigationCenter);
}
开发者ID:Doc-Ok,项目名称:OpticalTracking,代码行数:15,代码来源:SixAxisNavigationTool.cpp
示例15:
void SixAxisTransformToolFactory::Configuration::load(const Misc::ConfigurationFileSection& cfs)
{
/* Get parameters: */
translateFactor=cfs.retrieveValue<Scalar>("./translateFactor",translateFactor);
translations=cfs.retrieveValue<Misc::FixedArray<Vector,3> >("./translationVectors",translations);
rotateFactor=cfs.retrieveValue<Scalar>("./rotateFactor",rotateFactor);
rotations=cfs.retrieveValue<Misc::FixedArray<Vector,3> >("./scaledRotationAxes",rotations);
if(cfs.hasTag("./homePosition"))
{
followDisplayCenter=false;
homePosition=cfs.retrieveValue<Point>("./homePosition",homePosition);
}
deviceGlyphType=cfs.retrieveValue<std::string>("./deviceGlyphType",deviceGlyphType);
deviceGlyphMaterial=cfs.retrieveValue<GLMaterial>("./deviceGlyphMaterial",deviceGlyphMaterial);
}
开发者ID:PengfeiXuAI,项目名称:Sandbox,代码行数:15,代码来源:SixAxisTransformTool.cpp
示例16: storeState
void VectorEvaluationLocator::storeState(Misc::ConfigurationFileSection& configFileSection) const
{
Visualization::Abstract::VariableManager* vm=application->variableManager;
/* Write the algorithm type: */
configFileSection.storeString("./algorithm","Evaluate Vectors");
/* Write the vector variable name: */
configFileSection.storeValue<std::string>("./vectorVariableName",vm->getVectorVariableName(vm->getVectorVariable(vectorExtractor)));
/* Write the scalar variable name: */
configFileSection.storeValue<std::string>("./scalarVariableName",vm->getScalarVariableName(vm->getScalarVariable(scalarExtractor)));
/* Write the evaluation dialog's position: */
GLMotif::writeTopLevelPosition(evaluationDialogPopup,configFileSection);
}
开发者ID:jrevote,项目名称:3DA-3DVisualizer,代码行数:16,代码来源:VectorEvaluationLocator.cpp
示例17: storeState
void ExtractorLocator::storeState(Misc::ConfigurationFileSection& configFileSection) const
{
/* Write the algorithm type: */
configFileSection.storeString("./algorithm",extractor->getName());
/* Write the algorithm's current parameters: */
Visualization::Abstract::ConfigurationFileParametersSink sink(application->variableManager,configFileSection);
Visualization::Abstract::Parameters* parameters=extractor->cloneParameters();
parameters->write(sink);
delete parameters;
if(settingsDialog!=0)
{
/* Write the settings dialog's current position and size: */
GLMotif::writeTopLevelPosition(settingsDialog,configFileSection);
}
}
开发者ID:jaccen,项目名称:3DVisualizer,代码行数:17,代码来源:ExtractorLocator.cpp
示例18: initializeAdapter
void InputDeviceAdapter::initializeAdapter(const Misc::ConfigurationFileSection& configFileSection)
{
/* Allocate adapter state arrays: */
typedef std::vector<std::string> StringList;
StringList inputDeviceNames=configFileSection.retrieveValue<StringList>("./inputDeviceNames");
numInputDevices=inputDeviceNames.size();
inputDevices=new InputDevice*[numInputDevices];
for(int i=0;i<numInputDevices;++i)
inputDevices[i]=0;
/* Initialize input devices: */
for(int i=0;i<numInputDevices;++i)
{
/* Go to device's section: */
Misc::ConfigurationFileSection deviceSection=configFileSection.getSection(inputDeviceNames[i].c_str());
/* Initialize input device: */
createInputDevice(i,deviceSection);
}
}
开发者ID:Doc-Ok,项目名称:OpticalTracking,代码行数:20,代码来源:InputDeviceAdapter.cpp
示例19: render
ToolKillZone::ToolKillZone(const Misc::ConfigurationFileSection& configFileSection)
:baseDevice(0),
render(true),
material(getWidgetMaterial()),
modelVersion(1)
{
/* Retrieve the name of the base device (if any) from the configuration file: */
std::string baseDeviceName=configFileSection.retrieveString("./killZoneBaseDevice","");
if(baseDeviceName!="")
{
/* Attach the kill zone to the base device: */
baseDevice=getInputDeviceManager()->findInputDevice(baseDeviceName.c_str());
if(baseDevice==0)
Misc::throwStdErr("ToolKillZone: Unknown base input device \"%s\"",baseDeviceName.c_str());
}
/* Retrieve the render flag: */
render=configFileSection.retrieveValue<bool>("./killZoneRender",render);
/* Retrieve the model material: */
material=configFileSection.retrieveValue<GLMaterial>("./killZoneMaterial",material);
}
开发者ID:VisualIdeation,项目名称:Vrui,代码行数:22,代码来源:ToolKillZone.cpp
示例20: initialize
void InputDeviceManager::initialize(const Misc::ConfigurationFileSection& configFileSection)
{
/* Retrieve the list of input device adapters: */
typedef std::vector<std::string> StringList;
StringList inputDeviceAdapterNames=configFileSection.retrieveValue<StringList>("./inputDeviceAdapterNames");
/* Remove all duplicates from the list of input device adapters: */
for(unsigned int i=0;i<inputDeviceAdapterNames.size()-1;++i)
{
for(unsigned int j=inputDeviceAdapterNames.size()-1;j>i;--j)
{
if(inputDeviceAdapterNames[j]==inputDeviceAdapterNames[i])
{
/* Remove the duplicate list entry: */
inputDeviceAdapterNames.erase(inputDeviceAdapterNames.begin()+j);
}
}
}
/* Initialize the adapter array: */
numInputDeviceAdapters=inputDeviceAdapterNames.size();
inputDeviceAdapters=new InputDeviceAdapter*[numInputDeviceAdapters];
/* Initialize input device adapters: */
int numIgnoredAdapters=0;
int mouseAdapterIndex=-1;
for(int i=0;i<numInputDeviceAdapters;++i)
{
/* Go to input device adapter's section: */
Misc::ConfigurationFileSection inputDeviceAdapterSection=configFileSection.getSection(inputDeviceAdapterNames[i].c_str());
/* Determine input device adapter's type: */
std::string inputDeviceAdapterType=inputDeviceAdapterSection.retrieveString("./inputDeviceAdapterType");
bool typeFound=true;
try
{
if(inputDeviceAdapterType=="Mouse")
{
/* Check if there is already a mouse input device adapter: */
if(mouseAdapterIndex>=0)
{
/* Ignore this input device adapter: */
inputDeviceAdapters[i]=0;
++numIgnoredAdapters;
std::cout<<"InputDeviceManager: Ignoring mouse input device adapter "<<inputDeviceAdapterNames[i]<<" because there is already a mouse input device adapter"<<std::endl;
}
else
{
/* Create mouse input device adapter: */
inputDeviceAdapters[i]=new InputDeviceAdapterMouse(this,inputDeviceAdapterSection);
mouseAdapterIndex=i;
}
}
else if(inputDeviceAdapterType=="DeviceDaemon")
{
/* Create device daemon input device adapter: */
inputDeviceAdapters[i]=new InputDeviceAdapterDeviceDaemon(this,inputDeviceAdapterSection);
}
else if(inputDeviceAdapterType=="Trackd")
{
/* Create trackd input device adapter: */
inputDeviceAdapters[i]=new InputDeviceAdapterTrackd(this,inputDeviceAdapterSection);
}
else if(inputDeviceAdapterType=="VisBox")
{
/* Create VisBox input device adapter: */
inputDeviceAdapters[i]=new InputDeviceAdapterVisBox(this,inputDeviceAdapterSection);
}
else if(inputDeviceAdapterType=="HID")
{
/* Create HID input device adapter: */
inputDeviceAdapters[i]=new InputDeviceAdapterHID(this,inputDeviceAdapterSection);
}
else if(inputDeviceAdapterType=="Playback")
{
/* Create device daemon input device adapter: */
inputDeviceAdapters[i]=new InputDeviceAdapterPlayback(this,inputDeviceAdapterSection);
}
else
typeFound=false;
}
catch(std::runtime_error err)
{
/* Print a warning message: */
std::cout<<"InputDeviceManager: Ignoring input device adapter "<<inputDeviceAdapterNames[i];
std::cout<<" due to exception "<<err.what()<<std::endl;
/* Ignore the input device adapter: */
inputDeviceAdapters[i]=0;
++numIgnoredAdapters;
}
if(!typeFound)
Misc::throwStdErr("InputDeviceManager: Unknown input device adapter type \"%s\"",inputDeviceAdapterType.c_str());
}
if(numIgnoredAdapters!=0)
{
/* Remove any ignored input device adapters from the array: */
InputDeviceAdapter** newInputDeviceAdapters=new InputDeviceAdapter*[numInputDeviceAdapters-numIgnoredAdapters];
//.........这里部分代码省略.........
开发者ID:PengfeiXuAI,项目名称:Sandbox,代码行数:101,代码来源:InputDeviceManager.cpp
注:本文中的misc::ConfigurationFileSection类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论