Ejemplo n.º 1
0
  /**
   * GraphicalLine values are added to the pathway element model.
   *
   * @param mPointsDoubles
   * @param relX
   * @param relY
   * @param startGraphRef
   * @param endGraphRef
   * @param pointGraphId
   * @param arrowHead
   * @param anchorList
   * @param color
   * @param lnThickness
   * @param lineStyle
   * @param connectorType
   * @param zOrder
   * @param groupRef
   * @param bioPaxRefs
   * @param graphId
   * @param type
   * @return pwElt
   */
  public static PathwayElement createGraphicalLine(
      List<Double> mPointsDoubles,
      double relX,
      double relY,
      String startGraphRef,
      String endGraphRef,
      String pointGraphId,
      String arrowHead,
      List<String> anchorList,
      Color color,
      int lnThickness,
      int lineStyle,
      String connectorType,
      int zOrder,
      String groupRef,
      List<String> bioPaxRefs,
      String graphId,
      String type) {

    // !!! not done yet

    // create pathwayElement line
    PathwayElement pwElt = PathwayElement.createPathwayElement(ObjectType.GRAPHLINE);

    pwElt.setStartGraphRef(startGraphRef);
    pwElt.setEndGraphRef(endGraphRef);
    pwElt.setGraphId(graphId);
    pwElt.setColor(color);
    pwElt.setLineThickness(lnThickness);
    pwElt.setLineStyle(lineStyle);
    pwElt.setZOrder(zOrder);
    pwElt.setGroupRef(groupRef);
    pwElt.setGraphId(graphId);

    pwElt.setEndLineType(LineType.fromName(arrowHead));

    // add MPoints
    addLineType(pwElt, connectorType, mPointsDoubles);

    // add Anchor
    if (anchorList.size() > 0) {
      createAnchor(pwElt, anchorList);
    }

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

    return null;
  }
Ejemplo n.º 2
0
  /**
   * Line values are added to the pathway element model.
   *
   * @param mPointsDoubles
   * @param startGraphId
   * @param endGraphId
   * @param zOrder
   * @param lnThickness
   * @param connectorType
   * @param arrowHead
   * @param anchorList
   * @param startDataNodeId
   * @param endDataNodeId
   * @param startRelX
   * @param startRelY
   * @param endRelX
   * @param endRelY
   * @return pwElt
   */
  public static PathwayElement createLine(
      List<Double> mPointsDoubles,
      String startGraphId,
      String endGraphId,
      Integer zOrder,
      Double lnThickness,
      String connectorType,
      String arrowHead,
      List<String> anchorList,
      GraphIdContainer startDataNodeId,
      GraphIdContainer endDataNodeId,
      Double startRelX,
      Double startRelY,
      Double endRelX,
      Double endRelY) {

    // create pathwayElement line
    PathwayElement pwElt = PathwayElement.createPathwayElement(ObjectType.LINE);

    // set graph line variables
    if (mPointsDoubles.isEmpty()) {
      System.out.println("No mPoints for line!!");
      throw new EmptyStackException();
    }
    if (!(startGraphId.equals(""))) pwElt.setStartGraphRef(startGraphId);
    else {
      System.out.println("No startGraphId for line!!");
      throw new EmptyStackException();
    }
    if (!(endGraphId.equals(""))) pwElt.setEndGraphRef(endGraphId);
    else {
      System.out.println("No endGraphId for line!!");
      throw new EmptyStackException();
    }
    if (zOrder != -1) pwElt.setZOrder(zOrder);
    if (lnThickness != null) pwElt.setLineThickness(lnThickness);
    if (arrowHead != null) pwElt.setEndLineType(LineType.fromName(arrowHead));
    if (startRelX == null) {
      System.out.println("No relX 1 for line!!");
      throw new EmptyStackException();
    }
    if (endRelX == null) {
      System.out.println("No relX 2 for line!!");
      throw new EmptyStackException();
    }
    if (startRelY == null) {
      System.out.println("No relY 1 for line!!");
      throw new EmptyStackException();
    }
    if (endRelY == null) {
      System.out.println("No no relY 2 for line!!");
      throw new EmptyStackException();
    }

    // add MPoints
    addLineType(pwElt, connectorType, mPointsDoubles);

    // add Anchor
    if (anchorList.size() > 0) createAnchor(pwElt, anchorList);

    // bind on the correct place
    MPoint startLine = pwElt.getMStart();
    MPoint endLine = pwElt.getMEnd();
    if (startDataNodeId.equals("")) {
      startLine.linkTo(startDataNodeId, startRelX, startRelY);
    }
    if (startDataNodeId.equals("")) {
      endLine.linkTo(endDataNodeId, endRelX, endRelY);
    }

    return pwElt;
  }