Package org.sbml.jsbml.ext.layout

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


      if (newElement != null) {
        return newElement;
      }
    }
    else if (contextObject instanceof CurveSegment) {
      CubicBezier curveSegment = (CubicBezier) contextObject;

      if (elementName.equals(start)) {
        Start point = new Start();
        curveSegment.setStart(point);

        return point;
      }
      else if (elementName.equals(end)) {
        End point = new End();
        curveSegment.setEnd(point);

        return point;
      }
      else if (elementName.equals(basePoint1)) {
        BasePoint1 point = new BasePoint1();
        curveSegment.setBasePoint1(point);

        return point;
      }
      else if (elementName.equals(basePoint2)) {
        BasePoint2 point = new BasePoint2();
        curveSegment.setBasePoint2(point);

        return point;
      }

    }
    else if (contextObject instanceof ListOf<?>) {
      ListOf<SBase> listOf = (ListOf<SBase>) contextObject;
      SBase newElement = null;

      if (elementName.equals(layout)) {
        newElement = new Layout();
      }
      else if (elementName.equals(compartmentGlyph)) {
        newElement = new CompartmentGlyph();
      }
      else if (elementName.equals(speciesGlyph)) {
        newElement = new SpeciesGlyph();
      }
      else if (elementName.equals(reactionGlyph)) {
        newElement = new ReactionGlyph();
      }
      else if (elementName.equals(textGlyph)) {
        newElement = new TextGlyph();
      }
      else if (elementName.equals(curveSegment) || elementName.equals("cubicBezier")
          || elementName.equals("lineSegment")) // to allow reading of not properly written XML, we add  "cubicBezier" and "lineSegment" here.
      {
        newElement = new CubicBezier(); //Always creating a CubicBezier instance until we know the exact 'type' of the curveElement !!
      }
      else if (elementName.equals(speciesReferenceGlyph)) {
        newElement = new SpeciesReferenceGlyph();
      }
      else if (elementName.equals(referenceGlyph)) {
View Full Code Here


              return speciesReferenceGlyph;
            }
          } else if (elementName.equals("curveSegment")
              && groupList.equals(LayoutList.listOfCurveSegments)) {
            ListOf<CurveSegment> listOfLineSegment = (ListOf<CurveSegment>) contextObject;
            CubicBezier lineSegment = (CubicBezier) newContextObject;
            setNamespace(lineSegment, namespaceURI);
            listOfLineSegment.add(lineSegment);
            groupList = LayoutList.listOfCurveSegments;
            return lineSegment;
          } else if (listOf.getParentSBMLObject() instanceof Curve) {

            if (elementName.equals("curveSegment") || elementName.equals("cubicBezier")
                || elementName.equals("lineSegment"))
            {
              ListOf<CurveSegment> listOfLineSegment = (ListOf<CurveSegment>) contextObject;
              CubicBezier lineSegment = (CubicBezier) newContextObject;
              setNamespace(lineSegment, namespaceURI);
              listOfLineSegment.add(lineSegment);
              return lineSegment;
            }
          }

        } else if (contextObject instanceof Layout) {
          Layout layout = (Layout) contextObject;
          groupList = LayoutList.listOfLayouts;
          if (elementName.equals("dimensions")
              && groupList.equals(LayoutList.listOfLayouts)) {
            Dimensions dimensions = (Dimensions) newContextObject;
            setNamespace(dimensions, namespaceURI);
            layout.setDimensions(dimensions);
            return dimensions;
          } else if (elementName.equals("listOfCompartmentGlyphs")
              && groupList.equals(LayoutList.listOfLayouts)) {
            ListOf<CompartmentGlyph> listOfCompartmentGlyphs = (ListOf<CompartmentGlyph>) newContextObject;
            listOfCompartmentGlyphs.setSBaseListType(ListOf.Type.other);
            layout.setListOfCompartmentGlyphs(listOfCompartmentGlyphs);
            groupList = LayoutList.listOfCompartmentGlyphs;
            return listOfCompartmentGlyphs;
          } else if (elementName.equals("listOfSpeciesGlyphs")
              && groupList.equals(LayoutList.listOfLayouts)) {
            ListOf<SpeciesGlyph> listofSpeciesGlyph = (ListOf<SpeciesGlyph>) newContextObject;
            listofSpeciesGlyph.setSBaseListType(ListOf.Type.other);
            layout.setListOfSpeciesGlyphs(listofSpeciesGlyph);
            groupList = LayoutList.listOfSpeciesGlyphs;
            return listofSpeciesGlyph;
          } else if (elementName.equals("listOfReactionGlyphs")
              && groupList.equals(LayoutList.listOfLayouts)) {
            ListOf<ReactionGlyph> listOfReactionGlyphs = (ListOf<ReactionGlyph>) newContextObject;
            listOfReactionGlyphs.setSBaseListType(ListOf.Type.other);
            layout.setListOfReactionGlyphs(listOfReactionGlyphs);
            groupList = LayoutList.listOfReactionGlyphs;
            return listOfReactionGlyphs;
          } else if (elementName.equals("listOfTextGlyphs")
              && groupList.equals(LayoutList.listOfLayouts)) {
            ListOf<TextGlyph> listOfTextGlyphs = (ListOf<TextGlyph>) newContextObject;
            listOfTextGlyphs.setSBaseListType(ListOf.Type.other);
            layout.setListOfTextGlyphs(listOfTextGlyphs);
            groupList = LayoutList.listOfTextGlyphs;
            return listOfTextGlyphs;
          }
        } 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)) {
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.ext.layout.CubicBezier

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.