Examples of GML


Examples of gml4u.model.Gml

    assertTrue("normalized origin", gml.environment.normalizedOriginShift.equalsWithTolerance(new Vec3D(-0.12499998f, -0.06250001f, -0.31249997f), .000001f));
    assertTrue("normalized aspect ratio", gml.environment.normalizedAspectRatio.equalsWithTolerance(new Vec3D(1f, 0.81249994f, 1f), .0000001f));
  }
 
  public void testNormalizeAllSmaller() {
    Gml gml = new Gml();

    GmlStroke stroke = new GmlStroke();
    stroke.addPoint(new GmlPoint(new Vec3D(.2f, .1f, .25f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(.6f, .2f, .3f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(.9f, .8f, .8f), .04f, 1, new Vec3D(), new Vec3D()));
    stroke.setLayer(0);
    gml.addStroke(stroke);
   
    GmlUtils.normalize(gml);

    assertTrue("bounds", GmlUtils.isNormalized(gml));
    assertTrue("origin", gml.environment.originalOriginShift.equalsWithTolerance(new Vec3D(.2f, .1f, .25f), 0.0000001f));
View Full Code Here

Examples of gml4u.model.Gml

    assertTrue("normalized origin", gml.environment.normalizedOriginShift.equalsWithTolerance(new Vec3D(0.2857143f, 0.14285715f, 0.3571429f), .000001f));
    assertTrue("normalized aspect ratio", gml.environment.normalizedAspectRatio.equalsWithTolerance(new Vec3D(1f, 1f, 0.7857143f), .0000001f));
  }
   
  public void testNormalizeAllShiftedAhead() {
    Gml gml = new Gml();

    GmlStroke stroke = new GmlStroke();
    stroke.addPoint(new GmlPoint(new Vec3D(.2f, .1f, .25f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(.6f, .2f, .3f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(1.3f, 1.25f, 1.8f), .04f, 1, new Vec3D(), new Vec3D()));
    stroke.setLayer(0);
    gml.addStroke(stroke);
   
    GmlUtils.normalize(gml);
   
    assertTrue("bounds", GmlUtils.isNormalized(gml));
    assertTrue("origin", gml.environment.originalOriginShift.equalsWithTolerance(new Vec3D(0.19999999f, 0.100000024f, .25f), 0.000001f));
View Full Code Here

Examples of gml4u.model.Gml

    assertTrue("normalized origin", gml.environment.normalizedOriginShift.equalsWithTolerance(new Vec3D(0.12903225f, 0.06451615f, 0.16129033f), .000001f));
    assertTrue("normalized aspect ratio", gml.environment.normalizedAspectRatio.equalsWithTolerance(new Vec3D(0.7096774f, 0.7419355f, 1f), .0000001f));
  }
 
  public void testNormalizeAllShiftedBefore() {
    Gml gml = new Gml();

    GmlStroke stroke = new GmlStroke();
    stroke.addPoint(new GmlPoint(new Vec3D(-.2f, -.1f, -.25f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(.6f, .2f, .3f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(.7f, .7f, .6f), .04f, 1, new Vec3D(), new Vec3D()));
    stroke.setLayer(0);
    gml.addStroke(stroke);
   
    GmlUtils.normalize(gml);
   
    assertTrue("bounds", GmlUtils.isNormalized(gml));
    assertTrue("origin", gml.environment.originalOriginShift.equalsWithTolerance(new Vec3D(-.2f, -.1f, -.25f), 0.0000001f));
View Full Code Here

Examples of gml4u.model.Gml

      try {
        if (fileList.size() > 0) {
          LOGGER.log(Level.FINEST, "Start parsing: "+fileList.size()+ "files");
         
          for (String fileName : fileList) {
            Gml gml = GmlParsingHelper.getGml(fileName, normalize);
            if (null != gml && null !=callback) {
              try {
                // Call the method with this object as the argument!
                LOGGER.log(Level.FINEST, "Invoking callback");
                callback.invoke(parent, new GmlParsingEvent(gml) );
View Full Code Here

Examples of gml4u.model.Gml

   * @param screen - Vec3D (srceen dimensions)
   * @param minStrokeLength - int (minimum length of the stroke)
   * @param minPointsDistance - flaot (minimum distance between two points of the same stroke)
   */
  public GmlRecorder(final Vec3D screen, float minStrokeLength, float minPointsDistance) {
    gml = new Gml();
    initGml(screen);

    this.minStrokeLength = minStrokeLength;
    this.minPointsDistance = minPointsDistance;
  }
View Full Code Here

Examples of gml4u.model.Gml

  /**
   * Returns a copy of the Gml including the strokes under drawing
   * @return Gml
   */
  public Gml getGml() {
    Gml gmlCopy = gml.copy();
    gml.addStrokes(strokes.values());
    return gmlCopy;
  }
View Full Code Here

Examples of gml4u.model.Gml

   */
  public static Gml getGml(String file, boolean normalize) {

    LOGGER.log(Level.FINEST, "Parsing from file: "+ file);

    Gml gml = parseGml(file, true);
    gml = cleanGml(gml, normalize);
   
    return gml;

  }
View Full Code Here

Examples of gml4u.model.Gml

  * @return Gml
  */
  public static Gml getGmlFromString(String inputString, boolean normalize) {
    LOGGER.log(Level.FINEST, "Parsing from String");
   
    Gml gml = parseGml(inputString, false);
    gml = cleanGml(gml, normalize);
   
    return gml;
  }
View Full Code Here

Examples of gml4u.model.Gml

   * @param file - String
   * @return Gml
   */
  @SuppressWarnings("unchecked")
  private static Gml parseGml(String input, boolean isFile) {
    Gml gml = null;
   
    // TODO return null if the gml is a file and its path or type is incorrect

    // TODO xsd validation ???

    // Get document
    Document document = getDocument(input, isFile);
    String root = "/*[name()='GML' or name()='gml']";

    // Get version
    Element rootNode = (Element) JDomParsingUtils.selectSingleNode(document, root);
    String version = rootNode.getAttributeValue("spec");

    // TODO parsing factory with version

    String expression = root+"/tag/header/client/child::*";
    List<Element> elements = (List<Element>) JDomParsingUtils.selectNodes(document, expression);

    gml = new Gml();

   
    // Get Client
    GmlClient client = new GmlClient();
    if (null != elements) {
      setGmlGenericContainer(elements, client);
    }
    gml.client = client;

   
    // Get Environment
    if (null == version || version.equalsIgnoreCase("0.1a") || version.equalsIgnoreCase("0.1b")) {
      expression = root+"/tag/environment/child::*";
    }
    else {
      expression = root+"/tag/header/environment/child::*";
    }

    elements = (List<Element>) JDomParsingUtils.selectNodes(document, expression);
    GmlEnvironment environment = getGmlEnvironment(elements);
    gml.environment = environment;

    // TODO loop through all tags or skip multiple tags

    // Get Drawing
    expression = root+"/tag/drawing/child::*";
    elements = (List<Element>) JDomParsingUtils.selectNodes(document, expression);

    ArrayList<GmlStroke> gmlStrokes = new ArrayList<GmlStroke>();
    gmlStrokes.addAll(getGmlDrawing(elements));
    gml.addStrokes(gmlStrokes);

    return gml;
  }
View Full Code Here

Examples of org.geotools.GML

    try {
      String url = formatGetFeatureInfoUrl(bestResolution.getTileWidthPx(), bestResolution.getTileHeightPx(),
          layerBox, x, y);
      log.debug("getFeaturesByLocation: {} {} {} {}",
          new Object[] {layerCoordinate, layerScale, pixelTolerance, url});
      GML gml = new GML(Version.GML3);

      stream = httpService.getStream(url, getAuthentication());
      FeatureCollection<?, SimpleFeature> collection = gml.decodeFeatureCollection(stream);
      FeatureIterator<SimpleFeature> it = collection.features();

      while (it.hasNext()) {
        features.add(toDto(it.next()));
      }
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.