Changeset fc43dda in git


Ignore:
Timestamp:
29/08/19 07:08:47 (3 weeks ago)
Author:
Olly Betts <olly@…>
Branches:
master
Children:
72fac59
Parents:
b0908ea
Message:

Allow colouring by horizontal or vertical error

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • lib/survex.pot

    rb0908ea rfc43dda  
    22342234#: n:289
    22352235msgid "Colour by &Error"
     2236msgstr ""
     2237
     2238#: ../src/gfxcore.cc:4250
     2239#: ../src/mainfrm.cc:902
     2240#: n:480
     2241msgid "Colour by &Horizontal Error"
     2242msgstr ""
     2243
     2244#: ../src/gfxcore.cc:4250
     2245#: ../src/mainfrm.cc:903
     2246#: n:481
     2247msgid "Colour by &Vertical Error"
    22362248msgstr ""
    22372249
  • src/gfxcore.cc

    rb0908ea rfc43dda  
    10541054    key_lowerleft[m_ColourBy].x = left - KEY_EXTRA_LEFT_MARGIN;
    10551055    key_lowerleft[m_ColourBy].y = bottom;
     1056    switch (m_ColourBy) {
     1057        case COLOUR_BY_ERROR:
     1058        case COLOUR_BY_H_ERROR:
     1059        case COLOUR_BY_V_ERROR:
     1060            key_lowerleft[COLOUR_BY_ERROR] = key_lowerleft[m_ColourBy];
     1061            key_lowerleft[COLOUR_BY_H_ERROR] = key_lowerleft[m_ColourBy];
     1062            key_lowerleft[COLOUR_BY_V_ERROR] = key_lowerleft[m_ColourBy];
     1063    }
    10561064
    10571065    int y = bottom;
     
    26092617        void (GfxCore::* add_poly)(const traverse&);
    26102618        if (surface) {
    2611             if (m_ColourBy == COLOUR_BY_ERROR) {
    2612                 add_poly = &GfxCore::AddPolylineError;
    2613             } else {
    2614                 add_poly = &GfxCore::AddPolyline;
     2619            switch (m_ColourBy) {
     2620                case COLOUR_BY_ERROR:
     2621                case COLOUR_BY_H_ERROR:
     2622                case COLOUR_BY_V_ERROR:
     2623                    add_poly = &GfxCore::AddPolylineError;
     2624                    break;
     2625                default:
     2626                    add_poly = &GfxCore::AddPolyline;
    26152627            }
    26162628        } else {
     
    31593171                key_list = LIST_DATE_KEY; break;
    31603172            case COLOUR_BY_ERROR:
     3173            case COLOUR_BY_H_ERROR:
     3174            case COLOUR_BY_V_ERROR:
    31613175                key_list = LIST_ERROR_KEY; break;
    31623176            case COLOUR_BY_GRADIENT:
     
    35613575{
    35623576    BeginPolyline();
    3563     SetColourFromError(centreline.E, 1.0);
     3577    SetColourFromError(centreline.errors[error_type], 1.0);
    35643578    vector<PointInfo>::const_iterator i;
    35653579    for(i = centreline.begin(); i != centreline.end(); ++i) {
     
    40484062            break;
    40494063        case COLOUR_BY_ERROR:
     4064        case COLOUR_BY_H_ERROR:
     4065        case COLOUR_BY_V_ERROR:
    40504066            AddQuad = &GfxCore::AddQuadrilateralError;
    40514067            AddPoly = &GfxCore::AddPolylineError;
     
    40664082            AddQuad = &GfxCore::AddQuadrilateral;
    40674083            AddPoly = &GfxCore::AddPolyline;
     4084            break;
     4085    }
     4086
     4087    switch (colour_by) {
     4088        case COLOUR_BY_ERROR:
     4089            error_type = traverse::ERROR_3D;
     4090            break;
     4091        case COLOUR_BY_H_ERROR:
     4092            error_type = traverse::ERROR_H;
     4093            break;
     4094        case COLOUR_BY_V_ERROR:
     4095            error_type = traverse::ERROR_V;
    40684096            break;
    40694097    }
     
    43134341        menu.AppendCheckItem(menu_COLOUR_BY_DATE, wmsg(/*Colour by D&ate*/293));
    43144342        menu.AppendCheckItem(menu_COLOUR_BY_ERROR, wmsg(/*Colour by &Error*/289));
     4343        menu.AppendCheckItem(menu_COLOUR_BY_H_ERROR, wmsg(/*Colour by &Horizontal Error*/480));
     4344        menu.AppendCheckItem(menu_COLOUR_BY_V_ERROR, wmsg(/*Colour by &Vertical Error*/481));
    43154345        menu.AppendCheckItem(menu_COLOUR_BY_GRADIENT, wmsg(/*Colour by &Gradient*/85));
    43164346        menu.AppendCheckItem(menu_COLOUR_BY_LENGTH, wmsg(/*Colour by &Length*/82));
  • src/gfxcore.h

    rb0908ea rfc43dda  
    9292    COLOUR_BY_DATE,
    9393    COLOUR_BY_ERROR,
     94    COLOUR_BY_H_ERROR,
     95    COLOUR_BY_V_ERROR,
    9496    COLOUR_BY_GRADIENT,
    9597    COLOUR_BY_LENGTH,
     
    200202    bool m_Tubes;
    201203    int m_ColourBy;
     204    int error_type;
    202205
    203206    bool m_HaveData;
  • src/guicontrol.cc

    rb0908ea rfc43dda  
    542542}
    543543
     544void GUIControl::OnColourByHError()
     545{
     546    if (m_View->ColouringBy() == COLOUR_BY_H_ERROR) {
     547        m_View->SetColourBy(COLOUR_BY_NONE);
     548    } else {
     549        m_View->SetColourBy(COLOUR_BY_H_ERROR);
     550    }
     551}
     552
     553void GUIControl::OnColourByVError()
     554{
     555    if (m_View->ColouringBy() == COLOUR_BY_V_ERROR) {
     556        m_View->SetColourBy(COLOUR_BY_NONE);
     557    } else {
     558        m_View->SetColourBy(COLOUR_BY_V_ERROR);
     559    }
     560}
     561
    544562void GUIControl::OnColourByGradient()
    545563{
     
    590608    cmd.Enable(m_View->HasData());
    591609    cmd.Check(m_View->ColouringBy() == COLOUR_BY_ERROR);
     610}
     611
     612void GUIControl::OnColourByHErrorUpdate(wxUpdateUIEvent& cmd)
     613{
     614    cmd.Enable(m_View->HasData());
     615    cmd.Check(m_View->ColouringBy() == COLOUR_BY_H_ERROR);
     616}
     617
     618void GUIControl::OnColourByVErrorUpdate(wxUpdateUIEvent& cmd)
     619{
     620    cmd.Enable(m_View->HasData());
     621    cmd.Check(m_View->ColouringBy() == COLOUR_BY_V_ERROR);
    592622}
    593623
  • src/guicontrol.h

    rb0908ea rfc43dda  
    7676    void OnColourByDate();
    7777    void OnColourByError();
     78    void OnColourByHError();
     79    void OnColourByVError();
    7880    void OnColourByGradient();
    7981    void OnColourByLength();
     
    134136    void OnColourByDateUpdate(wxUpdateUIEvent&);
    135137    void OnColourByErrorUpdate(wxUpdateUIEvent&);
     138    void OnColourByHErrorUpdate(wxUpdateUIEvent&);
     139    void OnColourByVErrorUpdate(wxUpdateUIEvent&);
    136140    void OnColourByGradientUpdate(wxUpdateUIEvent&);
    137141    void OnColourByLengthUpdate(wxUpdateUIEvent&);
  • src/mainfrm.cc

    rb0908ea rfc43dda  
    574574    EVT_MENU(menu_COLOUR_BY_DATE, MainFrm::OnColourByDate)
    575575    EVT_MENU(menu_COLOUR_BY_ERROR, MainFrm::OnColourByError)
     576    EVT_MENU(menu_COLOUR_BY_H_ERROR, MainFrm::OnColourByHError)
     577    EVT_MENU(menu_COLOUR_BY_V_ERROR, MainFrm::OnColourByVError)
    576578    EVT_MENU(menu_COLOUR_BY_GRADIENT, MainFrm::OnColourByGradient)
    577579    EVT_MENU(menu_COLOUR_BY_LENGTH, MainFrm::OnColourByLength)
     
    637639    EVT_UPDATE_UI(menu_COLOUR_BY_DATE, MainFrm::OnColourByDateUpdate)
    638640    EVT_UPDATE_UI(menu_COLOUR_BY_ERROR, MainFrm::OnColourByErrorUpdate)
     641    EVT_UPDATE_UI(menu_COLOUR_BY_H_ERROR, MainFrm::OnColourByHErrorUpdate)
     642    EVT_UPDATE_UI(menu_COLOUR_BY_V_ERROR, MainFrm::OnColourByVErrorUpdate)
    639643    EVT_UPDATE_UI(menu_COLOUR_BY_GRADIENT, MainFrm::OnColourByGradientUpdate)
    640644    EVT_UPDATE_UI(menu_COLOUR_BY_LENGTH, MainFrm::OnColourByLengthUpdate)
     
    891895    colourbymenu->AppendCheckItem(menu_COLOUR_BY_DATE, wmsg(/*Colour by D&ate*/293));
    892896    colourbymenu->AppendCheckItem(menu_COLOUR_BY_ERROR, wmsg(/*Colour by &Error*/289));
     897    colourbymenu->AppendCheckItem(menu_COLOUR_BY_H_ERROR, wmsg(/*Colour by &Horizontal Error*/480));
     898    colourbymenu->AppendCheckItem(menu_COLOUR_BY_V_ERROR, wmsg(/*Colour by &Vertical Error*/481));
    893899    colourbymenu->AppendCheckItem(menu_COLOUR_BY_GRADIENT, wmsg(/*Colour by &Gradient*/85));
    894900    colourbymenu->AppendCheckItem(menu_COLOUR_BY_LENGTH, wmsg(/*Colour by &Length*/82));
  • src/mainfrm.h

    rb0908ea rfc43dda  
    125125    menu_COLOUR_BY_DATE,
    126126    menu_COLOUR_BY_ERROR,
     127    menu_COLOUR_BY_H_ERROR,
     128    menu_COLOUR_BY_V_ERROR,
    127129    menu_COLOUR_BY_GRADIENT,
    128130    menu_COLOUR_BY_LENGTH,
     
    292294    void OnColourByDateUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByDateUpdate(event); }
    293295    void OnColourByErrorUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByErrorUpdate(event); }
     296    void OnColourByHErrorUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByHErrorUpdate(event); }
     297    void OnColourByVErrorUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByVErrorUpdate(event); }
    294298    void OnColourByGradientUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByGradientUpdate(event); }
    295299    void OnColourByLengthUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByLengthUpdate(event); }
     
    342346    void OnColourByDate(wxCommandEvent&) { if (m_Control) m_Control->OnColourByDate(); }
    343347    void OnColourByError(wxCommandEvent&) { if (m_Control) m_Control->OnColourByError(); }
     348    void OnColourByHError(wxCommandEvent&) { if (m_Control) m_Control->OnColourByHError(); }
     349    void OnColourByVError(wxCommandEvent&) { if (m_Control) m_Control->OnColourByVError(); }
    344350    void OnColourByGradient(wxCommandEvent&) { if (m_Control) m_Control->OnColourByGradient(); }
    345351    void OnColourByLength(wxCommandEvent&) { if (m_Control) m_Control->OnColourByLength(); }
  • src/model.cc

    rb0908ea rfc43dda  
    328328                        t->n_legs = survey->n_legs;
    329329                        t->length = survey->length;
    330                         t->E = survey->E;
    331                         t->H = survey->H;
    332                         t->V = survey->V;
     330                        t->errors[traverse::ERROR_3D] = survey->E;
     331                        t->errors[traverse::ERROR_H] = survey->H;
     332                        t->errors[traverse::ERROR_V] = survey->V;
    333333                        --n;
    334334                        ++t;
  • src/model.h

    rb0908ea rfc43dda  
    8484class traverse : public vector<PointInfo> {
    8585  public:
    86     int n_legs;
     86    int n_legs = 0;
    8787    // Bitmask of img_FLAG_SURFACE, img_FLAG_SPLAY and img_FLAG_DUPLICATE.
    88     int flags;
    89     double length;
    90     double E, H, V;
     88    int flags = 0;
     89    double length = 0.0;
     90    enum { ERROR_3D = 0, ERROR_H = 1, ERROR_V = 2 };
     91    double errors[3] = {0, 0, 0};
    9192    wxString name;
    9293
    9394    explicit
    94     traverse(const char* name_)
    95         : n_legs(0), flags(0),
    96           length(0), E(-1), H(-1), V(-1),
    97           name(name_, wxConvUTF8) {
     95    traverse(const char* name_) : name(name_, wxConvUTF8) {
    9896        if (name.empty() && !name_[0]) {
    9997            // If name isn't valid UTF-8 then this conversion will
Note: See TracChangeset for help on using the changeset viewer.