示例#1
0
void ArrowMultiLineComp::Read (istream& in) {
    MultiLineComp::Read(in);
    SF_MultiLine* ml = GetMultiLine();
    Coord* x, *y;
    int count, h, t;
    float scale;

    const Coord* cx, * cy;
    count = ml->GetOriginal(cx, cy);
    x = (Coord*)cx; y = (Coord*)cy;

    in >> h >> t >> scale;

    ArrowMultiLine* aml = new ArrowMultiLine(x, y, count, h, t, scale, ml);

    SetGraphic(aml);
    delete ml;
}
示例#2
0
文件: line.cpp 项目: PNCG/neuron
void MultiLineComp::Write (ostream& out) {
    VerticesComp::Write(out);
    SF_MultiLine* ml = GetMultiLine();
    const Coord* x, *y;
    int count = ml->GetOriginal(x, y);

    WriteVertices(x, y, count, out);

    WriteBgFilled(ml->BgFilled(), out);
    WriteColor(ml->GetFgColor(), out);
    WriteColor(ml->GetBgColor(), out);
    WriteBrush(ml->GetBrush(), out);
    WritePattern(ml->GetPattern(), out);
    WriteTransformer(ml->GetTransformer(), out);
}
示例#3
0
文件: line.cpp 项目: PNCG/neuron
void MultiLineComp::Read (istream& in) {
    VerticesComp::Read(in);
    Coord* x, *y;
    int count;

    ReadVertices(in, x, y, count);
    SF_MultiLine* ml = new SF_MultiLine(x, y, count);
    delete x;
    delete y;

    ml->FillBg(ReadBgFilled(in));
    PSColor* fg = ReadColor(in);
    PSColor* bg = ReadColor(in);
    ml->SetColors(fg, bg);
    ml->SetBrush(ReadBrush(in));
    ml->SetPattern(ReadPattern(in));

    Transformer* t = ReadTransformer(in);
    ml->SetTransformer(t);
    Unref(t);

    SetGraphic(ml);
}
示例#4
0
文件: line.cpp 项目: PNCG/neuron
Command* MultiLineView::InterpretManipulator (Manipulator* m) {
    DragManip* dm = (DragManip*) m;
    Editor* ed = dm->GetViewer()->GetEditor();
    Tool* tool = dm->GetTool();
    Transformer* rel = dm->GetTransformer();
    Command* cmd = nil;

    if (tool->IsA(GRAPHIC_COMP_TOOL)) {
        GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband();
        Coord* x, *y;
        int n, pt;
        gv->GetCurrent(x, y, n, pt);

        if (n > 2 || x[0] != x[1] || y[0] != y[1]) {
            BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar");
            PatternVar* patVar = (PatternVar*) ed->GetState("PatternVar");
            ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar");

            if (rel != nil) {
                rel = new Transformer(rel);
                rel->Invert();
            }

            Graphic* pg = GetGraphicComp()->GetGraphic();
            SF_MultiLine* polygon = new SF_MultiLine(x, y, n, pg);

            if (brVar != nil) polygon->SetBrush(brVar->GetBrush());
            if (patVar != nil) polygon->SetPattern(patVar->GetPattern());

            if (colVar != nil) {
                polygon->SetColors(colVar->GetFgColor(), colVar->GetBgColor());
            }
            polygon->SetTransformer(rel);
            Unref(rel);
            cmd = new PasteCmd(ed, new Clipboard(new MultiLineComp(polygon)));
        }
        delete x;
        delete y;

    } else if (tool->IsA(RESHAPE_TOOL)) {
        GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband();
        Coord* x, *y;
        int n, pt;
        gv->RemoveVertex();
        gv->GetCurrent(x, y, n, pt);

	if (rel != nil) {
            rel = new Transformer(rel);
            rel->Invert();
        }

        SF_MultiLine* polygon = new SF_MultiLine(x, y, n, GetGraphic());
	delete x;
	delete y;
        polygon->SetTransformer(rel);
        Unref(rel);
	cmd = new ReplaceCmd(ed, new MultiLineComp(polygon));

    } else {
        cmd = VerticesView::InterpretManipulator(m);
    }
    return cmd;
}