Example #1
0
abcAncError::abcAncError(const char *outfiles,argStruct *arguments,int inputtype){
  tsk_outname=NULL;
  doAncError=0;
  currentChr=-1;
  refName=NULL;
  ancName=NULL;
  outfile = NULL;
  outfile2= NULL;
  if(arguments->argc==2){
    if(!strcasecmp(arguments->argv[1],"-doAncError")){
      printArg(stdout);
      exit(0);
    }else
      return;
  }
  
  getOptions(arguments);


  if(doAncError==0){
    shouldRun[index] =0;
    return;
  }
  printArg(arguments->argumentFile);

  //make output files
  const char* postfix;
  postfix=".ancError";
  outfile = aio::openFile(outfiles,postfix);
  //put the name of the outputfile into tsk_outname
  tsk_outname=(char*)malloc(strlen(outfiles)+strlen(postfix)+1);
  sprintf(tsk_outname,"%s%s",outfiles,postfix);
  
  const char* postfix2;
  postfix2=".ancErrorChr";
  outfile2 = aio::openFile(outfiles,postfix2);

  //allocate allele counts
  alleleCounts = new size_t *[nInd];
  for(int i=0;i<nInd;i++)
    alleleCounts[i] = new size_t [256];
  for(int i=0;i<nInd;i++)
    for(int j=0;j<256;j++)
      alleleCounts[i][j]=0;

  alleleCountsChr = new size_t *[nInd];
  for(int i=0;i<nInd;i++)
    alleleCountsChr[i] = new size_t [256];
  for(int i=0;i<nInd;i++)
    for(int j=0;j<256;j++)
      alleleCountsChr[i][j]=0;
}
Example #2
0
void CMainFrame::updateCheckedMenuItems() {
  const Options &options = getOptions();
  checkMenuItem(this, ID_OPTIONS_IGNOREBLANKS  , options.m_ignoreWhiteSpace );
  checkMenuItem(this, ID_OPTIONS_IGNORECASE    , options.m_ignoreCase       );
  checkMenuItem(this, ID_OPTIONS_IGNORESTRINGS , options.m_ignoreStrings    );
  checkMenuItem(this, ID_OPTIONS_IGNORECOMMENTS, options.m_ignoreComments   );
  checkMenuItem(this, ID_OPTIONS_IGNORECOLUMNS , options.m_ignoreColumns    );
  checkMenuItem(this, ID_OPTIONS_IGNOREREGEX   , options.m_ignoreRegex      );
  checkMenuItem(this, ID_OPTIONS_STRIPCOMMENTS , options.m_stripComments    );
  checkMenuItem(this, ID_VIEW_SHOWWHITESPACE   , options.m_viewWhiteSpace   );
  checkMenuItem(this, ID_VIEW_SHOW1000SEPARATOR, options.m_show1000Separator);
  updateNameFontSizeMenuItems(options.m_nameFontSizePct);
}
void ContentBlockingInformationWidget::updateState()
{
	m_icon = (isCustomized() ? getOptions().value(QLatin1String("icon")).value<QIcon>() : QIcon());

	if (m_icon.isNull())
	{
		m_icon = ThemesManager::createIcon(QLatin1String("content-blocking"));
	}

	const int iconSize(this->iconSize().width());
	const int fontSize(qMax((iconSize / 2), 12));
	QFont font(this->font());
	font.setBold(true);
	font.setPixelSize(fontSize);

	QString label;

	if (m_amount > 999999)
	{
		label = QString::number(m_amount / 1000000) + QLatin1Char('M');
	}
	else if (m_amount > 999)
	{
		label = QString::number(m_amount / 1000) + QLatin1Char('K');
	}
	else
	{
		label = QString::number(m_amount);
	}

	const qreal labelWidth(QFontMetricsF(font).width(label));

	font.setPixelSize(fontSize * 0.8);

	QRectF rectangle((iconSize - labelWidth), (iconSize - fontSize), labelWidth, fontSize);
	QPixmap pixmap(m_icon.pixmap(iconSize, iconSize, (m_isContentBlockingEnabled ? QIcon::Normal : QIcon::Disabled)));
	QPainter iconPainter(&pixmap);
	iconPainter.fillRect(rectangle, (m_isContentBlockingEnabled ? Qt::darkRed : Qt::darkGray));
	iconPainter.setFont(font);
	iconPainter.setPen(QColor(255, 255, 255, 230));
	iconPainter.drawText(rectangle, Qt::AlignCenter, label);

	m_icon = QIcon(pixmap);

	setText(getText());
	setToolTip(text());
	setIcon(m_icon);

	m_elementsMenu->setEnabled(m_amount > 0);
}
Example #4
0
boost::property_tree::ptree Reader::serializePipeline() const
{
    boost::property_tree::ptree tree;

    tree.add("<xmlattr>.type", getName());

    PipelineWriter::write_option_ptree(tree, getOptions());
    PipelineWriter::write_metadata_ptree(tree, getMetadata());

    boost::property_tree::ptree root;
    root.add_child("Reader", tree);

    return root;
}
Example #5
0
// set all options in array
void
Semantic::setOptions(Array<List<Semantic * > > &asubx) const
{
	int imax = asubx.getSize();
	for (int i=0; i < imax; i++)
	{
		ListIterator<Semantic * > ai(asubx[i]);
		for ( ; !ai.done(); ai++)
		{
			ai()->setOptions(getOptions());
		}
	}
	return;
}
Example #6
0
abcDstat::abcDstat(const char *outfiles,argStruct *arguments,int inputtype){
  rmTrans = 0;
  outfile=NULL;
  ancName=NULL;
  doAbbababa=0;
  doCount=0;
  
  currentChr=-1;
  NbasesPerLine=50;
  blockSize=5000000;
  block=0;
  if(arguments->argc==2){
    if(!strcasecmp(arguments->argv[1],"-doAbbababa")){
      printArg(stdout);
      exit(0);
    }else
      return;
  }
  
  getOptions(arguments);
  printArg(arguments->argumentFile);

  if(doAbbababa==0){
    shouldRun[index] = 0;
    return;
}
  //make output files
  const char* postfix;
  postfix=".abbababa";
  outfile = aio::openFile(outfiles,postfix);
  //  const char* postfix2;
  //  postfix2=".fastaChr";
  //  outfile2 = openFile(outfiles,postfix2);

  bufstr.s=NULL;
  bufstr.m=0;
  bufstr.l=0;


  //the number of combinations
  nComb=arguments->nInd*(arguments->nInd-1)*(arguments->nInd-2)/2;
  ABBA = new int[nComb];
  BABA = new int[nComb];


  calcMatCat();
  //pre calc all posible combinations


}
Example #7
0
void Colorization::collectOptions()
{

    Options options = getOptions();

    std::vector<Option> dimensions = options.getOptions("dimension");
    std::vector<Option>::const_iterator i;

    if (dimensions.size() == 0)
    {
        // No dimension mappings were given. We'll just assume
        // Red => 1
        // Green => 2
        // Blue => 3

        m_band_map.insert(std::pair<std::string, boost::uint32_t>("Red", 1));
        m_scale_map.insert(std::pair<std::string, double>("Red", 1.0));
        m_band_map.insert(std::pair<std::string, boost::uint32_t>("Green", 2));
        m_scale_map.insert(std::pair<std::string, double>("Green", 1.0));
        m_band_map.insert(std::pair<std::string, boost::uint32_t>("Blue", 3));
        m_scale_map.insert(std::pair<std::string, double>("Blue", 1.0));
        log()->get(logDEBUG) << "No dimension mappings were given. Using default mappings." << std::endl;

        return;
    }
    for (i = dimensions.begin(); i != dimensions.end(); ++i)
    {
        boost::optional<Options const&> dimensionOptions = i->getOptions();
        boost::uint32_t band_id(65536);
        double scale(1.0);
        std::string name = i->getValue<std::string>();
        if (dimensionOptions)
        {
            band_id = dimensionOptions->getValueOrThrow<boost::uint32_t>("band");
            scale = dimensionOptions->getValueOrDefault<double>("scale", 1.0);
        }
        else
        {
            std::ostringstream oss;
            oss << "No band and scaling information given for dimension '" << name<< "'";
            throw pdal_error(oss.str());
        }

        m_band_map.insert(std::pair<std::string, boost::uint32_t>(name, band_id));
        m_scale_map.insert(std::pair<std::string, double>(name, scale));
    }

    return;
}
Example #8
0
void PrintDialog::storeValues()
{
	getOptions(); // options were not set get last options with this hack

	m_doc->Print_Options.printer = PrintDest->currentText();
	m_doc->Print_Options.filename = QDir::fromNativeSeparators(LineEdit1->text());
	m_doc->Print_Options.toFile = outputToFile();
	m_doc->Print_Options.copies = numCopies();
	m_doc->Print_Options.outputSeparations = outputSeparations();
	m_doc->Print_Options.separationName = separationName();
	m_doc->Print_Options.allSeparations = allSeparations();
	if (m_doc->Print_Options.outputSeparations)
		m_doc->Print_Options.useSpotColors = true;
	else
		m_doc->Print_Options.useSpotColors = doSpot();
	m_doc->Print_Options.useColor = color();
	m_doc->Print_Options.mirrorH  = mirrorHorizontal();
	m_doc->Print_Options.mirrorV  = mirrorVertical();
	m_doc->Print_Options.useICC   = ICCinUse();
	m_doc->Print_Options.doClip   = doClip();
	m_doc->Print_Options.doGCR    = doGCR();
	m_doc->Print_Options.prnEngine= printEngine();
	m_doc->Print_Options.setDevParam = doDev();
	m_doc->Print_Options.useDocBleeds  = docBleeds->isChecked();
	m_doc->Print_Options.bleeds.Top    = BleedTop->value() / m_doc->unitRatio();
	m_doc->Print_Options.bleeds.Left   = BleedLeft->value() / m_doc->unitRatio();
	m_doc->Print_Options.bleeds.Right  = BleedRight->value() / m_doc->unitRatio();
	m_doc->Print_Options.bleeds.Bottom = BleedBottom->value() / m_doc->unitRatio();
	m_doc->Print_Options.markLength = markLength->value() / m_doc->unitRatio();
	m_doc->Print_Options.markOffset = markOffset->value() / m_doc->unitRatio();
	m_doc->Print_Options.cropMarks  = cropMarks->isChecked();
	m_doc->Print_Options.bleedMarks = bleedMarks->isChecked();
	m_doc->Print_Options.registrationMarks = registrationMarks->isChecked();
	m_doc->Print_Options.colorMarks = colorMarks->isChecked();
	m_doc->Print_Options.includePDFMarks = usePDFMarks->isChecked();
	if (OtherCom->isChecked())
	{
		m_doc->Print_Options.printerCommand = Command->text();
		m_doc->Print_Options.useAltPrintCommand = true;
	}
	else
		m_doc->Print_Options.useAltPrintCommand = false;
#ifdef HAVE_CUPS
	m_doc->Print_Options.printerOptions = PrinterOpts;
#else
	m_doc->Print_Options.printerOptions = QString();
#endif
	m_doc->Print_Options.devMode = DevMode;
}
Example #9
0
  Framework::OptionsReturnCode CLASSNAME::processOptions(
    int argc, char** argv)
  {

    std::stringstream ssFoo;
    ssFoo << s_optionFoo << "," << s_optionFoo[0];

    getOptions().getGenericOptions().add_options()
      (ssFoo.str().c_str(), 
       boost::program_options::value<std::string>(),
       "Description")
      ;

    return Framework::processOptions(argc, argv);
  }
Example #10
0
void P2gWriter::write(const PointViewPtr view)
{
    std::string z_name = getOptions().getValueOrDefault<std::string>("Z", "Z");


    for (point_count_t idx = 0; idx < view->size(); idx++)
    {
        double x = view->getFieldAs<double>(Dimension::Id::X, idx);
        double y = view->getFieldAs<double>(Dimension::Id::Y, idx);
        double z = view->getFieldAs<double>(Dimension::Id::Z, idx);
        m_coordinates.push_back(boost::tuple<double, double, double>(x, y, z));
    }

    view->calculateBounds(m_bounds);
}
Example #11
0
 GenericSum(const vle::devs::DynamicsInit& init, const vle::devs::InitEventList& events)
     : DiscreteTimeDyn(init, events)
 {
     Sum.init(this, "Sum", events);
     vle::vpz::ConnectionList::const_iterator itb =
             getModel().getInputPortList().begin();
     vle::vpz::ConnectionList::const_iterator ite =
             getModel().getInputPortList().end();
     for (; itb != ite; itb++) {
         Var* v = new Var();
         v->init(this, itb->first, events);
         getOptions().syncs.insert(std::make_pair(itb->first, 1));
         inputs.push_back(v);
     }
 }
Example #12
0
Schema InPlaceReprojection::alterSchema(Schema& schema)
{


    const std::string x_name = getOptions().getValueOrDefault<std::string>("x_dim", "X");
    const std::string y_name = getOptions().getValueOrDefault<std::string>("y_dim", "Y");
    const std::string z_name = getOptions().getValueOrDefault<std::string>("z_dim", "Z");

    log()->get(logDEBUG2) << "x_dim '" << x_name <<"' requested" << std::endl;
    log()->get(logDEBUG2) << "y_dim '" << y_name <<"' requested" << std::endl;
    log()->get(logDEBUG2) << "z_dim '" << z_name <<"' requested" << std::endl;

    Dimension const& dimX = schema.getDimension(x_name);
    Dimension const& dimY = schema.getDimension(y_name);
    Dimension const& dimZ = schema.getDimension(z_name);
    
    log()->get(logDEBUG3) << "Fetched x_name: " << dimX;
    log()->get(logDEBUG3) << "Fetched y_name: " << dimY;
    log()->get(logDEBUG3) << "Fetched z_name: " << dimZ;
    
    double offset_x = getOptions().getValueOrDefault<double>("offset_x", dimX.getNumericOffset());
    double offset_y = getOptions().getValueOrDefault<double>("offset_y", dimY.getNumericOffset());
    double offset_z = getOptions().getValueOrDefault<double>("offset_z", dimZ.getNumericOffset());

    log()->floatPrecision(8);

    log()->get(logDEBUG2) << "original offset x,y: " << offset_x <<"," << offset_y << std::endl;
    reprojectOffsets(offset_x, offset_y, offset_z);
    log()->get(logDEBUG2) << "reprojected offset x,y: " << offset_x <<"," << offset_y << std::endl;

    double scale_x = getOptions().getValueOrDefault<double>("scale_x", dimX.getNumericScale());
    double scale_y = getOptions().getValueOrDefault<double>("scale_y", dimY.getNumericScale());
    double scale_z = getOptions().getValueOrDefault<double>("scale_z", dimZ.getNumericScale());

    setDimension(x_name, m_old_x_id, m_new_x_id, schema, scale_x, offset_x);
    setDimension(y_name, m_old_y_id, m_new_y_id, schema, scale_y, offset_y);
    setDimension(z_name, m_old_z_id, m_new_z_id, schema, scale_z, offset_z);
    
    return schema;
    
}
Example #13
0
void CMainFrame::ajourMenuItems() {
  TextView    *view    = getActiveTextView();
  bool         hasView = view != NULL;
  CWinDiffDoc *doc     = getDoc();
  const Diff &diff     = doc->m_diff;

  if(!hasView) {
    enableMenuItem(this, ID_EDIT_COPY                     , false);
    enableMenuItem(this, ID_EDIT_SELECTALL                , false);

    enableToolbarButtonAndMenuItem(ID_EDIT_FIND           , false);
    enableToolbarButtonAndMenuItem(ID_EDIT_FIND_NEXT      , false);
    enableToolbarButtonAndMenuItem(ID_EDIT_FIND_PREV      , false);
    enableToolbarButtonAndMenuItem(ID_EDIT_PREV_DIFF      , false);

    enableMenuItem(this, ID_EDIT_GOTO                     , false);
    enableMenuItem(this, ID_EDIT_REFRESHFILES             , false);
    enableMenuItem(this, ID_VIEW_HIGHLIGHTCOMPAREEQUAL    , false);

    enableToolbarButtonAndMenuItem(ID_EDIT_NEXT_DIFF      , false);
    enableToolbarButtonAndMenuItem(ID_EDIT_SHOWDETAILS    , false);
    showStatusBarPanes(false);
  } else {
    const bool hasText = !diff.getDoc(view->getId()).isEmpty();

    enableMenuItem(this, ID_EDIT_COPY                     , !view->getSelectedRange().isEmpty());
    enableMenuItem(this, ID_EDIT_SELECTALL                , hasText);

    enableToolbarButtonAndMenuItem(ID_EDIT_FIND           , hasText);
    enableToolbarButtonAndMenuItem(ID_EDIT_FIND_NEXT      , hasText);
    enableToolbarButtonAndMenuItem(ID_EDIT_FIND_NEXT      , hasText);
    enableToolbarButtonAndMenuItem(ID_EDIT_FIND_PREV      , hasText);
    enableToolbarButtonAndMenuItem(ID_EDIT_FIND_PREV      , hasText);

    enableMenuItem(this, ID_EDIT_GOTO                     , hasText);
    enableMenuItem(this, ID_EDIT_REFRESHFILES             , diff.hasFileDoc());
    enableMenuItem(this, ID_VIEW_HIGHLIGHTCOMPAREEQUAL    , doc->m_filter.hasLineFilter());
    if(!doc->m_filter.hasLineFilter()) {
      checkMenuItem(this, ID_VIEW_HIGHLIGHTCOMPAREEQUAL, false);
    }
    enableToolbarButtonAndMenuItem( ID_EDIT_SHOWDETAILS   , !diff.isEmpty() && !diff.getDiffLines()[view->getCurrentLine()].linesAreEqual());
    enableToolbarButtonAndMenuItem( ID_EDIT_PREV_DIFF     , !diff.isEmpty() && (view->getCurrentLine() > diff.getFirstDiffLine()));
    enableToolbarButtonAndMenuItem( ID_EDIT_NEXT_DIFF     , !diff.isEmpty() && (view->getCurrentLine() < diff.getLastDiffLine()));

    showStatusBarPanes(!diff.isEmpty());
  }
  updateNameFontSizeMenuItems(getOptions().m_nameFontSizePct);
}
Example #14
0
abcHaploCall::abcHaploCall(const char *outfiles,argStruct *arguments,int inputtype){
 
  doHaploCall=0;
  maxMis=-1;
  minMinor=0;
  doCount=0;

  if(arguments->argc==2){
    if(!strcasecmp(arguments->argv[1],"-doHaploCall")){
      printArg(stdout);
      exit(0);
    }else
      return;
  }
  
  getOptions(arguments);
  printArg(arguments->argumentFile);

  if(doHaploCall==0){
    shouldRun[index] =0;
    return;
  }
  
  //for kputs output
  bufstr.s=NULL;bufstr.l=bufstr.m=0;

  //make output files
  const char* postfix;
  postfix=".haplo.gz";

  outfileZ = aio::openFileBG(outfiles,postfix);

 

  //write header
  bufstr.l=0;
 
  ksprintf(&bufstr,"chr\tpos\tmajor");

  for(int i=0;i<arguments->nInd;i++)
      ksprintf(&bufstr,"\tind%d",i);
  
  
  ksprintf(&bufstr,"\n");
  aio::bgzf_write(outfileZ,bufstr.s,bufstr.l);
  bufstr.l=0;

}
Example #15
0
void Writer::TurnOn_SDO_PC_Trigger(std::string trigger_name)
{

    if (!trigger_name.size()) return;

    std::ostringstream oss;

    std::string base_table_name = boost::to_upper_copy(getOptions().getValueOrThrow<std::string>("base_table_name"));

    oss << "ALTER TRIGGER " << trigger_name << " ENABLE ";

    Statement statement = Statement(m_connection->CreateStatement(oss.str().c_str()));
    statement->Execute();


}
Example #16
0
void CMainFrame::OnOptionsIgnoreRegex() {
  TextView *view = getActiveTextView();
  if(view == NULL) {
    return;
  }
  if(!isMenuItemChecked(this, ID_OPTIONS_IGNOREREGEX)) {
    const Options &options = getOptions();
    if(options.m_regexFilter.isEmpty()) {
      OnOptionsDefineRegex();
    }
    if(options.m_regexFilter.isEmpty()) {
      return;
    }
  }
  view->setIgnoreRegex(toggleMenuItem(this, ID_OPTIONS_IGNOREREGEX));
}
	COLLADAMax::String DocumentExporter::getXRefOutputPath( const ExportSceneGraph::XRefSceneGraph& xRefSceneGraph ) const
	{
		const String& xRefOutputFileDir = getOptions().getXRefOutputDir();

		if ( xRefOutputFileDir.empty() )
		{
			COLLADASW::URI uri(mOutputFileUri, xRefSceneGraph.exportFileBaseName + ".dae");
			return uri.toNativePath();
		}
		else
		{
			COLLADASW::URI xRefOutputFileDirURI(COLLADASW::URI::nativePathToUri(xRefOutputFileDir));
			COLLADASW::URI uri(xRefOutputFileDirURI, xRefSceneGraph.exportFileBaseName + ".dae");
			return uri.toNativePath();
		}
	}
Example #18
0
/*!

  Send a data to the parallel port.

*/
int
main(int argc, const char **argv)
{
  bool on = false;
  int nsec = 5; // Time while the ring light is turned on
  double nmsec = 0; // Pulse duration

  // Read the command line options
  if (getOptions(argc, argv, on, nsec, nmsec) == false) {
    exit (-1);
  }
  try {

    vpRingLight light;

    //if (nmsec == 0.)
    if (std::fabs(nmsec) <= std::numeric_limits<double>::epsilon())
      light.pulse();
    else
      light.pulse(nmsec);

    if (on) {
      printf("Turn on ring light\n");
      light.on(); // Turn the ring light on
      vpTime::wait(nsec * 1000); // Wait 5 s
      light.off(); // and then turn the ring light off
    }
    else {
      printf("Send a pulse to activate the ring light\n");
      light.pulse();
    }
  }
  catch (vpParallelPortException e) {
    switch(e.getCode()) {
    case vpParallelPortException::opening:
      printf("Can't open the parallel port to access to the ring light device\n");
      break;
    case vpParallelPortException::closing:
      printf("Can't close the parallel port\n");
      break;
    }
  }
  catch(...) {
    printf("An error occurs...\n");
  }
  return 0;
}
Example #19
0
void CMainFrame::OnOptionsIgnoreColumns() {
  TextView *view = getActiveTextView();
  if(view == NULL) {
    return;
  }

  if(!isMenuItemChecked(this, ID_OPTIONS_IGNORECOLUMNS)) {
    const Options &options = getOptions();
    if(options.m_fileFormat.isEmpty()) {
      OnOptionsDefineColumns();
    }
    if(options.m_fileFormat.isEmpty()) {
      return;
    }
  }
  view->setIgnoreColumns(toggleMenuItem(this,ID_OPTIONS_IGNORECOLUMNS));
}
Example #20
0
void Selector::checkImpedance()
{
    Options& options = getOptions();
    
    m_ignoreDefault = options.getValueOrDefault<bool>("ignore_default", true);
    std::vector<Option>::const_iterator i;
    
    try
    {
        Option ignored = options.getOption("ignore");
        boost::optional<Options const&> ignored_options = ignored.getOptions();
    
        
        if (ignored_options)
        {
            std::vector<Option> ignored_dimensions = ignored_options->getOptions("dimension");
            for (i = ignored_dimensions.begin(); i != ignored_dimensions.end(); ++i)
            {
                m_ignoredMap.insert(std::pair<std::string, bool>(i->getValue<std::string>(), true));
            }
        }
    }
    catch (option_not_found&)
    {
    }

    try
    {
        Option keep = options.getOption("keep");
        boost::optional<Options const&> keep_options = keep.getOptions();
    
        if (keep_options)
        {
            std::vector<Option> keep_dimensions = keep_options->getOptions("dimension");
            for (i = keep_dimensions.begin(); i != keep_dimensions.end(); ++i)
            {
                m_ignoredMap.insert(std::pair<std::string, bool>(i->getValue<std::string>(), false));
            }
        }
    }
    catch (option_not_found&)
    {
    }

    return;
}
Example #21
0
TEST(OptionsTest, test_static_options)
{
    Options ops;

    FauxReader reader;
    reader.setOptions(ops);

    CropFilter crop;
    crop.setOptions(ops);
    crop.setInput(reader);
    auto opts = crop.getDefaultOptions();
    EXPECT_EQ(opts.getOptions().size(), 4u);
    EXPECT_TRUE(opts.hasOption("bounds"));
    EXPECT_TRUE(opts.hasOption("inside"));
    EXPECT_TRUE(opts.hasOption("polygon"));
    EXPECT_FALSE(opts.hasOption("metes"));
}
Example #22
0
abbababa::abbababa(const char *outfiles,argStruct *arguments,int inputtype){
  doAbbababa=0;
  minQ=MINQ;//<-general.h
  sample=1;
  currentChr=-1;
  if(arguments->argc==2){
    if(!strcmp(arguments->argv[1],"-doAbbababa")){
      printArg(stdout);
      exit(0);
    }else
      return;
  }
  
  getOptions(arguments);
  printArg(arguments->argumentFile);

  if(doAbbababa==0)
    return;

 

  //make output files
  const char* postfix;
  postfix=".abbababa.gz";
  outfileZ = openFileGz(outfiles,postfix,GZOPT);
  const char* postfix2;
  postfix2=".abbababa2";
  outfile = openFile(outfiles,postfix2);

  //allocate allele counts
  alleleCounts = new size_t *[nInd];
  for(int i=0;i<nInd;i++)
    alleleCounts[i] = new size_t [256];
  for(int i=0;i<nInd;i++)
    for(int j=0;j<256;j++)
      alleleCounts[i][j]=0;

  alleleCountsChr = new size_t *[nInd];
  for(int i=0;i<nInd;i++)
    alleleCountsChr[i] = new size_t [256];
  for(int i=0;i<nInd;i++)
    for(int j=0;j<256;j++)
      alleleCountsChr[i][j]=0;

}
Example #23
0
/**
 * After all shapes have been generated, we write the actual STL file by looping over the
 * finalized geometry instances.
 */
void STLEncoder::finish(prtx::GenerateContext& /*context*/) {
	prt::SimpleOutputCallbacks* soh = dynamic_cast<prt::SimpleOutputCallbacks*>(getCallbacks());
	const std::wstring baseName = getOptions()->getString(EO_BASE_NAME);

	std::vector<prtx::EncodePreparator::FinalizedInstance> finalizedInstances;
	mEncodePreparator->fetchFinalizedInstances(finalizedInstances, ENC_PREP_FLAGS);

	std::wostringstream out;
	out << std::scientific;
	out << L"solid " << baseName << L"\n";

	for (const auto& instance: finalizedInstances) {
		for (const prtx::MeshPtr& m: instance.getGeometry()->getMeshes()) {
			for (uint32_t fi = 0, n = m->getFaceCount(); fi < n; fi++) {
				const prtx::DoubleVector& vc = m->getVertexCoords();

				const uint32_t* fvi = m->getFaceVertexIndices(fi);
				assert(m->getFaceVertexCount(fi) == 3); // we enabled triangulation above
				uint32_t vi0 = 3 * fvi[0];
				uint32_t vi1 = 3 * fvi[1];
				uint32_t vi2 = 3 * fvi[2];

				// using first vertex normal as face normal, see call to processVertexNormals() above
				const uint32_t* fvni = m->getFaceVertexNormalIndices(fi);
				const double* fn = &m->getVertexNormalsCoords()[3 * fvni[0]];

				out << L"facet normal " << fn[0] << L" " << fn[1] << L" " << fn[2] << WNL;
				out << L"  outer loop" << WNL;
				out << L"    vertex " << vc[vi0] << L" " << vc[vi0+1] << L" " << vc[vi0+2] << WNL;
				out << L"    vertex " << vc[vi1] << L" " << vc[vi1+1] << L" " << vc[vi1+2] << WNL;
				out << L"    vertex " << vc[vi2] << L" " << vc[vi2+1] << L" " << vc[vi2+2] << WNL;
				out << L"  endloop" << WNL;
				out << L"endfacet" << WNL;
			}
		}
	}

	out << L"endsolid" << WNL;

	// let the client application write the file via callback
	std::wstring fileName = baseName + STL_EXT;
	uint64_t h = soh->open(ID.c_str(), prt::CT_GEOMETRY, fileName.c_str(), prt::SimpleOutputCallbacks::SE_UTF8);
	soh->write(h, out.str().c_str());
	soh->close(h, 0, 0);
}
Example #24
0
boost::property_tree::ptree Writer::serializePipeline() const
{
    boost::property_tree::ptree tree;

    tree.add("<xmlattr>.type", getName());

    PipelineWriter::write_option_ptree(tree, getOptions());

    const Stage& stage = getPrevStage();
    boost::property_tree::ptree subtree = stage.serializePipeline();

    tree.add_child(subtree.begin()->first, subtree.begin()->second);

    boost::property_tree::ptree root;
    root.add_child("Writer", tree);

    return root;
}
void KoDocumentSectionDelegate::paint(QPainter *p, const QStyleOptionViewItem &o, const QModelIndex &index) const
{
    p->save();
    {
        QStyleOptionViewItemV4 option = getOptions(o, index);
        QStyle *style = option.widget ? option.widget->style() : QApplication::style();
        style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, p, option.widget);

        p->setFont(option.font);

        drawText(p, option, index);
        drawIcons(p, option, index);
        drawThumbnail(p, option, index);
        drawDecoration(p, option, index);
        drawProgressBar(p, option, index);
    }
    p->restore();
}
Example #26
0
void PBFruitPickupCommand::updateToFinalState(GameState &state) const
{
	//Update the state
	double da = _manager->getFuturePathingDistance(state, state._robotposition, _manager->getGrid()->getNode(_fruitAliasA));
	double db = _manager->getFuturePathingDistance(state, state._robotposition, _manager->getGrid()->getNode(_fruitAliasB));

	QString selectedAlias;
	double selectedAngle;
	RobotSide selectedSide;

	getOptions(da, db, selectedAlias, selectedAngle, selectedSide);

	state._content[_fruitAliasA] = true;
	state._content[_fruitAliasB] = true;
	int nbPickupDone = state._content.value(NB_FRUIT_PICKUP).toInt();
	state._content[NB_FRUIT_PICKUP] = nbPickupDone + 1;
	state._robotposition = _manager->getGrid()->getNode(selectedAlias);
}
Example #27
0
void InPlaceReprojection::setDimension( std::string const& name, 
                                        dimension::id& old_id,
                                        dimension::id& new_id,
                                        Schema& schema,
                                        double scale,
                                        double offset)
{


    Dimension const& old_dim = schema.getDimension(name);

    log()->get(logDEBUG2) << "found '" << name <<"' dimension " << old_dim << std::endl;

    Dimension derived(old_dim.getName(), old_dim.getInterpretation(), old_dim.getByteSize(), old_dim.getDescription());
    derived.setNumericScale(scale);
    derived.setNumericOffset(offset);
    derived.createUUID();
    derived.setNamespace(getName());
    derived.setParent(old_dim.getUUID());
    schema.appendDimension(derived);

    old_id = old_dim.getUUID();
    new_id = derived.getUUID();

    log()->get(logDEBUG2) << "source    dimension: " << old_dim << std::endl;
    log()->get(logDEBUG2) << "derived dimension: " << derived << std::endl;

    log()->get(logDEBUG2) << "source  id: " << old_id << std::endl;
    log()->get(logDEBUG2) << "derived id: " << new_id << std::endl;
    
    bool markIgnored = getOptions().getValueOrDefault<bool>("ignore_old_dimensions", true);
    if (markIgnored)
    {
        Dimension const& dim = schema.getDimension(old_id);
        log()->get(logDEBUG2) << "marking " << name << " as ignored with uuid "  << old_id << std::endl;

        Dimension d(dim);
        boost::uint32_t flags = d.getFlags();
        d.setFlags(flags | dimension::IsIgnored);
        schema.setDimension(d);
    }
    
}
Example #28
0
void Stage::initialize()
{
    StageBase::initialize();
    
    // Try to fetch overridden options here    
    
    // If the user gave us an SRS via options, take that.
    try 
    {
        m_spatialReference = getOptions().getValueOrThrow<pdal::SpatialReference>("spatialreference");
        
    }
    catch (pdal_error const&) 
    {
        // If one wasn't set on the options, we'll ignore at this 
        // point.  Maybe another stage might forward/set it later.
    }

    return;
}
Example #29
0
/*
 * Refresh the view
 */
void PackageGroupModel::refreshCacheView()
{
  if (isExecutingCommand) return;

  //update UI for background refresh
  QApplication::setOverrideCursor(Qt::WaitCursor);
  m_acc->reset();
  m_refreshButton->setEnabled(false);
  m_cleanButton->setEnabled(false);
  m_listView->clear();

  m_oldKeepValue = m_spinner->value();

  //connect handler slot and call the command
  QObject::connect(m_cmd, SIGNAL( finished ( int, QProcess::ExitStatus )),
                   this, SLOT( finishedDryrun ( int, QProcess::ExitStatus )) );

  m_cmd->executeCommandAsNormalUser("paccache -v -d " + getOptions());
  isExecutingCommand = true;
}
Example #30
0
abcMajorMinor::abcMajorMinor(const char *outfiles,argStruct *arguments,int inputtype){
  //default
  doMajorMinor = 0;
  doSaf = 0;
  pest = NULL;
  
  if(arguments->argc==2){
    if(!strcasecmp(arguments->argv[1],"-doMajorMinor")){
      printArg(stdout);
      exit(0);
    }else
      return;
  }

  getOptions(arguments);
  if(doMajorMinor==0 || doMajorMinor ==3 )
    shouldRun[index] =0;

  printArg(arguments->argumentFile);
}