Package gml4u.model

Examples of gml4u.model.GmlStroke


   * Ends recording of all GmlStroke
   */
  public void endStrokes() {
    LOGGER.log(Level.FINEST, "Stop recording");
    for (int sessionID : strokes.keySet()) {
      GmlStroke stroke = strokes.get(sessionID);
      // Add the stroke only if significant (at least a certain length)
      if (null != stroke && stroke.getLength() > minStrokeLength) {
        gml.addStroke(stroke);
      }     
    }
    strokes.clear();
  }
View Full Code Here


    // TODO layers absolute and relative
    ArrayList<GmlStroke> list = new ArrayList<GmlStroke>();

    for (Element element: elements) {
      // Get the GmlStroke
      GmlStroke stroke = getGmlStroke(element);
      list.add(stroke);
    }
    return list;
  }
View Full Code Here

  private static GmlStroke getGmlStroke(Element element) {

    // TODO brush merge only if brushes are the same kind
    // TODO have a "reset brush" parameter
   
    GmlStroke gmlStroke = new GmlStroke();

    // Get isDrawing value
    try {
      String isDrawing =  element.getAttributeValue("isDrawing");
      if (isDrawing.equalsIgnoreCase("false")) {
        gmlStroke.setIsDrawing(false);
      }
    }
    catch (Exception ex) {
    }

    try {
      String layer =  element.getAttributeValue("layer");
      gmlStroke.setLayer(Integer.parseInt(layer));
    }
    catch (Exception ex) {
      gmlStroke.setLayer(Integer.MIN_VALUE);
    }

    // Get info
    GmlInfo gmlInfo = new GmlInfo();
    Element infoElement = element.getChild("info");
    if (null != infoElement) {
      setGmlGenericContainer(infoElement.getChildren(), gmlInfo);
    }
    gmlStroke.setInfo(gmlInfo);

    // Get Brush
    GmlBrush gmlBrush = new GmlBrush();
    Element brushElement = element.getChild("brush");
    if (null != brushElement) {
      setGmlGenericContainer(brushElement.getChildren(), gmlBrush);
    }
    gmlStroke.setBrush(gmlBrush);
   
    // Get points
    List<Element> points = element.getChildren("pt");
    List<GmlPoint> gmlPoints = getGmlPoints(points);

    gmlStroke.addPoints(gmlPoints);
    return gmlStroke;
  }
View Full Code Here

TOP

Related Classes of gml4u.model.GmlStroke

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.