UcUseCaseCanvas * UcUseCaseCanvas::read(char * & st, UmlCanvas * canvas, char * k) { if (!strcmp(k, "usecasecanvas_ref")) return ((UcUseCaseCanvas *) dict_get(read_id(st), "usecasecanvas", canvas)); else if (!strcmp(k, "usecasecanvas")) { int id = read_id(st); BrowserNode * br = BrowserUseCase::read_ref(st); UmlColor color = UmlDefaultColor; k = read_keyword(st); read_color(st, "color", color, k); if (strcmp(k, "xyzwh")) wrong_keyword(k, "xyzwh"); int x = (int) read_double(st); UcUseCaseCanvas * result = new UcUseCaseCanvas(br, canvas, x, (int) read_double(st), id); result->itscolor = color; read_zwh(st, result); result->width_scale100 = result->width(); result->height_scale100 = result->height(); result->set_center100(); k = read_keyword(st); result->update_name(); read_xy(st, result->label); result->label->setZ(result->z() + 0.5); result->label->set_center100(); if (!strcmp(k, "label_xyz")) // old version read_double(st); else if (strcmp(k, "label_xy")) wrong_keyword(k, "label_xy/label_xyz"); if (read_file_format() >= 58) { k = read_keyword(st); result->read_stereotype_property(st, k); // updates k if (strcmp(k, "end")) wrong_keyword(k, "end"); } result->show(); result->check_stereotypeproperties(); return result; } else return 0; }
bool HomTransform::read(yarp::os::idl::WireReader& reader) { if (!read_x(reader)) return false; if (!read_y(reader)) return false; if (!read_z(reader)) return false; if (!read_xx(reader)) return false; if (!read_xy(reader)) return false; if (!read_xz(reader)) return false; if (!read_yx(reader)) return false; if (!read_yy(reader)) return false; if (!read_yz(reader)) return false; if (!read_zx(reader)) return false; if (!read_zy(reader)) return false; if (!read_zz(reader)) return false; return !reader.isError(); }
void SdObjCanvas::read(char * & st, const char * k) { if (!strcmp(k, "mortal")) { mortal = TRUE; k = read_keyword(st); } if (!strcmp(k, "xyz")) { // new version read_xyz(st, this); k = read_keyword(st); if (!strcmp(k, "life_line_masked")) { life_line->set_masked(TRUE); k = read_keyword(st); } if (strcmp(k, "life_line_z")) wrong_keyword(k, "life_line_z"); life_line->setZ(read_double(st)); } else if (!strcmp(k, "xy")) read_xy(st, this); else wrong_keyword(k, "xy/xyz"); set_center100(); }
ArrowJunctionCanvas * ArrowJunctionCanvas::read(char * & st, UmlCanvas * canvas, char * k) { if (!strcmp(k, "arrowjunctioncanvas")) { int id = read_id(st); BrowserClass * br = BrowserClass::read_ref(st); ArrowJunctionCanvas * result = new ArrowJunctionCanvas(canvas, 0, 0, br, id); read_keyword(st, "xyz"); read_xyz(st, result); result->set_center100(); if (read_file_format() >= 27) { read_keyword(st, "label_xy"); read_xy(st, result->label); result->label->set_center100(); } result->show(); return result; } else return 0; }
CodDirsCanvas * CodDirsCanvas::read(char *& st, UmlCanvas * canvas, char *& k) { if (!strcmp(k, "dirscanvas_ref")) return ((CodDirsCanvas *) dict_get(read_id(st), "dirs canvas", canvas)); else if (!strcmp(k, "dirscanvas")) { int id = read_id(st); double z; if (read_file_format() < 5) z = OLD_COL_MSG_Z; else { read_keyword(st, "z"); z = read_double(st); } k = read_keyword(st); CodDirsCanvas * result = new CodDirsCanvas(canvas, CodLinkCanvas::read(st, canvas, k), id); result->setZValue(z); result->link->set_dirs(result); result->link->update_pos(); // to place result k = read_keyword(st); result->settings.read(st, k); // updates k if (!strcmp(k, "forward_label")) { result->label = new LabelCanvas(read_string(st), canvas, 0, 0); if (read_file_format() < 5) { read_keyword(st, "xy"); read_xy(st, result->label); } else { read_keyword(st, "xyz"); read_xyz(st, result->label); } result->label->set_center100(); k = read_keyword(st); } if (!strcmp(k, "backward_label")) { result->backward_label = new LabelCanvas(read_string(st), canvas, 0, 0); if (read_file_format() < 5) { read_keyword(st, "xy"); read_xy(st, result->backward_label); } else { read_keyword(st, "xyz"); read_xyz(st, result->backward_label); } result->backward_label->set_center100(); k = read_keyword(st); } return result; } else return 0; }
static void read_box(FILE *fob, mxArray **data, double dbu_to_uu) { mxArray *pstruct; mxArray *pprop = NULL; uint16_t rtype, rlen; int nprop = 0; element_t box; const char *fields[] = {"internal", "xy", "prop"}; /* initialize element */ init_element(&box, GDS_BOX); /* output data structure */ pstruct = mxCreateStructMatrix(1,1, 3, fields); /* read element properties */ while (1) { if ( read_record_hdr(fob, &rtype, &rlen) ) mexErrMsgTxt("gds_read_element (box) : could not read record header."); if (rtype == ENDEL) break; switch (rtype) { case XY: mxSetFieldByNumber(pstruct, 0, 1, read_xy(fob, rlen, dbu_to_uu)); break; case LAYER: box.layer = read_layer(fob); break; case BOXTYPE: box.dtype = read_type(fob); break; case ELFLAGS: box.elflags = read_elflags(fob); box.has |= HAS_ELFLAGS; break; case PLEX: box.plex = read_plex(fob); box.has |= HAS_PLEX; break; case PROPATTR: pprop = resize_property_structure(pprop, nprop+1); mxSetFieldByNumber(pprop, nprop, 0, read_propattr(fob)); break; case PROPVALUE: mxSetFieldByNumber(pprop, nprop, 1, read_propvalue(fob,rlen)); nprop += 1; break; default: mexPrintf("Unknown record id: 0x%x\n", rtype); mexErrMsgTxt("BOX : found unknown element property."); } } /* set prop field */ if ( nprop ) { mxSetFieldByNumber(pstruct, 0, 2, pprop); } else { mxSetFieldByNumber(pstruct, 0, 2, empty_matrix()); } /* store structure with element data */ mxSetFieldByNumber(pstruct, 0, 0, copy_element_to_array(&box)); /* return data */ *data = pstruct; }
static void read_text(FILE *fob, mxArray **data, double dbu_to_uu) { mxArray *pstruct; mxArray *pprop = NULL; uint16_t rtype, rlen; int nprop = 0; char tstr[TXTLEN+4]; element_t text; const char *fields[] = {"internal", "xy", "prop", "text"}; /* initialize element */ init_element(&text, GDS_TEXT); /* output data structure */ pstruct = mxCreateStructMatrix(1,1, 4, fields); /* read element properties */ while (1) { if ( read_record_hdr(fob, &rtype, &rlen) ) mexErrMsgTxt("gds_read_element (text) : could not read record header."); if (rtype == ENDEL) break; switch (rtype) { case STRING: if ( read_string(fob, tstr, rlen) ) mexErrMsgTxt("gds_read_element (text) : could not read string."); struct_set_string(pstruct, 3, tstr); break; case TEXTTYPE: text.dtype = read_type(fob); break; case XY: mxSetFieldByNumber(pstruct, 0, 1, read_xy(fob, rlen, dbu_to_uu)); break; case LAYER: text.layer = read_layer(fob); break; case PATHTYPE: text.ptype = read_type(fob); text.has |= HAS_PTYPE; break; case WIDTH: text.width = dbu_to_uu * read_width(fob); text.has |= HAS_WIDTH; break; case PRESENTATION: if ( read_word(fob, &text.present) ) mexErrMsgTxt("gds_read_element (text) : could not read presentation data."); text.has |= HAS_PRESTN; break; case STRANS: if ( read_word(fob, &text.strans.flags) ) mexErrMsgTxt("gds_read_element (text) : could not read strans data."); text.has |= HAS_STRANS; break; case MAG: if ( read_real8(fob, &text.strans.mag) ) mexErrMsgTxt("gds_read_element (text) : could not read magnification."); text.has |= HAS_MAG; break; case ANGLE: if ( read_real8(fob, &text.strans.angle) ) mexErrMsgTxt("gds_read_element (text) : could not read angle."); text.has |= HAS_ANGLE; break; case ELFLAGS: text.elflags = read_elflags(fob); text.has |= HAS_ELFLAGS; break; case PLEX: text.plex = read_plex(fob); text.has |= HAS_PLEX; break; case PROPATTR: pprop = resize_property_structure(pprop, nprop+1); mxSetFieldByNumber(pprop, nprop, 0, read_propattr(fob)); break; case PROPVALUE: mxSetFieldByNumber(pprop, nprop, 1, read_propvalue(fob,rlen)); nprop += 1; break; default: mexPrintf("Unknown record id: 0x%x\n", rtype); mexErrMsgTxt("TEXT : found unknown element property."); } } /* set prop field */ if ( nprop ) { mxSetFieldByNumber(pstruct, 0, 2, pprop); } else { mxSetFieldByNumber(pstruct, 0, 2, empty_matrix()); } /* store structure with element data */ mxSetFieldByNumber(pstruct, 0, 0, copy_element_to_array(&text)); /* return data */ *data = pstruct; }
static void read_aref(FILE *fob, mxArray **data, double dbu_to_uu) { mxArray *pstruct; mxArray *pprop = NULL; uint16_t rtype, rlen; int nprop = 0; element_t aref; const char *fields[] = {"internal", "xy", "prop"}; /* initialize element */ init_element(&aref, GDS_AREF); /* output data structure */ pstruct = mxCreateStructMatrix(1,1, 3, fields); /* read element properties */ while (1) { if ( read_record_hdr(fob, &rtype, &rlen) ) mexErrMsgTxt("gds_read_element (aref) : could not read record header."); if (rtype == ENDEL) break; switch (rtype) { case XY: mxSetFieldByNumber(pstruct, 0, 1, read_xy(fob, rlen, dbu_to_uu)); break; case SNAME: if ( read_string(fob, aref.sname, rlen) ) mexErrMsgTxt("gds_read_element (sref) : could not read structure name."); break; case COLROW: read_colrow(fob, &aref.nrow, &aref.ncol); break; case STRANS: if ( read_word(fob, &aref.strans.flags) ) mexErrMsgTxt("gds_read_element (aref) : could not read strans data."); aref.has |= HAS_STRANS; break; case MAG: if ( read_real8(fob, &aref.strans.mag) ) mexErrMsgTxt("gds_read_element (aref) : could not read magnification."); aref.has |= HAS_MAG; break; case ANGLE: if ( read_real8(fob, &aref.strans.angle) ) mexErrMsgTxt("gds_read_element (aref) : could not read angle."); aref.has |= HAS_ANGLE; break; case ELFLAGS: aref.elflags = read_elflags(fob); aref.has |= HAS_ELFLAGS; break; case PLEX: aref.plex = read_plex(fob); aref.has |= HAS_PLEX; break; case PROPATTR: pprop = resize_property_structure(pprop, nprop+1); mxSetFieldByNumber(pprop, nprop, 0, read_propattr(fob)); break; case PROPVALUE: mxSetFieldByNumber(pprop, nprop, 1, read_propvalue(fob,rlen)); nprop += 1; break; default: mexPrintf("Unknown record id: 0x%x\n", rtype); mexErrMsgTxt("AREF : found unknown element property."); } } /* set prop field */ if ( nprop ) { mxSetFieldByNumber(pstruct, 0, 2, pprop); } else { mxSetFieldByNumber(pstruct, 0, 2, empty_matrix()); } /* store structure with element data */ mxSetFieldByNumber(pstruct, 0, 0, copy_element_to_array(&aref)); /* return data */ *data = pstruct; }
static void read_path(FILE *fob, mxArray **data, double dbu_to_uu) { mxArray *pstruct; mxArray *pprop = NULL; mxArray *pc; tList xylist; uint16_t rtype, rlen; int nprop = 0; int nle, k; element_t path; const char *fields[] = {"internal", "xy", "prop"}; /* initialize element */ init_element(&path, GDS_PATH); /* output data structure */ pstruct = mxCreateStructMatrix(1,1, 3, fields); /* create a list for the XY data record(s) */ if ( create_list(&xylist) == -1 ) mexErrMsgTxt("gds_read_element (path) : could not create list for XY records."); /* read element properties */ while (1) { if ( read_record_hdr(fob, &rtype, &rlen) ) mexErrMsgTxt("gds_read_element (path) : could not read record header."); if (rtype == ENDEL) break; switch (rtype) { case XY: if ( list_insert(xylist, read_xy(fob, rlen, dbu_to_uu), AFTER) == -1) mexErrMsgTxt("gds_read_element (path) : list insertion failed."); break; case LAYER: path.layer = read_layer(fob); break; case PATHTYPE: path.ptype = read_type(fob); path.has |= HAS_PTYPE; break; case WIDTH: path.width = dbu_to_uu * (double)read_width(fob); path.has |= HAS_WIDTH; break; case BGNEXTN: path.bgnextn = dbu_to_uu * read_extn(fob); path.has |= HAS_BGNEXTN; break; case ENDEXTN: path.endextn = dbu_to_uu * read_extn(fob); path.has |= HAS_ENDEXTN; break; case DATATYPE: path.dtype = read_type(fob); break; case ELFLAGS: path.elflags = read_elflags(fob); path.has |= HAS_ELFLAGS; break; case PLEX: path.plex = read_plex(fob); path.has |= HAS_PLEX; break; case PROPATTR: pprop = resize_property_structure(pprop, nprop+1); mxSetFieldByNumber(pprop, nprop, 0, read_propattr(fob)); break; case PROPVALUE: mxSetFieldByNumber(pprop, nprop, 1, read_propvalue(fob,rlen)); nprop += 1; break; default: mexPrintf("Unknown record id: 0x%x\n", rtype); mexErrMsgTxt("PATH : found unknown element property."); } } /* cell array with XY records */ nle = list_entries(xylist); if ( !nle ) mexErrMsgTxt("gds_read_element (path) : element has no XY record."); pc = mxCreateCellMatrix(1, nle); list_head(xylist); for (k=0; k<nle; k++) mxSetCell(pc, k, (mxArray *)get_current_entry(xylist, NULL)); mxSetFieldByNumber(pstruct, 0, 1, pc); /* set prop field */ if ( nprop ) { mxSetFieldByNumber(pstruct, 0, 2, pprop); } else { mxSetFieldByNumber(pstruct, 0, 2, empty_matrix()); } /* store structure with element data */ mxSetFieldByNumber(pstruct, 0, 0, copy_element_to_array(&path)); /* return data */ *data = pstruct; }
PseudoStateCanvas * PseudoStateCanvas::read(char * & st, UmlCanvas * canvas, char * k) { if (!strcmp(k, "pseudostatecanvas_ref")) return ((PseudoStateCanvas *) dict_get(read_id(st), "PseudoStateCanvas", canvas)); else if (!strcmp(k, "pseudostatecanvas")) { int id = read_id(st); BrowserPseudoState * ps = BrowserPseudoState::read_ref(st); PseudoStateCanvas * result = new PseudoStateCanvas(canvas, id); result->browser_node = ps; connect(ps->get_data(), SIGNAL(changed()), result, SLOT(modified())); connect(ps->get_data(), SIGNAL(deleted()), result, SLOT(deleted())); connect(DrawingSettings::instance(), SIGNAL(changed()), result, SLOT(modified())); k = read_keyword(st); if (!strcmp(k, "horizontal")) { result->horiz = TRUE; k = read_keyword(st); } if (!strcmp(k, "xyzwh")) { read_xyzwh(st, result); result->manual_size = TRUE; } else if (strcmp(k, "xyz")) wrong_keyword(k, "xyz"); else read_xyz(st, result); if (!ps->allow_empty()) { result->label = new LabelCanvas(ps->get_name(), canvas, 0, 0); read_keyword(st, "label_xy"); read_xy(st, result->label); result->label->setZ(result->z()); result->label->set_center100(); } if (read_file_format() >= 58) { k = read_keyword(st); result->read_stereotype_property(st, k); // updates k if (strcmp(k, "end")) wrong_keyword(k, "end"); } result->set_xpm(); if (result->manual_size) { result->width_scale100 = result->width(); result->height_scale100 = result->height(); } result->set_center100(); result->show(); result->check_stereotypeproperties(); if (canvas->paste()) result->remove_if_already_present(); return result; } else return 0; }