Package org.graphstream.ui.graphicGraph.stylesheet

Examples of org.graphstream.ui.graphicGraph.stylesheet.Values


     *            The max ordinate of the area.
     * @return True if the node lies in the given area.
     */
    protected boolean isNodeIn(GraphicNode node, double X1, double Y1,
                               double X2, double Y2) {
        Values size = node.getStyle().getSize();
        double w2 = metrics.lengthToPx(size, 0) / 2;
        double h2 = size.size() > 1 ? metrics.lengthToPx(size, 1) / 2 : w2;
        Point2D.Double src = new Point2D.Double(node.getX(), node.getY());
        boolean vis = true;

        Tx.transform(src, src);

View Full Code Here


            return false;
        } else if (sprite.isAttachedToEdge()
            && !isEdgeVisible(sprite.getEdgeAttachment())) {
            return false;
        } else {
            Values size = sprite.getStyle().getSize();
            double w2 = metrics.lengthToPx(size, 0) / 2;
            double h2 = size.size() > 1 ? metrics.lengthToPx(size, 1) / 2 : w2;
            Point2D.Double src = spritePositionPx(sprite);// new Point2D.Double(
            // sprite.getX(),
            // sprite.getY() );

            // Tx.transform( src, src );
View Full Code Here

     * @param y
     *            The point ordinate.
     * @return True if (x,y) is in the given element.
     */
    protected boolean nodeContains(GraphicElement elt, double x, double y) {
        Values size = elt.getStyle().getSize();
        double w2 = metrics.lengthToPx(size, 0) / 2;
        double h2 = size.size() > 1 ? metrics.lengthToPx(size, 1) / 2 : w2;
        Point2D.Double src = new Point2D.Double(elt.getX(), elt.getY());
        Point2D.Double dst = new Point2D.Double();

        Tx.transform(src, dst);

View Full Code Here

     * @param y
     *            The point ordinate.
     * @return True if (x,y) is in the given element.
     */
    protected boolean spriteContains(GraphicElement elt, double x, double y) {
        Values size = elt.getStyle().getSize();
        double w2 = metrics.lengthToPx(size, 0) / 2;
        double h2 = size.size() > 1 ? metrics.lengthToPx(size, 1) / 2 : w2;
        Point2D.Double dst = spritePositionPx((GraphicSprite) elt); // new
        // Point2D.Double(
        // elt.getX(),
        // elt.getY()
        // );
View Full Code Here

    }
  }

  protected double evalEllipseRadius(GraphicEdge edge, GraphicNode node0,
      GraphicNode node1, Camera camera) {
    Values size = node1.getStyle().getSize();
    double w = camera.getMetrics().lengthToGu(size.get(0), size.getUnits());
    double h = size.size() > 1 ? camera.getMetrics().lengthToGu(
        size.get(1), size.getUnits()) : w;

    w /= 2;
    h /= 2;
       
    if (w == h)
View Full Code Here

    public String getPath(Element e, SVGStyle style) {
      StringBuilder buffer = new StringBuilder();

      if (e instanceof Node) {
        double sx, sy;
        Values size = style.group.getSize();

        sx = getValue(size.get(0), size.units, true);

        if (size.getValueCount() > 1)
          sy = getValue(size.get(1), size.units, false);
        else
          sy = getValue(size.get(0), size.units, false);

        switch (style.group.getShape()) {
        case ROUNDED_BOX:
          double rx,
          ry;
View Full Code Here

        x4 = Math.max(x4, getX(n));
        y4 = Math.max(y4, getY(n));
      }

      Values v = style.getPadding();

      if (v.getValueCount() > 0) {
        padding[0] = v.get(0);
        padding[1] = v.getValueCount() > 1 ? v.get(1) : v.get(0);
      }
    }
View Full Code Here

      if (values.length == 4) {
        if (values[0] instanceof Number && values[1] instanceof Number
            && values[2] instanceof Number
            && values[3] instanceof Style.Units) {
          return new Values((Style.Units) values[3],
              ((Number) values[0]).floatValue(),
              ((Number) values[1]).floatValue(),
              ((Number) values[2]).floatValue());
        } else {
          logger.warning("Cannot parse values[4] for sprite position.");
        }
      } else if (values.length == 3) {
        if (values[0] instanceof Number && values[1] instanceof Number
            && values[2] instanceof Number) {
          return new Values(Units.GU,
              ((Number) values[0]).floatValue(),
              ((Number) values[1]).floatValue(),
              ((Number) values[2]).floatValue());
        } else {
                    logger.warning("Cannot parse values[3] for sprite position.");
        }
      } else if (values.length == 1) {
        if (values[0] instanceof Number) {
          return new Values(Units.GU,
              ((Number) values[0]).floatValue());
        } else {
          logger.warning(String.format("Sprite position percent is not a number."));
        }
      } else {
        logger.warning(String.format("Cannot transform value '%s' (length=%d) into a position.", Arrays.toString(values), values.length));
      }
    } else if (value instanceof Number) {
      return new Values(Units.GU, ((Number) value).floatValue());
    } else if (value instanceof Value) {
      return new Values((Value) value);
    } else if (value instanceof Values) {
      return new Values((Values) value);
    } else {
      System.err
          .printf("GraphicGraph : cannot place sprite with posiiton '%s' (instance of %s)%n",
              value, value.getClass().getName());
    }
View Full Code Here

      if (spriteId.indexOf('.') < 0) {
        if (getSprite(spriteId) == null) {
          // A sprite has been created by another entity.
          // Synchronise this manager.

          Values position = null;

          if (value != null)
            position = getPositionValue(value);

          try {
View Full Code Here

        if (s != null) {
          // The sprite has been moved by another entity.
          // Update its position.

          if (newValue != null) {
            Values position = getPositionValue(newValue);
            s.setPosition(position);
          } else {
                        logger.warning(String.format("%s changed but newValue == null ! (old=%s).", spriteId, oldValue));
          }
        } else {
View Full Code Here

TOP

Related Classes of org.graphstream.ui.graphicGraph.stylesheet.Values

Copyright © 2018 www.massapicom. 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.