Пример #1
0
  /**
   * State values are added to the pathway element model.
   *
   * @param relX
   * @param relY
   * @param width
   * @param height
   * @param color
   * @param lineStyle
   * @param lnThickness
   * @param fillColor
   * @param shapeType
   * @param zOrder
   * @param database
   * @param ID
   * @param bioPaxRefs
   * @param graphId
   * @param graphRef
   * @param textLabel
   * @param stateType
   * @return pwElt
   */
  public static PathwayElement createState(
      double relX,
      double relY,
      double width,
      double height,
      Color color,
      int lineStyle,
      int lnThickness,
      Color fillColor,
      IShape shapeType,
      int zOrder,
      DataSource database,
      String ID,
      List<String> bioPaxRefs,
      String graphId,
      String graphRef,
      String textLabel,
      String stateType) {

    // create pathwayElement State
    PathwayElement pwElt = PathwayElement.createPathwayElement(ObjectType.STATE);

    // for better definition of identifier and database
    Xref ref = new Xref(ID, database);

    pwElt.setRelX(relX);
    pwElt.setRelY(relY);
    pwElt.setMWidth(width);
    pwElt.setMHeight(height);
    pwElt.setColor(color);
    pwElt.setLineStyle(lineStyle);
    pwElt.setLineThickness(lnThickness);
    pwElt.setFillColor(fillColor);
    pwElt.setShapeType(shapeType);
    pwElt.setZOrder(zOrder);
    pwElt.setDataSource(ref.getDataSource());
    pwElt.setElementID(ref.getId());
    pwElt.setGraphId(graphId);
    pwElt.setGraphRef(graphRef);
    pwElt.setTextLabel(textLabel);

    if (stateType == "unknown") {
    } else {
    }

    if (bioPaxRefs.size() > 0) {
      for (int i = 0; i < bioPaxRefs.size(); i++) {
        pwElt.addBiopaxRef(bioPaxRefs.get(i));
      }
    }
    return pwElt;
  }
Пример #2
0
  /**
   * Label values are added to the pathway element model.
   *
   * @param centerX
   * @param centerY
   * @param width
   * @param height
   * @param fontName
   * @param fontStyle
   * @param fontDecoration
   * @param fontStrikeThru
   * @param fontWeight
   * @param fontSize
   * @param align
   * @param vAlign
   * @param color
   * @param lnThickness
   * @param fillcolor
   * @param zOrder
   * @param bioPaxRefs
   * @param graphId
   * @param groupId
   * @param textLabel
   * @return pwElt
   */
  public static PathwayElement createLabel(
      Double centerX,
      Double centerY,
      Double width,
      Double height,
      String fontName,
      Boolean fontStyle,
      Boolean fontDecoration,
      Boolean fontStrikeThru,
      Boolean fontWeight,
      Double fontSize,
      String align,
      String vAlign,
      Color color,
      Double lnThickness,
      Color fillcolor,
      Integer zOrder,
      List<String> bioPaxRefs,
      String graphId,
      String groupId,
      String textLabel) {

    // create pathwayElement label
    PathwayElement pwElt = PathwayElement.createPathwayElement(ObjectType.LABEL);

    // put variables in element
    if (centerX != null) {
      pwElt.setMCenterX(centerX);
    } else {
      System.out.println("No CenterX for label!!");
      throw new EmptyStackException();
    }
    if (centerY != null) {
      pwElt.setMCenterY(centerY);
    } else {
      System.out.println("No centerY for label!!");
      throw new EmptyStackException();
    }
    if (width != null) {
      pwElt.setMWidth(width);
    } else {
      System.out.println("No width for label!!");
      throw new EmptyStackException();
    }
    if (height != null) {
      pwElt.setMHeight(height);
    } else {
      System.out.println("No height for label!!");
      throw new EmptyStackException();
    }
    if (fontSize != null) pwElt.setMFontSize(fontSize);
    if (color != null) {
      pwElt.setColor(color);
    }
    if (lnThickness != null) pwElt.setLineThickness(lnThickness);
    if (fillcolor != null) pwElt.setFillColor(fillcolor);
    if (!(graphId.equals(""))) {
      pwElt.setGraphId(graphId);
    } else {
      System.out.println("No GraphId for label!!");
      throw new EmptyStackException();
    }
    if (!(textLabel.equals(""))) {
      pwElt.setTextLabel(textLabel);
    } else {
      System.out.println("No label name for label!!");
      throw new EmptyStackException();
    }
    if (fontStyle == true) pwElt.setItalic(fontStyle);
    if (fontDecoration == true) pwElt.setUnderline(fontDecoration);
    if (fontStrikeThru == true) pwElt.setStrikethru(fontStrikeThru);
    if (fontWeight == true) pwElt.setBold(fontWeight);
    if (!(fontName.equals(""))) pwElt.setFontName(fontName);
    if (zOrder != -1) pwElt.setZOrder(zOrder);
    if (!(groupId.equals(""))) pwElt.setGraphRef(groupId);

    if (align.toLowerCase() == "center") {
      pwElt.setAlign(AlignType.CENTER);
    } else if (align.toLowerCase() == "left") {
      pwElt.setAlign(AlignType.LEFT);
    } else if (align.toLowerCase() == "right") {
      pwElt.setAlign(AlignType.RIGHT);
    } else {
      pwElt.setAlign(AlignType.CENTER);
    }

    if (vAlign.toLowerCase() == "middle") {
      pwElt.setValign(ValignType.MIDDLE);
    } else if (vAlign.toLowerCase() == "bottom") {
      pwElt.setValign(ValignType.BOTTOM);
    } else if (vAlign.toLowerCase() == "top") {
      pwElt.setValign(ValignType.TOP);
    } else {
      pwElt.setValign(ValignType.MIDDLE);
    }

    if (bioPaxRefs.size() > 0) {
      for (int i = 0; i < bioPaxRefs.size(); i++) {
        pwElt.addBiopaxRef(bioPaxRefs.get(i));
      }
    }
    return pwElt;
  }