Examples of FreedomPoint


Examples of it.freedomotic.model.geometry.FreedomPoint

    @Test
    public void testIntersects4() {
        System.out.println("Intersects overlapping polygins with edge collision (expected true)");

        FreedomPolygon source = new FreedomPolygon();
        source.append(new FreedomPoint(0, 0));
        source.append(new FreedomPoint(100, 0));
        source.append(new FreedomPoint(100, 50));
        source.append(new FreedomPoint(0, 50));

        FreedomPolygon target = new FreedomPolygon();
        target.append(new FreedomPoint(5, 5));
        target.append(new FreedomPoint(75, -25));
        target.append(new FreedomPoint(75, 75));
        target.append(new FreedomPoint(50, 75));

        boolean expResult = true;
        boolean result = TopologyUtils.intersects(source, target);
        assertEquals(expResult, result);
    }
View Full Code Here

Examples of it.freedomotic.model.geometry.FreedomPoint

    @Test
    public void testContains() {
        System.out.println("Check if a polygon A contains polygon B");

        FreedomPolygon source = new FreedomPolygon();
        source.append(new FreedomPoint(0, 0));
        source.append(new FreedomPoint(100, 0));
        source.append(new FreedomPoint(100, 50));
        source.append(new FreedomPoint(0, 50));

        FreedomPoint inside = new FreedomPoint(25, 25);
        FreedomPoint onBorder = new FreedomPoint(25, 0);
        FreedomPoint outside = new FreedomPoint(200, 200);
        assertEquals(true,
                TopologyUtils.contains(source, inside));
        assertEquals(false,
                TopologyUtils.contains(source, onBorder));
        assertEquals(false,
View Full Code Here

Examples of it.freedomotic.model.geometry.FreedomPoint

    public FreedomPoint getOffset() {
        return this.offset;
    }

    public void setOffset(int x, int y) {
        setOffset(new FreedomPoint(x, y));
    }
View Full Code Here

Examples of it.freedomotic.model.geometry.FreedomPoint

            if (canGo(x, y)) {
                validPos = true;
            }
        }

        return new FreedomPoint(x, y);
    }
View Full Code Here

Examples of it.freedomotic.model.geometry.FreedomPoint

    protected void onRun() {
        for (EnvObjectLogic object : EnvObjectPersistence.getObjectList()) {
            if (object instanceof it.freedomotic.objects.impl.Person) {
                Person person = (Person) object;
                FreedomPoint location = randomLocation();
                person.getPojo().getCurrentRepresentation()
                        .setOffset((int) location.getX(), (int) location.getY());
                person.setChanged(true);
            }
        }
    }
View Full Code Here

Examples of it.freedomotic.model.geometry.FreedomPoint

            if (zone.getPojo().isRoom()) {
                Point mouse = toRealCoords(p);
                onZone =
                        TopologyUtils.contains(zone.getPojo().getShape(),
                        new FreedomPoint((int) mouse.getX(), (int) mouse.getY()));

                if (onZone == true) {
                    return zone;
                }
            }
View Full Code Here

Examples of it.freedomotic.model.geometry.FreedomPoint

                for (Handle handle : handles) {
                    //move the zone point
                    if (handle.isSelected()) {
                        if (null == originalHandleLocation) {
                            originalHandleLocation = new FreedomPoint(handle.getPoint().getX(), handle.getPoint().getY());
                        }
                        handle.move(xSnapped, ySnapped);
                        addIndicator(TopologyUtils.convertToAWT(selectedZone.getPojo().getShape()));
                        // add indicators for overlapping zones
                        selectedZone = handle.getZone();
View Full Code Here

Examples of it.freedomotic.model.geometry.FreedomPoint

        if (forZone != null) { //create for all zones

            Iterator<FreedomPoint> it = forZone.getPojo().getShape().getPoints().iterator();

            while (it.hasNext()) {
                FreedomPoint corner = (FreedomPoint) it.next();
                handles.add(new Handle(forZone, corner));
            }
        } else {
            for (ZoneLogic zone : currEnv.getZones()) {
                Iterator<FreedomPoint> it = zone.getPojo().getShape().getPoints().iterator();

                while (it.hasNext()) {
                    FreedomPoint corner = (FreedomPoint) it.next();
                    handles.add(new Handle(zone, corner));
                }
            }
        }
View Full Code Here

Examples of it.freedomotic.model.geometry.FreedomPoint

  //Helper class to transform from a FreedomPolygon to a Path
  public static Path2D freedomPolygonToPath(FreedomPolygon fp)
  {
    Path2D mP = new Path2D.Double();
    for (int j = 0; j < fp.getPoints().size(); j++) {
      FreedomPoint point= fp.getPoints().get(j);
      if (j== 0)
        mP.moveTo(point.getX(), point.getY());
      else
        mP.lineTo(point.getX(), point.getY());           
    }           
    //closing the path
    mP.closePath();
 
    return mP;
View Full Code Here

Examples of it.freedomotic.model.geometry.FreedomPoint

    public FreedomPoint getOffset() {
        return this.offset;
    }

    public void setOffset(int x, int y) {
        setOffset(new FreedomPoint(x, y));
    }
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.