美文网首页
21.5 开放多线段

21.5 开放多线段

作者: Jianbaozi | 来源:发表于2019-04-11 16:07 被阅读0次
Annotation 2019-04-15 223227.png
#include <iostream>
#include <sstream>
#include "Graph.h"
#include "GUI.h"
#include "Simple_Window.h"
#include "GUI.h"
#include "Window.h"
struct Lines_window :Window {
    Lines_window(Point xy, int w, int h, const string& title);
    Open_polyline lines;
private:
    Button next_button;
    Button quit_button;
    In_box next_x;
    In_box next_y;
    Out_box xy_out;
    void next();
    void quit();
};
Lines_window::Lines_window(Point xy, int w, int h, const string& title) :
  Window{ xy,w,h,title },
next_button{ Point{x_max() - 150,0 },70,20,"Next Point",
  [](Address,Address pw) {reference_to<Lines_window>(pw).next(); } },
quit_button{ Point{x_max() - 70,0},70,20,"Quit",
  [](Address,Address pw) {reference_to<Lines_window>(pw).quit(); } },
next_x{ Point{x_max() - 310,0},50,20,"next x:" },
next_y{ Point{x_max() - 210,0},50,20,"next y:" },
xy_out{ Point{100,0},100,20,"current(x,y):" }{
    attach(next_button);
    attach(quit_button);
    attach(next_x);
    attach(next_y);
    attach(xy_out);
    attach(lines);
}
void Lines_window::next() {
    int x = next_x.get_int();
    int y = next_y.get_int();
    lines.add(Point{ x,y });
    lines.set_style(Line_style{ Line_style::solid,2 });//不改一下线粗根本看不出来效果
    lines.set_color(Color::dark_green);
    stringstream ss;
    ss << '(' << x << ',' << y << ')';
    xy_out.put(ss.str());
    redraw();
}
void Lines_window::quit() {
    hide();
}
int main() {
        Lines_window win(Point(100, 100), 600, 400, "lines");
        return gui_main();
}

相关文章

  • 21.5 开放多线段

  • 你以为的不一定是对的

    1. 如果问你两条长度不同的线段,哪条线段上的点多?你会怎样回答? 你可能觉得肯定是哪条线段长,哪天线段上的点就多...

  • 除法

    3 python3 python2 21.5/2,21.5//2,py2和py3都是10.75、10.021//2...

  • pedit修改多线段线宽

    1、选中要修改的多线段。 2、键入edit,然后再键入w,或在下拉菜单中选择宽度(W)。 3、输入新的线宽数值 。...

  • 压死骆驼的最后一根稻草

    21.5万,多吗?不多,但为什么20多万足以压垮我,让我剑走偏锋,有轻生的念头呢?其实压垮骆驼的往往是最...

  • 2018-07-11GBPAUD交易计划书

    品种:GBPAUD,5F短线做多,长线看空 理由1:缠论+MAT分析,周线上看形成黄色线段下跌一笔,在黄色线段内部...

  • OpenCV基本绘图函数

    线段:line 函数 img: 要绘制线段的图像。 pt1: 线段的起点。 pt2: 线段的终点。 color: ...

  • 一点微小的基础知识

    缠论基础核心:线段的唯一1.线段画法的由来2.线段画法的4个必要条件3.线段的转折4.线段的延伸5.线段的分类6....

  • 【Axure10】样式区域-元件样式(线段)

    样式区域-元件样式(线段) 线段样式 线段的样式与其它相同,唯一区别在于线段可以选择对应的线段两端样式。 Axur...

  • var data = [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, ...

网友评论

      本文标题:21.5 开放多线段

      本文链接:https://www.haomeiwen.com/subject/maztwqtx.html