void AmeGradientButton::setButtonCmd(ButtonCmd c)
{
        AmeSystemIcon ic((AmeSystemIcon::IconType)c);
        setIcon((QIcon)ic);
        cmd = c;
        update();
}
Exemple #2
0
BOOL LASwritePoint::write_chunk_table()
{

  if(rank==process_count-1)
  {
  U32 i;
  I64 position = outstream->tell();
  if (chunk_table_start_position != -1) // stream is seekable
  {


    if (!outstream->seek(chunk_table_start_position))
    {
      return FALSE;
    }

    if (!outstream->put64bitsLE((U8*)&position))
    {
      return FALSE;
    }

    if (!outstream->seek(position) && rank==process_count-1)
    {
      return FALSE;
    }
  }
  U32 version = 0;

  if (!outstream->put32bitsLE((U8*)&version))
  {
    return FALSE;
  }

  if (!outstream->put32bitsLE((U8*)&number_chunks))
  {
    return FALSE;
  }

  if (number_chunks > 0)
  {
    enc->init(outstream);
    IntegerCompressor ic(enc, 32, 2);
    ic.initCompressor();
    for (i = 0; i < number_chunks; i++)
    {
      if (chunk_size == U32_MAX) ic.compress((i ? chunk_sizes[i-1] : 0), chunk_sizes[i], 0);
      ic.compress((i ? chunk_bytes[i-1] : 0), chunk_bytes[i], 1);
    }
    enc->done();
  }
  if (chunk_table_start_position == -1) // stream is not-seekable
  {
    if (!outstream->put64bitsLE((U8*)&position))
    {
      return FALSE;
    }
  }
  }
  return TRUE;
}
Exemple #3
0
void PASCAL OpenStatus(HWND hUIWnd)
{
	POINT ptPos;
#define STATE_WIDTH 32
#define STATE_HEIGHT 32

	ptPos.x = get_wa_rect().right - STATE_WIDTH;
	ptPos.y = get_wa_rect().bottom - STATE_HEIGHT;

	if (!get_status_wnd(hUIWnd)) {
		HWND stat = CreateWindowEx(WS_EX_TOPMOST|WS_EX_TRANSPARENT, get_status_class_name().c_str(), NULL, WS_POPUP | WS_DISABLED,
									  ptPos.x, ptPos.y, STATE_WIDTH, STATE_HEIGHT,
									  hUIWnd, (HMENU) NULL, g_hInst, NULL);

		//ModifyStyleEx
		SetWindowLong (stat, GWL_EXSTYLE , 
					   GetWindowLong (stat , GWL_EXSTYLE ) | WS_EX_LAYERED);

		SetLayeredWindowAttributes(stat,
								   RGB(255, 255, 255),
								   100,
								   LWA_COLORKEY|LWA_ALPHA);
		
		set_status_wnd(hUIWnd, stat);
	}

	input_context ic(hUIWnd);
	if (!ic) {
		hide_status_wnd(hUIWnd);
	} else {
		show_status_wnd(hUIWnd);
	}
	return;
}
void
test()
{
    std::complex<T> c;
    const std::complex<T> c2(1.5, 2.5);
    assert(c.real() == 0);
    assert(c.imag() == 0);
    c += c2;
    assert(c.real() == 1.5);
    assert(c.imag() == 2.5);
    c += c2;
    assert(c.real() == 3);
    assert(c.imag() == 5);

    std::complex<T> c3;

    c3 = c;
    std::complex<int> ic (1,1);
    c3 += ic;
    assert(c3.real() == 4);
    assert(c3.imag() == 6);
    
    c3 = c;
    std::complex<float> fc (1,1);
    c3 += fc;
    assert(c3.real() == 4);
    assert(c3.imag() == 6);
}
/** Method fills-in all additional properties requested by user and not defined
*by matrix workspace itself.
*  it fills in [nd - (1 or 2 -- depending on emode)] values into Coord vector;
*
*@param Coord -- input-output vector of MD-coordinates
*@param nd    -- number of current dimensions
*
*@returns     -- Coord vector with nd-(1 or 2, depending on emode) values of MD
*coordinates
*/
bool MDTransfModQ::calcGenericVariables(std::vector<coord_t> &Coord,
                                        size_t nd) {
  // sanity check. If fails, something went fundamentally wrong
  if (m_NMatrixDim + m_AddDimCoordinates.size() != nd) {
    std::string ERR =
        "Number of matrix dimensions: " +
        boost::lexical_cast<std::string>(m_NMatrixDim) +
        " plus number of additional dimensions: " +
        boost::lexical_cast<std::string>(m_AddDimCoordinates.size()) +
        " not equal to number of workspace dimensions: " +
        boost::lexical_cast<std::string>(nd);
    throw(std::invalid_argument(ERR));
  }

  // in Elastic case, 1  coordinate (|Q|) came from workspace
  // in inelastic 2 coordinates (|Q| dE) came from workspace. All other are
  // defined by properties.
  // m_NMatrixDim is either 1 in elastic case or 2 in inelastic
  size_t ic(0);
  for (size_t i = m_NMatrixDim; i < nd; i++) {
    if (m_AddDimCoordinates[ic] < m_DimMin[i] ||
        m_AddDimCoordinates[ic] >= m_DimMax[i])
      return false;
    Coord[i] = m_AddDimCoordinates[ic];
    ic++;
  }
  return true;
}
Exemple #6
0
PatchView::PatchView(MainImpl* mi, Git* g) : Domain(mi, g, false) {

	patchTab = new Ui_TabPatch();
	patchTab->setupUi(container);
	SCRef ic(QString::fromUtf8(":/icons/resources/plusminus.png"));
	patchTab->buttonFilterPatch->setIcon(QIcon(ic));

	QButtonGroup* bg = new QButtonGroup(this);
	bg->addButton(patchTab->radioButtonParent, DIFF_TO_PARENT);
	bg->addButton(patchTab->radioButtonHead, DIFF_TO_HEAD);
	bg->addButton(patchTab->radioButtonSha, DIFF_TO_SHA);
	connect(bg, SIGNAL(buttonClicked(int)), this, SLOT(button_clicked(int)));

	patchTab->textBrowserDesc->setup(this);
	patchTab->textEditDiff->setup(this, git);
	patchTab->fileList->setup(this, git);

	connect(m(), SIGNAL(typeWriterFontChanged()),
	        patchTab->textEditDiff, SLOT(typeWriterFontChanged()));

	connect(m(), SIGNAL(changeFont(const QFont&)),
	       patchTab->fileList, SLOT(on_changeFont(const QFont&)));

	connect(patchTab->lineEditDiff, SIGNAL(returnPressed()),
	        this, SLOT(lineEditDiff_returnPressed()));

	connect(patchTab->fileList, SIGNAL(contextMenu(const QString&, int)),
	        this, SLOT(on_contextMenu(const QString&, int)));

	connect(patchTab->buttonFilterPatch, SIGNAL(clicked()),
	        this, SLOT(buttonFilterPatch_clicked()));
}
Exemple #7
0
  bool Simulator::
  Initialize()
  {
    for (size_t ic(0); ic < RobotClient::registry.size(); ++ic) {
      RobotClient *client(RobotClient::registry.at(ic));
      RobotServer *server(new RobotServer(client, *m_world));
      if ( !client->Initialize(*server)) {
	delete server;
	delete client;
	return false;
      }
      m_world->AddRobot(server);
      m_robot.push_back(robot_s(server, client));
      Frame const pose(client->m_initial_pose.x, client->m_initial_pose.y, client->m_initial_pose.theta);
      server->InitializePose(pose);
      client->SetPose(Pose(client->m_initial_pose.x, client->m_initial_pose.y, client->m_initial_pose.theta));
      if (client->m_goals.size() > 0) {
	client->SetGoal(m_timestep, client->m_goals[0]);
      }
      
      // This was a nice feature that might be worth resurrecting using fpplib
      // if ( ! layout_file.empty())
      // 	m_appwin.push_back(shared_ptr<AppWindow>(new AppWindow(rdesc[ii]->name, layout_file,
      // 							       640, 480, this)));
    }
    
    UpdateAllSensors();
    
    return true;
  }
Exemple #8
0
void Field::check_access_by(InstanceClass* sender_class,
                            InstanceClass* static_receiver_class,
                            FailureMode fail_mode JVM_TRAPS) {
  InstanceClass* field_class = ic();
  if (is_public()) {
    return;
  }
  if (field_class->equals(sender_class)) {
    return;
  }
  if (!is_private()) {
    if (field_class->is_same_class_package(sender_class)) {
      return;
    }
    if (is_protected()) {
      if (sender_class->is_subclass_of(field_class)) {
        if (static_receiver_class->equals(sender_class) || 
            static_receiver_class->is_subclass_of(sender_class) || 
            sender_class->is_subclass_of(static_receiver_class)) {
          return;
        }
      }
    }
  }
  Throw::illegal_access(fail_mode JVM_NO_CHECK_AT_BOTTOM);
}
Exemple #9
0
AplusFuncLabel::AplusFuncLabel(A a_, AplusLabelOut *alo_) : AplusLabelOut()
{
  if (alo_!=0 && alo_->outFunc()!=0)
   {
     outFunc(alo_->outFunc());
     v(alo_->v());
   }

  if (alo_!=0 && alo_->format()!=AplusFormatter::BadFormat)
   {
     format(alo_->format());
     precision(alo_->precision());
   }

  if (verify(a_)==MSTrue)
   {
     a((A) ic(a_));
   }
  else
   {
     MSStringVector emptyStringVector;
     a((A)0);
     tick((A)0);
     grid((A)0);
     value((A)0);
     labels(emptyStringVector);
   }
}
Exemple #10
0
/**
build the list of spectra to load and include into spectra-detectors map
@param range_supplied  -- if true specifies that the range of values provided
below have to be processed rather then spectra list
@param range_min       -- min value for spectra-ID to load
@param range_max       -- max value for spectra-ID to load
@param spec_list       -- list of spectra numbers to load
@param SpectraExcluded -- set of the spectra ID-s to exclude from loading
**/
void LoadISISNexus2::buildSpectraInd2SpectraNumMap(
    bool range_supplied, int64_t range_min, int64_t range_max,
    const std::vector<int64_t> &spec_list,
    const std::map<int64_t, std::string> &SpectraExcluded) {

  int64_t ic(0);

  if (spec_list.size() > 0) {
    ic = 0;
    auto start_point = spec_list.begin();
    for (auto it = start_point; it != spec_list.end(); it++) {

      specid_t spec_num = static_cast<specid_t>(*it);
      if (SpectraExcluded.find(spec_num) == SpectraExcluded.end()) {
        m_specInd2specNum_map.insert(
            std::pair<int64_t, specid_t>(ic, spec_num));
        ic++;
      }
    }
  } else {
    if (range_supplied) {
      ic = 0;
      for (int64_t i = range_min; i < range_max + 1; i++) {
        specid_t spec_num = static_cast<specid_t>(i);
        if (SpectraExcluded.find(spec_num) == SpectraExcluded.end()) {
          m_specInd2specNum_map.insert(
              std::pair<int64_t, specid_t>(ic, spec_num));
          ic++;
        }
      }
    }
  }
}
Exemple #11
0
Z I td(A a,A w,I i)
{
  A z;
  ND2 I0
    {
      I wt=w->t,wr=w->r,*wd=w->d;
      I j= *wd,k,m=*a->p;
      if(!wr)
	j=1,++wr; 
      if(i==26)
	m=m>0?(m>j?0:m-j):m<-j?0:m+j;
      k=tr(wr-1,wd+1);
      u=v=0;
      t=wt;
      if(m<0)
	if(m= -m,m>j)
	  u=(j-m)*k;
	else 
	  v=(j-m)*k;
      else 
	if(m>j)
	  u=(m-j)*k;
	else 
	  if(wt<Ct&&w->c==1&&m)
	    R g=(PFI)k1,w->n=(*w->d=m)*k,ic(w);
      W(ga(wt,wr,m*k,wd))*z->d=m;
      C2(k1)
    }
}
Exemple #12
0
static void PaintStatusWindow(HWND hWnd, HDC hdc)
{
	
	CRect rect;
	GetClientRect(hWnd, &rect);

	//hdc_with_font dc_lucida(hdc, L"Lucida Console", 12);
	// hdc = GetDC(NULL);
	// CPoint pt = rect.TopLeft();
	// ClientToScreen(hWnd, &pt);
	// rect.OffsetRect(pt);

	wstring name = to_wstring(g_ime_name);
	HWND hUIWnd = GetWindow(hWnd, GW_OWNER);
	input_context ic(hUIWnd);

	if (!ic || !ic->hWnd) {
		DrawText(hdc, name.c_str(), name.size(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
	} else {
		HWND hWnd = ic->hWnd;
		while (GetParent(hWnd) && GetParent(hWnd) != hWnd) {
			hWnd = GetParent(hWnd);
		}
		HICON icon = GetWindowIcons(hWnd);
		SetBkColor(hdc, RGB(254, 254, 255));
		SetTextColor(hdc, RGB(22, 1, 33));
		
		DrawIconEx (hdc, 0, 0, icon, rect.Width(), rect.Height(), 0, NULL, DI_NORMAL); 
	}

}
Exemple #13
0
void
callTagLSRefinementCellsCallbackFunction(const Pointer<BasePatchHierarchy<NDIM> > hierarchy,
                                         const int level_number,
                                         const double /*error_data_time*/,
                                         const int tag_index,
                                         const bool initial_time,
                                         const bool /*uses_richardson_extrapolation_too*/,
                                         void* ctx)
{
    if (initial_time) return;

    TagLSRefinementCells* ptr_ls_tagger = static_cast<TagLSRefinementCells*>(ctx);

    TBOX_ASSERT(hierarchy);
    TBOX_ASSERT((level_number >= 0) && (level_number <= hierarchy->getFinestLevelNumber()));
    TBOX_ASSERT(hierarchy->getPatchLevel(level_number));

    // Get the current level set information
    VariableDatabase<NDIM>* var_db = VariableDatabase<NDIM>::getDatabase();
    const int ls_current_idx = var_db->mapVariableAndContextToIndex(
        ptr_ls_tagger->d_ls_gas_var, ptr_ls_tagger->d_adv_diff_solver->getCurrentContext());

    // Tag cells based on the value of the level set variable
    Pointer<PatchLevel<NDIM> > level = hierarchy->getPatchLevel(level_number);
    for (PatchLevel<NDIM>::Iterator p(level); p; p++)
    {
        Pointer<Patch<NDIM> > patch = level->getPatch(p());
        const Box<NDIM>& patch_box = patch->getBox();
        Pointer<CellData<NDIM, int> > tags_data = patch->getPatchData(tag_index);
        Pointer<CellData<NDIM, double> > ls_data = patch->getPatchData(ls_current_idx);

        for (CellIterator<NDIM> ic(patch_box); ic; ic++)
        {
            const hier::Index<NDIM>& i = ic();
            const double dist_norm = (*ls_data)(i)-ptr_ls_tagger->d_tag_value;

            // Note that this ensures that the inside of the water is tagged as well
            if (dist_norm <= ptr_ls_tagger->d_tag_abs_thresh)
            {
                (*tags_data)(i) = 1;
            }
        }
    }

    return;

} // callTagLSRefinementCellsCallBackFunction
Exemple #14
0
int vfscanf(FILE *fp, char *fmt, va_list ap)
{
	int ret = 0;
	int t, c;
	int wid = 1 << 20;
	while (*fmt) {
		while (isspace((unsigned char) *fmt))
			fmt++;
		while (isspace(c = ic(fp)))
			;
		ungetc(c, fp);
		while (*fmt && *fmt != '%' && !isspace((unsigned char) *fmt))
			if (*fmt++ != ic(fp))
				return ret;
		if (*fmt != '%')
			continue;
		fmt++;
		if (isdigit((unsigned char) *fmt)) {
			wid = 0;
			while (isdigit((unsigned char) *fmt))
				wid = wid * 10 + *fmt++ - '0';
		}
		t = sizeof(int);
		while (*fmt == 'l') {
			t = sizeof(long);
			fmt++;
		}
		while (*fmt == 'h') {
			t = t < sizeof(int) ? sizeof(char) : sizeof(short);
			fmt++;
		}
		switch (*fmt++) {
		case 'u':
		case 'd':
			if (iint(fp, va_arg(ap, long *), t, wid))
				return ret;
			ret++;
			break;
		case 's':
			if (istr(fp, va_arg(ap, char *), wid))
				return ret;
			ret++;
			break;
		}
	}
	return ret;
}
void SheetBgColorStep::redo()
{
    QPixmap colIcon(32, 32);
    colIcon.fill(newColor);
    QIcon ic(colIcon);
    mainWindow->getUI()->sheetBgColSelect->setIcon(ic);
    mainWindow->getSheet()->setBgCol(newColor);
}
passwordDialog::passwordDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::passwordDialog)
{
    ui->setupUi(this);
    QIcon ic("./ico/LOCK.png");
    ui->label_4->setPixmap(ic.pixmap(48,48));
}
Exemple #17
0
int main(int argc, char** argv)
{
  ros::init(argc, argv, "img2dir");
  img2dir::Nh nh;
  img2dir::Img2dir ic(nh);
  ros::spin();
  return 0;
}
Exemple #18
0
int main(){
	Simple_window win(Point(100, 100), 600, 400, "Immobile_Circle");

	Immobile_Circle ic(Point(300, 200), 200);
	
	win.attach(ic);
	win.wait_for_button();
}
Exemple #19
0
AmeGradientButton::AmeGradientButton(const ButtonCmd c, QWidget *parent)
        : QToolButton(parent)
{
        AmeSystemIcon ic((AmeSystemIcon::IconType)c);
        setIcon(QIcon(ic));
        cmd = c;
        w1 = 22;
        setGroupPosition(LeftButton);
}
Exemple #20
0
AipcAttributes::AipcAttributes(AipcAttributes &src_)
  : _clientData((A)ic(src_.clientData())),
    _flagAttrs(src_._flagAttrs),
    _readPriority(src_._readPriority),
    _writePriority(src_._writePriority),
    _readBufsize(src_._readBufsize),
    _writeBufsize(src_._writeBufsize),
    _listener(src_._listener)
{}
Exemple #21
0
 int main( int argc, char *argv[] )
 {
     neuralnetwork::IConnection ic( 1.0 );
     neuralnetwork::CPerceptron cp;
     cp.addInputConnection( & ic );
     cp.inputEvent( & ic, 2.0 );
     std::cout << "No stack overflow here!" << std::endl;
     return 0;
 }
Exemple #22
0
static int istr(FILE *fp, char *dst, int wid)
{
	char *d = dst;
	int c;
	while ((c = ic(fp)) != EOF && wid-- > 0 && !isspace(c))
		*d++ = c;
	*d = '\0';
	ungetc(c, fp);
	return d == dst;
}
Exemple #23
0
void Process::setInitialConditions(const int process_id, double const t,
                                   GlobalVector& x)
{
    // getDOFTableOfProcess can be overloaded by the specific process.
    auto const& dof_table_of_process = getDOFTable(process_id);

    auto const& per_process_variables = _process_variables[process_id];
    for (std::size_t variable_id = 0;
         variable_id < per_process_variables.size();
         variable_id++)
    {
        SpatialPosition pos;

        auto const& pv = per_process_variables[variable_id];
        DBUG("Set the initial condition of variable %s of process %d.",
             pv.get().getName().data(), process_id);

        auto const& ic = pv.get().getInitialCondition();

        auto const num_comp = pv.get().getNumberOfComponents();

        for (int component_id = 0; component_id < num_comp; ++component_id)
        {
            auto const& mesh_subset =
                dof_table_of_process.getMeshSubset(variable_id, component_id);
            auto const mesh_id = mesh_subset.getMeshID();
            for (auto const* node : mesh_subset.getNodes())
            {
                MeshLib::Location const l(mesh_id, MeshLib::MeshItemType::Node,
                                          node->getID());

                pos.setNodeID(node->getID());
                auto const& ic_value = ic(t, pos);

                auto global_index =
                    std::abs(dof_table_of_process.getGlobalIndex(l, variable_id,
                                                                 component_id));
#ifdef USE_PETSC
                // The global indices of the ghost entries of the global
                // matrix or the global vectors need to be set as negative
                // values for equation assembly, however the global indices
                // start from zero. Therefore, any ghost entry with zero
                // index is assigned an negative value of the vector size
                // or the matrix dimension. To assign the initial value for
                // the ghost entries, the negative indices of the ghost
                // entries are restored to zero.
                if (global_index == x.size())
                    global_index = 0;
#endif
                x.set(global_index, ic_value[component_id]);
            }
        }
    }
}
Exemple #24
0
unique_ptr<Results> Query::GetMatches(const std::string& query,
                                      Index& index,
                                      std::string* parse_error) {
    SnapshopIteratorCreator ic(index.GetDB());
    Parser p(query, ic);
    unique_ptr<QueryRuntimeFilter> filter(p.BuildFilter(parse_error));
    if (filter)
        return unique_ptr<Results> (new Results(filter));
    else
        return nullptr;
}
int main(int argc, char** argv)
{
  ros::init(argc, argv, "video_writer");
  ros::NodeHandle nh("~");
  std::string topic;
  nh.param<std::string>("image", topic, std::string(""));

  ROS_INFO_STREAM("Subscribing to topic " << topic << "...");
  ImageConverter ic(topic, nh);
  ros::spin();
  return 0;
}
void InstantiationVisitor::visit(IdentifierExpr& i)
{
	if (i.value()) {
		_expr = clone(*i.value());
	} else if (auto* decl = dynamic_cast<DeclarationStmt*>(i.target())) {
		std::unique_ptr<IdentifierExpr> ic(new auto(i));
		ic->target(declClones.at(decl));
		_expr = std::move(ic);
	} else {
		_expr.reset(new auto(i));
	}
}
int main(int argc, char** argv)
{
  if (argc==2) {
    ros::init(argc, argv, "correll_image_converter");
    ImageGrabber ic(argv[1]);
    ros::spin();
    return 0;
  } else {
    std::cout<<"ERROR:\tusage - RosToOpencvImage <ros_image_topic>"<<std::endl;
    return 1;
  }
}
Exemple #28
0
int main(int argc, char** argv)
{
  if (argc>=3) {
    ros::init(argc, argv, "figleaf_image_converter", ros::init_options::AnonymousName);
    ImageConverter ic(argv[1], argv[2]);
    ros::spin();
    return 0;
  } else {
    std::cout<<"ERROR:\tusage - figleaf_2d <ros_image_topic> <ros_output_topic>"<<std::endl;
    return 1;
  }
}
QVariant QFPseudoTreeModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid())
        return QVariant();

    if (isFolder(index)) {
        if (role==Qt::DecorationRole) {
            return QIcon(":/lib/projecttree_folder.png");
        } else if (role==Qt::DisplayRole) {
            int idx=folderIndexForIndex(index);
            if (idx>=0 && idx<m_folders.size()) return m_folders.value(idx);
        }
        return QVariant();
    }

    if (index.internalPointer()) {
        QFPseudoTreeModelItem *item = static_cast<QFPseudoTreeModelItem*>(index.internalPointer());

        if (!item) return QVariant();

        if (role==Qt::DisplayRole) return  item->displayText();
        if (role==Qt::DecorationRole) {
            QVariant d=item->data(role);
            int w=16;
            if (d.type()==QVariant::Icon) {
                w=32;
            }
            QPixmap ic(QSize(w,16));

            ic.fill(Qt::transparent);
            {
                QPainter p(&ic);
                QPen pen(QApplication::palette("QWidget").color(QPalette::Mid));
                pen.setStyle(Qt::DotLine);
                p.setPen(pen);
                if (isLastInFolder(index)) {
                    p.drawLine(8,0,8,8);
                } else {
                    p.drawLine(8,0,8,17);
                }
                p.drawLine(8,8,15,8);

                if (d.type()==QVariant::Icon) {
                    p.drawPixmap(16,0,16,16, d.value<QIcon>().pixmap(QSize(16,16)));
                }
            }
            return  ic;
        }

        return item->data(role);
    }
    return QVariant();
}
Exemple #30
0
char *fgets(char *s, int sz, FILE *fp)
{
	int i = 0;
	int c;
	while (i + 1 < sz && (c = ic(fp)) != EOF) {
		s[i++] = c;
		if (c == '\n')
			break;
	}
	s[i] = '\0';
	return i ? s : NULL;
}