本文整理汇总了C++中ofXml::exists方法的典型用法代码示例。如果您正苦于以下问题:C++ ofXml::exists方法的具体用法?C++ ofXml::exists怎么用?C++ ofXml::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofXml
的用法示例。
在下文中一共展示了ofXml::exists方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadXML
void Render::loadXML(ofXml &xml) {
if (xml.exists("[@vsync]")) {
string str = ofToString( xml.getAttribute("[@vsync]") );
if (str == "on") vsync = true;
else vsync = false;
}
if (xml.exists("[@framerate]"))
framerate = ofToInt( xml.getAttribute("[@framerate]") );
setup();
}
示例2: loadXML
void Socket::loadXML(ofXml &xml) {
if (xml.exists("socket[@enabled]")) {
string str = ofToString(xml.getAttribute("socket[@enabled]"));
if (str == "on") enabled = true;
else enabled = false;
}
if (xml.exists("socket[@host]"))
host = ofToString( xml.getAttribute("socket[@host]") );
if (xml.exists("socket[@send]"))
send = ofToInt( xml.getAttribute("socket[@send]") );
if (xml.exists("socket[@receive]"))
receive = ofToInt( xml.getAttribute("socket[@receive]") );
if (enabled)
setup();
}
示例3: loadXML
void Projector::loadXML(ofXml &xml) {
string str;
if (xml.exists("[@resolution]")) {
str = xml.getAttribute("[@resolution]");
width = ofToFloat(ofSplitString(str, ",")[0]);
height = ofToFloat(ofSplitString(str, ",")[1]);
}
}
示例4: ofToFloat
void Projector::loadXML2(ofXml &xml) {
string str;
float val;
// color
if (xml.exists("[@brightness]")) {
brightness = ofToFloat( xml.getAttribute("[@brightness]"));
}
if (xml.exists("[@contrast]")) {
contrast = ofToFloat( xml.getAttribute("[@contrast]") );
}
if (xml.exists("[@saturation]")) {
saturation = ofToFloat( xml.getAttribute("[@saturation]") );
}
// plane warp
plane.width = width;
plane.height = height;
plane.load(xml, projectorStartingIndex);
// camera position
if (xml.exists("[@position]")) {
str = xml.getAttribute("[@position]");
float azi = ofToFloat(ofSplitString(str, ",")[0]);
float ele = ofToFloat(ofSplitString(str, ",")[1]);
float dis = ofToFloat(ofSplitString(str, ",")[2]);
setCameraPosition(azi, ele, dis);
}
// camera orientation
if (xml.exists("[@orientation]")) {
str = xml.getAttribute("[@orientation]");
float roll = ofToFloat(ofSplitString(str, ",")[0]);
float tilt = ofToFloat(ofSplitString(str, ",")[1]);
float pan = ofToFloat(ofSplitString(str, ",")[2]);
setCameraOrientation(roll, tilt, pan);
}
// camera lens fov
if (xml.exists("[@fov]")) {
val = ofToFloat( xml.getAttribute("[@fov]") );
setCameraFov(val);
}
//camera lens offset
if (xml.exists("[@offset]")) {
str = xml.getAttribute("[@offset]");
float offX = ofToFloat(ofSplitString(str, ",")[0]);
float offY = ofToFloat(ofSplitString(str, ",")[1]);
setCameraOffset(offX, offY);
}
curves.load(projectorStartingIndex);
mask.width = width;
mask.height = height;
mask.load(projectorStartingIndex);
}
示例5: setFromXml
void ofxControlPanel::setFromXml(ofXml &xml)
{
ofxControlWidget::setFromXml(xml);
if (xml.exists("Sequencer"))
{
if (!sequencerMade) {
createSequencer();
}
sequencer->setFromXml(xml);
}
else {
ofLog(OF_LOG_ERROR, "No sequencer found in preset");
}
}
示例6: loadSequencerFromXml
void ofxControlPanel::loadSequencerFromXml(ofXml &xml)
{
if (xml.exists("Sequencer"))
{
xml.setTo("Sequencer");
if (!sequencerMade) {
createSequencer();
}
sequencer->setFromXml(xml);
xml.setToParent();
}
else {
ofLog(OF_LOG_ERROR, "No sequencer found in preset");
}
}
示例7:
bool ofxFadeEffect::settings::deserialize( ofXml X )
{
ofParameterGroup G;
G.setName("fxShake_Settings");
X.deserialize(G);
bool bSuc = X.exists(G.getName());
if(bSuc)
{
alphaFrom = G.getInt("alphaFrom");
alphaTo = G.getInt("alphaTo");
time = G.getFloat("time");
delay = G.getFloat("delay");
}
return bSuc;
}
示例8:
bool ofxImageThing::settings::deserialize( ofXml X )
{
ofParameterGroup G;
G.setName("ofxImageThing_Settings");
X.deserialize(G);
bool bSuc = X.exists(G.getName());
if(bSuc)
{
imgPath= G.getString("imgPath");
imgColor = G.getColor("imgColor");
width = G.getFloat("width");
height = G.getFloat("height");
imgAlpha = G.getFloat("imgAlpha");
}
return bSuc;
}
示例9: addClass
void KinectV2Classifier::setFromLearnXml(ofXml &xml)
{
xml.setTo("LearnInfo");
if (xml.exists("Classes")) {
xml.setTo("Classes");
if (xml.exists("Class[0]"))
{
xml.setTo("Class[0]");
do {
addClass(xml.getValue<string>("Name"));
}
while(xml.setToSibling());
xml.setToParent();
}
xml.setToParent();
}
if (xml.exists("Ranges")) {
xml.setTo("Ranges");
if (xml.exists("Joint[0]"))
{
int idx = 0;
xml.setTo("Joint[0]");
do {
min[idx] = xml.getValue<float>("Min");
max[idx] = xml.getValue<float>("Max");
idx++;
}
while(xml.setToSibling());
xml.setToParent();
}
xml.setToParent();
}
if (xml.exists("Training")) {
xml.setTo("Training");
if (xml.exists("Entry[0]"))
{
xml.setTo("Entry[0]");
do {
double label = xml.getValue<double>("Label");
vector<string> featureVectorS = ofSplitString(xml.getValue<string>("Features"), ",");
vector<float> entry;
entry.push_back(label);
for (auto f : featureVectorS) {
entry.push_back(ofToFloat(f));
}
data.addEntry(entry);
}
while(xml.setToSibling());
xml.setToParent();
}
xml.setToParent();
}
if (xml.exists("Model")) {
xml.setTo("Model");
string path = xml.getValue<string>("Path");
svm.loadModel(path);
trained = true;
xml.setToParent();
}
xml.setToParent();
}