Exemplo n.º 1
0
void Polyline_2r::push_back(SharedPoint_2r v) {
    vertices_.push_back(v);

    SigRegisterPoint_2r(*v);
    SigPushVisualPoint_2r(*v, Visual::Point(mat_vertex_));

    if (vertices_.size() > 1) {
        SigPushVisualSegment_2r(Segment_2r(back(1), back(0)),
                                Visual::Segment(mat_edge_), 1000);
    }
}
Exemplo n.º 2
0
void Polyline_2r::push_front(SharedPoint_2r v) {
    vertices_.push_front(v);

    SigRegisterPoint_2r(*v);
    SigPushVisualPoint_2r(*v, Visual::Point(mat_vertex_, z_order_));

    if (vertices_.size() > 1) {
        SigPushVisualSegment_2r(Segment_2r(front(0), front(1)),
                                Visual::Segment(mat_edge_), 1000);
    }
}
Exemplo n.º 3
0
Polyline_2r::~Polyline_2r() {
    LOG(DEBUG) << "destroying polyline...";

    SharedPoint_2r last_vertex;
    for (auto vertex : vertices_) {
        SigPopVisualPoint_2r(*vertex);

        if (last_vertex) {
            SigPopVisualSegment_2r(Segment_2r(last_vertex, vertex));
        }

        last_vertex = vertex;
    }
}
Exemplo n.º 4
0
void Select() override {
    LOG(DEBUG) << "selecting polyline.";

    Visual::Material selected_mat;
    selected_mat.set_ambient(Visual::Color::SKYBLUE);

    SharedPoint_2r last_vertex;
    for (auto vertex : model_polyline_.vertices()) {
        SigPushVisualPoint_2r(*vertex, Visual::Point(selected_mat, 
            model_polyline_.z_order()));

        if (last_vertex) {
            SigPushVisualSegment_2r(Segment_2r(last_vertex, vertex),
                                    Visual::Segment(selected_mat));
        }

        last_vertex = vertex;
    }
}