public static List<Point> parsePoints(String str) { final List<Point> points = new ArrayList<Point>(); PointsParser pp = new PointsParser(); PointsHandler ph = new DefaultPointsHandler() { public void point(float x, float y) throws ParseException { SmartPointI sp = new SmartPointI(); sp.setX(rdouble(x)); sp.setY(rdouble(y)); points.add(sp); } }; pp.setPointsHandler(ph); pp.parse(str); return points; }
/** * Parses the current stream. */ protected void doParse() throws ParseException, IOException { pointsHandler.startPoints(); current = reader.read(); skipSpaces(); loop: for (;;) { if (current == -1) { break loop; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pointsHandler.point(x, y); skipCommaSpaces(); } pointsHandler.endPoints(); } }
/** * Creates a new AnimatablePointListValueFactory. */ public AnimatablePointListValueFactory() { parser.setPointsHandler(producer); }
/** * Creates a new AnimatableValue from a string. */ public AnimatableValue createValue(AnimationTarget target, String ns, String ln, boolean isCSS, String s) { try { parser.parse(s); return new AnimatablePointListValue(target, producer.getFloatArray()); } catch (ParseException e) { // XXX Do something better than returning null. return null; } }
/** * Parses the current stream. */ protected void doParse() throws ParseException, IOException { pointsHandler.startPoints(); current = reader.read(); skipSpaces(); loop: for (;;) { if (current == -1) { break loop; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pointsHandler.point(x, y); skipCommaSpaces(); } pointsHandler.endPoints(); } }
/** * Creates a new AnimatablePointListValueFactory. */ public AnimatablePointListValueFactory() { parser.setPointsHandler(producer); }
/** * Creates a new AnimatableValue from a string. */ public AnimatableValue createValue(AnimationTarget target, String ns, String ln, boolean isCSS, String s) { try { parser.parse(s); return new AnimatablePointListValue(target, producer.getFloatArray()); } catch (ParseException e) { // XXX Do something better than returning null. return null; } }
public static String parsePointsToPath(String str, boolean close) { final StringBuilder sb = new StringBuilder(); final boolean[] first = new boolean[] { true }; PointsParser pp = new PointsParser(); PointsHandler ph = new DefaultPointsHandler() { public void point(float x, float y) throws ParseException { first[0] = appendSegment(sb, first[0], x, y); } }; pp.setPointsHandler(ph); pp.parse(str); return sb.toString(); }
/** * Parses the current stream. */ protected void doParse() throws ParseException, IOException { pointsHandler.startPoints(); current = reader.read(); skipSpaces(); loop: for (;;) { if (current == -1) { break loop; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pointsHandler.point(x, y); skipCommaSpaces(); } pointsHandler.endPoints(); } }
/** * Creates a new AnimatablePointListValueFactory. */ public AnimatablePointListValueFactory() { parser.setPointsHandler(producer); }
/** * Creates a new AnimatableValue from a string. */ public AnimatableValue createValue(AnimationTarget target, String ns, String ln, boolean isCSS, String s) { try { parser.parse(s); return new AnimatablePointListValue(target, producer.getFloatArray()); } catch (ParseException e) { // XXX Do something better than returning null. return null; } }
/** * Parses the 'points' attribute. * * @param value 'points' attribute value * @param handler point list handler */ protected void doParse(String value, ListHandler handler) throws ParseException { PointsParser pointsParser = new PointsParser(); PointsListBuilder builder = new PointsListBuilder(handler); pointsParser.setPointsHandler(builder); pointsParser.parse(value); }
/** * Parses the 'points' attribute. * * @param value 'points' attribute value * @param handler point list handler */ protected void doParse(String value, ListHandler handler) throws ParseException { PointsParser pointsParser = new PointsParser(); PointsListBuilder builder = new PointsListBuilder(handler); pointsParser.setPointsHandler(builder); pointsParser.parse(value); }
/** * Utility method for creating an ExtendedGeneralPath. * @param r The reader used to read the path specification. * @param wr The winding rule to use for creating the path. */ public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolylineProducer ph = new AWTPolylineProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }
/** * Utility method for creating an ExtendedGeneralPath. * @param r The reader used to read the path specification. * @param wr The winding rule to use for creating the path. */ public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolylineProducer ph = new AWTPolylineProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }
/** * Utility method for creating an ExtendedGeneralPath. * @param r The reader used to read the path specification. * @param wr The winding rule to use for creating the path. */ public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolygonProducer ph = new AWTPolygonProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }
/** * Utility method for creating an ExtendedGeneralPath. * @param r The reader used to read the path specification. * @param wr The winding rule to use for creating the path. */ public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolylineProducer ph = new AWTPolylineProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }
/** * Utility method for creating an ExtendedGeneralPath. * @param r The reader used to read the path specification. * @param wr The winding rule to use for creating the path. */ public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolygonProducer ph = new AWTPolygonProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }
/** * Utility method for creating an ExtendedGeneralPath. * @param r The reader used to read the path specification. * @param wr The winding rule to use for creating the path. */ public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolygonProducer ph = new AWTPolygonProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }