Beispiel #1
0
void XmlOutput::addAttributeTag(const QString &attribute, const QString &value)
{
     switch(currentState) {
        case Bare:
        case Tag:
            //warn_msg(WarnLogic, "<%s>: Cannot add attribute since tags not open", tagStack.last().toLatin1().constData());
            qDebug("<%s>: Cannot add attribute (%s) since tag's not open",
                   (tagStack.count() ? tagStack.last().toLatin1().constData() : "Root"),
                   attribute.toLatin1().constData());
            return;
        case Attribute:
            break;
    }
    xmlFile << " " << doConversion(attribute) << "=\"" << doConversion(value) << "\"";
}
Beispiel #2
0
void XmlOutput::addDeclaration(const QString &version, const QString &encoding)
{
    switch(currentState) {
        case Bare:
            break;
        case Tag:
        case Attribute:
            //warn_msg(WarnLogic, "<%s>: Cannot add declaration when not in bare state", tagStack.last().toLatin1().constData());
            qDebug("<%s>: Cannot add declaration when not in bare state", tagStack.last().toLatin1().constData());
            return;
    }
    QString outData = QString("<?xml version=\"%1\" encoding=\"%2\"?>")
                              .arg(doConversion(version))
                              .arg(doConversion(encoding));
    addRaw(outData);
}
Beispiel #3
0
void XmlOutput::closeTag()
{
    switch(currentState) {
        case Bare:
            if (tagStack.count())
                //warn_msg(WarnLogic, "<Root>: Cannot close tag in Bare state, %d tags on stack", tagStack.count());
                qDebug("<Root>: Cannot close tag in Bare state, %d tags on stack", tagStack.count());
            else
                //warn_msg(WarnLogic, "<Root>: Cannot close tag, no tags on stack");
                qDebug("<Root>: Cannot close tag, no tags on stack");
            return;
        case Tag:
            decreaseIndent(); // <--- Pre-decrease indent
            if (format == NewLine)
                xmlFile << endl << currentIndent;
            xmlFile << "</" << doConversion(tagStack.last()) << '>';
            tagStack.pop_back();
            break;
        case Attribute:
            xmlFile << " />";
            tagStack.pop_back();
            currentState = Tag;
            decreaseIndent(); // <--- Post-decrease indent
            break;
    }
}
void
SoBuiltinFieldConverter::evaluate()
//
////////////////////////////////////////////////////////////////////////
{
    // For efficiency and to reduce bloat, we don't use the standard
    // SO_ENGINE_OUTPUT macro:

#ifdef DEBUG
    if (input == NULL) {
	SoDebugError::post("(internal) SoBuiltinFieldConverter::evaluate",
			   "NULL input field");
	return;
    }
#endif    

    // We know that our engineOutput cannot be disabled, since nobody
    // but us has access to it. If we are connected from an
    // engineOutput and that engineOutput is disabled, we still want
    // to convert that value - this will happen the first time this
    // engine is evaluated after the output is disabled. After the
    // first time, notification will be blocked, so we don't have to
    // check for a disabled output here.

    for (int i = 0; i < output->getNumConnections(); i++) {
	SoField *outField = (*output)[i];
	if (!outField->isReadOnly())
	    doConversion(outField);
    }
}
void LiftedAlgsConvertor::doLISApproxZ(LvrParams* params)
{
	vector<vector<int> > evidenceIntRep;
	vector<vector<int> > queriesIntRep;
	vector<string> queryStrings;
	doConversion(queriesIntRep,evidenceIntRep,queryStrings,false);
	liftedAlgsHandler->LISApproxPartition(params);
}
void LiftedAlgsConvertor::doLISApproxMar(LvrParams* params)
{
	vector<vector<int> > evidenceIntRep;
	vector<vector<int> > queriesIntRep;
	vector<string> queryStrings;
	doConversion(queriesIntRep,evidenceIntRep,queryStrings,false);
	//create the singleton instance for queries
	LvrQueryUpdater::createInstance(queriesIntRep,queryStrings,
			params->resultFile,&evidenceIntRep);
	liftedAlgsHandler->LISApproxMarginals(params);

}
Beispiel #7
0
void XmlOutput::newTagOpen(const QString &tag)
{
    Q_ASSERT_X(tag.count(), "XmlOutput", "Cannot open an empty tag");
    closeOpen();

    if (format == NewLine)
        xmlFile << endl << currentIndent;
    xmlFile << '<' << doConversion(tag);
    currentState = Attribute;
    tagStack.append(tag);
    increaseIndent(); // ---> indent
}
Beispiel #8
0
XmlOutput& XmlOutput::operator<<(const xml_output& o)
{
    switch(o.xo_type) {
    case tNothing:
        break;
    case tRaw:
        addRaw(o.xo_text);
        break;
    case tDeclaration:
        addDeclaration(o.xo_text, o.xo_value);
        break;
    case tTag:
        newTagOpen(o.xo_text);
        break;
    case tCloseTag:
        if (o.xo_value.count())
            closeAll();
        else if (o.xo_text.count())
            closeTo(o.xo_text);
        else
            closeTag();
        break;
    case tAttribute:
        addAttribute(o.xo_text, o.xo_value);
        break;
    case tData:
        {
            // Special case to be able to close tag in normal
            // way ("</tag>", not "/>") without using addRaw()..
            if (!o.xo_text.count()) {
                closeOpen();
                break;
            }
            QString output = doConversion(o.xo_text);
            output.replace('\n', "\n" + currentIndent);
            addRaw(QString("\n%1%2").arg(currentIndent).arg(output));
        }
        break;
    case tComment:
        {
            QString output("<!--%1-->");
            addRaw(output.arg(o.xo_text));
        }
        break;
    case tCDATA:
        {
            QString output("<![CDATA[\n%1\n]]>");
            addRaw(output.arg(o.xo_text));
        }
        break;
    }
    return *this;
}
void LiftedAlgsConvertor::doLBGMar(LvrParams* params)
{
	vector<vector<int> > evidenceIntRep;
	vector<vector<int> > queriesIntRep;
	vector<string> queryStrings;
	doConversion(queriesIntRep,evidenceIntRep,queryStrings,true);
	if(params->operationMode != ECLUSTERING)
	{
		//create the singleton instance for queries
		LvrQueryUpdater::createInstance(queriesIntRep,queryStrings,
				params->resultFile,&evidenceIntRep);
	}
	//obtain the string representations of all queries to display
	
	liftedAlgsHandler->LBGApproxMarginals(params);
}
Beispiel #10
0
void FormConversion::fahrenheitButtonClicked() {
    UnitConversionInstruction::tempFrom = UnitConversionInstruction::tempTo;
    UnitConversionInstruction::tempTo = 'f';
    doConversion();
}
Beispiel #11
0
void FormConversion::celciusButtonClicked() {
    UnitConversionInstruction::tempFrom = UnitConversionInstruction::tempTo;
    UnitConversionInstruction::tempTo = 'c';
    doConversion();
}
Beispiel #12
0
void FormConversion::kelvinButtonClicked() {
    UnitConversionInstruction::tempFrom = UnitConversionInstruction::tempTo;
    UnitConversionInstruction::tempTo = 'k';
    doConversion();
}
Beispiel #13
0
void FormConversion::conversionButtonClicked() {
    doConversion();
}
Beispiel #14
0
int main(int argc, const char *argv[])
{
  // Init Default
  RegistrationConfig reg_cfg;
  reg_cfg.configFile3D_.clear();
  reg_cfg.initTrans_.clear();
  reg_cfg.initTrans_.append("0,0,0");
  ConvertOctomapConfig co_cfg;
  co_cfg.octomap_resolution = 0.1; // was always 0.1 for mav and atlas
  co_cfg.blur_sigma = 0.1; // default was .5
  co_cfg.blur_map = false;
  AppConfig app_cfg;

  const int ret = validateArgs(argc, argv, reg_cfg, co_cfg);

  if (ret == -1)
    return ret;

  if (reg_cfg.cloud_name_A.empty())
  {
    reg_cfg.cloud_name_A.append(reg_cfg.homedir);
    reg_cfg.cloud_name_A.append("/logs/multisenselog__2015-11-16/pointclouds/multisense_00.vtk");	
  }
  if (reg_cfg.cloud_name_B.empty())
  {    
  	reg_cfg.cloud_name_B.append(reg_cfg.homedir);
    reg_cfg.cloud_name_B.append("/logs/multisenselog__2015-11-16/pointclouds/multisense_01.vtk");	
  }

  //std::cout << "Blur sigma: " << co_cfg.blur_sigma << "\n";

  //Set up LCM channel for visualization
  boost::shared_ptr<lcm::LCM> lcm(new lcm::LCM);
  if(!lcm->good()){
    std::cerr <<"ERROR: lcm is not good()" <<std::endl;
  }

  App* app = new App(lcm, reg_cfg, co_cfg, app_cfg);     
  
  // Load point clouds from file
  DP ref = DP::load(reg_cfg.cloud_name_A);
  DP data = DP::load(reg_cfg.cloud_name_B);
  
  //=================================
  // TRANSFORM 3D CLOUD
  //=================================

  app->registr_->getICPTransform(data, ref);
  
  PM::TransformationParameters T = app->registr_->getTransform();
  cout << "3D Transformation:" << endl << T << endl;

  //=================================
  // CONVERT CLOUD TO OCTREE
  //================================= 

  app->do_convert_cloud_ = true; 

  if ( app->do_convert_cloud_ ) {

    ColorOcTree* treeA = doConversion(app, 0);
    //cout << "Pruned tree A size: " << treeA->size() <<" nodes." << endl;
    cout << "Changes A:" << endl;
    app->convert_->printChangesAndActual(*treeA);

    // Uncomment for visualization of matching results one by one:
    cout << "Press ENTER to continue..." << endl;
    cin.get();
    
    ColorOcTree* treeB = doConversion(app, 1);
    //cout << "Pruned tree B size: " << treeB->size() <<" nodes." << endl;
    cout << "Changes B:" << endl;
    app->convert_->printChangesByColor(*treeB);
  }
  
  return 0;
}