Beispiel #1
0
AssocContainCanvas * AssocContainCanvas::read(char * & st, UmlCanvas * canvas, char * k)
{
  if (!strcmp(k, "containcanvas_ref"))
    return ((AssocContainCanvas *) dict_get(read_id(st), "contain canvas", canvas));
  else if (!strcmp(k, "containcanvas")) {
    int id = read_id(st);    
    LineGeometry geo;
    bool fixed;
    
    k = read_keyword(st);	// may read id
    if (!strcmp(k, "geometry")) {
      geo = line_geometry(read_keyword(st));
      k = read_keyword(st);
      if (! strcmp(k, "unfixed")) {
	k = read_keyword(st);
	fixed = FALSE;
      }
      else
	fixed = TRUE;
    }
    else {
      geo = NoGeometry;
      fixed = FALSE;
    }
    
    float dbegin;
    float dend;

    if (! strcmp(k, "decenter_begin")) {
      dbegin = read_double(st) / 1000;
      k = read_keyword(st);
    }
    else
      dbegin = -1;

    if (! strcmp(k, "decenter_end")) {
      dend = read_double(st) / 1000;
      k = read_keyword(st);
    }
    else
      dend = -1;
    
    unread_keyword(k, st);
    
    AssocContainCanvas * r = (AssocContainCanvas *)
      read_list(st, canvas, UmlContain, geo, fixed, dbegin, dend, id, &make);
    
    // remove association between components available in the
    // 2.0 deployment diagrams
    if (r->begin->type() == UmlComponent)
      Undefined.append(r);
    else if (read_file_format() == 30)
      // to remove redondant transitions made by release 2.22
      RelsToCheck.append(r);
    
    return r;
  }
  else
    return 0;
}
Beispiel #2
0
CodLinkCanvas * CodLinkCanvas::read(char * & st, UmlCanvas * canvas, char * & k)
{
  if (!strcmp(k, "linkcanvas_ref"))
    return ((CodLinkCanvas *) dict_get(read_id(st), "link canvas", canvas));
  else if (!strcmp(k, "linkcanvas")) {
    int id = read_id(st);
    
    float dbegin;
    float dend;
    
    k = read_keyword(st);

    if (! strcmp(k, "decenter_begin")) {
      dbegin = read_double(st) / 1000;
      k = read_keyword(st);
    }
    else
      dbegin = -1;

    if (! strcmp(k, "decenter_end")) {
      dend = read_double(st) / 1000;
      k = read_keyword(st);
    }
    else
      dend = -1;
    
    unread_keyword(k, st);
    
    read_keyword(st, "from");
    read_keyword(st, "ref");
    
    DiagramItem * bi = dict_get(read_id(st), "", canvas);
    CodLinkCanvas * result;
    
    for (;;) {
      double z = 0;
      
      if (read_file_format() >= 5) {
	read_keyword(st, "z");
	z = read_double(st);
      }
      
      read_keyword(st, "to");

      k = read_keyword(st);
      if (!strcmp(k, "ref"))
	break;
      
      DiagramItem * ap = ArrowPointCanvas::read(st, canvas, k);
    
      if (ap == 0)
	unknown_keyword(k);

      result = new CodLinkCanvas(canvas, bi, ap, id, dbegin, dend);
      if (read_file_format() >= 5)
	result->setZ(z);
      result->show();
      bi = ap;
      
      read_keyword(st, "line");
      id = read_id(st);
    }
    
    result =
      new CodLinkCanvas(canvas, bi, dict_get(read_id(st), "", canvas),
			id, dbegin, dend);
    result->show();
    
    k = read_keyword(st);
    
    return result;
  }
  else
    return 0;
}
Beispiel #3
0
void SdMsgBaseCanvas::read(char * & st) {
  if (((itsType != UmlReturnMsg) && (itsType != UmlSelfReturnMsg)) ||
      (read_file_format() >= 4)) {
    char * k = read_keyword(st);
    const OperationData * method = 0;
    QString expl;
    QString args;
    bool unspec = FALSE;
    
    if (!strcmp(k, "msg")) {
      if ((method = OperationData::read_ref(st)) == 0)
	expl = "<deleted operation>";
    }
    else if (!strcmp(k, "explicitmsg"))
      expl = read_string(st);
    else if (strcmp(k, "unspecifiedmsg"))
      wrong_keyword(k, "msg/explicitmsg/unspecifiedmsg");
    else
      unspec = TRUE;
    
    k = read_keyword(st);
    
    if (!strcmp(k, "stereotype")) {
      k = read_string(st);
      read_keyword(st, "xyz");
      
      int x = (int) read_double(st);
      
      stereotype =
	new LabelCanvas(k, the_canvas(), x, (int) read_double(st));
	
      stereotype->setZ(read_double(st));
      stereotype->show();
      k = read_keyword(st);
    }
    else
      stereotype = 0;
    
    if (!strcmp(k, "show_full_operations_definition")) {
      show_full_oper = state(read_keyword(st));
      k = read_keyword(st);
    }
    if (!strcmp(k, "drawing_language")) {
      drawing_language = ::drawing_language(read_keyword(st));
      k = read_keyword(st);
    }
    if (!strcmp(k, "show_context_mode")) {
      show_context_mode = ::context_mode(read_keyword(st));
      k = read_keyword(st);
    }
    
    if (unspec) {
      unread_keyword(k, st);
      return;
    }
    
    if (!strcmp(k, "args")) {
      args = read_string(st);
      k = read_keyword(st);
    }
    
    set_msg(method, expl, args);
    
    if (strcmp(k, "label_xy"))
      wrong_keyword(k, "label_xy");
    
    int lx = (int) read_double(st);
    
    label =
      new LabelCanvas(get_msg(TRUE), the_canvas(),
		      lx, (int) read_double(st),
		      FALSE, FALSE, FALSE, FALSE);
    label->show();
  }
}
SimpleRelationCanvas * SimpleRelationCanvas::read(char *& st, UmlCanvas * canvas, char * k)
{
    if (!strcmp(k, "simplerelationcanvas_ref"))
        return ((SimpleRelationCanvas *) dict_get(read_id(st), "simplerelationcanvas", canvas));
    else if (!strcmp(k, "simplerelationcanvas")) {
        int id = read_id(st);
        BrowserSimpleRelation * br = BrowserSimpleRelation::read_ref(st);
        SimpleRelationData * rd = (SimpleRelationData *) br->get_data();
        LineGeometry geo;
        bool fixed;

        k = read_keyword(st);

        if (! strcmp(k, "geometry")) {
            geo = line_geometry(read_keyword(st));
            k = read_keyword(st);

            if (! strcmp(k, "unfixed")) {
                k = read_keyword(st);
                fixed = FALSE;
            }
            else
                fixed = TRUE;
        }
        else {
            geo = NoGeometry;
            fixed = FALSE;
        }

        float dbegin;
        float dend;

        if (! strcmp(k, "decenter_begin")) {
            dbegin = read_double(st) / 1000;
            k = read_keyword(st);
        }
        else
            dbegin = -1;

        if (! strcmp(k, "decenter_end")) {
            dend = read_double(st) / 1000;
            k = read_keyword(st);
        }
        else
            dend = -1;

        unread_keyword(k, st);

        read_keyword(st, "from");
        read_keyword(st, "ref");

        DiagramItem * bi = dict_get(read_id(st), "canvas", canvas);
        BrowserNode * b = rd->get_start_node();
        UmlCode t = rd->get_type();
        SimpleRelationCanvas * first = 0;
        SimpleRelationCanvas * result;
        LabelCanvas * stereotype;
        double z;

        for (;;) {
            read_keyword(st, "z");
            z = read_double(st);
            k = read_keyword(st);

            if (!strcmp(k, "stereotype")) {
                (void) read_string(st);
                read_keyword(st, "xyz");

                int x = (int) read_double(st);
                int y = (int) read_double(st);

                if ((rd == 0) || (*(rd->get_stereotype()) == 0)) {
                    stereotype = 0;
                    read_double(st);	// z
                }
                else {
                    QString s = toUnicode(rd->get_short_stereotype());

                    if (s[0] != '{')
                        s = QString("<<") + s + ">>";

                    stereotype = new LabelCanvas(s, canvas, x, y);
                    stereotype->setZ(read_double(st));
                }

                k = read_keyword(st);
            }
            else
                stereotype = 0;

            if (strcmp(k, "to"))
                wrong_keyword(k, "to");

            DiagramItem * di;

            if (strcmp(k = read_keyword(st), "ref")) {
                di = ArrowPointCanvas::read(st, canvas, k);

                if (di == 0)
                    unknown_keyword(k);
            }
            else
                di = dict_get(read_id(st), "classcanvas", canvas);

            // do not give rd to not call update()
            result = new SimpleRelationCanvas(canvas, bi, di, b, t, id, dbegin, dend);
            result->geometry = geo;
            result->fixed_geometry = fixed;
            result->set_z(z);
            result->data = rd;
            connect(rd, SIGNAL(changed()), result, SLOT(modified()));
            connect(rd, SIGNAL(deleted()), result, SLOT(deleted()));

            if (first == 0) {
                first = result;

                if (read_file_format() == 30)
                    // to remove redondant relation made by release 2.22
                    RelsToCheck.append(result);
            }

            if (stereotype != 0)
                (result->stereotype = stereotype)->show();

            result->show();

            if (di->type() != UmlArrowPoint)
                break;

            bi = di;

            read_keyword(st, "line");
            id = read_id(st);
        }

        if (read_file_format() >= 58) {
            // stereotype property

            k = read_keyword(st);

            first->stereotypeproperties =
                StereotypePropertiesCanvas::read(st,  canvas, k, first);

            if (first->stereotypeproperties != 0)
                k = read_keyword(st);

            if (strcmp(k, "end"))
                wrong_keyword(k, "end");
        }

        // to add stereotype ... if needed

        first->update(FALSE);

        if (first != result)
            result->update(FALSE);

        first->check_stereotypeproperties();

        // manage case where the relation is deleted but present in the browser
        if (result->data->get_start()->deletedp())
            RelsToDel.append(result);
        else
            result->update_geometry();

        return result;
    }
    else
        return 0;
}
Beispiel #5
0
FlowCanvas * FlowCanvas::read(char * & st, UmlCanvas * canvas, char * k)
{
  if (!strcmp(k, "flowcanvas_ref"))
    return ((FlowCanvas *) dict_get(read_id(st), "flowcanvas", canvas));
  else if (!strcmp(k, "flowcanvas")) {    
    int id = read_id(st);
    BrowserFlow * br = BrowserFlow::read_ref(st);
    FlowData * tr = (FlowData *) br->get_data();
    LineGeometry geo;
    bool fixed = FALSE;
    
    k = read_keyword(st);
    if (! strcmp(k, "geometry")) {
      geo = line_geometry(read_keyword(st));
      k = read_keyword(st);
      if (! strcmp(k, "unfixed"))
	k = read_keyword(st);
      else {
	fixed = TRUE;
      }
    }
    else
      geo = NoGeometry;
    
    float dbegin;
    float dend;

    if (! strcmp(k, "decenter_begin")) {
      dbegin = read_double(st) / 1000;
      k = read_keyword(st);
    }
    else
      dbegin = -1;

    if (! strcmp(k, "decenter_end")) {
      dend = read_double(st) / 1000;
      k = read_keyword(st);
    }
    else
      dend = -1;

    unread_keyword(k, st);
    
    read_keyword(st, "from");
    read_keyword(st, "ref");
    
    DiagramItem * bi = dict_get(read_id(st), "canvas", canvas);
    BrowserNode * b = tr->get_start_node();
    QString s = br->get_name();
    FlowCanvas * first = 0;
    FlowCanvas * result;
    LabelCanvas * label;
    LabelCanvas * stereotype;
    double z;
              
    for (;;) {
      read_keyword(st, "z");
      z = read_double(st);
      k = read_keyword(st);
      
      if ((label = LabelCanvas::read(st, canvas, k)) != 0) {
	// the flow name can't be empty
	label->setZ(z);
	k = read_keyword(st);
      }
      
      if (!strcmp(k, "stereotype")) {
	(void) read_string(st);
	read_keyword(st, "xyz");
	
	int x = (int) read_double(st);
	int y = (int) read_double(st);
	
	if ((tr == 0) || (*(tr->get_stereotype()) == 0)) {
	  stereotype = 0;
	  read_double(st);	// z
	}
	else {
	  QString s = tr->get_short_stereotype();
	 
	  if (s == "interrupt")
	    s = LabelCanvas::Zigzag;
	  else
	    s = QString("<<") + toUnicode(s) + ">>";

	  stereotype = new LabelCanvas(s, canvas, x, y);
	  stereotype->setZ(read_double(st));
	}
	k = read_keyword(st);
      }
      else
	stereotype = 0;

      if (strcmp(k, "to"))
	wrong_keyword(k, "to");

      DiagramItem * di;
      
      if (strcmp(k = read_keyword(st), "ref")) {
	di = ArrowPointCanvas::read(st, canvas, k);
	
	if (di == 0)
	  unknown_keyword(k);
      }
      else
	di = dict_get(read_id(st), "activity node", canvas);

      // do not give data to not call update()
      result = new FlowCanvas(canvas, bi, di, b, id, dbegin, dend);
      result->geometry = geo;
      result->fixed_geometry = fixed;
      result->set_z(z);
      result->data = tr;
      connect(tr, SIGNAL(changed()), result, SLOT(modified()));
      connect(tr, SIGNAL(deleted()), result, SLOT(deleted()));

      if (first == 0) {
	first = result;
	if (read_file_format() == 30)
	  // to remove redondant relation made by release 2.22
	  RelsToCheck.append(result);
      }
      if (label != 0)
	result->label = label;
      if (stereotype != 0)
	(result->stereotype = stereotype)->show();
      result->show();
      
      if (di->type() != UmlArrowPoint)
	break;
      
      bi = di;
      
      read_keyword(st, "line");
      id = read_id(st);
    }
    
    k = read_keyword(st);
    result->settings.read(st, k);	// updates k    
    if (strcmp(k, "write_horizontally") != 0)
      wrong_keyword(k, "write_horizontally");
    result->write_horizontally = state(read_keyword(st));
    k = read_keyword(st);
    result->propagate_drawing_settings();
    
    // to add label, stereotype ... if needed    
    first->update(FALSE);
    if (first != result)
      result->update(FALSE);
    
    if (! strcmp(k, "selection")) {
      k = read_keyword(st);
      first->selection = InfoCanvas::read(st, canvas, k, first);
      k = read_keyword(st);
    }
    if (! strcmp(k, "transformation")) {
      k = read_keyword(st);
      first->transformation = InfoCanvas::read(st, canvas, k, first);
      k = read_keyword(st);
    }

    first->stereotypeproperties = 
      StereotypePropertiesCanvas::read(st,  canvas, k, first);
    
    if (first->stereotypeproperties != 0)
      k = read_keyword(st);
    
    first->check_sel_trans();
    first->check_stereotypeproperties();

    // manage case where the relation is deleted but present in the browser
    if (result->data->get_start()->deletedp())
      RelsToDel.append(result);
    else
      result->update_geometry();
    
    if (strcmp(k, "end"))
      wrong_keyword(k, "end");
    
    return result;
  }
  else
    return 0;
}