void PseudoStateCanvas::change_scale() { Q3CanvasRectangle::setVisible(FALSE); if (manual_size) { double scale = the_canvas()->zoom(); if (horiz) { int w = (int) (width_scale100*scale); if (w < MIN_FORK_JOIN_LARGESIDE) w = MIN_FORK_JOIN_LARGESIDE; setSize(w | 1, FORK_JOIN_SMALLSIDE); } else { int h = (int) (height_scale100*scale); if (h < MIN_FORK_JOIN_LARGESIDE) h = MIN_FORK_JOIN_LARGESIDE; setSize(FORK_JOIN_SMALLSIDE, h | 1); } DiagramCanvas::resize(width(), height()); recenter(); } else set_xpm(); recenter(); Q3CanvasRectangle::setVisible(TRUE); }
void ArrowJunctionCanvas::change_scale() { // the size is not modified Q3CanvasRectangle::setVisible(FALSE); recenter(); Q3CanvasRectangle::setVisible(TRUE); }
void add_path(T & path) { agg::scanline_u8 sl_; marker_placement_enum placement_method = get<marker_placement_enum>(sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT); bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_, false); bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false); bool avoid_edges = get<bool>(sym_, keys::avoid_edges, feature_, vars_, false); double opacity = get<double>(sym_,keys::opacity, feature_, vars_, 1.0); double spacing = get<double>(sym_, keys::spacing, feature_, vars_, 100.0); double max_error = get<double>(sym_, keys::max_error, feature_, vars_, 0.2); coord2d center = bbox_.center(); agg::trans_affine_translation recenter(-center.x, -center.y); agg::trans_affine tr = recenter * marker_trans_; markers_placement_params params { bbox_, tr, spacing * scale_factor_, max_error, allow_overlap, avoid_edges }; markers_placement_finder<T, Detector> placement_finder( placement_method, path, detector_, params); double x, y, angle = .0; while (placement_finder.get_point(x, y, angle, ignore_placement)) { agg::trans_affine matrix = tr; matrix.rotate(angle); matrix.translate(x, y); if (snap_to_pixels_) { // https://github.com/mapnik/mapnik/issues/1316 matrix.tx = std::floor(matrix.tx + .5); matrix.ty = std::floor(matrix.ty + .5); } svg_renderer_.render(ras_, sl_, renb_, matrix, opacity, bbox_); } }
void ImageCanvas::open() { QString s = path; ImageDialog d(s); if ((d.exec() == QDialog::Accepted) && !s.isEmpty() && (s != path)) { QPixmap * p = get_pixmap(s); if (p != 0) { path = s; width_scale100 = p->width(); height_scale100 = p->height(); px = get_pixmap(path, the_canvas()->zoom()); hide(); hide_lines(); setSize(px->width(), px->height()); recenter(); show(); update_show_lines(); canvas()->update(); package_modified(); } } }
void ArrowPointCanvas::change_scale() { // the size is not modified QGraphicsRectItem::setVisible(FALSE); recenter(); QGraphicsRectItem::setVisible(TRUE); }
void demography :: create_walls() { //body definition b2BodyDef myBodyDef; myBodyDef.type = b2_staticBody; //shape definition b2PolygonShape polygonShape; polygonShape.SetAsBox(1, 1); //a 2x2 rectangle //fixture definition b2FixtureDef myFixtureDef; myFixtureDef.shape = &polygonShape; myFixtureDef.density = 1; myFixtureDef.restitution = 1; //a static body myBodyDef.type = b2_staticBody; myBodyDef.position.Set(0, 0); b2Body* staticBody = World.CreateBody(&myBodyDef); // CircleShape * p = 0; staticBody->SetUserData(NULL); vector<b2Vec2> pos; vector<b2Vec2> size; // int coeff_x= 38; // int coeff_y= 29; // int coeff_x= 38; // int coeff_y= 29; b2Vec2 dims(wsize.x/SCALE,wsize.y/SCALE); int coeff_x = dims.x*.5, coeff_y = dims.y*.5; //top,bottom,left,right pos.push_back(b2Vec2(coeff_x,1)); pos.push_back(b2Vec2(coeff_x,coeff_y*2)); pos.push_back(b2Vec2(1,coeff_y)); pos.push_back(b2Vec2(coeff_x*2,coeff_y)); size.push_back(b2Vec2(coeff_x,1)); size.push_back(b2Vec2(coeff_x,1)); size.push_back(b2Vec2(1,coeff_y)); size.push_back(b2Vec2(1,coeff_y)); for(size_t a = 0; a < 4; ++a) { float w = size[a].x, h = size[a].y; Vector2f posit((pos[a].x)*SCALE,(pos[a].y)*SCALE); polygonShape.SetAsBox( w, h, pos[a], 0);//ground staticBody->CreateFixture(&myFixtureDef); walls.push_back(RectangleShape()); walls.back().setSize(Vector2f(w*2*SCALE,2*h*SCALE)); walls.back().setPosition(posit); walls.back().setFillColor(Color(50,50,50)); recenter(walls.back()); // staticBody->SetUserData(0); staticBody->SetUserData(NULL); } }
void ImageCanvas::change_scale() { Q3CanvasRectangle::setVisible(FALSE); px = get_pixmap(path, the_canvas()->zoom()); setSize(px->width(), px->height()); recenter(); Q3CanvasRectangle::setVisible(TRUE); }
void add_path(T & path) { marker_placement_enum placement_method = get<marker_placement_enum, keys::markers_placement_type>(sym_, feature_, vars_); value_bool ignore_placement = get<value_bool, keys::ignore_placement>(sym_, feature_, vars_); value_bool allow_overlap = get<value_bool, keys::allow_overlap>(sym_, feature_, vars_); value_bool avoid_edges = get<value_bool, keys::avoid_edges>(sym_, feature_, vars_); value_double opacity = get<value_double,keys::opacity>(sym_, feature_, vars_); value_double spacing = get<value_double, keys::spacing>(sym_, feature_, vars_); value_double max_error = get<value_double, keys::max_error>(sym_, feature_, vars_); coord2d center = src_->bounding_box().center(); agg::trans_affine_translation recenter(-center.x, -center.y); agg::trans_affine tr = recenter * marker_trans_; direction_enum direction = get<direction_enum, keys::direction>(sym_, feature_, vars_); markers_placement_params params { src_->bounding_box(), tr, spacing * scale_factor_, max_error, allow_overlap, avoid_edges, direction }; markers_placement_finder<T, Detector> placement_finder( placement_method, path, detector_, params); double x, y, angle = .0; while (placement_finder.get_point(x, y, angle, ignore_placement)) { agg::trans_affine matrix = tr; matrix.rotate(angle); matrix.translate(x, y); render_marker(matrix, opacity); } }
void add_path(T & path) { agg::scanline_bin sl_; marker_placement_enum placement_method = get<marker_placement_enum>(sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT); bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_, false); double opacity = get<double>(sym_,keys::opacity, feature_, vars_, 1.0); bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false); coord2d center = bbox_.center(); agg::trans_affine_translation recenter(-center.x, -center.y); double spacing = get<double>(sym_, keys::spacing, feature_, vars_, 100.0); double max_error = get<double>(sym_, keys::max_error, feature_, vars_, 0.2); markers_placement_params params { bbox_, marker_trans_, spacing * scale_factor_, max_error, allow_overlap }; markers_placement_finder<T, Detector> placement_finder( placement_method, path, detector_, params); double x, y, angle = .0; while (placement_finder.get_point(x, y, angle, ignore_placement)) { agg::trans_affine matrix = recenter * marker_trans_; matrix.rotate(angle); matrix.translate(x, y); svg_renderer_.render_id(ras_, sl_, renb_, feature_.id(), matrix, opacity, bbox_); if (!placed_) { pixmap_.add_feature(feature_); placed_ = true; } } }
void UcClassCanvas::change_scale() { Q3CanvasRectangle::setVisible(FALSE); compute_size(); recenter(); if (templ != 0) templ->update(); Q3CanvasRectangle::setVisible(TRUE); }
void SdLostFoundMsgSupportCanvas::change_scale() { // the size is not modified QCanvasRectangle::setVisible(FALSE); recenter(); if (msg != 0) msg->update_hpos(); QCanvasRectangle::setVisible(TRUE); }
void edgeCurve::mouseReleased(int _x, int _y, int _button){ for (auto v : mVerts){ v->bBeingDragged = false; } if (mHole) mHole->mouseReleased(_x, _y, _button); if (mSlaveHole) mSlaveHole->mouseReleased(_x, _y, _button); if (mIsSlave == false) recenter(); }
void ImageCanvas::change_scale() { QGraphicsRectItem::setVisible(FALSE); px = get_pixmap(path.toLatin1().constData(), the_canvas()->zoom()); setRect(rect().x(), rect().y(), px->width(), px->height()); recenter(); QGraphicsRectItem::setVisible(TRUE); }
/* the page up/down commands set cursor_motion to -1 because we do not want to use any goal column information */ int pagedown_cmd() { int col, this_line, this_point; int n; Cursor_Motion = -1; if (IN_MINI_WINDOW) { scroll_completion (1); return 1; } if (eobp()) { eob_bob_error (3); return 1; } n = JWindow->rows; if ((CBuf != JWindow->buffer) || (n == 1)) { return next_visible_lines (n); } if (JWindow->trashed) { update (NULL, 0, 0, 1); if (JWindow->trashed) return next_visible_lines (n); } /* This is ugly. */ this_line = LineNum; this_point = Point; col = calculate_column (); if (goto_bottom_of_window ()) { recenter (&Number_One); } goto_column1 (&col); if ((Last_Key_Function == (FVOID_STAR) pageup_cmd) && (Jed_This_Key_Function == (FVOID_STAR) pagedown_cmd)) { goto_line (&Last_Page_Line); if (Last_Page_Point < CLine->len) Point = Last_Page_Point; } else if (CLine->next == NULL) eol(); else bol (); Last_Page_Line = this_line; Last_Page_Point = this_point; return(1); }
void StateActionCanvas::change_scale() { QCanvasRectangle::setVisible(FALSE); double scale = the_canvas()->zoom(); setSize((int) (width_scale100*scale), (int) (height_scale100*scale)); compute_size(); recenter(); QCanvasRectangle::setVisible(TRUE); }
void DiagramCanvas::change_scale() { double scale = the_canvas()->zoom(); Q3CanvasRectangle::setVisible(FALSE); setSize((int)(width_scale100 * scale + 0.5), (int)(height_scale100 * scale + 0.5)); recenter(); Q3CanvasRectangle::setVisible(TRUE); }
void ActivityPartitionCanvas::change_scale() { double scale = the_canvas()->zoom(); Q3CanvasRectangle::setVisible(FALSE); setSize((int) (width_scale100*scale), (int) (height_scale100*scale)); check_size(); recenter(); Q3CanvasRectangle::setVisible(TRUE); }
void DiagramCanvas::change_scale() { double scale = the_canvas()->zoom(); QGraphicsRectItem::setVisible(FALSE); setRect(this->rect().x(), rect().y(),(int)(width_scale100 * scale + 0.5), (int)(height_scale100 * scale + 0.5)); recenter(); QGraphicsRectItem::setVisible(TRUE); }
int pageup_cmd (void) { int col, this_line, this_point; int n; Cursor_Motion = -1; if (IN_MINI_WINDOW) { scroll_completion (-1); return 1; } if (bobp()) { eob_bob_error (-3); return 1; } n = JWindow->rows; if ((CBuf != JWindow->buffer) || (n == 1)) { return prev_visible_lines (n); } if (JWindow->trashed) { update (NULL, 0, 0, 1); if (JWindow->trashed) return prev_visible_lines (n); } this_line = LineNum; this_point = Point; col = calculate_column (); goto_top_of_window (); (void) goto_column1(&col); recenter(&JWindow->rows); if ((Last_Key_Function == (FVOID_STAR) pagedown_cmd) && (Jed_This_Key_Function == (FVOID_STAR) pageup_cmd)) { goto_line (&Last_Page_Line); if (Last_Page_Point < CLine->len) Point = Last_Page_Point; } else bol (); /* something like: Point = point_column(JWindow->column) better? */ Last_Page_Line = this_line; Last_Page_Point = this_point; return(1); }
void FragmentCanvas::change_scale() { double scale = the_canvas()->zoom(); Q3CanvasRectangle::setVisible(FALSE); setSize((int) (width_scale100*scale), (int) (height_scale100*scale)); check_size(); recenter(); Q3CanvasRectangle::setVisible(TRUE); Q3PtrListIterator<FragmentSeparatorCanvas> it(separators); for (; it.current(); ++it) it.current()->update(); }
void portal_travel() { int start_y; int start_x; int y; int x; // int target_x; // int target_y; start_y = player->y / FLOOR_H; start_x = player->x / CELL_TO_TILES; player->y--; draw_board(); lpause(); player->y--; draw_board(); lpause(); for (y = 0; y < MAX_FLOORS; y++) { for (x = 0; x < CELLS_W; x++) { if (get_cell(y, x) == CELL_PORTAL && x != start_x && y != start_y) { player->x = x * CELL_TO_TILES + 4; player->y = y * FLOOR_H + FLOOR_Y - 3; view_y = y * FLOOR_H; recenter(false); } } } draw_board(); lpause(); player->y++; draw_board(); lpause(); player->y++; draw_board(); return; }
void ActivityActionCanvas::change_scale() { QCanvasRectangle::setVisible(FALSE); double scale = the_canvas()->zoom(); setSize((int) (width_scale100*scale) | 1, (int) (height_scale100*scale) | 1); recenter(); QCanvasRectangle::setVisible(TRUE); // update pins position QValueList<PinCanvas *>::Iterator iter; for (iter = pins.begin(); iter != pins.end(); ++iter) (*iter)->do_change_scale(); // update paramsets position check_parameter_sets_position(); }
void UcClassCanvas::modified() { if (visible()) { hide(); hide_lines(); compute_size(); recenter(); show(); update_show_lines(); force_self_rel_visible(); if (the_canvas()->must_draw_all_relations()) { draw_all_depend_gene(); draw_all_simple_relations(); } check_stereotypeproperties(); canvas()->update(); package_modified(); } }
vector_markers_dispatch(svg_path_ptr const& src, svg_path_adapter & path, svg_attribute_type const& attrs, agg::trans_affine const& marker_trans, symbolizer_base const& sym, Detector & detector, double scale_factor, feature_impl const& feature, attributes const& vars, bool snap_to_pixels, markers_renderer_context & renderer_context) : params_(src->bounding_box(), recenter(src) * marker_trans, sym, feature, vars, scale_factor, snap_to_pixels) , renderer_context_(renderer_context) , src_(src) , path_(path) , attrs_(attrs) , detector_(detector) {}
void LabelCanvas::change_scale() { hide(); if (font().bold()) setFont((font().italic()) ? ((UmlCanvas *) scene())->get_font(UmlNormalBoldItalicFont) : ((UmlCanvas *) scene())->get_font(UmlNormalBoldFont)); else if (font().italic()) setFont(((UmlCanvas *) scene())->get_font(UmlNormalItalicFont)); else if (font().underline()) setFont(((UmlCanvas *) scene())->get_font(UmlNormalUnderlinedFont)); else setFont((font().strikeOut()) ? ((UmlCanvas *) scene())->get_font(UmlNormalStrikeOutFont) : ((UmlCanvas *) scene())->get_font(UmlNormalFont)); recenter(); show(); }
edgeCurve::edgeCurve(vector <ofVec3f> _init_verts, bool _is_slave) : mSlavedCurve(NULL), mMasterCurve(NULL), mIsSlave(_is_slave), mLocked(_is_slave), mPath(NULL), mMaxVertCnt(13), mMinVertCnt(4), mVertCnt(_init_verts.size()), mHole(NULL), mSlaveHole(NULL), mHoleSlaved(true), mResampleLine(NULL), mDrawZipper(NULL), mZipperPath(NULL), mZipperWidth(15) { int ind = 0; for (auto v : _init_verts) { mVerts.push_back(new draggableVertex(v, ind)); ind++; } if (mIsSlave == false) { mSlavedCurve = new edgeCurve(calcSlaveVerts(),true); mSlavedCurve->setMaster(this); mPath = new ofPath(); updatePath(); mPath->setFillColor(ofColor(185)); mPath->setFilled(true); mPath->setStrokeColor(ofColor(90)); mPath->setStrokeWidth(3); mZipperPath = new ofPath(); mZipperPath->setFillColor(ofColor(255,0,128,100)); //mZipperPath->setStrokeColor(ofColor(255,0,128,200)); //mZipperPath->setStrokeWidth(0.5); recenter(); } }
void MessageBoxContainer::showMessage( const std::string& title, const std::string& message, MessageBox::MessageType type, MessageBoxResultReceiver* rec, int tag ) { if(getGui()) { if(m_msg->getModalContainer()->getParent() == NULL) getGui()->add(m_msg->getModalContainer()); m_msg->getModalContainer()->bringToFront(); m_msg->getModalContainer()->setVisibility(true); } setGlobalOpacity(0.0f); bringToFront(); m_msg->showMessage(title,message,m_frame,type,rec,tag); setSize(m_frame->getSize()); recenter(); setVisibility(true); bool gotFocus = requestModalFocus(); }
void ActivityPartitionCanvas::turn(int cx100, int cy100) { horiz ^= TRUE; setSize(height(), width()); if (cx100 == -1000) { // first turn partition cx100 = center_x_scale100; cy100 = center_y_scale100; } else { int dx = center_x_scale100 - cx100; int dy = center_y_scale100 - cy100; if (horiz) { center_x_scale100 = cx100 + dy; center_y_scale100 = cy100 - dx; } else { center_x_scale100 = cx100 - dy; center_y_scale100 = cy100 + dx; } } recenter(); DiagramCanvas::resize(width(), height()); Q3CanvasItemList all = the_canvas()->allItems(); Q3CanvasItemList::Iterator cit; for (cit = all.begin(); cit != all.end(); ++cit) { if ((*cit)->visible()) { ActivityPartitionCanvas * p = dynamic_cast<ActivityPartitionCanvas *>(*cit); if ((p != 0) && (p->get_bn()->parent() == browser_node) && (p->horiz != horiz)) { p->turn(cx100, cy100); } } } }
/** * Saves the new options and returns to the proper origin screen. * @param action Pointer to an action. */ void OptionsBaseState::btnOkClick(Action *) { int dX = Options::baseXResolution; int dY = Options::baseYResolution; Screen::updateScale(Options::battlescapeScale, Options::newBattlescapeScale, Options::baseXBattlescape, Options::baseYBattlescape, _origin == OPT_BATTLESCAPE); Screen::updateScale(Options::geoscapeScale, Options::newGeoscapeScale, Options::baseXGeoscape, Options::baseYGeoscape, _origin != OPT_BATTLESCAPE); dX = Options::baseXResolution - dX; dY = Options::baseYResolution - dY; recenter(dX, dY); Options::switchDisplay(); Options::save(); if (Options::reload && _origin == OPT_MENU) { Options::mapResources(); } _game->loadLanguage(Options::language); SDL_WM_GrabInput(Options::captureMouse); _game->getScreen()->resetDisplay(); _game->setVolume(Options::soundVolume, Options::musicVolume, Options::uiVolume); if (Options::reload && _origin == OPT_MENU) { _game->setState(new StartState); } else { // Confirm any video options changes if (Options::displayWidth != Options::newDisplayWidth || Options::displayHeight != Options::newDisplayHeight || Options::useOpenGL != Options::newOpenGL || Options::useScaleFilter != Options::newScaleFilter || Options::useHQXFilter != Options::newHQXFilter || Options::useOpenGLShader != Options::newOpenGLShader) { _game->pushState(new OptionsConfirmState(_origin)); } else { restart(_origin); } } }
void add_path(T & path) { marker_placement_enum placement_method = get<marker_placement_enum>( sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT); bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_, false); bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false); double opacity = get<double>(sym_, keys::opacity, feature_, vars_, 1.0); double spacing = get<double>(sym_, keys::spacing, feature_, vars_, 100.0); double max_error = get<double>(sym_, keys::max_error, feature_, vars_, 0.2); coord2d center = bbox_.center(); agg::trans_affine_translation recenter(-center.x, -center.y); agg::trans_affine tr = recenter * marker_trans_; markers_placement_finder<T, label_collision_detector4> placement_finder( placement_method, path, bbox_, tr, detector_, spacing * scale_factor_, max_error, allow_overlap); double x, y, angle = .0; while (placement_finder.get_point(x, y, angle, ignore_placement)) { agg::trans_affine matrix = tr; matrix.rotate(angle); matrix.translate(x, y); render_vector_marker( ctx_, pixel_position(x, y), marker_, bbox_, attributes_, matrix, opacity, false); } }