Examples of Curve


Examples of org.opengis.geometry.primitive.Curve

    private Surface readPolygonText(StreamTokenizer tokenizer) throws IOException, ParseException {
        String nextToken = getNextEmptyOrOpener(tokenizer);
        if (nextToken.equals(EMPTY)) {
            return null;
        }
        Curve curve = readLinearRingText(tokenizer);
        List curveList = Collections.singletonList(curve);
        Ring shell = primitiveFactory.createRing(curveList);
        //Ring shell = readLinearRingText(tokenizer);
        List holes = new ArrayList();
        nextToken = getNextCloserOrComma(tokenizer);
        while (nextToken.equals(COMMA)) {
          Curve holecurve = readLinearRingText(tokenizer);
            List holeList = Collections.singletonList(holecurve);
            Ring hole = primitiveFactory.createRing(holeList);
            //Ring hole = readLinearRingText(tokenizer);
            holes.add(hole);
            nextToken = getNextCloserOrComma(tokenizer);
View Full Code Here

Examples of org.sbml.jsbml.ext.layout.Curve

      if (graphicalObject instanceof ReactionGlyph)
      {
        ReactionGlyph reactionGlyph = (ReactionGlyph) graphicalObject;

        if (elementName.equals(curve)) {
          Curve curve = new Curve();
          reactionGlyph.setCurve(curve);

          return curve;
        }
        else if (elementName.equals(listOfSpeciesReferenceGlyphs))
        {
          ListOf<SpeciesReferenceGlyph> list = reactionGlyph.getListOfSpeciesReferenceGlyphs();
          return list;
        }

      }
      else if (graphicalObject instanceof SpeciesReferenceGlyph)
      {
        SpeciesReferenceGlyph speciesRefGlyph = (SpeciesReferenceGlyph) contextObject;

        if (elementName.equals(curve)) {
          Curve curve = new Curve();
          speciesRefGlyph.setCurve(curve);

          return curve;
        }

      }
      else if (graphicalObject instanceof GeneralGlyph)
      {
        GeneralGlyph generalGlyph = (GeneralGlyph) graphicalObject;

        if (elementName.equals(curve)) {
          Curve curve = new Curve();
          generalGlyph.setCurve(curve);

          return curve;
        }
        else if (elementName.equals(listOfSubGlyphs))
        {
          ListOf<GraphicalObject> list = generalGlyph.getListOfSubGlyphs();
          return list;
        }
        else if (elementName.equals(listOfReferenceGlyphs))
        {
          ListOf<ReferenceGlyph> list = generalGlyph.getListOfReferenceGlyphs();
          return list;
        }

      }
      else if (graphicalObject instanceof ReferenceGlyph)
      {
        ReferenceGlyph refGlyph = (ReferenceGlyph) contextObject;

        if (elementName.equals(curve)) {
          Curve curve = new Curve();
          refGlyph.setCurve(curve);

          return curve;
        }
      }

    }
    else if (contextObject instanceof BoundingBox)
    {
      BoundingBox bbox = (BoundingBox) contextObject;

      if (elementName.equals(position)) {
        Position position = new Position();
        bbox.setPosition(position);

        return position;
      }
      else if (elementName.equals(dimensions)) {
        Dimensions dimension = new Dimensions();
        bbox.setDimensions(dimension);

        return dimension;
      }
    }
    else if (contextObject instanceof Curve) {
      Curve curve = (Curve) contextObject;
      SBase newElement = null;

      if (elementName.equals(listOfCurveSegments)) {

        newElement = curve.getListOfCurveSegments();
      }

      if (newElement != null) {
        return newElement;
      }
View Full Code Here

Examples of org.sbml.jsbml.ext.layout.Curve

          return o instanceof Curve;
        }
      });

      for (TreeNode curveNode : curveElements) {
        Curve curve = (Curve) curveNode;

        // transform the CubicBezier into LineSegment when needed
        int i = 0;
        for (CurveSegment curveSegment : curve.getListOfCurveSegments().clone())
        {
          if (! curveSegment.isSetType())
          {
            if (((CubicBezier) curveSegment).isSetBasePoint1() || ((CubicBezier) curveSegment).isSetBasePoint2())
            {
              // trick to set the 'type' attribute, although the setType method is not visible.
              curveSegment.readAttribute("type", "", CurveSegment.Type.CUBIC_BEZIER.toString());
            }
            else
            {
              curveSegment.readAttribute("type", "", CurveSegment.Type.LINE_SEGMENT.toString());
            }
          }

          if (curveSegment.getType().equals(CurveSegment.Type.LINE_SEGMENT))
          {
            LineSegment realCurveSegment = new LineSegment(curveSegment);
            logger.debug("Transformed CubicBezier: " + curveSegment + " into a LineSegment.");
            curve.getListOfCurveSegments().remove(i);
            curve.getListOfCurveSegments().add(i, realCurveSegment);
          }

          if (logger.isDebugEnabled())
          {
            logger.debug("CurveSegment = " + curve.getListOfCurveSegments().get(i));
          }

          i++;
        }
      }
View Full Code Here

Examples of org.sbml.jsbml.ext.layout.Curve

        }
      });

      for (TreeNode curveNode : curveElements)
      {
        Curve curve = (Curve) curveNode;

        // transform the CubicBezier into LineSegment
        int i = 0;
        for (CurveSegment curveSegment : curve.getListOfCurveSegments().clone())
        {
          // Making sure the type attribute is set
          if (! curveSegment.isSetType())
          {
            if (((CubicBezier) curveSegment).isSetBasePoint1() || ((CubicBezier) curveSegment).isSetBasePoint2())
            {
              // trick to set the 'type' attribute, although the setType method is not visible.
              curveSegment.readAttribute("type", "", CurveSegment.Type.CUBIC_BEZIER.toString());
            }
            else
            {
              curveSegment.readAttribute("type", "", CurveSegment.Type.LINE_SEGMENT.toString());
            }
          }

          if (curveSegment.getType().equals(CurveSegment.Type.LINE_SEGMENT))
          {
            LineSegment realCurveSegment = new LineSegment(curveSegment);
            setNamespace(realCurveSegment, namespaceURI);
            logger.debug("Transformed CubicBezier: " + curveSegment + " into LineSegment.");
            curve.getListOfCurveSegments().remove(i);
            curve.getListOfCurveSegments().add(i, realCurveSegment);
          }

          if (logger.isDebugEnabled())
          {
            logger.debug("Transformed CurveSegment: realCurveSegment = " + curve.getListOfCurveSegments().get(i));
          }

          i++;
        }
      }
View Full Code Here

Examples of org.sbml.jsbml.ext.layout.Curve

          }
        } else if (contextObject instanceof ReactionGlyph) {
          ReactionGlyph reactionGlyph = (ReactionGlyph) contextObject;
          if (elementName.equals("curve")
              && groupList.equals(LayoutList.listOfReactionGlyphs)) {
            Curve curve = (Curve) newContextObject;
            setNamespace(curve, namespaceURI);
            reactionGlyph.setCurve(curve);
            return curve;
          } else if (elementName
              .equals("listOfSpeciesReferenceGlyphs")
              && groupList.equals(LayoutList.listOfReactionGlyphs)) {
            ListOf<SpeciesReferenceGlyph> listOfSpeciesReferenceGlyphs = (ListOf<SpeciesReferenceGlyph>) newContextObject;
            listOfSpeciesReferenceGlyphs.setSBaseListType(ListOf.Type.other);
            reactionGlyph.setListOfSpeciesReferencesGlyph(listOfSpeciesReferenceGlyphs);
            groupList = LayoutList.listOfSpeciesReferenceGlyphs;
            return listOfSpeciesReferenceGlyphs;
          } else if (elementName.equals("boundingBox")) {
            BoundingBox boundingBox = (BoundingBox) newContextObject;
            setNamespace(boundingBox, namespaceURI);
            reactionGlyph.setBoundingBox(boundingBox);
            return boundingBox;
          }
        } else if (contextObject instanceof SpeciesGlyph) {
          SpeciesGlyph speciesGlyph = (SpeciesGlyph) contextObject;
          if (elementName.equals("boundingBox")) {
            BoundingBox boundingBox = (BoundingBox) newContextObject;
            setNamespace(boundingBox, namespaceURI);
            speciesGlyph.setBoundingBox(boundingBox);
            return boundingBox;
          }
        } else if (contextObject instanceof CompartmentGlyph) {
          if (elementName.equals("boundingBox")
              && groupList.equals(LayoutList.listOfCompartmentGlyphs)) {
            CompartmentGlyph compartmentGlyph = (CompartmentGlyph) contextObject;
            BoundingBox boundingBox = (BoundingBox) newContextObject;
            setNamespace(boundingBox, namespaceURI);
            compartmentGlyph.setBoundingBox(boundingBox);
            return boundingBox;
          }
        } else if (contextObject instanceof TextGlyph) {
          if (elementName.equals("boundingBox")
              && groupList.equals(LayoutList.listOfTextGlyphs)) {
            TextGlyph textGlyph = (TextGlyph) contextObject;
            BoundingBox boundingBox = (BoundingBox) newContextObject;
            setNamespace(boundingBox, namespaceURI);
            textGlyph.setBoundingBox(boundingBox);
            return boundingBox;
          }
        } else if (contextObject instanceof Curve) {
          if (elementName.equals("listOfCurveSegments")
              && groupList.equals(LayoutList.listOfReactionGlyphs)) {
            Curve curve = (Curve) contextObject;
            ListOf<CurveSegment> listOfCurveSegments = (ListOf<CurveSegment>) newContextObject;
            listOfCurveSegments.setSBaseListType(ListOf.Type.other);
            setNamespace(listOfCurveSegments, namespaceURI);
            curve.setListOfCurveSegments(listOfCurveSegments);
            groupList = LayoutList.listOfReactionGlyphs;
            return listOfCurveSegments;
          } else if (elementName.equals("listOfCurveSegments")
              && groupList.equals(LayoutList.listOfSpeciesReferenceGlyphs)) {
            Curve curve = (Curve) contextObject;
            ListOf<CurveSegment> listOfCurveSegments = (ListOf<CurveSegment>) newContextObject;
            listOfCurveSegments.setSBaseListType(ListOf.Type.other);
            setNamespace(listOfCurveSegments, namespaceURI);
            curve.setListOfCurveSegments(listOfCurveSegments);
            groupList = LayoutList.listOfSpeciesReferenceGlyphs;
            return listOfCurveSegments;
          }
        } else if (contextObject instanceof BoundingBox) {
          BoundingBox boundingBox = (BoundingBox) contextObject;
          if (elementName.equals("position")) {
            Point point = (Point) newContextObject;
            setNamespace(point, namespaceURI);
            boundingBox.setPosition(point);
            return point;
          } else if (elementName.equals("dimensions")) {
            Dimensions dimensions = (Dimensions) newContextObject;
            setNamespace(dimensions, namespaceURI);
            boundingBox.setDimensions(dimensions);
            return dimensions;
          }
        } else if (contextObject instanceof CurveSegment) {
          if (elementName.equals("start")) {
            CurveSegment lineSegment = (CurveSegment) contextObject;
            Point start = (Point) newContextObject;
            lineSegment.setStart(start);
            setNamespace(start, namespaceURI);
            return start;
          } else if (elementName.equals("end")) {
            CurveSegment lineSegment = (CurveSegment) contextObject;
            Point end = (Point) newContextObject;
            lineSegment.setEnd(end);
            setNamespace(end, namespaceURI);
            return end;
          } else if (elementName.equals("basePoint1")) {
            CubicBezier lineSegment = (CubicBezier) contextObject;

            BasePoint1 basePoint1 = (BasePoint1) newContextObject;
            lineSegment.setBasePoint1(basePoint1);
            setNamespace(basePoint1, namespaceURI);
            return basePoint1;
          } else if (elementName.equals("basePoint2")) {
            CubicBezier lineSegment = (CubicBezier) contextObject;
            BasePoint2 basePoint2 = (BasePoint2) newContextObject;
            lineSegment.setBasePoint2(basePoint2);
            setNamespace(basePoint2, namespaceURI);
            return basePoint2;
          }
        } else if (contextObject instanceof SpeciesReferenceGlyph
            && groupList.equals(LayoutList.listOfSpeciesReferenceGlyphs)) {
          SpeciesReferenceGlyph speciesReferenceGlyph = (SpeciesReferenceGlyph) contextObject;
          if (elementName.equals("curve")) {
            Curve curve = (Curve) newContextObject;
            speciesReferenceGlyph.setCurve(curve);
            setNamespace(curve, namespaceURI);
            return curve;
          } else if (elementName.equals("boundingBox")) {
            BoundingBox boundingBox = (BoundingBox) newContextObject;
View Full Code Here

Examples of org.sbml.jsbml.ext.render.Curve

        return g;
      }
    }

    else if (contextObject instanceof Curve) {
      Curve curve = (Curve) contextObject;
      SBase newElement = null;

      if (elementName.equals(RenderConstants.listOfElements)) {
        newElement = curve.getListOfElements();
      }

      if (newElement != null) {
        curve.registerChild(newElement);
        return newElement;
      }
    }

    else if (contextObject instanceof GradientBase) {
View Full Code Here

Examples of sun.awt.geom.Curve

      return true;
  }
  if (size > 3) {
      return false;
  }
  Curve c1 = (Curve) curves.get(1);
  Curve c2 = (Curve) curves.get(2);
  if (c1.getOrder() != 1 || c2.getOrder() != 1) {
      return false;
  }
  if (c1.getXTop() != c1.getXBot() || c2.getXTop() != c2.getXBot()) {
      return false;
  }
  if (c1.getYTop() != c2.getYTop() || c1.getYBot() != c2.getYBot()) {
      // One might be able to prove that this is impossible...
      return false;
  }
  return true;
    }
View Full Code Here

Examples of sun.awt.geom.Curve

  if (cachedBounds != null) {
      return cachedBounds;
  }
  Rectangle2D r = new Rectangle2D.Double();
  if (curves.size() > 0) {
      Curve c = (Curve) curves.get(0);
      // First point is always an order 0 curve (moveto)
      r.setRect(c.getX0(), c.getY0(), 0, 0);
      for (int i = 1; i < curves.size(); i++) {
    ((Curve) curves.get(i)).enlarge(r);
      }
  }
  return (cachedBounds = r);
View Full Code Here

Examples of sun.awt.geom.Curve

      return false;
  }
  Enumeration enum_ = curves.elements();
  int crossings = 0;
  while (enum_.hasMoreElements()) {
      Curve c = (Curve) enum_.nextElement();
      crossings += c.crossingsFor(x, y);
  }
  return ((crossings & 1) == 1);
    }
View Full Code Here

Examples of sun.awt.geom.Curve

        if (cachedBounds != null) {
            return cachedBounds;
        }
        Rectangle2D r = new Rectangle2D.Double();
        if (curves.size() > 0) {
            Curve c = (Curve) curves.get(0);
            // First point is always an order 0 curve (moveto)
            r.setRect(c.getX0(), c.getY0(), 0, 0);
            for (int i = 1; i < curves.size(); i++) {
                ((Curve) curves.get(i)).enlarge(r);
            }
        }
        return (cachedBounds = r);
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.