Examples of mxGeometry


Examples of com.mxgraph.model.mxGeometry

        for (int i = 0; i < cells.length; i++)
        {
          if (model.isEdge(cells[i]))
          {
            mxGeometry geo = model.getGeometry(cells[i]);

            if (geo != null)
            {
              mxCellState state = view.getState(cells[i]);
              mxCellState pstate = view.getState(model
                  .getParent(cells[i]));

              if (state != null && pstate != null)
              {
                geo = (mxGeometry) geo.clone();

                double dx = -pstate.getOrigin().getX();
                double dy = -pstate.getOrigin().getY();

                Object src = model.getTerminal(cells[i], true);

                if (src != null
                    && isCellDisconnectable(cells[i], src,
                        true))
                {
                  while (src != null && !hash.contains(src))
                  {
                    src = model.getParent(src);
                  }

                  if (src == null)
                  {
                    mxPoint pt = state.getAbsolutePoint(0);
                    geo.setTerminalPoint(
                        new mxPoint(pt.getX() / scale
                            - tr.getX() + dx, pt
                            .getY()
                            / scale
                            - tr.getY() + dy), true);
                    model.setTerminal(cells[i], null, true);
                  }
                }

                Object trg = model.getTerminal(cells[i], false);

                if (trg != null
                    && isCellDisconnectable(cells[i], trg,
                        false))
                {
                  while (trg != null && !hash.contains(trg))
                  {
                    trg = model.getParent(trg);
                  }

                  if (trg == null)
                  {
                    int n = state.getAbsolutePointCount() - 1;
                    mxPoint pt = state.getAbsolutePoint(n);
                    geo.setTerminalPoint(
                        new mxPoint(pt.getX() / scale
                            - tr.getX() + dx, pt
                            .getY()
                            / scale
                            - tr.getY() + dy),
View Full Code Here

Examples of com.mxgraph.model.mxGeometry

    if (targetState != null)
    {
      ((mxICell) targetState.getCell()).insertEdge(cell, false);
    }

    mxGeometry geo = graph.getCellGeometry(previewState.getCell());

    geo.setTerminalPoint(startPoint, true);
    geo.setTerminalPoint(transformScreenPoint(x, y), false);

    revalidate(graph.getView().getState(graph.getDefaultParent()),
        previewState.getCell());
    fireEvent(new mxEventObject(mxEvent.CONTINUE, "event", e, "x", x, "y",
        y));
View Full Code Here

Examples of com.mxgraph.model.mxGeometry

    {
      for (int i = 0; i < cells.length; i++)
      {
        if (getModel().isVertex(cells[i]))
        {
          mxGeometry geo = getCellGeometry(cells[i]);

          if (result == null)
          {
            result = new mxRectangle(geo);
          }
View Full Code Here

Examples of com.mxgraph.model.mxGeometry

   * @param cell Cell whose locked state should be returned.
   * @return Returns true if the given cell is locked.
   */
  public boolean isCellLocked(Object cell)
  {
    mxGeometry geometry = model.getGeometry(cell);

    return isCellsLocked()
        || (geometry != null && model.isVertex(cell) && geometry
            .isRelative());
  }
View Full Code Here

Examples of com.mxgraph.model.mxGeometry

      else
      {
        // Clones the cell state and updates the absolute points using
        // the current state of this handle. This is required for
        // computing the correct perimeter points and edge style.
        mxGeometry geometry = graphComponent.getGraph()
            .getCellGeometry(state.getCell());
        mxCellState clone = (mxCellState) state.clone();
        List<mxPoint> points = geometry.getPoints();
        mxGraphView view = clone.getView();

        if (isSource || isTarget)
        {
          marker.process(e);
View Full Code Here

Examples of com.mxgraph.model.mxGeometry

   * Moves the edges control point with the given index to the given point.
   */
  protected void movePoint(Object edge, int pointIndex, mxPoint point)
  {
    mxIGraphModel model = graphComponent.getGraph().getModel();
    mxGeometry geometry = model.getGeometry(edge);

    if (geometry != null)
    {
      model.beginUpdate();
      try
      {
        geometry = (mxGeometry) geometry.clone();

        if (isSource(index) || isTarget(index))
        {
          connect(edge, null, isSource(index), false);
          geometry.setTerminalPoint(point, isSource(index));
        }
        else
        {
          List<mxPoint> pts = geometry.getPoints();

          if (pts == null)
          {
            pts = new ArrayList<mxPoint>();
            geometry.setPoints(pts);
          }

          if (pts != null)
          {
            if (pointIndex <= pts.size())
View Full Code Here

Examples of com.mxgraph.model.mxGeometry

   */
  protected void moveLabelTo(mxCellState edgeState, double x, double y)
  {
    mxGraph graph = graphComponent.getGraph();
    mxIGraphModel model = graph.getModel();
    mxGeometry geometry = model.getGeometry(state.getCell());

    if (geometry != null)
    {
      geometry = (mxGeometry) geometry.clone();

      // Resets the relative location stored inside the geometry
      mxPoint pt = graph.getView().getRelativePoint(edgeState, x, y);
      geometry.setX(pt.getX());
      geometry.setY(pt.getY());

      // Resets the offset inside the geometry to find the offset
      // from the resulting point
      double scale = graph.getView().getScale();
      geometry.setOffset(new mxPoint(0, 0));
      pt = graph.getView().getPoint(edgeState, geometry);
      geometry.setOffset(new mxPoint(Math.round((x - pt.getX()) / scale),
          Math.round((y - pt.getY()) / scale)));

      model.setGeometry(edgeState.getCell(), geometry);
    }
  }
View Full Code Here

Examples of com.mxgraph.model.mxGeometry

     * Prints out some useful information about the cell in the tooltip.
     */
    public String getToolTipForCell(Object cell)
    {
      String tip = "<html>";
      mxGeometry geo = getModel().getGeometry(cell);
      mxCellState state = getView().getState(cell);

      if (getModel().isEdge(cell))
      {
        tip += "points={";

        if (geo != null)
        {
          List<mxPoint> points = geo.getPoints();

          if (points != null)
          {
            Iterator<mxPoint> it = points.iterator();

            while (it.hasNext())
            {
              mxPoint point = it.next();
              tip += "[x=" + numberFormat.format(point.getX())
                  + ",y=" + numberFormat.format(point.getY())
                  + "],";
            }

            tip = tip.substring(0, tip.length() - 1);
          }
        }

        tip += "}<br>";
        tip += "absPoints={";

        if (state != null)
        {

          for (int i = 0; i < state.getAbsolutePointCount(); i++)
          {
            mxPoint point = state.getAbsolutePoint(i);
            tip += "[x=" + numberFormat.format(point.getX())
                + ",y=" + numberFormat.format(point.getY())
                + "],";
          }

          tip = tip.substring(0, tip.length() - 1);
        }

        tip += "}";
      }
      else
      {
        tip += "geo=[";

        if (geo != null)
        {
          tip += "x=" + numberFormat.format(geo.getX()) + ",y="
              + numberFormat.format(geo.getY()) + ",width="
              + numberFormat.format(geo.getWidth()) + ",height="
              + numberFormat.format(geo.getHeight());
        }

        tip += "]<br>";
        tip += "state=[";

View Full Code Here

Examples of com.mxgraph.model.mxGeometry

      else if (cell != currentRoot && parentState != null)
      {
        state.getAbsoluteOffset().setX(0);
        state.getAbsoluteOffset().setY(0);
        state.setOrigin(new mxPoint(parentState.getOrigin()));
        mxGeometry geo = graph.getCellGeometry(cell);

        if (geo != null)
        {
          if (!model.isEdge(cell))
          {
            mxPoint origin = state.getOrigin();
            mxPoint offset = geo.getOffset();

            if (offset == null)
            {
              offset = EMPTY_POINT;
            }

            if (geo.isRelative())
            {
              origin.setX(origin.getX() + geo.getX()
                  * parentState.getWidth() / scale
                  + offset.getX());
              origin.setY(origin.getY() + geo.getY()
                  * parentState.getHeight() / scale
                  + offset.getY());
            }
            else
            {
              state.setAbsoluteOffset(new mxPoint(scale
                  * offset.getX(), scale * offset.getY()));
              origin.setX(origin.getX() + geo.getX());
              origin.setY(origin.getY() + geo.getY());
            }
          }

          // Updates the cell state's bounds
          state.setX(scale
              * (translate.getX() + state.getOrigin().getX()));
          state.setY(scale
              * (translate.getY() + state.getOrigin().getY()));
          state.setWidth(scale * geo.getWidth());
          state.setHeight(scale * geo.getHeight());

          if (model.isVertex(cell))
          {
            updateVertexLabelOffset(state);
          }
View Full Code Here

Examples of com.mxgraph.model.mxGeometry

    if (state != null)
    {
      if (state.isInvalid())
      {
        mxGeometry geo = graph.getCellGeometry(cell);

        if (geo != null && model.isEdge(cell))
        {
          // Updates the points on the source terminal if its an edge
          mxCellState source = getState(getVisibleTerminal(cell, true));

          if (source != null && model.isEdge(source.getCell())
              && !model.isAncestor(source, cell))
          {
            mxCellState tmp = getState(model.getParent(source
                .getCell()));
            validatePoints(tmp, source);
          }

          // Updates the points on the source terminal if its an edge
          mxCellState target = getState(getVisibleTerminal(cell,
              false));

          if (target != null && model.isEdge(target.getCell())
              && !model.isAncestor(target, cell))
          {
            mxCellState tmp = getState(model.getParent(target
                .getCell()));
            validatePoints(tmp, target);
          }

          updateFixedTerminalPoints(state, source, target);
          updatePoints(state, geo.getPoints(), source, target);
          updateFloatingTerminalPoints(state, source, target);
          updateEdgeBounds(state);
          state.setAbsoluteOffset(getPoint(state, geo));
        }
        else if (geo != null && geo.isRelative() && parentState != null
            && model.isEdge(parentState.getCell()))
        {
          mxPoint origin = getPoint(parentState, geo);

          if (origin != null)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.