Ejemplo n.º 1
0
void LinkComp::Read (istream& in) {
    GraphicComp::Read(in);

    Line* line = new Line(0, 0, 1, 1);

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

    _conn1 = (Connector*) unidraw->GetCatalog()->ReadComponent(in);
    _conn2 = (Connector*) unidraw->GetCatalog()->ReadComponent(in);

    Graphic* parent = new Picture;
    parent->FillBg(ReadBgFilled(in));
    PSColor* fg = ReadColor(in);
    PSColor* bg = ReadColor(in);
    parent->SetColors(fg, bg);
    parent->SetBrush(ReadBrush(in));

    t = ReadTransformer(in);
    parent->SetTransformer(t);
    Unref(t);

    parent->Append(line, _conn1->GetGraphic(), _conn2->GetGraphic());
    SetGraphic(parent);
}
Ejemplo n.º 2
0
bool CMapFileType::Open(const char *pMap)
{
	std::list<CPolyhedron *>::iterator i;
	char *pBuffer=new char [MAX_TEXT_FILE_LENGHT];
	unsigned int fileLen=0;
	unsigned int offset=0;
	FILE *pFile=fopen(pMap,"rb");
	if(pFile!=NULL)
	{
		fileLen=fread(pBuffer,1,MAX_TEXT_FILE_LENGHT,pFile);
		fclose(pFile);
		pFile=NULL;
	}
	if(!fileLen){return false;}

	SkipCommentsStringsAndSpaces(pBuffer,&offset,fileLen);
	while(offset!=(fileLen-1))
	{
		// For all entities
		while(offset!=(fileLen-1))
		{
			// Check for Entity start
			if(pBuffer[offset]=='{')
			{
				offset++;
				while(offset!=(fileLen-1))
				{
					// brush start
					if(pBuffer[offset]=='{')
					{
						offset++;
						CMapFileBrush *pBrush=ReadBrush(pBuffer,&offset,fileLen,0.0);
						if(pBrush)
						{
							m_lBrushes.push_back(pBrush);
						}
						continue;
					}
					// entity end
					else if(pBuffer[offset]=='}')
					{
						offset++;
						break;
					}
					offset++;
				}

				continue;
			}
			offset++;
		}
	}
	delete [] pBuffer;
	return true;
}
Ejemplo n.º 3
0
Archivo: line.cpp Proyecto: PNCG/neuron
void LineComp::Read (istream& in) {
    GraphicComp::Read(in);
    Coord x0, y0, x1, y1;

    in >> x0 >> y0 >> x1 >> y1;
    Line* line = new Line(x0, y0, x1, y1);

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

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

    SetGraphic(line);
}
Ejemplo n.º 4
0
Archivo: rect.cpp Proyecto: PNCG/neuron
void RectComp::Read (istream& in) {
    GraphicComp::Read(in);
    Coord x0, y0, x1, y1;

    in >> x0 >> y0 >> x1 >> y1;
    SF_Rect* rect = new SF_Rect(x0, y0, x1, y1);

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

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

    SetGraphic(rect);
}
Ejemplo n.º 5
0
void PadComp::Read (istream& in) {
    Connector::Read(in);
    Coord l, b, r, t;
    int mobility;

    in >> l >> b >> r >> t >> mobility;
    PadGraphic* pad = new PadGraphic(l, b, r, t);
    _mobility = Mobility(mobility);
    
    pad->FillBg(ReadBgFilled(in));
    PSColor* fg = ReadColor(in);
    PSColor* bg = ReadColor(in);
    pad->SetColors(fg, bg);
    pad->SetBrush(ReadBrush(in));

    Transformer* xf = ReadTransformer(in);
    pad->SetTransformer(xf);
    Unref(xf);

    SetGraphic(pad);
}
Ejemplo n.º 6
0
void EllipseComp::Read (istream& in) {
    GraphicComp::Read(in);
    Coord x0, y0;
    int r1, r2;

    in >> x0 >> y0 >> r1 >> r2;
    SF_Ellipse* ellipse = new SF_Ellipse(x0, y0, r1, r2);

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

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

    SetGraphic(ellipse);
}
Ejemplo n.º 7
0
Archivo: pin.cpp Proyecto: PNCG/neuron
void PinComp::Read (istream& in) {
    Connector::Read(in);
    Coord x0, y0;
    int mobility;

    in >> x0 >> y0 >> mobility;
    PinGraphic* pin = new PinGraphic(x0, y0);
    _mobility = Mobility(mobility);
    
    pin->FillBg(ReadBgFilled(in));
    PSColor* fg = ReadColor(in);
    PSColor* bg = ReadColor(in);
    pin->SetColors(fg, bg);
    pin->SetBrush(ReadBrush(in));

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

    SetGraphic(pin);
}
Ejemplo n.º 8
0
Archivo: line.cpp Proyecto: 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);
}
Ejemplo n.º 9
0
void SplineComp::Read (istream& in) {
    VerticesComp::Read(in);
    Coord* x, *y;
    int count;

    ReadVertices(in, x, y, count);
    SFH_OpenBSpline* spline = new SFH_OpenBSpline(x, y, count);
    delete x;
    delete y;

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

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

    SetGraphic(spline);
}