void Graphic_Rectangle::serialize(CArchive &ar, bool serialize_flag)
{
	serialize_P(ar, serialize_flag);
	if(serialize_flag){
		ar<<pointEnd<<Line_Pattern<<Back_Pattern<<Back_Color;
	}
	else {
		ar>>pointEnd>>Line_Pattern>>Back_Pattern>>Back_Color;
	}
}
Exemplo n.º 2
0
void GPolyline::serialize(CArchive& ar, bool serialize_flag)
{
	serialize_P(ar, serialize_flag);
	if (serialize_flag)
	{	
		ar << point_end << linepattern << pt_num;
		pt_arr.Serialize(ar);
	}
	else
	{	
		ar >> point_end >> linepattern >> pt_num;
		pt_arr.Serialize(ar);
	}
}
Exemplo n.º 3
0
void Group::serialize(CArchive& ar, bool serialize_flag)
{
	serialize_P(ar, serialize_flag);

	if (serialize_flag){
		int count = NodeData.GetCount();
		ar << point << point_end << linepattern << inner_color << line_color << inner_pattern << count;

		POSITION pos = NodeData.GetHeadPosition();

		while (pos){
			Figure* temp = (Figure*)NodeData.GetNext(pos);
			ar << temp->thisobject();
			temp->serialize(ar, true);
		}

		count = Child.GetCount();
		ar << count;
		pos = Child.GetHeadPosition();
		while (pos){
			Figure* temp = (Figure*)Child.GetNext(pos);
			ar << temp->thisobject();
			temp->serialize(ar, true);
		}
	}
	else {
		int count;
		ar >> point >> point_end >> linepattern >> inner_color >> line_color >> inner_pattern >> count;
		NodeData.RemoveAll();
		POSITION pos = NodeData.GetHeadPosition();
		int t;
		for (int i = 0; i < count; i++){
			ar >> t;
			switch (t){

			case LINE:{
				MyLine* temp = new MyLine();
				NodeData.AddTail((void*)temp);
				temp->serialize(ar, false);
				break;
			}
			case POLYLINE:{
				MyPolyline* temp = new MyPolyline();
				NodeData.AddTail((void*)temp);
				temp->serialize(ar, false);
				break;
			}

			case ELIPSE:{
				MyElipse* temp = new MyElipse();
				NodeData.AddTail((void*)temp);
				temp->serialize(ar, false);
				break;
			}
			case RECTANGLE:{
				MyRectangle* temp = new MyRectangle();
				NodeData.AddTail((void*)temp);
				temp->serialize(ar, false);
				break;
			}
			case TEXT:{
				MyTextDraw* temp = new MyTextDraw();
				NodeData.AddTail((void*)temp);
				temp->serialize(ar, false);
				break;
			}
			case FREECURVE:{
				MyFreeCurve* temp = new MyFreeCurve();
				NodeData.AddTail((void*)temp);
				temp->serialize(ar, false);
				break;
			}
			}
		}
		ar >> count;
		Child.RemoveAll();
		pos = Child.GetHeadPosition();
		for (int i = 0; i < count; i++){
			ar >> t;
			switch (t){
			case MYGROUP:{
				Group* temp = new Group();
				Child.AddTail((void*)temp);
				temp->serialize(ar, false);
				break;
			}
			}
		}
	}
}