Ticket #729: arced.patch

File arced.patch, 5.7 KB (added by westram, 8 years ago)

patch vs trunk @ 15376 (code discarded during impl. of #578)

  • WINDOW/AW_print.cxx

     
    261261bool AW_device_print::arc_impl(int gc, AW::FillStyle filled, const AW::Position& center, const AW::Vector& radius, int start_degrees, int arc_degrees, AW_bitset filteri) {
    262262    bool drawflag = false;
    263263    if (filteri && filter) {
    264         aw_assert(radius.x()>0 && radius.y()>0);
     264        // aw_assert(radius.x() != 0 && radius.y() != 0);
     265
     266        if (nearlyZero(radius.x())) return false; // @@@ hack: skip (should print a line)
     267        if (nearlyZero(radius.y())) return false; // @@@ hack: skip (should print a line)
     268
    265269        Rectangle Box(center-radius, center+radius);
    266270        Rectangle screen_box = transform(Box);
     271
    267272        Rectangle clipped_box;
    268         drawflag          = box_clip(screen_box, clipped_box);
     273        drawflag = box_clip(screen_box, clipped_box);
     274
    269275        bool half_visible = (clipped_box.surface()*2) > screen_box.surface();
    270 
    271276        drawflag = drawflag && half_visible;
    272277        // @@@ correct behavior would be to draw an arc if only partly visible
    273278
  • SL/TREEDISP/TreeDisplay.cxx

     
    25422542                remarkPos.movey(scaled_remark_ascend*(right ? 1.2 : -0.1)); // lower subtree -> draw below branch; upper subtree -> draw above branch
    25432543                const AW_pos   alignment = 1; // =right-justified
    25442544
     2545                // @@@ circle and remark positions are wrong for BS_ARCHED!
     2546
    25452547                bool bootstrap_shown = TREE_show_branch_remark(disp_device, son->get_remark(), son->is_leaf, remarkPos, alignment, remark_text_filter, bootstrap_min);
    25462548                if (show_circle && bootstrap_shown) {
    25472549                    show_bootstrap_circle(disp_device, son->get_remark(), circle_zoom_factor, circle_max_size, len, circlePos, use_ellipse, scaled_branch_distance, bs_circle_filter);
     
    25512553            set_line_attributes_for(son);
    25522554            unsigned int gc = son->gr.gc;
    25532555
    2554             if (branch_style == BS_RECTANGULAR) {
    2555                 draw_branch_line(gc, s, n, line_filter);
    2556                 draw_branch_line(gc, attach, s, vert_line_filter);
     2556            switch (branch_style) {
     2557                case BS_RECTANGULAR:
     2558                    draw_branch_line(gc, s, n, line_filter);
     2559                    draw_branch_line(gc, attach, s, vert_line_filter);
     2560                    break;
     2561
     2562                case BS_DIAGONAL:
     2563                    draw_branch_line(gc, attach, n, line_filter);
     2564                    break;
     2565
     2566                case BS_ARCHED: {
     2567                    Position center = attach+(n-s);
     2568                    disp_device->arc(gc, FillStyle::EMPTY, center, s-center, right ? 90 : 180, 90, line_filter);
     2569                    break;
     2570                }
    25572571            }
    2558             else {
    2559                 td_assert(branch_style == BS_DIAGONAL);
    2560                 draw_branch_line(gc, attach, n, line_filter);
    2561             }
    25622572        }
    25632573        if (at->name) {
    25642574            diamond(at->gr.gc, attach, NT_DIAMOND_RADIUS);
     
    35803590
    35813591        aws->label("Branch style");
    35823592        aws->create_option_menu(AWAR_DTREE_BRANCH_STYLE, true);
    3583         aws->insert_default_option("Rectangular",     "R", BS_RECTANGULAR);
    3584         aws->insert_option        ("Diagonal",        "D", BS_DIAGONAL);
     3593        aws->insert_default_option("Rectangular", "R", BS_RECTANGULAR);
     3594        aws->insert_option        ("Diagonal",    "D", BS_DIAGONAL);
     3595        aws->insert_option        ("Arched",      "A", BS_ARCHED);
    35853596        aws->update_option_menu();
    35863597        aws->at_newline();
    35873598
     
    40104021                        const AttachSettings& SETT = attach_settings[attach_style];
    40114022                        char *spool_name2 = GBS_global_string_copy("%s%s", spool_name, SETT.suffix);
    40124023
    4013                         for (BranchStyle bstyle = BS_RECTANGULAR; bstyle<=BS_DIAGONAL; bstyle = BranchStyle(bstyle+1)) {
     4024                        for (BranchStyle bstyle = BS_RECTANGULAR; bstyle<=BS_ARCHED; bstyle = BranchStyle(bstyle+1)) {
    40144025                            if (bstyle != BS_RECTANGULAR) { // test alternate branch-styles only ..
    40154026                                if (istyle != AP_TREE_NORMAL) continue; // .. for dendrogram view
    40164027                                if (attach_style != 0 && attach_style != 3) continue; // .. for traditional and centered attach_points
     
    40194030                            static const char *suffix[] = {
    40204031                                "",
    40214032                                "_diagonal",
     4033                                "_arched",
    40224034                            };
    40234035
    40244036                            char *spool_name3 = GBS_global_string_copy("%s%s", spool_name2, suffix[bstyle]);
    40254037
    4026 // #define TEST_AUTO_UPDATE // dont test, instead update expected results
     4038#define TEST_AUTO_UPDATE // dont test, instead update expected results
    40274039                            {
    40284040                                char *spool_file     = GBS_global_string_copy("%s_curr.fig", spool_name3);
    40294041                                char *spool_expected = GBS_global_string_copy("%s.fig", spool_name3);
  • SL/TREEDISP/TreeDisplay.hxx

     
    255255enum BranchStyle {
    256256    BS_RECTANGULAR, // traditional rectangular branches
    257257    BS_DIAGONAL,    // diagonal branches (directly from fathers to sons attach point)
     258    BS_ARCHED,      // using arcs (located between BS_RECTANGULAR and BS_DIAGONAL)
    258259};
    259260
    260261enum GroupStyle {