当前位置: 首页>>代码示例>>C++>>正文


C++ Transformer::Transform方法代码示例

本文整理汇总了C++中Transformer::Transform方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformer::Transform方法的具体用法?C++ Transformer::Transform怎么用?C++ Transformer::Transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transformer的用法示例。


在下文中一共展示了Transformer::Transform方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Align

void AlignToGridCmd::Align (GraphicView* gv, float refx, float refy) {
    MoveData* md = (MoveData*) Recall(gv->GetGraphicComp());

    if (md == nil) {
        Viewer* v = gv->GetViewer();
        Grid* grid = (v == nil) ? nil : v->GetGrid();

        if (grid == nil) {
            return;
        }

        Graphic* g = gv->GetGraphic();
        Transformer t;
        g->Parent()->TotalTransformation(t);
        t.Invert();

        Coord cx = iv26_round(refx);
        Coord cy = iv26_round(refy);

        grid->Constrain(cx, cy);

        float dx, dy, trefx, trefy;

        t.Transform(float(cx), float(cy), dx, dy);
        t.Transform(refx, refy, trefx, trefy);

        dx -= trefx;
        dy -= trefy;
        Store(gv->GetGraphicComp(), new MoveData(dx, dy));

    }
    Move(gv->GetGraphicComp());
}
开发者ID:PNCG,项目名称:neuron,代码行数:33,代码来源:align.cpp

示例2: intersects

bool RasterRect::intersects (BoxObj& userb, Graphic* gs) {
    Transformer* t = gs->GetTransformer();
    Coord xmax = _raster->Width();
    Coord ymax = _raster->Height();
    Coord tx0, ty0, tx1, ty1;
    
    if (t != nil && t->Rotated()) {
	Coord x[4], tx[5];
	Coord y[4], ty[5];
    
	x[0] = x[3] = y[0] = y[1] = 0;
	x[2] = x[1] = xmax;
	y[2] = y[3] = ymax;
	transformList(x, y, 4, tx, ty, gs);
	tx[4] = tx[0];
	ty[4] = ty[0];
	FillPolygonObj fp (tx, ty, 5);
	return fp.Intersects(userb);
    
    } else if (t != nil) {
	t->Transform(0, 0, tx0, ty0);
	t->Transform(xmax, ymax, tx1, ty1);
	BoxObj b1 (tx0, ty0, tx1, ty1);
	return b1.Intersects(userb);

    } else {
	BoxObj b2 (0, 0, xmax, ymax);
	return b2.Intersects(userb);
    }
}
开发者ID:PNCG,项目名称:neuron,代码行数:30,代码来源:rasterrect.cpp

示例3: transform

void Graphic::transform (Coord& x, Coord& y, Graphic* g) {
    Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer();

    if (t != nil) {
        t->Transform(x, y);
    }
}
开发者ID:neurodebian,项目名称:iv-hines,代码行数:7,代码来源:graphic.cpp

示例4: Picture

LinkComp::LinkComp (Line* line) {
    if (line != nil) {
        Coord x0, y0, x1, y1;
        float fx0, fy0, fx1, fy1;

        line->GetOriginal(x0, y0, x1, y1);
        Transformer* t = line->GetTransformer();
        Graphic* parent = new Picture(line);
        parent->SetTransformer(nil);

        if (t == nil) {
            fx0 = x0; fy0 = y0; fx1 = x1; fy1 = y1;
        } else {
            t->Transform(float(x0), float(y0), fx0, fy0);
            t->Transform(float(x1), float(y1), fx1, fy1);
        }
        delete line;
        line = new Line(0, 0, 1, 1);
        InitLine(line, fx0, fy0, fx1, fy1);

        PinGraphic* pg1 = new PinGraphic;
        PinGraphic* pg2 = new PinGraphic;
        pg1->SetBrush(psnonebr);
        pg2->SetBrush(psnonebr);
        pg1->Translate(fx0, fy0);
        pg2->Translate(fx1, fy1);

        _conn1 = new PinComp(pg1);
        _conn2 = new PinComp(pg2);

        parent->Append(line, pg1, pg2);
        SetGraphic(parent);
    }
}
开发者ID:barak,项目名称:ivtools-cvs,代码行数:34,代码来源:link.c

示例5: GetEndpoints

void LineView::GetEndpoints (Coord& x0, Coord& y0, Coord& x1, Coord& y1) {
    Line* line = (Line*) GetGraphic();
    Transformer t;

    line->GetOriginal(x0, y0, x1, y1);
    line->TotalTransformation(t);
    t.Transform(x0, y0);
    t.Transform(x1, y1);
}
开发者ID:PNCG,项目名称:neuron,代码行数:9,代码来源:line.cpp

示例6: GetPoint

boolean Vertices::GetPoint (int index, Coord& px, Coord& py) {
    if (index<0 || index>=count()) return false;
    Coord tx, ty;
    Transformer t;
    tx = x()[index];
    ty = y()[index];
    TotalTransformation(t);
    t.Transform(tx, ty, px, py);
    return true;
}
开发者ID:jmzaleski,项目名称:ivtools-1.2,代码行数:10,代码来源:verts.c

示例7: OverlayComp

TextOvComp::TextOvComp(istream& in, OverlayComp* parent) 
: OverlayComp(nil, parent) {
    _valid = GetParamList()->read_args(in, this); 

    /* correct font vertical position */
    PSFont* f = _gr->GetFont();
    float sep = 1 - (f ? f->GetLineHt() : 0);
    Transformer* t = _gr->GetTransformer();
    float dx = 0., dy = sep;

    if (t != nil) {
        float x0, y0, x1, y1;
        t->Transform(0., 0., x0, y0);
        t->Transform(0., sep, x1, y1);
        dx = x1 - x0;
        dy = y1 - y0;
    }
    _gr->Translate(dx, dy);
}
开发者ID:jmzaleski,项目名称:ivtools-1.2,代码行数:19,代码来源:ovtext.c

示例8: Interpret

void TextView::Interpret (Command* cmd) {
    if (cmd->IsA(ALIGNTOGRID_CMD)) {
        Transformer total;
        GetGraphic()->TotalTransformation(total);

        float tx0, ty0;
        total.Transform(0., 0., tx0, ty0);
        ((AlignToGridCmd*) cmd)->Align(this, tx0, ty0);

    } else {
        GraphicView::Interpret(cmd);
    }
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:13,代码来源:text.c

示例9: Interpret

void LineView::Interpret (Command* cmd) {
    if (cmd->IsA(ALIGNTOGRID_CMD)) {
        Line* line = (Line*) GetGraphic();
        Transformer total;
        line->TotalTransformation(total);

        Coord x0, y0, x1, y1;
        float tx0, ty0;

        line->GetOriginal(x0, y0, x1, y1);
        total.Transform(float(x0), float(y0), tx0, ty0);
        ((AlignToGridCmd*) cmd)->Align(this, tx0, ty0);

    } else {
        GraphicView::Interpret(cmd);
    }
}
开发者ID:PNCG,项目名称:neuron,代码行数:17,代码来源:line.cpp

示例10: Interpret

void PadView::Interpret (Command* cmd) {
    if (cmd->IsA(ALIGNTOGRID_CMD)) {
        PadGraphic* padg = (PadGraphic*) GetGraphic();
        Transformer total;
        padg->TotalTransformation(total);

        Coord x0, y0, x1, y1;
        float tx0, ty0;

        padg->GetOriginal(x0, y0, x1, y1);
        total.Transform(float(x0), float(y0), tx0, ty0);
        ((AlignToGridCmd*) cmd)->Align(this, tx0, ty0);

    } else {
        ConnectorView::Interpret(cmd);
    }
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:17,代码来源:pad.c

示例11: intersects

bool SFH_ClosedBSpline::intersects (BoxObj& userb, Graphic* gs) {
    PointObj po;
    const Coord *x, *y;
    int count = GetOriginal(x, y);
    Transformer* t = gs->GetTransformer();

    for (int i = 0; i < count; i++) {
	po._x = x[i];
	po._y = y[i];

        if (t != nil) {
            t->Transform(po._x, po._y);
        }
	if (userb.Contains(po)) {
            return true;
        }
    }
    return SF_ClosedBSpline::intersects(userb, gs);
}
开发者ID:PNCG,项目名称:neuron,代码行数:19,代码来源:splines.cpp

示例12: Align

void Graphic::Align (Alignment falign, Graphic* moved, Alignment malign) {
    float fx0, fy0, fx1, fy1, mx0, my0, mx1, my1, dx = 0, dy = 0;

    GetBounds(fx0, fy0, fx1, fy1);
    moved->GetBounds(mx0, my0, mx1, my1);

    switch (falign) {
    case BottomLeft:
    case CenterLeft:
    case TopLeft:
    case Left:
        dx = fx0;
        break;
    case BottomCenter:
    case Center:
    case TopCenter:
    case HorizCenter:
        dx = (fx0 + fx1 + 1)/2;
        break;
    case BottomRight:
    case CenterRight:
    case TopRight:
    case Right:
        dx = fx1 + 1;
        break;
    }
    switch (falign) {
    case BottomLeft:
    case BottomCenter:
    case BottomRight:
    case Bottom:
        dy = fy0;
        break;
    case CenterLeft:
    case Center:
    case CenterRight:
    case VertCenter:
        dy = (fy0 + fy1 + 1)/2;
        break;
    case TopLeft:
    case TopCenter:
    case TopRight:
    case Top:
        dy = fy1 + 1;
        break;
    }

    switch (malign) {
    case BottomLeft:
    case CenterLeft:
    case TopLeft:
    case Left:
        dx -= mx0;
        break;
    case BottomCenter:
    case Center:
    case TopCenter:
    case HorizCenter:
        dx -= (mx0 + mx1 + 1)/2;
        break;
    case BottomRight:
    case CenterRight:
    case TopRight:
    case Right:
        dx -= (mx1 + 1);
        break;
    }
    switch (malign) {
    case BottomLeft:
    case BottomCenter:
    case BottomRight:
    case Bottom:
        dy -= my0;
        break;
    case CenterLeft:
    case Center:
    case CenterRight:
    case VertCenter:
        dy -= (my0 + my1 + 1)/2;
        break;
    case TopLeft:
    case TopCenter:
    case TopRight:
    case Top:
        dy -= (my1 + 1);
        break;
    }
    if (dx != 0 || dy != 0) {
        Transformer parents;
        moved->parentXform(parents);

        parents.Invert();
        parents.Transform(0.0, 0.0, fx0, fy0);
        parents.Transform(dx, dy, mx0, my0);

        moved->Translate(mx0-fx0, my0-fy0);
    }
}
开发者ID:neurodebian,项目名称:iv-hines,代码行数:98,代码来源:graphic.cpp

示例13: Init


//.........这里部分代码省略.........
		buffer = newbuffer;
	    }

	    if (_linewidth > -1) {
		wordbuf = new char[len+nsub+1];

	        for (int i = 0; i < len; i++) {
	            c = inbuf[i];
		    ++nc;
		    if (c == ' ' || c == '\t' || c == '\n') {
			if (nc > _linewidth+1) {
			    strcpy(buffer+buflen, "\n");
	       		    ++buflen;
			    if (c == '\n' && nc > 1 ) {
			        wordbuf[wordc] = ' ';
			    } else {
			        wordbuf[wordc] = c;
                            }
			    wordbuf[wordc+1] = '\0';
			    nc = strlen(wordbuf);
			    wordc = 0;
			    strcpy(buffer+buflen, wordbuf);
	       		    buflen += strlen(wordbuf);
			
			} else {
			    if (c == '\n' && nc > 1 && i > 0) {
			        wordbuf[wordc] = ' ';
			        wordbuf[wordc+1] = '\0';
			    } else if (c == '\n' && i == 0) {
			        wordbuf[wordc] = c;
			        wordbuf[wordc+1] = c;
			        wordbuf[wordc+2] = '\0';
				nc = 0;
			    } else {
			        wordbuf[wordc] = c;
			        wordbuf[wordc+1] = '\0';
                            }
			    wordc = 0;
			    if (buffer[buflen-1] != ' ' || wordbuf[0] != ' ') {
				strcpy(buffer+buflen, wordbuf);
				buflen += strlen(wordbuf); 
			    } else {
				strcpy(buffer+buflen, wordbuf+1);
				buflen += strlen(wordbuf) - 1; 
			    }
			}
		    
		    } else {
			if (c=='\\') {
			    c = inbuf[++i];
			    if (isdigit(c)) {
				char buf[4];
				buf[0] = c; 
				buf[1] = buf[2] = buf[3] = '\0';
				if (isdigit(inbuf[i+1])) {
				    buf[1] = inbuf[++i];
				    if (isdigit(inbuf[i+1])) {
					buf[2] = inbuf[++i];
				    }
				}
				c = ParamList::octal(buf);
			    }
			} 
			wordbuf[wordc] = c;
			++wordc;
		    }
	        }
	        delete wordbuf;
	    
	    } else {
                strcpy(buffer+buflen, inbuf);
	        buflen += strlen(inbuf);
            }
	    fgets( inbuf, BUFSIZ, fptr);
	}
	/* done looping until eof or endstr is found */
    }

    fclose(fptr);

    /* setup the graphic */
    ((TextGraphic*)_gr)->SetOriginal(buffer);
    delete buffer;

    /* correct font vertical position */
    PSFont* f = _gr->GetFont();
    float sep = 1 - f->GetLineHt();
    Transformer* t = _gr->GetTransformer();
    float dx = 0., dy = sep;

    if (t != nil) {
        float x0, y0, x1, y1;
        t->Transform(0., 0., x0, y0);
        t->Transform(0., sep, x1, y1);
        dx = x1 - x0;
        dy = y1 - y0;
    }
    _gr->Translate(dx, dy);

}
开发者ID:barak,项目名称:ivtools-cvs,代码行数:101,代码来源:textfile.c


注:本文中的Transformer::Transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。