Changeset 2895 for trunk/src


Ignore:
Timestamp:
02/19/14 20:41:19 (10 years ago)
Author:
WataruKawasaki
Message:

New Development: Yes

JIRA Issue: Yes CAS-6168

Ready for Test: Yes

Interface Changes:

What Interface Changed:

Test Programs:

Put in Release Notes: Yes

Module(s): sd.plotter2

Description: added methods to sd.plotter2 to enable changing the size and shape of the entire region to be plotted (which is referred to as 'viewsurface' in PGPLOT).


Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Plotter2.cpp

    r2861 r2895  
    294294    hasDefaultViewport = true;
    295295    currentViewportId = 0;
     296
     297    width = 8.82796; // default viewsurface width seems to be this value.
     298    aspect = 0.75;   // default viewsurface aspect
    296299}
    297300
     
    320323    cpgopen((filename + "/" + device).c_str());
    321324    hasDevice = true;
     325}
     326
     327float Plotter2::getViewSurfaceWidth() {
     328    return width;
     329}
     330
     331float Plotter2::getViewSurfaceAspect() {
     332    return aspect;
     333}
     334
     335void Plotter2::setViewSurface(const float inWidth, const float inAspect) {
     336    width = inWidth;
     337    aspect = inAspect;
    322338}
    323339
     
    11271143    open();
    11281144
     1145    if ((width > 0.0) && (aspect > 0.0)) {
     1146        cpgpap(width, aspect);
     1147    }
     1148
    11291149    cpgscr(0, 1.0, 1.0, 1.0); // set background color white
    11301150    cpgscr(1, 0.0, 0.0, 0.0); // set foreground color black
  • trunk/src/Plotter2.h

    r2861 r2895  
    162162    void setDevice(const std::string& inDevice);
    163163
     164    float getViewSurfaceWidth();
     165    float getViewSurfaceAspect();
     166    void setViewSurface(const float width, const float aspect);
    164167    int addViewport(const float xmin, const float xmax, const float ymin, const float ymax);
    165168    void setViewport(const float xmin, const float xmax, const float ymin, const float ymax, const int id);
     
    208211    bool hasDefaultViewport;
    209212    int currentViewportId;
     213    float width;
     214    float aspect;
    210215    void open();
    211216    void close();
  • trunk/src/python_Plotter2.cpp

    r2830 r2895  
    4444         .def("get_device",&Plotter2::getDevice)
    4545         .def("set_device",&Plotter2::setDevice)
     46         .def("get_viewsurface_width",&Plotter2::getViewSurfaceWidth)
     47         .def("get_viewsurface_aspect",&Plotter2::getViewSurfaceAspect)
     48         .def("set_viewsurface",&Plotter2::setViewSurface)
    4649         .def("add_viewport",&Plotter2::addViewport)
    4750         .def("set_viewport",&Plotter2::setViewport)
Note: See TracChangeset for help on using the changeset viewer.